[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260122-sound-cleanup-v1-4-0a91901609b8@nxp.com>
Date: Thu, 22 Jan 2026 20:45:00 +0800
From: "Peng Fan (OSS)" <peng.fan@....nxp.com>
To: Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
Linus Walleij <linusw@...nel.org>, Bartosz Golaszewski <brgl@...nel.org>,
Daniel Mack <daniel@...que.org>, Haojian Zhuang <haojian.zhuang@...il.com>,
Robert Jarzmik <robert.jarzmik@...e.fr>,
Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: linux-kernel@...r.kernel.org, linux-sound@...r.kernel.org,
linux-gpio@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Peng Fan <peng.fan@....com>
Subject: [PATCH 4/4] ASoC: ac97: Convert to GPIO descriptors
From: Peng Fan <peng.fan@....com>
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 <peng.fan@....com>
---
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 0a28e44118c5253054370b6d8117d8b61fa257fd..1e114dbcf93c94ef30b7b81c40ef9aa30d1271ff 100644
--- a/sound/arm/pxa2xx-ac97-lib.c
+++ b/sound/arm/pxa2xx-ac97-lib.c
@@ -13,10 +13,9 @@
#include <linux/interrupt.h>
#include <linux/clk.h>
#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
#include <linux/module.h>
#include <linux/io.h>
-#include <linux/gpio.h>
-#include <linux/of_gpio.h>
#include <linux/soc/pxa/cpu.h>
#include <sound/pxa2xx-lib.h>
@@ -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.37.1
Powered by blists - more mailing lists