mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
Merge "ASoC: msm: 8939: schedule mbhc start after 4sec"
This commit is contained in:
commit
7f228bd00c
1 changed files with 40 additions and 5 deletions
|
@ -70,6 +70,7 @@
|
|||
#define LPASS_CSR_GP_IO_MUX_SPKR_CTL 0x07702004
|
||||
|
||||
#define ADSP_STATE_READY_TIMEOUT_MS 50
|
||||
#define HS_STARTWORK_TIMEOUT 4000
|
||||
|
||||
static int slim0_rx_sample_rate = SAMPLING_RATE_48KHZ;
|
||||
static int slim0_rx_bit_format = SNDRV_PCM_FORMAT_S16_LE;
|
||||
|
@ -91,6 +92,8 @@ struct msm8939_asoc_mach_data {
|
|||
int us_euro_gpio;
|
||||
struct mutex cdc_mclk_mutex;
|
||||
struct afe_digital_clk_cfg digital_cdc_clk;
|
||||
struct delayed_work hs_detect_dwork;
|
||||
struct snd_soc_codec *codec;
|
||||
};
|
||||
|
||||
static int msm_snd_enable_codec_ext_clk(struct snd_soc_codec *codec, int enable,
|
||||
|
@ -896,6 +899,29 @@ out:
|
|||
return err;
|
||||
}
|
||||
|
||||
static void hs_detect_work(struct work_struct *work)
|
||||
{
|
||||
struct delayed_work *dwork;
|
||||
struct msm8939_asoc_mach_data *pdata;
|
||||
int ret;
|
||||
|
||||
pr_debug("%s: enter\n", __func__);
|
||||
|
||||
dwork = to_delayed_work(work);
|
||||
pdata = container_of(dwork, struct msm8939_asoc_mach_data,
|
||||
hs_detect_dwork);
|
||||
ret = tapan_hs_detect(pdata->codec, &wcd9xxx_mbhc_cfg);
|
||||
if (ret < 0)
|
||||
pr_err("%s: Failed to intialise mbhc %d\n", __func__, ret);
|
||||
|
||||
/*
|
||||
* Set pdata->codec back to NULL, to ensure codec pointer
|
||||
* is not referenced further from this structure.
|
||||
*/
|
||||
pdata->codec = NULL;
|
||||
pr_debug("%s: leave\n", __func__);
|
||||
}
|
||||
|
||||
static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
|
||||
|
@ -903,6 +929,8 @@ static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
|
|||
struct snd_soc_dapm_context *dapm = &codec->dapm;
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
||||
struct snd_soc_card *card = codec->card;
|
||||
struct msm8939_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||
void __iomem *vaddr = NULL;
|
||||
int val = 0;
|
||||
int ret = 0;
|
||||
|
@ -992,13 +1020,19 @@ static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd)
|
|||
pr_debug("%s:val2 %x\n", __func__, val);
|
||||
iounmap(vaddr);
|
||||
|
||||
|
||||
/* start mbhc */
|
||||
wcd9xxx_mbhc_cfg.calibration = def_codec_mbhc_cal();
|
||||
if (wcd9xxx_mbhc_cfg.calibration)
|
||||
ret = tapan_hs_detect(codec, &wcd9xxx_mbhc_cfg);
|
||||
else
|
||||
if (wcd9xxx_mbhc_cfg.calibration) {
|
||||
/*
|
||||
* mbhc inital calibration needs mclk to be enabled, so schedule
|
||||
* headset detection for 4sec so that modem gets loaded and
|
||||
* will be ready to accept mclk request command.
|
||||
*/
|
||||
pdata->codec = codec;
|
||||
schedule_delayed_work(&pdata->hs_detect_dwork,
|
||||
msecs_to_jiffies(HS_STARTWORK_TIMEOUT));
|
||||
} else {
|
||||
ret = -ENOMEM;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -2099,6 +2133,7 @@ static int msm8939_asoc_machine_probe(struct platform_device *pdev)
|
|||
spdev = pdev;
|
||||
card->dev = &pdev->dev;
|
||||
|
||||
INIT_DELAYED_WORK(&pdata->hs_detect_dwork, hs_detect_work);
|
||||
mutex_init(&pdata->cdc_mclk_mutex);
|
||||
ret = snd_soc_of_parse_card_name(card, "qcom,model");
|
||||
if (ret) {
|
||||
|
|
Loading…
Reference in a new issue