gpio fixes for v5.19-rc4

- make the irqchip immutable in gpio-realtek-otto
 - fix error code propagation in gpio-winbond
 - fix device removing in gpio-grgpio
 - fix a typo in gpio-mxs which indicates the driver is for a different model
 - documentation fixes
 - MAINTAINERS file updates
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmK2Ra0ACgkQEacuoBRx
 13JXoBAAiev+IHynWHmyv27EwIH5/oH3WaAPyri15NteOnRNUr9CjVbXKX1q0Qhn
 3iAtQuydF3iqjqwZrSKZ01fiSJNPjnqEJigKXVDse75LmOzhlvpjGAmfiBGtrafA
 N5Xw1Z80hgAT450mRHqr4EJafVloApK0LI2DDFrqj9Q/venYZMfbrC3/FzpbiPaD
 ADnL6xmbNuG4R+UA/wIMCgaErmvCOMEupkiFUOdJ4UuEIzG42wHlWbWwohUyQ9SM
 O7S2MJds/mfH7tPpYCZL8FqOxZTfDHCPtnrhWdfVZFSRUClXDMnLdyk7PTu2nALo
 6LZODL02ME5p9osRBymmYxqaUbfpR0rV6OJw+dGsZmdgw5s9Jv1HFn2Ph4C2+ul2
 OrgQp/ZjR2LvSXDbORDX+QcsOv5V/tmEvRtZVX3UyERJ3NtArrXYk7A5EuayP3Sk
 nJ+bhrUwqdFWijoCCecvSGjVEj7SkIY9Og5clSktTKHz5ZBq65DOX1GtfllkufAi
 Cb6vt6IgUoKJOj2tGK8wRiiKYT6jNaDKFlW7BceTrrXcP3/AsF4fBs0KtAewJmA6
 Szq4ys6SqiAEm1gQ6iq77d3+ZT8h5z+6Yzl1/FL+ii4PNjQGJ83P6GIzkJz+Oncf
 0uTi6WJatx76Aw7kQyT4t2dWyMe2EPAv0JoMt1DV37qYPPHdkl8=
 =0wLZ
 -----END PGP SIGNATURE-----

Merge tag 'gpio-fixes-for-v5.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio fixes from Bartosz Golaszewski:

 - make the irqchip immutable in gpio-realtek-otto

 - fix error code propagation in gpio-winbond

 - fix device removing in gpio-grgpio

 - fix a typo in gpio-mxs which indicates the driver is for a different
   model

 - documentation fixes

 - MAINTAINERS file updates

* tag 'gpio-fixes-for-v5.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
  gpio: mxs: Fix header comment
  gpio: Fix kernel-doc comments to nested union
  gpio: grgpio: Fix device removing
  gpio: winbond: Fix error code in winbond_gpio_get()
  gpio: realtek-otto: Make the irqchip immutable
  docs: driver-api: gpio: Fix filename mismatch
  MAINTAINERS: add include/dt-bindings/gpio to GPIO SUBSYSTEM
This commit is contained in:
Linus Torvalds 2022-06-24 17:01:31 -07:00
commit 8c23f235a6
9 changed files with 38 additions and 39 deletions

View File

@ -6,7 +6,7 @@ This document explains how GPIOs can be assigned to given devices and functions.
Note that it only applies to the new descriptor-based interface. For a Note that it only applies to the new descriptor-based interface. For a
description of the deprecated integer-based GPIO interface please refer to description of the deprecated integer-based GPIO interface please refer to
gpio-legacy.txt (actually, there is no real mapping possible with the old legacy.rst (actually, there is no real mapping possible with the old
interface; you just fetch an integer from somewhere and request the interface; you just fetch an integer from somewhere and request the
corresponding GPIO). corresponding GPIO).

View File

@ -4,7 +4,7 @@ GPIO Descriptor Consumer Interface
This document describes the consumer interface of the GPIO framework. Note that This document describes the consumer interface of the GPIO framework. Note that
it describes the new descriptor-based interface. For a description of the it describes the new descriptor-based interface. For a description of the
deprecated integer-based GPIO interface please refer to gpio-legacy.txt. deprecated integer-based GPIO interface please refer to legacy.rst.
Guidelines for GPIOs consumers Guidelines for GPIOs consumers
@ -78,7 +78,7 @@ whether the line is configured active high or active low (see
The two last flags are used for use cases where open drain is mandatory, such The two last flags are used for use cases where open drain is mandatory, such
as I2C: if the line is not already configured as open drain in the mappings as I2C: if the line is not already configured as open drain in the mappings
(see board.txt), then open drain will be enforced anyway and a warning will be (see board.rst), then open drain will be enforced anyway and a warning will be
printed that the board configuration needs to be updated to match the use case. printed that the board configuration needs to be updated to match the use case.
Both functions return either a valid GPIO descriptor, or an error code checkable Both functions return either a valid GPIO descriptor, or an error code checkable
@ -270,7 +270,7 @@ driven.
The same is applicable for open drain or open source output lines: those do not The same is applicable for open drain or open source output lines: those do not
actively drive their output high (open drain) or low (open source), they just actively drive their output high (open drain) or low (open source), they just
switch their output to a high impedance value. The consumer should not need to switch their output to a high impedance value. The consumer should not need to
care. (For details read about open drain in driver.txt.) care. (For details read about open drain in driver.rst.)
With this, all the gpiod_set_(array)_value_xxx() functions interpret the With this, all the gpiod_set_(array)_value_xxx() functions interpret the
parameter "value" as "asserted" ("1") or "de-asserted" ("0"). The physical line parameter "value" as "asserted" ("1") or "de-asserted" ("0"). The physical line

View File

@ -14,12 +14,12 @@ Due to the history of GPIO interfaces in the kernel, there are two different
ways to obtain and use GPIOs: ways to obtain and use GPIOs:
- The descriptor-based interface is the preferred way to manipulate GPIOs, - The descriptor-based interface is the preferred way to manipulate GPIOs,
and is described by all the files in this directory excepted gpio-legacy.txt. and is described by all the files in this directory excepted legacy.rst.
- The legacy integer-based interface which is considered deprecated (but still - The legacy integer-based interface which is considered deprecated (but still
usable for compatibility reasons) is documented in gpio-legacy.txt. usable for compatibility reasons) is documented in legacy.rst.
The remainder of this document applies to the new descriptor-based interface. The remainder of this document applies to the new descriptor-based interface.
gpio-legacy.txt contains the same information applied to the legacy legacy.rst contains the same information applied to the legacy
integer-based interface. integer-based interface.

View File

@ -8498,6 +8498,7 @@ F: Documentation/devicetree/bindings/gpio/
F: Documentation/driver-api/gpio/ F: Documentation/driver-api/gpio/
F: drivers/gpio/ F: drivers/gpio/
F: include/asm-generic/gpio.h F: include/asm-generic/gpio.h
F: include/dt-bindings/gpio/
F: include/linux/gpio.h F: include/linux/gpio.h
F: include/linux/gpio/ F: include/linux/gpio/
F: include/linux/of_gpio.h F: include/linux/of_gpio.h

View File

@ -434,25 +434,13 @@ static int grgpio_probe(struct platform_device *ofdev)
static int grgpio_remove(struct platform_device *ofdev) static int grgpio_remove(struct platform_device *ofdev)
{ {
struct grgpio_priv *priv = platform_get_drvdata(ofdev); struct grgpio_priv *priv = platform_get_drvdata(ofdev);
int i;
int ret = 0;
if (priv->domain) {
for (i = 0; i < GRGPIO_MAX_NGPIO; i++) {
if (priv->uirqs[i].refcnt != 0) {
ret = -EBUSY;
goto out;
}
}
}
gpiochip_remove(&priv->gc); gpiochip_remove(&priv->gc);
if (priv->domain) if (priv->domain)
irq_domain_remove(priv->domain); irq_domain_remove(priv->domain);
out: return 0;
return ret;
} }
static const struct of_device_id grgpio_match[] = { static const struct of_device_id grgpio_match[] = {

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0+ // SPDX-License-Identifier: GPL-2.0+
// //
// MXC GPIO support. (c) 2008 Daniel Mack <daniel@caiaq.de> // MXS GPIO support. (c) 2008 Daniel Mack <daniel@caiaq.de>
// Copyright 2008 Juergen Beisert, kernel@pengutronix.de // Copyright 2008 Juergen Beisert, kernel@pengutronix.de
// //
// Based on code from Freescale, // Based on code from Freescale,

View File

@ -172,6 +172,8 @@ static void realtek_gpio_irq_unmask(struct irq_data *data)
unsigned long flags; unsigned long flags;
u16 m; u16 m;
gpiochip_enable_irq(&ctrl->gc, line);
raw_spin_lock_irqsave(&ctrl->lock, flags); raw_spin_lock_irqsave(&ctrl->lock, flags);
m = ctrl->intr_mask[port]; m = ctrl->intr_mask[port];
m |= realtek_gpio_imr_bits(port_pin, REALTEK_GPIO_IMR_LINE_MASK); m |= realtek_gpio_imr_bits(port_pin, REALTEK_GPIO_IMR_LINE_MASK);
@ -195,6 +197,8 @@ static void realtek_gpio_irq_mask(struct irq_data *data)
ctrl->intr_mask[port] = m; ctrl->intr_mask[port] = m;
realtek_gpio_write_imr(ctrl, port, ctrl->intr_type[port], m); realtek_gpio_write_imr(ctrl, port, ctrl->intr_type[port], m);
raw_spin_unlock_irqrestore(&ctrl->lock, flags); raw_spin_unlock_irqrestore(&ctrl->lock, flags);
gpiochip_disable_irq(&ctrl->gc, line);
} }
static int realtek_gpio_irq_set_type(struct irq_data *data, unsigned int flow_type) static int realtek_gpio_irq_set_type(struct irq_data *data, unsigned int flow_type)
@ -315,13 +319,15 @@ static int realtek_gpio_irq_init(struct gpio_chip *gc)
return 0; return 0;
} }
static struct irq_chip realtek_gpio_irq_chip = { static const struct irq_chip realtek_gpio_irq_chip = {
.name = "realtek-otto-gpio", .name = "realtek-otto-gpio",
.irq_ack = realtek_gpio_irq_ack, .irq_ack = realtek_gpio_irq_ack,
.irq_mask = realtek_gpio_irq_mask, .irq_mask = realtek_gpio_irq_mask,
.irq_unmask = realtek_gpio_irq_unmask, .irq_unmask = realtek_gpio_irq_unmask,
.irq_set_type = realtek_gpio_irq_set_type, .irq_set_type = realtek_gpio_irq_set_type,
.irq_set_affinity = realtek_gpio_irq_set_affinity, .irq_set_affinity = realtek_gpio_irq_set_affinity,
.flags = IRQCHIP_IMMUTABLE,
GPIOCHIP_IRQ_RESOURCE_HELPERS,
}; };
static const struct of_device_id realtek_gpio_of_match[] = { static const struct of_device_id realtek_gpio_of_match[] = {
@ -404,7 +410,7 @@ static int realtek_gpio_probe(struct platform_device *pdev)
irq = platform_get_irq_optional(pdev, 0); irq = platform_get_irq_optional(pdev, 0);
if (!(dev_flags & GPIO_INTERRUPTS_DISABLED) && irq > 0) { if (!(dev_flags & GPIO_INTERRUPTS_DISABLED) && irq > 0) {
girq = &ctrl->gc.irq; girq = &ctrl->gc.irq;
girq->chip = &realtek_gpio_irq_chip; gpio_irq_chip_set_chip(girq, &realtek_gpio_irq_chip);
girq->default_type = IRQ_TYPE_NONE; girq->default_type = IRQ_TYPE_NONE;
girq->handler = handle_bad_irq; girq->handler = handle_bad_irq;
girq->parent_handler = realtek_gpio_irq_handler; girq->parent_handler = realtek_gpio_irq_handler;

View File

@ -385,12 +385,13 @@ static int winbond_gpio_get(struct gpio_chip *gc, unsigned int offset)
unsigned long *base = gpiochip_get_data(gc); unsigned long *base = gpiochip_get_data(gc);
const struct winbond_gpio_info *info; const struct winbond_gpio_info *info;
bool val; bool val;
int ret;
winbond_gpio_get_info(&offset, &info); winbond_gpio_get_info(&offset, &info);
val = winbond_sio_enter(*base); ret = winbond_sio_enter(*base);
if (val) if (ret)
return val; return ret;
winbond_sio_select_logical(*base, info->dev); winbond_sio_select_logical(*base, info->dev);

View File

@ -167,21 +167,24 @@ struct gpio_irq_chip {
*/ */
irq_flow_handler_t parent_handler; irq_flow_handler_t parent_handler;
/**
* @parent_handler_data:
*
* If @per_parent_data is false, @parent_handler_data is a single
* pointer used as the data associated with every parent interrupt.
*
* @parent_handler_data_array:
*
* If @per_parent_data is true, @parent_handler_data_array is
* an array of @num_parents pointers, and is used to associate
* different data for each parent. This cannot be NULL if
* @per_parent_data is true.
*/
union { union {
/**
* @parent_handler_data:
*
* If @per_parent_data is false, @parent_handler_data is a
* single pointer used as the data associated with every
* parent interrupt.
*/
void *parent_handler_data; void *parent_handler_data;
/**
* @parent_handler_data_array:
*
* If @per_parent_data is true, @parent_handler_data_array is
* an array of @num_parents pointers, and is used to associate
* different data for each parent. This cannot be NULL if
* @per_parent_data is true.
*/
void **parent_handler_data_array; void **parent_handler_data_array;
}; };