Commit 20bfdca1 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pwm/for-4.7-rc6' of...

Merge tag 'pwm/for-4.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm

Pull pwm fixes from Thierry Reding:
 "One more fix for some fallout observed after the introduction of the
  atomic API"

* tag 'pwm/for-4.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm:
  pwm: Fix pwm_apply_args()
parents 4aa34ce3 33cdcee0
...@@ -464,6 +464,8 @@ static inline bool pwm_can_sleep(struct pwm_device *pwm) ...@@ -464,6 +464,8 @@ static inline bool pwm_can_sleep(struct pwm_device *pwm)
static inline void pwm_apply_args(struct pwm_device *pwm) static inline void pwm_apply_args(struct pwm_device *pwm)
{ {
struct pwm_state state = { };
/* /*
* PWM users calling pwm_apply_args() expect to have a fresh config * PWM users calling pwm_apply_args() expect to have a fresh config
* where the polarity and period are set according to pwm_args info. * 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,18 +478,20 @@ static inline void pwm_apply_args(struct pwm_device *pwm)
* at startup (even if they are actually enabled), thus authorizing * at startup (even if they are actually enabled), thus authorizing
* polarity setting. * polarity setting.
* *
* Instead of setting ->enabled to false, we call pwm_disable() * To fulfill this requirement, we apply a new state which disables
* before pwm_set_polarity() to ensure that everything is configured * the PWM device and set the reference period and polarity config.
* as expected, and the PWM is really disabled when the user request
* it.
* *
* Note that PWM users requiring a smooth handover between the * Note that PWM users requiring a smooth handover between the
* bootloader and the kernel (like critical regulators controlled by * bootloader and the kernel (like critical regulators controlled by
* PWM devices) will have to switch to the atomic API and avoid calling * PWM devices) will have to switch to the atomic API and avoid calling
* pwm_apply_args(). * pwm_apply_args().
*/ */
pwm_disable(pwm);
pwm_set_polarity(pwm, pwm->args.polarity); state.enabled = false;
state.polarity = pwm->args.polarity;
state.period = pwm->args.period;
pwm_apply_state(pwm, &state);
} }
struct pwm_lookup { struct pwm_lookup {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment