diff options
author | Jeff LaBundy <jeff@labundy.com> | 2021-01-18 22:30:29 -0600 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2021-02-22 15:18:50 +0100 |
commit | 28208c7b4a2c38ea91b6ee04f6023d3145257f5d (patch) | |
tree | 3b7f44b5dc811fe3931bb4ef54ac18122bcd0166 /lib | |
parent | 72d6b2459dbd539c1369149e501fdc3dc8ddef16 (diff) |
pwm: iqs620a: Correct a stale state variable
If duty cycle is first set to a value that is sufficiently high to
enable the output (e.g. 10000 ns) but then lowered to a value that
is quantized to zero (e.g. 1000 ns), the output is disabled as the
device cannot drive a constant zero (as expected).
However if the device is later re-initialized due to watchdog bite,
the output is re-enabled at the next-to-last duty cycle (10000 ns).
This is because the iqs620_pwm->out_en flag unconditionally tracks
state->enabled instead of what was actually written to the device.
To solve this problem, use one state variable that encodes all 257
states of the output (duty_scale) with 0 representing tri-state, 1
representing the minimum available duty cycle and 256 representing
100% duty cycle.
Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions