Skip to content

Commit 0486bea

Browse files
committed
Merge tag 'gpio-v5.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO updates from Linus Walleij: "This time very little driver changes but lots of core changes. We have some interesting cooperative work for ARM and Intel alike, making the GPIO subsystem more and more suitable for industrial systems and the like, in addition to the in-kernel users. We touch driver core (device properties) and lib/* by adding one simple string array free function, these are authored by Andy Shevchenko who is a well known and recognized core helpers maintainers so this should be fine. We also see some Android GKI-related modularization in the MXC drivers. Core changes: - The big core change is the updated (v2) userspace character device API. This corrects badly designed 64-bit alignment around the line events. We also add the debounce request feature. This echoes the often quotes passage from Frederick Brooks "The mythical man-month" to always throw one away, which we have seen before in things such as V4L2. So we put in a new one and deprecate and obsolete the old one. - All example tools in tools/gpio/* are migrated to the new API to set a good example. The libgpiod userspace library has been augmented to use this new API pretty much from day 1. - Some misc API hardening by using strn* function calls has been added as well. - Use the simpler IDA interface for GPIO chip instance enumeration. - Add device core function for counting string arrays in device properties. - Provide a generic library function kfree_strarray() that can be used throughout the kernel. Driver enhancements: - The DesignWare dwapb-gpio driver has been enhanced and now uses the IRQ handling in the gpiolib core. - The mockup and aggregator drivers have seen some substantial code clean-up and now use more of the core kernel inftrastructure. - Misc cleanups using dev_err_probe(). - The MXC drivers (Freescale/NXP) can now be built modularized, which makes modularized GKI Android kernels happy" * tag 'gpio-v5.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (73 commits) gpiolib: Update header block in gpiolib-cdev.h gpiolib: cdev: switch from kstrdup() to kstrndup() docs: gpio: add a new document to its index.rst gpio: pca953x: Add support for the NXP PCAL9554B/C tools: gpio: add debounce support to gpio-event-mon tools: gpio: add multi-line monitoring to gpio-event-mon tools: gpio: port gpio-event-mon to v2 uAPI tools: gpio: port gpio-hammer to v2 uAPI tools: gpio: rename nlines to num_lines tools: gpio: port gpio-watch to v2 uAPI tools: gpio: port lsgpio to v2 uAPI gpio: uapi: document uAPI v1 as deprecated gpiolib: cdev: support setting debounce gpiolib: cdev: support GPIO_V2_LINE_SET_VALUES_IOCTL gpiolib: cdev: support GPIO_V2_LINE_SET_CONFIG_IOCTL gpiolib: cdev: support edge detection for uAPI v2 gpiolib: cdev: support GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL gpiolib: add build option for CDEV v1 ABI gpiolib: make cdev a build option ...
2 parents a996b9c + fc709df commit 0486bea

46 files changed

Lines changed: 2962 additions & 938 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.. SPDX-License-Identifier: GPL-2.0-only
2+
3+
GPIO Testing Driver
4+
===================
5+
6+
The GPIO Testing Driver (gpio-mockup) provides a way to create simulated GPIO
7+
chips for testing purposes. The lines exposed by these chips can be accessed
8+
using the standard GPIO character device interface as well as manipulated
9+
using the dedicated debugfs directory structure.
10+
11+
Creating simulated chips using module params
12+
--------------------------------------------
13+
14+
When loading the gpio-mockup driver a number of parameters can be passed to the
15+
module.
16+
17+
gpio_mockup_ranges
18+
19+
This parameter takes an argument in the form of an array of integer
20+
pairs. Each pair defines the base GPIO number (if any) and the number
21+
of lines exposed by the chip. If the base GPIO is -1, the gpiolib
22+
will assign it automatically.
23+
24+
Example: gpio_mockup_ranges=-1,8,-1,16,405,4
25+
26+
The line above creates three chips. The first one will expose 8 lines,
27+
the second 16 and the third 4. The base GPIO for the third chip is set
28+
to 405 while for two first chips it will be assigned automatically.
29+
30+
gpio_named_lines
31+
32+
This parameter doesn't take any arguments. It lets the driver know that
33+
GPIO lines exposed by it should be named.
34+
35+
The name format is: gpio-mockup-X-Y where X is mockup chip's ID
36+
and Y is the line offset.
37+
38+
Manipulating simulated lines
39+
----------------------------
40+
41+
Each mockup chip creates its own subdirectory in /sys/kernel/debug/gpio-mockup/.
42+
The directory is named after the chip's label. A symlink is also created, named
43+
after the chip's name, which points to the label directory.
44+
45+
Inside each subdirectory, there's a separate attribute for each GPIO line. The
46+
name of the attribute represents the line's offset in the chip.
47+
48+
Reading from a line attribute returns the current value. Writing to it (0 or 1)
49+
changes the configuration of the simulated pull-up/pull-down resistor
50+
(1 - pull-up, 0 - pull-down).

Documentation/admin-guide/gpio/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ gpio
99

1010
gpio-aggregator
1111
sysfs
12+
gpio-mockup
1213

1314
.. only:: subproject and html
1415

Documentation/devicetree/bindings/gpio/fsl-imx-gpio.yaml

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,33 @@ maintainers:
1111

1212
properties:
1313
compatible:
14-
enum:
15-
- fsl,imx1-gpio
16-
- fsl,imx21-gpio
17-
- fsl,imx31-gpio
18-
- fsl,imx35-gpio
19-
- fsl,imx7d-gpio
14+
oneOf:
15+
- enum:
16+
- fsl,imx1-gpio
17+
- fsl,imx21-gpio
18+
- fsl,imx31-gpio
19+
- fsl,imx35-gpio
20+
- fsl,imx7d-gpio
21+
- items:
22+
- const: fsl,imx35-gpio
23+
- const: fsl,imx31-gpio
24+
- items:
25+
- enum:
26+
- fsl,imx50-gpio
27+
- fsl,imx51-gpio
28+
- fsl,imx53-gpio
29+
- fsl,imx6q-gpio
30+
- fsl,imx6sl-gpio
31+
- fsl,imx6sll-gpio
32+
- fsl,imx6sx-gpio
33+
- fsl,imx6ul-gpio
34+
- fsl,imx7d-gpio
35+
- fsl,imx8mm-gpio
36+
- fsl,imx8mn-gpio
37+
- fsl,imx8mp-gpio
38+
- fsl,imx8mq-gpio
39+
- fsl,imx8qxp-gpio
40+
- const: fsl,imx35-gpio
2041

2142
reg:
2243
maxItems: 1
@@ -41,6 +62,28 @@ properties:
4162
const: 2
4263

4364
gpio-controller: true
65+
gpio-line-names: true
66+
gpio-ranges: true
67+
68+
power-domains:
69+
maxItems: 1
70+
71+
patternProperties:
72+
"^(hog-[0-9]+|.+-hog(-[0-9]+)?)$":
73+
type: object
74+
properties:
75+
gpio-hog: true
76+
gpios: true
77+
input: true
78+
output-high: true
79+
output-low: true
80+
line-name: true
81+
82+
required:
83+
- gpio-hog
84+
- gpios
85+
86+
additionalProperties: false
4487

4588
required:
4689
- compatible

Documentation/devicetree/bindings/gpio/gpio-max732x.txt

Lines changed: 0 additions & 58 deletions
This file was deleted.

Documentation/devicetree/bindings/gpio/gpio-pca953x.txt

Lines changed: 0 additions & 90 deletions
This file was deleted.

0 commit comments

Comments
 (0)