FAILED: patch "[PATCH] ASoC: codecs: wsa881x: fix unnecessary initialisation" failed to apply to 5.15-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x 29d71b8a5a40708b3eed9ba4953bfc2312c9c776
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026012029-possibly-cornhusk-03c3@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 29d71b8a5a40708b3eed9ba4953bfc2312c9c776 Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Fri, 2 Jan 2026 12:14:11 +0100
Subject: [PATCH] ASoC: codecs: wsa881x: fix unnecessary initialisation
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.
sound/soc/codecs/wsa881x.c +9 -0
@@ -678,6 +678,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 ]; };
@@ -687,6 +688,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));
@@ -724,6 +728,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)
@@ -1067,6 +1073,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);
Sasha Levin
maintainerPATCH 1/4 ASoC: codecs: wsa881x: Simplify &pdev->dev in probe
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit c617c9e7024d152426acf9f1aaf01070b6852f13 ]
The probe already stores pointer to &pdev->dev, so use it to make the code a bit easier to read.
Stable-dep-of: 29d71b8a5a40 ("ASoC: codecs: wsa881x: fix unnecessary initialisation")
--- sound/soc/codecs/wsa881x.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/codecs/wsa881x.c +5 -5
@@ -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));
Signature · 1 line
2.51.0
Sasha Levin
maintainerPATCH 2/4 ASoC: codecs: wsa881x: Use proper shutdown GPIO polarity
From: Krzysztof Kozlowski <[email protected]>
[ 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.
Stable-dep-of: 29d71b8a5a40 ("ASoC: codecs: wsa881x: fix unnecessary initialisation")
--- sound/soc/codecs/wsa881x.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
sound/soc/codecs/wsa881x.c +26 -1
@@ -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)) {
Signature · 1 line
2.51.0
Sasha Levin
maintainerPATCH 3/4 ASoC: codecs: wsa881x: Drop unused version readout
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 3d2a69eb503d15171a7ba51cf0b562728ac396b7 ]
Driver does not use the device version after reading it from the registers, so simplify by dropping unneeded code.
Stable-dep-of: 29d71b8a5a40 ("ASoC: codecs: wsa881x: fix unnecessary initialisation")
--- sound/soc/codecs/wsa881x.c | 2 -- 1 file changed, 2 deletions(-)
sound/soc/codecs/wsa881x.c +0 -2
@@ -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));
Signature · 1 line
2.51.0
Sasha Levin
maintainerPATCH 4/4 ASoC: codecs: wsa881x: fix unnecessary initialisation
In reply to Sasha LevinFrom: Johan Hovold <[email protected]>
[ 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.
--- sound/soc/codecs/wsa881x.c | 9 +++++++++ 1 file changed, 9 insertions(+)
sound/soc/codecs/wsa881x.c +9 -0
@@ -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);
Signature · 1 line
2.51.0
Greg KH
maintainerRe: [PATCH 5.15.y 1/4] ASoC: codecs: wsa881x: Simplify &pdev->dev in probe
In reply to Sasha LevinQuoted 58 lines · Sasha Levin
From: Krzysztof Kozlowski <[email protected]>
[ 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 <[email protected]>Signed-off-by Mark Brown <[email protected]>Stable-dep-of:
29d71b8a5a40("ASoC: codecs: wsa881x: fix unnecessary initialisation")Signed-off-by Sasha Levin <[email protected]>--- sound/soc/codecs/wsa881x.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)sound/soc/codecs/wsa881x.c +5
-5@@ -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));Signature · 1 line
2.51.0
Breaks the build :(