public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <lrg@slimlogic.co.uk>
To: "Olaya, Margarita" <magi.olaya@ti.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"broonie@opensource.wolfsonmicro.com"
	<broonie@opensource.wolfsonmicro.com>
Subject: Re: [PATCHv4 3/7] ASoC: TWL6030: Manual power-up/down sequences
Date: Wed, 24 Feb 2010 10:40:36 +0000	[thread overview]
Message-ID: <1267008036.3274.141.camel@odin> (raw)
In-Reply-To: <1889FA7136B567478A67D4B0F85B0CCE65DD1B15@dlee06.ent.ti.com>

On Tue, 2010-02-23 at 18:10 -0600, Olaya, Margarita wrote:
> From: Misael Lopez Cruz <x0052729@ti.com>
> 
> TWL6030 codec device can be powered-up/down through a specific register
> writes sequence. These sequences can be used when no gpio line is
> provided for AUDPWRON.
> 
> When the codec is powered-up in this way, automatic power-down sequence
> (triggered by thermal shutdown) is not possible.
> 
> Signed-off-by: Misael Lopez Cruz <x0052729@ti.com>
> Signed-off-by: Jorge Eduardo Candelaria <jorge.candelaria@ti.com>
> Signed-off-by: Margarita Olaya Cabrera <magi.olaya@ti.com>
> ---
>  sound/soc/codecs/twl6030.c |  112 ++++++++++++++++++++++++++++++++++++++-----
>  sound/soc/codecs/twl6030.h |   16 ++++++
>  2 files changed, 115 insertions(+), 13 deletions(-)
> 
> diff --git a/sound/soc/codecs/twl6030.c b/sound/soc/codecs/twl6030.c
> index 8b52aa1..ec838b1 100644
> --- a/sound/soc/codecs/twl6030.c
> +++ b/sound/soc/codecs/twl6030.c
> @@ -244,6 +244,88 @@ static void twl6030_init_vdd_regs(struct snd_soc_codec *codec)
>  	}
>  }
>  
> +/* twl6030 codec manual power-up sequence */
> +static void twl6030_power_up(struct snd_soc_codec *codec)
> +{
> +	u8 ncpctl, ldoctl, lppllctl, accctl;
> +
> +	ncpctl = twl6030_read_reg_cache(codec, TWL6030_REG_NCPCTL);
> +	ldoctl = twl6030_read_reg_cache(codec, TWL6030_REG_LDOCTL);
> +	lppllctl = twl6030_read_reg_cache(codec, TWL6030_REG_LPPLLCTL);
> +	accctl = twl6030_read_reg_cache(codec, TWL6030_REG_ACCCTL);
> +
> +	/* enable reference system */
> +	ldoctl |= TWL6030_REFENA;
> +	twl6030_write(codec, TWL6030_REG_LDOCTL, ldoctl);
> +	mdelay(10);
> +	/* enable internal oscillator */
> +	ldoctl |= TWL6030_OSCENA;
> +	twl6030_write(codec, TWL6030_REG_LDOCTL, ldoctl);
> +	udelay(10);
> +	/* enable high-side ldo */
> +	ldoctl |= TWL6030_HSLDOENA;
> +	twl6030_write(codec, TWL6030_REG_LDOCTL, ldoctl);
> +	udelay(244);
> +	/* enable negative charge pump */
> +	ncpctl |= TWL6030_NCPENA | TWL6030_NCPOPEN;
> +	twl6030_write(codec, TWL6030_REG_NCPCTL, ncpctl);
> +	udelay(488);
> +	/* enable low-side ldo */
> +	ldoctl |= TWL6030_LSLDOENA;
> +	twl6030_write(codec, TWL6030_REG_LDOCTL, ldoctl);
> +	udelay(244);
> +	/* enable low-power pll */
> +	lppllctl |= TWL6030_LPLLENA;
> +	twl6030_write(codec, TWL6030_REG_LPPLLCTL, lppllctl);
> +	/* reset state machine */
> +	accctl |= TWL6030_RESETSPLIT;
> +	twl6030_write(codec, TWL6030_REG_ACCCTL, accctl);
> +	mdelay(5);
> +	accctl &= ~TWL6030_RESETSPLIT;
> +	twl6030_write(codec, TWL6030_REG_ACCCTL, accctl);
> +	/* disable internal oscillator */
> +	ldoctl &= ~TWL6030_OSCENA;
> +	twl6030_write(codec, TWL6030_REG_LDOCTL, ldoctl);
> +}
> +
> +/* twl6030 codec manual power-down sequence */
> +static void twl6030_power_down(struct snd_soc_codec *codec)
> +{
> +	u8 ncpctl, ldoctl, lppllctl, accctl;
> +
> +	ncpctl = twl6030_read_reg_cache(codec, TWL6030_REG_NCPCTL);
> +	ldoctl = twl6030_read_reg_cache(codec, TWL6030_REG_LDOCTL);
> +	lppllctl = twl6030_read_reg_cache(codec, TWL6030_REG_LPPLLCTL);
> +	accctl = twl6030_read_reg_cache(codec, TWL6030_REG_ACCCTL);
> +
> +	/* enable internal oscillator */
> +	ldoctl |= TWL6030_OSCENA;
> +	twl6030_write(codec, TWL6030_REG_LDOCTL, ldoctl);
> +	udelay(10);
> +	/* disable low-power pll */
> +	lppllctl &= ~TWL6030_LPLLENA;
> +	twl6030_write(codec, TWL6030_REG_LPPLLCTL, lppllctl);
> +	/* disable low-side ldo */
> +	ldoctl &= ~TWL6030_LSLDOENA;
> +	twl6030_write(codec, TWL6030_REG_LDOCTL, ldoctl);
> +	udelay(244);
> +	/* disable negative charge pump */
> +	ncpctl &= ~(TWL6030_NCPENA | TWL6030_NCPOPEN);
> +	twl6030_write(codec, TWL6030_REG_NCPCTL, ncpctl);
> +	udelay(488);
> +	/* disable high-side ldo */
> +	ldoctl &= ~TWL6030_HSLDOENA;
> +	twl6030_write(codec, TWL6030_REG_LDOCTL, ldoctl);
> +	udelay(244);
> +	/* disable internal oscillator */
> +	ldoctl &= ~TWL6030_OSCENA;
> +	twl6030_write(codec, TWL6030_REG_LDOCTL, ldoctl);
> +	/* disable reference system */
> +	ldoctl &= ~TWL6030_REFENA;
> +	twl6030_write(codec, TWL6030_REG_LDOCTL, ldoctl);
> +	mdelay(10);
> +}
> +
>  /*


Some large mdelays here again.

Liam

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


  reply	other threads:[~2010-02-24 10:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-24  0:10 [PATCHv4 3/7] ASoC: TWL6030: Manual power-up/down sequences Olaya, Margarita
2010-02-24 10:40 ` Liam Girdwood [this message]
2010-02-24 23:42   ` Olaya, Margarita

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=1267008036.3274.141.camel@odin \
    --to=lrg@slimlogic.co.uk \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=magi.olaya@ti.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