aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm9713.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2008-05-19 06:31:28 -0400
committerJaroslav Kysela <perex@perex.cz>2008-05-19 11:28:43 -0400
commit0be9898adb6f58fee44f0fec0bbc0eac997ea9eb (patch)
tree61842c7381c7dcc4060280357a9a5fc08f4db023 /sound/soc/codecs/wm9713.c
parent1ef6ab75c7deef931d6308af282ed7d8e480e77f (diff)
[ALSA] ASoC: Clarify API for bias configuration
Currently the ASoC core configures the bias levels in the system using a callback on codecs and machines called 'dapm_event', passing it PCI style power levels as SNDRV_CTL_POWER_ constants. This is more obscure than it needs to be and has caused confusion to driver authors, especially given that DAPM is also performing power management. Address this by renaming the callback function to 'set_bias_level' and using constants explicitly representing the off, standby, pre-on and on states which DAPM transitions through. Also unexport the API for setting bias level: there are currently no in-tree users of this API other than the core itself and it is likely that the core would need to be extended to cater for any users. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Jarkko Nikula <jarkko.nikula@nokia.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/soc/codecs/wm9713.c')
-rw-r--r--sound/soc/codecs/wm9713.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index 9e6b2fd7262b..4863636e9d56 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -1094,33 +1094,33 @@ int wm9713_reset(struct snd_soc_codec *codec, int try_warm)
1094} 1094}
1095EXPORT_SYMBOL_GPL(wm9713_reset); 1095EXPORT_SYMBOL_GPL(wm9713_reset);
1096 1096
1097static int wm9713_dapm_event(struct snd_soc_codec *codec, int event) 1097static int wm9713_set_bias_level(struct snd_soc_codec *codec,
1098 enum snd_soc_bias_level level)
1098{ 1099{
1099 u16 reg; 1100 u16 reg;
1100 1101
1101 switch (event) { 1102 switch (level) {
1102 case SNDRV_CTL_POWER_D0: /* full On */ 1103 case SND_SOC_BIAS_ON:
1103 /* enable thermal shutdown */ 1104 /* enable thermal shutdown */
1104 reg = ac97_read(codec, AC97_EXTENDED_MID) & 0x1bff; 1105 reg = ac97_read(codec, AC97_EXTENDED_MID) & 0x1bff;
1105 ac97_write(codec, AC97_EXTENDED_MID, reg); 1106 ac97_write(codec, AC97_EXTENDED_MID, reg);
1106 break; 1107 break;
1107 case SNDRV_CTL_POWER_D1: /* partial On */ 1108 case SND_SOC_BIAS_PREPARE:
1108 case SNDRV_CTL_POWER_D2: /* partial On */
1109 break; 1109 break;
1110 case SNDRV_CTL_POWER_D3hot: /* Off, with power */ 1110 case SND_SOC_BIAS_STANDBY:
1111 /* enable master bias and vmid */ 1111 /* enable master bias and vmid */
1112 reg = ac97_read(codec, AC97_EXTENDED_MID) & 0x3bff; 1112 reg = ac97_read(codec, AC97_EXTENDED_MID) & 0x3bff;
1113 ac97_write(codec, AC97_EXTENDED_MID, reg); 1113 ac97_write(codec, AC97_EXTENDED_MID, reg);
1114 ac97_write(codec, AC97_POWERDOWN, 0x0000); 1114 ac97_write(codec, AC97_POWERDOWN, 0x0000);
1115 break; 1115 break;
1116 case SNDRV_CTL_POWER_D3cold: /* Off, without power */ 1116 case SND_SOC_BIAS_OFF:
1117 /* disable everything including AC link */ 1117 /* disable everything including AC link */
1118 ac97_write(codec, AC97_EXTENDED_MID, 0xffff); 1118 ac97_write(codec, AC97_EXTENDED_MID, 0xffff);
1119 ac97_write(codec, AC97_EXTENDED_MSTATUS, 0xffff); 1119 ac97_write(codec, AC97_EXTENDED_MSTATUS, 0xffff);
1120 ac97_write(codec, AC97_POWERDOWN, 0xffff); 1120 ac97_write(codec, AC97_POWERDOWN, 0xffff);
1121 break; 1121 break;
1122 } 1122 }
1123 codec->dapm_state = event; 1123 codec->bias_level = level;
1124 return 0; 1124 return 0;
1125} 1125}
1126 1126
@@ -1157,7 +1157,7 @@ static int wm9713_soc_resume(struct platform_device *pdev)
1157 return ret; 1157 return ret;
1158 } 1158 }
1159 1159
1160 wm9713_dapm_event(codec, SNDRV_CTL_POWER_D3hot); 1160 wm9713_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1161 1161
1162 /* do we need to re-start the PLL ? */ 1162 /* do we need to re-start the PLL ? */
1163 if (wm9713->pll_out) 1163 if (wm9713->pll_out)
@@ -1173,8 +1173,8 @@ static int wm9713_soc_resume(struct platform_device *pdev)
1173 } 1173 }
1174 } 1174 }
1175 1175
1176 if (codec->suspend_dapm_state == SNDRV_CTL_POWER_D0) 1176 if (codec->suspend_bias_level == SND_SOC_BIAS_ON)
1177 wm9713_dapm_event(codec, SNDRV_CTL_POWER_D0); 1177 wm9713_set_bias_level(codec, SND_SOC_BIAS_ON);
1178 1178
1179 return ret; 1179 return ret;
1180} 1180}
@@ -1213,7 +1213,7 @@ static int wm9713_soc_probe(struct platform_device *pdev)
1213 codec->num_dai = ARRAY_SIZE(wm9713_dai); 1213 codec->num_dai = ARRAY_SIZE(wm9713_dai);
1214 codec->write = ac97_write; 1214 codec->write = ac97_write;
1215 codec->read = ac97_read; 1215 codec->read = ac97_read;
1216 codec->dapm_event = wm9713_dapm_event; 1216 codec->set_bias_level = wm9713_set_bias_level;
1217 INIT_LIST_HEAD(&codec->dapm_widgets); 1217 INIT_LIST_HEAD(&codec->dapm_widgets);
1218 INIT_LIST_HEAD(&codec->dapm_paths); 1218 INIT_LIST_HEAD(&codec->dapm_paths);
1219 1219
@@ -1235,7 +1235,7 @@ static int wm9713_soc_probe(struct platform_device *pdev)
1235 goto reset_err; 1235 goto reset_err;
1236 } 1236 }
1237 1237
1238 wm9713_dapm_event(codec, SNDRV_CTL_POWER_D3hot); 1238 wm9713_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1239 1239
1240 /* unmute the adc - move to kcontrol */ 1240 /* unmute the adc - move to kcontrol */
1241 reg = ac97_read(codec, AC97_CD) & 0x7fff; 1241 reg = ac97_read(codec, AC97_CD) & 0x7fff;