From: Eric Nelson <eric.nelson@boundarydevices.com>
To: Mark Brown <broonie@kernel.org>
Cc: fabio.estevam@freescale.com, alsa-devel@alsa-project.org,
lars@metafoo.de, tiwai@suse.de, lgirdwood@gmail.com,
rmk+kernel@arm.linux.org.uk, jean-michel.hautbois@vodalys.com,
troy.kisky@boundarydevices.com
Subject: Re: [RFC PATCH 3/6] ASoC: sgtl5000: initialize CHIP_ANA_POWER to power-on defaults
Date: Fri, 06 Mar 2015 15:14:16 -0700 [thread overview]
Message-ID: <54FA26B8.9050601@boundarydevices.com> (raw)
In-Reply-To: <20150306201207.GX21293@sirena.org.uk>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Mark,
On 03/06/2015 01:12 PM, Mark Brown wrote:
> On Thu, Feb 26, 2015 at 03:54:30PM -0700, Eric Nelson wrote:
>> Initialize CHIP_ANA_POWER to match power on defaults, which
>> disables ADC, DAC, and charge pumps.
>
>> +++ b/sound/soc/codecs/sgtl5000.c @@ -47,12 +47,10 @@ static
>> const struct reg_default sgtl5000_reg_defaults[] = { {
>> SGTL5000_CHIP_ANA_ADC_CTRL, 0x0000 }, {
>> SGTL5000_CHIP_ANA_HP_CTRL, 0x1818 }, { SGTL5000_CHIP_ANA_CTRL,
>> 0x0111 }, - { SGTL5000_CHIP_LINREG_CTRL, 0x0000 }, {
>> SGTL5000_CHIP_REF_CTRL, 0x0000 }, { SGTL5000_CHIP_MIC_CTRL,
>> 0x0000 }, { SGTL5000_CHIP_LINE_OUT_CTRL, 0x0000 }, {
>> SGTL5000_CHIP_LINE_OUT_VOL, 0x0404 }, - {
>> SGTL5000_CHIP_ANA_POWER, 0x7060 },
>
> Two big problems here. One is that this appears to also affect
> LINREG_CTRL which your changelog didn't mention.
It did mention the change:
> Initialize CHIP_ANA_POWER to match power on defaults, which
> disables ADC, DAC, and charge pumps.
>
> In the process, remove references to the following
> register/bitfields from the sgttl5000_set_power_regs routine:
> CHIP_ANA_POWER/LINREG_SIMPLE_POWERUP and
> CHIP_LINREG_CTRL/LINREG_VDD_MASK
>
> And remove CHIP_ANA_POWER and CHIP_LINREG_CTRL from the set
> of default registers so they don't get clobbered by
> sgtl5000_fill_defaults().
The CHIP_LINREG_CTRL value needs to be set based on the presence
or absence of external VDDD, so writing a default (power-on) value
doesn't help much, and this certainly shouldn't happen after
the proper value is written.
> The other is that contrary to what the changelog says this isn't
> fixing the default, it's removing it.
>
You're right about the commit message. It should be re-worded.
> The whole point of the register defaults table is to contain the
> default power on register values, if it contains other things that
> is a bug and should be fixed by changing the values not removing
> them.
>
I understand that, but the crux of the problem is that these
registers need to be set early, their order is critical, and
some of them need to be written based on the internal/external
VDDD decision.
In a soft reboot on a machine that doesn't actually control
the power to the SGTL5000 (which is all supported boards at
the moment), a write to the ANA_POWER register with stale
values in either LINREG_CTRL or CLK_CTRL (from patch 5)
will fail and cause the chip to lock up.
Discussion of this is the primary reason I sent this patch
set as an RFC: to highlight the issues.
> Given that confusion I'm really having a hard time understanding
> the rest of the commit.
>
Some of this (and some of your expressed concerns) could be
alleviated by moving the call to sgtl5000_fill_defaults()
before the newly-added code to initialize ANA_POWER based on
whether an external VDDD is supplied or the internal LDO is
used, but then the dependencies would be hidden in the order
of registers in the table.
This is just more explicit.
I hope that clarifies things.
Regards,
Eric
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAEBAgAGBQJU+ia3AAoJEFUqXmm9AiVrU6AH/iu2bxDRrhBPaBBLMnXQUqiG
w49zAs74PA3LcFAvR0zPhBeRjbw3NOFjAVqsr2nejpq4jtNnlxG0aYYiX+bsWA4H
52vplw8BaJxRUnR/pwa+cj7HzUwK637t8/19Zk3mfxbeqaUMX6zDS1w5k8c8U5DE
1497cxLXnX5OVjClzCyrLiZMUhLqu2BCXFgxJLHe9315MFz5T+Nd1tFXDFSVmNB8
oO85GSMBvdz2CkQ9X6wjMVVS9QnISoisEjBOhoqzfGP6A5C3p2f2zi+Sm/2Rote7
E3diMCmrH22q+IruCfQbzzVVB0B3SiU+ckQvvEWtCXWNr0RVaJwzuzdonD51Zkk=
=9hrU
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2015-03-06 22:14 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-26 22:54 [PATCH RFC 0/6] ASoC: sgtl5000: fix use of regulators and internal LDO Eric Nelson
2015-02-26 22:54 ` [RFC PATCH 1/6] ASoC: sgtl5000: fix regulator support Eric Nelson
2015-03-06 20:04 ` Mark Brown
2015-03-06 21:09 ` Eric Nelson
2015-03-07 9:59 ` Mark Brown
2015-02-26 22:54 ` [RFC PATCH 2/6] ASoC: sgtl5000: write all default registers Eric Nelson
2015-03-06 20:14 ` Mark Brown
2015-03-06 22:24 ` Eric Nelson
2016-06-15 14:38 ` Applied "ASoC: sgtl5000: Write all default registers" to the asoc tree Mark Brown
2015-02-26 22:54 ` [RFC PATCH 3/6] ASoC: sgtl5000: initialize CHIP_ANA_POWER to power-on defaults Eric Nelson
2015-03-06 20:12 ` Mark Brown
2015-03-06 22:14 ` Eric Nelson [this message]
2015-03-07 10:28 ` Mark Brown
2015-02-26 22:54 ` [RFC PATCH 4/6] ASoC: sgtl5000: check return values Eric Nelson
2015-02-26 22:54 ` [RFC PATCH 5/6] ASoC: sgtl5000: disable internal PLL early Eric Nelson
2015-03-06 20:15 ` Mark Brown
2015-03-06 22:16 ` Eric Nelson
2016-06-15 14:38 ` Applied "ASoC: sgtl5000: Disable internal PLL early" to the asoc tree Mark Brown
2015-02-26 22:54 ` [RFC PATCH 6/6] ASoC: sgtl5000: Don't disable regulators in SND_SOC_BIAS_OFF Eric Nelson
2015-03-06 20:16 ` Mark Brown
2015-03-06 22:35 ` Eric Nelson
2015-03-07 10:41 ` Mark Brown
2015-03-06 22:49 ` [PATCH RFC 0/6] ASoC: sgtl5000: fix use of regulators and internal LDO Eric Nelson
2015-03-06 22:53 ` Russell King - ARM Linux
2015-03-06 22:58 ` Eric Nelson
2015-03-06 23:16 ` Eric Nelson
2015-03-06 23:24 ` Russell King - ARM Linux
2015-03-06 23:31 ` Eric Nelson
2015-03-07 10:45 ` Mark Brown
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=54FA26B8.9050601@boundarydevices.com \
--to=eric.nelson@boundarydevices.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=fabio.estevam@freescale.com \
--cc=jean-michel.hautbois@vodalys.com \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=rmk+kernel@arm.linux.org.uk \
--cc=tiwai@suse.de \
--cc=troy.kisky@boundarydevices.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.