summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs
diff options
context:
space:
mode:
authorCharles Keepax2015-09-16 14:59:41 +0200
committerMark Brown2015-09-16 22:00:03 +0200
commit002b083b8da96fd6c546fab2608803e7ce47627d (patch)
tree3ad74242e56dd632965d88e8ddbbf69dddcd0d4f /sound/soc/codecs
parentASoC: arizona: Add default cases for event switches (diff)
downloadkernel-qcow2-linux-002b083b8da96fd6c546fab2608803e7ce47627d.tar.gz
kernel-qcow2-linux-002b083b8da96fd6c546fab2608803e7ce47627d.tar.xz
kernel-qcow2-linux-002b083b8da96fd6c546fab2608803e7ce47627d.zip
ASoC: arizona: Add utility function to check if an input is analog
We will occasionally require to take different action based on if an input is analog or digital so add a helper function to return if an input is analog. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r--sound/soc/codecs/arizona.c9
-rw-r--r--sound/soc/codecs/arizona.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 1bc19f1e5e70..ac21b85ff75f 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -691,6 +691,15 @@ static void arizona_in_set_vu(struct snd_soc_codec *codec, int ena)
ARIZONA_IN_VU, val);
}
+bool arizona_input_analog(struct snd_soc_codec *codec, int shift)
+{
+ unsigned int reg = ARIZONA_IN1L_CONTROL + ((shift / 2) * 8);
+ unsigned int val = snd_soc_read(codec, reg);
+
+ return !(val & ARIZONA_IN1_MODE_MASK);
+}
+EXPORT_SYMBOL_GPL(arizona_input_analog);
+
int arizona_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
int event)
{
diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h
index ada0a418ff4b..7b68d05a0939 100644
--- a/sound/soc/codecs/arizona.h
+++ b/sound/soc/codecs/arizona.h
@@ -294,4 +294,6 @@ 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);
+extern bool arizona_input_analog(struct snd_soc_codec *codec, int shift);
+
#endif