OSDN Git Service

pwm: omap-dmtimer: Add sanity checking for load and match values
authorDavid Rivshin <drivshin@allworx.com>
Sat, 30 Jan 2016 04:26:52 +0000 (23:26 -0500)
committerThierry Reding <thierry.reding@gmail.com>
Wed, 23 Mar 2016 16:11:46 +0000 (17:11 +0100)
commitcd378881426379a62a7fe67f34b8cbe738302022
treea8753c450bfb1c1124ee7f32b6a74d17a58b9529
parentf8caa792261c0edded20eba2b8fcc899a1b91819
pwm: omap-dmtimer: Add sanity checking for load and match values

Add sanity checking to ensure that we do not program load or match values
that are out of range if a user requests period or duty_cycle values which
are not achievable. The match value cannot be less than the load value (but
can be equal), and neither can be 0xffffffff. This means that there must be
at least one fclk cycle between load and match, and another between match
and overflow.

Fixes: 6604c6556db9 ("pwm: Add PWM driver for OMAP using dual-mode timers")
Signed-off-by: David Rivshin <drivshin@allworx.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
[thierry.reding@gmail.com: minor coding style cleanups]
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-omap-dmtimer.c