Merge "dsp: fix NULL pointer exception in core driver"
diff --git a/asoc/codecs/wcd934x/wcd934x.c b/asoc/codecs/wcd934x/wcd934x.c
index 8e3981c..e7cec2b 100644
--- a/asoc/codecs/wcd934x/wcd934x.c
+++ b/asoc/codecs/wcd934x/wcd934x.c
@@ -526,7 +526,7 @@
struct delayed_work dwork;
};
-#define WCD934X_SPK_ANC_EN_DELAY_MS 350
+#define WCD934X_SPK_ANC_EN_DELAY_MS 550
static int spk_anc_en_delay = WCD934X_SPK_ANC_EN_DELAY_MS;
module_param(spk_anc_en_delay, int, 0664);
MODULE_PARM_DESC(spk_anc_en_delay, "delay to enable anc in speaker path");
diff --git a/asoc/sdm660-common.c b/asoc/sdm660-common.c
index 4496642..ccfe528 100644
--- a/asoc/sdm660-common.c
+++ b/asoc/sdm660-common.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2018, 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
@@ -2783,11 +2783,10 @@
pdata->mi2s_gpio_p[index]);
ret = msm_mi2s_set_sclk(substream, false);
- if (ret < 0) {
+ if (ret < 0)
pr_err("%s:clock disable failed for MI2S (%d); ret=%d\n",
__func__, index, ret);
- mi2s_intf_conf[index].ref_cnt++;
- }
+
if (mi2s_intf_conf[index].msm_is_ext_mclk) {
mi2s_mclk[index].enable = 0;
pr_debug("%s: Disabling mclk, clk_freq_in_hz = %u\n",
diff --git a/asoc/sdm660-ext-dai-links.c b/asoc/sdm660-ext-dai-links.c
index 5e37da3..02d35a9 100644
--- a/asoc/sdm660-ext-dai-links.c
+++ b/asoc/sdm660-ext-dai-links.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2018, 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
@@ -331,6 +331,7 @@
.ignore_suspend = 1,
.dpcm_playback = 1,
.dpcm_capture = 1,
+ .ignore_pmdown_time = 1,
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ops = &msm_ext_slimbus_2_be_ops,
},
@@ -358,7 +359,6 @@
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
.dpcm_capture = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "tasha_mad1",
.codec_name = "tasha_codec",
.ops = &msm_ext_cpe_ops,
@@ -418,6 +418,7 @@
.codec_name = "tavil_codec",
.codec_dai_name = "tavil_rx2",
.ignore_suspend = 1,
+ .ignore_pmdown_time = 1,
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ops = &msm_ext_slimbus_2_be_ops,
},
@@ -1003,7 +1004,6 @@
SND_SOC_DPCM_TRIGGER_POST },
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.id = MSM_FRONTEND_DAI_LSM1,
@@ -1033,7 +1033,6 @@
.dynamic = 1,
.dpcm_capture = 1,
.dpcm_playback = 1,
- .dpcm_capture = 1,
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
SND_SOC_DPCM_TRIGGER_POST},
.codec_dai_name = "snd-soc-dummy-dai",
@@ -1104,7 +1103,6 @@
SND_SOC_DPCM_TRIGGER_POST },
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.id = MSM_FRONTEND_DAI_LSM2,
@@ -1120,7 +1118,6 @@
SND_SOC_DPCM_TRIGGER_POST },
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.id = MSM_FRONTEND_DAI_LSM3,
@@ -1136,7 +1133,6 @@
SND_SOC_DPCM_TRIGGER_POST },
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.id = MSM_FRONTEND_DAI_LSM4,
@@ -1152,7 +1148,6 @@
SND_SOC_DPCM_TRIGGER_POST },
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.id = MSM_FRONTEND_DAI_LSM5,
@@ -1168,7 +1163,6 @@
SND_SOC_DPCM_TRIGGER_POST },
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.id = MSM_FRONTEND_DAI_LSM6
@@ -1184,7 +1178,6 @@
SND_SOC_DPCM_TRIGGER_POST },
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.id = MSM_FRONTEND_DAI_LSM7,
@@ -1200,7 +1193,6 @@
SND_SOC_DPCM_TRIGGER_POST },
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.id = MSM_FRONTEND_DAI_LSM8,
@@ -1335,7 +1327,6 @@
SND_SOC_DPCM_TRIGGER_POST},
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
},
@@ -1444,6 +1435,7 @@
.id = MSM_BACKEND_DAI_VOICE_PLAYBACK_TX,
.be_hw_params_fixup = msm_ext_be_hw_params_fixup,
.ignore_suspend = 1,
+ .ignore_pmdown_time = 1,
},
/* Incall Music 2 BACK END DAI Link */
{
@@ -1458,6 +1450,7 @@
.id = MSM_BACKEND_DAI_VOICE2_PLAYBACK_TX,
.be_hw_params_fixup = msm_ext_be_hw_params_fixup,
.ignore_suspend = 1,
+ .ignore_pmdown_time = 1,
},
{
.name = LPASS_BE_USB_AUDIO_RX,
@@ -1499,6 +1492,7 @@
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ops = &msm_tdm_be_ops,
.ignore_suspend = 1,
+ .ignore_pmdown_time = 1,
},
{
.name = LPASS_BE_PRI_TDM_TX_0,
@@ -1527,6 +1521,7 @@
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ops = &msm_tdm_be_ops,
.ignore_suspend = 1,
+ .ignore_pmdown_time = 1,
},
{
.name = LPASS_BE_SEC_TDM_TX_0,
@@ -1555,6 +1550,7 @@
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ops = &msm_tdm_be_ops,
.ignore_suspend = 1,
+ .ignore_pmdown_time = 1,
},
{
.name = LPASS_BE_TERT_TDM_TX_0,
@@ -1583,6 +1579,7 @@
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ops = &msm_tdm_be_ops,
.ignore_suspend = 1,
+ .ignore_pmdown_time = 1,
},
{
.name = LPASS_BE_QUAT_TDM_TX_0,
@@ -1611,6 +1608,7 @@
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ops = &msm_tdm_be_ops,
.ignore_suspend = 1,
+ .ignore_pmdown_time = 1,
},
{
.name = LPASS_BE_QUIN_TDM_TX_0,
@@ -1804,7 +1802,6 @@
.dpcm_capture = 1,
.id = MSM_BACKEND_DAI_AUXPCM_TX,
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
.ignore_suspend = 1,
.ops = &msm_aux_pcm_be_ops,
},
@@ -1836,7 +1833,6 @@
.id = MSM_BACKEND_DAI_SEC_AUXPCM_TX,
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.ops = &msm_aux_pcm_be_ops,
},
/* Tertiary AUX PCM Backend DAI Links */
@@ -1867,7 +1863,6 @@
.id = MSM_BACKEND_DAI_TERT_AUXPCM_TX,
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.ops = &msm_aux_pcm_be_ops,
},
/* Quaternary AUX PCM Backend DAI Links */
@@ -1898,7 +1893,6 @@
.id = MSM_BACKEND_DAI_QUAT_AUXPCM_TX,
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.ops = &msm_aux_pcm_be_ops,
},
/* Quinary AUX PCM Backend DAI Links */
@@ -1929,7 +1923,6 @@
.id = MSM_BACKEND_DAI_QUIN_AUXPCM_TX,
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.ops = &msm_aux_pcm_be_ops,
},
};
diff --git a/asoc/sdm660-external.c b/asoc/sdm660-external.c
index b22a365..8ff98ed 100644
--- a/asoc/sdm660-external.c
+++ b/asoc/sdm660-external.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2018, 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
@@ -1215,34 +1215,44 @@
afe_clear_config(AFE_SLIMBUS_SLAVE_CONFIG);
}
-static int msm_adsp_power_up_config(struct snd_soc_codec *codec)
+static int msm_adsp_power_up_config(struct snd_soc_codec *codec,
+ struct snd_card *card)
{
int ret = 0;
unsigned long timeout;
int adsp_ready = 0;
- struct snd_soc_card *card = codec->component.card;
- struct msm_asoc_mach_data *pdata;
+ bool snd_card_online = 0;
- pdata = snd_soc_card_get_drvdata(card);
timeout = jiffies +
msecs_to_jiffies(ADSP_STATE_READY_TIMEOUT_MS);
do {
- if (q6core_is_adsp_ready()) {
- pr_debug("%s: ADSP Audio is ready\n", __func__);
- adsp_ready = 1;
- break;
+ if (!snd_card_online) {
+ snd_card_online = snd_card_is_online_state(card);
+ pr_debug("%s: Sound card is %s\n", __func__,
+ snd_card_online ? "Online" : "Offline");
}
+ if (!adsp_ready) {
+ adsp_ready = q6core_is_adsp_ready();
+ pr_debug("%s: ADSP Audio is %s\n", __func__,
+ adsp_ready ? "ready" : "not ready");
+ }
+ if (snd_card_online && adsp_ready)
+ break;
+
/*
- * ADSP will be coming up after subsystem restart and
+ * Sound card/ADSP will be coming up after subsystem restart and
* it might not be fully up when the control reaches
* here. So, wait for 50msec before checking ADSP state
*/
msleep(50);
} while (time_after(timeout, jiffies));
- if (!adsp_ready) {
- pr_err("%s: timed out waiting for ADSP Audio\n", __func__);
+ if (!snd_card_online || !adsp_ready) {
+ pr_err("%s: Timeout. Sound card is %s, ADSP Audio is %s\n",
+ __func__,
+ snd_card_online ? "Online" : "Offline",
+ adsp_ready ? "ready" : "not ready");
ret = -ETIMEDOUT;
goto err_fail;
}
@@ -1300,7 +1310,7 @@
}
codec = rtd->codec;
- ret = msm_adsp_power_up_config(codec);
+ ret = msm_adsp_power_up_config(codec, card->snd_card);
if (ret < 0) {
dev_err(card->dev,
"%s: msm_adsp_power_up_config failed ret = %d!\n",
@@ -1688,7 +1698,7 @@
msm_codec_fn.mbhc_hs_detect_exit = tasha_mbhc_hs_detect_exit;
}
- ret = msm_adsp_power_up_config(codec);
+ ret = msm_adsp_power_up_config(codec, rtd->card->snd_card);
if (ret) {
pr_err("%s: Failed to set AFE config %d\n", __func__, ret);
goto err_afe_cfg;
diff --git a/asoc/sdm660-internal.c b/asoc/sdm660-internal.c
index 2446d7b..7e02e21 100644
--- a/asoc/sdm660-internal.c
+++ b/asoc/sdm660-internal.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2018, 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
@@ -1881,7 +1881,6 @@
SND_SOC_DPCM_TRIGGER_POST},
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
},
@@ -1931,7 +1930,6 @@
SND_SOC_DPCM_TRIGGER_POST },
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.id = MSM_FRONTEND_DAI_LSM1,
@@ -2030,7 +2028,6 @@
SND_SOC_DPCM_TRIGGER_POST },
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.id = MSM_FRONTEND_DAI_LSM2,
@@ -2046,7 +2043,6 @@
SND_SOC_DPCM_TRIGGER_POST },
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.id = MSM_FRONTEND_DAI_LSM3,
@@ -2062,7 +2058,6 @@
SND_SOC_DPCM_TRIGGER_POST },
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.id = MSM_FRONTEND_DAI_LSM4,
@@ -2078,7 +2073,6 @@
SND_SOC_DPCM_TRIGGER_POST },
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.id = MSM_FRONTEND_DAI_LSM5,
@@ -2094,7 +2088,6 @@
SND_SOC_DPCM_TRIGGER_POST },
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.id = MSM_FRONTEND_DAI_LSM6
@@ -2110,7 +2103,6 @@
SND_SOC_DPCM_TRIGGER_POST },
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.id = MSM_FRONTEND_DAI_LSM7,
@@ -2126,7 +2118,6 @@
SND_SOC_DPCM_TRIGGER_POST },
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
.id = MSM_FRONTEND_DAI_LSM8,
@@ -2261,7 +2252,6 @@
SND_SOC_DPCM_TRIGGER_POST},
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.codec_dai_name = "snd-soc-dummy-dai",
.codec_name = "snd-soc-dummy",
},
@@ -2367,7 +2357,6 @@
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
.ignore_suspend = 1,
.dpcm_capture = 1,
- .ignore_pmdown_time = 1,
},
};
@@ -2491,6 +2480,7 @@
.id = MSM_BACKEND_DAI_VOICE_PLAYBACK_TX,
.be_hw_params_fixup = msm_be_hw_params_fixup,
.ignore_suspend = 1,
+ .ignore_pmdown_time = 1,
},
/* Incall Music 2 BACK END DAI Link */
{
@@ -2505,6 +2495,7 @@
.id = MSM_BACKEND_DAI_VOICE2_PLAYBACK_TX,
.be_hw_params_fixup = msm_be_hw_params_fixup,
.ignore_suspend = 1,
+ .ignore_pmdown_time = 1,
},
{
.name = LPASS_BE_USB_AUDIO_RX,
@@ -2546,6 +2537,7 @@
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ops = &msm_tdm_be_ops,
.ignore_suspend = 1,
+ .ignore_pmdown_time = 1,
},
{
.name = LPASS_BE_PRI_TDM_TX_0,
@@ -2574,6 +2566,7 @@
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ops = &msm_tdm_be_ops,
.ignore_suspend = 1,
+ .ignore_pmdown_time = 1,
},
{
.name = LPASS_BE_SEC_TDM_TX_0,
@@ -2602,6 +2595,7 @@
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ops = &msm_tdm_be_ops,
.ignore_suspend = 1,
+ .ignore_pmdown_time = 1,
},
{
.name = LPASS_BE_TERT_TDM_TX_0,
@@ -2630,6 +2624,7 @@
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ops = &msm_tdm_be_ops,
.ignore_suspend = 1,
+ .ignore_pmdown_time = 1,
},
{
.name = LPASS_BE_QUAT_TDM_TX_0,
@@ -2658,6 +2653,7 @@
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ops = &msm_tdm_be_ops,
.ignore_suspend = 1,
+ .ignore_pmdown_time = 1,
},
{
.name = LPASS_BE_QUIN_TDM_TX_0,
@@ -2851,7 +2847,6 @@
.dpcm_capture = 1,
.id = MSM_BACKEND_DAI_AUXPCM_TX,
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
- .ignore_pmdown_time = 1,
.ignore_suspend = 1,
.ops = &msm_aux_pcm_be_ops,
},
@@ -2883,7 +2878,6 @@
.id = MSM_BACKEND_DAI_SEC_AUXPCM_TX,
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.ops = &msm_aux_pcm_be_ops,
},
/* Tertiary AUX PCM Backend DAI Links */
@@ -2914,7 +2908,6 @@
.id = MSM_BACKEND_DAI_TERT_AUXPCM_TX,
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.ops = &msm_aux_pcm_be_ops,
},
/* Quaternary AUX PCM Backend DAI Links */
@@ -2945,7 +2938,6 @@
.id = MSM_BACKEND_DAI_QUAT_AUXPCM_TX,
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.ops = &msm_aux_pcm_be_ops,
},
/* Quinary AUX PCM Backend DAI Links */
@@ -2976,7 +2968,6 @@
.id = MSM_BACKEND_DAI_QUIN_AUXPCM_TX,
.be_hw_params_fixup = msm_common_be_hw_params_fixup,
.ignore_suspend = 1,
- .ignore_pmdown_time = 1,
.ops = &msm_aux_pcm_be_ops,
},
};