Commit 30a464a8 authored by Linus Walleij's avatar Linus Walleij
Browse files

Merge tag 'gpio-updates-for-v5.7-part4' of...

Merge tag 'gpio-updates-for-v5.7-part4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into devel

gpio updates for v5.7 part 4

- improve comments in the uapi header
- fix documentation issues
- add a warning to gpio-pl061 when the IRQ line is not configured
- allow building gpio-mxc and gpio-mxs with COMPILE_TEST enabled
- don't print an error message when an optional IRQ is missing in gpio-mvebu
- fix a potential segfault in gpio-hammer
- fix a couple typos and coding style issues in gpio tools
- provide a new flag in gpio-mmio and use it in mt7621 to fix an issue with
  the controller ignoring value setting when a GPIO is in input mode
- slightly refactor gpio_name_to_desc()
parents a28e1c05 97551625
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -416,7 +416,7 @@ The preferred way to set up the helpers is to fill in the
struct gpio_irq_chip inside struct gpio_chip before adding the gpio_chip.
If you do this, the additional irq_chip will be set up by gpiolib at the
same time as setting up the rest of the GPIO functionality. The following
is a typical example of a cascaded interrupt handler using gpio_irq_chip::
is a typical example of a cascaded interrupt handler using gpio_irq_chip:

.. code-block:: c

@@ -453,7 +453,7 @@ is a typical example of a cascaded interrupt handler using gpio_irq_chip::
  return devm_gpiochip_add_data(dev, &g->gc, g);

The helper support using hierarchical interrupt controllers as well.
In this case the typical set-up will look like this::
In this case the typical set-up will look like this:

.. code-block:: c

+2 −2
Original line number Diff line number Diff line
@@ -394,13 +394,13 @@ config GPIO_MVEBU

config GPIO_MXC
	def_bool y
	depends on ARCH_MXC
	depends on ARCH_MXC || COMPILE_TEST
	select GPIO_GENERIC
	select GENERIC_IRQ_CHIP

config GPIO_MXS
	def_bool y
	depends on ARCH_MXS
	depends on ARCH_MXS || COMPILE_TEST
	select GPIO_GENERIC
	select GENERIC_IRQ_CHIP

+19 −4
Original line number Diff line number Diff line
@@ -389,12 +389,10 @@ static int bgpio_get_dir(struct gpio_chip *gc, unsigned int gpio)
	return GPIO_LINE_DIRECTION_IN;
}

static int bgpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
static void bgpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
{
	unsigned long flags;

	gc->set(gc, gpio, val);

	spin_lock_irqsave(&gc->bgpio_lock, flags);

	gc->bgpio_dir |= bgpio_line2mask(gc, gpio);
@@ -405,7 +403,21 @@ static int bgpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
		gc->write_reg(gc->reg_dir_out, gc->bgpio_dir);

	spin_unlock_irqrestore(&gc->bgpio_lock, flags);
}

static int bgpio_dir_out_dir_first(struct gpio_chip *gc, unsigned int gpio,
				   int val)
{
	bgpio_dir_out(gc, gpio, val);
	gc->set(gc, gpio, val);
	return 0;
}

static int bgpio_dir_out_val_first(struct gpio_chip *gc, unsigned int gpio,
				   int val)
{
	gc->set(gc, gpio, val);
	bgpio_dir_out(gc, gpio, val);
	return 0;
}

@@ -538,7 +550,10 @@ static int bgpio_setup_direction(struct gpio_chip *gc,
	if (dirout || dirin) {
		gc->reg_dir_out = dirout;
		gc->reg_dir_in = dirin;
		gc->direction_output = bgpio_dir_out;
		if (flags & BGPIOF_NO_SET_ON_INPUT)
			gc->direction_output = bgpio_dir_out_dir_first;
		else
			gc->direction_output = bgpio_dir_out_val_first;
		gc->direction_input = bgpio_dir_in;
		gc->get_direction = bgpio_get_dir;
	} else {
+2 −2
Original line number Diff line number Diff line
@@ -227,8 +227,8 @@ mediatek_gpio_bank_probe(struct device *dev,
	ctrl = mtk->base + GPIO_REG_DCLR + (rg->bank * GPIO_BANK_STRIDE);
	diro = mtk->base + GPIO_REG_CTRL + (rg->bank * GPIO_BANK_STRIDE);

	ret = bgpio_init(&rg->chip, dev, 4,
			 dat, set, ctrl, diro, NULL, 0);
	ret = bgpio_init(&rg->chip, dev, 4, dat, set, ctrl, diro, NULL,
			 BGPIOF_NO_SET_ON_INPUT);
	if (ret) {
		dev_err(dev, "bgpio_init() failed\n");
		return ret;
+1 −1
Original line number Diff line number Diff line
@@ -1247,7 +1247,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
	 * pins.
	 */
	for (i = 0; i < 4; i++) {
		int irq = platform_get_irq(pdev, i);
		int irq = platform_get_irq_optional(pdev, i);

		if (irq < 0)
			continue;
Loading