]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
soundwire: cadence: only prepare attached devices on clock stop
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tue, 23 Mar 2021 01:37:07 +0000 (09:37 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 May 2021 06:39:36 +0000 (08:39 +0200)
[ Upstream commit 58ef9356260c291a4321e07ff507f31a1d8212af ]

We sometimes see COMMAND_IGNORED responses during the clock stop
sequence. It turns out we already have information if devices are
present on a link, so we should only prepare those when they
are attached.

In addition, even when COMMAND_IGNORED are received, we should still
proceed with the clock stop. The device will not be prepared but
that's not a problem.

The only case where the clock stop will fail is if the Cadence IP
reports an error (including a timeout), or if the devices throw a
COMMAND_FAILED response.

BugLink: https://github.com/thesofproject/linux/issues/2621
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20210323013707.21455-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/soundwire/cadence_master.c

index d05442e646a38317c125ef5e9bf5606deff1c130..57c59a33ce61647b07d33bf35d75f7cbd414ec7f 100644 (file)
@@ -1450,10 +1450,12 @@ int sdw_cdns_clock_stop(struct sdw_cdns *cdns, bool block_wake)
        }
 
        /* Prepare slaves for clock stop */
-       ret = sdw_bus_prep_clk_stop(&cdns->bus);
-       if (ret < 0) {
-               dev_err(cdns->dev, "prepare clock stop failed %d", ret);
-               return ret;
+       if (slave_present) {
+               ret = sdw_bus_prep_clk_stop(&cdns->bus);
+               if (ret < 0 && ret != -ENODATA) {
+                       dev_err(cdns->dev, "prepare clock stop failed %d\n", ret);
+                       return ret;
+               }
        }
 
        /*