Skip to content

Commit

Permalink
Merge tag 'gpio-pinctrl-updates-for-v6.7-rc1' of git://git.kernel.org…
Browse files Browse the repository at this point in the history
…/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()
  ...
  • Loading branch information
Linus Torvalds committed Nov 8, 2023
2 parents 13d88ac + 5be5547 commit dc14348
Show file tree
Hide file tree
Showing 39 changed files with 198 additions and 310 deletions.
6 changes: 3 additions & 3 deletions drivers/gpio/gpio-aspeed.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,12 +750,12 @@ static int aspeed_gpio_request(struct gpio_chip *chip, unsigned int offset)
if (!have_gpio(gpiochip_get_data(chip), offset))
return -ENODEV;

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

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

static int usecs_to_cycles(struct aspeed_gpio *gpio, unsigned long usecs,
Expand Down Expand Up @@ -973,7 +973,7 @@ static int aspeed_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
else if (param == PIN_CONFIG_BIAS_DISABLE ||
param == PIN_CONFIG_BIAS_PULL_DOWN ||
param == PIN_CONFIG_DRIVE_STRENGTH)
return pinctrl_gpio_set_config(chip->base + offset, config);
return pinctrl_gpio_set_config(chip, offset, config);
else if (param == PIN_CONFIG_DRIVE_OPEN_DRAIN ||
param == PIN_CONFIG_DRIVE_OPEN_SOURCE)
/* Return -ENOTSUPP to trigger emulation, as per datasheet */
Expand Down
9 changes: 2 additions & 7 deletions drivers/gpio/gpio-em.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,9 @@ static int em_gio_to_irq(struct gpio_chip *chip, unsigned offset)
return irq_create_mapping(gpio_to_priv(chip)->irq_domain, offset);
}

static int em_gio_request(struct gpio_chip *chip, unsigned offset)
{
return pinctrl_gpio_request(chip->base + offset);
}

static void em_gio_free(struct gpio_chip *chip, unsigned offset)
{
pinctrl_gpio_free(chip->base + offset);
pinctrl_gpio_free(chip, offset);

/* Set the GPIO as an input to ensure that the next GPIO request won't
* drive the GPIO pin as an output.
Expand Down Expand Up @@ -311,7 +306,7 @@ static int em_gio_probe(struct platform_device *pdev)
gpio_chip->direction_output = em_gio_direction_output;
gpio_chip->set = em_gio_set;
gpio_chip->to_irq = em_gio_to_irq;
gpio_chip->request = em_gio_request;
gpio_chip->request = pinctrl_gpio_request;
gpio_chip->free = em_gio_free;
gpio_chip->label = name;
gpio_chip->parent = dev;
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpio/gpio-mvebu.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ static int mvebu_gpio_direction_input(struct gpio_chip *chip, unsigned int pin)
* Check with the pinctrl driver whether this pin is usable as
* an input GPIO
*/
ret = pinctrl_gpio_direction_input(chip->base + pin);
ret = pinctrl_gpio_direction_input(chip, pin);
if (ret)
return ret;

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

Expand Down
4 changes: 2 additions & 2 deletions drivers/gpio/gpio-pxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
int ret;

if (pxa_gpio_has_pinctrl()) {
ret = pinctrl_gpio_direction_input(chip->base + offset);
ret = pinctrl_gpio_direction_input(chip, offset);
if (ret)
return ret;
}
Expand Down Expand Up @@ -289,7 +289,7 @@ static int pxa_gpio_direction_output(struct gpio_chip *chip,
writel_relaxed(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET));

if (pxa_gpio_has_pinctrl()) {
ret = pinctrl_gpio_direction_output(chip->base + offset);
ret = pinctrl_gpio_direction_output(chip, offset);
if (ret)
return ret;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpio/gpio-rcar.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset)
return error;
}

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

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

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

/*
* Set the GPIO as an input to ensure that the next GPIO request won't
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpio/gpio-rockchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ static int rockchip_gpio_set_direction(struct gpio_chip *chip,


if (input)
pinctrl_gpio_direction_input(bank->pin_base + offset);
pinctrl_gpio_direction_input(chip, offset);
else
pinctrl_gpio_direction_output(bank->pin_base + offset);
pinctrl_gpio_direction_output(chip, offset);

raw_spin_lock_irqsave(&bank->slock, flags);
rockchip_gpio_writel_bit(bank, offset, data, bank->gpio_regs->port_ddr);
Expand Down
13 changes: 4 additions & 9 deletions drivers/gpio/gpio-tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,11 @@ static void tegra_gpio_disable(struct tegra_gpio_info *tgi, unsigned int gpio)
tegra_gpio_mask_write(tgi, GPIO_MSK_CNF(tgi, gpio), gpio, 0);
}

static int tegra_gpio_request(struct gpio_chip *chip, unsigned int offset)
{
return pinctrl_gpio_request(chip->base + offset);
}

static void tegra_gpio_free(struct gpio_chip *chip, unsigned int offset)
{
struct tegra_gpio_info *tgi = gpiochip_get_data(chip);

pinctrl_gpio_free(chip->base + offset);
pinctrl_gpio_free(chip, offset);
tegra_gpio_disable(tgi, offset);
}

Expand Down Expand Up @@ -179,7 +174,7 @@ static int tegra_gpio_direction_input(struct gpio_chip *chip,
tegra_gpio_mask_write(tgi, GPIO_MSK_OE(tgi, offset), offset, 0);
tegra_gpio_enable(tgi, offset);

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

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

tgi->gc.label = "tegra-gpio";
tgi->gc.request = tegra_gpio_request;
tgi->gc.request = pinctrl_gpio_request;
tgi->gc.free = tegra_gpio_free;
tgi->gc.direction_input = tegra_gpio_direction_input;
tgi->gc.get = tegra_gpio_get;
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpio/gpio-vf610.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ static int vf610_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
vf610_gpio_writel(val, port->gpio_base + GPIO_PDDR);
}

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

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

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

static void vf610_gpio_irq_handler(struct irq_desc *desc)
Expand Down
3 changes: 1 addition & 2 deletions drivers/gpio/gpiolib-cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2287,8 +2287,7 @@ static void gpio_desc_to_lineinfo(struct gpio_desc *desc,
* FIXME: find a non-racy way to retrieve this information. Maybe a
* lock common to both frameworks?
*/
ok_for_pinctrl =
pinctrl_gpio_can_use_line(gc->base + info->offset);
ok_for_pinctrl = pinctrl_gpio_can_use_line(gc, info->offset);

spin_lock_irqsave(&gpio_lock, flags);

Expand Down
28 changes: 3 additions & 25 deletions drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1092,28 +1092,6 @@ void gpiochip_remove(struct gpio_chip *gc)
}
EXPORT_SYMBOL_GPL(gpiochip_remove);

/*
* FIXME: This will be removed soon.
*
* This function is depracated, don't use.
*/
struct gpio_chip *gpiochip_find(void *data,
int (*match)(struct gpio_chip *gc,
void *data))
{
struct gpio_device *gdev;
struct gpio_chip *gc = NULL;

gdev = gpio_device_find(data, match);
if (gdev) {
gc = gdev->chip;
gpio_device_put(gdev);
}

return gc;
}
EXPORT_SYMBOL_GPL(gpiochip_find);

/**
* gpio_device_find() - find a specific GPIO device
* @data: data to pass to match function
Expand Down Expand Up @@ -2036,7 +2014,7 @@ int gpiochip_generic_request(struct gpio_chip *gc, unsigned int offset)
return 0;
#endif

return pinctrl_gpio_request(gc->gpiodev->base + offset);
return pinctrl_gpio_request(gc, offset);
}
EXPORT_SYMBOL_GPL(gpiochip_generic_request);

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

pinctrl_gpio_free(gc->gpiodev->base + offset);
pinctrl_gpio_free(gc, offset);
}
EXPORT_SYMBOL_GPL(gpiochip_generic_free);

Expand All @@ -2065,7 +2043,7 @@ EXPORT_SYMBOL_GPL(gpiochip_generic_free);
int gpiochip_generic_config(struct gpio_chip *gc, unsigned int offset,
unsigned long config)
{
return pinctrl_gpio_set_config(gc->gpiodev->base + offset, config);
return pinctrl_gpio_set_config(gc, offset, config);
}
EXPORT_SYMBOL_GPL(gpiochip_generic_config);

Expand Down
6 changes: 2 additions & 4 deletions drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,24 +330,22 @@ static const struct irq_chip iproc_gpio_irq_chip = {
static int iproc_gpio_request(struct gpio_chip *gc, unsigned offset)
{
struct iproc_gpio *chip = gpiochip_get_data(gc);
unsigned gpio = gc->base + offset;

/* not all Iproc GPIO pins can be muxed individually */
if (!chip->pinmux_is_supported)
return 0;

return pinctrl_gpio_request(gpio);
return pinctrl_gpio_request(gc, offset);
}

static void iproc_gpio_free(struct gpio_chip *gc, unsigned offset)
{
struct iproc_gpio *chip = gpiochip_get_data(gc);
unsigned gpio = gc->base + offset;

if (!chip->pinmux_is_supported)
return;

pinctrl_gpio_free(gpio);
pinctrl_gpio_free(gc, offset);
}

static int iproc_gpio_direction_input(struct gpio_chip *gc, unsigned gpio)
Expand Down
9 changes: 2 additions & 7 deletions drivers/pinctrl/cirrus/pinctrl-cs42l43.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,17 +506,12 @@ static void cs42l43_gpio_set(struct gpio_chip *chip, unsigned int offset, int va
pm_runtime_put(priv->dev);
}

static int cs42l43_gpio_direction_in(struct gpio_chip *chip, unsigned int offset)
{
return pinctrl_gpio_direction_input(chip->base + offset);
}

static int cs42l43_gpio_direction_out(struct gpio_chip *chip,
unsigned int offset, int value)
{
cs42l43_gpio_set(chip, offset, value);

return pinctrl_gpio_direction_output(chip->base + offset);
return pinctrl_gpio_direction_output(chip, offset);
}

static int cs42l43_gpio_add_pin_ranges(struct gpio_chip *chip)
Expand Down Expand Up @@ -551,7 +546,7 @@ static int cs42l43_pin_probe(struct platform_device *pdev)

priv->gpio_chip.request = gpiochip_generic_request;
priv->gpio_chip.free = gpiochip_generic_free;
priv->gpio_chip.direction_input = cs42l43_gpio_direction_in;
priv->gpio_chip.direction_input = pinctrl_gpio_direction_input;
priv->gpio_chip.direction_output = cs42l43_gpio_direction_out;
priv->gpio_chip.add_pin_ranges = cs42l43_gpio_add_pin_ranges;
priv->gpio_chip.get = cs42l43_gpio_get;
Expand Down
2 changes: 1 addition & 1 deletion drivers/pinctrl/cirrus/pinctrl-lochnagar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ static int lochnagar_gpio_direction_out(struct gpio_chip *chip,
{
lochnagar_gpio_set(chip, offset, value);

return pinctrl_gpio_direction_output(chip->base + offset);
return pinctrl_gpio_direction_output(chip, offset);
}

static int lochnagar_fill_func_groups(struct lochnagar_pin_priv *priv)
Expand Down
Loading

0 comments on commit dc14348

Please sign in to comment.