Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1376746

Re: [PATCH v5 15/46] pwm: introduce the pwm_state concept

From Thierry Reding <thierry.reding@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v5 15/46] pwm: introduce the pwm_state concept
Date 2016-04-12 14:30 +0200
Message-ID <rn5Ca-7oG-11@gated-at.bofh.it> (permalink)
References <riuBc-28V-5@gated-at.bofh.it> <riuKT-2cZ-37@gated-at.bofh.it> <rn4Zs-6Nd-5@gated-at.bofh.it> <rn5st-7hl-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Tue, Apr 12, 2016 at 02:17:18PM +0200, Boris Brezillon wrote:
> On Tue, 12 Apr 2016 13:49:04 +0200
> Thierry Reding <thierry.reding@gmail.com> wrote:
> 
> > On Wed, Mar 30, 2016 at 10:03:38PM +0200, Boris Brezillon wrote:
> > > 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 <boris.brezillon@free-electrons.com>
> > > ---
> > >  drivers/pwm/core.c  |  8 ++++----
> > >  include/linux/pwm.h | 54 +++++++++++++++++++++++++++++++++++++++++------------
> > >  2 files changed, 46 insertions(+), 16 deletions(-)
> > > 
> > > diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
> > > index 6433059..f3f91e7 100644
> > > --- a/drivers/pwm/core.c
> > > +++ b/drivers/pwm/core.c
> > > @@ -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;
> > 
> > Would this not more correctly be assigned to pwm->args.polarity? After
> > all this is setting up the "initial" state, much like DT or the lookup
> > tables would for duty cycle and period.
> 
> Yes, I wasn't sure about the pwm_add_with_polarity() meaning. To me,
> all the reference info should be extracted from DT, PWM lookup table or
> driver specific ->request() implementation, but I can definitely
> initialize the args.polarity here too.
> 
> Should I keep the pwm->state.polarity assignment (to set the initial
> polarity when the driver does not support hardware readout)?

Wouldn't this work automatically as part of the pwm_apply_args() helper
if we extended it with this setting?

Thierry

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v5 15/46] pwm: introduce the pwm_state concept Thierry Reding <thierry.reding@gmail.com> - 2016-04-12 13:50 +0200
  Re: [PATCH v5 15/46] pwm: introduce the pwm_state concept Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-04-12 14:20 +0200
    Re: [PATCH v5 15/46] pwm: introduce the pwm_state concept Thierry Reding <thierry.reding@gmail.com> - 2016-04-12 14:30 +0200
      Re: [PATCH v5 15/46] pwm: introduce the pwm_state concept Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-04-12 14:50 +0200
        Re: [PATCH v5 15/46] pwm: introduce the pwm_state concept Thierry Reding <thierry.reding@gmail.com> - 2016-04-12 15:20 +0200
          Re: [PATCH v5 15/46] pwm: introduce the pwm_state concept Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-04-12 15:30 +0200
            Re: [PATCH v5 15/46] pwm: introduce the pwm_state concept Thierry Reding <thierry.reding@gmail.com> - 2016-04-12 16:10 +0200
              Re: [PATCH v5 15/46] pwm: introduce the pwm_state concept Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-04-12 16:20 +0200

csiph-web