All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/15] ASoC: fixes for SoundWire codec drivers
@ 2021-06-07 22:22 Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 01/15] ASoC: max98373-sdw: add missing memory allocation check Pierre-Louis Bossart
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: Pierre-Louis Bossart @ 2021-06-07 22:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: Oder Chiou, Jack Yu, Ryan Lee, tiwai, Pierre-Louis Bossart,
	broonie, Shuming Fan, Bard liao

The SOF CI exposed a set of issues with suspend/resume, error
handling, register access and mixer values.

These fixes were indentified with a tag so that they can be applied by
linux-stable and distributions. Thanks to the Realtek and Maxim teams
for their help.

Bard Liao (3):
  ASoC: rt5682-sdw: set regcache_cache_only false before reading
    RT5682_DEVICE_ID
  ASoC: rt711-sdca-sdw: add readable for SDW_SDCA_CTL() registers
  ASoC: rt711-sdca: handle mbq_regmap in rt711_sdca_io_init

Jack Yu (1):
  ASoC: rt715-sdca: fix clock stop prepare timeout issue

Oder Chiou (1):
  ASoC: rt5682: Fix a problem with error handling in the io init
    function of the soundwire

Pierre-Louis Bossart (10):
  ASoC: max98373-sdw: add missing memory allocation check
  ASoC: max98373-sdw: use first_hw_init flag on resume
  ASoC: rt1308-sdw: use first_hw_init flag on resume
  ASoC: rt1316-sdw: use first_hw_init flag on resume
  ASoC: rt5682-sdw: use first_hw_init flag on resume
  ASoC: rt700-sdw: use first_hw_init flag on resume
  ASoC: rt711-sdca-sdw: use first_hw_init flag on resume
  ASoC: rt711-sdw: use first_hw_init flag on resume
  ASoC: rt715-sdca-sdw: use first_hw_init flag on resume
  ASoC: rt715-sdw: use first_hw_init flag on resume

 sound/soc/codecs/max98373-sdw.c   | 14 ++++++++------
 sound/soc/codecs/max98373.h       |  2 +-
 sound/soc/codecs/rt1308-sdw.c     |  2 +-
 sound/soc/codecs/rt1316-sdw.c     |  2 +-
 sound/soc/codecs/rt5682-sdw.c     | 19 +++++++++++--------
 sound/soc/codecs/rt700-sdw.c      |  2 +-
 sound/soc/codecs/rt711-sdca-sdw.c | 12 +++++++++++-
 sound/soc/codecs/rt711-sdca.c     |  4 ++++
 sound/soc/codecs/rt711-sdw.c      |  2 +-
 sound/soc/codecs/rt715-sdca-sdw.c |  3 ++-
 sound/soc/codecs/rt715-sdca-sdw.h |  1 +
 sound/soc/codecs/rt715-sdca.c     |  9 ++++++---
 sound/soc/codecs/rt715-sdca.h     |  3 ++-
 sound/soc/codecs/rt715-sdw.c      |  2 +-
 14 files changed, 51 insertions(+), 26 deletions(-)

-- 
2.25.1


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

* [PATCH 01/15] ASoC: max98373-sdw: add missing memory allocation check
  2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
@ 2021-06-07 22:22 ` Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 02/15] ASoC: max98373-sdw: use first_hw_init flag on resume Pierre-Louis Bossart
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Pierre-Louis Bossart @ 2021-06-07 22:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: Oder Chiou, Jack Yu, Ryan Lee, Guennadi Liakhovetski, tiwai,
	Pierre-Louis Bossart, broonie, Shuming Fan, Bard liao, Bard Liao

We forgot to test that devm_kcalloc doesn't return NULL.

Fixes: 349dd23931d1 ('ASoC: max98373: don't access volatile registers in bias level off')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
---
 sound/soc/codecs/max98373-sdw.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/codecs/max98373-sdw.c b/sound/soc/codecs/max98373-sdw.c
index f3a12205cd48..c7a3506046db 100644
--- a/sound/soc/codecs/max98373-sdw.c
+++ b/sound/soc/codecs/max98373-sdw.c
@@ -787,6 +787,8 @@ static int max98373_init(struct sdw_slave *slave, struct regmap *regmap)
 	max98373->cache = devm_kcalloc(dev, max98373->cache_num,
 				       sizeof(*max98373->cache),
 				       GFP_KERNEL);
+	if (!max98373->cache)
+		return -ENOMEM;
 
 	for (i = 0; i < max98373->cache_num; i++)
 		max98373->cache[i].reg = max98373_sdw_cache_reg[i];
-- 
2.25.1


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

* [PATCH 02/15] ASoC: max98373-sdw: use first_hw_init flag on resume
  2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 01/15] ASoC: max98373-sdw: add missing memory allocation check Pierre-Louis Bossart
@ 2021-06-07 22:22 ` Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 03/15] ASoC: rt1308-sdw: " Pierre-Louis Bossart
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Pierre-Louis Bossart @ 2021-06-07 22:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: Oder Chiou, Jack Yu, Ryan Lee, Guennadi Liakhovetski, tiwai,
	Pierre-Louis Bossart, broonie, Shuming Fan, Bard liao, Bard Liao

The intent of the status check on resume was to verify if a SoundWire
peripheral reported ATTACHED before waiting for the initialization to
complete. This is required to avoid timeouts that will happen with
'ghost' devices that are exposed in the platform firmware but are not
populated in hardware.

Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to
another error, the resume operation never timed out, but the volume
settings were not properly restored.

This patch renames the status flag to 'first_hw_init' for consistency
with other drivers.

BugLink: https://github.com/thesofproject/linux/issues/2637
Fixes: 56a5b7910e96 ('ASoC: codecs: max98373: add SoundWire support')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
---
 sound/soc/codecs/max98373-sdw.c | 12 ++++++------
 sound/soc/codecs/max98373.h     |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/max98373-sdw.c b/sound/soc/codecs/max98373-sdw.c
index c7a3506046db..dc520effc61c 100644
--- a/sound/soc/codecs/max98373-sdw.c
+++ b/sound/soc/codecs/max98373-sdw.c
@@ -271,7 +271,7 @@ static __maybe_unused int max98373_resume(struct device *dev)
 	struct max98373_priv *max98373 = dev_get_drvdata(dev);
 	unsigned long time;
 
-	if (!max98373->hw_init)
+	if (!max98373->first_hw_init)
 		return 0;
 
 	if (!slave->unattach_request)
@@ -362,7 +362,7 @@ static int max98373_io_init(struct sdw_slave *slave)
 	struct device *dev = &slave->dev;
 	struct max98373_priv *max98373 = dev_get_drvdata(dev);
 
-	if (max98373->pm_init_once) {
+	if (max98373->first_hw_init) {
 		regcache_cache_only(max98373->regmap, false);
 		regcache_cache_bypass(max98373->regmap, true);
 	}
@@ -370,7 +370,7 @@ static int max98373_io_init(struct sdw_slave *slave)
 	/*
 	 * PM runtime is only enabled when a Slave reports as Attached
 	 */
-	if (!max98373->pm_init_once) {
+	if (!max98373->first_hw_init) {
 		/* set autosuspend parameters */
 		pm_runtime_set_autosuspend_delay(dev, 3000);
 		pm_runtime_use_autosuspend(dev);
@@ -462,12 +462,12 @@ static int max98373_io_init(struct sdw_slave *slave)
 	regmap_write(max98373->regmap, MAX98373_R20B5_BDE_EN, 1);
 	regmap_write(max98373->regmap, MAX98373_R20E2_LIMITER_EN, 1);
 
-	if (max98373->pm_init_once) {
+	if (max98373->first_hw_init) {
 		regcache_cache_bypass(max98373->regmap, false);
 		regcache_mark_dirty(max98373->regmap);
 	}
 
-	max98373->pm_init_once = true;
+	max98373->first_hw_init = true;
 	max98373->hw_init = true;
 
 	pm_runtime_mark_last_busy(dev);
@@ -797,7 +797,7 @@ static int max98373_init(struct sdw_slave *slave, struct regmap *regmap)
 	max98373_slot_config(dev, max98373);
 
 	max98373->hw_init = false;
-	max98373->pm_init_once = false;
+	max98373->first_hw_init = false;
 
 	/* codec registration  */
 	ret = devm_snd_soc_register_component(dev, &soc_codec_dev_max98373_sdw,
diff --git a/sound/soc/codecs/max98373.h b/sound/soc/codecs/max98373.h
index 73a2cf69d84a..e1810b3b1620 100644
--- a/sound/soc/codecs/max98373.h
+++ b/sound/soc/codecs/max98373.h
@@ -226,7 +226,7 @@ struct max98373_priv {
 	/* variables to support soundwire */
 	struct sdw_slave *slave;
 	bool hw_init;
-	bool pm_init_once;
+	bool first_hw_init;
 	int slot;
 	unsigned int rx_mask;
 };
-- 
2.25.1


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

* [PATCH 03/15] ASoC: rt1308-sdw: use first_hw_init flag on resume
  2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 01/15] ASoC: max98373-sdw: add missing memory allocation check Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 02/15] ASoC: max98373-sdw: use first_hw_init flag on resume Pierre-Louis Bossart
@ 2021-06-07 22:22 ` Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 04/15] ASoC: rt1316-sdw: " Pierre-Louis Bossart
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Pierre-Louis Bossart @ 2021-06-07 22:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: Oder Chiou, Jack Yu, Ryan Lee, Guennadi Liakhovetski, tiwai,
	Pierre-Louis Bossart, broonie, Shuming Fan, Bard liao, Bard Liao

The intent of the status check on resume was to verify if a SoundWire
peripheral reported ATTACHED before waiting for the initialization to
complete. This is required to avoid timeouts that will happen with
'ghost' devices that are exposed in the platform firmware but are not
populated in hardware.

Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to
another error, the resume operation never timed out, but the volume
settings were not properly restored.

BugLink: https://github.com/thesofproject/linux/issues/2908
BugLink: https://github.com/thesofproject/linux/issues/2637
Fixes: a87a6653a28c0 ('ASoC: rt1308-sdw: add rt1308 SdW amplifier driver')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
---
 sound/soc/codecs/rt1308-sdw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt1308-sdw.c b/sound/soc/codecs/rt1308-sdw.c
index 1c226994aebd..f716668de640 100644
--- a/sound/soc/codecs/rt1308-sdw.c
+++ b/sound/soc/codecs/rt1308-sdw.c
@@ -709,7 +709,7 @@ static int __maybe_unused rt1308_dev_resume(struct device *dev)
 	struct rt1308_sdw_priv *rt1308 = dev_get_drvdata(dev);
 	unsigned long time;
 
-	if (!rt1308->hw_init)
+	if (!rt1308->first_hw_init)
 		return 0;
 
 	if (!slave->unattach_request)
-- 
2.25.1


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

* [PATCH 04/15] ASoC: rt1316-sdw: use first_hw_init flag on resume
  2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
                   ` (2 preceding siblings ...)
  2021-06-07 22:22 ` [PATCH 03/15] ASoC: rt1308-sdw: " Pierre-Louis Bossart
@ 2021-06-07 22:22 ` Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 05/15] ASoC: rt5682-sdw: " Pierre-Louis Bossart
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Pierre-Louis Bossart @ 2021-06-07 22:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: Oder Chiou, Jack Yu, Ryan Lee, Guennadi Liakhovetski, tiwai,
	Pierre-Louis Bossart, broonie, Shuming Fan, Bard liao, Bard Liao

The intent of the status check on resume was to verify if a SoundWire
peripheral reported ATTACHED before waiting for the initialization to
complete. This is required to avoid timeouts that will happen with
'ghost' devices that are exposed in the platform firmware but are not
populated in hardware.

Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to
another error, the resume operation never timed out, but the volume
settings were not properly restored.

BugLink: https://github.com/thesofproject/linux/issues/2908
BugLink: https://github.com/thesofproject/linux/issues/2637
Fixes: 2b719fd20f327 ('ASoC: rt1316: Add RT1316 SDCA vendor-specific driver')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
---
 sound/soc/codecs/rt1316-sdw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt1316-sdw.c b/sound/soc/codecs/rt1316-sdw.c
index 3b029c56467d..09b4914bba1b 100644
--- a/sound/soc/codecs/rt1316-sdw.c
+++ b/sound/soc/codecs/rt1316-sdw.c
@@ -701,7 +701,7 @@ static int __maybe_unused rt1316_dev_resume(struct device *dev)
 	struct rt1316_sdw_priv *rt1316 = dev_get_drvdata(dev);
 	unsigned long time;
 
-	if (!rt1316->hw_init)
+	if (!rt1316->first_hw_init)
 		return 0;
 
 	if (!slave->unattach_request)
-- 
2.25.1


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

* [PATCH 05/15] ASoC: rt5682-sdw: use first_hw_init flag on resume
  2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
                   ` (3 preceding siblings ...)
  2021-06-07 22:22 ` [PATCH 04/15] ASoC: rt1316-sdw: " Pierre-Louis Bossart
@ 2021-06-07 22:22 ` Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 06/15] ASoC: rt700-sdw: " Pierre-Louis Bossart
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Pierre-Louis Bossart @ 2021-06-07 22:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: Oder Chiou, Jack Yu, Ryan Lee, Guennadi Liakhovetski, tiwai,
	Pierre-Louis Bossart, broonie, Shuming Fan, Bard liao, Bard Liao

The intent of the status check on resume was to verify if a SoundWire
peripheral reported ATTACHED before waiting for the initialization to
complete. This is required to avoid timeouts that will happen with
'ghost' devices that are exposed in the platform firmware but are not
populated in hardware.

Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to
another error, the resume operation never timed out, but the volume
settings were not properly restored.

BugLink: https://github.com/thesofproject/linux/issues/2908
BugLink: https://github.com/thesofproject/linux/issues/2637
Fixes: 03f6fc6de9192 ('ASoC: rt5682: Add the soundwire support')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
---
 sound/soc/codecs/rt5682-sdw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt5682-sdw.c b/sound/soc/codecs/rt5682-sdw.c
index e78ba3b064c4..8e4bb9dd194e 100644
--- a/sound/soc/codecs/rt5682-sdw.c
+++ b/sound/soc/codecs/rt5682-sdw.c
@@ -743,7 +743,7 @@ static int __maybe_unused rt5682_dev_resume(struct device *dev)
 	struct rt5682_priv *rt5682 = dev_get_drvdata(dev);
 	unsigned long time;
 
-	if (!rt5682->hw_init)
+	if (!rt5682->first_hw_init)
 		return 0;
 
 	if (!slave->unattach_request)
-- 
2.25.1


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

* [PATCH 06/15] ASoC: rt700-sdw: use first_hw_init flag on resume
  2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
                   ` (4 preceding siblings ...)
  2021-06-07 22:22 ` [PATCH 05/15] ASoC: rt5682-sdw: " Pierre-Louis Bossart
@ 2021-06-07 22:22 ` Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 07/15] ASoC: rt711-sdca-sdw: " Pierre-Louis Bossart
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Pierre-Louis Bossart @ 2021-06-07 22:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: Oder Chiou, Jack Yu, Ryan Lee, Guennadi Liakhovetski, tiwai,
	Pierre-Louis Bossart, broonie, Shuming Fan, Bard liao, Bard Liao

The intent of the status check on resume was to verify if a SoundWire
peripheral reported ATTACHED before waiting for the initialization to
complete. This is required to avoid timeouts that will happen with
'ghost' devices that are exposed in the platform firmware but are not
populated in hardware.

Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to
another error, the resume operation never timed out, but the volume
settings were not properly restored.

BugLink: https://github.com/thesofproject/linux/issues/2908
BugLink: https://github.com/thesofproject/linux/issues/2637
Fixes: 7d2a5f9ae41e3 ('ASoC: rt700: add rt700 codec driver')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
---
 sound/soc/codecs/rt700-sdw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt700-sdw.c b/sound/soc/codecs/rt700-sdw.c
index ff9c081fd52a..d1d9c0f455b4 100644
--- a/sound/soc/codecs/rt700-sdw.c
+++ b/sound/soc/codecs/rt700-sdw.c
@@ -498,7 +498,7 @@ static int __maybe_unused rt700_dev_resume(struct device *dev)
 	struct rt700_priv *rt700 = dev_get_drvdata(dev);
 	unsigned long time;
 
-	if (!rt700->hw_init)
+	if (!rt700->first_hw_init)
 		return 0;
 
 	if (!slave->unattach_request)
-- 
2.25.1


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

* [PATCH 07/15] ASoC: rt711-sdca-sdw: use first_hw_init flag on resume
  2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
                   ` (5 preceding siblings ...)
  2021-06-07 22:22 ` [PATCH 06/15] ASoC: rt700-sdw: " Pierre-Louis Bossart
@ 2021-06-07 22:22 ` Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 08/15] ASoC: rt711-sdw: " Pierre-Louis Bossart
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Pierre-Louis Bossart @ 2021-06-07 22:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: Oder Chiou, Jack Yu, Ryan Lee, Guennadi Liakhovetski, tiwai,
	Pierre-Louis Bossart, broonie, Shuming Fan, Bard liao, Bard Liao

The intent of the status check on resume was to verify if a SoundWire
peripheral reported ATTACHED before waiting for the initialization to
complete. This is required to avoid timeouts that will happen with
'ghost' devices that are exposed in the platform firmware but are not
populated in hardware.

Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to
another error, the resume operation never timed out, but the volume
settings were not properly restored.

BugLink: https://github.com/thesofproject/linux/issues/2908
BugLink: https://github.com/thesofproject/linux/issues/2637
Fixes: 7ad4d237e7c4a ('ASoC: rt711-sdca: Add RT711 SDCA vendor-specific driver')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
---
 sound/soc/codecs/rt711-sdca-sdw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt711-sdca-sdw.c b/sound/soc/codecs/rt711-sdca-sdw.c
index 9685c8905468..b84e64233d96 100644
--- a/sound/soc/codecs/rt711-sdca-sdw.c
+++ b/sound/soc/codecs/rt711-sdca-sdw.c
@@ -380,7 +380,7 @@ static int __maybe_unused rt711_sdca_dev_resume(struct device *dev)
 	struct rt711_sdca_priv *rt711 = dev_get_drvdata(dev);
 	unsigned long time;
 
-	if (!rt711->hw_init)
+	if (!rt711->first_hw_init)
 		return 0;
 
 	if (!slave->unattach_request)
-- 
2.25.1


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

* [PATCH 08/15] ASoC: rt711-sdw: use first_hw_init flag on resume
  2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
                   ` (6 preceding siblings ...)
  2021-06-07 22:22 ` [PATCH 07/15] ASoC: rt711-sdca-sdw: " Pierre-Louis Bossart
@ 2021-06-07 22:22 ` Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 09/15] ASoC: rt715-sdca-sdw: " Pierre-Louis Bossart
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Pierre-Louis Bossart @ 2021-06-07 22:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: Oder Chiou, Jack Yu, Ryan Lee, Guennadi Liakhovetski, tiwai,
	Pierre-Louis Bossart, broonie, Shuming Fan, Bard liao, Bard Liao

The intent of the status check on resume was to verify if a SoundWire
peripheral reported ATTACHED before waiting for the initialization to
complete. This is required to avoid timeouts that will happen with
'ghost' devices that are exposed in the platform firmware but are not
populated in hardware.

Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to
another error, the resume operation never timed out, but the volume
settings were not properly restored.

BugLink: https://github.com/thesofproject/linux/issues/2908
BugLink: https://github.com/thesofproject/linux/issues/2637
Fixes: 320b8b0d13b81 ('ASoC: rt711: add rt711 codec driver')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
---
 sound/soc/codecs/rt711-sdw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt711-sdw.c b/sound/soc/codecs/rt711-sdw.c
index 8f5ebe92d407..15299084429f 100644
--- a/sound/soc/codecs/rt711-sdw.c
+++ b/sound/soc/codecs/rt711-sdw.c
@@ -501,7 +501,7 @@ static int __maybe_unused rt711_dev_resume(struct device *dev)
 	struct rt711_priv *rt711 = dev_get_drvdata(dev);
 	unsigned long time;
 
-	if (!rt711->hw_init)
+	if (!rt711->first_hw_init)
 		return 0;
 
 	if (!slave->unattach_request)
-- 
2.25.1


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

* [PATCH 09/15] ASoC: rt715-sdca-sdw: use first_hw_init flag on resume
  2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
                   ` (7 preceding siblings ...)
  2021-06-07 22:22 ` [PATCH 08/15] ASoC: rt711-sdw: " Pierre-Louis Bossart
@ 2021-06-07 22:22 ` Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 10/15] ASoC: rt715-sdw: " Pierre-Louis Bossart
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Pierre-Louis Bossart @ 2021-06-07 22:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: Oder Chiou, Jack Yu, Ryan Lee, Guennadi Liakhovetski, tiwai,
	Pierre-Louis Bossart, broonie, Shuming Fan, Bard liao, Bard Liao

The intent of the status check on resume was to verify if a SoundWire
peripheral reported ATTACHED before waiting for the initialization to
complete. This is required to avoid timeouts that will happen with
'ghost' devices that are exposed in the platform firmware but are not
populated in hardware.

Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to
another error, the resume operation never timed out, but the volume
settings were not properly restored.

This patch renames the status flag to 'first_hw_init' for consistency
with other drivers (was 'first_init')

BugLink: https://github.com/thesofproject/linux/issues/2908
BugLink: https://github.com/thesofproject/linux/issues/2637
Fixes: 20d17057f0a8c ('ASoC: rt715-sdca: Add RT715 sdca vendor-specific driver')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
---
 sound/soc/codecs/rt715-sdca-sdw.c | 2 +-
 sound/soc/codecs/rt715-sdca.c     | 6 +++---
 sound/soc/codecs/rt715-sdca.h     | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/rt715-sdca-sdw.c b/sound/soc/codecs/rt715-sdca-sdw.c
index 1350798406f0..7646bbe739f1 100644
--- a/sound/soc/codecs/rt715-sdca-sdw.c
+++ b/sound/soc/codecs/rt715-sdca-sdw.c
@@ -224,7 +224,7 @@ static int __maybe_unused rt715_dev_resume(struct device *dev)
 	struct rt715_sdca_priv *rt715 = dev_get_drvdata(dev);
 	unsigned long time;
 
-	if (!rt715->hw_init)
+	if (!rt715->first_hw_init)
 		return 0;
 
 	if (!slave->unattach_request)
diff --git a/sound/soc/codecs/rt715-sdca.c b/sound/soc/codecs/rt715-sdca.c
index 7db76c19e048..d82166f1a378 100644
--- a/sound/soc/codecs/rt715-sdca.c
+++ b/sound/soc/codecs/rt715-sdca.c
@@ -997,7 +997,7 @@ int rt715_sdca_init(struct device *dev, struct regmap *mbq_regmap,
 	 * HW init will be performed when device reports present
 	 */
 	rt715->hw_init = false;
-	rt715->first_init = false;
+	rt715->first_hw_init = false;
 
 	ret = devm_snd_soc_register_component(dev,
 			&soc_codec_dev_rt715_sdca,
@@ -1018,7 +1018,7 @@ int rt715_sdca_io_init(struct device *dev, struct sdw_slave *slave)
 	/*
 	 * PM runtime is only enabled when a Slave reports as Attached
 	 */
-	if (!rt715->first_init) {
+	if (!rt715->first_hw_init) {
 		/* set autosuspend parameters */
 		pm_runtime_set_autosuspend_delay(&slave->dev, 3000);
 		pm_runtime_use_autosuspend(&slave->dev);
@@ -1031,7 +1031,7 @@ int rt715_sdca_io_init(struct device *dev, struct sdw_slave *slave)
 
 		pm_runtime_enable(&slave->dev);
 
-		rt715->first_init = true;
+		rt715->first_hw_init = true;
 	}
 
 	pm_runtime_get_noresume(&slave->dev);
diff --git a/sound/soc/codecs/rt715-sdca.h b/sound/soc/codecs/rt715-sdca.h
index 85ce4d95e5eb..0c1fdd5bc7ca 100644
--- a/sound/soc/codecs/rt715-sdca.h
+++ b/sound/soc/codecs/rt715-sdca.h
@@ -27,7 +27,7 @@ struct rt715_sdca_priv {
 	enum sdw_slave_status status;
 	struct sdw_bus_params params;
 	bool hw_init;
-	bool first_init;
+	bool first_hw_init;
 	int l_is_unmute;
 	int r_is_unmute;
 	int hw_sdw_ver;
-- 
2.25.1


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

* [PATCH 10/15] ASoC: rt715-sdw: use first_hw_init flag on resume
  2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
                   ` (8 preceding siblings ...)
  2021-06-07 22:22 ` [PATCH 09/15] ASoC: rt715-sdca-sdw: " Pierre-Louis Bossart
@ 2021-06-07 22:22 ` Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 11/15] ASoC: rt715-sdca: fix clock stop prepare timeout issue Pierre-Louis Bossart
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Pierre-Louis Bossart @ 2021-06-07 22:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: Oder Chiou, Jack Yu, Ryan Lee, Guennadi Liakhovetski, tiwai,
	Pierre-Louis Bossart, broonie, Shuming Fan, Bard liao, Bard Liao

The intent of the status check on resume was to verify if a SoundWire
peripheral reported ATTACHED before waiting for the initialization to
complete. This is required to avoid timeouts that will happen with
'ghost' devices that are exposed in the platform firmware but are not
populated in hardware.

Unfortunately we used 'hw_init' instead of 'first_hw_init'. Due to
another error, the resume operation never timed out, but the volume
settings were not properly restored.

BugLink: https://github.com/thesofproject/linux/issues/2908
BugLink: https://github.com/thesofproject/linux/issues/2637
Fixes: d1ede0641b05e ('ASoC: rt715: add RT715 codec driver')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
---
 sound/soc/codecs/rt715-sdw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt715-sdw.c b/sound/soc/codecs/rt715-sdw.c
index 81a1dd77b6f6..a7b21b03c08b 100644
--- a/sound/soc/codecs/rt715-sdw.c
+++ b/sound/soc/codecs/rt715-sdw.c
@@ -541,7 +541,7 @@ static int __maybe_unused rt715_dev_resume(struct device *dev)
 	struct rt715_priv *rt715 = dev_get_drvdata(dev);
 	unsigned long time;
 
-	if (!rt715->hw_init)
+	if (!rt715->first_hw_init)
 		return 0;
 
 	if (!slave->unattach_request)
-- 
2.25.1


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

* [PATCH 11/15] ASoC: rt715-sdca: fix clock stop prepare timeout issue
  2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
                   ` (9 preceding siblings ...)
  2021-06-07 22:22 ` [PATCH 10/15] ASoC: rt715-sdw: " Pierre-Louis Bossart
@ 2021-06-07 22:22 ` Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 12/15] ASoC: rt5682: Fix a problem with error handling in the io init function of the soundwire Pierre-Louis Bossart
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Pierre-Louis Bossart @ 2021-06-07 22:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: Oder Chiou, Jack Yu, Ryan Lee, tiwai, Pierre-Louis Bossart,
	broonie, Shuming Fan, Bard liao

From: Jack Yu <jack.yu@realtek.com>

Fix clock stop prepare timeout issue (#2853).
The trigger of internal circuit which belong to
“SDCA preset stuffs” was not set correctly in previous driver,
which could block clock_stop_preparation state.
Add the correct register setting to fix it.

Fixes: 20d17057f0a8c ('ASoC: rt715-sdca: Add RT715 sdca vendor-specific driver')
Signed-off-by: Jack Yu <jack.yu@realtek.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/rt715-sdca-sdw.c | 1 +
 sound/soc/codecs/rt715-sdca-sdw.h | 1 +
 sound/soc/codecs/rt715-sdca.c     | 3 +++
 sound/soc/codecs/rt715-sdca.h     | 1 +
 4 files changed, 6 insertions(+)

diff --git a/sound/soc/codecs/rt715-sdca-sdw.c b/sound/soc/codecs/rt715-sdca-sdw.c
index 7646bbe739f1..a5c673f43d82 100644
--- a/sound/soc/codecs/rt715-sdca-sdw.c
+++ b/sound/soc/codecs/rt715-sdca-sdw.c
@@ -70,6 +70,7 @@ static bool rt715_sdca_mbq_readable_register(struct device *dev, unsigned int re
 	case 0x2000036:
 	case 0x2000037:
 	case 0x2000039:
+	case 0x2000044:
 	case 0x6100000:
 		return true;
 	default:
diff --git a/sound/soc/codecs/rt715-sdca-sdw.h b/sound/soc/codecs/rt715-sdca-sdw.h
index cd365bb60747..0cbc14844f8c 100644
--- a/sound/soc/codecs/rt715-sdca-sdw.h
+++ b/sound/soc/codecs/rt715-sdca-sdw.h
@@ -113,6 +113,7 @@ static const struct reg_default rt715_mbq_reg_defaults_sdca[] = {
 	{ 0x2000036, 0x0000 },
 	{ 0x2000037, 0x0000 },
 	{ 0x2000039, 0xaa81 },
+	{ 0x2000044, 0x0202 },
 	{ 0x6100000, 0x0100 },
 	{ SDW_SDCA_CTL(FUN_MIC_ARRAY, RT715_SDCA_FU_ADC8_9_VOL,
 		RT715_SDCA_FU_VOL_CTRL, CH_01), 0x00 },
diff --git a/sound/soc/codecs/rt715-sdca.c b/sound/soc/codecs/rt715-sdca.c
index d82166f1a378..66e166568c50 100644
--- a/sound/soc/codecs/rt715-sdca.c
+++ b/sound/soc/codecs/rt715-sdca.c
@@ -1054,6 +1054,9 @@ int rt715_sdca_io_init(struct device *dev, struct sdw_slave *slave)
 		rt715_sdca_index_update_bits(rt715, RT715_VENDOR_REG,
 			RT715_REV_1, 0x40, 0x40);
 	}
+	/* DFLL Calibration trigger */
+	rt715_sdca_index_update_bits(rt715, RT715_VENDOR_REG,
+			RT715_DFLL_VAD, 0x1, 0x1);
 	/* trigger mode = VAD enable */
 	regmap_write(rt715->regmap,
 		SDW_SDCA_CTL(FUN_MIC_ARRAY, RT715_SDCA_SMPU_TRIG_ST_EN,
diff --git a/sound/soc/codecs/rt715-sdca.h b/sound/soc/codecs/rt715-sdca.h
index 0c1fdd5bc7ca..90881b455ece 100644
--- a/sound/soc/codecs/rt715-sdca.h
+++ b/sound/soc/codecs/rt715-sdca.h
@@ -81,6 +81,7 @@ struct rt715_sdca_kcontrol_private {
 #define RT715_AD_FUNC_EN				0x36
 #define RT715_REV_1					0x37
 #define RT715_SDW_INPUT_SEL				0x39
+#define RT715_DFLL_VAD					0x44
 #define RT715_EXT_DMIC_CLK_CTRL2			0x54
 
 /* Index (NID:61h) */
-- 
2.25.1


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

* [PATCH 12/15] ASoC: rt5682: Fix a problem with error handling in the io init function of the soundwire
  2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
                   ` (10 preceding siblings ...)
  2021-06-07 22:22 ` [PATCH 11/15] ASoC: rt715-sdca: fix clock stop prepare timeout issue Pierre-Louis Bossart
@ 2021-06-07 22:22 ` Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 13/15] ASoC: rt5682-sdw: set regcache_cache_only false before reading RT5682_DEVICE_ID Pierre-Louis Bossart
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Pierre-Louis Bossart @ 2021-06-07 22:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: Oder Chiou, Jack Yu, Ryan Lee, tiwai, Pierre-Louis Bossart,
	broonie, Shuming Fan, Bard liao, Bard Liao

From: Oder Chiou <oder_chiou@realtek.com>

The device checking error should be a jump to pm_runtime_put_autosuspend()
as done before returning value.

Fixes: 867f8d18df4f ('ASoC: rt5682: fix getting the wrong device id when the suspend_stress_test')
Reviewed-by: Bard Liao <bard.liao@intel.com>
Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/rt5682-sdw.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/rt5682-sdw.c b/sound/soc/codecs/rt5682-sdw.c
index 8e4bb9dd194e..529a85fd0a00 100644
--- a/sound/soc/codecs/rt5682-sdw.c
+++ b/sound/soc/codecs/rt5682-sdw.c
@@ -408,9 +408,11 @@ static int rt5682_io_init(struct device *dev, struct sdw_slave *slave)
 		usleep_range(30000, 30005);
 		loop--;
 	}
+
 	if (val != DEVICE_ID) {
 		dev_err(dev, "Device with ID register %x is not rt5682\n", val);
-		return -ENODEV;
+		ret = -ENODEV;
+		goto err_nodev;
 	}
 
 	if (rt5682->first_hw_init) {
@@ -486,10 +488,11 @@ static int rt5682_io_init(struct device *dev, struct sdw_slave *slave)
 	rt5682->hw_init = true;
 	rt5682->first_hw_init = true;
 
+err_nodev:
 	pm_runtime_mark_last_busy(&slave->dev);
 	pm_runtime_put_autosuspend(&slave->dev);
 
-	dev_dbg(&slave->dev, "%s hw_init complete\n", __func__);
+	dev_dbg(&slave->dev, "%s hw_init complete: %d\n", __func__, ret);
 
 	return ret;
 }
-- 
2.25.1


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

* [PATCH 13/15] ASoC: rt5682-sdw: set regcache_cache_only false before reading RT5682_DEVICE_ID
  2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
                   ` (11 preceding siblings ...)
  2021-06-07 22:22 ` [PATCH 12/15] ASoC: rt5682: Fix a problem with error handling in the io init function of the soundwire Pierre-Louis Bossart
@ 2021-06-07 22:22 ` Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 14/15] ASoC: rt711-sdca-sdw: add readable for SDW_SDCA_CTL() registers Pierre-Louis Bossart
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Pierre-Louis Bossart @ 2021-06-07 22:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: Oder Chiou, Jack Yu, Ryan Lee, tiwai, Pierre-Louis Bossart,
	broonie, Shuming Fan, Bard liao

From: Bard Liao <yung-chuan.liao@linux.intel.com>

RT5682_DEVICE_ID is a volatile register, we can not read it in cache
only mode.

Fixes: 03f6fc6de919 ("ASoC: rt5682: Add the soundwire support")
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/rt5682-sdw.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/rt5682-sdw.c b/sound/soc/codecs/rt5682-sdw.c
index 529a85fd0a00..54873730bec5 100644
--- a/sound/soc/codecs/rt5682-sdw.c
+++ b/sound/soc/codecs/rt5682-sdw.c
@@ -400,6 +400,11 @@ static int rt5682_io_init(struct device *dev, struct sdw_slave *slave)
 
 	pm_runtime_get_noresume(&slave->dev);
 
+	if (rt5682->first_hw_init) {
+		regcache_cache_only(rt5682->regmap, false);
+		regcache_cache_bypass(rt5682->regmap, true);
+	}
+
 	while (loop > 0) {
 		regmap_read(rt5682->regmap, RT5682_DEVICE_ID, &val);
 		if (val == DEVICE_ID)
@@ -415,11 +420,6 @@ static int rt5682_io_init(struct device *dev, struct sdw_slave *slave)
 		goto err_nodev;
 	}
 
-	if (rt5682->first_hw_init) {
-		regcache_cache_only(rt5682->regmap, false);
-		regcache_cache_bypass(rt5682->regmap, true);
-	}
-
 	rt5682_calibrate(rt5682);
 
 	if (rt5682->first_hw_init) {
-- 
2.25.1


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

* [PATCH 14/15] ASoC: rt711-sdca-sdw: add readable for SDW_SDCA_CTL() registers
  2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
                   ` (12 preceding siblings ...)
  2021-06-07 22:22 ` [PATCH 13/15] ASoC: rt5682-sdw: set regcache_cache_only false before reading RT5682_DEVICE_ID Pierre-Louis Bossart
@ 2021-06-07 22:22 ` Pierre-Louis Bossart
  2021-06-07 22:22 ` [PATCH 15/15] ASoC: rt711-sdca: handle mbq_regmap in rt711_sdca_io_init Pierre-Louis Bossart
  2021-06-08 16:06 ` [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Mark Brown
  15 siblings, 0 replies; 17+ messages in thread
From: Pierre-Louis Bossart @ 2021-06-07 22:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: Oder Chiou, Jack Yu, Ryan Lee, tiwai, Pierre-Louis Bossart,
	broonie, Shuming Fan, Bard liao

From: Bard Liao <yung-chuan.liao@linux.intel.com>

SDW_SDCA_CTL() registers are used but are not set to readable.

Fixes: 7ad4d237e7c4a ('ASoC: rt711-sdca: Add RT711 SDCA vendor-specific driver')
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/rt711-sdca-sdw.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sound/soc/codecs/rt711-sdca-sdw.c b/sound/soc/codecs/rt711-sdca-sdw.c
index b84e64233d96..03cd3e0142f9 100644
--- a/sound/soc/codecs/rt711-sdca-sdw.c
+++ b/sound/soc/codecs/rt711-sdca-sdw.c
@@ -75,6 +75,16 @@ static bool rt711_sdca_mbq_readable_register(struct device *dev, unsigned int re
 	case 0x5b00000 ... 0x5b000ff:
 	case 0x5f00000 ... 0x5f000ff:
 	case 0x6100000 ... 0x61000ff:
+	case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU05, RT711_SDCA_CTL_FU_VOLUME, CH_L):
+	case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU05, RT711_SDCA_CTL_FU_VOLUME, CH_R):
+	case SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_VOLUME, CH_L):
+	case SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT711_SDCA_ENT_USER_FU1E, RT711_SDCA_CTL_FU_VOLUME, CH_R):
+	case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_VOLUME, CH_L):
+	case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_USER_FU0F, RT711_SDCA_CTL_FU_VOLUME, CH_R):
+	case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_PLATFORM_FU44, RT711_SDCA_CTL_FU_CH_GAIN, CH_L):
+	case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT711_SDCA_ENT_PLATFORM_FU44, RT711_SDCA_CTL_FU_CH_GAIN, CH_R):
+	case SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT711_SDCA_ENT_PLATFORM_FU15, RT711_SDCA_CTL_FU_CH_GAIN, CH_L):
+	case SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT711_SDCA_ENT_PLATFORM_FU15, RT711_SDCA_CTL_FU_CH_GAIN, CH_R):
 		return true;
 	default:
 		return false;
-- 
2.25.1


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

* [PATCH 15/15] ASoC: rt711-sdca: handle mbq_regmap in rt711_sdca_io_init
  2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
                   ` (13 preceding siblings ...)
  2021-06-07 22:22 ` [PATCH 14/15] ASoC: rt711-sdca-sdw: add readable for SDW_SDCA_CTL() registers Pierre-Louis Bossart
@ 2021-06-07 22:22 ` Pierre-Louis Bossart
  2021-06-08 16:06 ` [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Mark Brown
  15 siblings, 0 replies; 17+ messages in thread
From: Pierre-Louis Bossart @ 2021-06-07 22:22 UTC (permalink / raw)
  To: alsa-devel
  Cc: Oder Chiou, Jack Yu, Ryan Lee, tiwai, Pierre-Louis Bossart,
	broonie, Shuming Fan, Bard liao

From: Bard Liao <yung-chuan.liao@linux.intel.com>

We currently only hangle rt711->regmap in rt711_sdca_io_init(), and
rt711->mbq_regmap is missing.

Fixes: 7ad4d237e7c4a ('ASoC: rt711-sdca: Add RT711 SDCA vendor-specific driver')
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/codecs/rt711-sdca.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-sdca.c
index 24a084e0b48a..0b0c230dcf71 100644
--- a/sound/soc/codecs/rt711-sdca.c
+++ b/sound/soc/codecs/rt711-sdca.c
@@ -1500,6 +1500,8 @@ int rt711_sdca_io_init(struct device *dev, struct sdw_slave *slave)
 	if (rt711->first_hw_init) {
 		regcache_cache_only(rt711->regmap, false);
 		regcache_cache_bypass(rt711->regmap, true);
+		regcache_cache_only(rt711->mbq_regmap, false);
+		regcache_cache_bypass(rt711->mbq_regmap, true);
 	} else {
 		/*
 		 * PM runtime is only enabled when a Slave reports as Attached
@@ -1565,6 +1567,8 @@ int rt711_sdca_io_init(struct device *dev, struct sdw_slave *slave)
 	if (rt711->first_hw_init) {
 		regcache_cache_bypass(rt711->regmap, false);
 		regcache_mark_dirty(rt711->regmap);
+		regcache_cache_bypass(rt711->mbq_regmap, false);
+		regcache_mark_dirty(rt711->mbq_regmap);
 	} else
 		rt711->first_hw_init = true;
 
-- 
2.25.1


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

* Re: [PATCH 00/15] ASoC: fixes for SoundWire codec drivers
  2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
                   ` (14 preceding siblings ...)
  2021-06-07 22:22 ` [PATCH 15/15] ASoC: rt711-sdca: handle mbq_regmap in rt711_sdca_io_init Pierre-Louis Bossart
@ 2021-06-08 16:06 ` Mark Brown
  15 siblings, 0 replies; 17+ messages in thread
From: Mark Brown @ 2021-06-08 16:06 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel
  Cc: Oder Chiou, Jack Yu, Ryan Lee, tiwai, Mark Brown, Shuming Fan, Bard liao

On Mon, 7 Jun 2021 17:22:24 -0500, Pierre-Louis Bossart wrote:
> The SOF CI exposed a set of issues with suspend/resume, error
> handling, register access and mixer values.
> 
> These fixes were indentified with a tag so that they can be applied by
> linux-stable and distributions. Thanks to the Realtek and Maxim teams
> for their help.
> 
> [...]

Applied to

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

Thanks!

[01/15] ASoC: max98373-sdw: add missing memory allocation check
        commit: 468a272ca49cc4e2f58f3c360643c3f6d313c146
[02/15] ASoC: max98373-sdw: use first_hw_init flag on resume
        commit: bf881170311ea74ff30c3be0be8fb097132ce696
[03/15] ASoC: rt1308-sdw: use first_hw_init flag on resume
        commit: 30e102dab5fad1db71684f8ac5e1ac74e49da06d
[04/15] ASoC: rt1316-sdw: use first_hw_init flag on resume
        commit: ebe2ef60ed76c1afd8ec84e1bfd1868e3456e96b
[05/15] ASoC: rt5682-sdw: use first_hw_init flag on resume
        commit: 5361a42114689f875a9748299cadb4b1adbee6f4
[06/15] ASoC: rt700-sdw: use first_hw_init flag on resume
        commit: a9e54e5fbe396b546771cf77b43ce7c75e212278
[07/15] ASoC: rt711-sdca-sdw: use first_hw_init flag on resume
        commit: b32cab09707bb7fd851128633157c92716df6781
[08/15] ASoC: rt711-sdw: use first_hw_init flag on resume
        commit: a0897ebca669f09a2e02206a9c48a738af655329
[09/15] ASoC: rt715-sdca-sdw: use first_hw_init flag on resume
        commit: d34d0897a753f42c8a7a6af3866781dd57344a45
[10/15] ASoC: rt715-sdw: use first_hw_init flag on resume
        commit: dbc07517ab173688ef11234d1099bc1e24e4f14b
[11/15] ASoC: rt715-sdca: fix clock stop prepare timeout issue
        commit: e343d34a9c912fc5c321e2a9fbc02e9dc9534ade
[12/15] ASoC: rt5682: Fix a problem with error handling in the io init function of the soundwire
        commit: 9266d95405ae0c078f188ec8bca3a004631be429
[13/15] ASoC: rt5682-sdw: set regcache_cache_only false before reading RT5682_DEVICE_ID
        commit: c0372bc873dd29f325ee908351e0bd5b08d4d608
[14/15] ASoC: rt711-sdca-sdw: add readable for SDW_SDCA_CTL() registers
        commit: 5ad1ba99e4784929588c79e9810f5610825f0411
[15/15] ASoC: rt711-sdca: handle mbq_regmap in rt711_sdca_io_init
        commit: bcc0f0c078771e983a7e602eb14efa02f811445f

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] 17+ messages in thread

end of thread, other threads:[~2021-06-08 16:09 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-07 22:22 [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 01/15] ASoC: max98373-sdw: add missing memory allocation check Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 02/15] ASoC: max98373-sdw: use first_hw_init flag on resume Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 03/15] ASoC: rt1308-sdw: " Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 04/15] ASoC: rt1316-sdw: " Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 05/15] ASoC: rt5682-sdw: " Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 06/15] ASoC: rt700-sdw: " Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 07/15] ASoC: rt711-sdca-sdw: " Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 08/15] ASoC: rt711-sdw: " Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 09/15] ASoC: rt715-sdca-sdw: " Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 10/15] ASoC: rt715-sdw: " Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 11/15] ASoC: rt715-sdca: fix clock stop prepare timeout issue Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 12/15] ASoC: rt5682: Fix a problem with error handling in the io init function of the soundwire Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 13/15] ASoC: rt5682-sdw: set regcache_cache_only false before reading RT5682_DEVICE_ID Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 14/15] ASoC: rt711-sdca-sdw: add readable for SDW_SDCA_CTL() registers Pierre-Louis Bossart
2021-06-07 22:22 ` [PATCH 15/15] ASoC: rt711-sdca: handle mbq_regmap in rt711_sdca_io_init Pierre-Louis Bossart
2021-06-08 16:06 ` [PATCH 00/15] ASoC: fixes for SoundWire codec drivers Mark Brown

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.