summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaxminath Kasam <lkasam@codeaurora.org>2016-12-22 19:44:52 +0530
committerLaxminath Kasam <lkasam@codeaurora.org>2017-01-03 11:40:05 +0530
commit03e601544bb1e7ae64e64134f29d1265945e6b30 (patch)
tree7df933ea92af5290a0106c2036f214e7c3cf9181
parent613765204325713b6419765d5d27e7b8f633ef59 (diff)
ASoC: msm: Fix audio SSR on SDM660 external codec
Update notifier function to use platform device correctly in order to fix Audio SSR on external codec. CRs-Fixed: 1094763 Change-Id: I67fc099c30ad097d0be3a2c9fc92a31ce61368f7 Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
-rw-r--r--sound/soc/msm/sdm660-common.c17
-rw-r--r--sound/soc/msm/sdm660-common.h3
-rw-r--r--sound/soc/msm/sdm660-external.c10
-rw-r--r--sound/soc/msm/sdm660-external.h6
4 files changed, 26 insertions, 10 deletions
diff --git a/sound/soc/msm/sdm660-common.c b/sound/soc/msm/sdm660-common.c
index 623b8c5c866a..bf5dbeb3a401 100644
--- a/sound/soc/msm/sdm660-common.c
+++ b/sound/soc/msm/sdm660-common.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -2772,11 +2772,24 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
ret = devm_snd_soc_register_card(&pdev->dev, card);
- if (ret) {
+ if (ret == -EPROBE_DEFER) {
+ if (codec_reg_done) {
+ /*
+ * return failure as EINVAL since other codec
+ * registered sound card successfully.
+ * This avoids any further probe calls.
+ */
+ ret = -EINVAL;
+ }
+ goto err;
+ } else if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
ret);
goto err;
}
+ if (pdata->snd_card_val != INT_SND_CARD)
+ msm_ext_register_audio_notifier(pdev);
+
return 0;
err:
if (pdata->us_euro_gpio > 0) {
diff --git a/sound/soc/msm/sdm660-common.h b/sound/soc/msm/sdm660-common.h
index 71b6a0786549..aa760ba71de2 100644
--- a/sound/soc/msm/sdm660-common.h
+++ b/sound/soc/msm/sdm660-common.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -66,6 +66,7 @@ enum {
};
extern const struct snd_kcontrol_new msm_common_snd_controls[];
+extern bool codec_reg_done;
struct sdm660_codec {
void* (*get_afe_config_fn)(struct snd_soc_codec *codec,
enum afe_config_type config_type);
diff --git a/sound/soc/msm/sdm660-external.c b/sound/soc/msm/sdm660-external.c
index f610eb53d5df..a741499b2a73 100644
--- a/sound/soc/msm/sdm660-external.c
+++ b/sound/soc/msm/sdm660-external.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -56,6 +56,7 @@
static int msm_ext_spk_control = 1;
static struct wcd_mbhc_config *wcd_mbhc_cfg_ptr;
+bool codec_reg_done;
struct msm_asoc_wcd93xx_codec {
void* (*get_afe_config_fn)(struct snd_soc_codec *codec,
@@ -1722,6 +1723,7 @@ int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
}
}
+ codec_reg_done = true;
done:
return 0;
@@ -1735,10 +1737,12 @@ EXPORT_SYMBOL(msm_audrx_init);
/**
* msm_ext_register_audio_notifier - register SSR notifier.
*/
-void msm_ext_register_audio_notifier(void)
+void msm_ext_register_audio_notifier(struct platform_device *pdev)
{
int ret;
+ is_initial_boot = true;
+ spdev = pdev;
ret = audio_notifier_register("sdm660", AUDIO_NOTIFIER_ADSP_DOMAIN,
&service_nb);
if (ret < 0)
@@ -1777,10 +1781,8 @@ int msm_ext_cdc_init(struct platform_device *pdev,
ret = -EPROBE_DEFER;
goto err;
}
- spdev = pdev;
platform_set_drvdata(pdev, *card);
snd_soc_card_set_drvdata(*card, pdata);
- is_initial_boot = true;
pdata->hph_en1_gpio = of_get_named_gpio(pdev->dev.of_node,
"qcom,hph-en1-gpio", 0);
if (!gpio_is_valid(pdata->hph_en1_gpio))
diff --git a/sound/soc/msm/sdm660-external.h b/sound/soc/msm/sdm660-external.h
index 0ede06f0c082..7625a24e8fae 100644
--- a/sound/soc/msm/sdm660-external.h
+++ b/sound/soc/msm/sdm660-external.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -33,7 +33,7 @@ int msm_ext_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
#ifdef CONFIG_SND_SOC_EXT_CODEC
int msm_ext_cdc_init(struct platform_device *, struct msm_asoc_mach_data *,
struct snd_soc_card **, struct wcd_mbhc_config *);
-void msm_ext_register_audio_notifier(void);
+void msm_ext_register_audio_notifier(struct platform_device *pdev);
void msm_ext_cdc_deinit(void);
#else
inline int msm_ext_cdc_init(struct platform_device *pdev,
@@ -44,7 +44,7 @@ inline int msm_ext_cdc_init(struct platform_device *pdev,
return 0;
}
-inline void msm_ext_register_audio_notifier(void)
+inline void msm_ext_register_audio_notifier(struct platform_device *pdev)
{
}
inline void msm_ext_cdc_deinit(void)