aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pwm/pwm-pxa.c
Commit message (Collapse)AuthorAgeFilesLines
* pwm: pxa: Improve using dev_err_probe()Uwe Kleine-König2025-04-141-10/+8
| | | | | | | | | Add a message to the error path of devm_clk_get() and simplify the error path of devm_pwmchip_add() while improving the error message en passant. Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Uwe Kleine-König <[email protected]>
* pwm: add missing MODULE_DESCRIPTION() macrosJeff Johnson2024-07-101-0/+1
| | | | | | | | | | | | | | | | | | | make allmodconfig && make W=1 C=1 reports: WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pwm/pwm-imx1.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pwm/pwm-imx27.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pwm/pwm-intel-lgm.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pwm/pwm-mediatek.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pwm/pwm-pxa.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pwm/pwm-samsung.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pwm/pwm-spear.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pwm/pwm-visconti.o Add the missing invocations of the MODULE_DESCRIPTION() macro. Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Jeff Johnson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Uwe Kleine-König <[email protected]>
* pwm: pxa: Make use of devm_pwmchip_alloc() functionUwe Kleine-König2024-02-191-10/+11
| | | | | | | | | This prepares the pwm-pxa 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/bee8ae436a9dfb8539637cbb7269a208f787a62a.1707900770.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <[email protected]>
* pwm: Drop useless member .of_pwm_n_cells of struct pwm_chipUwe Kleine-König2024-02-151-3/+1
| | | | | | | | | | | Apart from the two of_xlate implementations this member is write-only. In the of_xlate functions of_pwm_xlate_with_flags() and of_pwm_single_xlate() it's more sensible to check for args->args_count because this is what is actually used in the device tree. Acked-by: Douglas Anderson <[email protected]> Link: https://lore.kernel.org/r/53d8c545aa8f79a920358be9e72e382b3981bdc4.1704835845.git.u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <[email protected]>
* pwm: pxa: Explicitly include correct DT includesRob Herring2023-10-131-1/+1
| | | | | | | | | | | | | | | The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes. Signed-off-by: Rob Herring <[email protected]> Acked-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
* pwm: Manage owner assignment implicitly for driversUwe Kleine-König2023-10-131-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]>
* pwm: pxa: Don't reimplement of_device_get_match_data()Uwe Kleine-König2023-07-281-8/+1
| | | | | | | | | Apart from the return type pxa_pwm_get_id_dt() reimplements of_device_get_match_data(). Drop the former and replace the call to it by the latter. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
* pwm: Explicitly include correct DT includesRob Herring2023-07-241-0/+1
| | | | | | | | | | | | | | | | | The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes. Signed-off-by: Rob Herring <[email protected]> Reviewed-by: Nobuhiro Iwamatsu <[email protected]> Acked-by: Uwe Kleine-König <[email protected]> Reviewed-by: Tzung-Bi Shih <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
* docs: update some straggling Documentation/arm referencesJonathan Corbet2023-06-161-1/+1
| | | | | | | | | | | | | | | The Arm documentation has moved to Documentation/arch/arm; update the last remaining references to match. Cc: Dmitry Torokhov <[email protected]> Cc: Chen-Yu Tsai <[email protected]> Cc: Samuel Holland <[email protected]> Cc: Thierry Reding <[email protected]> Acked-by: Nicolas Ferre <[email protected]> Acked-by: Jernej Skrabec <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Acked-by: Uwe Kleine-König <[email protected]> # for pwm Signed-off-by: Jonathan Corbet <[email protected]>
* pwm: pxa: Add reference manual link and limitationsDoug Brown2022-12-061-0/+7
| | | | | | | | | | | | | Add a pointer to the location of reference manuals for some of the supported chips, and add a limitations section explaining the hardware's PWM disable behavior. Suggested-by: Uwe Kleine-König <[email protected]> Signed-off-by: Doug Brown <[email protected]> Reviewed-by: Uwe Kleine-König <[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]>
* pwm: pxa: Use abrupt shutdown modeDoug Brown2022-12-061-1/+1
| | | | | | | | | | | | | Switch to abrupt shutdown mode in order to stop the clock as soon as possible when PWM is disabled. This minimizes the possibility of the clock being re-enabled while it is still in the process of turning off, which will result in the clock ending up erroneously disabled. Signed-off-by: Doug Brown <[email protected]> Reviewed-by: Uwe Kleine-König <[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]>
* pwm: pxa: Remove clk enable/disable from pxa_pwm_configDoug Brown2022-12-061-9/+0
| | | | | | | | | | | Now that pxa_pwm_apply always enables the clock first, there is no need for pxa_pwm_config to do any clock enabling/disabling. Signed-off-by: Doug Brown <[email protected]> Reviewed-by: Uwe Kleine-König <[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]>
* pwm: pxa: Set duty cycle to 0 when disabling PWMDoug Brown2022-12-061-9/+16
| | | | | | | | | | | | | | | | | When disabling PWM, the duty cycle needs to be set to 0. This prevents the previous duty cycle from showing up momentarily when the clock is re-enabled next time. Because the clock has to be running in order to configure the duty cycle, unconditionally enable it early in pxa_pwm_apply and account for the correct enable count at the end. Suggested-by: Uwe Kleine-König <[email protected]> Signed-off-by: Doug Brown <[email protected]> Reviewed-by: Uwe Kleine-König <[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]>
* pwm: pxa: Remove pxa_pwm_enable/disableDoug Brown2022-12-061-16/+3
| | | | | | | | | | | | These functions are only acting as wrappers for clk_prepare_enable and clk_disable_unprepare now, so remove them to simplify the driver. Suggested-by: Uwe Kleine-König <[email protected]> Signed-off-by: Doug Brown <[email protected]> Reviewed-by: Uwe Kleine-König <[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]>
* pwm: pxa: Implement .apply() callbackUwe Kleine-König2022-02-021-5/+28
| | | | | | | | | To eventually get rid of all legacy drivers convert this driver to the modern world implementing .apply(). This just pushes down a slightly optimized variant of how legacy drivers are handled in the core. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
* pwm: Introduce single-PWM of_xlate functionBjorn Andersson2021-10-271-15/+1
| | | | | | | | | | | | | | | | | The existing pxa driver and the upcoming addition of PWM support in the TI sn565dsi86 DSI/eDP bridge driver both has a single PWM channel and thereby a need for a of_xlate function with the period as its single argument. Introduce a common helper function in the core that can be used as of_xlate by such drivers and migrate the pxa driver to use this. Signed-off-by: Bjorn Andersson <[email protected]> Acked-by: Uwe Kleine-König <[email protected]> Tested-by: Steev Klimaszewski <[email protected]> Tested-By: Steev Klimaszewski <[email protected]> Signed-off-by: Robert Foss <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
* 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 <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
* pwm: pxa: Always use the same variable name for driver dataUwe Kleine-König2021-06-301-19/+19
| | | | | | | | In most functions the driver data variable is called pc. Do the same in the two remaining functions. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
* pwm: pxa: Drop if with an always false conditionUwe Kleine-König2021-06-301-2/+0
| | | | | | | | | | The .remove() function is only called after .probe() returned successfully. In this case platform_set_drvdata() was called with a non-NULL argument and so platfrom_get_drvdata() returns the same non-NULL value. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
* pwm: Always allocate PWM chip base ID dynamicallyUwe Kleine-König2021-03-221-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]>
* pwm: pxa: Convert to devm_platform_ioremap_resource()Yangtao Li2020-12-171-3/+1
| | | | | | | | Use devm_platform_ioremap_resource() to simplify code. Signed-off-by: Yangtao Li <[email protected]> Reviewed-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
* treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500Thomas Gleixner2019-06-191-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Based on 2 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation # extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 4122 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Enrico Weigelt <[email protected]> Reviewed-by: Kate Stewart <[email protected]> Reviewed-by: Allison Randal <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
* pwm: constify pwm_ops structuresBhumika Goyal2017-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Declare pwm_ops structures as const as they are only stored in the ops field of a pwm_chip structure. This field is of type const struct pwm_ops *, so pwm_ops structures having this property can be declared as const. Done using Coccinelle: @r1 disable optional_qualifier@ identifier i; position p; @@ static struct pwm_ops i@p={...}; @ok1@ identifier r1.i; position p; struct pxa_pwm_chip pwm; struct bfin_pwm_chip bwm; struct vt8500_chip vp; struct imx_chip icp; @@ ( pwm.chip.ops=&i@p | bwm.chip.ops=&i@p | vp.chip.ops=&i@p | icp.chip.ops=&i@p ) @bad@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct pwm_ops i; File size details: text data bss dec hex filename 1646 328 0 1974 7b6 drivers/pwm/pwm-imx.o 1742 224 0 1966 7ae drivers/pwm/pwm-imx.o 1941 296 0 2237 8bd drivers/pwm/pwm-pxa.o 2037 192 0 2229 8b5 drivers/pwm/pwm-pxa.o 1946 296 0 2242 8c2 drivers/pwm/pwm-vt8500.o 2050 192 0 2242 8c2 drivers/pwm/pwm-vt8500.o The drivers/pwm/pwm-bfin.o file did not compile. Signed-off-by: Bhumika Goyal <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
* pwm: Introduce the pwm_args conceptBoris Brezillon2016-05-031-1/+1
| | | | | | | | | | | | | | | | | | Currently the PWM core mixes the current PWM state with the per-platform reference config (specified through the PWM lookup table, DT definition or directly hardcoded in PWM drivers). Create a struct pwm_args to store this reference configuration, so that PWM users can differentiate between the current and reference configurations. Patch all places where pwm->args should be initialized. We keep the pwm_set_polarity/period() calls until all PWM users are patched to use pwm_args instead of pwm_get_period/polarity(). Signed-off-by: Boris Brezillon <[email protected]> [[email protected]: reword kerneldoc comments] Signed-off-by: Thierry Reding <[email protected]>
* pwm: drop owner assignment from platform_driversWolfram Sang2014-10-201-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]>
* pwm: pxa: Remove unnecessary OOM messagesJingoo Han2014-04-281-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]>
* pwm: pxa: Constify OF match tableThierry Reding2014-04-011-1/+1
| | | | | | | The table is never modified and all OF functions that use it take a const struct of_device_id *. Signed-off-by: Thierry Reding <[email protected]>
* pwm: pxa: Fix typo "pwm" -> "PWM"Thierry Reding2014-04-011-1/+1
| | | | | | Being an abbreviation, PWM should always be capitalized in prose. Signed-off-by: Thierry Reding <[email protected]>
* Revert "pwm: pxa: Use of_match_ptr()"Thierry Reding2014-04-011-1/+3
| | | | | | | | | This reverts commit 8468949cddcdbb1b1b1bc552aefceb252078ceb1. The OF match table dummy for non-OF configurations cannot be removed because it is still used by the pxa_pwm_get_id_dt() function. Signed-off-by: Thierry Reding <[email protected]>
* pwm: pxa: Use of_match_ptr()Jingoo Han2014-02-261-3/+1
| | | | | | | | Use of_match_ptr(), because of_match_ptr() returns NULL pointer when CONFIG_OF is disabled. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
* pwm: pxa: remove unnecessary space before tabsJingoo Han2013-12-201-1/+1
| | | | | | | | | | Remove unnecessary space before tabs in order to fix the following checkpatch warning. WARNING: please, no space before tabs Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
* pwm: pxa: Add device tree supportMike Dunn2013-12-041-0/+53
| | | | | | | | | | | | | | | | | | This patch adds device tree support to the PXA's PWM driver. Nothing needs to be extracted from the device tree node by the PWM device. Client devices need only specify the period; the per-chip index is implicitly zero because one device node must be present for each PWM output in use. This approach is more convenient due to the wide variability in the number of PWM channels present across the various PXA variants, and is made possible by the fact that the register sets for each PWM channel are segregated from each other. An of_xlate() method is added to parse this single-cell node. The existing ID table is reused for the match table data. Tested on a Palm Treo 680 (both platform data and DT cases). Signed-off-by: Mike Dunn <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
* pwm: pxa: Use module_platform_driverMike Dunn2013-09-031-11/+1
| | | | | | | | | | | | | | | | | | | | Commit 76abbdde2d95a3807d0dc6bf9f84d03d0dbd4f3d pwm: Add sysfs interface causes a kernel oops due to a null pointer dereference on PXA platforms. This happens because the class added by the patch is registered in a subsys_initcall (initcall4), but the pxa pwm driver is registered in arch_initcall (initcall3). If the class is not registered before the driver probe function runs, the oops occurs in device_add() when the uninitialized pointers in struct class are dereferenced. I don't see a reason that the driver must be an arch_initcall, so this patch makes it a regular module_platform_driver (initcall6), preventing the oops. Signed-off-by: Mike Dunn <[email protected]> Acked-by: Robert Jarzmik <[email protected]> Acked-by: Marek Vasut <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
* drivers/pwm: don't check resource with devm_ioremap_resourceWolfram Sang2013-05-181-5/+0
| | | | | | | | devm_ioremap_resource does sanity checks on the given resource. No need to duplicate this in the driver. Signed-off-by: Wolfram Sang <[email protected]> Acked-by: Stephen Warren <[email protected]>
* pwm: pxa: Remove PWM_ID_BASE macroAxel Lin2013-04-021-4/+3
| | | | | | | | | PWM_ID_BASE() is not used after convert to PWM framework, remove it. Also update driver_data field of struct platform_device_id accordingly. Signed-off-by: Axel Lin <[email protected]> Acked-by: Eric Miao <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
* pwm: pxa: Remove clk_enabled field from struct pxa_pwm_chipAxel Lin2013-04-021-14/+2
| | | | | | | | | | | clk_enable/clk_disable maintain an enable_count, clk_prepare and clk_unprepare also maintain a prepare_count. These APIs will do prepare/enable when the first user calling these APIs, and do disable/unprepare when the corresponding counter reach 0. Thus We don't need to maintain a clk_enabled counter here. Signed-off-by: Axel Lin <[email protected]> Acked-by: Eric Miao <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
* pwm: Convert to devm_ioremap_resource()Thierry Reding2013-01-221-3/+3
| | | | | | | | | Convert all uses of devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling. Signed-off-by: Thierry Reding <[email protected]> Acked-by: Viresh Kumar <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
* pwm: remove use of __devexitBill Pemberton2012-11-281-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]>
* pwm: remove use of __devinitBill Pemberton2012-11-281-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]>
* pwm: remove use of __devexit_pBill Pemberton2012-11-281-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]>
* pwm: Check for negative duty-cycle and periodThierry Reding2012-10-051-3/+0
| | | | | | | | | | | | | | | | | | | | | Make sure the duty-cycle and period passed in are not negative. This should eventually be made implicit by making them unsigned. While at it, the drivers' .config() implementations can have the equivalent checks removed. Signed-off-by: Thierry Reding <[email protected]> Cc: Shawn Guo <[email protected]> Cc: Mark Brown <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Sachin Kamat <[email protected]> Cc: Axel Lin <[email protected]> Cc: Kukjin Kim <[email protected]> Cc: Jingoo Han <[email protected]> Cc: Jonghwan Choi <[email protected]> Cc: Sascha Hauer <[email protected]> Cc: "Philip, Avinash" <[email protected]> Cc: Vaibhav Bedia <[email protected]> Acked-by: Jingoo Han <[email protected]>
* pwm: pxa: Propagate pwmchip_remove() errorThierry Reding2012-07-231-2/+1
| | | | | | | | If the pwmchip_remove() call fails, propagate the error to the driver's remove callback. This is required to prevent the module from being unloaded if a PWM provided by the driver is still in use. Signed-off-by: Thierry Reding <[email protected]>
* pwm: Convert pwm-pxa to use devm_* APIsAxel Lin2012-07-231-39/+10
| | | | | Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
* pwm: Move PXA PWM driver to PWM frameworkThierry Reding2012-07-021-0/+248
This commit moves the PXA PWM driver to the drivers/pwm subdirectory and converts it to use the new PWM framework. Signed-off-by: Thierry Reding <[email protected]>