From: Nicholas Mc Guire <der.herr@hofr.at>
To: Mark Brown <broonie@kernel.org>
Cc: Nicholas Mc Guire <hofrat@osadl.org>,
Bard Liao <bardliao@realtek.com>,
Oder Chiou <oder_chiou@realtek.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] ASoC: rt5663: use msleep() for uncritical delay
Date: Thu, 19 Jan 2017 12:24:26 +0000 [thread overview]
Message-ID: <20170119122425.GB2693@osadl.at> (raw)
In-Reply-To: <20170117193302.q4spr53qwrgqdrbh@sirena.org.uk>
On Tue, Jan 17, 2017 at 07:33:02PM +0000, Mark Brown wrote:
> On Wed, Jan 11, 2017 at 04:03:51PM +0100, Nicholas Mc Guire wrote:
> > The delay here does not seem to be critical with respect to longer
> > delays than 10ms as this delay is to ensure that the write took
> > effect before the next soc_update_bits/write call only, thus a
> > high resolution timer makes little sense here - msleep() should do.
>
> No, that's not what the code is doing at all.
>
> > +++ b/sound/soc/codecs/rt5663.c
> > @@ -2764,7 +2764,7 @@ static int rt5663_set_bias_level(struct snd_soc_codec *codec,
> > RT5663_PWR_FV1_MASK | RT5663_PWR_FV2_MASK |
> > RT5663_PWR_MB_MASK, RT5663_PWR_VREF1 |
> > RT5663_PWR_VREF2 | RT5663_PWR_MB);
> > - usleep_range(10000, 10005);
> > + msleep(10);
>
> The write before is turning on a bunch of analogue power bits, the
> enabled supplies will then take time to ramp up to their operating
> state before we can proceed. That's not just "make sure the change took
> effect", there's a bit more to it than that, and power up sequences are
> generally very latency sensitive as they tend to happen in response to
> user input. People are generally picking the minimum value they can
> reliably get away with and a lot of effort goes into optimising the
> power up procedures.
>
> That doesn't mean that the change is bad but the analysis in the
> changelog is and could cause confusion.
ok - thanks for the explaination - you are right that I was not seeing
the actual intent of the delay here but simply took it as a I/O delay.
The change should stay valid as both msleep() and usleep_range() can
very significantly overrun their stated values and that should be safe here
(or the code has a deeper rooted problem) while the usage of the high-resolution
timers does not seem to bring any benefit here.
Will clean up the commit message and resend this as well.
thx!
hofrat
prev parent reply other threads:[~2017-01-19 12:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-11 15:03 [PATCH RFC] ASoC: rt5663: use msleep() for uncritical delay Nicholas Mc Guire
2017-01-17 19:33 ` Mark Brown
2017-01-19 12:24 ` Nicholas Mc Guire [this message]
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=20170119122425.GB2693@osadl.at \
--to=der.herr@hofr.at \
--cc=alsa-devel@alsa-project.org \
--cc=bardliao@realtek.com \
--cc=broonie@kernel.org \
--cc=hofrat@osadl.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oder_chiou@realtek.com \
--cc=perex@perex.cz \
--cc=tiwai@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox