Re: [PATCH] irqchip/loongson-liointc: Support to set IRQ_TYPE_EDGE_BOTH
From: Thomas Gleixner
Date: Tue Apr 08 2025 - 12:14:17 EST
On Tue, Apr 08 2025 at 20:37, Huacai Chen wrote:
> On Sun, Apr 6, 2025 at 10:20 PM Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>> This is the card change detection and it uses a GPIO. Insert raises one
>> edge and remove the opposite one.
>>
>> Which means whatever edge you chose randomly the detection will only
>> work in one direction. Please don't tell me that this is correct by any
>> meaning of correct. It's not.
>
> From experiments, either setting to EDGE_RISING or EDGE_FALLING, card
> detection (inserting and removing) works.
You might get lucky in that case because the switch bounces and there is
no debounce mechanism in place.
> Maybe the driver request "BOTH", but it really need "ANY"? I've
> searched git log, but I haven't get any useful information.
There is no maybe at all and speculation is not a technical argument.
It's well defined by the hardware:
Present ________________
| |
Not present _____| |_______________
How can you detect that with a single edge?
If the switch bounces then the signal is:
Present __ ___________ __
| | | | | |
Not present _____| |_| |_| |_______________
which makes it "work" by accident, but not by design.
There is ZERO guarantee that this will work with all other drivers which
request EDGE_BOTH.
Thanks,
tglx