Merge "ASoC: Kona: Make addition of aux codec as optional"

This commit is contained in:
qctecmdr
2019-07-08 01:31:16 -07:00
committed by Gerrit - the friendly Code Review server

View File

@@ -7174,6 +7174,7 @@ static int msm_init_aux_dev(struct platform_device *pdev,
struct device_node *aux_codec_of_node;
u32 wsa_max_devs;
u32 wsa_dev_cnt;
u32 codec_max_aux_devs = 0;
u32 codec_aux_dev_cnt = 0;
int i;
struct msm_wsa881x_dev_info *wsa881x_dev_info;
@@ -7289,6 +7290,24 @@ static int msm_init_aux_dev(struct platform_device *pdev,
__func__, found);
codec_aux_dev:
/* Get maximum aux codec device count for this platform */
ret = of_property_read_u32(pdev->dev.of_node,
"qcom,codec-max-aux-devs",
&codec_max_aux_devs);
if (ret) {
dev_err(&pdev->dev,
"%s: codec-max-aux-devs property missing in DT %s, ret = %d\n",
__func__, pdev->dev.of_node->full_name, ret);
codec_max_aux_devs = 0;
goto aux_dev_register;
}
if (codec_max_aux_devs == 0) {
dev_dbg(&pdev->dev,
"%s: Max aux codec devices is 0 for this target?\n",
__func__);
goto aux_dev_register;
}
/* Get count of aux codec device phandles for this platform */
codec_aux_dev_cnt = of_count_phandle_with_args(
pdev->dev.of_node,
@@ -7305,6 +7324,19 @@ codec_aux_dev:
goto err;
}
/*
* Expect total phandles count to be NOT less than maximum possible
* AUX device count. However, if it is less, then assign same value to
* max count as well.
*/
if (codec_aux_dev_cnt < codec_max_aux_devs) {
dev_dbg(&pdev->dev,
"%s: codec_max_aux_devs = %d cannot exceed codec_aux_dev_cnt = %d\n",
__func__, codec_max_aux_devs,
codec_aux_dev_cnt);
codec_max_aux_devs = codec_aux_dev_cnt;
}
/*
* Alloc mem to store phandle and index info of aux codec
* if already registered with ALSA core
@@ -7353,6 +7385,7 @@ codec_aux_dev:
"%s: found %d AUX codecs registered with ALSA core\n",
__func__, codecs_found);
aux_dev_register:
card->num_aux_devs = wsa_max_devs + codec_aux_dev_cnt;
card->num_configs = wsa_max_devs + codec_aux_dev_cnt;