Skip to content

Commit 6a0ee2a

Browse files
mairacanalLee Jones
authored andcommitted
mfd: wcd934x: Replace legacy gpio interface for gpiod
Considering the current transition of the GPIO subsystem, remove all dependencies of the legacy GPIO interface (linux/gpio.h and linux /of_gpio.h) and replace it with the descriptor-based GPIO approach. Signed-off-by: Maíra Canal <[email protected]> Signed-off-by: Lee Jones <[email protected]> Link: https://lore.kernel.org/r/YXDEBCiSnXYRQPXt@fedora
1 parent bfe6a66 commit 6a0ee2a

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

drivers/mfd/wcd934x.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
// Copyright (c) 2019, Linaro Limited
33

44
#include <linux/clk.h>
5-
#include <linux/gpio.h>
5+
#include <linux/gpio/consumer.h>
66
#include <linux/interrupt.h>
77
#include <linux/kernel.h>
88
#include <linux/mfd/core.h>
99
#include <linux/mfd/wcd934x/registers.h>
1010
#include <linux/mfd/wcd934x/wcd934x.h>
1111
#include <linux/module.h>
12-
#include <linux/of_gpio.h>
1312
#include <linux/of.h>
1413
#include <linux/of_irq.h>
1514
#include <linux/platform_device.h>
@@ -210,7 +209,8 @@ static int wcd934x_slim_probe(struct slim_device *sdev)
210209
struct device *dev = &sdev->dev;
211210
struct device_node *np = dev->of_node;
212211
struct wcd934x_ddata *ddata;
213-
int reset_gpio, ret;
212+
struct gpio_desc *reset_gpio;
213+
int ret;
214214

215215
ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL);
216216
if (!ddata)
@@ -221,13 +221,6 @@ static int wcd934x_slim_probe(struct slim_device *sdev)
221221
return dev_err_probe(ddata->dev, ddata->irq,
222222
"Failed to get IRQ\n");
223223

224-
reset_gpio = of_get_named_gpio(np, "reset-gpios", 0);
225-
if (reset_gpio < 0) {
226-
dev_err(dev, "Failed to get reset gpio: err = %d\n",
227-
reset_gpio);
228-
return reset_gpio;
229-
}
230-
231224
ddata->extclk = devm_clk_get(dev, "extclk");
232225
if (IS_ERR(ddata->extclk)) {
233226
dev_err(dev, "Failed to get extclk");
@@ -258,9 +251,13 @@ static int wcd934x_slim_probe(struct slim_device *sdev)
258251
* SYS_RST_N shouldn't be pulled high during this time
259252
*/
260253
usleep_range(600, 650);
261-
gpio_direction_output(reset_gpio, 0);
254+
reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
255+
if (IS_ERR(reset_gpio)) {
256+
return dev_err_probe(dev, PTR_ERR(reset_gpio),
257+
"Failed to get reset gpio: err = %ld\n", PTR_ERR(reset_gpio));
258+
}
262259
msleep(20);
263-
gpio_set_value(reset_gpio, 1);
260+
gpiod_set_value(reset_gpio, 1);
264261
msleep(20);
265262

266263
ddata->dev = dev;

0 commit comments

Comments
 (0)