From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Ilkka Koskinen <ilkka.koskinen@intel.com>,
Hans de Goede <hdegoede@redhat.com>
Cc: Thierry Reding <thierry.reding@gmail.com>,
"linux-pwm@vger.kernel.org" <linux-pwm@vger.kernel.org>
Subject: Re: [PATCH 1/3] pwm: lpss: Do not set / wait_for update_bit when not enabled
Date: Tue, 28 Feb 2017 11:46:25 +0200 [thread overview]
Message-ID: <1488275185.20145.48.camel@linux.intel.com> (raw)
In-Reply-To: <20170223080623.GB61837@kammari>
On Thu, 2017-02-23 at 00:06 -0800, Ilkka Koskinen wrote:
> > At least on cherrytrail, the update bit will never go low when the
> > enabled bit is not set.
> >
> > This causes the backlight on my cube iwork8 air tablet to never go
> > on
> > again after being turned off, because the enable path does:
> >
> > pwm_lpss_prepare();
> > ret = pwm_lpss_update(pwm);
> > if (ret)
> > return ret;
> > pwm_lpss_write(pwm, pwm_lpss_read(pwm) | PWM_ENABLE);
> >
> > And the pwm_lpss_update() call fails, as the setting of the
> > UPDATE bit never gets acked, because the ENABLE bit is not set.
> >
> > Subsequent calls then all fail because of the pwm_lpss_is_updating()
> > check done by pwm_lpss_apply().
> >
> > This commit fixes this by setting the enable bit before calling
> > pwm_lpss_update().
This might break other systems.
> > @@ -137,12 +137,12 @@ static int pwm_lpss_apply(struct pwm_chip
> > *chip, struct pwm_device *pwm,
> > return ret;
> > }
> > pwm_lpss_prepare(lpwm, pwm, state-
> > >duty_cycle, state->period);
> > + pwm_lpss_write(pwm, pwm_lpss_read(pwm) |
> > PWM_ENABLE);
> > ret = pwm_lpss_update(pwm);
>
> The BXT documentation that I have recommends to set update bit before
> enable
> one.
We have the same work flow for all SoCs that have this PWM IP. I suspect
it might be a silicon bug somewhere, but I have never heard of it.
> However, based on your experiment on Cherryview, we still have to set
> it
> before read_poll_timeout().
I would test and confirm the issue on our machines to see that the fix
doesn't break the rest. Seems like we have several subtle different
implementation of it: BYT, CHT, MRFLD, BXT.
> Andy, should we indeed remove the return value from apply() and just
> print a warning
> like Mika initially suggested?
I definitely consider it better than Hans' initial proposal.
Hans, can you just replace
return ret;
by
dev_warn(..., "UPDATE bit is not cleared!\n");
and test it?
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
next prev parent reply other threads:[~2017-02-28 9:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-20 20:16 [PATCH 1/3] pwm: lpss: Bug-fix + 2 improvements Hans de Goede
2017-02-20 20:16 ` [PATCH 1/3] pwm: lpss: Do not set / wait_for update_bit when not enabled Hans de Goede
2017-02-23 8:06 ` Ilkka Koskinen
2017-02-28 9:46 ` Andy Shevchenko [this message]
2017-03-13 15:29 ` Hans de Goede
2017-02-20 20:16 ` [PATCH 2/3] pwm: lpss: Simplify update check in pwm_lpss_apply Hans de Goede
2017-02-20 20:16 ` [PATCH 3/3] pwm: lpss: Add get_state callback Hans de Goede
2017-02-21 10:33 ` Andy Shevchenko
2017-02-27 14:09 ` 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=1488275185.20145.48.camel@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=ilkka.koskinen@intel.com \
--cc=linux-pwm@vger.kernel.org \
--cc=thierry.reding@gmail.com \
/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.