#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>
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;
/*
}
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;
* 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");
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) {