Skip to contentSkip to conversation

soundwire: qcom: disable stop clock on 1.3.0 and below

PATCH In review Anton Bambura 3 participants 5 messages Apr 13, 2024 – Apr 19, 2024

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover soundwire: qcom: disable stop clock on 1.3.0 and below

This patch fixes audio on sdm845 + wcd9340 with soundwire. The affected devices are AYN Odin and Lenovo Yoga C630.

If this gets applied it should also be backported to stable and 6.6.x LTS.

Anton Bambura (1):
soundwire: qcom: disable stop clock on 1.3.0 and below

 drivers/soundwire/qcom.c | 3 +++
 1 file changed, 3 insertions(+)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/1 soundwire: qcom: disable stop clock on 1.3.0 and below

This patch returns back the behavior of disabling stop clock on soundwire 1.3.0 and below which seems to have been altered by accident which results in broken audio on sdm845 + wcd9340. For example, on AYN Odin and Lenovo Yoga C630 devices.

Fixes 4830bfa2c812 ("soundwire: qcom: set clk stop need reset flag at runtime")
---
 drivers/soundwire/qcom.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/soundwire/qcom.c +3 -0
index a1e2d6c98186..bc03484a28e8 100644
@@ -628,6 +628,9 @@ static int qcom_swrm_enumerate(struct sdw_bus *bus)
 			}
 		}
 
+		if (ctrl->version <= SWRM_VERSION_1_3_0)
+			ctrl->clock_stop_not_supported = true;
+
 		if (!found) {
 			qcom_swrm_set_slave_dev_num(bus, NULL, i);
 			sdw_slave_add(bus, &id, NULL);
Signature · 1 line
2.43.0
Tested-by on v1 1/1
#2 lore raw

Thank you!

Quoted 27 lines · Anton Bambura

This patch returns back the behavior of disabling stop clock on soundwire 1.3.0 and below which seems to have been altered by accident which results in broken audio on sdm845 + wcd9340. For example, on AYN Odin and Lenovo Yoga C630 devices.

Fixes 4830bfa2c812 ("soundwire: qcom: set clk stop need reset flag at runtime")
---
 drivers/soundwire/qcom.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/soundwire/qcom.c +3 -1
index a1e2d6c98186..bc03484a28e8 100644
@@ -628,6 +628,9 @@ static int qcom_swrm_enumerate(struct sdw_bus *bus)
                        }
                }
 
+               if (ctrl->version <= SWRM_VERSION_1_3_0)
+                       ctrl->clock_stop_not_supported = true;
+
                if (!found) {
                        qcom_swrm_set_slave_dev_num(bus, NULL, i);
                        sdw_slave_add(bus, &id, NULL);
--
Quoted 3 lines

2.43.0

Tested on the Lenovo Yoga C630

-- steev

#3 lore raw
In reply to Anton Bambura
Quoted 16 lines · Anton Bambura

This patch returns back the behavior of disabling stop clock on soundwire 1.3.0 and below which seems to have been altered by accident which results in broken audio on sdm845 + wcd9340. For example, on AYN Odin and Lenovo Yoga C630 devices.

Fixes 4830bfa2c812 ("soundwire: qcom: set clk stop need reset flag at runtime")
---
  drivers/soundwire/qcom.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/soundwire/qcom.c +0 -0
index a1e2d6c98186..bc03484a28e8 100644

drivers/soundwire/qcom.c static int qcom_swrm_enumerate(struct sdw_bus *bus) · line 633

Quoted 6 lines
drivers/soundwire/qcom.c +3 -0
@@ -628,6 +628,9 @@ static int qcom_swrm_enumerate(struct sdw_bus *bus)
  			}
  		}
 
+		if (ctrl->version <= SWRM_VERSION_1_3_0)
+			ctrl->clock_stop_not_supported = true;
+

This is not the right fix, this can be determined from codec clk_stop_mode1 flag.

can you try this patch:

----------------------------->cut<-----------------------------
From: Srinivas Kandagatla <[email protected]>
Date: Wed, 17 Apr 2024 12:38:49 +0100
Subject: [PATCH] ASoC: codecs: wsa881x: set clk_stop_mode1 flag

WSA881x codecs do not retain the state while clock is stopped, so mark this with clk_stop_mode1 flag.

Fixes a0aab9e1404a ("ASoC: codecs: add wsa881x amplifier support")
---
 sound/soc/codecs/wsa881x.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/codecs/wsa881x.c +1 -0
index 3c025dabaf7a..1253695bebd8 100644
@@ -1155,6 +1155,7 @@ static int wsa881x_probe(struct sdw_slave *pdev,
 	pdev->prop.sink_ports = GENMASK(WSA881X_MAX_SWR_PORTS, 0);
 	pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop;
 	pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
+	pdev->prop.clk_stop_mode1 = true;
 	gpiod_direction_output(wsa881x->sd_n, !wsa881x->sd_n_val);
 
 	wsa881x->regmap = devm_regmap_init_sdw(pdev, &wsa881x_regmap_config);
Signature · 6 lines
2.21.0
----------------------------->cut<-----------------------------


thanks,
Srini
Quoted 3 lines
drivers/soundwire/qcom.c +0 -0
  		if (!found) {
  			qcom_swrm_set_slave_dev_num(bus, NULL, i);
  			sdw_slave_add(bus, &id, NULL);
#4 lore raw

Hi Srini,

Quoted 37 lines · Srinivas Kandagatla

This is not the right fix, this can be determined from codec clk_stop_mode1 flag.

can you try this patch:

----------------------------->cut<-----------------------------
From: Srinivas Kandagatla <[email protected]>
Date: Wed, 17 Apr 2024 12:38:49 +0100
Subject: [PATCH] ASoC: codecs: wsa881x: set clk_stop_mode1 flag

WSA881x codecs do not retain the state while clock is stopped, so mark this with clk_stop_mode1 flag.

Fixes a0aab9e1404a ("ASoC: codecs: add wsa881x amplifier support")
---
  sound/soc/codecs/wsa881x.c | 1 +
  1 file changed, 1 insertion(+)
sound/soc/codecs/wsa881x.c +1 -1
index 3c025dabaf7a..1253695bebd8 100644
@@ -1155,6 +1155,7 @@ static int wsa881x_probe(struct sdw_slave *pdev,
        pdev->prop.sink_ports = GENMASK(WSA881X_MAX_SWR_PORTS, 0);
        pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop;
        pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
+       pdev->prop.clk_stop_mode1 = true;
        gpiod_direction_output(wsa881x->sd_n, !wsa881x->sd_n_val);
 
        wsa881x->regmap = devm_regmap_init_sdw(pdev, &wsa881x_regmap_config);
--

2.21.0 ----------------------------->cut<-----------------------------

Quoted 7 lines

thanks,
Srini

Quoted 3 lines
              if (!found) {
                      qcom_swrm_set_slave_dev_num(bus, NULL, i);
                      sdw_slave_add(bus, &id, NULL);

I tested it here on my c630 and can confirm that your patch does fix the audio as well.