summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-04 19:31:00 +0000
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-04 21:20:59 +0000
commitbc9ab6d31c4fde1016ecc6606913ed0d52b3ed76 (patch)
treee5991fa7f66e182623a56f80d185b12a6de8712e /sound/soc/codecs
parent91660bd65c26b71c35772004c686ed437a1e2cf1 (diff)
downloadlinux-bc9ab6d31c4fde1016ecc6606913ed0d52b3ed76.tar.gz
linux-bc9ab6d31c4fde1016ecc6606913ed0d52b3ed76.tar.bz2
linux-bc9ab6d31c4fde1016ecc6606913ed0d52b3ed76.zip
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/soc/codecs')
-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,
}
EXPORT_SYMBOL_GPL(arizona_init_fll);
+/**
+ * arizona_set_output_mode - Set the mode of the specified output
+ *
+ * @codec: Device to configure
+ * @output: Output number
+ * @diff: True to set the output to differential 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, an operation
+ * supported using this function.
+ *
+ * Most systems have a single static configuration and should use
+ * platform data instead.
+ */
+int arizona_set_output_mode(struct snd_soc_codec *codec, int output, bool diff)
+{
+ unsigned int reg, val;
+
+ if (output < 1 || output > 6)
+ return -EINVAL;
+
+ reg = ARIZONA_OUTPUT_PATH_CONFIG_1L + (output - 1) * 8;
+
+ if (diff)
+ val = ARIZONA_OUT1_MONO;
+ else
+ val = 0;
+
+ return snd_soc_update_bits(codec, reg, ARIZONA_OUT1_MONO, val);
+}
+EXPORT_SYMBOL_GPL(arizona_set_output_mode);
+
MODULE_DESCRIPTION("ASoC Wolfson Arizona class device support");
MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
MODULE_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,
extern int arizona_init_dai(struct arizona_priv *priv, int dai);
+int arizona_set_output_mode(struct snd_soc_codec *codec, int output,
+ bool diff);
+
#endif