From: "Eric Bénard" <eric@eukrea.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: anuj.aggarwal@ti.com, alsa-devel@alsa-project.org, lrg@slimlogic.co.uk
Subject: Re: [PATCH] codecs/tlv320aic23: fix suspend/resume
Date: Sat, 19 Jun 2010 14:07:00 +0200 [thread overview]
Message-ID: <4C1CB2E4.8060401@eukrea.com> (raw)
In-Reply-To: <20100619105929.GB2409@opensource.wolfsonmicro.com>
Le 19/06/2010 12:59, Mark Brown a écrit :
> On Sat, Jun 19, 2010 at 10:56:54AM +0200, Eric Bénard wrote:
>> The PWR register actually can't be restored at resume because its
>> cached value was set to 0xFFFF when suspending and thus the initial
>> state won't be restored. Thus, sound doesn't work after resume (tested
>> on an i.MX27).
>
> What is the actual problem here?
>
aplay test.wav => sound
echo mem > /sys/power/state => system suspended
press button to wake up => system resumed
aplay test.wav => no sound
at wake up, the codec doesn't produce any sound and checking with a
scope shows that the I2S interface (codec is master and thus generates
the signals) is not working (no clock produced by the codec).
>> + /* backup PWR register */
>> + tmp = tlv320aic23_read_reg_cache(codec, TLV320AIC23_PWR);
>> + /* turn off the codec */
>> tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_OFF);
>
> On power down we put the CODEC into BIAS_OFF...
>
>> - tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
>> -
>
> ...then we bring the power back up on resume. If there's a problem here
> it looks like the bias management functions need fixing but without
> knowing what the actual problem with the system is it's not clear what
> this is supposed to fix.
>
my understanding of the actual code is :
- at suspend :
tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_OFF);
will set PWR to 0xFFFF (all off) which is the expected behaviour
- at resume :
tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
will set PWR to 0xff7f (all off except DAC) as its value is restored
from the register cache, which doesn't seems to be the expected
behaviour unless I'm one more time mistaken.
You will find hereinafter log added to tlv320aic23_write concerning PWR
register and reg value in tlv320aic23_set_bias_level (patch copy and
pasted bellow so it may be line wrapped) :
boot :
tlv320aic23_set_bias_level : reg is 7
tlv320aic23_write write 047 to register R6
aplay :
tlv320aic23_set_bias_level : reg is 5f
tlv320aic23_write write 057 to register R6
(so DEVICE + OSC + DAC are on)
tlv320aic23_set_bias_level : reg is 47
tlv320aic23_write write 047 to register R6
(so DEVICE + OSC + OUT + DAC are on)
suspend :
tlv320aic23_set_bias_level : reg is 5f
tlv320aic23_write write ffff to register R6
resume :
tlv320aic23_write write ffff to register R6
tlv320aic23_set_bias_level : reg is ff7f
tlv320aic23_write write ff7f to register R6
aplay (after resume) :
tlv320aic23_set_bias_level : reg is ff7f
tlv320aic23_write write ff7f to register R6
(so DEVICE is on but DAC and OSC are off)
tlv320aic23_set_bias_level : reg is ff67
tlv320aic23_write write ff67 to register R6
(so DEVICE + OUT + DAC are on but OSC is off)
So do unless I'm mistaken the actual handling of PWR register is wrong
as OSC bit stays OFF even after resume.
Eric
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -95,6 +95,8 @@ static int tlv320aic23_write(struct snd_soc_codec
*codec, unsigned int reg,
data[1] = value & 0xff;
tlv320aic23_write_reg_cache(codec, reg, value);
+printk("%s write %03x to register R%u\n", __func__,
+ value, reg);
if (codec->hw_write(codec->control_data, data, 2) == 2)
return 0;
@@ -556,7 +558,7 @@ static int tlv320aic23_set_bias_level(struct
snd_soc_codec *codec,
enum snd_soc_bias_level level)
{
u16 reg = tlv320aic23_read_reg_cache(codec, TLV320AIC23_PWR) &
0xff7f;
-
+printk("%s : reg is %x\n", __FUNCTION__, reg);
switch (level) {
case SND_SOC_BIAS_ON:
/* vref/mid, osc on, dac unmute */
next prev parent reply other threads:[~2010-06-19 12:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-19 8:56 [PATCH] codecs/tlv320aic23: fix suspend/resume Eric Bénard
2010-06-19 10:59 ` Mark Brown
2010-06-19 12:07 ` Eric Bénard [this message]
2010-06-19 17:33 ` [PATCH v2] codecs/tlv320aic23: fix bias management for suspend/resume Eric Bénard
2010-06-22 10:07 ` Liam Girdwood
2010-06-22 23:17 ` Mark Brown
2010-06-23 10:35 ` Liam Girdwood
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=4C1CB2E4.8060401@eukrea.com \
--to=eric@eukrea.com \
--cc=alsa-devel@alsa-project.org \
--cc=anuj.aggarwal@ti.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=lrg@slimlogic.co.uk \
/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.