diff --git a/asoc/codecs/wcd938x/wcd938x.c b/asoc/codecs/wcd938x/wcd938x.c index 26bdafbb06..9dc8e15fc5 100644 --- a/asoc/codecs/wcd938x/wcd938x.c +++ b/asoc/codecs/wcd938x/wcd938x.c @@ -2739,6 +2739,29 @@ static int wcd938x_ear_pa_gain_put(struct snd_kcontrol *kcontrol, return 0; } +/* wcd938x_codec_get_dev_num - returns swr device number + * @component: Codec instance + * + * Return: swr device number on success or negative error + * code on failure. + */ +int wcd938x_codec_get_dev_num(struct snd_soc_component *component) +{ + struct wcd938x_priv *wcd938x; + + if (!component) + return -EINVAL; + + wcd938x = snd_soc_component_get_drvdata(component); + if (!wcd938x || !wcd938x->rx_swr_dev) { + pr_err("%s: wcd938x component is NULL\n", __func__); + return -EINVAL; + } + + return wcd938x->rx_swr_dev->dev_num; +} +EXPORT_SYMBOL(wcd938x_codec_get_dev_num); + static int wcd938x_get_compander(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { diff --git a/asoc/codecs/wcd938x/wcd938x.h b/asoc/codecs/wcd938x/wcd938x.h index 1f945be99a..69b148ab49 100644 --- a/asoc/codecs/wcd938x/wcd938x.h +++ b/asoc/codecs/wcd938x/wcd938x.h @@ -71,6 +71,7 @@ int wcd938x_codec_force_enable_micbias_v2(struct snd_soc_component *wcd938x, int wcd938x_swr_dmic_register_notifier(struct snd_soc_component *wcd938x, struct notifier_block *nblock, bool enable); +int wcd938x_codec_get_dev_num(struct snd_soc_component *component); static inline int wcd938x_slave_get_master_ch_val(int ch) { @@ -127,5 +128,9 @@ static inline int wcd938x_slave_get_slave_ch_val(int ch) { return 0; } +static int wcd938x_codec_get_dev_num(struct snd_soc_component *component) +{ + return 0; +} #endif /* CONFIG_SND_SOC_WCD938X */ #endif /* _WCD938X_H */