public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Maxime Ripard <maxime@cerno.tech>
Cc: Andreas Feldner <andreas@feldner-bv.de>,
	Andreas Feldner <pelzi@flying-snail.de>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Chen-Yu Tsai <wens@csie.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Samuel Holland <samuel@sholland.org>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ARM: dts: allwinner: minimize irq debounce filter per default
Date: Fri, 10 Feb 2023 09:44:25 +0000	[thread overview]
Message-ID: <20230210094425.474cfba5@donnerap.cambridge.arm.com> (raw)
In-Reply-To: <20230210082936.qefzz4fsp3jpalvp@houat>

On Fri, 10 Feb 2023 09:29:36 +0100
Maxime Ripard <maxime@cerno.tech> wrote:

Hi Maxime,

thanks for the reply!

> On Thu, Feb 09, 2023 at 08:29:52PM +0000, Andre Przywara wrote:
> > > >>   &pio {
> > > >> +	/* 1�s debounce filter on both IRQ banks */  
> > > > Is that supposed to be <micro> in UTF-8? It seems to have got lost in
> > > > translation, or is that just me?  
> > > O yes, the Greek character slipped into the comment.  
> > > >> +	input-debounce = <1 1>;  
> > > > As mentioned above, I am not so sure this is generic enough to put it
> > > > here for PA. And what is the significance of "1 us", in particular? Is
> > > > that just the smallest value?    
> > > 
> > > Yes indeed it's a bit more complicated than I feel it needs to be. The
> > > configuration is taken as microseconds and translated into the best
> > > matching clock and divider by the driver. However, 0 is not translated
> > > to the lowest divider of the high speed clock as would be logical if
> > > you ask for zero microseconds, but to "leave at default". The default
> > > of the board is 0 in the register, translating to lowest divider on the
> > > _low_ speed clock.  
> > 
> > I'd say the "if (!debounce) continue;" code is just to defend against
> > the division by zero, which would be the next statement to execute.
> > 
> > We might want to change that to interpret 0 as "lowest possible", which
> > would be 24MHz/1. Please feel free to send a patch in this regard, and
> > CC: Maxime, to get some input on that idea.  
> 
> I never had any complaint on that part either, so the default looks sane
> to me.
> 
> If some board needs a higher debouncing rate, then we should obviously
> set it up in the device tree of that board, but changing it for every
> user also introduces the risk of breaking other boards that actually
> require a lower debouncing frequency.

Yeah, we definitely should keep the default at 32KHz/1, as this is also
the hardware reset value.

Not sure if you were actually arguing this, but the change I sketched
above (interpreting 0 as 24MHz/1) is separate though, as the current
default is "no DT property", and not 0. There is no input-debounce
property user in the kernel tree at the moment, so we wouldn't break
anyone. The only thing that would change is if a downstream user was
relying on "0" being interpreted as "skip the setup", which isn't
really documented and could be argued to be an implementation detail.

So I'd suggest to implement 0 as "lowest possible", and documenting that
and the 32KHz/1 default if no property is given.

> And any default is always going to be debated, there's one, it seems to
> create little controversy, it seems to work in most case, I'd just stick
> with it.

Agreed.

Cheers,
Andre.

> 
> > > To me this is mindboggling.
> > > 
> > > If you want to keep IRQ bank A as it is today and switch off the
> > > definitely unnecessary (and _potentially_ IRQ eating) debounce off
> > > for bank G only, I'd suggest the following setting:
> > > 
> > >      input-debounce = <31 1>;  
> > 
> > It should be documented that the effective default is 31, I guess the
> > binding is the right place.  
> 
> Yeah, if the documentation is lacking, we should definitely improve it.
> 
> Maxime


  reply	other threads:[~2023-02-10  9:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-06 19:51 [PATCH] ARM: dts: allwinner: minimize irq debounce filter per default Andreas Feldner
2023-02-07  1:16 ` Andre Przywara
2023-02-08 12:50   ` Andreas Feldner
2023-02-09 20:29     ` Andre Przywara
2023-02-10  8:29       ` Maxime Ripard
2023-02-10  9:44         ` Andre Przywara [this message]
2023-02-10 10:06           ` Maxime Ripard
2023-02-10 10:18             ` Andre Przywara
2023-02-11 12:50               ` pelzi
2023-02-11 15:13                 ` Andre Przywara
2023-02-11 18:08                   ` [PATCH] pinctrl: sunxi: set minimal debounce on input-debounce 0 Andreas Feldner
2023-02-11 19:59                     ` Andre Przywara
2023-02-13  8:43               ` [PATCH] ARM: dts: allwinner: minimize irq debounce filter per default Maxime Ripard
2023-02-13  8:49                 ` pelzi
2023-02-13  9:18                   ` Maxime Ripard
2023-02-13 11:56                     ` Andre Przywara
2023-02-14 18:49                       ` pelzi
2023-02-15  8:36                       ` Maxime Ripard
2023-02-11 19:45       ` Samuel Holland
2023-02-13  1:51         ` Andre Przywara

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=20230210094425.474cfba5@donnerap.cambridge.arm.com \
    --to=andre.przywara@arm.com \
    --cc=andreas@feldner-bv.de \
    --cc=devicetree@vger.kernel.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=maxime@cerno.tech \
    --cc=pelzi@flying-snail.de \
    --cc=robh+dt@kernel.org \
    --cc=samuel@sholland.org \
    --cc=wens@csie.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox