Skip to contentSkip to conversation

soundwire: cadence: only prepare attached devices on clock stop

PATCH Applied Bard Liao 2 participants 2 messages Mar 23, 2021 – Mar 30, 2021 SoundWire

lore
Share & tools
lore

Bard Liao

author maintainer
#0 lore raw

PATCH 1/1 soundwire: cadence: only prepare attached devices on clock stop

From: Pierre-Louis Bossart <[email protected]>

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.

---
 drivers/soundwire/cadence_master.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/soundwire/cadence_master.c +6 -4
index d05442e646a3..57c59a33ce61 100644
@@ -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;
+		}
 	}
 
 	/*
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 7 lines · Bard Liao

From: Pierre-Louis Bossart <[email protected]>

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.

Quoted 7 lines

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.

Applied, thanks

Signature · 1 line
~Vinod