Hello Alexandre, On 8/16/19 10:43 PM, Alexandre Belloni wrote: > On 16/08/2019 11:37:48+0200, Uwe Kleine-König wrote: >> Signed-off-by: Uwe Kleine-König >> --- >> drivers/pwm/pwm-atmel.c | 10 ++++++++++ >> 1 file changed, 10 insertions(+) >> >> diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c >> index 42fe7bc043a8..1ddb93db9627 100644 >> --- a/drivers/pwm/pwm-atmel.c >> +++ b/drivers/pwm/pwm-atmel.c >> @@ -7,6 +7,16 @@ >> * >> * Reference manual for "atmel,at91sam9rl-pwm": >> * http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-11032-32-bit-ARM926EJ-S-Microcontroller-SAM9G25_Datasheet.pdf >> + * >> + * Limitations: >> + * - Periods start with the inactive level. >> + * - Hardware has to be stopped in general to update settings. >> + * >> + * Software bugs/possible improvements: >> + * - When atmel_pwm_apply() is called with state->enabled=false a change in >> + * state->polarity isn't honored. >> + * - Instead of sleeping to wait for a completed period, the interrupt >> + * functionality could be used. > > This is definitively not trivial to do right. The main reason it is not > done so is that reading PWM_ISR will clear all the bits so it is > necessary to be very careful to avoid race conditions. I'm not sure it > is worth the effort. I didn't intend to claim it is easy or even that it should be implemented. This was just what I noticed while reading through driver and manual. I thought it was a good idea to document that in case someone finds time and motivation to work on this driver. The first issue pointed out should however be easy to fix and IMHO is a real bug. (Though it's a corner case that hardly ever triggers.) Best regards Uwe