soundwire: cadence: handle error cases with CONFIG_UPDATE
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tue, 17 Mar 2020 16:33:16 +0000 (11:33 -0500)
committerVinod Koul <vkoul@kernel.org>
Thu, 19 Mar 2020 07:13:03 +0000 (12:43 +0530)
config_update() may time out or cannot be use in ClockStopMode

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200317163329.25501-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/cadence_master.c

index 1bfdc1d..d7f01d3 100644 (file)
@@ -239,6 +239,11 @@ static int cdns_config_update(struct sdw_cdns *cdns)
 {
        int ret;
 
+       if (sdw_cdns_is_clock_stop(cdns)) {
+               dev_err(cdns->dev, "Cannot program MCP_CONFIG_UPDATE in ClockStopMode\n");
+               return -EINVAL;
+       }
+
        ret = cdns_clear_bit(cdns, CDNS_MCP_CONFIG_UPDATE,
                             CDNS_MCP_CONFIG_UPDATE_BIT);
        if (ret < 0)