aboutsummaryrefslogtreecommitdiff
path: root/drivers/pwm/pwm-ab8500.c
AgeCommit message (Collapse)AuthorFilesLines
2024-02-15pwm: ab8500: Make use of devm_pwmchip_alloc() functionUwe Kleine-König1-8/+6
This prepares the pwm-ab8500 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/9c952baafe7e53c482adf23215138724b61e376b.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <[email protected]>
2024-02-15pwm: ab8500: Introduce a local pwm_chip variable in .probe()Uwe Kleine-König1-4/+6
This simplifies converting the driver to pwmchip_alloc() as there is only a single code line left that makes use of struct ab8500_pwm_chip::chip. Link: https://lore.kernel.org/r/7fae4833b97728abc8bd400663fdd331c86a761b.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <[email protected]>
2024-02-15pwm: ab8500: Make use of pwmchip_parent() accessorUwe Kleine-König1-9/+9
struct pwm_chip::dev is about to change. To not have to touch this driver in the same commit as struct pwm_chip::dev, use the accessor function provided for exactly this purpose. Link: https://lore.kernel.org/r/24028d8d0add621a0c054235e6281a05a83d8fb4.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <[email protected]>
2023-10-13pwm: Manage owner assignment implicitly for driversUwe Kleine-König1-1/+0
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 <[email protected]> # Intel LPSS Reviewed-by: Florian Fainelli <[email protected]> # pwm-{bcm,brcm}*.c Acked-by: Jernej Skrabec <[email protected]> # sun4i Acked-by: Andi Shyti <[email protected]> Acked-by: Nobuhiro Iwamatsu <[email protected]> # pwm-visconti Acked-by: Heiko Stuebner <[email protected]> # pwm-rockchip Acked-by: Michael Walle <[email protected]> # pwm-sl28cpld Acked-by: Neil Armstrong <[email protected]> # pwm-meson Reviewed-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2023-06-23pwm: ab8500: Fix error code in probe()Dan Carpenter1-1/+1
This code accidentally return positive EINVAL instead of negative -EINVAL. Fixes: eb41f334589d ("pwm: ab8500: Fix register offset calculation to not depend on probe order") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Uwe Kleine-König <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2023-02-17pwm: ab8500: Implement .get_state()Uwe Kleine-König1-0/+43
The registers are readable, so it's possible to implement the .get_state() callback for this PWM. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2023-02-17pwm: ab8500: Fix calculation of duty and periodUwe Kleine-König1-9/+60
After a check of the manual it becomes obvious that the calculations in .apply() are totally bogus: FreqPWMOutx was always written as zero, so the period was fixed at 3413333.33 ns. However state->period wasn't checked at all. The lower 10 bits of duty_cycle were just used as DutyPWMOutx. So if a duty cycle of 512 ns (or 1536 ns) was requested, it actually programmed 1710000 ns. Other values were wrong by the same factor. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2021-09-02pwm: ab8500: Simplify using devm_pwmchip_add()Uwe Kleine-König1-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 <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2021-09-02pwm: ab8500: Fix register offset calculation to not depend on probe orderUwe Kleine-König1-3/+14
The assumption that lead to commit 5e5da1e9fbee ("pwm: ab8500: Explicitly allocate pwm chip base dynamically") was wrong: The pwm-ab8500 devices are not directly instantiated from device tree, but from the ab8500 mfd driver. So the pdev->id isn't -1, but a number between 1 and 3. Now that pwmchip ids are always allocated dynamically, this cannot easily be reverted. Introduce a new member in the driver data struct that tracks the hardware id and use this to calculate the register offset. Side-note: Using chip->base to calculate the offset was never robust because if there was already a PWM with id 1 at the time ab8500-pwm.1 was probed, the associated pwmchip would get assigned chip->base = 2 (or something bigger). Fixes: 5e5da1e9fbee ("pwm: ab8500: Explicitly allocate pwm chip base dynamically") Fixes: 6173f8f4ed9c ("pwm: Move AB8500 PWM driver to PWM framework") Signed-off-by: Uwe Kleine-König <[email protected]> Acked-by: Linus Walleij <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2021-03-22pwm: Always allocate PWM chip base ID dynamicallyUwe Kleine-König1-1/+0
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 <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2021-03-22pwm: ab8500: Implement .apply instead of .config, .enable and .disableUwe Kleine-König1-28/+25
To eventually get rid of all legacy drivers convert this driver to the modern world implementing .apply(). Signed-off-by: Uwe Kleine-König <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2020-12-17pwm: ab8500: Explicitly allocate pwm chip base dynamicallyUwe Kleine-König1-1/+1
The ab8500 driver is the last one which doesn't (explicitly) use dynamic allocation of the pwm id. Looking through the kernel sources I didn't find a place that relies on this id. And with the device probed from device tree pdev->id is -1 anyhow; making this explicit looks beneficial, too. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2020-12-17pwm: ab8500: Add error message if pwmchip_add() failsUwe Kleine-König1-1/+1
pwmchip_add() doesn't emit an error message, so add one in the driver. Signed-off-by: Uwe Kleine-König <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194Thomas Gleixner1-1/+1
Based on 1 normalized pattern(s): license terms gnu general public license gpl version 2 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 161 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Allison Randal <[email protected]> Reviewed-by: Alexios Zavras <[email protected]> Reviewed-by: Steve Winslow <[email protected]> Reviewed-by: Richard Fontana <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2014-10-20pwm: drop owner assignment from platform_driversWolfram Sang1-1/+0
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <[email protected]>
2014-05-21pwm: ab8500: Fix wrong value shift for disable/enable PWMAxel Lin1-7/+2
Current code only works when pdev->id is 1. Fix it by passing correct bit values to abx500_mask_and_set_register_interruptible(). Having DISABLE_PWM/ENABLE_PWM does not make the code more readable because the bit values depend on pdev->id. Thus drop the DISABLE_PWM and ENABLE_PWM defines. This patch also removes an unnecessary return in ab8500_pwm_disable(). Signed-off-by: Axel Lin <[email protected]> Acked-by: Linus Walleij <[email protected]> Acked-by: Alexandre BOURDIOL <[email protected]> Acked-by: Philippe Begnic <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2014-04-28pwm: ab8500: Remove unnecessary OOM messagesJingoo Han1-3/+1
The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2013-04-02pwm: ab8500: Add .owner to struct pwm_opsAxel Lin1-0/+1
Add missing .owner of struct pwm_ops. This prevents the module from being removed from underneath its users. Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2013-03-26pwm: ab8500: Fix trivial typo in dev_err messageAxel Lin1-1/+1
Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2013-03-08pwm: ab8500: use devm_kzalloc()Jingoo Han1-5/+2
Use devm_kzalloc() to make cleanup paths more simple. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2012-11-28pwm: remove use of __devexitBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <[email protected]> Acked-by: Thierry Reding <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-11-28pwm: remove use of __devinitBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <[email protected]> Acked-by: Thierry Reding <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-11-28pwm: remove use of __devexit_pBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <[email protected]> Acked-by: Thierry Reding <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-09-20pwm: Move AB8500 PWM driver to PWM frameworkThierry Reding1-0/+153
This commit moves the driver to drivers/pwm and converts it to the new PWM framework. Signed-off-by: Thierry Reding <[email protected]> Acked-by: Linus Walleij <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Acked-by: Arun Murthy <[email protected]>