diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-19 11:19:07 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-19 11:19:07 -0500 |
commit | 74779e22261172ea728b989310f6ecc991b57d62 (patch) | |
tree | a6c71e02bf6cefc9e0d261dd1ab11f4a7433ed92 /drivers/pwm/core.c | |
parent | 5031a2a7c12b837a0913c4139ebeb6bbff5e1aa5 (diff) | |
parent | 20e8ac3eea4dcfeea6ebeae57cd2c739fa48da11 (diff) |
Merge tag 'for-3.8-rc1' of git://gitorious.org/linux-pwm/linux-pwm
Pull pwm changes from Thierry Reding:
"A new driver has been added for the SPEAr platform and the
TWL4030/6030 driver has been replaced by two drivers that control the
regular PWMs and the PWM driven LEDs provided by the chips.
The vt8500, tiecap, tiehrpwm, i.MX, LPC32xx and Samsung drivers have
all been improved and the device tree bindings now support the PWM
signal polarity."
Fix up trivial conflicts due to __devinit/exit removal.
* tag 'for-3.8-rc1' of git://gitorious.org/linux-pwm/linux-pwm: (21 commits)
pwm: samsung: add missing s3c->pwm_id assignment
pwm: lpc32xx: Set the chip base for dynamic allocation
pwm: lpc32xx: Properly disable the clock on device removal
pwm: lpc32xx: Fix the PWM polarity
pwm: i.MX: eliminate build warning
pwm: Export of_pwm_xlate_with_flags()
pwm: Remove pwm-twl6030 driver
pwm: New driver to support PWM driven LEDs on TWL4030/6030 series of PMICs
pwm: New driver to support PWMs on TWL4030/6030 series of PMICs
pwm: pwm-tiehrpwm: pinctrl support
pwm: tiehrpwm: Add device-tree binding
pwm: pwm-tiehrpwm: Adding TBCLK gating support.
pwm: pwm-tiecap: pinctrl support
pwm: tiecap: Add device-tree binding
pwm: Add TI PWM subsystem driver
pwm: Device tree support for PWM polarity
pwm: vt8500: Ensure PWM clock is enabled during pwm_config
pwm: vt8500: Fix build error
pwm: spear: Staticize spear_pwm_config()
pwm: Add SPEAr PWM chip driver support
...
Diffstat (limited to 'drivers/pwm/core.c')
-rw-r--r-- | drivers/pwm/core.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index f5acdaa52707..903138b18842 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c | |||
@@ -32,6 +32,9 @@ | |||
32 | 32 | ||
33 | #define MAX_PWMS 1024 | 33 | #define MAX_PWMS 1024 |
34 | 34 | ||
35 | /* flags in the third cell of the DT PWM specifier */ | ||
36 | #define PWM_SPEC_POLARITY (1 << 0) | ||
37 | |||
35 | static DEFINE_MUTEX(pwm_lookup_lock); | 38 | static DEFINE_MUTEX(pwm_lookup_lock); |
36 | static LIST_HEAD(pwm_lookup_list); | 39 | static LIST_HEAD(pwm_lookup_list); |
37 | static DEFINE_MUTEX(pwm_lock); | 40 | static DEFINE_MUTEX(pwm_lock); |
@@ -129,6 +132,32 @@ static int pwm_device_request(struct pwm_device *pwm, const char *label) | |||
129 | return 0; | 132 | return 0; |
130 | } | 133 | } |
131 | 134 | ||
135 | struct pwm_device * | ||
136 | of_pwm_xlate_with_flags(struct pwm_chip *pc, const struct of_phandle_args *args) | ||
137 | { | ||
138 | struct pwm_device *pwm; | ||
139 | |||
140 | if (pc->of_pwm_n_cells < 3) | ||
141 | return ERR_PTR(-EINVAL); | ||
142 | |||
143 | if (args->args[0] >= pc->npwm) | ||
144 | return ERR_PTR(-EINVAL); | ||
145 | |||
146 | pwm = pwm_request_from_chip(pc, args->args[0], NULL); | ||
147 | if (IS_ERR(pwm)) | ||
148 | return pwm; | ||
149 | |||
150 | pwm_set_period(pwm, args->args[1]); | ||
151 | |||
152 | if (args->args[2] & PWM_SPEC_POLARITY) | ||
153 | pwm_set_polarity(pwm, PWM_POLARITY_INVERSED); | ||
154 | else | ||
155 | pwm_set_polarity(pwm, PWM_POLARITY_NORMAL); | ||
156 | |||
157 | return pwm; | ||
158 | } | ||
159 | EXPORT_SYMBOL_GPL(of_pwm_xlate_with_flags); | ||
160 | |||
132 | static struct pwm_device * | 161 | static struct pwm_device * |
133 | of_pwm_simple_xlate(struct pwm_chip *pc, const struct of_phandle_args *args) | 162 | of_pwm_simple_xlate(struct pwm_chip *pc, const struct of_phandle_args *args) |
134 | { | 163 | { |