Lines Matching +full:gpio +full:-
1 .. SPDX-License-Identifier: GPL-2.0-or-later
3 Configfs GPIO Simulator
6 The configfs GPIO Simulator (gpio-sim) provides a way to create simulated GPIO
8 using the standard GPIO character device interface as well as manipulated
12 ------------------------
14 The gpio-sim module registers a configfs subsystem called ``'gpio-sim'``. For
21 **Group:** ``/config/gpio-sim``
23 This is the top directory of the gpio-sim configfs tree.
25 **Group:** ``/config/gpio-sim/gpio-device``
27 **Attribute:** ``/config/gpio-sim/gpio-device/dev_name``
29 **Attribute:** ``/config/gpio-sim/gpio-device/live``
31 This is a directory representing a GPIO platform device. The ``'dev_name'``
32 attribute is read-only and allows the user-space to read the platform device
33 name (e.g. ``'gpio-sim.0'``). The ``'live'`` attribute allows to trigger the
38 **Group:** ``/config/gpio-sim/gpio-device/gpio-bankX``
40 **Attribute:** ``/config/gpio-sim/gpio-device/gpio-bankX/chip_name``
42 **Attribute:** ``/config/gpio-sim/gpio-device/gpio-bankX/num_lines``
45 ``'chip_name'`` attribute is read-only and allows the user-space to read the
49 **Group:** ``/config/gpio-sim/gpio-device/gpio-bankX/lineY``
51 **Attribute:** ``/config/gpio-sim/gpio-device/gpio-bankX/lineY/name``
54 allows to set the line name as represented by the 'gpio-line-names' property.
56 **Item:** ``/config/gpio-sim/gpio-device/gpio-bankX/lineY/hog``
58 **Attribute:** ``/config/gpio-sim/gpio-device/gpio-bankX/lineY/hog/name``
60 **Attribute:** ``/config/gpio-sim/gpio-device/gpio-bankX/lineY/hog/direction``
62 This item makes the gpio-sim module hog the associated line. The ``'name'``
63 attribute specifies the in-kernel consumer name to use. The ``'direction'``
65 ``'output-high'`` and ``'output-low'``.
80 Simulated GPIO chips can also be defined in device-tree. The compatible string
81 must be: ``"gpio-simulator"``. Supported properties are:
83 ``"gpio-sim,label"`` - chip label
85 Other standard GPIO properties (like ``"gpio-line-names"``, ``"ngpios"`` or
86 ``"gpio-hog"``) are also supported. Please refer to the GPIO documentation for
89 An example device-tree code defining a GPIO simulator:
91 .. code-block :: none
93 gpio-sim {
94 compatible = "gpio-simulator";
97 gpio-controller;
98 #gpio-cells = <2>;
100 gpio-sim,label = "dt-bank0";
101 gpio-line-names = "", "sim-foo", "", "sim-bar";
105 gpio-controller;
106 #gpio-cells = <2>;
108 gpio-sim,label = "dt-bank1";
111 gpio-hog;
113 output-high;
114 line-name = "sim-hog-from-dt";
120 ----------------------------
122 Each simulated GPIO chip creates a separate sysfs group under its device
124 (e.g. ``/sys/devices/platform/gpio-sim.X/gpiochipY/``). The name of each group
128 ``pull`` - allows to read and set the current simulated pull setting for
129 every line, when writing the value must be one of: ``'pull-up'``,
130 ``'pull-down'``
132 ``value`` - allows to read the current value of the line which may be
134 user-space