aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-04 14:31:00 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-04 16:20:59 -0500
commitbc9ab6d31c4fde1016ecc6606913ed0d52b3ed76 (patch)
treee5991fa7f66e182623a56f80d185b12a6de8712e /sound
parent91660bd65c26b71c35772004c686ed437a1e2cf1 (diff)
ASoC: arizona: Allow runtime reconfiguration of the output mode
Some systems use external analogue switches to connect more analogue devices to the CODEC than are supported by the device. In some systems this requires changing the switched output from single ended to differential mode dynamically at runtime. Add a new function arizona_set_output_mode() to support this. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/arizona.c34
-rw-r--r--sound/soc/codecs/arizona.h3
2 files changed, 37 insertions, 0 deletions
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 27c6a52442a0..bcd225853eb5 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1164,6 +1164,40 @@ int arizona_init_fll(struct arizona *arizona, int id, int base, int lock_irq,
1164} 1164}
1165EXPORT_SYMBOL_GPL(arizona_init_fll); 1165EXPORT_SYMBOL_GPL(arizona_init_fll);
1166 1166
1167/**
1168 * arizona_set_output_mode - Set the mode of the specified output
1169 *
1170 * @codec: Device to configure
1171 * @output: Output number
1172 * @diff: True to set the output to differential mode
1173 *
1174 * Some systems use external analogue switches to connect more
1175 * analogue devices to the CODEC than are supported by the device. In
1176 * some systems this requires changing the switched output from single
1177 * ended to differential mode dynamically at runtime, an operation
1178 * supported using this function.
1179 *
1180 * Most systems have a single static configuration and should use
1181 * platform data instead.
1182 */
1183int arizona_set_output_mode(struct snd_soc_codec *codec, int output, bool diff)
1184{
1185 unsigned int reg, val;
1186
1187 if (output < 1 || output > 6)
1188 return -EINVAL;
1189
1190 reg = ARIZONA_OUTPUT_PATH_CONFIG_1L + (output - 1) * 8;
1191
1192 if (diff)
1193 val = ARIZONA_OUT1_MONO;
1194 else
1195 val = 0;
1196
1197 return snd_soc_update_bits(codec, reg, ARIZONA_OUT1_MONO, val);
1198}
1199EXPORT_SYMBOL_GPL(arizona_set_output_mode);
1200
1167MODULE_DESCRIPTION("ASoC Wolfson Arizona class device support"); 1201MODULE_DESCRIPTION("ASoC Wolfson Arizona class device support");
1168MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); 1202MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
1169MODULE_LICENSE("GPL"); 1203MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h
index 7f22b4f84369..0973fd9bd9a7 100644
--- a/sound/soc/codecs/arizona.h
+++ b/sound/soc/codecs/arizona.h
@@ -213,4 +213,7 @@ extern int arizona_set_fll(struct arizona_fll *fll, int source,
213 213
214extern int arizona_init_dai(struct arizona_priv *priv, int dai); 214extern int arizona_init_dai(struct arizona_priv *priv, int dai);
215 215
216int arizona_set_output_mode(struct snd_soc_codec *codec, int output,
217 bool diff);
218
216#endif 219#endif