All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Mack <daniel@caiaq.de>
To: alsa-devel@alsa-project.org
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Timur Tabi <timur@freescale.com>,
	Liam Girdwood <lrg@slimlogic.co.uk>
Subject: Re: [PATCH] ALSA: ASoc: Add regulator support to CS4270 codec driver
Date: Fri, 4 Dec 2009 13:00:07 +0100	[thread overview]
Message-ID: <20091204120007.GH29442@buzzloop.caiaq.de> (raw)
In-Reply-To: <1259600171-30357-1-git-send-email-daniel@caiaq.de>

Was that one applied?

On Mon, Nov 30, 2009 at 05:56:11PM +0100, Daniel Mack wrote:
> Signed-off-by: Daniel Mack <daniel@caiaq.de>
> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
> Cc: Timur Tabi <timur@freescale.com>
> Cc: Liam Girdwood <lrg@slimlogic.co.uk>
> ---
>  sound/soc/codecs/cs4270.c |   43 ++++++++++++++++++++++++++++++++++++++++---
>  1 files changed, 40 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c
> index ffe122d..8b54575 100644
> --- a/sound/soc/codecs/cs4270.c
> +++ b/sound/soc/codecs/cs4270.c
> @@ -28,6 +28,7 @@
>  #include <sound/initval.h>
>  #include <linux/i2c.h>
>  #include <linux/delay.h>
> +#include <linux/regulator/consumer.h>
>  
>  #include "cs4270.h"
>  
> @@ -106,6 +107,10 @@
>  #define CS4270_MUTE_DAC_A	0x01
>  #define CS4270_MUTE_DAC_B	0x02
>  
> +static const char *supply_names[] = {
> +	"va", "vd", "vlc"
> +};
> +
>  /* Private data for the CS4270 */
>  struct cs4270_private {
>  	struct snd_soc_codec codec;
> @@ -114,6 +119,9 @@ struct cs4270_private {
>  	unsigned int mode; /* The mode (I2S or left-justified) */
>  	unsigned int slave_mode;
>  	unsigned int manual_mute;
> +
> +	/* power domain regulators */
> +	struct regulator_bulk_data supplies[ARRAY_SIZE(supply_names)];
>  };
>  
>  /**
> @@ -579,7 +587,8 @@ static int cs4270_probe(struct platform_device *pdev)
>  {
>  	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
>  	struct snd_soc_codec *codec = cs4270_codec;
> -	int ret;
> +	struct cs4270_private *cs4270 = codec->private_data;
> +	int i, ret;
>  
>  	/* Connect the codec to the socdev.  snd_soc_new_pcms() needs this. */
>  	socdev->card->codec = codec;
> @@ -599,6 +608,15 @@ static int cs4270_probe(struct platform_device *pdev)
>  		goto error_free_pcms;
>  	}
>  
> +	/* get the power supply regulators */
> +	for (i = 0; i < ARRAY_SIZE(supply_names); i++)
> +		cs4270->supplies[i].supply = supply_names[i];
> +
> +	ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(cs4270->supplies),
> +				 cs4270->supplies);
> +	if (ret < 0)
> +		goto error_free_pcms;
> +
>  	return 0;
>  
>  error_free_pcms:
> @@ -616,8 +634,11 @@ error_free_pcms:
>  static int cs4270_remove(struct platform_device *pdev)
>  {
>  	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
> +	struct snd_soc_codec *codec = cs4270_codec;
> +	struct cs4270_private *cs4270 = codec->private_data;
>  
>  	snd_soc_free_pcms(socdev);
> +	regulator_bulk_free(ARRAY_SIZE(cs4270->supplies), cs4270->supplies);
>  
>  	return 0;
>  };
> @@ -799,17 +820,33 @@ MODULE_DEVICE_TABLE(i2c, cs4270_id);
>  static int cs4270_soc_suspend(struct platform_device *pdev, pm_message_t mesg)
>  {
>  	struct snd_soc_codec *codec = cs4270_codec;
> -	int reg = snd_soc_read(codec, CS4270_PWRCTL) | CS4270_PWRCTL_PDN_ALL;
> +	struct cs4270_private *cs4270 = codec->private_data;
> +	int reg, ret;
>  
> -	return snd_soc_write(codec, CS4270_PWRCTL, reg);
> +	reg = snd_soc_read(codec, CS4270_PWRCTL) | CS4270_PWRCTL_PDN_ALL;
> +	if (reg < 0)
> +		return reg;
> +
> +	ret = snd_soc_write(codec, CS4270_PWRCTL, reg);
> +	if (ret < 0)
> +		return ret;
> +
> +	regulator_bulk_disable(ARRAY_SIZE(cs4270->supplies),
> +			       cs4270->supplies);
> +
> +	return 0;
>  }
>  
>  static int cs4270_soc_resume(struct platform_device *pdev)
>  {
>  	struct snd_soc_codec *codec = cs4270_codec;
> +	struct cs4270_private *cs4270 = codec->private_data;
>  	struct i2c_client *i2c_client = codec->control_data;
>  	int reg;
>  
> +	regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies),
> +			      cs4270->supplies);
> +
>  	/* In case the device was put to hard reset during sleep, we need to
>  	 * wait 500ns here before any I2C communication. */
>  	ndelay(500);
> -- 
> 1.6.5.2
> 

  reply	other threads:[~2009-12-04 12:00 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-25 14:36 [PATCH] ALSA: ASoc: Add regulator support to CS4270 codec driver Daniel Mack
2009-11-25 15:01 ` Mark Brown
2009-11-25 15:20   ` Daniel Mack
2009-11-25 15:38     ` Mark Brown
2009-11-25 15:46       ` Daniel Mack
2009-11-26 15:48       ` Daniel Mack
2009-11-26 16:03         ` Mark Brown
2009-11-26 17:42           ` Daniel Mack
2009-11-27 11:25             ` Mark Brown
2009-11-27 12:41               ` Daniel Mack
2009-11-27 13:32                 ` Mark Brown
2009-11-28 20:23                   ` Timur Tabi
2009-11-28 20:31                     ` Mark Brown
2009-11-28 22:18                       ` Timur Tabi
2009-11-29  0:44                         ` Daniel Mack
2009-11-29  4:34                           ` Timur Tabi
2009-11-29  8:35                             ` Daniel Mack
2009-11-30 10:12                               ` Daniel Mack
     [not found]                           ` <5610599F537DD74A8D1F5CC946A7507303478C40@az33exm25.fsl.freescale.net>
2009-11-30 12:01                             ` Mark Brown
2009-11-30 12:36                               ` Daniel Mack
2009-11-30 15:57                                 ` Daniel Mack
2009-11-30 16:12                                   ` Mark Brown
2009-11-30 16:51                                     ` Daniel Mack
2009-11-30 16:56                                       ` Daniel Mack
2009-12-04 12:00                                         ` Daniel Mack [this message]
2009-12-04 12:07                                           ` Mark Brown
2009-12-05  2:54                                             ` Timur Tabi
2009-12-05  3:51                                               ` Mark Brown
2009-12-05 17:03                                         ` Timur Tabi
2009-12-07 13:16                                           ` 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=20091204120007.GH29442@buzzloop.caiaq.de \
    --to=daniel@caiaq.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=lrg@slimlogic.co.uk \
    --cc=timur@freescale.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.