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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 22 Nov 2018 17:17:48 +0100
From:   Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>
To:     Thierry Reding <thierry.reding@...il.com>
Cc:     Vokáč Michal <Michal.Vokac@...ft.com>,
        Mark Rutland <mark.rutland@....com>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-pwm@...r.kernel.org" <linux-pwm@...r.kernel.org>,
        Lukasz Majewski <l.majewski@...ess.pl>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Rob Herring <robh+dt@...nel.org>,
        "kernel@...gutronix.de" <kernel@...gutronix.de>,
        Fabio Estevam <fabio.estevam@....com>,
        Lothar Waßmann <LW@...o-electronics.de>,
        Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [RCF PATCH,v2,2/2] pwm:
 imx: Configure output to GPIO in disabled state

Hello Thierry,

On Thu, Nov 22, 2018 at 04:03:38PM +0100, Thierry Reding wrote:
> On Sun, Nov 18, 2018 at 09:08:15PM +0100, Uwe Kleine-König wrote:
> > Thinking a bit about this it doesn't really matter for the consumer if
> > the pin stays in the idle level because there is a pull into the right
> > direction and the PWM is high-Z or if the PWM pulls actively in the
> > right direction. Also for pwm_config(pwm, 0, 100) the PWM could disable
> > its output in the presence of a pull, so the property says true that the
> > effects of pwm_config(pwm, 0, 100) and pwm_disable(pwm) should be the
> > same. And so my claim that pwm_disable is a part of the API that
> > doesn't give any value stays true.
> 
> I still think there's a slight difference there. Granted the effect on
> the consumer is the same whether you disable or set the duty-cycle to
> zero because the power output is the same. pwm_disable() is still more
> explicit, though, so it may involve more than just setting the duty-
> cycle.

If pwm_disable() vs. duty-cycle=0 doesn't make a difference to the
consumer, who do we do a favour by providing pwm_disable()?

> > > But again, why should PWMs be special? You turn off all other resources
> > > when you no longer need them, right? If you power your panel with a
> > > regulator, then when the panel is disabled you want to disable the
> > > regulator, right? Similarily if you don't use your I2C controller you
> > > want to turn off the clock that drives it, right? This is the same for
> > > any resource in your system: if you no longer need it, disable it. The
> > > fact that "disabling" the PWM is not straightforward on i.MX doesn't
> > > mean that we should simply ignore it.
> > 
> > I don't say we should ignore it. I say we shouldn't disable the hardware
> > if the consumer calls pwm_disable() if disabling the hardware results in
> > a state that shouldn't happen on pwm_disable().
> 
> That's backwards. If disabling the hardware results in a state that
> shouldn't happen when you disable the hardware, that just means that
> you're doing something wrong. When you do something wrong you fix it.

For you pwm_disable must imply disabling the PWM hardware. As you cannot
have both (disable the hardware and keep the pin on the idle level
without involving pinmux and GPIO) on i.MX in my eyes it is sensible to
drop one requirement from the framework's expectations to make it
possible for i.MX to fulfill them.

As there is no advantage for anyone to force .disable() to actually
disable the hardware (apart from a little power saving that probably
isn't even measurable) that's IMHO the one to drop.

> If the pin goes to the wrong level when you disable the hardware, the
> natural fix for the problem is to make sure the pin stays at the right
> level.

Ack. And you can do this either in an easy variant or in a more
complicated one.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ