diff options
Diffstat (limited to 'drivers/pwm/pwm-pxa.c')
-rw-r--r-- | drivers/pwm/pwm-pxa.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c index 20370e61de5a..dee6ab552a0a 100644 --- a/drivers/pwm/pwm-pxa.c +++ b/drivers/pwm/pwm-pxa.c | |||
@@ -23,14 +23,13 @@ | |||
23 | #include <asm/div64.h> | 23 | #include <asm/div64.h> |
24 | 24 | ||
25 | #define HAS_SECONDARY_PWM 0x10 | 25 | #define HAS_SECONDARY_PWM 0x10 |
26 | #define PWM_ID_BASE(d) ((d) & 0xf) | ||
27 | 26 | ||
28 | static const struct platform_device_id pwm_id_table[] = { | 27 | static const struct platform_device_id pwm_id_table[] = { |
29 | /* PWM has_secondary_pwm? */ | 28 | /* PWM has_secondary_pwm? */ |
30 | { "pxa25x-pwm", 0 }, | 29 | { "pxa25x-pwm", 0 }, |
31 | { "pxa27x-pwm", 0 | HAS_SECONDARY_PWM }, | 30 | { "pxa27x-pwm", HAS_SECONDARY_PWM }, |
32 | { "pxa168-pwm", 1 }, | 31 | { "pxa168-pwm", 0 }, |
33 | { "pxa910-pwm", 1 }, | 32 | { "pxa910-pwm", 0 }, |
34 | { }, | 33 | { }, |
35 | }; | 34 | }; |
36 | MODULE_DEVICE_TABLE(platform, pwm_id_table); | 35 | MODULE_DEVICE_TABLE(platform, pwm_id_table); |
@@ -48,7 +47,6 @@ struct pxa_pwm_chip { | |||
48 | struct device *dev; | 47 | struct device *dev; |
49 | 48 | ||
50 | struct clk *clk; | 49 | struct clk *clk; |
51 | int clk_enabled; | ||
52 | void __iomem *mmio_base; | 50 | void __iomem *mmio_base; |
53 | }; | 51 | }; |
54 | 52 | ||
@@ -108,24 +106,15 @@ static int pxa_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
108 | static int pxa_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) | 106 | static int pxa_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) |
109 | { | 107 | { |
110 | struct pxa_pwm_chip *pc = to_pxa_pwm_chip(chip); | 108 | struct pxa_pwm_chip *pc = to_pxa_pwm_chip(chip); |
111 | int rc = 0; | ||
112 | 109 | ||
113 | if (!pc->clk_enabled) { | 110 | return clk_prepare_enable(pc->clk); |
114 | rc = clk_prepare_enable(pc->clk); | ||
115 | if (!rc) | ||
116 | pc->clk_enabled++; | ||
117 | } | ||
118 | return rc; | ||
119 | } | 111 | } |
120 | 112 | ||
121 | static void pxa_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) | 113 | static void pxa_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) |
122 | { | 114 | { |
123 | struct pxa_pwm_chip *pc = to_pxa_pwm_chip(chip); | 115 | struct pxa_pwm_chip *pc = to_pxa_pwm_chip(chip); |
124 | 116 | ||
125 | if (pc->clk_enabled) { | 117 | clk_disable_unprepare(pc->clk); |
126 | clk_disable_unprepare(pc->clk); | ||
127 | pc->clk_enabled--; | ||
128 | } | ||
129 | } | 118 | } |
130 | 119 | ||
131 | static struct pwm_ops pxa_pwm_ops = { | 120 | static struct pwm_ops pxa_pwm_ops = { |
@@ -152,8 +141,6 @@ static int pwm_probe(struct platform_device *pdev) | |||
152 | if (IS_ERR(pwm->clk)) | 141 | if (IS_ERR(pwm->clk)) |
153 | return PTR_ERR(pwm->clk); | 142 | return PTR_ERR(pwm->clk); |
154 | 143 | ||
155 | pwm->clk_enabled = 0; | ||
156 | |||
157 | pwm->chip.dev = &pdev->dev; | 144 | pwm->chip.dev = &pdev->dev; |
158 | pwm->chip.ops = &pxa_pwm_ops; | 145 | pwm->chip.ops = &pxa_pwm_ops; |
159 | pwm->chip.base = -1; | 146 | pwm->chip.base = -1; |