summaryrefslogtreecommitdiffstats
path: root/drivers/pwm
Commit message (Collapse)AuthorAgeFilesLines
* pwm: vt8500: Rename pwm_busy_wait() to make it obviously driver-specificUwe Kleine-König2021-11-051-8/+8
| | | | | | | | | The pwm_ prefix suggests that pwm_busy_wait() is a function provided by the pwm core. Use the otherwise consistently used driver prefix for this function, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: pwm-samsung: Trigger manual update when disabling PWMMårten Lindahl2021-11-051-8/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* pwm: visconti: Simplify using devm_pwmchip_add()zhaoxiao2021-11-051-13/+1
| | | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: zhaoxiao <long870912@gmail.com> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: samsung: Describe driver in KconfigKrzysztof Kozlowski2021-11-051-1/+3
| | | | | | | | | Describe better which driver applies to which SoC, to make configuring kernel for Samsung SoC easier. Signed-off-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>
* pwm: Make it explicit that pwm_apply_state() might sleepUwe Kleine-König2021-11-051-0/+9
| | | | | | | | | | | At least some implementations sleep. So mark pwm_apply_state() with a might_sleep() to make callers aware. In the worst case this uncovers a valid atomic user, then we revert this patch and at least gained some more knowledge and then can work on a concept similar to gpio_get_value/gpio_get_value_cansleep. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: atmel: Drop unused headerUwe Kleine-König2021-11-051-1/+0
| | | | | | | | | | | Since commit 52eaba4cedbd ("pwm: atmel: Rework tracking updates pending in hardware") the driver doesn't make use of mutexes any more, so the header defining these doesn't need to be included. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by: Claudiu Beznea <claudiu.beznea@microchip.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: mtk-disp: Implement atomic API .get_state()Jitao Shi2021-09-021-0/+43
| | | | | | | | Switch the driver to support the .get_state() method. Signed-off-by: Jitao Shi <jitao.shi@mediatek.com> [thierry.reding@gmail.com: add missing linux/bitfield.h include] Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: mtk-disp: Fix overflow in period and duty calculationJitao Shi2021-09-021-3/+3
| | | | | | | | | | | | | | Current calculation for period and high_width may have 64-bit overflow. state->period and rate are u64. rate * state->period will overflow. clk_div = div_u64(rate * state->period, NSEC_PER_SEC) period = div64_u64(rate * state->period, div); high_width = div64_u64(rate * state->duty_cycle, div); This patch is to resolve it by using mul_u64_u64_div_u64(). Signed-off-by: Jitao Shi <jitao.shi@mediatek.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: mtk-disp: Implement atomic API .apply()Jitao Shi2021-09-021-54/+41
| | | | | | | Switch the driver to support the .apply() method. Signed-off-by: Jitao Shi <jitao.shi@mediatek.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: mtk-disp: Adjust the clocks to avoid them mismatchJitao Shi2021-09-021-50/+41
| | | | | | | | | | | | | | The clks "main" and "mm" are prepared in .probe() (and unprepared in .remove()). This results in the clocks being on during suspend which results in unnecessarily increased power consumption. Remove the clock operations from .probe() and .remove(). Add the clk_prepare_enable() in .enable() and the clk_disable_unprepare() in .disable(). Signed-off-by: Jitao Shi <jitao.shi@mediatek.com> [thierry.reding@gmail.com: squashed in fixup patch] Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: Make pwmchip_remove() return voidUwe Kleine-König2021-09-021-3/+1
| | | | | | | | | Since some time pwmchip_remove() always returns 0 so the return value isn't usefull. Now that all callers are converted to ignore its value the function can be changed to return void. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: sun4i: Don't check the return code of pwmchip_remove()Uwe Kleine-König2021-09-021-4/+1
| | | | | | | | | | | pwmchip_remove() returns always 0. Don't use the value to make it possible to eventually change the function to return void. Also the driver core ignores the return value of sun4i_pwm_remove() and considers the device removed anyhow. So returning early results in a resource leak. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: sifive: Don't check the return code of pwmchip_remove()Uwe Kleine-König2021-09-021-3/+3
| | | | | | | | | pwmchip_remove() returns always 0. Don't use the value to make it possible to eventually change the function to return void. Also the driver core ignores the return value of pwm_sifive_remove(). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: samsung: Don't check the return code of pwmchip_remove()Uwe Kleine-König2021-09-021-4/+1
| | | | | | | | | | | pwmchip_remove() returns always 0. Don't use the value to make it possible to eventually change the function to return void. Also the driver core ignores the return value of pwm_samsung_remove() and considers the device removed anyhow. So returning early results in a resource leak. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: renesas-tpu: Don't check the return code of pwmchip_remove()Uwe Kleine-König2021-09-021-3/+2
| | | | | | | | | pwmchip_remove() returns always 0. Don't use the value to make it possible to eventually change the function to return void. Also the driver core ignores the return value of tpu_remove(). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: rcar: Don't check the return code of pwmchip_remove()Uwe Kleine-König2021-09-021-3/+2
| | | | | | | | | pwmchip_remove() returns always 0. Don't use the value to make it possible to eventually change the function to return void. Also the driver core ignores the return value of rcar_pwm_remove(). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: pca9685: Don't check the return code of pwmchip_remove()Uwe Kleine-König2021-09-021-4/+1
| | | | | | | | | | | pwmchip_remove() returns always 0. Don't use the value to make it possible to eventually change the function to return void. Also the driver core ignores the return value of pca9685_pwm_remove() and considers the device removed anyhow. So returning early results in a resource leak. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: omap-dmtimer: Don't check the return code of pwmchip_remove()Uwe Kleine-König2021-09-021-4/+1
| | | | | | | | | | | pwmchip_remove() returns always 0. Don't use the value to make it possible to eventually change the function to return void. Also the driver core ignores the return value of pwm_omap_dmtimer_remove() and considers the device removed anyhow. So returning early results in a resource leak. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: mtk-disp: Don't check the return code of pwmchip_remove()Uwe Kleine-König2021-09-021-3/+2
| | | | | | | | | pwmchip_remove() returns always 0. Don't use the value to make it possible to eventually change the function to return void. Also the driver core ignores the return value of mtk_disp_pwm_remove(). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: imx-tpm: Don't check the return code of pwmchip_remove()Uwe Kleine-König2021-09-021-2/+3
| | | | | | | | | pwmchip_remove() returns always 0. Don't use the value to make it possible to eventually change the function to return void. Also the driver core ignores the return value of pwm_imx_tpm_remove(). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: img: Don't check the return code of pwmchip_remove()Uwe Kleine-König2021-09-021-1/+3
| | | | | | | | | pwmchip_remove() returns always 0. Don't use the value to make it possible to eventually change the function to return void. Also the driver core ignores the return value of pwm_imx_tpm_remove(). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: cros-ec: Don't check the return code of pwmchip_remove()Uwe Kleine-König2021-09-021-1/+3
| | | | | | | | | pwmchip_remove() returns always 0. Don't use the value to make it possible to eventually change the function to return void. Also the driver core ignores the return value of cros_ec_pwm_remove(). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: brcmstb: Don't check the return code of pwmchip_remove()Uwe Kleine-König2021-09-021-3/+2
| | | | | | | | | pwmchip_remove() returns always 0. Don't use the value to make it possible to eventually change the function to return void. Also the driver core ignores the return value of brcmstb_pwm_remove(). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: atmel-tcb: Don't check the return code of pwmchip_remove()Uwe Kleine-König2021-09-021-4/+1
| | | | | | | | | | | pwmchip_remove() returns always 0. Don't use the value to make it possible to eventually change the function to return void. Also the driver core ignores the return value of atmel_tcb_pwm_remove() and considers the device removed anyhow. So returning early results in a resource leak. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: atmel-hlcdc: Don't check the return code of pwmchip_remove()Uwe Kleine-König2021-09-021-4/+1
| | | | | | | | | | pwmchip_remove() returns always 0. Don't use the value to make it possible to eventually change the function to return void. Also the driver core ignores the return value of atmel_hlcdc_pwm_remove() and considers the device removed anyhow. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: twl: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-16/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: twl-led: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-16/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: tiecap: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-4/+2
| | | | | | | | With devm_pwmchip_add() there is no need to explicitly call pwmchip_remove(), so this call can be dropped from the remove callback. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: stm32-lp: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-9/+1
| | | | | | | This allows to drop the platform_driver's remove function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: sl28cpld: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-11/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: raspberrypi-poe: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-11/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: pxa: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-12/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: ntxec: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-12/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: mxs: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-11/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: mediatek: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-11/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: lpc32xx: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-11/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: lp3943: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-11/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: keembay: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-11/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: jz4740: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-11/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: iqs620a: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-15/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: intel-lgm: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-11/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: imx27: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-13/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: fsl-ftm: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-9/+1
| | | | | | | This allows to drop the platform_driver's remove function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: ep93xx: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-10/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: bcm-kona: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-11/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: ab8500: Simplify using devm_pwmchip_add()Uwe Kleine-König2021-09-021-17/+1
| | | | | | | | This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: keembay: Improve compile coverage by allowing to enable on !ARM64Uwe Kleine-König2021-09-021-1/+2
| | | | | | | | There are no arm64 specific constructs in this driver and it compiles just fine with ARCH=arm. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: jz4740: Improve compile coverage by allowing to enable on !MIPSUwe Kleine-König2021-09-021-1/+1
| | | | | | | | There are no mips specific constructs in this driver and it compiles just fine with ARCH=arm. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: ntxec: Drop useless assignment to struct pwmchip::baseUwe Kleine-König2021-09-021-1/+0
| | | | | | | | | | Since commit f9a8ee8c8bcd ("pwm: Always allocate PWM chip base ID dynamically") there is no effect any more for assigning this variable. When the patch resulting in f9a8ee8c8bcd was created, this driver didn't exist yet, so this was missed. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
* pwm: tiehrpwm: Unprepare clock only after the PWM was unregisteredUwe Kleine-König2021-09-021-1/+3
| | | | | | | | | | | | The driver is supposed to stay functional until pwmchip_remove() returns. So disable clocks only after that. pwmchip_remove() always returns 0, so the return code can be ignored which keeps ehrpwm_pwm_remove() a bit simpler and eventually allows to make pwmchip_remove() return void. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>