mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 10:33:41 +02:00
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 <peng.fan@nxp.com> Link: https://patch.msgid.link/20260122-sound-cleanup-v1-4-0a91901609b8@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
be829277ef
commit
c76d50b71e
|
|
@ -13,10 +13,9 @@
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
|
#include <linux/gpio/consumer.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/gpio.h>
|
|
||||||
#include <linux/of_gpio.h>
|
|
||||||
#include <linux/soc/pxa/cpu.h>
|
#include <linux/soc/pxa/cpu.h>
|
||||||
|
|
||||||
#include <sound/pxa2xx-lib.h>
|
#include <sound/pxa2xx-lib.h>
|
||||||
|
|
@ -31,6 +30,7 @@ static volatile long gsr_bits;
|
||||||
static struct clk *ac97_clk;
|
static struct clk *ac97_clk;
|
||||||
static struct clk *ac97conf_clk;
|
static struct clk *ac97conf_clk;
|
||||||
static int reset_gpio;
|
static int reset_gpio;
|
||||||
|
struct gpio_desc *rst_gpio;
|
||||||
static void __iomem *ac97_reg_base;
|
static void __iomem *ac97_reg_base;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -329,11 +329,14 @@ int pxa2xx_ac97_hw_probe(struct platform_device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->dev.of_node) {
|
if (dev->dev.of_node) {
|
||||||
reset_gpio = of_get_named_gpio(dev->dev.of_node, "reset-gpios", 0);
|
/* Assert reset using GPIOD_OUT_HIGH, because reset is GPIO_ACTIVE_LOW */
|
||||||
if (reset_gpio == -ENOENT)
|
rst_gpio = devm_gpiod_get(&dev->dev, "reset", GPIOD_OUT_HIGH);
|
||||||
|
ret = PTR_ERR(rst_gpio);
|
||||||
|
if (ret == -ENOENT)
|
||||||
reset_gpio = -1;
|
reset_gpio = -1;
|
||||||
else if (reset_gpio < 0)
|
else if (ret)
|
||||||
return reset_gpio;
|
return ret;
|
||||||
|
reset_gpio = desc_to_gpio(rst_gpio);
|
||||||
} else {
|
} else {
|
||||||
if (cpu_is_pxa27x())
|
if (cpu_is_pxa27x())
|
||||||
reset_gpio = 113;
|
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
|
* here so that it is an output driven high when switching from
|
||||||
* AC97_nRESET alt function to generic gpio.
|
* AC97_nRESET alt function to generic gpio.
|
||||||
*/
|
*/
|
||||||
ret = gpio_request_one(reset_gpio, GPIOF_OUT_INIT_HIGH,
|
gpiod_set_consumer_name(rst_gpio, "pxa27x ac97 reset");
|
||||||
"pxa27x ac97 reset");
|
|
||||||
if (ret < 0) {
|
|
||||||
pr_err("%s: gpio_request_one() failed: %d\n",
|
|
||||||
__func__, ret);
|
|
||||||
goto err_conf;
|
|
||||||
}
|
|
||||||
pxa27x_configure_ac97reset(reset_gpio, false);
|
pxa27x_configure_ac97reset(reset_gpio, false);
|
||||||
|
|
||||||
ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK");
|
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)
|
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);
|
writel(readl(ac97_reg_base + GCR) | (GCR_ACLINK_OFF), ac97_reg_base + GCR);
|
||||||
free_irq(platform_get_irq(dev, 0), NULL);
|
free_irq(platform_get_irq(dev, 0), NULL);
|
||||||
if (ac97conf_clk) {
|
if (ac97conf_clk) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user