OSDN Git Service

pwm: atmel: Rework tracking updates pending in hardware
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 21 Apr 2021 09:26:08 +0000 (11:26 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Thu, 2 Sep 2021 19:35:09 +0000 (21:35 +0200)
commit52eaba4cedbda728f78d7083a05725e537b3df91
tree4edab885befe2b3e8c35f954b48a602943d44425
parent2734d6c1b1a089fb593ef6a23d4b70903526fe0c
pwm: atmel: Rework tracking updates pending in hardware

This improves the driver's behavior in several ways:

 - The lock is held for shorter periods and so a channel that is currently
   waited for doesn't block disabling another channel.

 - It's easier to understand because the procedure is split into more
   semantic units and documentation is improved

 - A channel is only set to pending when such an event is actually
   scheduled in hardware (by writing the CUPD register).

 - Also wait in .get_state() to report the last configured state instead
   of (maybe) the previous one. This fixes the read back duty cycle and so
   prevents a warning being emitted when PWM_DEBUG is on.

Tested on an AriettaG25.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-atmel.c