asoc: msm: add workqueue to handle SSR/PDR UP notification

Use workqueue in machine driver to handle sending AFE
configuration to DSP during SSR/PDR UP notification,
so that the response to the notification is not delayed
because of AVS not up or sound card not up.

Change-Id: If537d214cfbbe7f85b66425cbd6a762f383c05ab
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
This commit is contained in:
Karthikeyan Mani 2018-04-23 18:01:19 -07:00 committed by Gerrit - the friendly Code Review server
parent 45e64b92bb
commit 743a507eb0

View file

@ -167,6 +167,8 @@ struct msm_asoc_mach_data {
struct device_node *hph_en1_gpio_p; /* used by pinctrl API */
struct device_node *hph_en0_gpio_p; /* used by pinctrl API */
struct device_node *fsa_handle;
struct snd_soc_codec *codec;
struct work_struct adsp_power_up_work;
};
struct msm_asoc_wcd93xx_codec {
@ -3878,6 +3880,19 @@ static int msm_adsp_power_up_config(struct snd_soc_codec *codec,
return ret;
}
static void msm_adsp_power_up_config_work(struct work_struct *work)
{
struct msm_asoc_mach_data *pdata;
struct snd_soc_codec *codec;
struct snd_card *card;
pdata = container_of(work, struct msm_asoc_mach_data,
adsp_power_up_work);
codec = pdata->codec;
card = codec->component.card->snd_card;
msm_adsp_power_up_config(codec, card);
}
static int sm8150_notifier_service_cb(struct notifier_block *this,
unsigned long opcode, void *ptr)
{
@ -3886,6 +3901,7 @@ static int sm8150_notifier_service_cb(struct notifier_block *this,
const char *be_dl_name = LPASS_BE_SLIMBUS_0_RX;
struct snd_soc_pcm_runtime *rtd;
struct snd_soc_codec *codec;
struct msm_asoc_mach_data *pdata;
pr_debug("%s: Service opcode 0x%lx\n", __func__, opcode);
@ -3920,13 +3936,9 @@ static int sm8150_notifier_service_cb(struct notifier_block *this,
}
codec = rtd->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",
__func__, ret);
goto err;
}
pdata = snd_soc_card_get_drvdata(card);
pdata->codec = codec;
schedule_work(&pdata->adsp_power_up_work);
break;
default:
break;
@ -7414,6 +7426,8 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "Sound card %s registered\n", card->name);
spdev = pdev;
INIT_WORK(&pdata->adsp_power_up_work, msm_adsp_power_up_config_work);
ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
if (ret) {
dev_dbg(&pdev->dev, "%s: failed to add child nodes, ret=%d\n",