Skip to content

Commit

Permalink
Merge tag 'gpio-updates-for-v6.2' of git://git.kernel.org/pub/scm/lin…
Browse files Browse the repository at this point in the history
…ux/kernel/git/brgl/linux

Pull gpio updates from Bartosz Golaszewski:
 "We have a new GPIO multiplexer driver, bunch of driver updates and
  refactoring in the core GPIO library.

  GPIO core:
   - teach gpiolib to work with software nodes for HW description
   - remove ARCH_NR_GPIOS treewide as we no longer impose any limit on
     the number of GPIOS since the allocation became entirely dynamic
   - add support for HW quirks for Cirrus CS42L56 codec, Marvell NFC
     controller, Freescale PCIe and Ethernet controller, Himax LCDs and
     Mediatek mt2701
   - refactor OF quirk code
   - some general refactoring of the OF and ACPI code, adding new
     helpers, minor tweaks and fixes, making fwnode usage consistent
     etc.

  GPIO uAPI:
   - fix an issue where the user-space can trigger a NULL-pointer
     dereference in the kernel by opening a device file, forcing a
     driver unbind and then calling one of the syscalls on the
     associated file descriptor

  New drivers:
   - add gpio-latch: a new GPIO multiplexer based on latches connected
     to other GPIOs

  Driver updates:
   - convert i2c GPIO expanders to using .probe_new()
   - drop the gpio-sta2x11 driver
   - factor out common code for the ACCES IDIO-16 family of controllers
     and use this new library wherever applicable in drivers
   - add DT support to gpio-hisi
   - allow building gpio-davinci as a module and increase its maxItems
     property
   - add support for a new model to gpio-pca9570
   - other minor changes to various drivers"

* tag 'gpio-updates-for-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (66 commits)
  gpio: sim: set a limit on the number of GPIOs
  gpiolib: protect the GPIO device against being dropped while in use by user-space
  gpiolib: cdev: fix NULL-pointer dereferences
  gpiolib: Provide to_gpio_device() helper
  gpiolib: Unify access to the device properties
  gpio: Do not include <linux/kernel.h> when not really needed.
  gpio: pcf857x: Convert to i2c's .probe_new()
  gpio: pca953x: Convert to i2c's .probe_new()
  gpio: max732x: Convert to i2c's .probe_new()
  dt-bindings: gpio: gpio-davinci: Increase maxItems in gpio-line-names
  gpiolib: ensure that fwnode is properly set
  gpio: sl28cpld: Replace irqchip mask_invert with unmask_base
  gpiolib: of: Use correct fwnode for DT-probed chips
  gpiolib: of: Drop redundant check in of_mm_gpiochip_remove()
  gpiolib: of: Prepare of_mm_gpiochip_add_data() for fwnode
  gpiolib: add support for software nodes
  gpiolib: consolidate GPIO lookups
  gpiolib: acpi: avoid leaking ACPI details into upper gpiolib layers
  gpiolib: acpi: teach acpi_find_gpio() to handle data-only nodes
  gpiolib: acpi: change acpi_find_gpio() to accept firmware node
  ...
  • Loading branch information
Linus Torvalds committed Dec 15, 2022
2 parents 9fa4abc + 11e47bb commit c0f234f
Show file tree
Hide file tree
Showing 50 changed files with 1,614 additions and 1,213 deletions.
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/gpio/gpio-davinci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ properties:
gpio-line-names:
description: strings describing the names of each gpio line.
minItems: 1
maxItems: 100
maxItems: 144

"#gpio-cells":
const: 2
Expand Down
94 changes: 94 additions & 0 deletions Documentation/devicetree/bindings/gpio/gpio-latch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/gpio/gpio-latch.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: GPIO latch controller

maintainers:
- Sascha Hauer <s.hauer@pengutronix.de>

description: |
This binding describes a GPIO multiplexer based on latches connected to
other GPIOs, like this:
CLK0 ----------------------. ,--------.
CLK1 -------------------. `--------|> #0 |
| | |
OUT0 ----------------+--|-----------|D0 Q0|-----|<
OUT1 --------------+-|--|-----------|D1 Q1|-----|<
OUT2 ------------+-|-|--|-----------|D2 Q2|-----|<
OUT3 ----------+-|-|-|--|-----------|D3 Q3|-----|<
OUT4 --------+-|-|-|-|--|-----------|D4 Q4|-----|<
OUT5 ------+-|-|-|-|-|--|-----------|D5 Q5|-----|<
OUT6 ----+-|-|-|-|-|-|--|-----------|D6 Q6|-----|<
OUT7 --+-|-|-|-|-|-|-|--|-----------|D7 Q7|-----|<
| | | | | | | | | `--------'
| | | | | | | | |
| | | | | | | | | ,--------.
| | | | | | | | `-----------|> #1 |
| | | | | | | | | |
| | | | | | | `--------------|D0 Q0|-----|<
| | | | | | `----------------|D1 Q1|-----|<
| | | | | `------------------|D2 Q2|-----|<
| | | | `--------------------|D3 Q3|-----|<
| | | `----------------------|D4 Q4|-----|<
| | `------------------------|D5 Q5|-----|<
| `--------------------------|D6 Q6|-----|<
`----------------------------|D7 Q7|-----|<
`--------'
The number of clk-gpios and latched-gpios is not fixed. The actual number
of number of latches and the number of inputs per latch is derived from
the number of GPIOs given in the corresponding device tree properties.
properties:
compatible:
const: gpio-latch
"#gpio-cells":
const: 2

clk-gpios:
description: Array of GPIOs to be used to clock a latch

latched-gpios:
description: Array of GPIOs to be used as inputs per latch

setup-duration-ns:
description: Delay in nanoseconds to wait after the latch inputs have been
set up

clock-duration-ns:
description: Delay in nanoseconds to wait between clock output changes

gpio-controller: true

gpio-line-names: true

required:
- compatible
- "#gpio-cells"
- gpio-controller
- clk-gpios
- latched-gpios

additionalProperties: false

examples:
- |
gpio-latch {
#gpio-cells = <2>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_di_do_leds>;
compatible = "gpio-latch";
gpio-controller;
setup-duration-ns = <100>;
clock-duration-ns = <100>;
clk-gpios = <&gpio3 7 0>, <&gpio3 8 0>;
latched-gpios = <&gpio3 21 0>, <&gpio3 22 0>,
<&gpio3 23 0>, <&gpio3 24 0>,
<&gpio3 25 0>, <&gpio3 26 0>,
<&gpio3 27 0>, <&gpio3 28 0>;
};
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/gpio/gpio-pca9570.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ maintainers:
properties:
compatible:
enum:
- dlg,slg7xl45106
- nxp,pca9570
- nxp,pca9571

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/gpio/hisilicon,ascend910-gpio.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: HiSilicon common GPIO controller

maintainers:
- Jay Fang <f.fangjian@huawei.com>

description:
The HiSilicon common GPIO controller can be used for many different
types of SoC such as Huawei Ascend AI series chips.

properties:
compatible:
const: hisilicon,ascend910-gpio

reg:
maxItems: 1

interrupts:
maxItems: 1

gpio-controller: true

"#gpio-cells":
const: 2

ngpios:
minimum: 1
maximum: 32

required:
- compatible
- reg
- interrupts
- gpio-controller
- "#gpio-cells"
- ngpios

additionalProperties: false

examples:
- |
#include <dt-bindings/interrupt-controller/arm-gic.h>
gpio@840d0000 {
compatible = "hisilicon,ascend910-gpio";
reg = <0x840d0000 0x1000>;
ngpios = <32>;
gpio-controller;
#gpio-cells = <2>;
interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
};
5 changes: 0 additions & 5 deletions Documentation/driver-api/gpio/legacy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -558,11 +558,6 @@ Platform Support
To force-enable this framework, a platform's Kconfig will "select" GPIOLIB,
else it is up to the user to configure support for GPIO.

It may also provide a custom value for ARCH_NR_GPIOS, so that it better
reflects the number of GPIOs in actual use on that platform, without
wasting static table space. (It should count both built-in/SoC GPIOs and
also ones on GPIO expanders.

If neither of these options are selected, the platform does not support
GPIOs through GPIO-lib and the code cannot be enabled by the user.

Expand Down
8 changes: 8 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,13 @@ L: linux-iio@vger.kernel.org
S: Maintained
F: drivers/counter/104-quad-8.c

ACCES IDIO-16 GPIO LIBRARY
M: William Breathitt Gray <william.gray@linaro.org>
L: linux-gpio@vger.kernel.org
S: Maintained
F: drivers/gpio/gpio-idio-16.c
F: drivers/gpio/gpio-idio-16.h

ACCES PCI-IDIO-16 GPIO DRIVER
M: William Breathitt Gray <william.gray@linaro.org>
L: linux-gpio@vger.kernel.org
Expand Down Expand Up @@ -9266,6 +9273,7 @@ HISILICON GPIO DRIVER
M: Jay Fang <f.fangjian@huawei.com>
L: linux-gpio@vger.kernel.org
S: Maintained
F: Documentation/devicetree/bindings/gpio/hisilicon,ascend910-gpio.yaml
F: drivers/gpio/gpio-hisi.c

HISILICON HIGH PERFORMANCE RSA ENGINE DRIVER (HPRE)
Expand Down
21 changes: 0 additions & 21 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1158,27 +1158,6 @@ config ARM_PSCI
0022A ("Power State Coordination Interface System Software on
ARM processors").

# The GPIO number here must be sorted by descending number. In case of
# a multiplatform kernel, we just want the highest value required by the
# selected platforms.
config ARCH_NR_GPIO
int
default 2048 if ARCH_INTEL_SOCFPGA
default 1024 if ARCH_BRCMSTB || ARCH_RENESAS || ARCH_TEGRA || \
ARCH_ZYNQ || ARCH_ASPEED
default 512 if ARCH_EXYNOS || ARCH_KEYSTONE || SOC_OMAP5 || \
SOC_DRA7XX || ARCH_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210
default 416 if ARCH_SUNXI
default 392 if ARCH_U8500
default 352 if ARCH_VT8500
default 288 if ARCH_ROCKCHIP
default 264 if MACH_H4700
default 0
help
Maximum number of GPIOs in the system.

If unsure, leave the default value.

config HZ_FIXED
int
default 128 if SOC_AT91RM9200
Expand Down
1 change: 0 additions & 1 deletion arch/arm/include/asm/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#ifndef _ARCH_ARM_GPIO_H
#define _ARCH_ARM_GPIO_H

/* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */
#include <asm-generic/gpio.h>

/* The trivial gpiolib dispatchers */
Expand Down
12 changes: 0 additions & 12 deletions arch/arm64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2168,18 +2168,6 @@ config STACKPROTECTOR_PER_TASK
def_bool y
depends on STACKPROTECTOR && CC_HAVE_STACKPROTECTOR_SYSREG

# The GPIO number here must be sorted by descending number. In case of
# a multiplatform kernel, we just want the highest value required by the
# selected platforms.
config ARCH_NR_GPIO
int
default 2048 if ARCH_APPLE
default 0
help
Maximum number of GPIOs in the system.

If unsure, leave the default value.

config UNWIND_PATCH_PAC_INTO_SCS
bool "Enable shadow call stack dynamically using code patching"
# needs Clang with https://reviews.llvm.org/D111780 incorporated
Expand Down
5 changes: 0 additions & 5 deletions arch/x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,6 @@ config ARCH_HAS_CPU_RELAX
config ARCH_HIBERNATION_POSSIBLE
def_bool y

config ARCH_NR_GPIO
int
default 1024 if X86_64
default 512

config ARCH_SUSPEND_POSSIBLE
def_bool y

Expand Down
29 changes: 19 additions & 10 deletions drivers/gpio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ config GPIO_REGMAP
config GPIO_MAX730X
tristate

config GPIO_IDIO_16
tristate
help
Enables support for the idio-16 library functions. The idio-16 library
provides functions to facilitate communication with devices within the
ACCES IDIO-16 family such as the 104-IDIO-16 and the PCI-IDIO-16.

If built as a module its name will be gpio-idio-16.

menu "Memory mapped GPIO drivers"
depends on HAS_IOMEM

Expand Down Expand Up @@ -219,7 +228,7 @@ config GPIO_CLPS711X
Say yes here to support GPIO on CLPS711X SoCs.

config GPIO_DAVINCI
bool "TI Davinci/Keystone GPIO support"
tristate "TI Davinci/Keystone GPIO support"
default y if ARCH_DAVINCI
depends on (ARM || ARM64) && (ARCH_DAVINCI || ARCH_KEYSTONE || ARCH_K3)
help
Expand Down Expand Up @@ -310,7 +319,7 @@ config GPIO_GRGPIO

config GPIO_HISI
tristate "HiSilicon GPIO controller driver"
depends on (ARM64 && ACPI) || COMPILE_TEST
depends on ARM64 || COMPILE_TEST
select GPIO_GENERIC
select GPIOLIB_IRQCHIP
help
Expand Down Expand Up @@ -600,14 +609,6 @@ config GPIO_SPRD
help
Say yes here to support Spreadtrum GPIO device.

config GPIO_STA2X11
bool "STA2x11/ConneXt GPIO support"
depends on MFD_STA2X11
select GENERIC_IRQ_CHIP
help
Say yes here to support the STA2x11/ConneXt GPIO device.
The GPIO module has 128 GPIO pins with alternate functions.

config GPIO_STP_XWAY
bool "XWAY STP GPIOs"
depends on SOC_XWAY || COMPILE_TEST
Expand Down Expand Up @@ -857,6 +858,7 @@ config GPIO_104_IDIO_16
depends on PC104
select ISA_BUS_API
select GPIOLIB_IRQCHIP
select GPIO_IDIO_16
help
Enables GPIO support for the ACCES 104-IDIO-16 family (104-IDIO-16,
104-IDIO-16E, 104-IDO-16, 104-IDIO-8, 104-IDIO-8E, 104-IDO-8). The
Expand Down Expand Up @@ -1561,6 +1563,7 @@ config GPIO_PCH
config GPIO_PCI_IDIO_16
tristate "ACCES PCI-IDIO-16 GPIO support"
select GPIOLIB_IRQCHIP
select GPIO_IDIO_16
help
Enables GPIO support for the ACCES PCI-IDIO-16. An interrupt is
generated when any of the inputs change state (low to high or high to
Expand Down Expand Up @@ -1681,6 +1684,12 @@ config GPIO_AGGREGATOR
industrial control context, to be operated from userspace using
the GPIO chardev interface.

config GPIO_LATCH
tristate "GPIO latch driver"
help
Say yes here to enable a driver for GPIO multiplexers based on latches
connected to other GPIOs.

config GPIO_MOCKUP
tristate "GPIO Testing Driver"
select IRQ_SIM
Expand Down
4 changes: 3 additions & 1 deletion drivers/gpio/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ obj-$(CONFIG_OF_GPIO) += gpiolib-of.o
obj-$(CONFIG_GPIO_CDEV) += gpiolib-cdev.o
obj-$(CONFIG_GPIO_SYSFS) += gpiolib-sysfs.o
obj-$(CONFIG_GPIO_ACPI) += gpiolib-acpi.o
obj-$(CONFIG_GPIOLIB) += gpiolib-swnode.o

# Device drivers. Generally keep list sorted alphabetically
obj-$(CONFIG_GPIO_REGMAP) += gpio-regmap.o
Expand Down Expand Up @@ -68,13 +69,15 @@ obj-$(CONFIG_GPIO_HLWD) += gpio-hlwd.o
obj-$(CONFIG_HTC_EGPIO) += gpio-htc-egpio.o
obj-$(CONFIG_GPIO_I8255) += gpio-i8255.o
obj-$(CONFIG_GPIO_ICH) += gpio-ich.o
obj-$(CONFIG_GPIO_IDIO_16) += gpio-idio-16.o
obj-$(CONFIG_GPIO_IDT3243X) += gpio-idt3243x.o
obj-$(CONFIG_GPIO_IMX_SCU) += gpio-imx-scu.o
obj-$(CONFIG_GPIO_IOP) += gpio-iop.o
obj-$(CONFIG_GPIO_IT87) += gpio-it87.o
obj-$(CONFIG_GPIO_IXP4XX) += gpio-ixp4xx.o
obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o
obj-$(CONFIG_GPIO_KEMPLD) += gpio-kempld.o
obj-$(CONFIG_GPIO_LATCH) += gpio-latch.o
obj-$(CONFIG_GPIO_LOGICVC) += gpio-logicvc.o
obj-$(CONFIG_GPIO_LOONGSON1) += gpio-loongson1.o
obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o
Expand Down Expand Up @@ -140,7 +143,6 @@ obj-$(CONFIG_GPIO_SL28CPLD) += gpio-sl28cpld.o
obj-$(CONFIG_GPIO_SODAVILLE) += gpio-sodaville.o
obj-$(CONFIG_GPIO_SPEAR_SPICS) += gpio-spear-spics.o
obj-$(CONFIG_GPIO_SPRD) += gpio-sprd.o
obj-$(CONFIG_GPIO_STA2X11) += gpio-sta2x11.o
obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o
obj-$(CONFIG_GPIO_STP_XWAY) += gpio-stp-xway.o
obj-$(CONFIG_GPIO_SYSCON) += gpio-syscon.o
Expand Down
7 changes: 7 additions & 0 deletions drivers/gpio/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ Work items:
this with dry-coding and sending to maintainers to test


Generic regmap GPIO

In the very similar way to Generic MMIO GPIO convert the users which can
take advantage of using regmap over direct IO accessors. Note, even in
MMIO case the regmap MMIO with gpio-regmap.c is preferable over gpio-mmio.c.


GPIOLIB irqchip

The GPIOLIB irqchip is a helper irqchip for "simple cases" that should
Expand Down
Loading

0 comments on commit c0f234f

Please sign in to comment.