Commit Graph

159 Commits

Author SHA1 Message Date
Sachin Kamat b577cdcf17 pwm: samsung: Fix kernel warning while unexporting a channel
PWM channel data was set to NULL before freeing it. This caused the
following kernel warning while unexporting the channel. Set the channel
data to NULL after freeing it.

[   70.495000] WARNING: CPU: 0 PID: 1 at drivers/base/devres.c:805 pwm_put+0x48/0x80()
[   70.505000] Modules linked in:
[   70.505000] CPU: 0 PID: 1 Comm: sh Not tainted 3.12.0-rc6-next-20131024-00012-gd4aec04-dirty #58
[   70.515000] [<c0014ddc>] (unwind_backtrace+0x0/0xf4) from [<c0011784>] (show_stack+0x10/0x14)
[   70.525000] [<c0011784>] (show_stack+0x10/0x14) from [<c03a3cbc>] (dump_stack+0x7c/0xb0)
[   70.530000] [<c03a3cbc>] (dump_stack+0x7c/0xb0) from [<c001de68>] (warn_slowpath_common+0x6c/0x88)
[   70.540000] [<c001de68>] (warn_slowpath_common+0x6c/0x88) from [<c001df20>] (warn_slowpath_null+0x1c/0x24)
[   70.550000] [<c001df20>] (warn_slowpath_null+0x1c/0x24) from [<c01d1af8>] (pwm_put+0x48/0x80)
[   70.560000] [<c01d1af8>] (pwm_put+0x48/0x80) from [<c01d21c8>] (pwm_unexport_store+0x94/0xac)
[   70.565000] [<c01d21c8>] (pwm_unexport_store+0x94/0xac) from [<c010991c>] (sysfs_write_file+0x148/0x1d8)
[   70.575000] [<c010991c>] (sysfs_write_file+0x148/0x1d8) from [<c00b2a80>] (vfs_write+0xb4/0x1a0)
[   70.585000] [<c00b2a80>] (vfs_write+0xb4/0x1a0) from [<c00b3068>] (SyS_write+0x3c/0x78)
[   70.595000] [<c00b3068>] (SyS_write+0x3c/0x78) from [<c000e2e0>] (ret_fast_syscall+0x0/0x30)

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Reviewed-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-11-01 11:17:57 +01:00
H Hartley Sweeten a230869817 pwm: add ep93xx PWM support
Remove the non-standard EP93xx PWM driver in drivers/misc and add
a new driver for the PWM controllers on the EP93xx platform based
on the PWM framework.

These PWM controllers each support 1 PWM channel with programmable
duty cycle, frequency, and polarity inversion.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ryan Mallon <rmallon@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-10-17 16:07:19 +02:00
Wolfram Sang faed9c3808 pwm: don't use devm_pinctrl_get_select_default() in probe
Since commit ab78029 (drivers/pinctrl: grab default handles from device core),
we can rely on device core for setting the default pins. Compile tested only.

Acked-by: Linus Walleij <linus.walleij@linaro.org> (personally at LCE13)
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-10-15 12:16:35 +02:00
Sachin Kamat becbca1390 pwm: imx: Remove redundant of_match_ptr
The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-10-08 15:49:38 +02:00
Sachin Kamat 3cb3b2bfdd pwm: lpc32xx: Remove redundant of_match_ptr
The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-10-08 15:49:19 +02:00
Sachin Kamat de02cb887c pwm: mxs: Remove redundant of_match_ptr
The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-10-08 15:49:10 +02:00
Sachin Kamat ea8eeb1502 pwm: twl: Include linux/of.h header
'of_match_ptr' is defined in linux/of.h. Include it explicitly.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-10-08 15:45:44 +02:00
Sachin Kamat e852340dee pwm: twl-led: Include linux/of.h header
'of_match_ptr' is defined in linux/of.h. Include it explicitly.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-10-08 15:45:44 +02:00
Sachin Kamat c3bdfe1f1e pwm: samsung: Include linux/of.h header
'of_match_ptr' is defined in linux/of.h. Include it explicitly.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-10-08 15:45:44 +02:00
Sachin Kamat 2a8876cfdf pwm: imx: Include linux/of.h header
'of_match_ptr' is defined in linux/of.h. Include it explicitly.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-10-08 15:45:44 +02:00
Boris BREZILLON ceb12f9398 pwm: atmel-tcb: fix max time computation for slow clk source
Use the the tcb counter width to compute the maximum time that can be
represented using the slow clock source instead of the static 16 bit width.

Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-09-19 14:04:32 +02:00
Boris BREZILLON f3a82170ae pwm: atmel-tcb: add missing clk source config
Clock source changes are never applied to the CMR register.
This may lead to wrong period/duty cycle configuration.

Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-09-19 14:04:24 +02:00
Linus Torvalds 8e73e367f7 ARM: SoC cleanups for 3.12
This branch contains code cleanups, moves and removals for 3.12.
 
 There's a large number of various cleanups, and a nice net removal of
 13500 lines of code.
 
 Highlights worth mentioning are:
 
 - A series of patches from Stephen Boyd removing the ARM local timer API.
 - Move of Qualcomm MSM IOMMU code to drivers/iommu.
 - Samsung PWM driver cleanups from Tomasz Figa, removing legacy PWM driver
   and switching over to the drivers/pwm one.
 - Removal of some unusued auto-generated headers for OMAP2+ (PRM/CM).
 
 There's also a move of a header file out of include/linux/i2c/ to
 platform_data, where it really belongs. It touches mostly ARM platform
 code for include changes so we took it through our tree.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJSKg/NAAoJEIwa5zzehBx3vxIP/19ouV4WrzOeEMz2Id8bYT5/
 Tu9HRm+PJJ2O+4P+DYlycRAEHsbuDbwgdcqToH3quca1YnIcoJgY0FA6D0ihQ5uE
 EvTgFIpkNMLnR43GYDOE3a/rR3hYPg5oQabKFn7ZGLG2ND3D3d2N05WT8XNbTYDk
 nvCXvyRRT1ynCEzbxRBiE8x62ao4bqa5dZ1zrHHIEoakqciXEng8IU0nxx7SUarv
 61GBJHVoGFpwOWXdgt2uxyXFbn6nMrhf33ynB+RRAZhqlrC8FROj8Iz+3EoKSAHc
 fMJSw6jgdjMCfTDvi0j/eemoNC4fm0eP17Dz9WcwxtIrJPNFVrxZq+biDnpb49nM
 IHsbNrILosw9AbHr3C0kTU9tp+Jie2cE1RWHqTIN3S3zb4qN+fIJiU6o6LMhsNP5
 +ZxL4M5IYmvZYbU3a+A00TPwVRqBbsZB+et9RtYZsdpepovDiN4XcixEoT7ffqrt
 VLjJyoX7Aqmds46lMdsdD3bpPkREmMdf8aMm5fvdIqwbJi1pFMMGMdTgN2WLG5aM
 r0bj/DizxL7Brs8RHwOScUgXteZs3gg87v5Ns/3zAyJZvE4norPAiT+EJeXylpRO
 LDqqaypFs75nU+mWLNo8Fzck4Xue55SBqx5Bo3aD/Smk8B6r4KMqnMKVsV5RFHAU
 XfWb49HulUwHHdn5DAPx
 =1vE4
 -----END PGP SIGNATURE-----

Merge tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM SoC cleanups from Olof Johansson:
 "This branch contains code cleanups, moves and removals for 3.12.

  There's a large number of various cleanups, and a nice net removal of
  13500 lines of code.

  Highlights worth mentioning are:

   - A series of patches from Stephen Boyd removing the ARM local timer
     API.
   - Move of Qualcomm MSM IOMMU code to drivers/iommu.
   - Samsung PWM driver cleanups from Tomasz Figa, removing legacy PWM
     driver and switching over to the drivers/pwm one.
   - Removal of some unusued auto-generated headers for OMAP2+ (PRM/CM).

  There's also a move of a header file out of include/linux/i2c/ to
  platform_data, where it really belongs.  It touches mostly ARM
  platform code for include changes so we took it through our tree"

* tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (83 commits)
  ARM: OMAP2+: Add back the define for AM33XX_RST_GLOBAL_WARM_SW_MASK
  gpio: (gpio-pca953x) move header to linux/platform_data/
  arm: zynq: hotplug: Remove unreachable code
  ARM: SAMSUNG: Remove unnecessary exynos4_default_sdhci*()
  tegra: simplify use of devm_ioremap_resource
  ARM: SAMSUNG: Remove plat/regs-timer.h header
  ARM: SAMSUNG: Remove remaining uses of plat/regs-timer.h header
  ARM: SAMSUNG: Remove pwm-clock infrastructure
  ARM: SAMSUNG: Remove old PWM timer platform devices
  pwm: Remove superseded pwm-samsung-legacy driver
  ARM: SAMSUNG: Modify board files to use new PWM platform device
  ARM: SAMSUNG: Rework private data handling in dev-backlight
  pwm: Add new pwm-samsung driver
  ARM: mach-mvebu: remove redundant DT parsing and validation
  ARM: msm: Only compile io.c on platforms that use it
  iommu/msm: Move mach includes to iommu directory
  ARM: msm: Remove devices-iommu.c
  ARM: msm: Move mach/board.h contents to common.h
  ARM: msm: Migrate msm_timer to CLOCKSOURCE_OF_DECLARE
  ARM: msm: Remove TMR and TMR0 static mappings
  ...
2013-09-06 13:21:16 -07:00
Mike Dunn 1e185c7aaf pwm: pxa: Use module_platform_driver
Commit 76abbdde2d

    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 <mikedunn@newsguy.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-09-03 13:09:17 +02:00
Jingoo Han ac872bc9ed pwm: tiehrpwm: add missing __iomem annotation
Fix the following sparse warnings:

drivers/pwm/pwm-tiehrpwm.c:144:16: warning: incorrect type in argument 1 (different address spaces)
drivers/pwm/pwm-tiehrpwm.c:144:16:    expected void const volatile [noderef] <asn:2>*addr
drivers/pwm/pwm-tiehrpwm.c:144:16:    got void *
drivers/pwm/pwm-tiehrpwm.c:149:9: warning: incorrect type in argument 2 (different address spaces)
drivers/pwm/pwm-tiehrpwm.c:149:9:    expected void volatile [noderef] <asn:2>*addr
drivers/pwm/pwm-tiehrpwm.c:149:9:    got void *
drivers/pwm/pwm-tiehrpwm.c:157:18: warning: incorrect type in argument 1 (different address spaces)
drivers/pwm/pwm-tiehrpwm.c:157:18:    expected void const volatile [noderef] <asn:2>*addr
drivers/pwm/pwm-tiehrpwm.c:157:18:    got void *
drivers/pwm/pwm-tiehrpwm.c:160:9: warning: incorrect type in argument 2 (different address spaces)
drivers/pwm/pwm-tiehrpwm.c:160:9:    expected void volatile [noderef] <asn:2>*addr
drivers/pwm/pwm-tiehrpwm.c:160:9:    got void *

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-09-03 13:09:16 +02:00
Jingoo Han 3943a650f6 pwm: tiecap: add CONFIG_PM_SLEEP to ecap_pwm_{save,restore}_context()
ecap_pwm_save_context() and ecap_pwm_restore_context() are only used
when CONFIG_PM_SLEEP is selected.

drivers/pwm/pwm-tiecap.c:293:13: warning: 'ecap_pwm_save_context' defined but not used [-Wunused-function]
drivers/pwm/pwm-tiecap.c:302:13: warning: 'ecap_pwm_restore_context' defined but not used [-Wunused-function]

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-09-03 13:09:16 +02:00
Julia Lawall 88d5a2e6ff pwm: simplify use of devm_ioremap_resource
Remove unneeded error handling on the result of a call to
platform_get_resource when the value is passed to devm_ioremap_resource.

Move the call to platform_get_resource adjacent to the call to
devm_ioremap_resource to make the connection between them more clear.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression pdev,res,n,e,e1;
expression ret != 0;
identifier l;
@@

- res = platform_get_resource(pdev, IORESOURCE_MEM, n);
  ... when != res
- if (res == NULL) { ... \(goto l;\|return ret;\) }
  ... when != res
+ res = platform_get_resource(pdev, IORESOURCE_MEM, n);
  e = devm_ioremap_resource(e1, res);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-09-03 13:09:16 +02:00
Laurent Pinchart 382457e562 pwm: renesas-tpu: Add DT support
Specify DT bindings for the TPU PWM controller and add OF support to the
driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-09-03 13:09:15 +02:00
Laurent Pinchart 208be7698f pwm: Use the DT macro directly when parsing PWM DT flags
Don't redefine a PWM_SPEC_POLARITY macro with a value identical to
PWM_POLARITY_INVERTED, use the PWM DT macro directly.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-09-03 13:08:10 +02:00
Fabio Estevam cfb9e4c40e pwm: mxs: Check the return value from stmp_reset_block()
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 <fabio.estevam@freescale.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-09-03 13:07:51 +02:00
Tomasz Figa 6059235c51 pwm: Remove superseded pwm-samsung-legacy driver
This patch removes the now unused pwm-samsung-legacy driver, which was
replaced by new pwm-samsung driver.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Mark Brown <broonie@linaro.org>
Tested-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
2013-08-12 21:53:23 +02:00
Tomasz Figa 11ad39ede2 pwm: Add new pwm-samsung driver
This patch introduces new Samsung PWM driver, which is completely
rewritten to be multiplatform- and DeviceTree-aware.

In addition, remaining problems of old driver are fixed, such as:
 - proper handling of hardware variants,
 - synchronization on SMP systems,
 - handling of boundary parameter values,
 - hardware sharing with PWM clocksource driver,
 - undefined state of PWM output after stopping PWM channel.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Mark Brown <broonie@linaro.org>
Tested-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
2013-08-12 21:53:22 +02:00
Tomasz Figa 615c19e160 pwm: samsung: Rename to pwm-samsung-legacy
This patch renames the old pwm-samsung driver to pwm-samsung-legacy to
create place for the new, rewritten, DT-aware pwm-samsung driver.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Mark Brown <broonie@linaro.org>
Tested-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
2013-08-06 01:21:49 +02:00
Greg Kroah-Hartman 9da0175963 pwm: convert class code to use dev_groups
The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the PWM class code to use the
correct field.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-07-29 09:08:33 +02:00
Marek Belisko b388f15fd1 pwm: pwm-tiehrpwm: Use clk_enable/disable instead clk_prepare/unprepare.
This was found when using pwm-led on am33xx and enable
heartbeat trigger.

[  808.624876] =================================
[  808.629443] [ INFO: inconsistent lock state ]
[  808.634021] 3.9.0 #2 Not tainted
[  808.637415] ---------------------------------
[  808.641981] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
[  808.648288] swapper/0 [HC0[0]:SC1[1]:HE1:SE0] takes:
[  808.653494]  (prepare_lock){+.?.+.}, at: [<c027c211>] clk_unprepare+0x15/0x24
[  808.661040] {SOFTIRQ-ON-W} state was registered at:
[  808.666155]   [<c004ec4d>] __lock_acquire+0x411/0x824
[  808.671465]   [<c004f359>] lock_acquire+0x41/0x50
[  808.676412]   [<c039ee9d>] mutex_lock_nested+0x31/0x1d8
[  808.681912]   [<c027c275>] clk_prepare+0x15/0x28
[  808.686764]   [<c0590c6b>] _init+0x117/0x1e0
[  808.691256]   [<c0019ef9>] omap_hwmod_for_each+0x29/0x3c
[  808.696842]   [<c0591107>] __omap_hwmod_setup_all+0x17/0x2c
[  808.702696]   [<c0008653>] do_one_initcall+0xc3/0x10c
[  808.708017]   [<c058a627>] kernel_init_freeable+0xa7/0x134
[  808.713778]   [<c039a543>] kernel_init+0x7/0x98
[  808.718544]   [<c000cd95>] ret_from_fork+0x11/0x3c
[  808.723583] irq event stamp: 1379172
[  808.727328] hardirqs last  enabled at (1379172): [<c03a0759>] _raw_spin_unlock_irqrestore+0x21/0x30
[  808.736828] hardirqs last disabled at (1379171): [<c03a03c3>] _raw_spin_lock_irqsave+0x13/0x38
[  808.745876] softirqs last  enabled at (1379164): [<c002ae5d>] irq_enter+0x49/0x4c
[  808.753747] softirqs last disabled at (1379165): [<c002aec3>] irq_exit+0x63/0x88
[  808.761518]
[  808.761518] other info that might help us debug this:
[  808.768373]  Possible unsafe locking scenario:
[  808.768373]
[  808.774578]        CPU0
[  808.777141]        ----
[  808.779705]   lock(prepare_lock);
[  808.783186]   <Interrupt>
[  808.785929]     lock(prepare_lock);
[  808.789595]
[  808.789595]  *** DEADLOCK ***
[  808.789595]
[  808.795805] 1 lock held by swapper/0:
[  808.799643]  #0:  (((&heartbeat_data->timer))){+.-...}, at: [<c002e204>] call_timer_fn+0x0/0x90
[  808.808814]
[  808.808814] stack backtrace:
[  808.813402] [<c000ff19>] (unwind_backtrace+0x1/0x98) from [<c039bd75>] (print_usage_bug.part.25+0x16d/0x1cc)
[  808.823721] [<c039bd75>] (print_usage_bug.part.25+0x16d/0x1cc) from [<c004e595>] (mark_lock+0x18d/0x434)
[  808.833669] [<c004e595>] (mark_lock+0x18d/0x434) from [<c004ec1d>] (__lock_acquire+0x3e1/0x824)
[  808.842803] [<c004ec1d>] (__lock_acquire+0x3e1/0x824) from [<c004f359>] (lock_acquire+0x41/0x50)
[  808.852031] [<c004f359>] (lock_acquire+0x41/0x50) from [<c039ee9d>] (mutex_lock_nested+0x31/0x1d8)
[  808.861433] [<c039ee9d>] (mutex_lock_nested+0x31/0x1d8) from [<c027c211>] (clk_unprepare+0x15/0x24)
[  808.870930] [<c027c211>] (clk_unprepare+0x15/0x24) from [<c019f7bf>] (ehrpwm_pwm_disable+0x5f/0x80)
[  808.880431] [<c019f7bf>] (ehrpwm_pwm_disable+0x5f/0x80) from [<c019f29f>] (pwm_disable+0x27/0x28)
[  808.889751] [<c019f29f>] (pwm_disable+0x27/0x28) from [<c026f8f3>] (led_heartbeat_function+0x3f/0xb0)
[  808.899431] [<c026f8f3>] (led_heartbeat_function+0x3f/0xb0) from [<c002e249>] (call_timer_fn+0x45/0x90)
[  808.909288] [<c002e249>] (call_timer_fn+0x45/0x90) from [<c002e399>] (run_timer_softirq+0x105/0x17c)
[  808.918884] [<c002e399>] (run_timer_softirq+0x105/0x17c) from [<c002abc5>] (__do_softirq+0xa5/0x150)
[  808.928486] [<c002abc5>] (__do_softirq+0xa5/0x150) from [<c002aec3>] (irq_exit+0x63/0x88)
[  808.937098] [<c002aec3>] (irq_exit+0x63/0x88) from [<c000d599>] (handle_IRQ+0x21/0x54)
[  808.945415] [<c000d599>] (handle_IRQ+0x21/0x54) from [<c0008495>] (omap3_intc_handle_irq+0x5d/0x68)
[  808.954900] [<c0008495>] (omap3_intc_handle_irq+0x5d/0x68) from [<c000c7ff>] (__irq_svc+0x3f/0x64)
[  808.964287] Exception stack(0xc05b1f68 to 0xc05b1fb0)
[  808.969587] 1f60:                   00000001 00000001 00000000 00000000 c05b0000 c0619748
[  808.978158] 1f80: c05b0000 c05b0000 c0619748 413fc082 00000000 00000000 01000000 c05b1fb0
[  808.986719] 1fa0: c004f989 c000d6f0 400f0033 ffffffff
[  808.992024] [<c000c7ff>] (__irq_svc+0x3f/0x64) from [<c000d6f0>] (cpu_idle+0x60/0x98)
[  809.000250] [<c000d6f0>] (cpu_idle+0x60/0x98) from [<c058a535>] (start_kernel+0x1e9/0x234)

Remove non atomic clk api calls and use only atomic for enable/disable because
can be called from atomic context (led_heartbeat_function is timer callback).

Signed-off-by: Marek Belisko <marek.belisko@streamunlimited.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-06-26 23:23:54 +02:00
Axel Lin fed1bf8dc7 pwm: pca9685: Fix wrong argument to set MODE1_SLEEP bit
Current code actually does not set MODE1_SLEEP bit because the new value for
bitmask (0x1) is wrong. To set MODE1_SLEEP bit, we should pass MODE1_SLEEP
as the new value for bitmask.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-06-26 23:23:54 +02:00
Axel Lin 71077bc8db pwm: renesas-tpu: Add MODULE_ALIAS to make module auto loading work
This driver can be built as module, add MODULE_ALIAS to make module auto loading
work.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-06-26 11:48:26 +02:00
Wei Yongjun 00cf99ee00 pwm: renesas-tpu: fix return value check in tpu_probe()
In case of error, the function devm_ioremap_resource() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-06-25 12:20:06 +02:00
Laurent Pinchart 99b82abb0a pwm: Add Renesas TPU PWM driver
The Timer Pulse Unit (TPU) is a 4-channels 16-bit timer used to generate
waveforms. This driver exposes PWM functions through the PWM API for
other drivers to use.

The code is loosely based on the leds-renesas-tpu driver by Magnus Damm
and the TPU PWM driver shipped in the Armadillo EVA 800 kernel sources.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-06-21 11:33:28 +02:00
H Hartley Sweeten 76abbdde2d pwm: Add sysfs interface
Add a simple sysfs interface to the generic PWM framework.

  /sys/class/pwm/
  `-- pwmchipN/           for each PWM chip
      |-- export          (w/o) ask the kernel to export a PWM channel
      |-- npwm            (r/o) number of PWM channels in this PWM chip
      |-- pwmX/           for each exported PWM channel
      |   |-- duty_cycle  (r/w) duty cycle (in nanoseconds)
      |   |-- enable      (r/w) enable/disable PWM
      |   |-- period      (r/w) period (in nanoseconds)
      |   `-- polarity    (r/w) polarity of PWM (normal/inversed)
      `-- unexport        (w/o) return a PWM channel to the kernel

Based on work by Lars Poeschel.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Lars Poeschel <poeschel@lemonage.de>
Cc: Ryan Mallon <rmallon@gmail.com>
Cc: Rob Landley <rob@landley.net>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-06-21 11:32:51 +02:00
Thierry Reding 3dd0a90947 pwm: Fill in missing .owner fields
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 <thierry.reding@gmail.com>
2013-06-12 13:18:29 +02:00
Steffen Trumtrar 88b613e623 pwm: add pca9685 driver
Add pwm driver for the NXP pca9685 16 channel pwm-led controller.

The driver is really barebones at this stage. E.g. the OE' pin and
therefore the corresponding registers are not supported.
The driver was tested on a HW where this pin is tied to GND.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
[thierry.reding@gmail.com: style and whitespace cleanups]
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-06-12 13:13:18 +02:00
Boris BREZILLON 8796f9c565 pwm: atmel-tcb: prepare clk before calling enable
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
avoid common clk framework warnings.

Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-06-12 12:51:44 +02:00
Wolfram Sang 77f0b9d2ff pwm: devm: alloc correct pointer size
The allocated object should be the size of what the pointer is pointing
to and not the size of the pointer itself.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-06-10 12:50:10 +02:00
Fabio Estevam e7927141ed pwm: mxs: Let device core handle pinctrl
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 <thierry.reding@avionic-design.de>
Cc: <linux-kernel@vger.kernel.org>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2013-05-27 17:48:33 +02:00
Wolfram Sang 362e9cd2f5 drivers/pwm: don't check resource with devm_ioremap_resource
devm_ioremap_resource does sanity checks on the given resource. No need to
duplicate this in the driver.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Stephen Warren <swarren@nvidia.com>
2013-05-18 11:55:58 +02:00
Axel Lin affb923df9 pwm: lpc32xx: Don't change PWM_ENABLE bit in lpc32xx_pwm_config
lpc32xx_pwm_config() is supposed to set duty_ns and period_ns,
it should not change PWM_ENABLE bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Roland Stigge <stigge@antcom.de>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
2013-04-23 10:58:47 +02:00
Axel Lin 08ee77b5a5 pwm: lpc32xx: Properly set PWM_ENABLE bit in lpc32xx_pwm_[enable|disable]
According to the LPC32x0 User Manual [1]:

For both PWM1 and PWM2 Control Registers:
BIT 31:
This bit gates the PWM_CLK signal and enables the external output pin
to the PWM_PIN_STATE logical level.

0 = PWM disabled. (Default)
1 = PWM enabled

So in lpc32xx_pwm_enable(), we should set PWM_ENABLE bit.
In lpc32xx_pwm_disable(), we should just clear PWM_ENABLE bit rather than
write 0 to the register which will also clear PWMx_RELOADV and PWMx_DUTY bits.

[1] http://www.nxp.com/documents/user_manual/UM10326.pdf

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Roland Stigge <stigge@antcom.de>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
2013-04-23 10:58:35 +02:00
Thierry Reding f1a8870aeb pwm: Constify OF match tables
A few drivers already annotate this properly. Make the same change for
all other OF supporting drivers.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
2013-04-23 07:42:20 +02:00
Axel Lin a46ef4d572 pwm: puv3: Remove unused enabled filed from struct puv3_pwm_chip
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
2013-04-02 11:40:18 +02:00
Axel Lin 22976a5dad pwm: pxa: Remove PWM_ID_BASE macro
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 <axel.lin@ingics.com>
Acked-by: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
2013-04-02 11:40:17 +02:00
Axel Lin b3fef7f100 pwm: spear: Remove unused *dev from struct spear_pwm_chip
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Shiraz Hashim <shiraz.hashim@st.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
2013-04-02 11:40:00 +02:00
Axel Lin 4e61573df8 pwm: mxs: Remove unused *dev from struct mxs_pwm_chip
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
2013-04-02 11:33:05 +02:00
Axel Lin c8e4df3109 pwm: twl: Return proper error if twl6030_pwm_enable() fails
Return proper error instead of 0 if twl6030_pwm_enable() fails.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
2013-04-02 11:32:14 +02:00
Axel Lin b014a30c59 pwm: pxa: Remove clk_enabled field from struct pxa_pwm_chip
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 <axel.lin@ingics.com>
Acked-by: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
2013-04-02 11:31:37 +02:00
Axel Lin 72da70e77f pwm: imx: Remove enabled field from struct imx_chip
We can test PWMF_ENABLED bit to know if pwm is enabled or not.
Thus remove enabled field from struct imx_chip.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
2013-04-02 11:30:57 +02:00
Axel Lin d5714e8b9d pwm: twl: Add .owner to struct pwm_ops
Add missing .owner of struct pwm_ops. This prevents the module from being
removed from underneath its users.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
2013-04-02 11:30:18 +02:00
Axel Lin 7fa25314d5 pwm: twl-led: Add .owner to struct pwm_ops
Add missing .owner of struct pwm_ops. This prevents the module from being
removed from underneath its users.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
2013-04-02 11:29:57 +02:00
Axel Lin 83c80dc535 pwm: atmel-tcb: Add .owner to struct pwm_ops
Add missing .owner of struct pwm_ops. This prevents the module from being
removed from underneath its users.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
2013-04-02 11:29:22 +02:00
Axel Lin fa0abee9b8 pwm: ab8500: Add .owner to struct pwm_ops
Add missing .owner of struct pwm_ops. This prevents the module from being
removed from underneath its users.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
2013-04-02 11:29:11 +02:00