All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <lrg@slimlogic.co.uk>
To: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Cc: alsa-devel@alsa-project.org, broonie@opensource.wolfsonmicro.com
Subject: Re: [PATCH 5/7] ASoC: TWL4030: Helper to check chip default registers
Date: Tue, 25 May 2010 12:57:24 +0100	[thread overview]
Message-ID: <1274788644.3000.151.camel@odin> (raw)
In-Reply-To: <1274787248-18583-6-git-send-email-peter.ujfalusi@nokia.com>

On Tue, 2010-05-25 at 14:34 +0300, Peter Ujfalusi wrote:
> Since the twl4030 codec driver supports different version
> of the PM chip, a helper function can come handy, which
> can check the driver's default versus the chip values.
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
> ---
>  sound/soc/codecs/twl4030.c |   23 +++++++++++++++++++++++
>  sound/soc/codecs/twl4030.h |    1 +
>  2 files changed, 24 insertions(+), 0 deletions(-)
> 
> diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
> index 08f24de..4220c8d 100644
> --- a/sound/soc/codecs/twl4030.c
> +++ b/sound/soc/codecs/twl4030.c
> @@ -243,6 +243,25 @@ static void twl4030_codec_enable(struct snd_soc_codec *codec, int enable)
>  	udelay(10);
>  }
>  
> +static inline void twl4030_check_defaults(struct snd_soc_codec *codec)
> +{
> +	int i, difference = 0;
> +	u8 val;
> +
> +	dev_info(codec->dev, "Checking TWL audio default configuration\n");
> +	for (i = 1; i <= TWL4030_REG_MISC_SET_2; i++) {
> +		twl4030_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &val, i);
> +		if (val != twl4030_reg[i]) {
> +			difference++;
> +			dev_info(codec->dev,
> +				 "Reg 0x%02x: chip: 0x%02x driver: 0x%02x\n",
> +				 i, val, twl4030_reg[i]);
> +		}
> +	}
> +	dev_info(codec->dev, "Found %d non maching registers. %s\n",

matching

> +		 difference, difference ? "Not OK" : "OK");
> +}
> +
>  static void twl4030_init_chip(struct platform_device *pdev)
>  {
>  	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
> @@ -252,6 +271,10 @@ static void twl4030_init_chip(struct platform_device *pdev)
>  	u8 reg, byte;
>  	int i = 0;
>  
> +	/* Check defaults, if instructed before anythiing else */
> +	if (setup && setup->check_defaults)
> +		twl4030_check_defaults(codec);
> +

Is this purely for information/debug purposes ?

Why do we need to check default vales at init(). Is there another driver
changing the audio codec registers ?

Thanks

Liam
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

  reply	other threads:[~2010-05-25 11:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-25 11:34 [PATCH 0/7] ASoC: TWL4030: put the codec to off when not active Peter Ujfalusi
2010-05-25 11:34 ` [PATCH 1/7] ASoC: TWL4030: Revisit codec defaults Peter Ujfalusi
2010-05-25 11:34 ` [PATCH 2/7] ASoC: TWL4030: Remove wrapper for power down Peter Ujfalusi
2010-05-25 11:34 ` [PATCH 3/7] ASoC: TWL4030: Make offset cancellation path configurable Peter Ujfalusi
2010-05-25 11:59   ` Peter Ujfalusi
2010-05-25 11:34 ` [PATCH 4/7] ASoC: TWL4030: Optimize the power up sequence Peter Ujfalusi
2010-05-25 11:34 ` [PATCH 5/7] ASoC: TWL4030: Helper to check chip default registers Peter Ujfalusi
2010-05-25 11:57   ` Liam Girdwood [this message]
2010-05-25 12:20     ` Peter Ujfalusi
2010-05-25 13:09       ` Liam Girdwood
2010-05-26  6:00         ` Peter Ujfalusi
2010-05-26  6:28           ` Peter Ujfalusi
2010-05-26  6:35             ` Mark Brown
2010-05-26  7:15               ` Peter Ujfalusi
2010-05-25 11:34 ` [PATCH 6/7] ASoC: TWL4030: Correct the ARXR2_APGA_CTL chip default Peter Ujfalusi
2010-05-25 11:34 ` [PATCH 7/7] ASoC: TWL4030: Use BIAS_OFF instead of BIAS_STANDBY, when not in use Peter Ujfalusi
2010-05-25 17:35 ` [PATCH 0/7] ASoC: TWL4030: put the codec to off when not active 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=1274788644.3000.151.camel@odin \
    --to=lrg@slimlogic.co.uk \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=peter.ujfalusi@nokia.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.