From: Lars-Peter Clausen <lars@metafoo.de>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>,
Liam Girdwood <lrg@slimlogic.co.uk>
Cc: device-driver-devel@blackfin.uclinux.org,
alsa-devel@alsa-project.org, Lars-Peter Clausen <lars@metafoo.de>,
Mike Frysinger <vapier@gentoo.org>
Subject: [PATCH 11/12] ASoC: SSM2602: Model power supply for the digital core as a DAPM widget
Date: Thu, 5 May 2011 16:59:19 +0200 [thread overview]
Message-ID: <1304607560-15083-11-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1304607560-15083-1-git-send-email-lars@metafoo.de>
Model the power supply for the digital core as a DAPM_SUPPLY widget. This allows
to cleanup the code a bit.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
sound/soc/codecs/ssm2602.c | 25 ++++++-------------------
1 files changed, 6 insertions(+), 19 deletions(-)
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
index ca57d93..c3d5936 100644
--- a/sound/soc/codecs/ssm2602.c
+++ b/sound/soc/codecs/ssm2602.c
@@ -126,6 +126,8 @@ SND_SOC_DAPM_DAC("DAC", "HiFi Playback", SSM2602_PWR, 3, 1),
SND_SOC_DAPM_ADC("ADC", "HiFi Capture", SSM2602_PWR, 2, 1),
SND_SOC_DAPM_PGA("Line Input", SSM2602_PWR, 0, 1, NULL, 0),
+SND_SOC_DAPM_SUPPLY("Digital Core Power", SSM2602_ACTIVE, 0, 0, 0, 0),
+
SND_SOC_DAPM_OUTPUT("LOUT"),
SND_SOC_DAPM_OUTPUT("ROUT"),
SND_SOC_DAPM_INPUT("RLINEIN"),
@@ -152,6 +154,9 @@ SND_SOC_DAPM_MIXER("Output Mixer", SND_SOC_NOPM, 0, 0,
};
static const struct snd_soc_dapm_route ssm260x_routes[] = {
+ {"DAC", NULL, "Digital Core Power"},
+ {"ADC", NULL, "Digital Core Power"},
+
{"Output Mixer", "Line Bypass Switch", "Line Input"},
{"Output Mixer", "HiFi Playback Switch", "DAC"},
@@ -252,7 +257,6 @@ static int ssm2602_hw_params(struct snd_pcm_substream *substream,
if (srate < 0)
return srate;
- snd_soc_write(codec, SSM2602_ACTIVE, 0);
snd_soc_write(codec, SSM2602_SRATE, srate);
/* bit size */
@@ -270,7 +274,6 @@ static int ssm2602_hw_params(struct snd_pcm_substream *substream,
break;
}
snd_soc_write(codec, SSM2602_IFACE, iface);
- snd_soc_write(codec, SSM2602_ACTIVE, ACTIVE_ACTIVATE_CODEC);
return 0;
}
@@ -312,17 +315,6 @@ static int ssm2602_startup(struct snd_pcm_substream *substream,
return 0;
}
-static int ssm2602_pcm_prepare(struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
-{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_codec *codec = rtd->codec;
- /* set active */
- snd_soc_write(codec, SSM2602_ACTIVE, ACTIVE_ACTIVATE_CODEC);
-
- return 0;
-}
-
static void ssm2602_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
@@ -330,16 +322,13 @@ static void ssm2602_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_codec *codec = rtd->codec;
struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
- /* deactivate */
- if (!codec->active)
- snd_soc_write(codec, SSM2602_ACTIVE, 0);
-
if (ssm2602->master_substream == substream)
ssm2602->master_substream = ssm2602->slave_substream;
ssm2602->slave_substream = NULL;
}
+
static int ssm2602_mute(struct snd_soc_dai *dai, int mute)
{
struct snd_soc_codec *codec = dai->codec;
@@ -446,7 +435,6 @@ static int ssm2602_set_bias_level(struct snd_soc_codec *codec,
break;
case SND_SOC_BIAS_OFF:
/* everything off, dac mute, inactive */
- snd_soc_write(codec, SSM2602_ACTIVE, 0);
snd_soc_write(codec, SSM2602_PWR, 0xffff);
break;
@@ -464,7 +452,6 @@ static int ssm2602_set_bias_level(struct snd_soc_codec *codec,
static struct snd_soc_dai_ops ssm2602_dai_ops = {
.startup = ssm2602_startup,
- .prepare = ssm2602_pcm_prepare,
.hw_params = ssm2602_hw_params,
.shutdown = ssm2602_shutdown,
.digital_mute = ssm2602_mute,
--
1.7.2.5
next prev parent reply other threads:[~2011-05-05 14:59 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-05 14:59 [PATCH 01/12] ASoC: Create codec DAPM widgets before calling the codecs probe function Lars-Peter Clausen
2011-05-05 14:59 ` [PATCH 02/12] ASoC: SSM2602: Cleanup coeff handling Lars-Peter Clausen
2011-05-05 14:59 ` [PATCH 03/12] ASoC: SSM2602: Remove duplicate control Lars-Peter Clausen
2011-05-05 14:59 ` [PATCH 04/12] ASoC: SSM2602: Properly annotate i2c probe and remove functions Lars-Peter Clausen
2011-05-05 14:59 ` [PATCH 05/12] ASoC: SSM2602: Remove unused struct and define Lars-Peter Clausen
2011-05-05 14:59 ` [PATCH 06/12] ASoC: SSM2602: Fix reg_cache_size Lars-Peter Clausen
2011-05-05 14:59 ` [PATCH 07/12] ASoC: SSM2602: Do not power the codec up in probe Lars-Peter Clausen
2011-05-06 10:00 ` Mark Brown
2011-05-05 14:59 ` [PATCH 08/12] ASoC: SSM2602: Fix 'Mic Boost2' control Lars-Peter Clausen
2011-05-05 14:59 ` [PATCH 09/12] ASoC: SSM2602: Add SSM2604 support Lars-Peter Clausen
2011-05-05 14:59 ` [PATCH 10/12] ASoC: SSM2602: Add entry for the ssm2603 to the device id table Lars-Peter Clausen
2011-05-05 14:59 ` Lars-Peter Clausen [this message]
2011-05-05 14:59 ` [PATCH 12/12] ASoC: SSM2602: Provide dB ranges for the volume controls Lars-Peter Clausen
2011-05-05 19:08 ` [PATCH 01/12] ASoC: Create codec DAPM widgets before calling the codecs probe function Mike Frysinger
2011-05-05 23:01 ` Mike Frysinger
2011-05-07 18:11 ` Liam Girdwood
2011-05-07 18:21 ` Mark Brown
2011-05-08 11:16 ` Liam Girdwood
2011-05-08 13:56 ` Mark Brown
2011-05-08 16:24 ` [PATCH 2/6] ASoC: SSM2602: Do not power the codec up in probe Lars-Peter Clausen
2011-05-08 16:24 ` [PATCH 4/6] ASoC: SSM2602: Add entry for the ssm2603 to the device id table Lars-Peter Clausen
[not found] ` <20110508135613.GA15968-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-05-08 16:24 ` [PATCH 1/6] ASoC: SSM2602: Fix default register cache Lars-Peter Clausen
2011-05-08 20:53 ` Liam Girdwood
2011-05-08 23:46 ` Mark Brown
2011-05-08 16:24 ` [PATCH 3/6] ASoC: SSM2602: Add SSM2604 support Lars-Peter Clausen
2011-05-08 16:24 ` [PATCH 5/6] ASoC: SSM2602: Model power supply for the digital core as a DAPM widget Lars-Peter Clausen
2011-05-08 16:24 ` [PATCH 6/6] ASoC: SSM2602: Provide dB ranges for the volume controls Lars-Peter Clausen
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=1304607560-15083-11-git-send-email-lars@metafoo.de \
--to=lars@metafoo.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=device-driver-devel@blackfin.uclinux.org \
--cc=lrg@slimlogic.co.uk \
--cc=vapier@gentoo.org \
/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;
as well as URLs for NNTP newsgroup(s).