asoc: codec: wcd938x: Get swr device number

add wcd938x_codec_get_dev_num to return
swr device number

Change-Id: I45f4324645643b4edc6182cee508ce1e647c3612
signed-off-by: sarath varma ganapahiraju <ganavarm@codeaurora.org>
This commit is contained in:
sarath varma ganapathiraju
2021-05-17 19:23:22 +05:30
committed by Gerrit - the friendly Code Review server
parent 4a24723e3d
commit 2db2fd8857
2 changed files with 28 additions and 0 deletions

View File

@@ -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)
{

View File

@@ -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 */