From: Mark Brown <broonie@kernel.org>
To: Tzung-Bi Shih <tzungbi@google.com>
Cc: ALSA development <alsa-devel@alsa-project.org>,
Jimmy Cheng-Yi Chiang <cychiang@google.com>,
Takashi Iwai <tiwai@suse.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Liam Girdwood <lgirdwood@gmail.com>,
jarkko.nikula@linux.intel.com, Benson Leung <bleung@google.com>,
Dylan Reid <dgreid@google.com>, Hsin-yu Chao <hychao@google.com>
Subject: Re: [alsa-devel] Questions about max98090 codec driver
Date: Thu, 24 Oct 2019 20:14:11 +0100 [thread overview]
Message-ID: <20191024191411.GH46373@sirena.co.uk> (raw)
In-Reply-To: <CA+Px+wUAzwf1kYD8eMogE9Y6Euw4_-itc5EPWU19c_Sg6+ypQA@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 3360 bytes --]
On Fri, Oct 25, 2019 at 02:23:18AM +0800, Tzung-Bi Shih wrote:
> The playback stream becomes silent and the console keeps printing "PLL
> unlocked". But, if comment out the msleep(10) between the SHDN off
> and on, the issue fixed. I am trying to find the reason but facing
> further more questions and may need your inputs.
Wow, that's a bit special. I'm wondering if the PLL unlock error
handling isn't connected to the PLL configuration?
> I feel it is weird to sleep in max98090_pll_work(). Especially, at
> this line https://elixir.bootlin.com/linux/v5.4-rc2/source/sound/soc/codecs/max98090.c#L2125
> (it makes less sense to "wait" in another thread). Note that, the
> threaded IRQF_ONESHOT handler and max98090_pll_work() are in 2
> different threads.
Sleeping after starting a PLL to give it time to lock is pretty normal.
Doing so after stopping is a bit more fun.
> I guess the original intention is:
> - disable ULK interrupt in IRQ handler
> (https://elixir.bootlin.com/linux/v5.4-rc2/source/sound/soc/codecs/max98090.c#L2260)
> - schedule max98090_pll_work() to workaround it
> - wait 10ms to give PLL chance to lock
> - enable ULK interrupt again
> If max98090 claims its PLL is unlocked again, repeat the above by
> receiving another ULK interrupt.
I think so.
> 2. According to the datasheet page 164 table 90
> (https://datasheets.maximintegrated.com/en/ds/MAX98090.pdf), there are
> some registers should only be adjusted when SHDN==0. But I fail to
> find max98090.c tries to set SHDN to 0 and restore it afterwards when
> writing to these registers. For example,
> https://elixir.bootlin.com/linux/v5.4-rc2/source/sound/soc/codecs/max98090.c#L1897.
> I am wondering if it would bring any side effects because the
> datasheet states "Changing these settings during normal operation
> (SHDN=1) can compromise device stability and performance
> specifications."
That does sound like it might be causing problems, yes - even if it's
not the problem you're seeing it's probably a good idea to try to follow
the datsheet recommendation in case it's causing some other problem.
> 3. By searching some history data, I found a previous version did not
> have the msleep(10) between the SHDN off and on
> (https://crrev.com/c/191740, click the file name in the middle of the
> window to see the diff. Pardon me, I do not find another public
> repository for this). I am curious if anyone of you still remember
> why the upstream version contains the msleep(10). I am also curious
> if anyone of your environment works well with the upstream version
> max98090.c.
No idea from me on any of that. Upstream the sleep between shutdown and
on was added in the original code to do the recovery from Jarkko,
b8a3ee820f7b0 (ASoC: max98090: Add recovery for PLL lock failure) - the
ChromeOS patch you linked to claims to be a backport but clearly isn't a
backport from upstream. It's missing the first sleep, the second sleep
is shorter but it polls for success instead of just dead reckoning and
not reading back. The "upstream" commit that the ChromeOS commit
references just doesn't exist upstream so no idea what they were
backporting from.
If the ChromeOS code is working for you we may as well get it upstream,
if we can start the PLL faster than the 10ms that's a win and the
confirmation that we got lock looks like a win too.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 161 bytes --]
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next prev parent reply other threads:[~2019-10-24 19:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-24 18:23 [alsa-devel] Questions about max98090 codec driver Tzung-Bi Shih
2019-10-24 19:14 ` Mark Brown [this message]
2019-10-25 5:09 ` Tzung-Bi Shih
2019-10-28 12:14 ` Mark Brown
2019-10-24 19:25 ` Pierre-Louis Bossart
2019-10-25 11:49 ` Jarkko Nikula
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=20191024191411.GH46373@sirena.co.uk \
--to=broonie@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=bleung@google.com \
--cc=cychiang@google.com \
--cc=dgreid@google.com \
--cc=hychao@google.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=tiwai@suse.com \
--cc=tzungbi@google.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