* [PATCH v5 0/2] Handle shared reset GPIO for WSA883x speakers
@ 2025-08-15 17:23 Mohammad Rafi Shaik
2025-08-15 17:23 ` [PATCH v5 1/2] ASoC: dt-bindings: qcom,wsa8830: Add reset-gpios for shared line Mohammad Rafi Shaik
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Mohammad Rafi Shaik @ 2025-08-15 17:23 UTC (permalink / raw)
To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jaroslav Kysela, Takashi Iwai,
Philipp Zabel, Linus Walleij, Bartosz Golaszewski
Cc: linux-sound, linux-arm-msm, devicetree, linux-kernel, linux-gpio,
kernel
On some Qualcomm platforms such as QCS6490-RB3Gen2, the multiple
WSA8830/WSA8835 speakers share a common reset (shutdown) GPIO.
To handle such cases, use the reset controller framework along with the
"reset-gpio" driver.
Tested on:
- QCS6490-RB3Gen2
changes in [v5]:
- Removed multiple error logs and used proper shared reset API.
- Link to V4: https://lore.kernel.org/linux-sound/20250806181818.2817356-1-mohammad.rafi.shaik@oss.qualcomm.com/
changes in [v4]:
- Dropped v3-0002 patch, which is not required.
Fixed with proper error handling for failure cases.
- Link to V3: https://lore.kernel.org/linux-arm-msm/20250727083117.2415725-1-mohammad.rafi.shaik@oss.qualcomm.com/
changes in [v3]:
- Created separate patch for devm action to safely disable
regulator.
- cleanup the v2-0002 patch.
- Link to V2: https://lore.kernel.org/linux-sound/20250718104628.3732645-1-mohammad.rafi.shaik@oss.qualcomm.com/
changes in [v2]:
- Addressed the review comments from Krzysztof, Dmitry, Philipp.
- Used devm_reset_control_get_optional_shared_deasserted() api.
- created deasserts/asserts functions to handle reset gpios.
- Register devm action to safely disable the regulator on device removal.
- Link to V1: https://lore.kernel.org/linux-sound/20250620103012.360794-1-mohammad.rafi.shaik@oss.qualcomm.com/
Mohammad Rafi Shaik (2):
ASoC: dt-bindings: qcom,wsa8830: Add reset-gpios for shared line
ASoC: codecs: wsa883x: Handle shared reset GPIO for WSA883x speakers
.../bindings/sound/qcom,wsa883x.yaml | 11 +++-
sound/soc/codecs/wsa883x.c | 57 ++++++++++++++++---
2 files changed, 59 insertions(+), 9 deletions(-)
base-commit: 1357b2649c026b51353c84ddd32bc963e8999603
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v5 1/2] ASoC: dt-bindings: qcom,wsa8830: Add reset-gpios for shared line
2025-08-15 17:23 [PATCH v5 0/2] Handle shared reset GPIO for WSA883x speakers Mohammad Rafi Shaik
@ 2025-08-15 17:23 ` Mohammad Rafi Shaik
2025-08-15 17:23 ` [PATCH v5 2/2] ASoC: codecs: wsa883x: Handle shared reset GPIO for WSA883x speakers Mohammad Rafi Shaik
2025-08-19 19:46 ` [PATCH v5 0/2] " Mark Brown
2 siblings, 0 replies; 6+ messages in thread
From: Mohammad Rafi Shaik @ 2025-08-15 17:23 UTC (permalink / raw)
To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jaroslav Kysela, Takashi Iwai,
Philipp Zabel, Linus Walleij, Bartosz Golaszewski
Cc: linux-sound, linux-arm-msm, devicetree, linux-kernel, linux-gpio,
kernel, Krzysztof Kozlowski
On Qualcomm platforms such as QCS6490-RB3Gen2, the WSA883x speaker
amplifiers share the SD_N GPIO line between two speakers, thus
requires coordinated control when asserting the GPIO. Linux supports
shared GPIO handling via the "reset-gpios" property, which can be
used to specify either the powerdown or reset GPIOs.
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
---
.../devicetree/bindings/sound/qcom,wsa883x.yaml | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/sound/qcom,wsa883x.yaml b/Documentation/devicetree/bindings/sound/qcom,wsa883x.yaml
index 14d312f9c345..098f1df62c8c 100644
--- a/Documentation/devicetree/bindings/sound/qcom,wsa883x.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,wsa883x.yaml
@@ -29,6 +29,10 @@ properties:
description: GPIO spec for Powerdown/Shutdown line to use (pin SD_N)
maxItems: 1
+ reset-gpios:
+ description: Powerdown/Shutdown line to use (pin SD_N)
+ maxItems: 1
+
vdd-supply:
description: VDD Supply for the Codec
@@ -50,10 +54,15 @@ required:
- compatible
- reg
- vdd-supply
- - powerdown-gpios
- "#thermal-sensor-cells"
- "#sound-dai-cells"
+oneOf:
+ - required:
+ - powerdown-gpios
+ - required:
+ - reset-gpios
+
unevaluatedProperties: false
examples:
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v5 2/2] ASoC: codecs: wsa883x: Handle shared reset GPIO for WSA883x speakers
2025-08-15 17:23 [PATCH v5 0/2] Handle shared reset GPIO for WSA883x speakers Mohammad Rafi Shaik
2025-08-15 17:23 ` [PATCH v5 1/2] ASoC: dt-bindings: qcom,wsa8830: Add reset-gpios for shared line Mohammad Rafi Shaik
@ 2025-08-15 17:23 ` Mohammad Rafi Shaik
2025-08-16 8:28 ` Krzysztof Kozlowski
2025-08-18 6:14 ` Srinivas Kandagatla
2025-08-19 19:46 ` [PATCH v5 0/2] " Mark Brown
2 siblings, 2 replies; 6+ messages in thread
From: Mohammad Rafi Shaik @ 2025-08-15 17:23 UTC (permalink / raw)
To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jaroslav Kysela, Takashi Iwai,
Philipp Zabel, Linus Walleij, Bartosz Golaszewski
Cc: linux-sound, linux-arm-msm, devicetree, linux-kernel, linux-gpio,
kernel, Mohammad Rafi Shaik
From: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
On some Qualcomm platforms such as QCS6490-RB3Gen2, the multiple
WSA8830/WSA8835 speaker amplifiers share a common reset (shutdown) GPIO.
To handle such scenario, use the reset controller framework and its
"reset-gpio" driver to handle such case. This allows proper handling
of all WSA883x speaker amplifiers on QCS6490-RB3Gen2 board.
Signed-off-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
---
sound/soc/codecs/wsa883x.c | 57 ++++++++++++++++++++++++++++++++------
1 file changed, 49 insertions(+), 8 deletions(-)
diff --git a/sound/soc/codecs/wsa883x.c b/sound/soc/codecs/wsa883x.c
index 188363b03b93..ca4520ade79a 100644
--- a/sound/soc/codecs/wsa883x.c
+++ b/sound/soc/codecs/wsa883x.c
@@ -14,6 +14,7 @@
#include <linux/printk.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
+#include <linux/reset.h>
#include <linux/slab.h>
#include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_registers.h>
@@ -468,6 +469,7 @@ struct wsa883x_priv {
struct sdw_stream_runtime *sruntime;
struct sdw_port_config port_config[WSA883X_MAX_SWR_PORTS];
struct gpio_desc *sd_n;
+ struct reset_control *sd_reset;
bool port_prepared[WSA883X_MAX_SWR_PORTS];
bool port_enable[WSA883X_MAX_SWR_PORTS];
int active_ports;
@@ -1546,6 +1548,46 @@ static const struct hwmon_chip_info wsa883x_hwmon_chip_info = {
.info = wsa883x_hwmon_info,
};
+static void wsa883x_reset_assert(void *data)
+{
+ struct wsa883x_priv *wsa883x = data;
+
+ if (wsa883x->sd_reset)
+ reset_control_assert(wsa883x->sd_reset);
+ else
+ gpiod_direction_output(wsa883x->sd_n, 1);
+}
+
+static void wsa883x_reset_deassert(struct wsa883x_priv *wsa883x)
+{
+ if (wsa883x->sd_reset)
+ reset_control_deassert(wsa883x->sd_reset);
+ else
+ gpiod_direction_output(wsa883x->sd_n, 0);
+}
+
+static int wsa883x_get_reset(struct device *dev, struct wsa883x_priv *wsa883x)
+{
+ wsa883x->sd_reset = devm_reset_control_get_optional_shared(dev, NULL);
+ if (IS_ERR(wsa883x->sd_reset))
+ return dev_err_probe(dev, PTR_ERR(wsa883x->sd_reset),
+ "Failed to get reset\n");
+ /*
+ * if sd_reset: NULL, so use the backwards compatible way for powerdown-gpios,
+ * which does not handle sharing GPIO properly.
+ */
+ if (!wsa883x->sd_reset) {
+ wsa883x->sd_n = devm_gpiod_get_optional(dev, "powerdown",
+ GPIOD_FLAGS_BIT_NONEXCLUSIVE |
+ GPIOD_OUT_HIGH);
+ if (IS_ERR(wsa883x->sd_n))
+ return dev_err_probe(dev, PTR_ERR(wsa883x->sd_n),
+ "Shutdown Control GPIO not found\n");
+ }
+
+ return 0;
+}
+
static int wsa883x_probe(struct sdw_slave *pdev,
const struct sdw_device_id *id)
{
@@ -1566,13 +1608,9 @@ static int wsa883x_probe(struct sdw_slave *pdev,
if (ret)
return dev_err_probe(dev, ret, "Failed to enable vdd regulator\n");
- wsa883x->sd_n = devm_gpiod_get_optional(dev, "powerdown",
- GPIOD_FLAGS_BIT_NONEXCLUSIVE | GPIOD_OUT_HIGH);
- if (IS_ERR(wsa883x->sd_n)) {
- ret = dev_err_probe(dev, PTR_ERR(wsa883x->sd_n),
- "Shutdown Control GPIO not found\n");
+ ret = wsa883x_get_reset(dev, wsa883x);
+ if (ret)
goto err;
- }
dev_set_drvdata(dev, wsa883x);
wsa883x->slave = pdev;
@@ -1595,11 +1633,14 @@ static int wsa883x_probe(struct sdw_slave *pdev,
pdev->prop.simple_clk_stop_capable = true;
pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop;
pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
- gpiod_direction_output(wsa883x->sd_n, 0);
+
+ wsa883x_reset_deassert(wsa883x);
+ ret = devm_add_action_or_reset(dev, wsa883x_reset_assert, wsa883x);
+ if (ret)
+ return ret;
wsa883x->regmap = devm_regmap_init_sdw(pdev, &wsa883x_regmap_config);
if (IS_ERR(wsa883x->regmap)) {
- gpiod_direction_output(wsa883x->sd_n, 1);
ret = dev_err_probe(dev, PTR_ERR(wsa883x->regmap),
"regmap_init failed\n");
goto err;
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v5 2/2] ASoC: codecs: wsa883x: Handle shared reset GPIO for WSA883x speakers
2025-08-15 17:23 ` [PATCH v5 2/2] ASoC: codecs: wsa883x: Handle shared reset GPIO for WSA883x speakers Mohammad Rafi Shaik
@ 2025-08-16 8:28 ` Krzysztof Kozlowski
2025-08-18 6:14 ` Srinivas Kandagatla
1 sibling, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-16 8:28 UTC (permalink / raw)
To: Mohammad Rafi Shaik, Srinivas Kandagatla, Liam Girdwood,
Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jaroslav Kysela, Takashi Iwai, Philipp Zabel, Linus Walleij,
Bartosz Golaszewski
Cc: linux-sound, linux-arm-msm, devicetree, linux-kernel, linux-gpio,
kernel, Mohammad Rafi Shaik
On 15/08/2025 19:23, Mohammad Rafi Shaik wrote:
> From: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
>
> On some Qualcomm platforms such as QCS6490-RB3Gen2, the multiple
> WSA8830/WSA8835 speaker amplifiers share a common reset (shutdown) GPIO.
>
> To handle such scenario, use the reset controller framework and its
> "reset-gpio" driver to handle such case. This allows proper handling
> of all WSA883x speaker amplifiers on QCS6490-RB3Gen2 board.
>
> Signed-off-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v5 2/2] ASoC: codecs: wsa883x: Handle shared reset GPIO for WSA883x speakers
2025-08-15 17:23 ` [PATCH v5 2/2] ASoC: codecs: wsa883x: Handle shared reset GPIO for WSA883x speakers Mohammad Rafi Shaik
2025-08-16 8:28 ` Krzysztof Kozlowski
@ 2025-08-18 6:14 ` Srinivas Kandagatla
1 sibling, 0 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2025-08-18 6:14 UTC (permalink / raw)
To: Mohammad Rafi Shaik, Srinivas Kandagatla, Liam Girdwood,
Mark Brown, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Jaroslav Kysela, Takashi Iwai, Philipp Zabel, Linus Walleij,
Bartosz Golaszewski
Cc: linux-sound, linux-arm-msm, devicetree, linux-kernel, linux-gpio,
kernel, Mohammad Rafi Shaik
On 8/15/25 6:23 PM, Mohammad Rafi Shaik wrote:
> From: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
>
> On some Qualcomm platforms such as QCS6490-RB3Gen2, the multiple
> WSA8830/WSA8835 speaker amplifiers share a common reset (shutdown) GPIO.
>
> To handle such scenario, use the reset controller framework and its
> "reset-gpio" driver to handle such case. This allows proper handling
> of all WSA883x speaker amplifiers on QCS6490-RB3Gen2 board.
>
> Signed-off-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
> ---
lgtm,
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
--srini
> sound/soc/codecs/wsa883x.c | 57 ++++++++++++++++++++++++++++++++------
> 1 file changed, 49 insertions(+), 8 deletions(-)
>
> diff --git a/sound/soc/codecs/wsa883x.c b/sound/soc/codecs/wsa883x.c
> index 188363b03b93..ca4520ade79a 100644
> --- a/sound/soc/codecs/wsa883x.c
> +++ b/sound/soc/codecs/wsa883x.c
> @@ -14,6 +14,7 @@
> #include <linux/printk.h>
> #include <linux/regmap.h>
> #include <linux/regulator/consumer.h>
> +#include <linux/reset.h>
> #include <linux/slab.h>
> #include <linux/soundwire/sdw.h>
> #include <linux/soundwire/sdw_registers.h>
> @@ -468,6 +469,7 @@ struct wsa883x_priv {
> struct sdw_stream_runtime *sruntime;
> struct sdw_port_config port_config[WSA883X_MAX_SWR_PORTS];
> struct gpio_desc *sd_n;
> + struct reset_control *sd_reset;
> bool port_prepared[WSA883X_MAX_SWR_PORTS];
> bool port_enable[WSA883X_MAX_SWR_PORTS];
> int active_ports;
> @@ -1546,6 +1548,46 @@ static const struct hwmon_chip_info wsa883x_hwmon_chip_info = {
> .info = wsa883x_hwmon_info,
> };
>
> +static void wsa883x_reset_assert(void *data)
> +{
> + struct wsa883x_priv *wsa883x = data;
> +
> + if (wsa883x->sd_reset)
> + reset_control_assert(wsa883x->sd_reset);
> + else
> + gpiod_direction_output(wsa883x->sd_n, 1);
> +}
> +
> +static void wsa883x_reset_deassert(struct wsa883x_priv *wsa883x)
> +{
> + if (wsa883x->sd_reset)
> + reset_control_deassert(wsa883x->sd_reset);
> + else
> + gpiod_direction_output(wsa883x->sd_n, 0);
> +}
> +
> +static int wsa883x_get_reset(struct device *dev, struct wsa883x_priv *wsa883x)
> +{
> + wsa883x->sd_reset = devm_reset_control_get_optional_shared(dev, NULL);
> + if (IS_ERR(wsa883x->sd_reset))
> + return dev_err_probe(dev, PTR_ERR(wsa883x->sd_reset),
> + "Failed to get reset\n");
> + /*
> + * if sd_reset: NULL, so use the backwards compatible way for powerdown-gpios,
> + * which does not handle sharing GPIO properly.
> + */
> + if (!wsa883x->sd_reset) {
> + wsa883x->sd_n = devm_gpiod_get_optional(dev, "powerdown",
> + GPIOD_FLAGS_BIT_NONEXCLUSIVE |
> + GPIOD_OUT_HIGH);
> + if (IS_ERR(wsa883x->sd_n))
> + return dev_err_probe(dev, PTR_ERR(wsa883x->sd_n),
> + "Shutdown Control GPIO not found\n");
> + }
> +
> + return 0;
> +}
> +
> static int wsa883x_probe(struct sdw_slave *pdev,
> const struct sdw_device_id *id)
> {
> @@ -1566,13 +1608,9 @@ static int wsa883x_probe(struct sdw_slave *pdev,
> if (ret)
> return dev_err_probe(dev, ret, "Failed to enable vdd regulator\n");
>
> - wsa883x->sd_n = devm_gpiod_get_optional(dev, "powerdown",
> - GPIOD_FLAGS_BIT_NONEXCLUSIVE | GPIOD_OUT_HIGH);
> - if (IS_ERR(wsa883x->sd_n)) {
> - ret = dev_err_probe(dev, PTR_ERR(wsa883x->sd_n),
> - "Shutdown Control GPIO not found\n");
> + ret = wsa883x_get_reset(dev, wsa883x);
> + if (ret)
> goto err;
> - }
>
> dev_set_drvdata(dev, wsa883x);
> wsa883x->slave = pdev;
> @@ -1595,11 +1633,14 @@ static int wsa883x_probe(struct sdw_slave *pdev,
> pdev->prop.simple_clk_stop_capable = true;
> pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop;
> pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
> - gpiod_direction_output(wsa883x->sd_n, 0);
> +
> + wsa883x_reset_deassert(wsa883x);
> + ret = devm_add_action_or_reset(dev, wsa883x_reset_assert, wsa883x);
> + if (ret)
> + return ret;
>
> wsa883x->regmap = devm_regmap_init_sdw(pdev, &wsa883x_regmap_config);
> if (IS_ERR(wsa883x->regmap)) {
> - gpiod_direction_output(wsa883x->sd_n, 1);
> ret = dev_err_probe(dev, PTR_ERR(wsa883x->regmap),
> "regmap_init failed\n");
> goto err;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v5 0/2] Handle shared reset GPIO for WSA883x speakers
2025-08-15 17:23 [PATCH v5 0/2] Handle shared reset GPIO for WSA883x speakers Mohammad Rafi Shaik
2025-08-15 17:23 ` [PATCH v5 1/2] ASoC: dt-bindings: qcom,wsa8830: Add reset-gpios for shared line Mohammad Rafi Shaik
2025-08-15 17:23 ` [PATCH v5 2/2] ASoC: codecs: wsa883x: Handle shared reset GPIO for WSA883x speakers Mohammad Rafi Shaik
@ 2025-08-19 19:46 ` Mark Brown
2 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2025-08-19 19:46 UTC (permalink / raw)
To: Srinivas Kandagatla, Liam Girdwood, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Jaroslav Kysela, Takashi Iwai,
Philipp Zabel, Linus Walleij, Bartosz Golaszewski,
Mohammad Rafi Shaik
Cc: linux-sound, linux-arm-msm, devicetree, linux-kernel, linux-gpio,
kernel
On Fri, 15 Aug 2025 22:53:51 +0530, Mohammad Rafi Shaik wrote:
> On some Qualcomm platforms such as QCS6490-RB3Gen2, the multiple
> WSA8830/WSA8835 speakers share a common reset (shutdown) GPIO.
> To handle such cases, use the reset controller framework along with the
> "reset-gpio" driver.
>
> Tested on:
> - QCS6490-RB3Gen2
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoC: dt-bindings: qcom,wsa8830: Add reset-gpios for shared line
commit: 126750523eac0ea79df672d9771eb483f7497b16
[2/2] ASoC: codecs: wsa883x: Handle shared reset GPIO for WSA883x speakers
commit: cf65182247761f7993737b710afe8c781699356b
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] 6+ messages in thread
end of thread, other threads:[~2025-08-19 19:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-15 17:23 [PATCH v5 0/2] Handle shared reset GPIO for WSA883x speakers Mohammad Rafi Shaik
2025-08-15 17:23 ` [PATCH v5 1/2] ASoC: dt-bindings: qcom,wsa8830: Add reset-gpios for shared line Mohammad Rafi Shaik
2025-08-15 17:23 ` [PATCH v5 2/2] ASoC: codecs: wsa883x: Handle shared reset GPIO for WSA883x speakers Mohammad Rafi Shaik
2025-08-16 8:28 ` Krzysztof Kozlowski
2025-08-18 6:14 ` Srinivas Kandagatla
2025-08-19 19:46 ` [PATCH v5 0/2] " 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).