alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC/SoundWire: fix timeout values
@ 2021-01-15  6:16 Bard Liao
  2021-01-15  6:16 ` [PATCH 1/2] ASoC: codecs: soundwire: increase resume timeout Bard Liao
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Bard Liao @ 2021-01-15  6:16 UTC (permalink / raw)
  To: alsa-devel, vkoul
  Cc: pierre-louis.bossart, vinod.koul, tiwai, gregkh, linux-kernel,
	ranjani.sridharan, hui.wang, broonie, srinivas.kandagatla, jank,
	sanyog.r.kale, rander.wang, bard.liao

The timeout for an individual transaction w/ the Cadence IP is the same as
the entire resume operation for codecs.
This doesn't make sense, we need to have at least one order of magnitude
between individual transactions and the entire resume operation.

Set the timeout on the Cadence side to 500ms and 5s for the codec resume.

Both ASoC and SoundWire trees are fine for this series.

Pierre-Louis Bossart (2):
  ASoC: codecs: soundwire: increase resume timeout
  soundwire: cadence: reduce timeout on transactions

 drivers/soundwire/cadence_master.c | 2 +-
 sound/soc/codecs/max98373-sdw.c    | 4 +++-
 sound/soc/codecs/rt1308-sdw.c      | 2 +-
 sound/soc/codecs/rt5682.h          | 2 +-
 sound/soc/codecs/rt700-sdw.c       | 2 +-
 sound/soc/codecs/rt711-sdw.c       | 2 +-
 sound/soc/codecs/rt715-sdw.c       | 2 +-
 7 files changed, 9 insertions(+), 7 deletions(-)

-- 
2.17.1


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

* [PATCH 1/2] ASoC: codecs: soundwire: increase resume timeout
  2021-01-15  6:16 [PATCH 0/2] ASoC/SoundWire: fix timeout values Bard Liao
@ 2021-01-15  6:16 ` Bard Liao
  2021-01-15  6:16 ` [PATCH 2/2] soundwire: cadence: reduce timeout on transactions Bard Liao
  2021-01-15 18:18 ` (subset) [PATCH 0/2] ASoC/SoundWire: fix timeout values Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Bard Liao @ 2021-01-15  6:16 UTC (permalink / raw)
  To: alsa-devel, vkoul
  Cc: pierre-louis.bossart, vinod.koul, tiwai, gregkh, linux-kernel,
	ranjani.sridharan, hui.wang, broonie, srinivas.kandagatla, jank,
	sanyog.r.kale, rander.wang, bard.liao

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

The resume operation relies on multiple transactions to synchronize
the regmap state, make sure the timeout is one order of magnitude
larger than an individual transaction, so that timeouts of failed
transactions are detected first.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 sound/soc/codecs/max98373-sdw.c | 4 +++-
 sound/soc/codecs/rt1308-sdw.c   | 2 +-
 sound/soc/codecs/rt5682.h       | 2 +-
 sound/soc/codecs/rt700-sdw.c    | 2 +-
 sound/soc/codecs/rt711-sdw.c    | 2 +-
 sound/soc/codecs/rt715-sdw.c    | 2 +-
 6 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/max98373-sdw.c b/sound/soc/codecs/max98373-sdw.c
index ec2e79c57357..ad2d5d6a2fe4 100644
--- a/sound/soc/codecs/max98373-sdw.c
+++ b/sound/soc/codecs/max98373-sdw.c
@@ -251,6 +251,8 @@ static __maybe_unused int max98373_suspend(struct device *dev)
 	return 0;
 }
 
+#define MAX98373_PROBE_TIMEOUT 5000
+
 static __maybe_unused int max98373_resume(struct device *dev)
 {
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
@@ -264,7 +266,7 @@ static __maybe_unused int max98373_resume(struct device *dev)
 		goto regmap_sync;
 
 	time = wait_for_completion_timeout(&slave->initialization_complete,
-					   msecs_to_jiffies(2000));
+					   msecs_to_jiffies(MAX98373_PROBE_TIMEOUT));
 	if (!time) {
 		dev_err(dev, "Initialization not complete, timed out\n");
 		return -ETIMEDOUT;
diff --git a/sound/soc/codecs/rt1308-sdw.c b/sound/soc/codecs/rt1308-sdw.c
index ec5564f780e8..afd2c3b687cc 100644
--- a/sound/soc/codecs/rt1308-sdw.c
+++ b/sound/soc/codecs/rt1308-sdw.c
@@ -701,7 +701,7 @@ static int __maybe_unused rt1308_dev_suspend(struct device *dev)
 	return 0;
 }
 
-#define RT1308_PROBE_TIMEOUT 2000
+#define RT1308_PROBE_TIMEOUT 5000
 
 static int __maybe_unused rt1308_dev_resume(struct device *dev)
 {
diff --git a/sound/soc/codecs/rt5682.h b/sound/soc/codecs/rt5682.h
index 99b85cfe6248..1f9c51a5b9bf 100644
--- a/sound/soc/codecs/rt5682.h
+++ b/sound/soc/codecs/rt5682.h
@@ -1356,7 +1356,7 @@
 #define RT5682_SAR_SOUR_TYPE			(0x0)
 
 /* soundwire timeout */
-#define RT5682_PROBE_TIMEOUT			2000
+#define RT5682_PROBE_TIMEOUT			5000
 
 
 #define RT5682_STEREO_RATES SNDRV_PCM_RATE_8000_192000
diff --git a/sound/soc/codecs/rt700-sdw.c b/sound/soc/codecs/rt700-sdw.c
index fb77e77a4ebd..ce9255b881d4 100644
--- a/sound/soc/codecs/rt700-sdw.c
+++ b/sound/soc/codecs/rt700-sdw.c
@@ -490,7 +490,7 @@ static int __maybe_unused rt700_dev_suspend(struct device *dev)
 	return 0;
 }
 
-#define RT700_PROBE_TIMEOUT 2000
+#define RT700_PROBE_TIMEOUT 5000
 
 static int __maybe_unused rt700_dev_resume(struct device *dev)
 {
diff --git a/sound/soc/codecs/rt711-sdw.c b/sound/soc/codecs/rt711-sdw.c
index fc7df79c3b91..756c0ada3b31 100644
--- a/sound/soc/codecs/rt711-sdw.c
+++ b/sound/soc/codecs/rt711-sdw.c
@@ -493,7 +493,7 @@ static int __maybe_unused rt711_dev_suspend(struct device *dev)
 	return 0;
 }
 
-#define RT711_PROBE_TIMEOUT 2000
+#define RT711_PROBE_TIMEOUT 5000
 
 static int __maybe_unused rt711_dev_resume(struct device *dev)
 {
diff --git a/sound/soc/codecs/rt715-sdw.c b/sound/soc/codecs/rt715-sdw.c
index 8f0aa1e8a273..71dd3b97a459 100644
--- a/sound/soc/codecs/rt715-sdw.c
+++ b/sound/soc/codecs/rt715-sdw.c
@@ -533,7 +533,7 @@ static int __maybe_unused rt715_dev_suspend(struct device *dev)
 	return 0;
 }
 
-#define RT715_PROBE_TIMEOUT 2000
+#define RT715_PROBE_TIMEOUT 5000
 
 static int __maybe_unused rt715_dev_resume(struct device *dev)
 {
-- 
2.17.1


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

* [PATCH 2/2] soundwire: cadence: reduce timeout on transactions
  2021-01-15  6:16 [PATCH 0/2] ASoC/SoundWire: fix timeout values Bard Liao
  2021-01-15  6:16 ` [PATCH 1/2] ASoC: codecs: soundwire: increase resume timeout Bard Liao
@ 2021-01-15  6:16 ` Bard Liao
  2021-01-19 14:52   ` Vinod Koul
  2021-01-15 18:18 ` (subset) [PATCH 0/2] ASoC/SoundWire: fix timeout values Mark Brown
  2 siblings, 1 reply; 5+ messages in thread
From: Bard Liao @ 2021-01-15  6:16 UTC (permalink / raw)
  To: alsa-devel, vkoul
  Cc: pierre-louis.bossart, vinod.koul, tiwai, gregkh, linux-kernel,
	ranjani.sridharan, hui.wang, broonie, srinivas.kandagatla, jank,
	sanyog.r.kale, rander.wang, bard.liao

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

Currently the timeout for SoundWire individual transactions is 2s.

This is too large in comparison with the enumeration and completion
timeouts used in codec drivers.

A command will typically be handled in less than 100us, so 500ms for
the command completion is more than generous.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/cadence_master.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c
index 9fa55164354a..f0b0ec173f8b 100644
--- a/drivers/soundwire/cadence_master.c
+++ b/drivers/soundwire/cadence_master.c
@@ -188,7 +188,7 @@ MODULE_PARM_DESC(cdns_mcp_int_mask, "Cadence MCP IntMask");
 #define CDNS_PDI_CONFIG_PORT			GENMASK(4, 0)
 
 /* Driver defaults */
-#define CDNS_TX_TIMEOUT				2000
+#define CDNS_TX_TIMEOUT				500
 
 #define CDNS_SCP_RX_FIFOLEVEL			0x2
 
-- 
2.17.1


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

* Re: (subset) [PATCH 0/2] ASoC/SoundWire: fix timeout values
  2021-01-15  6:16 [PATCH 0/2] ASoC/SoundWire: fix timeout values Bard Liao
  2021-01-15  6:16 ` [PATCH 1/2] ASoC: codecs: soundwire: increase resume timeout Bard Liao
  2021-01-15  6:16 ` [PATCH 2/2] soundwire: cadence: reduce timeout on transactions Bard Liao
@ 2021-01-15 18:18 ` Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2021-01-15 18:18 UTC (permalink / raw)
  To: alsa-devel, Bard Liao, vkoul
  Cc: linux-kernel, vinod.koul, tiwai, gregkh, ranjani.sridharan,
	pierre-louis.bossart, hui.wang, srinivas.kandagatla, jank,
	sanyog.r.kale, rander.wang, bard.liao

On Fri, 15 Jan 2021 14:16:49 +0800, Bard Liao wrote:
> The timeout for an individual transaction w/ the Cadence IP is the same as
> the entire resume operation for codecs.
> This doesn't make sense, we need to have at least one order of magnitude
> between individual transactions and the entire resume operation.
> 
> Set the timeout on the Cadence side to 500ms and 5s for the codec resume.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: codecs: soundwire: increase resume timeout
      commit: 7ef8c9edc86cff0881b2eb9a3274796258fbd872

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

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

* Re: [PATCH 2/2] soundwire: cadence: reduce timeout on transactions
  2021-01-15  6:16 ` [PATCH 2/2] soundwire: cadence: reduce timeout on transactions Bard Liao
@ 2021-01-19 14:52   ` Vinod Koul
  0 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2021-01-19 14:52 UTC (permalink / raw)
  To: Bard Liao
  Cc: pierre-louis.bossart, alsa-devel, tiwai, gregkh, linux-kernel,
	ranjani.sridharan, hui.wang, broonie, srinivas.kandagatla, jank,
	sanyog.r.kale, rander.wang, bard.liao

On 15-01-21, 14:16, Bard Liao wrote:
> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> 
> Currently the timeout for SoundWire individual transactions is 2s.
> 
> This is too large in comparison with the enumeration and completion
> timeouts used in codec drivers.
> 
> A command will typically be handled in less than 100us, so 500ms for
> the command completion is more than generous.

Applied, thanks

-- 
~Vinod

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

end of thread, other threads:[~2021-01-19 14:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-15  6:16 [PATCH 0/2] ASoC/SoundWire: fix timeout values Bard Liao
2021-01-15  6:16 ` [PATCH 1/2] ASoC: codecs: soundwire: increase resume timeout Bard Liao
2021-01-15  6:16 ` [PATCH 2/2] soundwire: cadence: reduce timeout on transactions Bard Liao
2021-01-19 14:52   ` Vinod Koul
2021-01-15 18:18 ` (subset) [PATCH 0/2] ASoC/SoundWire: fix timeout values Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).