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]
Message-ID: <20200120193118.3vzwy5uxnsy2w4sv@pengutronix.de>
Date:   Mon, 20 Jan 2020 20:31:18 +0100
From:   Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>
To:     Miquel Raynal <miquel.raynal@...tlin.com>
Cc:     Thierry Reding <thierry.reding@...il.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>,
        linux-gpio@...r.kernel.org, linux-pwm@...r.kernel.org,
        Andy Shevchenko <andy.shevchenko@...il.com>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5] gpio: pca953x: Add Maxim MAX7313 PWM support

Hi Miquèl,

On Mon, Jan 20, 2020 at 04:38:22PM +0100, Miquel Raynal wrote:
> One dumb question that I still have is: besides any backward
> compatibility aspects, do we really care about the period/frequency of
> the PWM? Why do we enforce a period and an active duration, while
> we could limit ourselves to a ratio and let the driver use the most
> suitable frequency if the hardware supports it?

There are situations where just fixing the ratio would (nearly) be good
enough. For example if you drive an LED just requesting a ratio might
look fine at first glance. But 

	.period = 5000 ms, .duty_cycle = 2500 ms

has quite a different effect than

	.period = 500 ns, .duty_cycle = 250 ns

while both are valid if you requested 50%.

Having said that I think the lowlevel API (i.e. what a device driver has
to implement) is sane, as it allows to implement all possible requests,
even if there might be a consumer that cares more about the absolute
value of duty-cycle than the duty-cycle/period ratio; and it matches
what most hardware models implement. There is usually a register to
specify the period and one to specify the duty-cycle.

And on top of that (at least once there is pwm_round_state()) you can
implement all sort of helper functions that implement for example "best
effort 50% with a period < 2ms".

Best regards
Uwe

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ