linux/drivers/pwm
Mårten Lindahl 5d82e66139 pwm: pwm-samsung: Trigger manual update when disabling PWM
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 <marten.lindahl@axis.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2021-11-05 11:51:42 +01:00
..
core.c pwm: Make it explicit that pwm_apply_state() might sleep 2021-11-05 11:51:41 +01:00
Kconfig pwm: samsung: Describe driver in Kconfig 2021-11-05 11:51:41 +01:00
Makefile pwm: Changes for v5.13-rc1 2021-05-05 12:53:16 -07:00
pwm-ab8500.c pwm: ab8500: Simplify using devm_pwmchip_add() 2021-09-02 21:38:40 +02:00
pwm-atmel-hlcdc.c pwm: atmel-hlcdc: Don't check the return code of pwmchip_remove() 2021-09-02 21:38:49 +02:00
pwm-atmel-tcb.c pwm: atmel-tcb: Don't check the return code of pwmchip_remove() 2021-09-02 21:38:50 +02:00
pwm-atmel.c pwm: atmel: Drop unused header 2021-11-05 11:51:40 +01:00
pwm-bcm2835.c pwm: Simplify all drivers with explicit of_pwm_n_cells = 3 2021-05-25 18:19:15 +02:00
pwm-bcm-iproc.c pwm: Simplify all drivers with explicit of_pwm_n_cells = 3 2021-05-25 18:19:15 +02:00
pwm-bcm-kona.c pwm: bcm-kona: Simplify using devm_pwmchip_add() 2021-09-02 21:38:40 +02:00
pwm-berlin.c pwm: berlin: Ensure configuring period and duty_cycle isn't wrongly skipped 2021-07-08 16:09:17 +02:00
pwm-brcmstb.c pwm: brcmstb: Don't check the return code of pwmchip_remove() 2021-09-02 21:38:50 +02:00
pwm-clps711x.c pwm: clps711x: Simplify using devm_pwmchip_add() 2021-06-28 13:23:11 +02:00
pwm-crc.c pwm: crc: Simplify using devm_pwmchip_add() 2021-06-28 13:25:04 +02:00
pwm-cros-ec.c pwm: cros-ec: Don't check the return code of pwmchip_remove() 2021-09-02 21:38:51 +02:00
pwm-dwc.c pwm: Always allocate PWM chip base ID dynamically 2021-03-22 11:53:00 +01:00
pwm-ep93xx.c pwm: ep93xx: Simplify using devm_pwmchip_add() 2021-09-02 21:38:41 +02:00
pwm-fsl-ftm.c pwm: fsl-ftm: Simplify using devm_pwmchip_add() 2021-09-02 21:38:41 +02:00
pwm-hibvt.c pwm: hibvt: Disable the clock only after the PWM was unregistered 2021-09-02 21:38:37 +02:00
pwm-img.c pwm: img: Don't check the return code of pwmchip_remove() 2021-09-02 21:38:51 +02:00
pwm-imx1.c pwm: imx1: Simplify using devm_pwmchip_add() 2021-06-28 13:24:45 +02:00
pwm-imx27.c pwm: imx27: Simplify using devm_pwmchip_add() 2021-09-02 21:38:42 +02:00
pwm-imx-tpm.c pwm: imx-tpm: Don't check the return code of pwmchip_remove() 2021-09-02 21:38:52 +02:00
pwm-intel-lgm.c pwm: intel-lgm: Simplify using devm_pwmchip_add() 2021-09-02 21:38:42 +02:00
pwm-iqs620a.c pwm: iqs620a: Simplify using devm_pwmchip_add() 2021-09-02 21:38:43 +02:00
pwm-jz4740.c pwm: jz4740: Simplify using devm_pwmchip_add() 2021-09-02 21:38:43 +02:00
pwm-keembay.c pwm: keembay: Simplify using devm_pwmchip_add() 2021-09-02 21:38:44 +02:00
pwm-lp3943.c pwm: lp3943: Simplify using devm_pwmchip_add() 2021-09-02 21:38:44 +02:00
pwm-lpc18xx-sct.c pwm: Simplify all drivers with explicit of_pwm_n_cells = 3 2021-05-25 18:19:15 +02:00
pwm-lpc32xx.c pwm: lpc32xx: Simplify using devm_pwmchip_add() 2021-09-02 21:38:44 +02:00
pwm-lpss-pci.c pwm: lpss: Simplify using devm_pwmchip_add() 2021-06-28 13:18:25 +02:00
pwm-lpss-platform.c pwm: lpss: Simplify using devm_pwmchip_add() 2021-06-28 13:18:25 +02:00
pwm-lpss.c pwm: lpss: Simplify using devm_pwmchip_add() 2021-06-28 13:18:25 +02:00
pwm-lpss.h pwm: lpss: Simplify using devm_pwmchip_add() 2021-06-28 13:18:25 +02:00
pwm-mediatek.c pwm: mediatek: Simplify using devm_pwmchip_add() 2021-09-02 21:38:45 +02:00
pwm-meson.c pwm: meson: Simplify using devm_pwmchip_add() 2021-06-28 13:22:07 +02:00
pwm-mtk-disp.c pwm: mtk-disp: Implement atomic API .get_state() 2021-09-02 22:27:46 +02:00
pwm-mxs.c pwm: mxs: Simplify using devm_pwmchip_add() 2021-09-02 21:38:45 +02:00
pwm-ntxec.c pwm: ntxec: Simplify using devm_pwmchip_add() 2021-09-02 21:38:46 +02:00
pwm-omap-dmtimer.c pwm: omap-dmtimer: Don't check the return code of pwmchip_remove() 2021-09-02 21:38:52 +02:00
pwm-pca9685.c pwm: pca9685: Don't check the return code of pwmchip_remove() 2021-09-02 21:38:53 +02:00
pwm-pxa.c pwm: pxa: Simplify using devm_pwmchip_add() 2021-09-02 21:38:46 +02:00
pwm-raspberrypi-poe.c pwm: raspberrypi-poe: Simplify using devm_pwmchip_add() 2021-09-02 21:38:47 +02:00
pwm-rcar.c pwm: rcar: Don't check the return code of pwmchip_remove() 2021-09-02 21:38:53 +02:00
pwm-renesas-tpu.c pwm: renesas-tpu: Don't check the return code of pwmchip_remove() 2021-09-02 21:38:54 +02:00
pwm-rockchip.c pwm: rockchip: Unprepare clocks only after the PWM was unregistered 2021-09-02 21:38:38 +02:00
pwm-samsung.c pwm: pwm-samsung: Trigger manual update when disabling PWM 2021-11-05 11:51:42 +01:00
pwm-sifive.c pwm: sifive: Don't check the return code of pwmchip_remove() 2021-09-02 21:38:55 +02:00
pwm-sl28cpld.c pwm: sl28cpld: Simplify using devm_pwmchip_add() 2021-09-02 21:38:47 +02:00
pwm-spear.c pwm: spear: Ensure configuring period and duty_cycle isn't wrongly skipped 2021-07-08 16:08:38 +02:00
pwm-sprd.c pwm: sprd: Ensure configuring period and duty_cycle isn't wrongly skipped 2021-07-08 16:08:08 +02:00
pwm-sti.c pwm: sti: Free resources only after pwmchip_remove() 2021-04-09 14:46:58 +02:00
pwm-stm32-lp.c pwm: stm32-lp: Simplify using devm_pwmchip_add() 2021-09-02 21:38:47 +02:00
pwm-stm32.c pwm: Simplify all drivers with explicit of_pwm_n_cells = 3 2021-05-25 18:19:15 +02:00
pwm-stmpe.c pwm: Always allocate PWM chip base ID dynamically 2021-03-22 11:53:00 +01:00
pwm-sun4i.c pwm: sun4i: Don't check the return code of pwmchip_remove() 2021-09-02 21:38:55 +02:00
pwm-tegra.c pwm: tegra: Assert reset only after the PWM was unregistered 2021-06-30 19:12:20 +02:00
pwm-tiecap.c pwm: tiecap: Simplify using devm_pwmchip_add() 2021-09-02 21:38:48 +02:00
pwm-tiehrpwm.c pwm: tiehrpwm: Unprepare clock only after the PWM was unregistered 2021-09-02 21:38:38 +02:00
pwm-twl-led.c pwm: twl-led: Simplify using devm_pwmchip_add() 2021-09-02 21:38:48 +02:00
pwm-twl.c pwm: twl: Simplify using devm_pwmchip_add() 2021-09-02 21:38:49 +02:00
pwm-visconti.c pwm: visconti: Simplify using devm_pwmchip_add() 2021-11-05 11:51:41 +01:00
pwm-vt8500.c pwm: vt8500: Only unprepare the clock after the pwmchip was removed 2021-06-30 19:12:20 +02:00
sysfs.c pwm: Allow store 64-bit duty cycle from sysfs interface 2020-09-24 09:18:14 +02:00