Merge "ASoC: msm: Fix audio SSR on SDM660 external codec"

This commit is contained in:
Linux Build Service Account 2017-01-03 08:43:34 -08:00 committed by Gerrit - the friendly Code Review server
commit 5901096e46
4 changed files with 26 additions and 10 deletions

View file

@ -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) {

View file

@ -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);

View file

@ -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))

View file

@ -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)