ASoC: msmcobalt: Check for number of aux codecs

Add a check for number of aux codecs before applying the
aux codec gain settings from machine driver to avoid
setting the gains if there are no aux codecs connected.

Change-Id: I86e6c4a15e6eed8e4650c6eb072f07f49890aecc
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
This commit is contained in:
Sudheer Papothi 2016-10-01 00:19:45 +05:30
parent 626caf4e54
commit f02d95e87b

View file

@ -2531,8 +2531,10 @@ static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
* Send speaker configuration only for WSA8810.
* Defalut configuration is for WSA8815.
*/
pr_debug("%s: Number of aux devices: %d\n",
__func__, rtd->card->num_aux_devs);
if (!strcmp(dev_name(codec_dai->dev), "tavil_codec")) {
if (rtd_aux && rtd_aux->component)
if (rtd->card->num_aux_devs && rtd_aux && rtd_aux->component)
if (!strcmp(rtd_aux->component->name, WSA8810_NAME_1) ||
!strcmp(rtd_aux->component->name, WSA8810_NAME_2)) {
tavil_set_spkr_mode(rtd->codec, SPKR_MODE_1);
@ -2551,7 +2553,7 @@ static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
pdata->codec_root = entry;
tavil_codec_info_create_codec_entry(pdata->codec_root, codec);
} else {
if (rtd_aux && rtd_aux->component)
if (rtd->card->num_aux_devs && rtd_aux && rtd_aux->component)
if (!strcmp(rtd_aux->component->name, WSA8810_NAME_1) ||
!strcmp(rtd_aux->component->name, WSA8810_NAME_2)) {
tasha_set_spkr_mode(rtd->codec, SPKR_MODE_1);