[PATCH v2 2/3] ASoC: pxa2xx: push gpio usage into arch code

Andy Shevchenko andriy.shevchenko at intel.com
Wed May 6 01:13:48 PDT 2026


On Tue, May 05, 2026 at 10:24:25PM +0200, Arnd Bergmann wrote:

> There are no remaining static platform_device users of pxa2xx ac97,
> so the rest of that code path can go away as well.
> 
> Since nothing in the driver uses the gpio number now, constrain the use

GPIO

> of the legacy gpio interface to the architecture specific code.

GPIO

...

>  #include <sound/pcm.h>
>  #include <sound/ac97_codec.h>
>  
> -extern void pxa27x_configure_ac97reset(int reset_gpio, bool to_gpio);
> +extern void pxa27x_configure_ac97reset(struct gpio_desc *reset_gpio, bool to_gpio);

Looks like this is the only useful line in the header, hence while at it we may
drop 'extern'.

>  #endif

...

> +	if (cpu_is_pxa27x()) {
>  		/* Assert reset using GPIOD_OUT_HIGH, because reset is GPIO_ACTIVE_LOW */
> -		rst_gpio = devm_gpiod_get(&dev->dev, "reset", GPIOD_OUT_HIGH);
> -		if (IS_ERR(rst_gpio)) {
> -			ret = PTR_ERR(rst_gpio);
> -			if (ret == -ENOENT)
> -				reset_gpio = -1;
> -			else if (ret)
> -				return ret;
> -		} else {
> -			reset_gpio = desc_to_gpio(rst_gpio);
> -		}
> -	} else {
> -		if (cpu_is_pxa27x())
> -			reset_gpio = 113;
> -	}
> +		rst_gpio = devm_gpiod_get_optional(&dev->dev, "reset",
> +						   GPIOD_OUT_HIGH);
> +		if (IS_ERR(rst_gpio))
> +			return dev_err_probe(&dev->dev, PTR_ERR(rst_gpio),
> +					     "reset gpio failed\n");

I *slightly* tend to have my patch just as preparatory for this one as it does
one logical change, this one does another. But if you think it is not worth it,
okay then.

...

Now looking at this, I am not even sure that we need that if (cpu_is_pxa27x())
since optional GPIO will return NULL and everything should work as long as
there is no mistake in DT or platform code that provides the GPIO.

But such a change should be done carefully.

-- 
With Best Regards,
Andy Shevchenko





More information about the linux-arm-kernel mailing list