From db0cc84eb7bcb5066684a45d1a49a3045495f990 Mon Sep 17 00:00:00 2001 From: Sudheer Papothi Date: Sat, 20 Jun 2020 20:56:41 +0530 Subject: [PATCH] soc: soundwire: Enable audio core voting Audio core vote enables soundwire master and establishes soundwire link without which soundwire master will not power up. This change votes for audio core during soundwire runtime resume and unvotes during soundwire runtime suspend. Change-Id: I3ca283be42670a56102c4f08c0f207ae9dc4e5c3 Signed-off-by: Sudheer Papothi --- soc/swr-mstr-ctrl.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/soc/swr-mstr-ctrl.c b/soc/swr-mstr-ctrl.c index 0207a9e3fcde..540608dad486 100644 --- a/soc/swr-mstr-ctrl.c +++ b/soc/swr-mstr-ctrl.c @@ -2672,6 +2672,8 @@ static int swrm_probe(struct platform_device *pdev) * controller will be up now */ swr_master_add_boarddevices(&swrm->master); + if (swrm_request_hw_vote(swrm, LPASS_AUDIO_CORE, true)) + dev_dbg(&pdev->dev, "%s: Audio HW Vote is failed\n", __func__); mutex_lock(&swrm->mlock); swrm_clk_request(swrm, true); swrm->version = swr_master_read(swrm, SWRM_COMP_HW_VERSION); @@ -2812,7 +2814,6 @@ static int swrm_runtime_resume(struct device *dev) int ret = 0; bool swrm_clk_req_err = false; bool hw_core_err = false; - bool aud_core_err = false; struct swr_master *mstr = &swrm->master; struct swr_device *swr_dev; u32 temp = 0; @@ -2828,11 +2829,9 @@ static int swrm_runtime_resume(struct device *dev) __func__); hw_core_err = true; } - if (swrm_request_hw_vote(swrm, LPASS_AUDIO_CORE, true)) { + if (swrm_request_hw_vote(swrm, LPASS_AUDIO_CORE, true)) dev_err(dev, "%s:lpass audio hw enable failed\n", __func__); - aud_core_err = true; - } if ((swrm->state == SWR_MSTR_DOWN) || (swrm->state == SWR_MSTR_SSR && swrm->dev_up)) { @@ -2923,8 +2922,6 @@ static int swrm_runtime_resume(struct device *dev) swrm->state = SWR_MSTR_UP; } exit: - if (!aud_core_err) - swrm_request_hw_vote(swrm, LPASS_AUDIO_CORE, false); if (!hw_core_err) swrm_request_hw_vote(swrm, LPASS_HW_CORE, false); if (swrm_clk_req_err) @@ -2948,7 +2945,6 @@ static int swrm_runtime_suspend(struct device *dev) struct swr_mstr_ctrl *swrm = platform_get_drvdata(pdev); int ret = 0; bool hw_core_err = false; - bool aud_core_err = false; struct swr_master *mstr = &swrm->master; struct swr_device *swr_dev; int current_state = 0; @@ -2967,11 +2963,6 @@ static int swrm_runtime_suspend(struct device *dev) __func__); hw_core_err = true; } - if (swrm_request_hw_vote(swrm, LPASS_AUDIO_CORE, true)) { - dev_err(dev, "%s:lpass audio hw enable failed\n", - __func__); - aud_core_err = true; - } if ((current_state == SWR_MSTR_UP) || (current_state == SWR_MSTR_SSR)) { @@ -3049,12 +3040,14 @@ static int swrm_runtime_suspend(struct device *dev) } } + if (swrm_request_hw_vote(swrm, LPASS_AUDIO_CORE, false)) + dev_dbg(dev, "%s:lpass audio hw enable failed\n", + __func__); + /* Retain SSR state until resume */ if (current_state != SWR_MSTR_SSR) swrm->state = SWR_MSTR_DOWN; exit: - if (!aud_core_err) - swrm_request_hw_vote(swrm, LPASS_AUDIO_CORE, false); if (!hw_core_err) swrm_request_hw_vote(swrm, LPASS_HW_CORE, false); mutex_unlock(&swrm->reslock);