Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pwm: Check actual period and duty_cycle for ignored polarity test

When a lowlevel driver configures the wrong period that might
(historically) be ok if the emitted signal has a 100% relative duty_cycle
as that just corresponds to rounding down the duty_cycle to 0 which is an
allowed thing to do for a lowlevel driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/bc511c0250ea2f6390e4209ab1ea9c08a3c18612.1751994988.git.u.kleine-koenig@baylibre.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>

authored by

Uwe Kleine-König and committed by
Uwe Kleine-König
b871d093 5364e70b

+1 -1
+1 -1
drivers/pwm/core.c
··· 536 536 } 537 537 538 538 if (s2.polarity != state->polarity && 539 - state->duty_cycle < state->period) 539 + s2.duty_cycle < s2.period) 540 540 dev_warn(pwmchip_parent(chip), ".apply ignored .polarity\n"); 541 541 542 542 if (last->polarity == state->polarity &&