diff --git a/soc/swr-mstr-ctrl.c b/soc/swr-mstr-ctrl.c index 598b269834a7..edc772dd12e2 100644 --- a/soc/swr-mstr-ctrl.c +++ b/soc/swr-mstr-ctrl.c @@ -3074,9 +3074,18 @@ int swrm_wcd_notify(struct platform_device *pdev, u32 id, void *data) * next activity on soundwire will request clock from new clock * source. */ + if (!data) { + dev_err(swrm->dev, "%s: data is NULL for id:%d\n", + __func__, id); + ret = -EINVAL; + break; + } mutex_lock(&swrm->mlock); - if (swrm->state == SWR_MSTR_UP) - swrm_device_suspend(&pdev->dev); + if (swrm->clk_src != *(int *)data) { + if (swrm->state == SWR_MSTR_UP) + swrm_device_suspend(&pdev->dev); + swrm->clk_src = *(int *)data; + } mutex_unlock(&swrm->mlock); break; case SWR_CLK_FREQ: diff --git a/soc/swr-mstr-ctrl.h b/soc/swr-mstr-ctrl.h index 1987e0fdffd1..c404fc6f9664 100644 --- a/soc/swr-mstr-ctrl.h +++ b/soc/swr-mstr-ctrl.h @@ -178,6 +178,7 @@ struct swr_mstr_ctrl { u32 swr_irq_wakeup_capable; int hw_core_clk_en; int aud_core_clk_en; + int clk_src; #ifdef CONFIG_DEBUG_FS struct dentry *debugfs_swrm_dent; struct dentry *debugfs_peek;