diff options
Diffstat (limited to 'drivers/pwm')
-rw-r--r-- | drivers/pwm/core.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index c6e05078d3ad..85592e97ef2d 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c | |||
@@ -379,6 +379,28 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) | |||
379 | EXPORT_SYMBOL_GPL(pwm_config); | 379 | EXPORT_SYMBOL_GPL(pwm_config); |
380 | 380 | ||
381 | /** | 381 | /** |
382 | * pwm_set_polarity() - configure the polarity of a PWM signal | ||
383 | * @pwm: PWM device | ||
384 | * @polarity: new polarity of the PWM signal | ||
385 | * | ||
386 | * Note that the polarity cannot be configured while the PWM device is enabled | ||
387 | */ | ||
388 | int pwm_set_polarity(struct pwm_device *pwm, enum pwm_polarity polarity) | ||
389 | { | ||
390 | if (!pwm || !pwm->chip->ops) | ||
391 | return -EINVAL; | ||
392 | |||
393 | if (!pwm->chip->ops->set_polarity) | ||
394 | return -ENOSYS; | ||
395 | |||
396 | if (test_bit(PWMF_ENABLED, &pwm->flags)) | ||
397 | return -EBUSY; | ||
398 | |||
399 | return pwm->chip->ops->set_polarity(pwm->chip, pwm, polarity); | ||
400 | } | ||
401 | EXPORT_SYMBOL_GPL(pwm_set_polarity); | ||
402 | |||
403 | /** | ||
382 | * pwm_enable() - start a PWM output toggling | 404 | * pwm_enable() - start a PWM output toggling |
383 | * @pwm: PWM device | 405 | * @pwm: PWM device |
384 | */ | 406 | */ |