diff options
Diffstat (limited to 'include/linux/pwm.h')
-rw-r--r-- | include/linux/pwm.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/include/linux/pwm.h b/include/linux/pwm.h index 908b67c847cd..c038ae36b10e 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h | |||
@@ -464,6 +464,8 @@ static inline bool pwm_can_sleep(struct pwm_device *pwm) | |||
464 | 464 | ||
465 | static inline void pwm_apply_args(struct pwm_device *pwm) | 465 | static inline void pwm_apply_args(struct pwm_device *pwm) |
466 | { | 466 | { |
467 | struct pwm_state state = { }; | ||
468 | |||
467 | /* | 469 | /* |
468 | * PWM users calling pwm_apply_args() expect to have a fresh config | 470 | * PWM users calling pwm_apply_args() expect to have a fresh config |
469 | * where the polarity and period are set according to pwm_args info. | 471 | * where the polarity and period are set according to pwm_args info. |
@@ -476,18 +478,20 @@ static inline void pwm_apply_args(struct pwm_device *pwm) | |||
476 | * at startup (even if they are actually enabled), thus authorizing | 478 | * at startup (even if they are actually enabled), thus authorizing |
477 | * polarity setting. | 479 | * polarity setting. |
478 | * | 480 | * |
479 | * Instead of setting ->enabled to false, we call pwm_disable() | 481 | * To fulfill this requirement, we apply a new state which disables |
480 | * before pwm_set_polarity() to ensure that everything is configured | 482 | * the PWM device and set the reference period and polarity config. |
481 | * as expected, and the PWM is really disabled when the user request | ||
482 | * it. | ||
483 | * | 483 | * |
484 | * Note that PWM users requiring a smooth handover between the | 484 | * Note that PWM users requiring a smooth handover between the |
485 | * bootloader and the kernel (like critical regulators controlled by | 485 | * bootloader and the kernel (like critical regulators controlled by |
486 | * PWM devices) will have to switch to the atomic API and avoid calling | 486 | * PWM devices) will have to switch to the atomic API and avoid calling |
487 | * pwm_apply_args(). | 487 | * pwm_apply_args(). |
488 | */ | 488 | */ |
489 | pwm_disable(pwm); | 489 | |
490 | pwm_set_polarity(pwm, pwm->args.polarity); | 490 | state.enabled = false; |
491 | state.polarity = pwm->args.polarity; | ||
492 | state.period = pwm->args.period; | ||
493 | |||
494 | pwm_apply_state(pwm, &state); | ||
491 | } | 495 | } |
492 | 496 | ||
493 | struct pwm_lookup { | 497 | struct pwm_lookup { |