#
1b669168 |
| 14-Feb-2024 |
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
pwm: iqs620a: Make use of devm_pwmchip_alloc() function
This prepares the pwm-iqs620a driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no i
pwm: iqs620a: Make use of devm_pwmchip_alloc() function
This prepares the pwm-iqs620a driver to further changes of the pwm core outlined in the commit introducing devm_pwmchip_alloc(). There is no intended semantical change and the driver should behave as before.
Link: https://lore.kernel.org/r/85cb0e73baadd76ede364abc4b57ee72000880e5.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
show more ...
|
#
07b61160 |
| 14-Feb-2024 |
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
pwm: iqs620a: Prepare removing pwm_chip from driver data
This prepares the driver for further changes that will drop struct pwm_chip chip from struct iqs620_pwm_private. The only two functions that
pwm: iqs620a: Prepare removing pwm_chip from driver data
This prepares the driver for further changes that will drop struct pwm_chip chip from struct iqs620_pwm_private. The only two functions that make use of struct iqs620_pwm_private::chip (apart from the probe function that is handled later when converting to pwmchip_alloc()) only use the chip's device pointer. Introduce such a pointer in driver data and use that instead.
Link: https://lore.kernel.org/r/e6b1636c0d26d8bcb02a66b2963e2cc394014d76.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
show more ...
|
#
8a18b973 |
| 14-Feb-2024 |
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
pwm: iqs620a: Create a wrapper for converting a pwm_chip to driver data
There is no semantic change. The new function just implements what was open-coded twice in the driver before.
Link: https://l
pwm: iqs620a: Create a wrapper for converting a pwm_chip to driver data
There is no semantic change. The new function just implements what was open-coded twice in the driver before.
Link: https://lore.kernel.org/r/cc7ab547b4c4b79456b548aa72205bcf4476db8c.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
show more ...
|
#
384461ab |
| 04-Aug-2023 |
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
pwm: Manage owner assignment implicitly for drivers
Instead of requiring each driver to care for assigning the owner member of struct pwm_ops, handle that implicitly using a macro. Note that the own
pwm: Manage owner assignment implicitly for drivers
Instead of requiring each driver to care for assigning the owner member of struct pwm_ops, handle that implicitly using a macro. Note that the owner member has to be moved to struct pwm_chip, as the ops structure usually lives in read-only memory and so cannot be modified.
The upside is that new low level drivers cannot forget the assignment and save one line each. The pwm-crc driver didn't assign .owner, that's not a problem in practice though as the driver cannot be compiled as a module.
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com> # Intel LPSS Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> # pwm-{bcm,brcm}*.c Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> # sun4i Acked-by: Andi Shyti <andi.shyti@kernel.org> Acked-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp> # pwm-visconti Acked-by: Heiko Stuebner <heiko@sntech.de> # pwm-rockchip Acked-by: Michael Walle <michael@walle.cc> # pwm-sl28cpld Acked-by: Neil Armstrong <neil.armstrong@linaro.org> # pwm-meson Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230804142707.412137-2-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
show more ...
|
#
b20b0971 |
| 22-Mar-2023 |
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
pwm: iqs620a: Explicitly set .polarity in .get_state()
The driver only supports normal polarity. Complete the implementation of .get_state() by setting .polarity accordingly.
Fixes: 6f0841a8197b ("
pwm: iqs620a: Explicitly set .polarity in .get_state()
The driver only supports normal polarity. Complete the implementation of .get_state() by setting .polarity accordingly.
Fixes: 6f0841a8197b ("pwm: Add support for Azoteq IQS620A PWM generator") Reviewed-by: Jeff LaBundy <jeff@labundy.com> Link: https://lore.kernel.org/r/20230228135508.1798428-4-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
show more ...
|
#
860793bb |
| 06-Feb-2023 |
Jeff LaBundy <jeff@labundy.com> |
pwm: iqs620a: Replace one remaining instance of regmap_update_bits()
The call to regmap_update_bits() which was responsible for clearing the PWM output enable register bit was recently dropped in fa
pwm: iqs620a: Replace one remaining instance of regmap_update_bits()
The call to regmap_update_bits() which was responsible for clearing the PWM output enable register bit was recently dropped in favor of a call to regmap_clear_bits(), thereby simplifying the code.
Similarly, the call to regmap_update_bits() which sets the same bit can be simplified with a call to regmap_set_bits().
Signed-off-by: Jeff LaBundy <jeff@labundy.com> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
show more ...
|
#
6c452cff |
| 02-Dec-2022 |
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
pwm: Make .get_state() callback return an error code
.get_state() might fail in some cases. To make it possible that a driver signals such a failure change the prototype of .get_state() to return an
pwm: Make .get_state() callback return an error code
.get_state() might fail in some cases. To make it possible that a driver signals such a failure change the prototype of .get_state() to return an error code.
This patch was created using coccinelle and the following semantic patch:
@p1@ identifier getstatefunc; identifier driver; @@ struct pwm_ops driver = { ..., .get_state = getstatefunc ,... };
@p2@ identifier p1.getstatefunc; identifier chip, pwm, state; @@ -void +int getstatefunc(struct pwm_chip *chip, struct pwm_device *pwm, struct pwm_state *state) { ... - return; + return 0; ... }
plus the actual change of the prototype in include/linux/pwm.h (plus some manual fixing of indentions and empty lines).
So for now all drivers return success unconditionally. They are adapted in the following patches to make the changes easier reviewable.
Reviewed-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com> Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Acked-by: Douglas Anderson <dianders@chromium.org> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> Acked-by: Conor Dooley <conor.dooley@microchip.com> Link: https://lore.kernel.org/r/20221130152148.2769768-2-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
show more ...
|
#
2c85895b |
| 02-Dec-2022 |
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
pwm: iqs620a: Use regmap_clear_bits and regmap_set_bits where applicable
Found using coccinelle and the following semantic patch:
@@ expression map, reg, bits; @@
- regmap_update_bits(map, reg, bi
pwm: iqs620a: Use regmap_clear_bits and regmap_set_bits where applicable
Found using coccinelle and the following semantic patch:
@@ expression map, reg, bits; @@
- regmap_update_bits(map, reg, bits, bits) + regmap_set_bits(map, reg, bits)
@@ expression map, reg, bits; @@
- regmap_update_bits(map, reg, bits, 0) + regmap_clear_bits(map, reg, bits)
Link: https://lore.kernel.org/r/20221115111347.3705732-4-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
show more ...
|
#
2e27afd0 |
| 07-Jul-2021 |
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
pwm: iqs620a: Simplify using devm_pwmchip_add()
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
pwm: iqs620a: Simplify using devm_pwmchip_add()
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>
show more ...
|
#
f9a8ee8c |
| 01-Mar-2021 |
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
pwm: Always allocate PWM chip base ID dynamically
Since commit 5e5da1e9fbee ("pwm: ab8500: Explicitly allocate pwm chip base dynamically") all drivers use dynamic ID allocation explicitly. New drive
pwm: Always allocate PWM chip base ID dynamically
Since commit 5e5da1e9fbee ("pwm: ab8500: Explicitly allocate pwm chip base dynamically") all drivers use dynamic ID allocation explicitly. New drivers are supposed to do the same, so remove support for driver specified base IDs and drop all assignments in the low-level drivers.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
show more ...
|
#
28208c7b |
| 19-Jan-2021 |
Jeff LaBundy <jeff@labundy.com> |
pwm: iqs620a: Correct a stale state variable
If duty cycle is first set to a value that is sufficiently high to enable the output (e.g. 10000 ns) but then lowered to a value that is quantized to zer
pwm: iqs620a: Correct a stale state variable
If duty cycle is first set to a value that is sufficiently high to enable the output (e.g. 10000 ns) but then lowered to a value that is quantized to zero (e.g. 1000 ns), the output is disabled as the device cannot drive a constant zero (as expected).
However if the device is later re-initialized due to watchdog bite, the output is re-enabled at the next-to-last duty cycle (10000 ns). This is because the iqs620_pwm->out_en flag unconditionally tracks state->enabled instead of what was actually written to the device.
To solve this problem, use one state variable that encodes all 257 states of the output (duty_scale) with 0 representing tri-state, 1 representing the minimum available duty cycle and 256 representing 100% duty cycle.
Signed-off-by: Jeff LaBundy <jeff@labundy.com> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
show more ...
|
#
72d6b245 |
| 15-Jan-2021 |
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
pwm: iqs620a: Fix overflow and optimize calculations
If state->duty_cycle is 0x100000000000000, the previous calculation of duty_scale overflows and yields a duty cycle ratio of 0% instead of 100%.
pwm: iqs620a: Fix overflow and optimize calculations
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: 6f0841a8197b ("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>
show more ...
|
#
2b1c1a5d |
| 11-Nov-2020 |
Thierry Reding <thierry.reding@gmail.com> |
pwm: Use -EINVAL for unsupported polarity
Instead of using a mix of -EOPNOTSUPP and -ENOTSUPP, use the more standard -EINVAL to signal that the specified polarity value was invalid.
Acked-by: Uwe K
pwm: Use -EINVAL for unsupported polarity
Instead of using a mix of -EOPNOTSUPP and -ENOTSUPP, use the more standard -EINVAL to signal that the specified polarity value was invalid.
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
show more ...
|
#
b8fb642a |
| 15-Jun-2020 |
Thierry Reding <thierry.reding@gmail.com> |
pwm: iqs620a: Use lowercase hexadecimal literals for consistency
Other drivers use lowercase hexadecimal literals, so convert the IQS620a driver to do the same for consistency.
Signed-off-by: Thier
pwm: iqs620a: Use lowercase hexadecimal literals for consistency
Other drivers use lowercase hexadecimal literals, so convert the IQS620a driver to do the same for consistency.
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
show more ...
|
#
5bc5d99f |
| 15-Jun-2020 |
Thierry Reding <thierry.reding@gmail.com> |
pwm: iqs620a: Use 64-bit division
The PWM framework is going to change the PWM period and duty cycles to be 64-bit unsigned integers. To avoid build errors on platforms that do not natively support
pwm: iqs620a: Use 64-bit division
The PWM framework is going to change the PWM period and duty cycles to be 64-bit unsigned integers. To avoid build errors on platforms that do not natively support 64-bit division, use explicity 64-bit division.
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
show more ...
|
#
6f0841a8 |
| 13-Apr-2020 |
Jeff LaBundy <jeff@labundy.com> |
pwm: Add support for Azoteq IQS620A PWM generator
This patch adds support for the Azoteq IQS620A, capable of generating a 1-kHz PWM output with duty cycle between ~0.4% and 100% (inclusive).
Signed
pwm: Add support for Azoteq IQS620A PWM generator
This patch adds support for the Azoteq IQS620A, capable of generating a 1-kHz PWM output with duty cycle between ~0.4% and 100% (inclusive).
Signed-off-by: Jeff LaBundy <jeff@labundy.com> Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
show more ...
|