From 9f408076d4ab63ee15f4ad1f4e3c0d16c93e3b28 Mon Sep 17 00:00:00 2001 From: Bhalchandra Gajare Date: Mon, 15 May 2017 19:14:49 -0700 Subject: [PATCH] ASoc: wcd934x-dsp-cntl: notify online event after clocks are disabled The moment the online event is notified to userspace, it may happen that the userspace might enable the WDSP. This causes race between the enabling of WDSP and SSR handling of WDSP. Change the sequence to notify online event after all SSR handling is completed. Change-Id: I3cb5d40034884cdfc35de957fab4dafd42d0697c Signed-off-by: Bhalchandra Gajare --- sound/soc/codecs/wcd934x/wcd934x-dsp-cntl.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/wcd934x/wcd934x-dsp-cntl.c b/sound/soc/codecs/wcd934x/wcd934x-dsp-cntl.c index e791bf07ec67..29c218013a07 100644 --- a/sound/soc/codecs/wcd934x/wcd934x-dsp-cntl.c +++ b/sound/soc/codecs/wcd934x/wcd934x-dsp-cntl.c @@ -763,10 +763,6 @@ static int wcd_control_handler(struct device *dev, void *priv_data, case WDSP_EVENT_DLOAD_FAILED: case WDSP_EVENT_POST_SHUTDOWN: - if (event == WDSP_EVENT_POST_DLOAD_CODE) - /* Mark DSP online since code download is complete */ - wcd_cntl_change_online_state(cntl, 1); - /* Disable CPAR */ wcd_cntl_cpar_ctrl(cntl, false); /* Disable all the clocks */ @@ -775,6 +771,11 @@ static int wcd_control_handler(struct device *dev, void *priv_data, dev_err(codec->dev, "%s: Failed to disable clocks, err = %d\n", __func__, ret); + + if (event == WDSP_EVENT_POST_DLOAD_CODE) + /* Mark DSP online since code download is complete */ + wcd_cntl_change_online_state(cntl, 1); + break; case WDSP_EVENT_PRE_DLOAD_DATA: