Re: [PATCH 2/3] ASoC: wm8962: add GPIO interrupt controller support
From: Laurentiu Mihalcea
Date: Tue Dec 01 2026 - 17:35:58 EST
On 11/30/2026 1:25 PM, Charles Keepax wrote:
> On Fri, Nov 27, 2026 at 07:00:38PM +0200, Laurentiu Mihalcea wrote:
>> From: Laurentiu Mihalcea <laurentiu.mihalcea@xxxxxxx>
>>
>> The WM8962 codec provides two GPIO pins: GPIO5/GPIO6 which can act as
>> interrupt sources. Therefore, in the context of Linux, GPIO consumer
>> devices (e.g. in this case, the sound card), could make use of these two
>> pins to handle certain events (e.g. HP detection).
>>
>> Add support for this by modelling the WM8962 codec as a GPIO interrupt
>> controller.
>>
>> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@xxxxxxx>
>> ---
> Should this not have some sort of mechanism to enable/disable
> this functionality? This is a fairly old part presumably there
> are many systems that already exist, seems bold to assume all of
> them have connected those GPIOs in this way.
Hm, I think you've raised a very good concern. I think this feature already
depends on the fact that the user has chosen to configure GPIO5/GPIO6
as GPIO inputs (via gpio-cfg). Otherwise, I don't think they should be generating IRQs.
I'm basing this thought on two things:
1) This quote from the datasheet:
"""
GPIO5 and GPIO6 pins can be configured as GPIO inputs can be used to trigger an
Interrupt event.
"""
2) In our case, GPIO6 is configured as DMIC DATA input. So far, I don't remember
seeing any interrupts misfiring? Not sure if this point is valid though as I might
have just missed them?
That being said, I don't think having a mechanism to enable/disable this feature
would be a bad idea as it would give users more control and maybe protect us
against some weird configurations that would somehow end up triggering the
IRQs?
The way I see this being done at the moment is with the IRQ mask()/unmask()/bus_sync()
callbacks. If you're OK with this, I can try to implement this for V2.
Thanks!