Re: [PATCH v1 2/2] ASoC: codecs: wsa883x: Handle shared reset GPIO for WSA883x speakers

From: Philipp Zabel
Date: Mon Jun 23 2025 - 03:00:35 EST


On Fr, 2025-06-20 at 16:00 +0530, Mohammad Rafi Shaik wrote:
> On some Qualcomm platforms, such as QCS6490-RB3Gen2 and QCM6490-IDP,
> 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.
>
> Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@xxxxxxxxxxxxxxxx>
> ---
> sound/soc/codecs/wsa883x.c | 57 ++++++++++++++++++++++++++++++++------
> 1 file changed, 48 insertions(+), 9 deletions(-)
>
> diff --git a/sound/soc/codecs/wsa883x.c b/sound/soc/codecs/wsa883x.c
> index 13c9d4a6f015..b82b925c1f8d 100644
> --- a/sound/soc/codecs/wsa883x.c
> +++ b/sound/soc/codecs/wsa883x.c
[...]
> @@ -1547,6 +1549,44 @@ static const struct hwmon_chip_info wsa883x_hwmon_chip_info = {
> .info = wsa883x_hwmon_info,
> };
>
> +static void wsa883x_reset_powerdown(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);

Since this driver only deasserts/asserts on probe/remove, you could use
devm_reset_control_get_optional_shared_deasserted() and let the
framework code handle the (de)assertion of sd_reset.

I wonder if the codec could also be put into reset during (runtime)
suspend.

regards
Philipp