Lines Matching +full:gpio +full:- +full:key

1 .. SPDX-License-Identifier: GPL-2.0-only
3 GPIO Aggregator
6 The GPIO Aggregator provides a mechanism to aggregate GPIOs, and expose them as
11 -----------------------------
13 GPIO controllers are exported to userspace using /dev/gpiochip* character
15 system permissions, on an all-or-nothing basis: either a GPIO controller is
18 The GPIO Aggregator provides access control for a set of one or more GPIOs, by
22 grab the full GPIO controller, and no longer needs to care about which GPIOs to
25 Aggregated GPIO controllers are instantiated and destroyed by writing to
26 write-only attribute files in sysfs.
28 /sys/bus/platform/drivers/gpio-aggregator/
31 Userspace may ask the kernel to instantiate an aggregated GPIO
35 .. code-block:: none
42 is a GPIO line name,
45 is a GPIO chip label, and
48 is a comma-separated list of GPIO offsets and/or
49 GPIO offset ranges denoted by dashes.
51 Example: Instantiate a new GPIO aggregator by aggregating GPIO
52 line 19 of "e6052000.gpio" and GPIO lines 20-21 of
53 "e6050000.gpio" into a new gpio_chip:
55 .. code-block:: sh
57 $ echo 'e6052000.gpio 19 e6050000.gpio 20-21' > new_device
60 Userspace may ask the kernel to destroy an aggregated GPIO
64 Example: Destroy the previously-created aggregated GPIO
65 controller, assumed to be "gpio-aggregator.0":
67 .. code-block:: sh
69 $ echo gpio-aggregator.0 > delete_device
73 --------------------------------
75 **Group:** ``/config/gpio-aggregator``
77 This is the root directory of the gpio-aggregator configfs tree.
79 **Group:** ``/config/gpio-aggregator/<example-name>``
81 This directory represents a GPIO aggregator device. You can assign any
82 name to ``<example-name>`` (e.g. ``agg0``), except names starting with
83 ``_sysfs`` prefix, which are reserved for auto-generated configfs
86 **Attribute:** ``/config/gpio-aggregator/<example-name>/live``
94 **Attribute:** ``/config/gpio-aggregator/<example-name>/dev_name``
96 The read-only ``dev_name`` attribute exposes the name of the device as it
97 will appear in the system on the platform bus (e.g. ``gpio-aggregator.0``).
99 aggregator. If it's ``gpio-aggregator.0``,
100 ``/sys/devices/platform/gpio-aggregator.0/gpiochipX`` path tells you that the
101 GPIO device id is ``X``.
108 **Group:** ``/config/gpio-aggregator/<example-name>/<lineY>/``
110 This directory represents a GPIO line to include in the aggregator.
112 **Attribute:** ``/config/gpio-aggregator/<example-name>/<lineY>/key``
114 **Attribute:** ``/config/gpio-aggregator/<example-name>/<lineY>/offset``
118 * ``key`` : <empty>
119 * ``offset`` : -1
121 ``key`` must always be explicitly configured, while ``offset`` depends.
124 (a). For lookup by GPIO line name:
126 * Set ``key`` to the line name.
127 * Ensure ``offset`` remains -1 (the default).
129 (b). For lookup by GPIO chip name and the line offset within the chip:
131 * Set ``key`` to the chip name.
134 **Attribute:** ``/config/gpio-aggregator/<example-name>/<lineY>/name``
149 auto-generated and appear as ``/config/gpio-aggregator/_sysfs.<N>/``. You
154 ``key``, ``offset``, and ``name`` attributes for each line when ``live``
160 .. code-block:: sh
163 $ mkdir /sys/kernel/config/gpio-aggregator/agg0
166 $ mkdir /sys/kernel/config/gpio-aggregator/agg0/line0
167 $ echo gpiochip0 > /sys/kernel/config/gpio-aggregator/agg0/line0/key
168 $ echo 6 > /sys/kernel/config/gpio-aggregator/agg0/line0/offset
169 $ echo test0 > /sys/kernel/config/gpio-aggregator/agg0/line0/name
170 $ mkdir /sys/kernel/config/gpio-aggregator/agg0/line1
171 $ echo gpiochip0 > /sys/kernel/config/gpio-aggregator/agg0/line1/key
172 $ echo 7 > /sys/kernel/config/gpio-aggregator/agg0/line1/offset
173 $ echo test1 > /sys/kernel/config/gpio-aggregator/agg0/line1/name
176 $ echo 1 > /sys/kernel/config/gpio-aggregator/agg0/live
179 Generic GPIO Driver
180 -------------------
182 The GPIO Aggregator can also be used as a generic driver for a simple
183 GPIO-operated device described in DT, without a dedicated in-kernel driver.
187 Binding a device to the GPIO Aggregator is performed either by modifying the
188 gpio-aggregator driver, or by writing to the "driver_override" file in Sysfs.
190 Example: If "door" is a GPIO-operated device described in DT, using its own
198 gpio-line-names = "open", "lock";
201 it can be bound to the GPIO Aggregator by either:
206 .. code-block:: sh
208 $ echo gpio-aggregator > /sys/bus/platform/devices/door/driver_override
209 $ echo door > /sys/bus/platform/drivers/gpio-aggregator/bind
213 .. code-block:: sh
216 gpiochip12 - 2 lines:
217 line 0: "open" unused input active-high
218 line 1: "lock" unused input active-high