Skip to content

Commit dc14348

Browse files
committed
Merge tag 'gpio-pinctrl-updates-for-v6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio/pinctrl updates from Bartosz Golaszewski: "The bulk of it is a rework of the glue layer between pinctrl and GPIO. We changed the signature of GPIO helpers for pinctrl to taking the gpio_chip/offset pair as arguments instead of using the deprecated global GPIO numberspace. The last little bit is removing the gpiochip_find() function as it now has no more users in-tree. Summary: - rework the GPIO-to-pinctrl glue code to stop using the deprecated global GPIO numberspace - remove now unused wrappers around pinctrl GPIO helpers from drivers - remove gpiochip_find() as it has no more users" * tag 'gpio-pinctrl-updates-for-v6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (70 commits) pinctrl: tegra: drop the wrapper around pinctrl_gpio_request() pinctrl: em: drop the wrapper around pinctrl_gpio_request() pinctrl: nuvoton: npcm8xx: drop wrappers around pinctrl_gpio_request/free() pinctrl: nuvoton: npcm7xx: drop wrappers around pinctrl_gpio_request/free() pinctrl: stm32: drop wrappers around pinctrl_gpio_free/input() pinctrl: starfive: jh7110: drop wrappers around pinctrl_gpio_request/free() pinctrl: starfive: jh7100: drop wrappers around pinctrl_gpio_request/free() pinctrl: ocelot: drop the wrapper around pinctrl_gpio_direction_input() pinctrl: cirrus: drop the wrapper around pinctrl_gpio_direction_input() pinctrl: mediatek: common: drop the wrappers around pinctrl_gpio_direction_input() pinctrl: mediatek: moore: drop the wrappers around pinctrl_gpio_direction_input() pinctrl: rk805: drop the wrapper around pinctrl_gpio_direction_input() pinctrl: axp209: drop the wrapper around pinctrl_gpio_direction_input() pinctrl: vt8500: drop the wrapper around pinctrl_gpio_direction_input() pinctrl: as3722: drop the wrapper around pinctrl_gpio_direction_input() pinctrl: ingenic: drop the wrapper around pinctrl_gpio_direction_input() pinctrl: st: drop the wrapper around pinctrl_gpio_direction_input() pinctrl: change the signature of pinctrl_ready_for_gpio_range() pinctrl: change the signature of gpio_to_pin() pinctrl: change the signature of pinctrl_match_gpio_range() ...
2 parents 13d88ac + 5be5547 commit dc14348

39 files changed

+198
-310
lines changed

drivers/gpio/gpio-aspeed.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -750,12 +750,12 @@ static int aspeed_gpio_request(struct gpio_chip *chip, unsigned int offset)
750750
if (!have_gpio(gpiochip_get_data(chip), offset))
751751
return -ENODEV;
752752

753-
return pinctrl_gpio_request(chip->base + offset);
753+
return pinctrl_gpio_request(chip, offset);
754754
}
755755

756756
static void aspeed_gpio_free(struct gpio_chip *chip, unsigned int offset)
757757
{
758-
pinctrl_gpio_free(chip->base + offset);
758+
pinctrl_gpio_free(chip, offset);
759759
}
760760

761761
static int usecs_to_cycles(struct aspeed_gpio *gpio, unsigned long usecs,
@@ -973,7 +973,7 @@ static int aspeed_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
973973
else if (param == PIN_CONFIG_BIAS_DISABLE ||
974974
param == PIN_CONFIG_BIAS_PULL_DOWN ||
975975
param == PIN_CONFIG_DRIVE_STRENGTH)
976-
return pinctrl_gpio_set_config(chip->base + offset, config);
976+
return pinctrl_gpio_set_config(chip, offset, config);
977977
else if (param == PIN_CONFIG_DRIVE_OPEN_DRAIN ||
978978
param == PIN_CONFIG_DRIVE_OPEN_SOURCE)
979979
/* Return -ENOTSUPP to trigger emulation, as per datasheet */

drivers/gpio/gpio-em.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,9 @@ static int em_gio_to_irq(struct gpio_chip *chip, unsigned offset)
227227
return irq_create_mapping(gpio_to_priv(chip)->irq_domain, offset);
228228
}
229229

230-
static int em_gio_request(struct gpio_chip *chip, unsigned offset)
231-
{
232-
return pinctrl_gpio_request(chip->base + offset);
233-
}
234-
235230
static void em_gio_free(struct gpio_chip *chip, unsigned offset)
236231
{
237-
pinctrl_gpio_free(chip->base + offset);
232+
pinctrl_gpio_free(chip, offset);
238233

239234
/* Set the GPIO as an input to ensure that the next GPIO request won't
240235
* drive the GPIO pin as an output.
@@ -311,7 +306,7 @@ static int em_gio_probe(struct platform_device *pdev)
311306
gpio_chip->direction_output = em_gio_direction_output;
312307
gpio_chip->set = em_gio_set;
313308
gpio_chip->to_irq = em_gio_to_irq;
314-
gpio_chip->request = em_gio_request;
309+
gpio_chip->request = pinctrl_gpio_request;
315310
gpio_chip->free = em_gio_free;
316311
gpio_chip->label = name;
317312
gpio_chip->parent = dev;

drivers/gpio/gpio-mvebu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ static int mvebu_gpio_direction_input(struct gpio_chip *chip, unsigned int pin)
346346
* Check with the pinctrl driver whether this pin is usable as
347347
* an input GPIO
348348
*/
349-
ret = pinctrl_gpio_direction_input(chip->base + pin);
349+
ret = pinctrl_gpio_direction_input(chip, pin);
350350
if (ret)
351351
return ret;
352352

@@ -366,7 +366,7 @@ static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned int pin,
366366
* Check with the pinctrl driver whether this pin is usable as
367367
* an output GPIO
368368
*/
369-
ret = pinctrl_gpio_direction_output(chip->base + pin);
369+
ret = pinctrl_gpio_direction_output(chip, pin);
370370
if (ret)
371371
return ret;
372372

drivers/gpio/gpio-pxa.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
260260
int ret;
261261

262262
if (pxa_gpio_has_pinctrl()) {
263-
ret = pinctrl_gpio_direction_input(chip->base + offset);
263+
ret = pinctrl_gpio_direction_input(chip, offset);
264264
if (ret)
265265
return ret;
266266
}
@@ -289,7 +289,7 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip,
289289
writel_relaxed(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET));
290290

291291
if (pxa_gpio_has_pinctrl()) {
292-
ret = pinctrl_gpio_direction_output(chip->base + offset);
292+
ret = pinctrl_gpio_direction_output(chip, offset);
293293
if (ret)
294294
return ret;
295295
}

drivers/gpio/gpio-rcar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset)
275275
return error;
276276
}
277277

278-
error = pinctrl_gpio_request(chip->base + offset);
278+
error = pinctrl_gpio_request(chip, offset);
279279
if (error)
280280
pm_runtime_put(p->dev);
281281

@@ -286,7 +286,7 @@ static void gpio_rcar_free(struct gpio_chip *chip, unsigned offset)
286286
{
287287
struct gpio_rcar_priv *p = gpiochip_get_data(chip);
288288

289-
pinctrl_gpio_free(chip->base + offset);
289+
pinctrl_gpio_free(chip, offset);
290290

291291
/*
292292
* Set the GPIO as an input to ensure that the next GPIO request won't

drivers/gpio/gpio-rockchip.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ static int rockchip_gpio_set_direction(struct gpio_chip *chip,
159159

160160

161161
if (input)
162-
pinctrl_gpio_direction_input(bank->pin_base + offset);
162+
pinctrl_gpio_direction_input(chip, offset);
163163
else
164-
pinctrl_gpio_direction_output(bank->pin_base + offset);
164+
pinctrl_gpio_direction_output(chip, offset);
165165

166166
raw_spin_lock_irqsave(&bank->slock, flags);
167167
rockchip_gpio_writel_bit(bank, offset, data, bank->gpio_regs->port_ddr);

drivers/gpio/gpio-tegra.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,11 @@ static void tegra_gpio_disable(struct tegra_gpio_info *tgi, unsigned int gpio)
137137
tegra_gpio_mask_write(tgi, GPIO_MSK_CNF(tgi, gpio), gpio, 0);
138138
}
139139

140-
static int tegra_gpio_request(struct gpio_chip *chip, unsigned int offset)
141-
{
142-
return pinctrl_gpio_request(chip->base + offset);
143-
}
144-
145140
static void tegra_gpio_free(struct gpio_chip *chip, unsigned int offset)
146141
{
147142
struct tegra_gpio_info *tgi = gpiochip_get_data(chip);
148143

149-
pinctrl_gpio_free(chip->base + offset);
144+
pinctrl_gpio_free(chip, offset);
150145
tegra_gpio_disable(tgi, offset);
151146
}
152147

@@ -179,7 +174,7 @@ static int tegra_gpio_direction_input(struct gpio_chip *chip,
179174
tegra_gpio_mask_write(tgi, GPIO_MSK_OE(tgi, offset), offset, 0);
180175
tegra_gpio_enable(tgi, offset);
181176

182-
ret = pinctrl_gpio_direction_input(chip->base + offset);
177+
ret = pinctrl_gpio_direction_input(chip, offset);
183178
if (ret < 0)
184179
dev_err(tgi->dev,
185180
"Failed to set pinctrl input direction of GPIO %d: %d",
@@ -199,7 +194,7 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip,
199194
tegra_gpio_mask_write(tgi, GPIO_MSK_OE(tgi, offset), offset, 1);
200195
tegra_gpio_enable(tgi, offset);
201196

202-
ret = pinctrl_gpio_direction_output(chip->base + offset);
197+
ret = pinctrl_gpio_direction_output(chip, offset);
203198
if (ret < 0)
204199
dev_err(tgi->dev,
205200
"Failed to set pinctrl output direction of GPIO %d: %d",
@@ -717,7 +712,7 @@ static int tegra_gpio_probe(struct platform_device *pdev)
717712
}
718713

719714
tgi->gc.label = "tegra-gpio";
720-
tgi->gc.request = tegra_gpio_request;
715+
tgi->gc.request = pinctrl_gpio_request;
721716
tgi->gc.free = tegra_gpio_free;
722717
tgi->gc.direction_input = tegra_gpio_direction_input;
723718
tgi->gc.get = tegra_gpio_get;

drivers/gpio/gpio-vf610.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static int vf610_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
130130
vf610_gpio_writel(val, port->gpio_base + GPIO_PDDR);
131131
}
132132

133-
return pinctrl_gpio_direction_input(chip->base + gpio);
133+
return pinctrl_gpio_direction_input(chip, gpio);
134134
}
135135

136136
static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
@@ -148,7 +148,7 @@ static int vf610_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
148148
vf610_gpio_writel(val, port->gpio_base + GPIO_PDDR);
149149
}
150150

151-
return pinctrl_gpio_direction_output(chip->base + gpio);
151+
return pinctrl_gpio_direction_output(chip, gpio);
152152
}
153153

154154
static void vf610_gpio_irq_handler(struct irq_desc *desc)

drivers/gpio/gpiolib-cdev.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2287,8 +2287,7 @@ static void gpio_desc_to_lineinfo(struct gpio_desc *desc,
22872287
* FIXME: find a non-racy way to retrieve this information. Maybe a
22882288
* lock common to both frameworks?
22892289
*/
2290-
ok_for_pinctrl =
2291-
pinctrl_gpio_can_use_line(gc->base + info->offset);
2290+
ok_for_pinctrl = pinctrl_gpio_can_use_line(gc, info->offset);
22922291

22932292
spin_lock_irqsave(&gpio_lock, flags);
22942293

drivers/gpio/gpiolib.c

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,28 +1092,6 @@ void gpiochip_remove(struct gpio_chip *gc)
10921092
}
10931093
EXPORT_SYMBOL_GPL(gpiochip_remove);
10941094

1095-
/*
1096-
* FIXME: This will be removed soon.
1097-
*
1098-
* This function is depracated, don't use.
1099-
*/
1100-
struct gpio_chip *gpiochip_find(void *data,
1101-
int (*match)(struct gpio_chip *gc,
1102-
void *data))
1103-
{
1104-
struct gpio_device *gdev;
1105-
struct gpio_chip *gc = NULL;
1106-
1107-
gdev = gpio_device_find(data, match);
1108-
if (gdev) {
1109-
gc = gdev->chip;
1110-
gpio_device_put(gdev);
1111-
}
1112-
1113-
return gc;
1114-
}
1115-
EXPORT_SYMBOL_GPL(gpiochip_find);
1116-
11171095
/**
11181096
* gpio_device_find() - find a specific GPIO device
11191097
* @data: data to pass to match function
@@ -2036,7 +2014,7 @@ int gpiochip_generic_request(struct gpio_chip *gc, unsigned int offset)
20362014
return 0;
20372015
#endif
20382016

2039-
return pinctrl_gpio_request(gc->gpiodev->base + offset);
2017+
return pinctrl_gpio_request(gc, offset);
20402018
}
20412019
EXPORT_SYMBOL_GPL(gpiochip_generic_request);
20422020

@@ -2052,7 +2030,7 @@ void gpiochip_generic_free(struct gpio_chip *gc, unsigned int offset)
20522030
return;
20532031
#endif
20542032

2055-
pinctrl_gpio_free(gc->gpiodev->base + offset);
2033+
pinctrl_gpio_free(gc, offset);
20562034
}
20572035
EXPORT_SYMBOL_GPL(gpiochip_generic_free);
20582036

@@ -2065,7 +2043,7 @@ EXPORT_SYMBOL_GPL(gpiochip_generic_free);
20652043
int gpiochip_generic_config(struct gpio_chip *gc, unsigned int offset,
20662044
unsigned long config)
20672045
{
2068-
return pinctrl_gpio_set_config(gc->gpiodev->base + offset, config);
2046+
return pinctrl_gpio_set_config(gc, offset, config);
20692047
}
20702048
EXPORT_SYMBOL_GPL(gpiochip_generic_config);
20712049

0 commit comments

Comments
 (0)