From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>,
Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>,
Andy Shevchenko <andy@infradead.org>,
linux-pwm@vger.kernel.org, Takashi Iwai <tiwai@suse.de>
Subject: Re: [PATCH v3] pwm: lpss: Add get_state callback
Date: Sun, 26 Mar 2017 15:34:52 +0300 [thread overview]
Message-ID: <1490531692.708.5.camel@linux.intel.com> (raw)
In-Reply-To: <29c21164-c5d7-3772-0bae-306780075ce6@redhat.com>
On Fri, 2017-03-10 at 22:13 +0100, Hans de Goede wrote:
> Hi,
>
> On 03/10/2017 04:49 PM, Andy Shevchenko wrote:
> > On Tue, 2017-02-28 at 15:09 +0100, Hans de Goede wrote:
> > > Hi,
> > >
> > > On 27-02-17 23:20, Andy Shevchenko wrote:
> > > > On Mon, Feb 27, 2017 at 6:59 PM, Hans de Goede <hdegoede@redhat.
> > > > com>
> > > > wrote:
> > > Ok, so maybe we should do this then ?
> > >
> > > if (freq == 0) {
> > > state->period = NSEC_PER_SEC;
> > > state->duty_cycle = NSEC_PER_SEC;
> > > return;
> > > }
> > >
> > > ?
> >
> > But the period is not that one. Can we assign them to 0?
>
> That will cause a divide by 0 in apply() when a user
> calls apply without changing / setting period.
I have to look closer to this one. Perhaps next week together with yours
other change.
> > > Anyways since we now may get a pm-ref during probe
> > > I will add the balancing (and equally conditional)
> > > put of that ref to pwm_lpss_remove().
> > >
> > > > Second question, how ->get_state() is supposed to work if power
> > > > is
> > > > off
> > > > when it enters it?
> > >
> > > get_state only gets called on probe and the device is guaranteed
> > > to
> > > be powered on during probe().
> >
> > Ah, seems I now understand what this call back actually does.
> >
> > So, the name of the callback a bit confusing, to me it sounds rather
> > "get_to_[initial_]state()".
> >
> > Thus, would it be better to split ->apply() to get a common part for
> > both?
>
> I don't understand what you mean here ? Ah I guess you mean split
> out the pm_runtime_get / put stuff. I don't think that is going
> to work well as apply compares old and new state and we do not
> have old state when get_state gets called.
I mean to have similar flow in ->get_state() and ->apply() when we
enable the device.
I don't like ->get_state() name as I mentioned before. If its
functionality is "get *to* (initial) state", that what we need to
implement.
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
next prev parent reply other threads:[~2017-03-26 12:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-27 16:59 [PATCH v3] pwm: lpss: Add get_state callback Hans de Goede
2017-02-27 22:20 ` Andy Shevchenko
2017-02-28 14:09 ` Hans de Goede
2017-03-10 15:49 ` Andy Shevchenko
2017-03-10 21:13 ` Hans de Goede
2017-03-26 12:34 ` Andy Shevchenko [this message]
2017-03-26 14:46 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1490531692.708.5.camel@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=andy@infradead.org \
--cc=hdegoede@redhat.com \
--cc=linux-pwm@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.