Linux on ARM based TI OMAP SoCs
 help / color / mirror / Atom feed
From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
To: "Valentin Eduardo (Nokia-D/Helsinki)" <eduardo.valentin@nokia.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	ext Tony Lindgren <tony@atomide.com>,
	"Ujfalusi Peter (Nokia-D/Tampere)" <peter.ujfalusi@nokia.com>,
	Jarkko Nikula <jhnikula@gmail.com>,
	Linux-OMAP <linux-omap@vger.kernel.org>,
	ALSA-Devel <alsa-devel@vger.kernel.org>
Subject: Re: [PATCH 7/8] ASoC: tlv320aic3x: add initial usage of regulator framework to control avdd_dac
Date: Thu, 08 Oct 2009 15:17:07 +0300	[thread overview]
Message-ID: <1255004227.30157.159.camel@eenurkka-desktop> (raw)
In-Reply-To: <1255003137-1034-8-git-send-email-eduardo.valentin@nokia.com>

On Thu, 2009-10-08 at 13:58 +0200, Valentin Eduardo (Nokia-D/Helsinki)
wrote:
> From: Eduardo Valentin <eduardo.valentin@nokia.com>
> 
> This patch adds initial usage of regulator framework to control avdd_dac
> inside tlv320aic3x ASoC codec driver.
> 
> The  refcount to avdd_dac is increased / decreased
> only during probe and remove. Here it is still needed to implement
> proper enable/disable regulator depending on chip usage. Now if driver
> can get regulator for avdd_dac, then it will just let it on on probe
> and then leave it off on remove.
> 
> Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
> ---
>  sound/soc/codecs/tlv320aic3x.c |   26 ++++++++++++++++++++++++++
>  1 files changed, 26 insertions(+), 0 deletions(-)
> 
> diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
> index 3395cf9..82e0a64 100644
> --- a/sound/soc/codecs/tlv320aic3x.c
> +++ b/sound/soc/codecs/tlv320aic3x.c
> @@ -38,6 +38,7 @@
>  #include <linux/delay.h>
>  #include <linux/pm.h>
>  #include <linux/i2c.h>
> +#include <linux/regulator/consumer.h>
>  #include <linux/platform_device.h>
>  #include <sound/core.h>
>  #include <sound/pcm.h>
> @@ -56,6 +57,7 @@ struct aic3x_priv {
>  	struct snd_soc_codec codec;
>  	unsigned int sysclk;
>  	int master;
> +	struct regulator *regulator;
>  };
>  
>  /*
> @@ -1286,6 +1288,11 @@ static int aic3x_unregister(struct aic3x_priv *aic3x)
>  	snd_soc_unregister_dai(&aic3x_dai);
>  	snd_soc_unregister_codec(&aic3x->codec);
>  
> +	if (aic3x->regulator) {
> +		regulator_disable(aic3x->regulator);
> +		regulator_put(aic3x->regulator);
> +	}
> +
>  	kfree(aic3x);
>  	aic3x_codec = NULL;
>  
> @@ -1320,6 +1327,25 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
>  	codec->control_data = i2c;
>  	codec->hw_write = (hw_write_t) i2c_master_send;
>  
> +	aic3x->regulator = regulator_get(&i2c->dev, "avdd_dac");
> +	if (IS_ERR(aic3x->regulator)) {
> +		dev_warn(&i2c->dev, "No regulator to supply avdd_dac."
> +					" Assuming always on.\n");
> +		aic3x->regulator = NULL;
> +	}
> +
> +	/*
> +	 * REVISIT: Need to add proper code to put into sleep mode
> +	 * avdd_dac regulator. For now, just leave it on.
> +	 */

Will this ever be revisited =) ? If so, I think there's going to be a
jungle in finding the right spots - you need to remember the bypass
paths also (bias is not on necessarily). Also, this is regulator thing
is highly platform dependent, not aic3x related really at all, so is
this the correct place... Just a thought, dont take it too seriously ;) 

> +	if (aic3x->regulator) {
> +		int err;
> +
> +		err = regulator_enable(aic3x->regulator);
> +		if (err < 0)
> +			return err;
> +	}
> +
>  	i2c_set_clientdata(i2c, aic3x);
>  
>  	return aic3x_register(codec);


  reply	other threads:[~2009-10-08 12:19 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-08 11:58 [PATCH 0/8] RX-51 audio drivers Eduardo Valentin
2009-10-08 11:58 ` [PATCH 1/8] ASoC: TPA6130A2 amplifier driver Eduardo Valentin
2009-10-08 12:30   ` Eero Nurkkala
2009-10-08 13:07     ` Peter Ujfalusi
2009-10-08 12:52   ` Mark Brown
2009-10-08 13:38     ` Peter Ujfalusi
2009-10-08 13:53       ` Mark Brown
2009-10-09  6:53         ` Peter Ujfalusi
2009-10-09 10:36           ` Mark Brown
2009-10-08 11:58 ` [PATCH 2/8] ASoC: OMAP: RX-51 Machine driver and AIC34b_dummy driver Eduardo Valentin
2009-10-08 12:31   ` Eero Nurkkala
2009-10-08 13:18     ` Eduardo Valentin
2009-10-08 13:11   ` Mark Brown
2009-10-09  5:44     ` Jarkko Nikula
2009-10-09  6:37       ` Eduardo Valentin
2009-10-09 12:19         ` Mark Brown
2009-10-08 11:58 ` [PATCH 3/8] McBSP: OMAP3: Add Sidetone feature Eduardo Valentin
2009-10-08 13:17   ` Mark Brown
2009-10-08 13:23     ` Eduardo Valentin
2009-10-08 13:27       ` Mark Brown
2009-10-09  5:09     ` Eero Nurkkala
2009-10-09 10:44       ` [alsa-devel] " Mark Brown
2009-10-12  6:17         ` Eero Nurkkala
2009-10-12  9:12           ` Mark Brown
2009-10-12  9:28             ` Eero Nurkkala
2009-10-12  9:32               ` Mark Brown
2009-10-12 10:28                 ` Eero Nurkkala
2009-10-12 10:33                   ` Mark Brown
2009-10-08 11:58 ` [PATCH 4/8] OMAP: RX51: Add audio board file Eduardo Valentin
2009-10-08 11:58 ` [PATCH 5/8] board-rx51-peripherals: split vaux3 and vmmc2 supplies Eduardo Valentin
2009-10-08 13:21   ` Mark Brown
2009-10-09  6:45     ` Eduardo Valentin
2009-10-09 11:03       ` Mark Brown
2009-10-12  8:08         ` Eduardo Valentin
2009-10-12  9:18           ` Mark Brown
2009-10-14 17:15             ` Tony Lindgren
2009-10-15  9:01               ` Mark Brown
2009-10-16 16:14                 ` Tony Lindgren
2009-10-08 11:58 ` [PATCH 6/8] RX-51: Audio: Add usage of regulator framework to control VMMC2 Eduardo Valentin
2009-10-08 13:26   ` Mark Brown
2009-10-12  9:04     ` Eduardo Valentin
2009-10-12  9:21       ` Mark Brown
2009-10-19  9:13         ` Eduardo Valentin
2009-10-19  9:23           ` Mark Brown
2009-10-19  9:24             ` Mark Brown
2009-10-08 11:58 ` [PATCH 7/8] ASoC: tlv320aic3x: add initial usage of regulator framework to control avdd_dac Eduardo Valentin
2009-10-08 12:17   ` Eero Nurkkala [this message]
2009-10-08 13:17     ` Eduardo Valentin
2009-10-08 13:40     ` Mark Brown
2009-10-08 15:44       ` ext-Eero.Nurkkala
2009-10-08 16:01         ` Mark Brown
2009-10-09  4:28           ` Eero Nurkkala
2009-10-09 10:19             ` Mark Brown
2009-10-08 13:38   ` Mark Brown
2009-10-08 11:58 ` [PATCH 8/8] ASoC: tpa6130a2: Control vdd using regulator framework Eduardo Valentin
2009-10-08 13:43   ` Mark Brown
2009-10-08 13:56     ` Eduardo Valentin
2009-10-08 14:41       ` 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=1255004227.30157.159.camel@eenurkka-desktop \
    --to=ext-eero.nurkkala@nokia.com \
    --cc=alsa-devel@vger.kernel.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=eduardo.valentin@nokia.com \
    --cc=jhnikula@gmail.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=peter.ujfalusi@nokia.com \
    --cc=tony@atomide.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