Message ID | 20210824164801.28896-16-lakshmi.sowjanya.d@intel.com |
---|---|
State | New |
Headers | show |
Series | Review Request: Add support for Intel PMC | expand |
On Tue, Aug 24, 2021 at 6:48 PM <lakshmi.sowjanya.d@intel.com> wrote: > From: Christopher Hall <christopher.s.hall@intel.com> > > Add additional flag that can be set by drivers to indicate that the > driver will manage its own PWM state. When calling pwm_ops.apply the > driver applies the requested state change to the pwm_device reconciling, > if possible, any conflicting requests. > > Intel(R) Timed I/O devices support very limited PWM capabilities. The > duty cycle must always be 50% of the period. When changing one parameter > at a time through the sysfs interface, it isn't possible for the user or > the PWM subsystem to maintain this relation. > > Signed-off-by: Christopher Hall <christopher.s.hall@intel.com> > Signed-off-by: Tamal Saha <tamal.saha@intel.com> > Signed-off-by: Lakshmi Sowjanya D <lakshmi.sowjanya.d@intel.com> > Reviewed-by: Mark Gross <mgross@linux.intel.com> These PWM changes clearly need to be reviewed by the PWM subsystem maintainers, and I think all of the output generation portions of this really need to go into the PWM subsystem. Yours, Linus Walleij
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index 35e894f4a379..c658585ac3bc 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -554,7 +554,8 @@ int pwm_apply_state(struct pwm_device *pwm, const struct pwm_state *state) trace_pwm_apply(pwm, state); - pwm->state = *state; + if (!test_bit(PWMF_DRIVERMANAGEDSTATE, &pwm->flags)) + pwm->state = *state; /* * only do this after pwm->state was applied as some diff --git a/include/linux/pwm.h b/include/linux/pwm.h index a0b7e43049d5..d805fee81e2c 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h @@ -46,6 +46,7 @@ struct pwm_args { enum { PWMF_REQUESTED = 1 << 0, PWMF_EXPORTED = 1 << 1, + PWMF_DRIVERMANAGEDSTATE = 1 << 2, }; /*