aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-10 07:15:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-10 07:15:24 -0400
commit2474542f64432398f503373f53bdf620491bcfa8 (patch)
tree3c9744b138c2158757530814b35c23eed31cf6ce /drivers/misc
parentc7a6ced9d8e8411bdafe83998474d185a79badc3 (diff)
parent85f8879ca4f3d26a7f473522101fb74a79bda3f2 (diff)
Merge tag 'for-3.7-rc1' of git://gitorious.org/linux-pwm/linux-pwm
Pull pwm changes from Thierry Reding: "All legacy PWM providers have now been moved to the PWM subsystem. The plan for 3.8 is to adapt all board files to provide a lookup table for PWM devices in order to get rid of the global namespace. Subsequently, users of the legacy pwm_request() and pwm_free() functions can be migrated to the new pwm_get() and pwm_put() functions. Once this has been completed, the legacy API and the compatibility code in the core can be removed. In addition to the above, these changes also add support for configuring the polarity of a PWM signal (currently only supported on ECAP and EHRPWM) and include a much needed rework of the i.MX driver. Managed functions to obtain and release a PWM device (devm_pwm_get() and devm_pwm_put()) have been added and the pwm-backlight driver has been updated to use them. If the PWM subsystem hasn't been enabled, dummy functions are provided that allow the subsystem to safely compile out. Some common checks on input parameters have been moved to the core and removed from the drivers. Finally, a small fix corrects the description of the PWM specifier's second cell in the device tree representation." * tag 'for-3.7-rc1' of git://gitorious.org/linux-pwm/linux-pwm: (23 commits) pwm: dt: Fix description of second PWM cell pwm: Check for negative duty-cycle and period pwm: Add Ingenic JZ4740 support MIPS: JZ4740: Export timer API pwm: Move PUV3 PWM driver to PWM framework unicore32: pwm: Use managed resource allocations unicore32: pwm: Remove unnecessary indirection unicore32: pwm: Use module_platform_driver() unicore32: pwm: Properly remap memory-mapped registers pwm-backlight: Use devm_pwm_get() instead of pwm_get() pwm: Move AB8500 PWM driver to PWM framework pwm: Fix compilation error when CONFIG_PWM is not defined pwm: i.MX: fix clock lookup pwm: i.MX: use per clock unconditionally pwm: i.MX: add devicetree support pwm: i.MX: Use module_platform_driver pwm: i.MX: add functions to enable/disable pwm. pwm: i.MX: remove unnecessary if in pwm_[en|dis]able pwm: i.MX: factor out SoC specific functions pwm: pwm-tiehrpwm: Add support for configuring polarity of PWM ...
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/Kconfig10
-rw-r--r--drivers/misc/Makefile1
-rw-r--r--drivers/misc/ab8500-pwm.c169
3 files changed, 0 insertions, 180 deletions
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 99c73352c430..b151b7c1bd59 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -60,16 +60,6 @@ config ATMEL_PWM
60 purposes including software controlled power-efficient backlights 60 purposes including software controlled power-efficient backlights
61 on LCD displays, motor control, and waveform generation. 61 on LCD displays, motor control, and waveform generation.
62 62
63config AB8500_PWM
64 bool "AB8500 PWM support"
65 depends on AB8500_CORE && ARCH_U8500
66 select HAVE_PWM
67 depends on !PWM
68 help
69 This driver exports functions to enable/disble/config/free Pulse
70 Width Modulation in the Analog Baseband Chip AB8500.
71 It is used by led and backlight driver to control the intensity.
72
73config ATMEL_TCLIB 63config ATMEL_TCLIB
74 bool "Atmel AT32/AT91 Timer/Counter Library" 64 bool "Atmel AT32/AT91 Timer/Counter Library"
75 depends on (AVR32 || ARCH_AT91) 65 depends on (AVR32 || ARCH_AT91)
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index b88df7a350b8..2129377c0de6 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -44,7 +44,6 @@ obj-$(CONFIG_VMWARE_BALLOON) += vmw_balloon.o
44obj-$(CONFIG_ARM_CHARLCD) += arm-charlcd.o 44obj-$(CONFIG_ARM_CHARLCD) += arm-charlcd.o
45obj-$(CONFIG_PCH_PHUB) += pch_phub.o 45obj-$(CONFIG_PCH_PHUB) += pch_phub.o
46obj-y += ti-st/ 46obj-y += ti-st/
47obj-$(CONFIG_AB8500_PWM) += ab8500-pwm.o
48obj-y += lis3lv02d/ 47obj-y += lis3lv02d/
49obj-y += carma/ 48obj-y += carma/
50obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o 49obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o
diff --git a/drivers/misc/ab8500-pwm.c b/drivers/misc/ab8500-pwm.c
deleted file mode 100644
index d7a9aa14e5d5..000000000000
--- a/drivers/misc/ab8500-pwm.c
+++ /dev/null
@@ -1,169 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Arun R Murthy <arun.murthy@stericsson.com>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7#include <linux/err.h>
8#include <linux/platform_device.h>
9#include <linux/slab.h>
10#include <linux/pwm.h>
11#include <linux/mfd/abx500.h>
12#include <linux/mfd/abx500/ab8500.h>
13#include <linux/module.h>
14
15/*
16 * PWM Out generators
17 * Bank: 0x10
18 */
19#define AB8500_PWM_OUT_CTRL1_REG 0x60
20#define AB8500_PWM_OUT_CTRL2_REG 0x61
21#define AB8500_PWM_OUT_CTRL7_REG 0x66
22
23/* backlight driver constants */
24#define ENABLE_PWM 1
25#define DISABLE_PWM 0
26
27struct pwm_device {
28 struct device *dev;
29 struct list_head node;
30 const char *label;
31 unsigned int pwm_id;
32};
33
34static LIST_HEAD(pwm_list);
35
36int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
37{
38 int ret = 0;
39 unsigned int higher_val, lower_val;
40 u8 reg;
41
42 /*
43 * get the first 8 bits that are be written to
44 * AB8500_PWM_OUT_CTRL1_REG[0:7]
45 */
46 lower_val = duty_ns & 0x00FF;
47 /*
48 * get bits [9:10] that are to be written to
49 * AB8500_PWM_OUT_CTRL2_REG[0:1]
50 */
51 higher_val = ((duty_ns & 0x0300) >> 8);
52
53 reg = AB8500_PWM_OUT_CTRL1_REG + ((pwm->pwm_id - 1) * 2);
54
55 ret = abx500_set_register_interruptible(pwm->dev, AB8500_MISC,
56 reg, (u8)lower_val);
57 if (ret < 0)
58 return ret;
59 ret = abx500_set_register_interruptible(pwm->dev, AB8500_MISC,
60 (reg + 1), (u8)higher_val);
61
62 return ret;
63}
64EXPORT_SYMBOL(pwm_config);
65
66int pwm_enable(struct pwm_device *pwm)
67{
68 int ret;
69
70 ret = abx500_mask_and_set_register_interruptible(pwm->dev,
71 AB8500_MISC, AB8500_PWM_OUT_CTRL7_REG,
72 1 << (pwm->pwm_id-1), ENABLE_PWM);
73 if (ret < 0)
74 dev_err(pwm->dev, "%s: Failed to disable PWM, Error %d\n",
75 pwm->label, ret);
76 return ret;
77}
78EXPORT_SYMBOL(pwm_enable);
79
80void pwm_disable(struct pwm_device *pwm)
81{
82 int ret;
83
84 ret = abx500_mask_and_set_register_interruptible(pwm->dev,
85 AB8500_MISC, AB8500_PWM_OUT_CTRL7_REG,
86 1 << (pwm->pwm_id-1), DISABLE_PWM);
87 if (ret < 0)
88 dev_err(pwm->dev, "%s: Failed to disable PWM, Error %d\n",
89 pwm->label, ret);
90 return;
91}
92EXPORT_SYMBOL(pwm_disable);
93
94struct pwm_device *pwm_request(int pwm_id, const char *label)
95{
96 struct pwm_device *pwm;
97
98 list_for_each_entry(pwm, &pwm_list, node) {
99 if (pwm->pwm_id == pwm_id) {
100 pwm->label = label;
101 pwm->pwm_id = pwm_id;
102 return pwm;
103 }
104 }
105
106 return ERR_PTR(-ENOENT);
107}
108EXPORT_SYMBOL(pwm_request);
109
110void pwm_free(struct pwm_device *pwm)
111{
112 pwm_disable(pwm);
113}
114EXPORT_SYMBOL(pwm_free);
115
116static int __devinit ab8500_pwm_probe(struct platform_device *pdev)
117{
118 struct pwm_device *pwm;
119 /*
120 * Nothing to be done in probe, this is required to get the
121 * device which is required for ab8500 read and write
122 */
123 pwm = kzalloc(sizeof(struct pwm_device), GFP_KERNEL);
124 if (pwm == NULL) {
125 dev_err(&pdev->dev, "failed to allocate memory\n");
126 return -ENOMEM;
127 }
128 pwm->dev = &pdev->dev;
129 pwm->pwm_id = pdev->id;
130 list_add_tail(&pwm->node, &pwm_list);
131 platform_set_drvdata(pdev, pwm);
132 dev_dbg(pwm->dev, "pwm probe successful\n");
133 return 0;
134}
135
136static int __devexit ab8500_pwm_remove(struct platform_device *pdev)
137{
138 struct pwm_device *pwm = platform_get_drvdata(pdev);
139 list_del(&pwm->node);
140 dev_dbg(&pdev->dev, "pwm driver removed\n");
141 kfree(pwm);
142 return 0;
143}
144
145static struct platform_driver ab8500_pwm_driver = {
146 .driver = {
147 .name = "ab8500-pwm",
148 .owner = THIS_MODULE,
149 },
150 .probe = ab8500_pwm_probe,
151 .remove = __devexit_p(ab8500_pwm_remove),
152};
153
154static int __init ab8500_pwm_init(void)
155{
156 return platform_driver_register(&ab8500_pwm_driver);
157}
158
159static void __exit ab8500_pwm_exit(void)
160{
161 platform_driver_unregister(&ab8500_pwm_driver);
162}
163
164subsys_initcall(ab8500_pwm_init);
165module_exit(ab8500_pwm_exit);
166MODULE_AUTHOR("Arun MURTHY <arun.murthy@stericsson.com>");
167MODULE_DESCRIPTION("AB8500 Pulse Width Modulation Driver");
168MODULE_ALIAS("platform:ab8500-pwm");
169MODULE_LICENSE("GPL v2");