diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2011-11-10 19:21:31 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-11-11 03:47:03 -0500 |
commit | 24747daea5610676fd1e2c2ca603c8822a085c87 (patch) | |
tree | 2092923247c1539422e9981f9bc6c45996cbd9ed /sound/soc/codecs/ak4642.c | |
parent | ed2dd7da35cad3115c38fd42eecbecae899a1d7a (diff) |
ASoC: ak4642: add DAPM support for HeadPhone Output
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/ak4642.c')
-rw-r--r-- | sound/soc/codecs/ak4642.c | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index 004a093547f9..da9caf0d5317 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c | |||
@@ -152,6 +152,37 @@ static const struct snd_kcontrol_new ak4642_snd_controls[] = { | |||
152 | 0, 0xFF, 1, out_tlv), | 152 | 0, 0xFF, 1, out_tlv), |
153 | }; | 153 | }; |
154 | 154 | ||
155 | static const struct snd_kcontrol_new ak4642_hpout_mixer_controls[] = { | ||
156 | SOC_DAPM_SINGLE("DACH", MD_CTL4, 0, 1, 0), | ||
157 | }; | ||
158 | |||
159 | static const struct snd_soc_dapm_widget ak4642_dapm_widgets[] = { | ||
160 | |||
161 | /* Outputs */ | ||
162 | SND_SOC_DAPM_OUTPUT("HPOUTL"), | ||
163 | SND_SOC_DAPM_OUTPUT("HPOUTR"), | ||
164 | |||
165 | SND_SOC_DAPM_MIXER("HPOUTL Mixer", PW_MGMT2, 5, 0, | ||
166 | &ak4642_hpout_mixer_controls[0], | ||
167 | ARRAY_SIZE(ak4642_hpout_mixer_controls)), | ||
168 | |||
169 | SND_SOC_DAPM_MIXER("HPOUTR Mixer", PW_MGMT2, 4, 0, | ||
170 | &ak4642_hpout_mixer_controls[0], | ||
171 | ARRAY_SIZE(ak4642_hpout_mixer_controls)), | ||
172 | |||
173 | /* DAC */ | ||
174 | SND_SOC_DAPM_DAC("DAC", "HiFi Playback", PW_MGMT1, 2, 0), | ||
175 | }; | ||
176 | |||
177 | static const struct snd_soc_dapm_route ak4642_intercon[] = { | ||
178 | |||
179 | /* Outputs */ | ||
180 | {"HPOUTL", NULL, "HPOUTL Mixer"}, | ||
181 | {"HPOUTR", NULL, "HPOUTR Mixer"}, | ||
182 | |||
183 | {"HPOUTL Mixer", "DACH", "DAC"}, | ||
184 | {"HPOUTR Mixer", "DACH", "DAC"}, | ||
185 | }; | ||
155 | 186 | ||
156 | /* codec private data */ | 187 | /* codec private data */ |
157 | struct ak4642_priv { | 188 | struct ak4642_priv { |
@@ -192,13 +223,8 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream, | |||
192 | * This operation came from example code of | 223 | * This operation came from example code of |
193 | * "ASAHI KASEI AK4642" (japanese) manual p97. | 224 | * "ASAHI KASEI AK4642" (japanese) manual p97. |
194 | */ | 225 | */ |
195 | snd_soc_update_bits(codec, MD_CTL4, DACH, DACH); | ||
196 | snd_soc_update_bits(codec, MD_CTL3, BST1, BST1); | ||
197 | snd_soc_write(codec, L_IVC, 0x91); /* volume */ | 226 | snd_soc_write(codec, L_IVC, 0x91); /* volume */ |
198 | snd_soc_write(codec, R_IVC, 0x91); /* volume */ | 227 | snd_soc_write(codec, R_IVC, 0x91); /* volume */ |
199 | snd_soc_update_bits(codec, PW_MGMT1, PMMIN | PMDAC, | ||
200 | PMMIN | PMDAC); | ||
201 | snd_soc_update_bits(codec, PW_MGMT2, PMHP_MASK, PMHP); | ||
202 | snd_soc_update_bits(codec, PW_MGMT2, HPMTN, HPMTN); | 228 | snd_soc_update_bits(codec, PW_MGMT2, HPMTN, HPMTN); |
203 | } else { | 229 | } else { |
204 | /* | 230 | /* |
@@ -233,10 +259,6 @@ static void ak4642_dai_shutdown(struct snd_pcm_substream *substream, | |||
233 | if (is_play) { | 259 | if (is_play) { |
234 | /* stop headphone output */ | 260 | /* stop headphone output */ |
235 | snd_soc_update_bits(codec, PW_MGMT2, HPMTN, 0); | 261 | snd_soc_update_bits(codec, PW_MGMT2, HPMTN, 0); |
236 | snd_soc_update_bits(codec, PW_MGMT2, PMHP_MASK, 0); | ||
237 | snd_soc_update_bits(codec, PW_MGMT1, PMMIN | PMDAC, 0); | ||
238 | snd_soc_update_bits(codec, MD_CTL3, BST1, 0); | ||
239 | snd_soc_update_bits(codec, MD_CTL4, DACH, 0); | ||
240 | } else { | 262 | } else { |
241 | /* stop stereo input */ | 263 | /* stop stereo input */ |
242 | snd_soc_update_bits(codec, PW_MGMT1, PMADL, 0); | 264 | snd_soc_update_bits(codec, PW_MGMT1, PMADL, 0); |
@@ -459,6 +481,10 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4642 = { | |||
459 | .reg_cache_size = ARRAY_SIZE(ak4642_reg), | 481 | .reg_cache_size = ARRAY_SIZE(ak4642_reg), |
460 | .reg_word_size = sizeof(u8), | 482 | .reg_word_size = sizeof(u8), |
461 | .reg_cache_default = ak4642_reg, | 483 | .reg_cache_default = ak4642_reg, |
484 | .dapm_widgets = ak4642_dapm_widgets, | ||
485 | .num_dapm_widgets = ARRAY_SIZE(ak4642_dapm_widgets), | ||
486 | .dapm_routes = ak4642_intercon, | ||
487 | .num_dapm_routes = ARRAY_SIZE(ak4642_intercon), | ||
462 | }; | 488 | }; |
463 | 489 | ||
464 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | 490 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) |