Merge "AsoC: lahaina: support right speaker as mono device"

This commit is contained in:
qctecmdr
2020-08-17 01:44:19 -07:00
committed by Gerrit - the friendly Code Review server

View File

@@ -7636,32 +7636,35 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
struct msm_asoc_mach_data *pdata =
snd_soc_card_get_drvdata(rtd->card);
int ret = 0;
int wsa_active_devs = 0;
if (codec_reg_done) {
return 0;
}
if (pdata->wsa_max_devs > 0) {
component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.1");
if (!component) {
pr_err("%s: wsa-codec.1 component is NULL\n", __func__);
return -EINVAL;
if (component) {
dapm = snd_soc_component_get_dapm(component);
wsa883x_set_channel_map(component, &spkleft_ports[0],
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
&ch_rate[0], &spkleft_port_types[0]);
wsa883x_codec_info_create_codec_entry(pdata->codec_root,
component);
wsa_active_devs++;
} else {
pr_info("%s: wsa-codec.1 component is NULL\n", __func__);
}
dapm = snd_soc_component_get_dapm(component);
wsa883x_set_channel_map(component, &spkleft_ports[0],
WSA883X_MAX_SWR_PORTS, &ch_mask[0],
&ch_rate[0], &spkleft_port_types[0]);
wsa883x_codec_info_create_codec_entry(pdata->codec_root,
component);
}
/* If current platform has more than one WSA */
if (pdata->wsa_max_devs > 1) {
if (pdata->wsa_max_devs > wsa_active_devs) {
component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.2");
if (!component) {
pr_err("%s: wsa-codec.2 component is NULL\n", __func__);
pr_err("%s: %d WSA is found. Expect %d WSA.",
__func__, wsa_active_devs, pdata->wsa_max_devs);
return -EINVAL;
}