ASoC: ak4642: enable stereo line output power-save mode

ak4642 has power-save mode for stereo line to reduce pop noise.
This patch enables it.

Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Takeshi Kihara 2015-03-24 05:15:22 +00:00 committed by Mark Brown
parent 379c4b05db
commit 39c2618064
1 changed files with 31 additions and 2 deletions

View File

@ -97,6 +97,9 @@
#define PMMP (1 << 2) /* MPWR pin Power Management */
#define MGAIN0 (1 << 0) /* MIC amp gain*/
/* SG_SL2 */
#define LOPS (1 << 6) /* Stero Line-out Power Save Mode */
/* TIMER */
#define ZTM(param) ((param & 0x3) << 4) /* ALC Zero Crossing TimeOut */
#define WTM(param) (((param & 0x4) << 4) | ((param & 0x3) << 2))
@ -168,6 +171,29 @@ static const struct snd_kcontrol_new ak4642_lout_mixer_controls[] = {
SOC_DAPM_SINGLE("DACL", SG_SL1, 4, 1, 0),
};
/* event handlers */
static int ak4642_lout_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
switch (event) {
case SND_SOC_DAPM_PRE_PMD:
case SND_SOC_DAPM_PRE_PMU:
/* Power save mode ON */
snd_soc_update_bits(codec, SG_SL2, LOPS, LOPS);
break;
case SND_SOC_DAPM_POST_PMU:
case SND_SOC_DAPM_POST_PMD:
/* Power save mode OFF */
mdelay(300);
snd_soc_update_bits(codec, SG_SL2, LOPS, 0);
break;
}
return 0;
}
static const struct snd_soc_dapm_widget ak4642_dapm_widgets[] = {
/* Outputs */
@ -182,9 +208,12 @@ static const struct snd_soc_dapm_widget ak4642_dapm_widgets[] = {
SND_SOC_DAPM_PGA("DACH", MD_CTL4, 0, 0, NULL, 0),
SND_SOC_DAPM_MIXER("LINEOUT Mixer", PW_MGMT1, 3, 0,
SND_SOC_DAPM_MIXER_E("LINEOUT Mixer", PW_MGMT1, 3, 0,
&ak4642_lout_mixer_controls[0],
ARRAY_SIZE(ak4642_lout_mixer_controls)),
ARRAY_SIZE(ak4642_lout_mixer_controls),
ak4642_lout_event,
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
/* DAC */
SND_SOC_DAPM_DAC("DAC", NULL, PW_MGMT1, 2, 0),