aboutsummaryrefslogtreecommitdiff
path: root/drivers/pwm/pwm-mxs.c
AgeCommit message (Collapse)AuthorFilesLines
2020-03-30pwm: mxs: Remove unused include of of_address.hAnson Huang1-1/+0
There is nothing in use from of_address.h, remove it. Signed-off-by: Anson Huang <[email protected]> Acked-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2020-01-08pwm: mxs: Avoid a division in mxs_pwm_apply()Rasmus Villemoes1-3/+3
Since the divisor is not a compile-time constant (unless gcc somehow decided to unroll the loop PERIOD_CDIV_MAX times), this does a somewhat expensive 32/32 division. Replace that with a right shift. We still have a 64/32 division just below, but at least in that case the divisor is compile-time constant. Signed-off-by: Rasmus Villemoes <[email protected]> Reviewed-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2020-01-08pwm: mxs: Add support for inverse polarityRasmus Villemoes1-4/+10
If I'm reading of_pwm_xlate_with_flags() right, existing device trees that set #pwm-cells = 2 will continue to work. Signed-off-by: Rasmus Villemoes <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2020-01-08pwm: mxs: Remove legacy methodsRasmus Villemoes1-77/+0
Since we now have ->apply(), these are no longer relevant. Signed-off-by: Rasmus Villemoes <[email protected]> Reviewed-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2020-01-08pwm: mxs: Implement ->apply()Rasmus Villemoes1-0/+70
In preparation for supporting setting the polarity, switch the driver to support the ->apply() method. Signed-off-by: Rasmus Villemoes <[email protected]> Reviewed-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2019-09-21pwm: mxs: Use devm_platform_ioremap_resource() to simplify codeAnson Huang1-3/+1
Use the new helper devm_platform_ioremap_resource() which wraps the platform_get_resource() and devm_ioremap_resource() together, to simplify the code. Signed-off-by: Anson Huang <[email protected]> Reviewed-by: Dong Aisheng <[email protected]> Acked-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2018-07-12pwm: mxs: Switch to SPDX identifierFabio Estevam1-7/+1
Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by: Fabio Estevam <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2017-01-04pwm: Remove .can_sleep from struct pwm_chipThierry Reding1-1/+1
All PWM devices have been marked as "might sleep" since v4.5, there is no longer a need to differentiate on a per-chip basis. Signed-off-by: Thierry Reding <[email protected]>
2015-07-20pwm: Add the pwm_is_enabled() helperBoris Brezillon1-2/+2
Some PWM drivers are testing the PWMF_ENABLED flag. Create a helper function to hide the logic behind enabled test. This will allow us to smoothly move from the current approach to an atomic PWM update approach. Signed-off-by: Boris Brezillon <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2015-03-11pwm: mxs: Fix period divider computationGaetan Hug1-2/+6
The driver computes which clock divider it sould be using from the requested period. This computation assumes that the link between the register value and the actual divider value is raising 2 to the power of the registry value. div = 1 << regvalue This is true only for the first 5 values out of 8. Next values are 64, 256 and, 1024 - instead of 32, 64, 128. This affects only the users requesting a period > 0.04369s. Replace the computation with a look-up table. Signed-off-by: Gaetan Hug <[email protected]> Acked-by: Shawn Guo <[email protected]> Signed-off-by: Thierry Reding <[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: mxs: set pwm_chip can_sleep flagShawn Guo1-0/+1
The .config() calls clk_get_rate() which might sleep, so we need to set pwm_chip can_sleep flag. Otherwise, we see the following warning when using PWM driven heartbeat led. WARNING: CPU: 0 PID: 0 at kernel/locking/mutex.c:856 mutex_trylock+0x184/0x1a4() DEBUG_LOCKS_WARN_ON(in_interrupt()) Modules linked in: CPU: 0 PID: 0 Comm: swapper Not tainted 3.14.0-rc5 #18 [<c0015420>] (unwind_backtrace) from [<c0012cb0>] (show_stack+0x10/0x14) [<c0012cb0>] (show_stack) from [<c001daf8>] (warn_slowpath_common+0x6c/0x8c) [<c001daf8>] (warn_slowpath_common) from [<c001dbac>] (warn_slowpath_fmt+0x30/0x40) [<c001dbac>] (warn_slowpath_fmt) from [<c045df74>] (mutex_trylock+0x184/0x1a4) [<c045df74>] (mutex_trylock) from [<c0360950>] (clk_prepare_lock+0xc/0xec) [<c0360950>] (clk_prepare_lock) from [<c0362020>] (clk_get_rate+0xc/0x68) [<c0362020>] (clk_get_rate) from [<c028d07c>] (mxs_pwm_config+0x20/0x198) [<c028d07c>] (mxs_pwm_config) from [<c028bde8>] (pwm_config+0x60/0x70) [<c028bde8>] (pwm_config) from [<c034b61c>] (__led_pwm_set+0x1c/0x3c) [<c034b61c>] (__led_pwm_set) from [<c034bc3c>] (led_heartbeat_function+0x70/0x110) [<c034bc3c>] (led_heartbeat_function) from [<c00292f0>] (call_timer_fn+0x7c/0x164) [<c00292f0>] (call_timer_fn) from [<c00295c8>] (run_timer_softirq+0x1f0/0x260) [<c00295c8>] (run_timer_softirq) from [<c002255c>] (__do_softirq+0xc4/0x2f0) [<c002255c>] (__do_softirq) from [<c0022890>] (irq_exit+0xa4/0x10c) [<c0022890>] (irq_exit) from [<c0010240>] (handle_IRQ+0x34/0x84) [<c0010240>] (handle_IRQ) from [<c0013524>] (__irq_svc+0x44/0x54) [<c0013524>] (__irq_svc) from [<c00107f8>] (arch_cpu_idle+0x40/0x48) [<c00107f8>] (arch_cpu_idle) from [<c005deb8>] (cpu_startup_entry+0x70/0x198) [<c005deb8>] (cpu_startup_entry) from [<c060aac8>] (start_kernel+0x2a8/0x2f8) Reported-by: Stefan Wahren <[email protected]> Signed-off-by: Shawn Guo <[email protected]> Acked-by: Alexandre Belloni <[email protected]> Tested-by: Stefan Wahren <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2013-10-08pwm: mxs: Remove redundant of_match_ptrSachin Kamat1-1/+1
The data structure of_match_ptr() protects is always compiled in. Hence of_match_ptr() is not needed. Signed-off-by: Sachin Kamat <[email protected]> Acked-by: Shawn Guo <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2013-09-03pwm: mxs: Check the return value from stmp_reset_block()Fabio Estevam1-1/+7
stmp_reset_block() may fail, so let's check its return value and propagate it in the case of error. Signed-off-by: Fabio Estevam <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2013-06-12pwm: Fill in missing .owner fieldsThierry Reding1-0/+1
Some drivers don't set the .owner fields of the struct device_driver or struct pwm_ops, which causes the module usage count to become wrong. Signed-off-by: Thierry Reding <[email protected]>
2013-05-27pwm: mxs: Let device core handle pinctrlFabio Estevam1-6/+0
Since commit ab78029 (drivers/pinctrl: grab default handles from device core), we can rely on device core for handling pinctrl. So remove devm_pinctrl_get_select_default() from the driver. Cc: Thierry Reding <[email protected]> Cc: <[email protected]> Signed-off-by: Fabio Estevam <[email protected]> Tested-by: Shawn Guo <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2013-04-23pwm: Constify OF match tablesThierry Reding1-1/+1
A few drivers already annotate this properly. Make the same change for all other OF supporting drivers. Signed-off-by: Thierry Reding <[email protected]> Acked-by: Shawn Guo <[email protected]> Acked-by: Alexandre Pereira da Silva <[email protected]> Acked-by: Viresh Kumar <[email protected]>
2013-04-02pwm: mxs: Remove unused *dev from struct mxs_pwm_chipAxel Lin1-2/+0
Signed-off-by: Axel Lin <[email protected]> Acked-by: Shawn Guo <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2013-01-22pwm: Convert to devm_ioremap_resource()Thierry Reding1-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]>
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 __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-07-23pwm: pwm-mxs: Return proper error if pwmchip_remove() failsAxel Lin1-3/+1
Signed-off-by: Axel Lin <[email protected]> Acked-by: Shawn Guo <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2012-07-23pwm: pwm-mxs: add pinctrl supportShawn Guo1-0/+6
Call pinctrl subsystem to set up pwm pin. Signed-off-by: Shawn Guo <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2012-07-23pwm: pwm-mxs: use devm_* managed functionsShawn Guo1-16/+8
Use devm_* managed functions to have a clean fail-out. Signed-off-by: Shawn Guo <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2012-07-23pwm: pwm-mxs: use global reset function stmp_reset_blockShawn Guo1-2/+2
Use global reset function stmp_reset_block instead of mxs_reset_block to remove <mach/common.h> inclusion. Signed-off-by: Shawn Guo <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2012-07-23pwm: pwm-mxs: encode soc name in compatible stringShawn Guo1-1/+1
Encode soc name in the compatible string to know the specific version hardware block. This is the general approach adopted for most bindings. Change mxs-pwm binding to use the approach. Signed-off-by: Shawn Guo <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
2012-07-02pwm: add pwm-mxs supportShawn Guo1-0/+207
Add generic PWM framework driver (DT only) for Freescale MXS. Signed-off-by: Sascha Hauer <[email protected]> Signed-off-by: Shawn Guo <[email protected]> Signed-off-by: Thierry Reding <[email protected]>