From: Clark Wang <xiaoning.wang@xxxxxxx>the same patch has been submitted from other people in the past and they
When the SAR FIFO is empty, the write value is directly applied to SAR even
though the current period is not over. If the new SAR value is less than
the old one and the counter is greater than the new SAR value, the current
period will not flip the level. This result in a pulse with a 100% duty
cycle.
Write the old SAR value before updating the new duty cycle to SAR. This
avoids writing the new value into an empty FIFO.
This only resolves the issue when the PWM period is longer than 2us
(or <500KHz) because write register is not quick enough when PWM period is
very short.
Reviewed-by: Jun Li <jun.li@xxxxxxx>
Signed-off-by: Clark Wang <xiaoning.wang@xxxxxxx>
Signed-off-by: Frank Li <Frank.Li@xxxxxxx>