* [PATCH AUTOSEL 6.17-5.4] ASoC: pxa: add GPIOLIB_LEGACY dependency
[not found] <20251025160905.3857885-1-sashal@kernel.org>
@ 2025-10-25 15:55 ` Sasha Levin
2025-10-27 9:23 ` Arnd Bergmann
2025-10-25 15:55 ` [PATCH AUTOSEL 6.17-5.15] media: em28xx: add special case for legacy gpiolib interface Sasha Levin
2025-10-25 15:57 ` [PATCH AUTOSEL 6.17] ASoC: codecs: wsa883x: Handle shared reset GPIO for WSA883x speakers Sasha Levin
2 siblings, 1 reply; 7+ messages in thread
From: Sasha Levin @ 2025-10-25 15:55 UTC (permalink / raw)
To: patches, stable
Cc: Arnd Bergmann, Mark Brown, Sasha Levin, daniel, haojian.zhuang,
robert.jarzmik, linus.walleij, brgl, linux-arm-kernel, linux-gpio
From: Arnd Bergmann <arnd@arndb.de>
[ Upstream commit 2d86d2585ab929a143d1e6f8963da1499e33bf13 ]
The pxa27x platform uses the legacy gpiolib interfaces, including
in its sound drivers:
sound/arm/pxa2xx-ac97-lib.c: In function 'pxa2xx_ac97_hw_probe':
sound/arm/pxa2xx-ac97-lib.c:374:23: error: implicit declaration of function 'gpio_request_one' [-Wimplicit-function-declaration]
374 | ret = gpio_request_one(reset_gpio, GPIOF_OUT_INIT_HIGH,
Make sure we don't select those drivers for compile-testing unless
we are building for a pxa27x system, or CONFIG_GPIOLIB_LEGACY is
already enabled.
The SND_PXA_SOC_SSP driver accidentally used a dependency on PLAT_PXA,
which includes both ARCH_PXA and ARCH_MMP, but it is only used on
the former.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20250808151822.536879-21-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
YES
Rationale
- Fixes a real build failure during COMPILE_TEST when legacy GPIO APIs
are disabled. The failure stems from `gpio_request_one()` in the PXA
AC97 support code: `sound/arm/pxa2xx-ac97-lib.c:374` uses legacy GPIO
(gpio_request_one/`GPIOF_OUT_INIT_HIGH`). When `GPIOLIB_LEGACY` is not
enabled, these legacy interfaces are not available, leading to the
implicit declaration error cited in the commit message.
- Targeted Kconfig gating avoids the bad configuration instead of
changing runtime code:
- `sound/soc/pxa/Kconfig:2` changes `SND_PXA2XX_SOC` from `depends on
ARCH_PXA || COMPILE_TEST` to `depends on ARCH_PXA || (COMPILE_TEST
&& GPIOLIB_LEGACY)`. This ensures the PXA SoC audio stack (which
selects `SND_PXA2XX_LIB_AC97` and builds `pxa2xx-ac97-lib.c`) is not
compile-tested unless legacy GPIO support is present, eliminating
the build break.
- `sound/soc/pxa/Kconfig:27` changes `SND_PXA_SOC_SSP` from `depends
on PLAT_PXA` to `depends on ARCH_PXA`. `PLAT_PXA` is selected by
both PXA and MMP (`drivers/soc/pxa/Kconfig:2`, selected in
`arch/arm/mach-pxa/Kconfig:13` and `arch/arm/mach-mmp/Kconfig:8`),
which caused the PXA-specific SSP DAI driver (`sound/soc/pxa/pxa-
ssp.c` includes `<linux/pxa2xx_ssp.h>`) to be selectable on MMP
inadvertently. Tightening to `ARCH_PXA` corrects that misdependency.
Why this suits stable
- Small, contained Kconfig-only change; no runtime behavior or ABI
change.
- Fixes a concrete build error affecting users of `COMPILE_TEST`
configurations without `GPIOLIB_LEGACY`.
- Reduces accidental driver enablement on the wrong SoC family (MMP) by
replacing `PLAT_PXA` with `ARCH_PXA` for `SND_PXA_SOC_SSP`.
- Minimal regression risk: only affects visibility of options under
specific Kconfig combinations. It does not introduce new features or
architectural changes.
Notes on applicability
- This backport is most relevant to stable series that already have the
`GPIOLIB_LEGACY` split. Older stable trees that predate
`GPIOLIB_LEGACY` either won’t need this change (no build break) or may
require adjusting the dependency accordingly.
sound/soc/pxa/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig
index e026f9912a6d1..e54abcd39f792 100644
--- a/sound/soc/pxa/Kconfig
+++ b/sound/soc/pxa/Kconfig
@@ -3,7 +3,7 @@ menu "PXA"
config SND_PXA2XX_SOC
tristate "SoC Audio for the Intel PXA2xx chip"
- depends on ARCH_PXA || COMPILE_TEST
+ depends on ARCH_PXA || (COMPILE_TEST && GPIOLIB_LEGACY)
select SND_PXA2XX_LIB
help
Say Y or M if you want to add support for codecs attached to
@@ -26,7 +26,7 @@ config SND_PXA2XX_SOC_I2S
config SND_PXA_SOC_SSP
tristate "Soc Audio via PXA2xx/PXA3xx SSP ports"
- depends on PLAT_PXA
+ depends on ARCH_PXA
select PXA_SSP
select SND_PXA2XX_LIB
--
2.51.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH AUTOSEL 6.17-5.15] media: em28xx: add special case for legacy gpiolib interface
[not found] <20251025160905.3857885-1-sashal@kernel.org>
2025-10-25 15:55 ` [PATCH AUTOSEL 6.17-5.4] ASoC: pxa: add GPIOLIB_LEGACY dependency Sasha Levin
@ 2025-10-25 15:55 ` Sasha Levin
2025-10-27 9:24 ` Arnd Bergmann
2025-10-25 15:57 ` [PATCH AUTOSEL 6.17] ASoC: codecs: wsa883x: Handle shared reset GPIO for WSA883x speakers Sasha Levin
2 siblings, 1 reply; 7+ messages in thread
From: Sasha Levin @ 2025-10-25 15:55 UTC (permalink / raw)
To: patches, stable
Cc: Arnd Bergmann, Hans Verkuil, Sasha Levin, mchehab, linus.walleij,
brgl, linux-media, linux-gpio
From: Arnd Bergmann <arnd@arndb.de>
[ Upstream commit d5d299e7e7f6b4ead31383d4abffca34e4296df0 ]
The em28xx driver uses the old-style gpio_request_one() interface to
switch the lna on the PCTV 290E card.
This interface is becoming optional and should no longer be called by
portable drivers. As I could not figure out an obvious replacement,
select the new GPIOLIB_LEGACY symbol as a workaround.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
YES
- What it fixes: Prevents build breakage when `GPIOLIB=y` but the legacy
GPIO consumer API is disabled. `gpio_request_one()` is only declared
when `CONFIG_GPIOLIB_LEGACY` is enabled (see
`include/linux/gpio.h:88`), so compiling code guarded only by
`CONFIG_GPIOLIB` fails if legacy support is off.
- Code changes (small and contained):
- Guards updated to match the actual availability of
`gpio_request_one()`:
- `drivers/media/usb/em28xx/em28xx-dvb.c:730` switches `#ifdef
CONFIG_GPIOLIB` to `#ifdef CONFIG_GPIOLIB_LEGACY` in
`em28xx_pctv_290e_set_lna()`, so the legacy-only API is used only
when the legacy interface is present.
- `drivers/media/usb/em28xx/em28xx-dvb.c:1708` does the same in
`em28xx_dvb_init()` where the LNA is enabled on init for the PCTV
290E.
- Kconfig ensures the legacy API is pulled in when this driver
configuration requires it:
- `drivers/media/usb/em28xx/Kconfig:71` adds `select GPIOLIB_LEGACY
if GPIOLIB && DVB_CXD2820R`.
- Behavior and scope:
- If `GPIOLIB_LEGACY` is available, functionality is unchanged: the
driver still toggles the LNA via `gpio_request_one()` and frees it.
- If `GPIOLIB=y` but `GPIOLIB_LEGACY=n`, the code now cleanly compiles
and falls back to a warning and no-op in
`em28xx_pctv_290e_set_lna()` (see `drivers/media/usb/em28xx/em28xx-
dvb.c:750`), avoiding a build error.
- The Kconfig `select` line actively keeps legacy enabled for this
combo, preserving LNA control where it mattered before.
- Risk assessment:
- No architectural changes; purely Kconfig and preprocessor guards.
- Touches only the em28xx media USB driver and its Kconfig.
- Aligns with the tree-wide pattern where `gpio_request_one()` and
friends are guarded by `CONFIG_GPIOLIB_LEGACY` (e.g.,
`include/linux/gpio.h:88`, multiple existing users throughout the
tree).
- Minimal regression risk; at worst, adds the tiny legacy gpiolib-
legacy code when selected by Kconfig.
- Stable criteria fit:
- Fixes a real user-facing problem (build failure in valid configs).
- Small, targeted, and low risk.
- No new features; purely compatibility/build fix.
Note: Backport is relevant for stable series where
`CONFIG_GPIOLIB_LEGACY` exists and can be disabled. Older stable series
lacking this symbol won’t need (or may not accept) the Kconfig/guard
changes.
drivers/media/usb/em28xx/Kconfig | 1 +
drivers/media/usb/em28xx/em28xx-dvb.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/usb/em28xx/Kconfig b/drivers/media/usb/em28xx/Kconfig
index cb61fd6cc6c61..3122d4bdfc596 100644
--- a/drivers/media/usb/em28xx/Kconfig
+++ b/drivers/media/usb/em28xx/Kconfig
@@ -68,6 +68,7 @@ config VIDEO_EM28XX_DVB
select MEDIA_TUNER_XC5000 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
select DVB_MXL692 if MEDIA_SUBDRV_AUTOSELECT
+ select GPIOLIB_LEGACY if GPIOLIB && DVB_CXD2820R
help
This adds support for DVB cards based on the
Empiatech em28xx chips.
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index 9fce59979e3bd..b94f5c70ab750 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -727,7 +727,7 @@ static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe)
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
struct em28xx_i2c_bus *i2c_bus = fe->dvb->priv;
struct em28xx *dev = i2c_bus->dev;
-#ifdef CONFIG_GPIOLIB
+#ifdef CONFIG_GPIOLIB_LEGACY
struct em28xx_dvb *dvb = dev->dvb;
int ret;
unsigned long flags;
@@ -1705,7 +1705,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
goto out_free;
}
-#ifdef CONFIG_GPIOLIB
+#ifdef CONFIG_GPIOLIB_LEGACY
/* enable LNA for DVB-T, DVB-T2 and DVB-C */
result = gpio_request_one(dvb->lna_gpio,
GPIOF_OUT_INIT_LOW, NULL);
--
2.51.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH AUTOSEL 6.17] ASoC: codecs: wsa883x: Handle shared reset GPIO for WSA883x speakers
[not found] <20251025160905.3857885-1-sashal@kernel.org>
2025-10-25 15:55 ` [PATCH AUTOSEL 6.17-5.4] ASoC: pxa: add GPIOLIB_LEGACY dependency Sasha Levin
2025-10-25 15:55 ` [PATCH AUTOSEL 6.17-5.15] media: em28xx: add special case for legacy gpiolib interface Sasha Levin
@ 2025-10-25 15:57 ` Sasha Levin
2 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2025-10-25 15:57 UTC (permalink / raw)
To: patches, stable
Cc: Mohammad Rafi Shaik, Krzysztof Kozlowski, Srinivas Kandagatla,
Mark Brown, Sasha Levin, srini, p.zabel, linus.walleij, brgl,
linux-sound, linux-arm-msm, linux-gpio
From: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
[ Upstream commit cf65182247761f7993737b710afe8c781699356b ]
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>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Link: https://patch.msgid.link/20250815172353.2430981-3-mohammad.rafi.shaik@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
YES
- What it fixes
- Addresses real functional issues on platforms where multiple WSA883x
amplifiers share a single shutdown/reset line (e.g.,
QCS6490-RB3Gen2). Using a plain GPIO per-device does not coordinate
shared users; one instance toggling the line can inadvertently reset
others. The patch switches to the reset controller framework with
the reset‑gpio backend to handle shared lines correctly.
- Scope and minimality
- Single-file, localized change in `sound/soc/codecs/wsa883x.c`.
- No ABI or architectural changes; strictly startup/shutdown control
path in probe.
- Optional feature: falls back to existing `powerdown-gpios` behavior
if no reset controller is provided, keeping backward compatibility.
- Specific code changes and rationale
- Adds reset framework usage
- Include added: `#include <linux/reset.h>` in
`sound/soc/codecs/wsa883x.c`.
- Private data gains an optional reset handle: `struct reset_control
*sd_reset;` alongside the existing `sd_n` GPIO
(sound/soc/codecs/wsa883x.c:462).
- Centralized assert/deassert helpers
- New helpers `wsa883x_reset_assert()` and
`wsa883x_reset_deassert()` switch between
`reset_control_assert/deassert()` and
`gpiod_direction_output(sd_n, 1/0)` depending on whether a reset
control is present.
- Robust resource acquisition with graceful fallback
- New `wsa883x_get_reset()` first tries
`devm_reset_control_get_optional_shared(dev, NULL)` and, if none,
falls back to the existing `devm_gpiod_get_optional(dev,
"powerdown", ...)` path. This keeps old DTs working while enabling
shared-reset handling when “resets”/“reset-gpios” is used.
- Safer cleanup on errors/unbind
- In `wsa883x_probe()`, instead of manually asserting the GPIO only
on regmap-init failure (previous code:
`gpiod_direction_output(wsa883x->sd_n, 1)` in the error path at
sound/soc/codecs/wsa883x.c:1579–1585), the patch calls
`wsa883x_reset_deassert(wsa883x)` to bring the device out of
reset, then registers `devm_add_action_or_reset(dev,
wsa883x_reset_assert, wsa883x)`. This guarantees the reset is
asserted on any probe failure or device removal, mirroring the
established pattern used in other codecs.
- Probe flow changes (localized, low risk)
- Replaces the hardwired GPIO bring-up:
- Old: acquire `powerdown-gpios` then
`gpiod_direction_output(sd_n, 0)` to deassert
(sound/soc/codecs/wsa883x.c:1572–1575, 1561–1568).
- New: `wsa883x_get_reset()` and `wsa883x_reset_deassert()` with
`devm_add_action_or_reset` to ensure deterministic cleanup.
Functionally equivalent for non-shared setups, but robust for
shared lines.
- Precedent and consistency
- The WSA884x codec already uses the same reset-controller-with-
fallback pattern (e.g., `sound/soc/codecs/wsa884x.c:1999–2060`),
demonstrating the approach is accepted upstream and low risk. This
change brings WSA883x in line with WSA884x.
- Backport risk assessment
- Small, contained, and backwards compatible: if no reset controller,
code behaves as before with the `powerdown-gpios` line.
- No behavioral change to runtime PM/audio paths; only reset/powerdown
handling in probe/cleanup is touched.
- No dependencies beyond standard reset framework and `reset-gpio`,
both present in stable series; the driver already builds with reset
APIs (used elsewhere in tree).
- Documentation note: current 6.17 binding for WSA883x
(`Documentation/devicetree/bindings/sound/qcom,wsa883x.yaml`) lists
`powerdown-gpios`, not `reset-gpios`/`resets`. Functionally this is
fine (fallback keeps working), but if boards want to use shared
reset via reset-gpio, a binding backport (to allow `reset-gpios` or
`resets`) may be desirable to avoid dtbs_check warnings. This is
documentation-only and does not affect runtime.
- Stable criteria
- Fixes a real platform issue (shared reset handling) affecting users.
- No new features to the audio path; no architectural refactor.
- Very low regression risk, self-contained, and aligns with existing
patterns in sibling drivers.
- While there is no explicit “Fixes:” or “Cc: stable”, the change
clearly improves correctness on affected hardware with minimal
impact elsewhere, making it a good stable candidate.
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 188363b03b937..ca4520ade79aa 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.51.0
^ permalink raw reply related [flat|nested] 7+ messages in thread