lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 27 Oct 2020 11:42:26 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Coiby Xu <coiby.xu@...il.com>
Cc:     "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Linus Walleij <linus.walleij@...aro.org>,
        Hans de Goede <hdegoede@...hat.com>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] pinctrl: amd: print debounce filter info in debugfs

On Tue, Oct 27, 2020 at 1:16 AM Coiby Xu <coiby.xu@...il.com> wrote:
> On Mon, Oct 26, 2020 at 05:22:45PM +0200, Andy Shevchenko wrote:
> >On Mon, Oct 26, 2020 at 5:16 PM Coiby Xu <coiby.xu@...il.com> wrote:

...

> >> +                               if (tmr_large) {
> >> +                                       if (tmr_out_unit)
> >> +                                               unit = 62500;
> >> +                                       else
> >
> >> +                                               unit = 15600;
> >
> >Side note: Hmm... Shouldn't be 15625? As 1/4.
>
> Thank you for discovering the inconsistency! I wrote these code based on
> amd_gpio_set_debounce. I'll send an email to the original author to
> confirm it.
>
> static int amd_gpio_set_debounce(struct gpio_chip *gc, unsigned offset,
>                 unsigned debounce)
> {
>      ...
>         if (debounce) {
>                 pin_reg |= DB_TYPE_REMOVE_GLITCH << DB_CNTRL_OFF;
>                 pin_reg &= ~DB_TMR_OUT_MASK;
>                 /*
>                 Debounce        Debounce        Timer   Max
>                 TmrLarge        TmrOutUnit      Unit    Debounce
>                                                         Time
>                 0       0       61 usec (2 RtcClk)      976 usec
>                 0       1       244 usec (8 RtcClk)     3.9 msec
>                 1       0       15.6 msec (512 RtcClk)  250 msec
>                 1       1       62.5 msec (2048 RtcClk) 1 sec
>                 */

What the heck with HW companies! (Just an emotion based on the experience)
They like to use really bad precision when it's clear that the numbers
should be different (note the cycles, it's 1/4 sharp ratio).

>                 if (debounce < 61) {
>                         pin_reg |= 1;
>                         pin_reg &= ~BIT(DB_TMR_OUT_UNIT_OFF);
>                         pin_reg &= ~BIT(DB_TMR_LARGE_OFF);
>                 } else if (debounce < 976) {
>                         time = debounce / 61;
>                         pin_reg |= time & DB_TMR_OUT_MASK;
>                         pin_reg &= ~BIT(DB_TMR_OUT_UNIT_OFF);
>                         pin_reg &= ~BIT(DB_TMR_LARGE_OFF);
>          ...
> >
> >> +                               } else {
> >> +                                       if (tmr_out_unit)
> >> +                                               unit = 244;
> >> +                                       else
> >> +                                               unit = 61;

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ