regulator: pwm: Support extra continuous mode cases
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 14 Jun 2016 09:13:21 +0000 (11:13 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Mon, 25 Jul 2016 13:34:06 +0000 (15:34 +0200)
commitea398e28739e25651ede7ddf5aeb57cbcbc8ca7d
treec01ed5831f0b7356c8106997f3787d0c83ac6cfb
parentd9070fdbe40a04b61262bac0f7ff0c7c29a68015
regulator: pwm: Support extra continuous mode cases

The continuous mode allows one to declare a PWM regulator without having
to declare the voltage <-> dutycycle association table. It works fine as
long as your voltage(dutycycle) function is linear, but also has the
following constraints:

- dutycycle for min_uV = 0%
- dutycycle for max_uV = 100%
- dutycycle for min_uV < dutycycle for max_uV

While the linearity constraint is acceptable for now, we sometimes need to
restrict of the PWM range (to limit the maximum/minimum voltage for
example) or have a min_uV_dutycycle > max_uV_dutycycle (this could be
tweaked with PWM polarity, but not all PWMs support inverted polarity).

Add the pwm-dutycycle-range and pwm-dutycycle-unit DT properties to define
such constraints. If those properties are not defined, the PWM regulator
use the default pwm-dutycycle-range = <0 100> and
pwm-dutycycle-unit = <100> values (existing behavior).

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/regulator/pwm-regulator.c