Asoc: msm: sdm660: Move mbhc_hs_detect to late_probe
mbhc_hs_detect should be called after sound card is registered. Move mbhc_hs_detect from audrx_init to late_probe of snd_soc_card to handle this. Change-Id: Ifee3cddf603143417fc0b4409c87f717ff037631 Signed-off-by: Rohit Kumar <rohitkr@codeaurora.org>
This commit is contained in:
parent
baf0fa8f1e
commit
1c45d33e8d
2 changed files with 31 additions and 25 deletions
|
@ -3772,7 +3772,6 @@ static int msm_anlg_cdc_device_up(struct snd_soc_codec *codec)
|
|||
{
|
||||
struct sdm660_cdc_priv *sdm660_cdc_priv =
|
||||
snd_soc_codec_get_drvdata(codec);
|
||||
int ret = 0;
|
||||
|
||||
dev_dbg(codec->dev, "%s: device up!\n", __func__);
|
||||
|
||||
|
@ -3794,21 +3793,6 @@ static int msm_anlg_cdc_device_up(struct snd_soc_codec *codec)
|
|||
else if (sdm660_cdc_priv->boost_option == BYPASS_ALWAYS)
|
||||
msm_anlg_cdc_bypass_on(codec);
|
||||
|
||||
msm_anlg_cdc_configure_cap(codec, false, false);
|
||||
wcd_mbhc_stop(&sdm660_cdc_priv->mbhc);
|
||||
wcd_mbhc_deinit(&sdm660_cdc_priv->mbhc);
|
||||
/* Disable mechanical detection and set type to insertion */
|
||||
snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_MBHC_DET_CTL_1,
|
||||
0xA0, 0x20);
|
||||
ret = wcd_mbhc_init(&sdm660_cdc_priv->mbhc, codec, &mbhc_cb,
|
||||
&intr_ids, wcd_mbhc_registers, true);
|
||||
if (ret)
|
||||
dev_err(codec->dev, "%s: mbhc initialization failed\n",
|
||||
__func__);
|
||||
else
|
||||
wcd_mbhc_start(&sdm660_cdc_priv->mbhc,
|
||||
sdm660_cdc_priv->mbhc.mbhc_cfg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1301,15 +1301,6 @@ static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
|
|||
msm_anlg_cdc_spk_ext_pa_cb(enable_spk_ext_pa, ana_cdc);
|
||||
msm_dig_cdc_hph_comp_cb(msm_config_hph_compander_gpio, dig_cdc);
|
||||
|
||||
mbhc_cfg_ptr->calibration = def_msm_int_wcd_mbhc_cal();
|
||||
if (mbhc_cfg_ptr->calibration) {
|
||||
ret = msm_anlg_cdc_hs_detect(ana_cdc, mbhc_cfg_ptr);
|
||||
if (ret) {
|
||||
pr_err("%s: msm_anlg_cdc_hs_detect failed\n", __func__);
|
||||
kfree(mbhc_cfg_ptr->calibration);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
card = rtd->card->snd_card;
|
||||
if (!codec_root)
|
||||
codec_root = snd_register_module_info(card->module, "codecs",
|
||||
|
@ -1569,6 +1560,36 @@ end:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int msm_snd_card_late_probe(struct snd_soc_card *card)
|
||||
{
|
||||
const char *be_dl_name = LPASS_BE_INT0_MI2S_RX;
|
||||
struct snd_soc_codec *ana_cdc;
|
||||
struct snd_soc_pcm_runtime *rtd;
|
||||
int ret = 0;
|
||||
|
||||
rtd = snd_soc_get_pcm_runtime(card, be_dl_name);
|
||||
if (!rtd) {
|
||||
dev_err(card->dev,
|
||||
"%s: snd_soc_get_pcm_runtime for %s failed!\n",
|
||||
__func__, be_dl_name);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ana_cdc = rtd->codec_dais[ANA_CDC]->codec;
|
||||
mbhc_cfg_ptr->calibration = def_msm_int_wcd_mbhc_cal();
|
||||
if (!mbhc_cfg_ptr->calibration)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = msm_anlg_cdc_hs_detect(ana_cdc, mbhc_cfg_ptr);
|
||||
if (ret) {
|
||||
dev_err(card->dev,
|
||||
"%s: msm_anlg_cdc_hs_detect failed\n", __func__);
|
||||
kfree(mbhc_cfg_ptr->calibration);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops msm_tdm_be_ops = {
|
||||
.hw_params = msm_tdm_snd_hw_params
|
||||
};
|
||||
|
@ -2930,6 +2951,7 @@ static struct snd_soc_card sdm660_card = {
|
|||
.name = "sdm660-snd-card",
|
||||
.dai_link = msm_int_dai,
|
||||
.num_links = ARRAY_SIZE(msm_int_dai),
|
||||
.late_probe = msm_snd_card_late_probe,
|
||||
};
|
||||
|
||||
static void msm_disable_int_mclk0(struct work_struct *work)
|
||||
|
|
Loading…
Add table
Reference in a new issue