From c76d50b71e898694c946993eb3c77f50efa97254 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Thu, 22 Jan 2026 20:45:00 +0800 Subject: [PATCH] ASoC: ac97: Convert to GPIO descriptors of_gpio.h is deprecated, update the driver to use GPIO descriptors. - Use devm_gpiod_get to get GPIO descriptor, and set consumer name. Since the driver still pass the reset_gpio to pxa27x_configure_ac97reset, so use desc_to_gpio() to get it gpio id. Signed-off-by: Peng Fan Link: https://patch.msgid.link/20260122-sound-cleanup-v1-4-0a91901609b8@nxp.com Signed-off-by: Mark Brown --- sound/arm/pxa2xx-ac97-lib.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c index 0a28e44118c5..1e114dbcf93c 100644 --- a/sound/arm/pxa2xx-ac97-lib.c +++ b/sound/arm/pxa2xx-ac97-lib.c @@ -13,10 +13,9 @@ #include #include #include +#include #include #include -#include -#include #include #include @@ -31,6 +30,7 @@ static volatile long gsr_bits; static struct clk *ac97_clk; static struct clk *ac97conf_clk; static int reset_gpio; +struct gpio_desc *rst_gpio; static void __iomem *ac97_reg_base; /* @@ -329,11 +329,14 @@ int pxa2xx_ac97_hw_probe(struct platform_device *dev) } if (dev->dev.of_node) { - reset_gpio = of_get_named_gpio(dev->dev.of_node, "reset-gpios", 0); - if (reset_gpio == -ENOENT) + /* Assert reset using GPIOD_OUT_HIGH, because reset is GPIO_ACTIVE_LOW */ + rst_gpio = devm_gpiod_get(&dev->dev, "reset", GPIOD_OUT_HIGH); + ret = PTR_ERR(rst_gpio); + if (ret == -ENOENT) reset_gpio = -1; - else if (reset_gpio < 0) - return reset_gpio; + else if (ret) + return ret; + reset_gpio = desc_to_gpio(rst_gpio); } else { if (cpu_is_pxa27x()) reset_gpio = 113; @@ -346,13 +349,7 @@ int pxa2xx_ac97_hw_probe(struct platform_device *dev) * here so that it is an output driven high when switching from * AC97_nRESET alt function to generic gpio. */ - ret = gpio_request_one(reset_gpio, GPIOF_OUT_INIT_HIGH, - "pxa27x ac97 reset"); - if (ret < 0) { - pr_err("%s: gpio_request_one() failed: %d\n", - __func__, ret); - goto err_conf; - } + gpiod_set_consumer_name(rst_gpio, "pxa27x ac97 reset"); pxa27x_configure_ac97reset(reset_gpio, false); ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK"); @@ -403,8 +400,6 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_probe); void pxa2xx_ac97_hw_remove(struct platform_device *dev) { - if (cpu_is_pxa27x()) - gpio_free(reset_gpio); writel(readl(ac97_reg_base + GCR) | (GCR_ACLINK_OFF), ac97_reg_base + GCR); free_irq(platform_get_irq(dev, 0), NULL); if (ac97conf_clk) { -- 2.47.3