Thread (3 messages) 3 messages, 3 authors, 2021-10-29

Re: [PATCH v3] pwm: pwm-samsung: Trigger manual update when disabling PWM

From: Krzysztof Kozlowski <hidden>
Date: 2021-09-09 10:42:21
Also in: linux-pwm, linux-samsung-soc

On 09/09/2021 12:10, Mårten Lindahl wrote:
When duty-cycle is at full level (100%), the TCNTn and TCMPn registers
needs to be flushed in order to disable the signal. The PWM manual does
not say anything about this, but states that only clearing the TCON
auto-reload bit should be needed, and this seems to be true when the PWM
duty-cycle is not at full level. This can be observed on an Axis
ARTPEC-8, by running:

  echo <period> > pwm/period
  echo <period> > pwm/duty_cycle
  echo 1 > pwm/enable
  echo 0 > pwm/enable

Since the TCNTn and TCMPn registers are activated when enabling the PWM
(setting TCON auto-reload bit), and are not touched when disabling the
PWM, the double buffered auto-reload function seems to be still active.
Lowering duty-cycle, and restoring it again in between the enabling and
disabling, makes the disable work since it triggers a reload of the
TCNTn and TCMPn registers.

Fix this by securing a reload of the TCNTn and TCMPn registers when
disabling the PWM and having a full duty-cycle.

Signed-off-by: Mårten Lindahl <redacted>
---

v2:
 - Move fix above setting of disabled_mask

v3:
 - Move up definition of __pwm_samsung_manual_update to avoid
   declaration of the same

 drivers/pwm/pwm-samsung.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

Reviewed-by: Krzysztof Kozlowski <redacted>


Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help