Skip to content

Commit

Permalink
Merge tag 'gpio-v5.6-1' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/linusw/linux-gpio

Pull GPIO updates from Linus Walleij:
 "This is the bulk of GPIO changes for the v5.6 kernel cycle.

  This is a pretty calm cycle so far, nothing special going on really.
  Some more changes will come in from the irqchip and pin control trees.

  I also deleted an orphan include file for FMC that was dangling since
  subsystem was removed.

  Core changes:

   - Document the usecases for the kernelspace vs userspace handling of
     GPIOs.

   - Handle MSI (message signalled interrupts) properly in the core
     hierarchical irqdomain code.

   - Fix a rare race condition while initializing the descriptor array.

  New drivers:

   - Xylon LogiCVC GPIO driver.

   - WDC934x GPIO controller driver.

  Driver improvements:

   - Implemented suspend/resume in the Tegra driver.

   - MPC8xx edge detection fixup.

   - Properly convert ThunderX to use hierarchical irqdomain with
     GPIOLIB_IRQCHIP on top of the revert of the previous buggy
     switchover. This time it works (hopefully).

  Misc:

   - Drop a FMC remnant file <linux/ipmi-fru.h>

   - A slew of fixes"

* tag 'gpio-v5.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (48 commits)
  MAINTAINERS: Replace Tien Hock Loh as Altera PIO maintainer
  gpiolib: hold gpio devices lock until ->descs array is initialised
  gpio: aspeed-sgpio: fixed typos
  gpio: mvebu: clear irq in edge cause register before unmask edge irq
  gpiolib: Lower verbosity when allocating hierarchy irq
  gpiolib: Remove duplicated function gpio_do_set_config()
  gpio: Fix the no return statement warning
  gpio: wcd934x: Add support to wcd934x gpio controller
  gpiolib: remove set but not used variable 'config'
  gpio: vx855: fixed a typo
  gpio: mockup: sort headers alphabetically
  gpio: mockup: update the license tag
  gpio: Remove the unused flags
  gpiolib: Set lockdep class for hierarchical irq domains
  gpio: thunderx: Switch to GPIOLIB_IRQCHIP
  gpiolib: Add the support for the msi parent domain
  gpiolib: Add support for the irqdomain which doesn't use irq_fwspec as arg
  gpio: Add use guidance documentation
  dt-bindings: gpio: wcd934x: Add bindings for gpio
  gpio: altera: change to platform_get_irq_optional to avoid false-positive error
  ...
  • Loading branch information
torvalds committed Jan 29, 2020
2 parents b3a6082 + 0282c72 commit fa889d8
Show file tree
Hide file tree
Showing 38 changed files with 814 additions and 413 deletions.
47 changes: 47 additions & 0 deletions Documentation/devicetree/bindings/gpio/qcom,wcd934x-gpio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/gpio/qcom,wcd934x-gpio.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: WCD9340/WCD9341 GPIO controller

maintainers:
- Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

description: |
Qualcomm Technologies Inc WCD9340/WCD9341 Audio Codec has integrated
gpio controller to control 5 gpios on the chip.
properties:
compatible:
enum:
- qcom,wcd9340-gpio
- qcom,wcd9341-gpio

reg:
maxItems: 1

gpio-controller: true

'#gpio-cells':
const: 2

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

additionalProperties: false

examples:
- |
wcdgpio: gpio@42 {
compatible = "qcom,wcd9340-gpio";
reg = <0x042 0x2>;
gpio-controller;
#gpio-cells = <2>;
};
...
3 changes: 2 additions & 1 deletion Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Required Properties:
- "renesas,gpio-r8a7793": for R8A7793 (R-Car M2-N) compatible GPIO controller.
- "renesas,gpio-r8a7794": for R8A7794 (R-Car E2) compatible GPIO controller.
- "renesas,gpio-r8a7795": for R8A7795 (R-Car H3) compatible GPIO controller.
- "renesas,gpio-r8a7796": for R8A7796 (R-Car M3-W) compatible GPIO controller.
- "renesas,gpio-r8a7796": for R8A77960 (R-Car M3-W) compatible GPIO controller.
- "renesas,gpio-r8a77961": for R8A77961 (R-Car M3-W+) compatible GPIO controller.
- "renesas,gpio-r8a77965": for R8A77965 (R-Car M3-N) compatible GPIO controller.
- "renesas,gpio-r8a77970": for R8A77970 (R-Car V3M) compatible GPIO controller.
- "renesas,gpio-r8a77980": for R8A77980 (R-Car V3H) compatible GPIO controller.
Expand Down
69 changes: 69 additions & 0 deletions Documentation/devicetree/bindings/gpio/xylon,logicvc-gpio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
# Copyright 2019 Bootlin
%YAML 1.2
---
$id: "http://devicetree.org/schemas/gpio/xylon,logicvc-gpio.yaml#"
$schema: "http://devicetree.org/meta-schemas/core.yaml#"

title: Xylon LogiCVC GPIO controller

maintainers:
- Paul Kocialkowski <paul.kocialkowski@bootlin.com>

description: |
The LogiCVC GPIO describes the GPIO block included in the LogiCVC display
controller. These are meant to be used for controlling display-related
signals.
The controller exposes GPIOs from the display and power control registers,
which are mapped by the driver as follows:
- GPIO[4:0] (display control) mapped to index 0-4
- EN_BLIGHT (power control) mapped to index 5
- EN_VDD (power control) mapped to index 6
- EN_VEE (power control) mapped to index 7
- V_EN (power control) mapped to index 8
properties:
$nodename:
pattern: "^gpio@[0-9a-f]+$"

compatible:
enum:
- xylon,logicvc-3.02.a-gpio

reg:
maxItems: 1

"#gpio-cells":
const: 2

gpio-controller: true

gpio-line-names:
minItems: 1
maxItems: 9

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

examples:
- |
logicvc: logicvc@43c00000 {
compatible = "xylon,logicvc-3.02.a", "syscon", "simple-mfd";
reg = <0x43c00000 0x6000>;
#address-cells = <1>;
#size-cells = <1>;
logicvc_gpio: gpio@40 {
compatible = "xylon,logicvc-3.02.a-gpio";
reg = <0x40 0x40>;
gpio-controller;
#gpio-cells = <2>;
gpio-line-names = "GPIO0", "GPIO1", "GPIO2", "GPIO3", "GPIO4",
"EN_BLIGHT", "EN_VDD", "EN_VEE", "V_EN";
};
};
50 changes: 50 additions & 0 deletions Documentation/devicetree/bindings/mfd/xylon,logicvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
# Copyright 2019 Bootlin
%YAML 1.2
---
$id: "http://devicetree.org/schemas/mfd/xylon,logicvc.yaml#"
$schema: "http://devicetree.org/meta-schemas/core.yaml#"

title: Xylon LogiCVC multi-function device

maintainers:
- Paul Kocialkowski <paul.kocialkowski@bootlin.com>

description: |
The LogiCVC is a display controller that also contains a GPIO controller.
As a result, a multi-function device is exposed as parent of the display
and GPIO blocks.
properties:
compatible:
items:
- enum:
- xylon,logicvc-3.02.a
- const: syscon
- const: simple-mfd

reg:
maxItems: 1

select:
properties:
compatible:
contains:
enum:
- xylon,logicvc-3.02.a

required:
- compatible

required:
- compatible
- reg

examples:
- |
logicvc: logicvc@43c00000 {
compatible = "xylon,logicvc-3.02.a", "syscon", "simple-mfd";
reg = <0x43c00000 0x6000>;
#address-cells = <1>;
#size-cells = <1>;
};
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/vendor-prefixes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,8 @@ patternProperties:
description: Xilinx
"^xunlong,.*":
description: Shenzhen Xunlong Software CO.,Limited
"^xylon,.*":
description: Xylon
"^yones-toptech,.*":
description: Yones Toptech Co., Ltd.
"^ysoft,.*":
Expand Down
2 changes: 2 additions & 0 deletions Documentation/driver-api/driver-model/devres.rst
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ DRM

GPIO
devm_gpiod_get()
devm_gpiod_get_array()
devm_gpiod_get_array_optional()
devm_gpiod_get_index()
devm_gpiod_get_index_optional()
devm_gpiod_get_optional()
Expand Down
8 changes: 4 additions & 4 deletions Documentation/driver-api/gpio/drivers-on-gpio.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ to emulate MCTRL (modem control) signals CTS/RTS by using two GPIO lines. The
MTD NOR flash has add-ons for extra GPIO lines too, though the address bus is
usually connected directly to the flash.

Use those instead of talking directly to the GPIOs using sysfs; they integrate
with kernel frameworks better than your userspace code could. Needless to say,
just using the appropriate kernel drivers will simplify and speed up your
embedded hacking in particular by providing ready-made components.
Use those instead of talking directly to the GPIOs from userspace; they
integrate with kernel frameworks better than your userspace code could.
Needless to say, just using the appropriate kernel drivers will simplify and
speed up your embedded hacking in particular by providing ready-made components.
1 change: 1 addition & 0 deletions Documentation/driver-api/gpio/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Contents:
:maxdepth: 2

intro
using-gpio
driver
consumer
board
Expand Down
50 changes: 50 additions & 0 deletions Documentation/driver-api/gpio/using-gpio.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
=========================
Using GPIO Lines in Linux
=========================

The Linux kernel exists to abstract and present hardware to users. GPIO lines
as such are normally not user facing abstractions. The most obvious, natural
and preferred way to use GPIO lines is to let kernel hardware drivers deal
with them.

For examples of already existing generic drivers that will also be good
examples for any other kernel drivers you want to author, refer to
:doc:`drivers-on-gpio`

For any kind of mass produced system you want to support, such as servers,
laptops, phones, tablets, routers, and any consumer or office or business goods
using appropriate kernel drivers is paramount. Submit your code for inclusion
in the upstream Linux kernel when you feel it is mature enough and you will get
help to refine it, see :doc:`../../process/submitting-patches`.

In Linux GPIO lines also have a userspace ABI.

The userspace ABI is intended for one-off deployments. Examples are prototypes,
factory lines, maker community projects, workshop specimen, production tools,
industrial automation, PLC-type use cases, door controllers, in short a piece
of specialized equipment that is not produced by the numbers, requiring
operators to have a deep knowledge of the equipment and knows about the
software-hardware interface to be set up. They should not have a natural fit
to any existing kernel subsystem and not be a good fit for an operating system,
because of not being reusable or abstract enough, or involving a lot of non
computer hardware related policy.

Applications that have a good reason to use the industrial I/O (IIO) subsystem
from userspace will likely be a good fit for using GPIO lines from userspace as
well.

Do not under any circumstances abuse the GPIO userspace ABI to cut corners in
any product development projects. If you use it for prototyping, then do not
productify the prototype: rewrite it using proper kernel drivers. Do not under
any circumstances deploy any uniform products using GPIO from userspace.

The userspace ABI is a character device for each GPIO hardware unit (GPIO chip).
These devices will appear on the system as ``/dev/gpiochip0`` thru
``/dev/gpiochipN``. Examples of how to directly use the userspace ABI can be
found in the kernel tree ``tools/gpio`` subdirectory.

For structured and managed applications, we recommend that you make use of the
libgpiod_ library. This provides helper abstractions, command line utlities
and arbitration for multiple simultaneous consumers on the same GPIO chip.

.. _libgpiod: https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ S: Maintained
F: drivers/mailbox/mailbox-altera.c

ALTERA PIO DRIVER
M: Tien Hock Loh <thloh@altera.com>
M: Joyce Ooi <joyce.ooi@intel.com>
L: linux-gpio@vger.kernel.org
S: Maintained
F: drivers/gpio/gpio-altera.c
Expand Down
14 changes: 14 additions & 0 deletions drivers/gpio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,12 @@ config GPIO_IXP4XX
IXP4xx series of chips.

If unsure, say N.
config GPIO_LOGICVC
tristate "Xylon LogiCVC GPIO support"
depends on MFD_SYSCON && OF
help
Say yes here to support GPIO functionality of the Xylon LogiCVC
programmable logic block.

config GPIO_LOONGSON
bool "Loongson-2/3 GPIO support"
Expand Down Expand Up @@ -582,6 +588,7 @@ config GPIO_THUNDERX
tristate "Cavium ThunderX/OCTEON-TX GPIO"
depends on ARCH_THUNDER || (64BIT && COMPILE_TEST)
depends on PCI_MSI
select GPIOLIB_IRQCHIP
select IRQ_DOMAIN_HIERARCHY
select IRQ_FASTEOI_HIERARCHY_HANDLERS
help
Expand Down Expand Up @@ -621,6 +628,13 @@ config GPIO_VX855
additional drivers must be enabled in order to use the
functionality of the device.

config GPIO_WCD934X
tristate "Qualcomm Technologies Inc WCD9340/WCD9341 gpio controller driver"
depends on MFD_WCD934X && OF_GPIO
help
This driver is to supprot GPIO block found on the Qualcomm Technologies
Inc WCD9340/WCD9341 Audio Codec.

config GPIO_XGENE
bool "APM X-Gene GPIO controller support"
depends on ARM64 && OF_GPIO
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpio/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ 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_LOGICVC) += gpio-logicvc.o
obj-$(CONFIG_GPIO_LOONGSON1) += gpio-loongson1.o
obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o
obj-$(CONFIG_GPIO_LP3943) += gpio-lp3943.o
Expand Down Expand Up @@ -158,6 +159,7 @@ obj-$(CONFIG_GPIO_VF610) += gpio-vf610.o
obj-$(CONFIG_GPIO_VIPERBOARD) += gpio-viperboard.o
obj-$(CONFIG_GPIO_VR41XX) += gpio-vr41xx.o
obj-$(CONFIG_GPIO_VX855) += gpio-vx855.o
obj-$(CONFIG_GPIO_WCD934X) += gpio-wcd934x.o
obj-$(CONFIG_GPIO_WHISKEY_COVE) += gpio-wcove.o
obj-$(CONFIG_GPIO_WINBOND) += gpio-winbond.o
obj-$(CONFIG_GPIO_WM831X) += gpio-wm831x.o
Expand Down
Loading

0 comments on commit fa889d8

Please sign in to comment.