All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soundwire: cadence: only prepare attached devices on clock stop
@ 2021-03-23  1:37 ` Bard Liao
  0 siblings, 0 replies; 4+ messages in thread
From: Bard Liao @ 2021-03-23  1:37 UTC (permalink / raw)
  To: alsa-devel, vkoul
  Cc: vinod.koul, linux-kernel, gregkh, srinivas.kandagatla,
	rander.wang, hui.wang, pierre-louis.bossart, sanyog.r.kale,
	bard.liao

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

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>
---
 drivers/soundwire/cadence_master.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c
index d05442e646a3..57c59a33ce61 100644
--- a/drivers/soundwire/cadence_master.c
+++ b/drivers/soundwire/cadence_master.c
@@ -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;
+		}
 	}
 
 	/*
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] soundwire: cadence: only prepare attached devices on clock stop
@ 2021-03-23  1:37 ` Bard Liao
  0 siblings, 0 replies; 4+ messages in thread
From: Bard Liao @ 2021-03-23  1:37 UTC (permalink / raw)
  To: alsa-devel, vkoul
  Cc: vinod.koul, gregkh, linux-kernel, pierre-louis.bossart, hui.wang,
	srinivas.kandagatla, sanyog.r.kale, rander.wang, bard.liao

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

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>
---
 drivers/soundwire/cadence_master.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c
index d05442e646a3..57c59a33ce61 100644
--- a/drivers/soundwire/cadence_master.c
+++ b/drivers/soundwire/cadence_master.c
@@ -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;
+		}
 	}
 
 	/*
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] soundwire: cadence: only prepare attached devices on clock stop
  2021-03-23  1:37 ` Bard Liao
@ 2021-03-30  9:06   ` Vinod Koul
  -1 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2021-03-30  9:06 UTC (permalink / raw)
  To: Bard Liao
  Cc: alsa-devel, linux-kernel, gregkh, srinivas.kandagatla,
	rander.wang, hui.wang, pierre-louis.bossart, sanyog.r.kale,
	bard.liao

On 23-03-21, 09:37, Bard Liao wrote:
> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> 
> 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.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] soundwire: cadence: only prepare attached devices on clock stop
@ 2021-03-30  9:06   ` Vinod Koul
  0 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2021-03-30  9:06 UTC (permalink / raw)
  To: Bard Liao
  Cc: alsa-devel, gregkh, linux-kernel, pierre-louis.bossart, hui.wang,
	sanyog.r.kale, rander.wang, bard.liao

On 23-03-21, 09:37, Bard Liao wrote:
> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> 
> 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.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-30  9:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23  1:37 [PATCH] soundwire: cadence: only prepare attached devices on clock stop Bard Liao
2021-03-23  1:37 ` Bard Liao
2021-03-30  9:06 ` Vinod Koul
2021-03-30  9:06   ` Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.