Message ID | cover.1677547393.git.william.gray@linaro.org |
---|---|
Headers | show |
Series | Migrate PCIe-IDIO-24 GPIO driver to the regmap API | expand |
On Tue, Feb 28, 2023 at 07:09:50PM +0000, Mark Brown wrote: > On Mon, Feb 27, 2023 at 08:53:39PM -0500, William Breathitt Gray wrote: > > > A patch to pass the device regmap and irq_drv_data as a parameters for > > the struct regmap_irq_chip set_type_config() is included. This is needed > > by idio_24_set_type_config() in order to update the type configuration > > on the device as well as irq_drv_data for idio_24_handle_mask_sync(). > > The values from the config buffer are supposed to be written out in > regmap_irq_sync_unlock() - why is something custom needed here? The PCIe-IDIO-24 "COS Enable" serves a dual purpose of interrupt enabling/disabling as well as configuring the interrupt types. Since this register is used for masking, config buffer would clobber the register if we use it in this particular case. Instead, we ignore the config buffer and configure the type directly for the device (handling the case where interrupts are masked and shouldn't be enabled). William Breathitt Gray
On Tue, Feb 28, 2023 at 07:28:45PM +0000, Mark Brown wrote: > On Mon, Feb 27, 2023 at 09:19:28PM -0500, William Breathitt Gray wrote: > > On Tue, Feb 28, 2023 at 07:09:50PM +0000, Mark Brown wrote: > > > > The values from the config buffer are supposed to be written out in > > > regmap_irq_sync_unlock() - why is something custom needed here? > > > The PCIe-IDIO-24 "COS Enable" serves a dual purpose of interrupt > > enabling/disabling as well as configuring the interrupt types. Since > > this register is used for masking, config buffer would clobber the > > register if we use it in this particular case. Instead, we ignore the > > config buffer and configure the type directly for the device (handling > > the case where interrupts are masked and shouldn't be enabled). > > Could you be more concrete about what's going on here please? In what > way does this "COS Enable" serve these dual functions and why do they > clobber each other? An explanation of the device registers is provided in [PATCH 3/3]; here's the relevant portion: The COS Enable register is used to enable/disable interrupts and configure the interrupt levels; each bit maps to a group of eight inputs as described below: Bit 0: IRQ EN Rising Edge IN0-7 Bit 1: IRQ EN Rising Edge IN8-15 Bit 2: IRQ EN Rising Edge IN16-23 Bit 3: IRQ EN Rising Edge TTL0-7 Bit 4: IRQ EN Falling Edge IN0-7 Bit 5: IRQ EN Falling Edge IN8-15 Bit 6: IRQ EN Falling Edge IN16-23 Bit 7: IRQ EN Falling Edge TTL0-7 An interrupt is asserted when a change-of-state matching the interrupt level configuration respective for a particular group of eight inputs with enabled COS is detected. So in order to mask lines, the respective bits need to be set to 0. However, if we use the regmap-irq config buffer to set the type, this mask will be cloberred and the disabled lines become enabled. To prevent the clobber, we can save the type configuration to irq_drv_data for use later in handle_mask_sync() and then update the type in this COS Enable register only when the lines are unmasked. William Breathitt Gray
On Mon, Feb 27, 2023 at 08:53:39PM -0500, William Breathitt Gray wrote: > A patch to pass the device regmap and irq_drv_data as a parameters for > the struct regmap_irq_chip set_type_config() is included. This is needed > by idio_24_set_type_config() in order to update the type configuration > on the device as well as irq_drv_data for idio_24_handle_mask_sync(). The values from the config buffer are supposed to be written out in regmap_irq_sync_unlock() - why is something custom needed here?
On Mon, Feb 27, 2023 at 09:19:28PM -0500, William Breathitt Gray wrote: > On Tue, Feb 28, 2023 at 07:09:50PM +0000, Mark Brown wrote: > > The values from the config buffer are supposed to be written out in > > regmap_irq_sync_unlock() - why is something custom needed here? > The PCIe-IDIO-24 "COS Enable" serves a dual purpose of interrupt > enabling/disabling as well as configuring the interrupt types. Since > this register is used for masking, config buffer would clobber the > register if we use it in this particular case. Instead, we ignore the > config buffer and configure the type directly for the device (handling > the case where interrupts are masked and shouldn't be enabled). Could you be more concrete about what's going on here please? In what way does this "COS Enable" serve these dual functions and why do they clobber each other?