Skip to content

Commit 5e6a584

Browse files
committed
Merge tag 'gpio-updates-for-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio updates from Bartosz Golaszewski: "We mostly have various improvements and refactoring all over the place but also some interesting new features - like the virtio GPIO driver that allows guest VMs to use host's GPIOs. We also have a new/old GPIO driver for rockchip - this one has been split out of the pinctrl driver. Summary: - new driver: gpio-virtio allowing a guest VM running linux to access GPIO lines provided by the host - split the GPIO driver out of the rockchip pin control driver - add support for a new model to gpio-aspeed-sgpio, refactor the driver and use generic device property interfaces, improve property sanitization - add ACPI support to gpio-tegra186 - improve the code setting the line names to support multiple GPIO banks per device - constify a bunch of OF functions in the core GPIO code and make the declaration for one of the core OF functions we use consistent within its header - use software nodes in intel_quark_i2c_gpio - add support for the gpio-line-names property in gpio-mt7621 - use the standard GPIO function for setting the GPIO names in gpio-brcmstb - fix a bunch of leaks and other bugs in gpio-mpc8xxx - use generic pm callbacks in gpio-ml-ioh - improve resource management and PM handling in gpio-mlxbf2 - modernize and improve the gpio-dwapb driver - coding style improvements in gpio-rcar - documentation fixes and improvements - update the MAINTAINERS entry for gpio-zynq - minor tweaks in several drivers" * tag 'gpio-updates-for-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (35 commits) gpio: mpc8xxx: Use 'devm_gpiochip_add_data()' to simplify the code and avoid a leak gpio: mpc8xxx: Fix a potential double iounmap call in 'mpc8xxx_probe()' gpio: mpc8xxx: Fix a resources leak in the error handling path of 'mpc8xxx_probe()' gpio: viperboard: remove platform_set_drvdata() call in probe gpio: virtio: Add missing mailings lists in MAINTAINERS entry gpio: virtio: Fix sparse warnings gpio: remove the obsolete MX35 3DS BOARD MC9S08DZ60 GPIO functions gpio: max730x: Use the right include gpio: Add virtio-gpio driver gpio: mlxbf2: Use DEFINE_RES_MEM_NAMED() helper macro gpio: mlxbf2: Use devm_platform_ioremap_resource() gpio: mlxbf2: Drop wrong use of ACPI_PTR() gpio: mlxbf2: Convert to device PM ops gpio: dwapb: Get rid of legacy platform data mfd: intel_quark_i2c_gpio: Convert GPIO to use software nodes gpio: dwapb: Read GPIO base from gpio-base property gpio: dwapb: Unify ACPI enumeration checks in get_irq() and configure_irqs() gpiolib: Deduplicate forward declaration in the consumer.h header MAINTAINERS: update gpio-zynq.yaml reference gpio: tegra186: Add ACPI support ...
2 parents 75b96f0 + 889a1b3 commit 5e6a584

29 files changed

+752
-447
lines changed

Documentation/driver-api/gpio/consumer.rst

+9-1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ for the GPIO. Values can be:
7272
* GPIOD_OUT_HIGH_OPEN_DRAIN same as GPIOD_OUT_HIGH but also enforce the line
7373
to be electrically used with open drain.
7474

75+
Note that the initial value is *logical* and the physical line level depends on
76+
whether the line is configured active high or active low (see
77+
:ref:`active_low_semantics`).
78+
7579
The two last flags are used for use cases where open drain is mandatory, such
7680
as I2C: if the line is not already configured as open drain in the mappings
7781
(see board.txt), then open drain will be enforced anyway and a warning will be
@@ -252,6 +256,8 @@ that can't be accessed from hardIRQ handlers, these calls act the same as the
252256
spinlock-safe calls.
253257

254258

259+
.. _active_low_semantics:
260+
255261
The active low and open drain semantics
256262
---------------------------------------
257263
As a consumer should not have to care about the physical line level, all of the
@@ -309,9 +315,11 @@ work on the raw line value::
309315
void gpiod_set_raw_value_cansleep(struct gpio_desc *desc, int value)
310316
int gpiod_direction_output_raw(struct gpio_desc *desc, int value)
311317

312-
The active low state of a GPIO can also be queried using the following call::
318+
The active low state of a GPIO can also be queried and toggled using the
319+
following calls::
313320

314321
int gpiod_is_active_low(const struct gpio_desc *desc)
322+
void gpiod_toggle_active_low(struct gpio_desc *desc)
315323

316324
Note that these functions should only be used with great moderation; a driver
317325
should not have to care about the physical line level or open drain semantics.

Documentation/driver-api/gpio/driver.rst

+4-7
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,10 @@ To use the helpers please keep the following in mind:
547547
the irqchip can initialize. E.g. .dev and .can_sleep shall be set up
548548
properly.
549549

550-
- Nominally set all handlers to handle_bad_irq() in the setup call and pass
551-
handle_bad_irq() as flow handler parameter in gpiochip_irqchip_add() if it is
552-
expected for GPIO driver that irqchip .set_type() callback will be called
553-
before using/enabling each GPIO IRQ. Then set the handler to
554-
handle_level_irq() and/or handle_edge_irq() in the irqchip .set_type()
555-
callback depending on what your controller supports and what is requested
556-
by the consumer.
550+
- Nominally set gpio_irq_chip.handler to handle_bad_irq. Then, if your irqchip
551+
is cascaded, set the handler to handle_level_irq() and/or handle_edge_irq()
552+
in the irqchip .set_type() callback depending on what your controller
553+
supports and what is requested by the consumer.
557554

558555

559556
Locking IRQ usage

MAINTAINERS

+10-1
Original file line numberDiff line numberDiff line change
@@ -19852,6 +19852,15 @@ F: Documentation/filesystems/virtiofs.rst
1985219852
F: fs/fuse/virtio_fs.c
1985319853
F: include/uapi/linux/virtio_fs.h
1985419854

19855+
VIRTIO GPIO DRIVER
19856+
M: Enrico Weigelt, metux IT consult <[email protected]>
19857+
M: Viresh Kumar <[email protected]>
19858+
19859+
19860+
S: Maintained
19861+
F: drivers/gpio/gpio-virtio.c
19862+
F: include/uapi/linux/virtio_gpio.h
19863+
1985519864
VIRTIO GPU DRIVER
1985619865
M: David Airlie <[email protected]>
1985719866
M: Gerd Hoffmann <[email protected]>
@@ -20546,7 +20555,7 @@ R: Srinivas Neeli <[email protected]>
2054620555
R: Michal Simek <[email protected]>
2054720556
S: Maintained
2054820557
F: Documentation/devicetree/bindings/gpio/gpio-xilinx.txt
20549-
F: Documentation/devicetree/bindings/gpio/gpio-zynq.txt
20558+
F: Documentation/devicetree/bindings/gpio/gpio-zynq.yaml
2055020559
F: drivers/gpio/gpio-xilinx.c
2055120560
F: drivers/gpio/gpio-zynq.c
2055220561

drivers/gpio/Kconfig

+9-6
Original file line numberDiff line numberDiff line change
@@ -1018,12 +1018,6 @@ config GPIO_MAX732X_IRQ
10181018
Say yes here to enable the max732x to be used as an interrupt
10191019
controller. It requires the driver to be built in the kernel.
10201020

1021-
config GPIO_MC9S08DZ60
1022-
bool "MX35 3DS BOARD MC9S08DZ60 GPIO functions"
1023-
depends on I2C=y && MACH_MX35_3DS
1024-
help
1025-
Select this to enable the MC9S08DZ60 GPIO driver
1026-
10271021
config GPIO_PCA953X
10281022
tristate "PCA95[357]x, PCA9698, TCA64xx, and MAX7310 I/O ports"
10291023
select REGMAP_I2C
@@ -1677,6 +1671,15 @@ config GPIO_MOCKUP
16771671
tools/testing/selftests/gpio/gpio-mockup.sh. Reference the usage in
16781672
it.
16791673

1674+
config GPIO_VIRTIO
1675+
tristate "VirtIO GPIO support"
1676+
depends on VIRTIO
1677+
help
1678+
Say Y here to enable guest support for virtio-based GPIO controllers.
1679+
1680+
These virtual GPIOs can be routed to real GPIOs or attached to
1681+
simulators on the host (like QEMU).
1682+
16801683
endmenu
16811684

16821685
endif

drivers/gpio/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ obj-$(CONFIG_GPIO_MAX77620) += gpio-max77620.o
9292
obj-$(CONFIG_GPIO_MAX77650) += gpio-max77650.o
9393
obj-$(CONFIG_GPIO_MB86S7X) += gpio-mb86s7x.o
9494
obj-$(CONFIG_GPIO_MC33880) += gpio-mc33880.o
95-
obj-$(CONFIG_GPIO_MC9S08DZ60) += gpio-mc9s08dz60.o
9695
obj-$(CONFIG_GPIO_MENZ127) += gpio-menz127.o
9796
obj-$(CONFIG_GPIO_MERRIFIELD) += gpio-merrifield.o
9897
obj-$(CONFIG_GPIO_ML_IOH) += gpio-ml-ioh.o
@@ -166,6 +165,7 @@ obj-$(CONFIG_GPIO_UCB1400) += gpio-ucb1400.o
166165
obj-$(CONFIG_GPIO_UNIPHIER) += gpio-uniphier.o
167166
obj-$(CONFIG_GPIO_VF610) += gpio-vf610.o
168167
obj-$(CONFIG_GPIO_VIPERBOARD) += gpio-viperboard.o
168+
obj-$(CONFIG_GPIO_VIRTIO) += gpio-virtio.o
169169
obj-$(CONFIG_GPIO_VISCONTI) += gpio-visconti.o
170170
obj-$(CONFIG_GPIO_VR41XX) += gpio-vr41xx.o
171171
obj-$(CONFIG_GPIO_VX855) += gpio-vx855.o

0 commit comments

Comments
 (0)