mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
pwm: Introduce the pwm_state concept
The PWM state, represented by its period, duty_cycle and polarity is currently directly stored in the PWM device. Declare a pwm_state structure embedding those field so that we can later use this struct to atomically update all the PWM parameters at once. All pwm_get_xxx() helpers are now implemented as wrappers around pwm_get_state(). Signed-off-by: Boris Brezillon <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
This commit is contained in:
parent
a8c3862551
commit
43a276b003
2 changed files with 46 additions and 16 deletions
|
|
@ -268,7 +268,7 @@ int pwmchip_add_with_polarity(struct pwm_chip *chip,
|
|||
pwm->chip = chip;
|
||||
pwm->pwm = chip->base + i;
|
||||
pwm->hwpwm = i;
|
||||
pwm->polarity = polarity;
|
||||
pwm->state.polarity = polarity;
|
||||
|
||||
radix_tree_insert(&pwm_tree, pwm->pwm, pwm);
|
||||
}
|
||||
|
|
@ -446,8 +446,8 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
pwm->duty_cycle = duty_ns;
|
||||
pwm->period = period_ns;
|
||||
pwm->state.duty_cycle = duty_ns;
|
||||
pwm->state.period = period_ns;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -480,7 +480,7 @@ int pwm_set_polarity(struct pwm_device *pwm, enum pwm_polarity polarity)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
pwm->polarity = polarity;
|
||||
pwm->state.polarity = polarity;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue