summaryrefslogtreecommitdiff
path: root/asoc
diff options
context:
space:
mode:
authorVignesh Kulothungan <vigneshk@codeaurora.org>2020-08-05 23:26:06 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2020-11-16 07:23:34 -0800
commit77ab1182b29e6e390fca1c31d68daccaf03db23c (patch)
tree57baebfe9cbaee0df4cba76c6894008c6ddbc9c1 /asoc
parent9ac902adbacbf38d599e9926dff7707e3b8de049 (diff)
downloadmsm-extra-77ab1182b29e6e390fca1c31d68daccaf03db23c.tar.gz
ASoC: wsa883x: add function to get swr device number
Add a function in wsa883x which returns the sound wire device number for a given wsa883x codec slave instance. Change-Id: Ie3d0e309870f488b1643a853bcddcf93314d94b5 Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
Diffstat (limited to 'asoc')
-rw-r--r--asoc/codecs/wsa883x/wsa883x.c24
-rw-r--r--asoc/codecs/wsa883x/wsa883x.h5
2 files changed, 29 insertions, 0 deletions
diff --git a/asoc/codecs/wsa883x/wsa883x.c b/asoc/codecs/wsa883x/wsa883x.c
index 8a5e99e4..edfeceee 100644
--- a/asoc/codecs/wsa883x/wsa883x.c
+++ b/asoc/codecs/wsa883x/wsa883x.c
@@ -770,6 +770,30 @@ int wsa883x_codec_info_create_codec_entry(struct snd_info_entry *codec_root,
}
EXPORT_SYMBOL(wsa883x_codec_info_create_codec_entry);
+/*
+ * wsa883x_codec_get_dev_num - returns swr device number
+ * @component: Codec instance
+ *
+ * Return: swr device number on success or negative error
+ * code on failure.
+ */
+int wsa883x_codec_get_dev_num(struct snd_soc_component *component)
+{
+ struct wsa883x_priv *wsa883x;
+
+ if (!component)
+ return -EINVAL;
+
+ wsa883x = snd_soc_component_get_drvdata(component);
+ if (!wsa883x) {
+ pr_err("%s: wsa883x component is NULL\n", __func__);
+ return -EINVAL;
+ }
+
+ return wsa883x->swr_slave->dev_num;
+}
+EXPORT_SYMBOL(wsa883x_codec_get_dev_num);
+
static int wsa883x_get_compander(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
diff --git a/asoc/codecs/wsa883x/wsa883x.h b/asoc/codecs/wsa883x/wsa883x.h
index e080134e..bb719831 100644
--- a/asoc/codecs/wsa883x/wsa883x.h
+++ b/asoc/codecs/wsa883x/wsa883x.h
@@ -21,6 +21,7 @@ int wsa883x_set_channel_map(struct snd_soc_component *component,
int wsa883x_codec_info_create_codec_entry(
struct snd_info_entry *codec_root,
struct snd_soc_component *component);
+int wsa883x_codec_get_dev_num(struct snd_soc_component *component);
#else
static int wsa883x_set_channel_map(struct snd_soc_component *component,
u8 *port, u8 num_port, unsigned int *ch_mask,
@@ -36,6 +37,10 @@ static int wsa883x_codec_info_create_codec_entry(
return 0;
}
+static int wsa883x_codec_get_dev_num(struct snd_soc_component *component)
+{
+ return 0;
+}
#endif
#endif /* _WSA883X_H */