linux_dsm_epyc7002/drivers/pwm
Uwe Kleine-König e47685ec4c pwm: iqs620a: Fix overflow and optimize calculations
[ Upstream commit 72d6b2459dbd539c1369149e501fdc3dc8ddef16 ]

If state->duty_cycle is 0x100000000000000, the previous calculation of
duty_scale overflows and yields a duty cycle ratio of 0% instead of
100%. Fix this by clamping the requested duty cycle to the maximal
possible duty cycle first. This way it is possible to use a native
integer division instead of a (depending on the architecture) more
expensive 64bit division.

With this change in place duty_scale cannot be bigger than 256 which
allows to simplify the calculation of duty_val.

Fixes: 6f0841a819 ("pwm: Add support for Azoteq IQS620A PWM generator")
Tested-by: Jeff LaBundy <jeff@labundy.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-03-04 11:38:17 +01:00
..
core.c pwm: Convert to use DEFINE_SEQ_ATTRIBUTE macro 2020-09-24 09:18:09 +02:00
Kconfig ARM: SoC platform updates 2020-10-24 10:33:08 -07:00
Makefile pwm: Add support for sl28cpld PWM controller 2020-09-17 15:59:34 +01:00
pwm-ab8500.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
pwm-atmel-hlcdc.c pwm: Ensure pwm_apply_state() doesn't modify the state argument 2019-09-21 03:25:10 +02:00
pwm-atmel-tcb.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
pwm-atmel.c pwm: atmel: Implement .get_state() 2020-01-08 13:47:46 +01:00
pwm-bcm2835.c pwm: bcm2835: Simplify with dev_err_probe() 2020-09-24 09:18:10 +02:00
pwm-bcm-iproc.c pwm: bcm-iproc: handle clk_get_rate() return 2020-07-30 11:27:13 +02:00
pwm-bcm-kona.c pwm: bcm-kona: Remove impossible comparison when validating duty cycle 2020-07-30 11:27:12 +02:00
pwm-berlin.c pwm: Clear chip_data in pwm_put() 2019-05-09 17:09:54 +02:00
pwm-brcmstb.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
pwm-clps711x.c pwm: clps711x: Use 64-bit division macro 2020-06-16 11:16:08 +02:00
pwm-crc.c pwm: crc: Implement get_state() method 2020-09-06 15:38:05 +02:00
pwm-cros-ec.c pwm: cros-ec: Simplify EC error handling 2020-08-24 11:37:34 +02:00
pwm-ep93xx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
pwm-fsl-ftm.c pwm: Ensure pwm_apply_state() doesn't modify the state argument 2019-09-21 03:25:10 +02:00
pwm-hibvt.c pwm: Ensure pwm_apply_state() doesn't modify the state argument 2019-09-21 03:25:10 +02:00
pwm-img.c pwm: img: Fix null pointer access in probe 2020-09-24 09:18:13 +02:00
pwm-imx1.c
pwm-imx27.c pwm: imx27: Fix overflow for bigger periods 2020-12-30 11:53:59 +01:00
pwm-imx-tpm.c pwm: imx-tpm: Use 64-bit division macro 2020-06-16 11:16:08 +02:00
pwm-iqs620a.c pwm: iqs620a: Fix overflow and optimize calculations 2021-03-04 11:38:17 +01:00
pwm-jz4740.c pwm: jz4740: Simplify with dev_err_probe() 2020-09-24 09:18:10 +02:00
pwm-lp3943.c pwm: lp3943: Dynamically allocate PWM chip base 2020-12-30 11:53:59 +01:00
pwm-lpc18xx-sct.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 178 2019-05-30 11:29:19 -07:00
pwm-lpc32xx.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 372 2019-06-05 17:37:10 +02:00
pwm-lpss-pci.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pwm-lpss-platform.c pwm: lpss: Remove suspend/resume handlers 2020-09-06 15:38:01 +02:00
pwm-lpss.c pwm: lpss: Remove suspend/resume handlers 2020-09-06 15:38:01 +02:00
pwm-lpss.h pwm: lpss: Remove suspend/resume handlers 2020-09-06 15:38:01 +02:00
pwm-mediatek.c pwm: mediatek: Provide missing kerneldoc description for 'soc' arg 2020-07-30 11:27:12 +02:00
pwm-meson.c pwm: meson: Remove redundant assignment to variable fin_freq 2020-04-03 21:40:56 +02:00
pwm-mtk-disp.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
pwm-mxs.c pwm: mxs: Remove unused include of of_address.h 2020-03-30 16:55:27 +02:00
pwm-omap-dmtimer.c pwm: Replace HTTP links with HTTPS ones 2020-07-30 11:27:13 +02:00
pwm-pca9685.c pwm: pca9685: Disable unused alternative addresses 2020-09-24 09:18:13 +02:00
pwm-pxa.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pwm-rcar.c pwm: rcar: Fix late Runtime PM enablement 2020-03-30 18:03:05 +02:00
pwm-renesas-tpu.c pwm: renesas-tpu: Drop confusing registered message 2020-03-30 18:03:06 +02:00
pwm-rockchip.c pwm: rockchip: Eliminate potential race condition when probing 2021-03-04 11:38:11 +01:00
pwm-samsung.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 178 2019-05-30 11:29:19 -07:00
pwm-sifive.c pwm: sifive: Simplify with dev_err_probe() 2020-09-24 09:18:11 +02:00
pwm-sl28cpld.c pwm: sl28cpld: fix getting driver data in pwm callbacks 2020-12-03 09:57:37 -08:00
pwm-spear.c
pwm-sprd.c pwm: sprd: Simplify with dev_err_probe() 2020-09-24 09:18:11 +02:00
pwm-sti.c pwm: Remove dev_err() usage after platform_get_irq() 2019-09-21 00:58:35 +02:00
pwm-stm32-lp.c pwm: Convert period and duty cycle to u64 2020-06-17 20:42:11 +02:00
pwm-stm32.c pwm: stm32: Remove automatic output enable 2020-01-20 13:47:36 +01:00
pwm-stmpe.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pwm-sun4i.c pwm: sun4i: Remove erroneous else branch 2020-12-30 11:53:59 +01:00
pwm-tegra.c pwm: tegra: Support dynamic clock frequency configuration 2020-06-02 14:25:37 +02:00
pwm-tiecap.c pwm: Replace HTTP links with HTTPS ones 2020-07-30 11:27:13 +02:00
pwm-tiehrpwm.c pwm: Replace HTTP links with HTTPS ones 2020-07-30 11:27:13 +02:00
pwm-twl-led.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
pwm-twl.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
pwm-vt8500.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
pwm-zx.c pwm: zx: Add missing cleanup in error path 2020-12-30 11:53:58 +01:00
sysfs.c pwm: Allow store 64-bit duty cycle from sysfs interface 2020-09-24 09:18:14 +02:00