diff options
author | Boris Brezillon <boris.brezillon@free-electrons.com> | 2015-07-01 04:21:47 -0400 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2015-07-20 03:46:06 -0400 |
commit | 5c31252c4a86dc591c23f1a951edd52ad791ef0e (patch) | |
tree | 4a955e92027bbf95cd5fc9222245c0e4c8810a43 | |
parent | d770e558e21961ad6cfdf0ff7df0eb5d7d4f0754 (diff) |
pwm: Add the pwm_is_enabled() helper
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 <boris.brezillon@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
-rw-r--r-- | drivers/pwm/core.c | 4 | ||||
-rw-r--r-- | drivers/pwm/pwm-atmel-tcb.c | 2 | ||||
-rw-r--r-- | drivers/pwm/pwm-atmel.c | 6 | ||||
-rw-r--r-- | drivers/pwm/pwm-bcm-kona.c | 4 | ||||
-rw-r--r-- | drivers/pwm/pwm-ep93xx.c | 4 | ||||
-rw-r--r-- | drivers/pwm/pwm-imx.c | 2 | ||||
-rw-r--r-- | drivers/pwm/pwm-mxs.c | 4 | ||||
-rw-r--r-- | drivers/pwm/pwm-renesas-tpu.c | 2 | ||||
-rw-r--r-- | drivers/pwm/pwm-tegra.c | 6 | ||||
-rw-r--r-- | drivers/pwm/pwm-tiecap.c | 10 | ||||
-rw-r--r-- | drivers/pwm/pwm-tiehrpwm.c | 6 | ||||
-rw-r--r-- | drivers/pwm/sysfs.c | 2 | ||||
-rw-r--r-- | include/linux/pwm.h | 5 |
13 files changed, 31 insertions, 26 deletions
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 3a7769fe53de..f7c11d2dec37 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c | |||
@@ -455,7 +455,7 @@ int pwm_set_polarity(struct pwm_device *pwm, enum pwm_polarity polarity) | |||
455 | if (!pwm->chip->ops->set_polarity) | 455 | if (!pwm->chip->ops->set_polarity) |
456 | return -ENOSYS; | 456 | return -ENOSYS; |
457 | 457 | ||
458 | if (test_bit(PWMF_ENABLED, &pwm->flags)) | 458 | if (pwm_is_enabled(pwm)) |
459 | return -EBUSY; | 459 | return -EBUSY; |
460 | 460 | ||
461 | err = pwm->chip->ops->set_polarity(pwm->chip, pwm, polarity); | 461 | err = pwm->chip->ops->set_polarity(pwm->chip, pwm, polarity); |
@@ -853,7 +853,7 @@ static void pwm_dbg_show(struct pwm_chip *chip, struct seq_file *s) | |||
853 | if (test_bit(PWMF_REQUESTED, &pwm->flags)) | 853 | if (test_bit(PWMF_REQUESTED, &pwm->flags)) |
854 | seq_puts(s, " requested"); | 854 | seq_puts(s, " requested"); |
855 | 855 | ||
856 | if (test_bit(PWMF_ENABLED, &pwm->flags)) | 856 | if (pwm_is_enabled(pwm)) |
857 | seq_puts(s, " enabled"); | 857 | seq_puts(s, " enabled"); |
858 | 858 | ||
859 | seq_puts(s, "\n"); | 859 | seq_puts(s, "\n"); |
diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c index d14e0677c92d..6da01b3bf6f4 100644 --- a/drivers/pwm/pwm-atmel-tcb.c +++ b/drivers/pwm/pwm-atmel-tcb.c | |||
@@ -347,7 +347,7 @@ static int atmel_tcb_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
347 | tcbpwm->duty = duty; | 347 | tcbpwm->duty = duty; |
348 | 348 | ||
349 | /* If the PWM is enabled, call enable to apply the new conf */ | 349 | /* If the PWM is enabled, call enable to apply the new conf */ |
350 | if (test_bit(PWMF_ENABLED, &pwm->flags)) | 350 | if (pwm_is_enabled(pwm)) |
351 | atmel_tcb_pwm_enable(chip, pwm); | 351 | atmel_tcb_pwm_enable(chip, pwm); |
352 | 352 | ||
353 | return 0; | 353 | return 0; |
diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c index a947c9095d9d..b3b294de88e0 100644 --- a/drivers/pwm/pwm-atmel.c +++ b/drivers/pwm/pwm-atmel.c | |||
@@ -114,7 +114,7 @@ static int atmel_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
114 | u32 val; | 114 | u32 val; |
115 | int ret; | 115 | int ret; |
116 | 116 | ||
117 | if (test_bit(PWMF_ENABLED, &pwm->flags) && (period_ns != pwm->period)) { | 117 | if (pwm_is_enabled(pwm) && (period_ns != pwm->period)) { |
118 | dev_err(chip->dev, "cannot change PWM period while enabled\n"); | 118 | dev_err(chip->dev, "cannot change PWM period while enabled\n"); |
119 | return -EBUSY; | 119 | return -EBUSY; |
120 | } | 120 | } |
@@ -176,7 +176,7 @@ static void atmel_pwm_config_v1(struct pwm_chip *chip, struct pwm_device *pwm, | |||
176 | * If the PWM channel is enabled, only update CDTY by using the update | 176 | * If the PWM channel is enabled, only update CDTY by using the update |
177 | * register, it needs to set bit 10 of CMR to 0 | 177 | * register, it needs to set bit 10 of CMR to 0 |
178 | */ | 178 | */ |
179 | if (test_bit(PWMF_ENABLED, &pwm->flags)) | 179 | if (pwm_is_enabled(pwm)) |
180 | return; | 180 | return; |
181 | /* | 181 | /* |
182 | * If the PWM channel is disabled, write value to duty and period | 182 | * If the PWM channel is disabled, write value to duty and period |
@@ -191,7 +191,7 @@ static void atmel_pwm_config_v2(struct pwm_chip *chip, struct pwm_device *pwm, | |||
191 | { | 191 | { |
192 | struct atmel_pwm_chip *atmel_pwm = to_atmel_pwm_chip(chip); | 192 | struct atmel_pwm_chip *atmel_pwm = to_atmel_pwm_chip(chip); |
193 | 193 | ||
194 | if (test_bit(PWMF_ENABLED, &pwm->flags)) { | 194 | if (pwm_is_enabled(pwm)) { |
195 | /* | 195 | /* |
196 | * If the PWM channel is enabled, using the duty update register | 196 | * If the PWM channel is enabled, using the duty update register |
197 | * to update the value. | 197 | * to update the value. |
diff --git a/drivers/pwm/pwm-bcm-kona.c b/drivers/pwm/pwm-bcm-kona.c index 7af8fea2dc5b..dfdcf88279ae 100644 --- a/drivers/pwm/pwm-bcm-kona.c +++ b/drivers/pwm/pwm-bcm-kona.c | |||
@@ -134,7 +134,7 @@ static int kona_pwmc_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
134 | } | 134 | } |
135 | 135 | ||
136 | /* If the PWM channel is enabled, write the settings to the HW */ | 136 | /* If the PWM channel is enabled, write the settings to the HW */ |
137 | if (test_bit(PWMF_ENABLED, &pwm->flags)) { | 137 | if (pwm_is_enabled(pwm)) { |
138 | value = readl(kp->base + PRESCALE_OFFSET); | 138 | value = readl(kp->base + PRESCALE_OFFSET); |
139 | value &= ~PRESCALE_MASK(chan); | 139 | value &= ~PRESCALE_MASK(chan); |
140 | value |= prescale << PRESCALE_SHIFT(chan); | 140 | value |= prescale << PRESCALE_SHIFT(chan); |
@@ -287,7 +287,7 @@ static int kona_pwmc_remove(struct platform_device *pdev) | |||
287 | unsigned int chan; | 287 | unsigned int chan; |
288 | 288 | ||
289 | for (chan = 0; chan < kp->chip.npwm; chan++) | 289 | for (chan = 0; chan < kp->chip.npwm; chan++) |
290 | if (test_bit(PWMF_ENABLED, &kp->chip.pwms[chan].flags)) | 290 | if (pwm_is_enabled(&kp->chip.pwms[chan])) |
291 | clk_disable_unprepare(kp->clk); | 291 | clk_disable_unprepare(kp->clk); |
292 | 292 | ||
293 | return pwmchip_remove(&kp->chip); | 293 | return pwmchip_remove(&kp->chip); |
diff --git a/drivers/pwm/pwm-ep93xx.c b/drivers/pwm/pwm-ep93xx.c index e593e9c45c51..bbf10ae02f0e 100644 --- a/drivers/pwm/pwm-ep93xx.c +++ b/drivers/pwm/pwm-ep93xx.c | |||
@@ -82,7 +82,7 @@ static int ep93xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
82 | * The clock needs to be enabled to access the PWM registers. | 82 | * The clock needs to be enabled to access the PWM registers. |
83 | * Configuration can be changed at any time. | 83 | * Configuration can be changed at any time. |
84 | */ | 84 | */ |
85 | if (!test_bit(PWMF_ENABLED, &pwm->flags)) { | 85 | if (!pwm_is_enabled(pwm)) { |
86 | ret = clk_enable(ep93xx_pwm->clk); | 86 | ret = clk_enable(ep93xx_pwm->clk); |
87 | if (ret) | 87 | if (ret) |
88 | return ret; | 88 | return ret; |
@@ -113,7 +113,7 @@ static int ep93xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
113 | ret = -EINVAL; | 113 | ret = -EINVAL; |
114 | } | 114 | } |
115 | 115 | ||
116 | if (!test_bit(PWMF_ENABLED, &pwm->flags)) | 116 | if (!pwm_is_enabled(pwm)) |
117 | clk_disable(ep93xx_pwm->clk); | 117 | clk_disable(ep93xx_pwm->clk); |
118 | 118 | ||
119 | return ret; | 119 | return ret; |
diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c index 66d6f0c5c421..008dc646225e 100644 --- a/drivers/pwm/pwm-imx.c +++ b/drivers/pwm/pwm-imx.c | |||
@@ -114,7 +114,7 @@ static int imx_pwm_config_v2(struct pwm_chip *chip, | |||
114 | unsigned long long c; | 114 | unsigned long long c; |
115 | unsigned long period_cycles, duty_cycles, prescale; | 115 | unsigned long period_cycles, duty_cycles, prescale; |
116 | unsigned int period_ms; | 116 | unsigned int period_ms; |
117 | bool enable = test_bit(PWMF_ENABLED, &pwm->flags); | 117 | bool enable = pwm_is_enabled(pwm); |
118 | int wait_count = 0, fifoav; | 118 | int wait_count = 0, fifoav; |
119 | u32 cr, sr; | 119 | u32 cr, sr; |
120 | 120 | ||
diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c index b430811e14f5..9a596324ebef 100644 --- a/drivers/pwm/pwm-mxs.c +++ b/drivers/pwm/pwm-mxs.c | |||
@@ -77,7 +77,7 @@ static int mxs_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
77 | * If the PWM channel is disabled, make sure to turn on the clock | 77 | * If the PWM channel is disabled, make sure to turn on the clock |
78 | * before writing the register. Otherwise, keep it enabled. | 78 | * before writing the register. Otherwise, keep it enabled. |
79 | */ | 79 | */ |
80 | if (!test_bit(PWMF_ENABLED, &pwm->flags)) { | 80 | if (!pwm_is_enabled(pwm)) { |
81 | ret = clk_prepare_enable(mxs->clk); | 81 | ret = clk_prepare_enable(mxs->clk); |
82 | if (ret) | 82 | if (ret) |
83 | return ret; | 83 | return ret; |
@@ -92,7 +92,7 @@ static int mxs_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
92 | /* | 92 | /* |
93 | * If the PWM is not enabled, turn the clock off again to save power. | 93 | * If the PWM is not enabled, turn the clock off again to save power. |
94 | */ | 94 | */ |
95 | if (!test_bit(PWMF_ENABLED, &pwm->flags)) | 95 | if (!pwm_is_enabled(pwm)) |
96 | clk_disable_unprepare(mxs->clk); | 96 | clk_disable_unprepare(mxs->clk); |
97 | 97 | ||
98 | return 0; | 98 | return 0; |
diff --git a/drivers/pwm/pwm-renesas-tpu.c b/drivers/pwm/pwm-renesas-tpu.c index ee63f9e9d0fb..075c1a764ba2 100644 --- a/drivers/pwm/pwm-renesas-tpu.c +++ b/drivers/pwm/pwm-renesas-tpu.c | |||
@@ -301,7 +301,7 @@ static int tpu_pwm_config(struct pwm_chip *chip, struct pwm_device *_pwm, | |||
301 | pwm->duty = duty; | 301 | pwm->duty = duty; |
302 | 302 | ||
303 | /* If the channel is disabled we're done. */ | 303 | /* If the channel is disabled we're done. */ |
304 | if (!test_bit(PWMF_ENABLED, &_pwm->flags)) | 304 | if (!pwm_is_enabled(_pwm)) |
305 | return 0; | 305 | return 0; |
306 | 306 | ||
307 | if (duty_only && pwm->timer_on) { | 307 | if (duty_only && pwm->timer_on) { |
diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c index cabd7d8e05cc..d4de0607b502 100644 --- a/drivers/pwm/pwm-tegra.c +++ b/drivers/pwm/pwm-tegra.c | |||
@@ -112,7 +112,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
112 | * If the PWM channel is disabled, make sure to turn on the clock | 112 | * If the PWM channel is disabled, make sure to turn on the clock |
113 | * before writing the register. Otherwise, keep it enabled. | 113 | * before writing the register. Otherwise, keep it enabled. |
114 | */ | 114 | */ |
115 | if (!test_bit(PWMF_ENABLED, &pwm->flags)) { | 115 | if (!pwm_is_enabled(pwm)) { |
116 | err = clk_prepare_enable(pc->clk); | 116 | err = clk_prepare_enable(pc->clk); |
117 | if (err < 0) | 117 | if (err < 0) |
118 | return err; | 118 | return err; |
@@ -124,7 +124,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
124 | /* | 124 | /* |
125 | * If the PWM is not enabled, turn the clock off again to save power. | 125 | * If the PWM is not enabled, turn the clock off again to save power. |
126 | */ | 126 | */ |
127 | if (!test_bit(PWMF_ENABLED, &pwm->flags)) | 127 | if (!pwm_is_enabled(pwm)) |
128 | clk_disable_unprepare(pc->clk); | 128 | clk_disable_unprepare(pc->clk); |
129 | 129 | ||
130 | return 0; | 130 | return 0; |
@@ -214,7 +214,7 @@ static int tegra_pwm_remove(struct platform_device *pdev) | |||
214 | for (i = 0; i < NUM_PWM; i++) { | 214 | for (i = 0; i < NUM_PWM; i++) { |
215 | struct pwm_device *pwm = &pc->chip.pwms[i]; | 215 | struct pwm_device *pwm = &pc->chip.pwms[i]; |
216 | 216 | ||
217 | if (!test_bit(PWMF_ENABLED, &pwm->flags)) | 217 | if (!pwm_is_enabled(pwm)) |
218 | if (clk_prepare_enable(pc->clk) < 0) | 218 | if (clk_prepare_enable(pc->clk) < 0) |
219 | continue; | 219 | continue; |
220 | 220 | ||
diff --git a/drivers/pwm/pwm-tiecap.c b/drivers/pwm/pwm-tiecap.c index e557befdf4e6..616af764a276 100644 --- a/drivers/pwm/pwm-tiecap.c +++ b/drivers/pwm/pwm-tiecap.c | |||
@@ -97,7 +97,7 @@ static int ecap_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
97 | 97 | ||
98 | writew(reg_val, pc->mmio_base + ECCTL2); | 98 | writew(reg_val, pc->mmio_base + ECCTL2); |
99 | 99 | ||
100 | if (!test_bit(PWMF_ENABLED, &pwm->flags)) { | 100 | if (!pwm_is_enabled(pwm)) { |
101 | /* Update active registers if not running */ | 101 | /* Update active registers if not running */ |
102 | writel(duty_cycles, pc->mmio_base + CAP2); | 102 | writel(duty_cycles, pc->mmio_base + CAP2); |
103 | writel(period_cycles, pc->mmio_base + CAP1); | 103 | writel(period_cycles, pc->mmio_base + CAP1); |
@@ -111,7 +111,7 @@ static int ecap_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
111 | writel(period_cycles, pc->mmio_base + CAP3); | 111 | writel(period_cycles, pc->mmio_base + CAP3); |
112 | } | 112 | } |
113 | 113 | ||
114 | if (!test_bit(PWMF_ENABLED, &pwm->flags)) { | 114 | if (!pwm_is_enabled(pwm)) { |
115 | reg_val = readw(pc->mmio_base + ECCTL2); | 115 | reg_val = readw(pc->mmio_base + ECCTL2); |
116 | /* Disable APWM mode to put APWM output Low */ | 116 | /* Disable APWM mode to put APWM output Low */ |
117 | reg_val &= ~ECCTL2_APWM_MODE; | 117 | reg_val &= ~ECCTL2_APWM_MODE; |
@@ -179,7 +179,7 @@ static void ecap_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) | |||
179 | 179 | ||
180 | static void ecap_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) | 180 | static void ecap_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) |
181 | { | 181 | { |
182 | if (test_bit(PWMF_ENABLED, &pwm->flags)) { | 182 | if (pwm_is_enabled(pwm)) { |
183 | dev_warn(chip->dev, "Removing PWM device without disabling\n"); | 183 | dev_warn(chip->dev, "Removing PWM device without disabling\n"); |
184 | pm_runtime_put_sync(chip->dev); | 184 | pm_runtime_put_sync(chip->dev); |
185 | } | 185 | } |
@@ -306,7 +306,7 @@ static int ecap_pwm_suspend(struct device *dev) | |||
306 | ecap_pwm_save_context(pc); | 306 | ecap_pwm_save_context(pc); |
307 | 307 | ||
308 | /* Disable explicitly if PWM is running */ | 308 | /* Disable explicitly if PWM is running */ |
309 | if (test_bit(PWMF_ENABLED, &pwm->flags)) | 309 | if (pwm_is_enabled(pwm)) |
310 | pm_runtime_put_sync(dev); | 310 | pm_runtime_put_sync(dev); |
311 | 311 | ||
312 | return 0; | 312 | return 0; |
@@ -318,7 +318,7 @@ static int ecap_pwm_resume(struct device *dev) | |||
318 | struct pwm_device *pwm = pc->chip.pwms; | 318 | struct pwm_device *pwm = pc->chip.pwms; |
319 | 319 | ||
320 | /* Enable explicitly if PWM was running */ | 320 | /* Enable explicitly if PWM was running */ |
321 | if (test_bit(PWMF_ENABLED, &pwm->flags)) | 321 | if (pwm_is_enabled(pwm)) |
322 | pm_runtime_get_sync(dev); | 322 | pm_runtime_get_sync(dev); |
323 | 323 | ||
324 | ecap_pwm_restore_context(pc); | 324 | ecap_pwm_restore_context(pc); |
diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c index 694b3cf7694b..6a41e66015b6 100644 --- a/drivers/pwm/pwm-tiehrpwm.c +++ b/drivers/pwm/pwm-tiehrpwm.c | |||
@@ -407,7 +407,7 @@ static void ehrpwm_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) | |||
407 | { | 407 | { |
408 | struct ehrpwm_pwm_chip *pc = to_ehrpwm_pwm_chip(chip); | 408 | struct ehrpwm_pwm_chip *pc = to_ehrpwm_pwm_chip(chip); |
409 | 409 | ||
410 | if (test_bit(PWMF_ENABLED, &pwm->flags)) { | 410 | if (pwm_is_enabled(pwm)) { |
411 | dev_warn(chip->dev, "Removing PWM device without disabling\n"); | 411 | dev_warn(chip->dev, "Removing PWM device without disabling\n"); |
412 | pm_runtime_put_sync(chip->dev); | 412 | pm_runtime_put_sync(chip->dev); |
413 | } | 413 | } |
@@ -565,7 +565,7 @@ static int ehrpwm_pwm_suspend(struct device *dev) | |||
565 | for (i = 0; i < pc->chip.npwm; i++) { | 565 | for (i = 0; i < pc->chip.npwm; i++) { |
566 | struct pwm_device *pwm = &pc->chip.pwms[i]; | 566 | struct pwm_device *pwm = &pc->chip.pwms[i]; |
567 | 567 | ||
568 | if (!test_bit(PWMF_ENABLED, &pwm->flags)) | 568 | if (!pwm_is_enabled(pwm)) |
569 | continue; | 569 | continue; |
570 | 570 | ||
571 | /* Disable explicitly if PWM is running */ | 571 | /* Disable explicitly if PWM is running */ |
@@ -582,7 +582,7 @@ static int ehrpwm_pwm_resume(struct device *dev) | |||
582 | for (i = 0; i < pc->chip.npwm; i++) { | 582 | for (i = 0; i < pc->chip.npwm; i++) { |
583 | struct pwm_device *pwm = &pc->chip.pwms[i]; | 583 | struct pwm_device *pwm = &pc->chip.pwms[i]; |
584 | 584 | ||
585 | if (!test_bit(PWMF_ENABLED, &pwm->flags)) | 585 | if (!pwm_is_enabled(pwm)) |
586 | continue; | 586 | continue; |
587 | 587 | ||
588 | /* Enable explicitly if PWM was running */ | 588 | /* Enable explicitly if PWM was running */ |
diff --git a/drivers/pwm/sysfs.c b/drivers/pwm/sysfs.c index 4bd0c639e16d..eecf21d68108 100644 --- a/drivers/pwm/sysfs.c +++ b/drivers/pwm/sysfs.c | |||
@@ -97,7 +97,7 @@ static ssize_t pwm_enable_show(struct device *child, | |||
97 | char *buf) | 97 | char *buf) |
98 | { | 98 | { |
99 | const struct pwm_device *pwm = child_to_pwm_device(child); | 99 | const struct pwm_device *pwm = child_to_pwm_device(child); |
100 | int enabled = test_bit(PWMF_ENABLED, &pwm->flags); | 100 | int enabled = pwm_is_enabled(pwm); |
101 | 101 | ||
102 | return sprintf(buf, "%d\n", enabled); | 102 | return sprintf(buf, "%d\n", enabled); |
103 | } | 103 | } |
diff --git a/include/linux/pwm.h b/include/linux/pwm.h index 36262d08a9da..ec34f4d9a9ee 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h | |||
@@ -92,6 +92,11 @@ struct pwm_device { | |||
92 | enum pwm_polarity polarity; | 92 | enum pwm_polarity polarity; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | static inline bool pwm_is_enabled(const struct pwm_device *pwm) | ||
96 | { | ||
97 | return test_bit(PWMF_ENABLED, &pwm->flags); | ||
98 | } | ||
99 | |||
95 | static inline void pwm_set_period(struct pwm_device *pwm, unsigned int period) | 100 | static inline void pwm_set_period(struct pwm_device *pwm, unsigned int period) |
96 | { | 101 | { |
97 | if (pwm) | 102 | if (pwm) |