All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Huacai Chen <chenhuacai@gmail.com>
Cc: Huacai Chen <chenhuacai@loongson.cn>,
	loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
	Xuefeng Li <lixuefeng@loongson.cn>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	stable@vger.kernel.org, Yinbo Zhu <zhuyinbo@loongson.cn>
Subject: Re: [PATCH] irqchip/loongson-liointc: Support to set IRQ_TYPE_EDGE_BOTH
Date: Tue, 08 Apr 2025 18:05:08 +0200	[thread overview]
Message-ID: <87cydmvdu3.ffs@tglx> (raw)
In-Reply-To: <CAAhV-H6tUvwN9UejTRf0zKXdhGG4o5X4ZOppE+1oQhL-rADFHg@mail.gmail.com>

On Tue, Apr 08 2025 at 20:37, Huacai Chen wrote:
> On Sun, Apr 6, 2025 at 10:20 PM Thomas Gleixner <tglx@linutronix.de> 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




      reply	other threads:[~2025-04-08 16:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-02  9:25 [PATCH] irqchip/loongson-liointc: Support to set IRQ_TYPE_EDGE_BOTH Huacai Chen
2025-04-03 15:48 ` Thomas Gleixner
2025-04-06  9:46   ` Huacai Chen
2025-04-06 10:18     ` Thomas Gleixner
2025-04-06 12:46       ` Huacai Chen
2025-04-06 14:19         ` Thomas Gleixner
2025-04-08 12:37           ` Huacai Chen
2025-04-08 16:05             ` Thomas Gleixner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cydmvdu3.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=chenhuacai@gmail.com \
    --cc=chenhuacai@loongson.cn \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lixuefeng@loongson.cn \
    --cc=loongarch@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=zhuyinbo@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.