* [PATCH 5.15.y 2/4] ASoC: codecs: wsa881x: Use proper shutdown GPIO polarity
2026-01-21 2:47 ` [PATCH 5.15.y 1/4] ASoC: codecs: wsa881x: Simplify &pdev->dev in probe Sasha Levin
@ 2026-01-21 2:47 ` Sasha Levin
2026-01-21 2:47 ` [PATCH 5.15.y 3/4] ASoC: codecs: wsa881x: Drop unused version readout Sasha Levin
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2026-01-21 2:47 UTC (permalink / raw)
To: stable; +Cc: Krzysztof Kozlowski, Mark Brown, Sasha Levin
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
[ Upstream commit 738455858a2d21b769f673892546cf8300c9fd78 ]
The shutdown GPIO is active low (SD_N), but this depends on actual board
layout. Linux drivers should only care about logical state, where high
(1) means shutdown and low (0) means do not shutdown.
Invert the GPIO to match logical value while preserving backwards DTB
compatibility. It is not possible to detect whether ACTIVE_HIGH flag in
DTB is because it is an old DTB (using incorrect flag) or it is a new
DTB with a correct hardware pin polarity description. Therefore the
solution prioritizes backwards compatibility while relying on relevant
DTS being upstreamed.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230102114152.297305-4-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 29d71b8a5a40 ("ASoC: codecs: wsa881x: fix unnecessary initialisation")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/codecs/wsa881x.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c
index f4fef94bdf989..24f3a92037d4c 100644
--- a/sound/soc/codecs/wsa881x.c
+++ b/sound/soc/codecs/wsa881x.c
@@ -676,6 +676,11 @@ struct wsa881x_priv {
struct sdw_stream_runtime *sruntime;
struct sdw_port_config port_config[WSA881X_MAX_SWR_PORTS];
struct gpio_desc *sd_n;
+ /*
+ * Logical state for SD_N GPIO: high for shutdown, low for enable.
+ * For backwards compatibility.
+ */
+ unsigned int sd_n_val;
int version;
int active_ports;
bool port_prepared[WSA881X_MAX_SWR_PORTS];
@@ -1112,6 +1117,26 @@ static int wsa881x_probe(struct sdw_slave *pdev,
return PTR_ERR(wsa881x->sd_n);
}
+ /*
+ * Backwards compatibility work-around.
+ *
+ * The SD_N GPIO is active low, however upstream DTS used always active
+ * high. Changing the flag in driver and DTS will break backwards
+ * compatibility, so add a simple value inversion to work with both old
+ * and new DTS.
+ *
+ * This won't work properly with DTS using the flags properly in cases:
+ * 1. Old DTS with proper ACTIVE_LOW, however such case was broken
+ * before as the driver required the active high.
+ * 2. New DTS with proper ACTIVE_HIGH (intended), which is rare case
+ * (not existing upstream) but possible. This is the price of
+ * backwards compatibility, therefore this hack should be removed at
+ * some point.
+ */
+ wsa881x->sd_n_val = gpiod_is_active_low(wsa881x->sd_n);
+ if (!wsa881x->sd_n_val)
+ dev_warn(dev, "Using ACTIVE_HIGH for shutdown GPIO. Your DTB might be outdated or you use unsupported configuration for the GPIO.");
+
dev_set_drvdata(dev, wsa881x);
wsa881x->slave = pdev;
wsa881x->dev = dev;
@@ -1123,7 +1148,7 @@ static int wsa881x_probe(struct sdw_slave *pdev,
pdev->prop.sink_ports = GENMASK(WSA881X_MAX_SWR_PORTS - 1, 0);
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(wsa881x->sd_n, 1);
+ gpiod_direction_output(wsa881x->sd_n, !wsa881x->sd_n_val);
wsa881x->regmap = devm_regmap_init_sdw(pdev, &wsa881x_regmap_config);
if (IS_ERR(wsa881x->regmap)) {
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 5.15.y 3/4] ASoC: codecs: wsa881x: Drop unused version readout
2026-01-21 2:47 ` [PATCH 5.15.y 1/4] ASoC: codecs: wsa881x: Simplify &pdev->dev in probe Sasha Levin
2026-01-21 2:47 ` [PATCH 5.15.y 2/4] ASoC: codecs: wsa881x: Use proper shutdown GPIO polarity Sasha Levin
@ 2026-01-21 2:47 ` Sasha Levin
2026-01-21 2:47 ` [PATCH 5.15.y 4/4] ASoC: codecs: wsa881x: fix unnecessary initialisation Sasha Levin
2026-02-03 16:13 ` [PATCH 5.15.y 1/4] ASoC: codecs: wsa881x: Simplify &pdev->dev in probe Greg KH
3 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2026-01-21 2:47 UTC (permalink / raw)
To: stable; +Cc: Krzysztof Kozlowski, Mark Brown, Sasha Levin
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
[ Upstream commit 3d2a69eb503d15171a7ba51cf0b562728ac396b7 ]
Driver does not use the device version after reading it from the
registers, so simplify by dropping unneeded code.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240710-asoc-wsa88xx-version-v1-1-f1c54966ccde@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 29d71b8a5a40 ("ASoC: codecs: wsa881x: fix unnecessary initialisation")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/codecs/wsa881x.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c
index 24f3a92037d4c..80625efc2fc7e 100644
--- a/sound/soc/codecs/wsa881x.c
+++ b/sound/soc/codecs/wsa881x.c
@@ -681,7 +681,6 @@ struct wsa881x_priv {
* For backwards compatibility.
*/
unsigned int sd_n_val;
- int version;
int active_ports;
bool port_prepared[WSA881X_MAX_SWR_PORTS];
bool port_enable[WSA881X_MAX_SWR_PORTS];
@@ -692,7 +691,6 @@ static void wsa881x_init(struct wsa881x_priv *wsa881x)
struct regmap *rm = wsa881x->regmap;
unsigned int val = 0;
- regmap_read(rm, WSA881X_CHIP_ID1, &wsa881x->version);
regmap_register_patch(wsa881x->regmap, wsa881x_rev_2_0,
ARRAY_SIZE(wsa881x_rev_2_0));
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 5.15.y 4/4] ASoC: codecs: wsa881x: fix unnecessary initialisation
2026-01-21 2:47 ` [PATCH 5.15.y 1/4] ASoC: codecs: wsa881x: Simplify &pdev->dev in probe Sasha Levin
2026-01-21 2:47 ` [PATCH 5.15.y 2/4] ASoC: codecs: wsa881x: Use proper shutdown GPIO polarity Sasha Levin
2026-01-21 2:47 ` [PATCH 5.15.y 3/4] ASoC: codecs: wsa881x: Drop unused version readout Sasha Levin
@ 2026-01-21 2:47 ` Sasha Levin
2026-02-03 16:13 ` [PATCH 5.15.y 1/4] ASoC: codecs: wsa881x: Simplify &pdev->dev in probe Greg KH
3 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2026-01-21 2:47 UTC (permalink / raw)
To: stable
Cc: Johan Hovold, Srinivas Kandagatla, Krzysztof Kozlowski,
Srinivas Kandagatla, Mark Brown, Sasha Levin
From: Johan Hovold <johan@kernel.org>
[ Upstream commit 29d71b8a5a40708b3eed9ba4953bfc2312c9c776 ]
The soundwire update_status() callback may be called multiple times with
the same ATTACHED status but initialisation should only be done when
transitioning from UNATTACHED to ATTACHED.
Fixes: a0aab9e1404a ("ASoC: codecs: add wsa881x amplifier support")
Cc: stable@vger.kernel.org # 5.6
Cc: Srinivas Kandagatla <srini@kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Link: https://patch.msgid.link/20260102111413.9605-3-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/codecs/wsa881x.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c
index 80625efc2fc7e..22c382f0c68bf 100644
--- a/sound/soc/codecs/wsa881x.c
+++ b/sound/soc/codecs/wsa881x.c
@@ -682,6 +682,7 @@ struct wsa881x_priv {
*/
unsigned int sd_n_val;
int active_ports;
+ bool hw_init;
bool port_prepared[WSA881X_MAX_SWR_PORTS];
bool port_enable[WSA881X_MAX_SWR_PORTS];
};
@@ -691,6 +692,9 @@ static void wsa881x_init(struct wsa881x_priv *wsa881x)
struct regmap *rm = wsa881x->regmap;
unsigned int val = 0;
+ if (wsa881x->hw_init)
+ return;
+
regmap_register_patch(wsa881x->regmap, wsa881x_rev_2_0,
ARRAY_SIZE(wsa881x_rev_2_0));
@@ -728,6 +732,8 @@ static void wsa881x_init(struct wsa881x_priv *wsa881x)
regmap_update_bits(rm, WSA881X_OTP_REG_28, 0x3F, 0x3A);
regmap_update_bits(rm, WSA881X_BONGO_RESRV_REG1, 0xFF, 0xB2);
regmap_update_bits(rm, WSA881X_BONGO_RESRV_REG2, 0xFF, 0x05);
+
+ wsa881x->hw_init = true;
}
static int wsa881x_component_probe(struct snd_soc_component *comp)
@@ -1064,6 +1070,9 @@ static int wsa881x_update_status(struct sdw_slave *slave,
{
struct wsa881x_priv *wsa881x = dev_get_drvdata(&slave->dev);
+ if (status == SDW_SLAVE_UNATTACHED)
+ wsa881x->hw_init = false;
+
if (status == SDW_SLAVE_ATTACHED && slave->dev_num > 0)
wsa881x_init(wsa881x);
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 5.15.y 1/4] ASoC: codecs: wsa881x: Simplify &pdev->dev in probe
2026-01-21 2:47 ` [PATCH 5.15.y 1/4] ASoC: codecs: wsa881x: Simplify &pdev->dev in probe Sasha Levin
` (2 preceding siblings ...)
2026-01-21 2:47 ` [PATCH 5.15.y 4/4] ASoC: codecs: wsa881x: fix unnecessary initialisation Sasha Levin
@ 2026-02-03 16:13 ` Greg KH
3 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2026-02-03 16:13 UTC (permalink / raw)
To: Sasha Levin; +Cc: stable, Krzysztof Kozlowski, Mark Brown
On Tue, Jan 20, 2026 at 09:47:37PM -0500, Sasha Levin wrote:
> From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>
> [ Upstream commit c617c9e7024d152426acf9f1aaf01070b6852f13 ]
>
> The probe already stores pointer to &pdev->dev, so use it to make the
> code a bit easier to read.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Link: https://lore.kernel.org/r/20230102114152.297305-2-krzysztof.kozlowski@linaro.org
> Signed-off-by: Mark Brown <broonie@kernel.org>
> Stable-dep-of: 29d71b8a5a40 ("ASoC: codecs: wsa881x: fix unnecessary initialisation")
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> sound/soc/codecs/wsa881x.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/sound/soc/codecs/wsa881x.c b/sound/soc/codecs/wsa881x.c
> index c8d3dc6341037..f4fef94bdf989 100644
> --- a/sound/soc/codecs/wsa881x.c
> +++ b/sound/soc/codecs/wsa881x.c
> @@ -1101,20 +1101,20 @@ static int wsa881x_probe(struct sdw_slave *pdev,
> {
> struct wsa881x_priv *wsa881x;
>
> - wsa881x = devm_kzalloc(&pdev->dev, sizeof(*wsa881x), GFP_KERNEL);
> + wsa881x = devm_kzalloc(dev, sizeof(*wsa881x), GFP_KERNEL);
> if (!wsa881x)
> return -ENOMEM;
>
> - wsa881x->sd_n = devm_gpiod_get_optional(&pdev->dev, "powerdown",
> + wsa881x->sd_n = devm_gpiod_get_optional(dev, "powerdown",
> GPIOD_FLAGS_BIT_NONEXCLUSIVE);
> if (IS_ERR(wsa881x->sd_n)) {
> dev_err(&pdev->dev, "Shutdown Control GPIO not found\n");
> return PTR_ERR(wsa881x->sd_n);
> }
>
> - dev_set_drvdata(&pdev->dev, wsa881x);
> + dev_set_drvdata(dev, wsa881x);
> wsa881x->slave = pdev;
> - wsa881x->dev = &pdev->dev;
> + wsa881x->dev = dev;
> wsa881x->sconfig.ch_count = 1;
> wsa881x->sconfig.bps = 1;
> wsa881x->sconfig.frame_rate = 48000;
> @@ -1131,7 +1131,7 @@ static int wsa881x_probe(struct sdw_slave *pdev,
> return PTR_ERR(wsa881x->regmap);
> }
>
> - return devm_snd_soc_register_component(&pdev->dev,
> + return devm_snd_soc_register_component(dev,
> &wsa881x_component_drv,
> wsa881x_dais,
> ARRAY_SIZE(wsa881x_dais));
> --
> 2.51.0
>
>
Breaks the build :(
^ permalink raw reply [flat|nested] 6+ messages in thread