\sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget2/translations/zh_CN/admin-guide/gpio/gpio-virtusermodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget2/translations/zh_TW/admin-guide/gpio/gpio-virtusermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget2/translations/it_IT/admin-guide/gpio/gpio-virtusermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget2/translations/ja_JP/admin-guide/gpio/gpio-virtusermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget2/translations/ko_KR/admin-guide/gpio/gpio-virtusermodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget2/translations/sp_SP/admin-guide/gpio/gpio-virtusermodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h%SPDX-License-Identifier: GPL-2.0-onlyh]h%SPDX-License-Identifier: GPL-2.0-only}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhL/var/lib/git/docbuild/linux/Documentation/admin-guide/gpio/gpio-virtuser.rsthKubhsection)}(hhh](htitle)}(hVirtual GPIO Consumerh]hVirtual GPIO Consumer}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hThe virtual GPIO Consumer module allows users to instantiate virtual devices that request GPIOs and then control their behavior over debugfs. Virtual consumer devices can be instantiated from device-tree or over configfs.h]hThe virtual GPIO Consumer module allows users to instantiate virtual devices that request GPIOs and then control their behavior over debugfs. Virtual consumer devices can be instantiated from device-tree or over configfs.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hA virtual consumer uses the driver-facing GPIO APIs and allows to cover it with automated tests driven by user-space. The GPIOs are requested using ``gpiod_get_array()`` and so we support multiple GPIOs per connector ID.h](hA virtual consumer uses the driver-facing GPIO APIs and allows to cover it with automated tests driven by user-space. The GPIOs are requested using }(hhhhhNhNubhliteral)}(h``gpiod_get_array()``h]hgpiod_get_array()}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhubh3 and so we support multiple GPIOs per connector ID.}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hhh](h)}(hCreating GPIO consumersh]hCreating GPIO consumers}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hThe gpio-consumer module registers a configfs subsystem called ``'gpio-virtuser'``. For details of the configfs filesystem, please refer to the configfs documentation.h](h?The gpio-consumer module registers a configfs subsystem called }(hj hhhNhNubh)}(h``'gpio-virtuser'``h]h'gpio-virtuser'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubhU. For details of the configfs filesystem, please refer to the configfs documentation.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hThe user can create a hierarchy of configfs groups and items as well as modify values of exposed attributes. Once the consumer is instantiated, this hierarchy will be translated to appropriate device properties. The general structure is:h]hThe user can create a hierarchy of configfs groups and items as well as modify values of exposed attributes. Once the consumer is instantiated, this hierarchy will be translated to appropriate device properties. The general structure is:}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(h$**Group:** ``/config/gpio-virtuser``h](hstrong)}(h **Group:**h]hGroup:}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1j>hj:ubh }(hj:hhhNhNubh)}(h``/config/gpio-virtuser``h]h/config/gpio-virtuser}(hjRhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj:ubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(h=This is the top directory of the gpio-consumer configfs tree.h]h=This is the top directory of the gpio-consumer configfs tree.}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(h1**Group:** ``/config/gpio-consumer/example-name``h](j?)}(h **Group:**h]hGroup:}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1j>hjtubh }(hjthhhNhNubh)}(h&``/config/gpio-consumer/example-name``h]h"/config/gpio-consumer/example-name}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjtubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(h:**Attribute:** ``/config/gpio-consumer/example-name/live``h](j?)}(h**Attribute:**h]h Attribute:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j>hjubh }(hjhhhNhNubh)}(h+``/config/gpio-consumer/example-name/live``h]h'/config/gpio-consumer/example-name/live}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(h>**Attribute:** ``/config/gpio-consumer/example-name/dev_name``h](j?)}(h**Attribute:**h]h Attribute:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j>hjubh }(hjhhhNhNubh)}(h/``/config/gpio-consumer/example-name/dev_name``h]h+/config/gpio-consumer/example-name/dev_name}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhK!hhhhubh)}(h8This is a directory representing a GPIO consumer device.h]h8This is a directory representing a GPIO consumer device.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK#hhhhubh)}(hThe read-only ``dev_name`` attribute exposes the name of the device as it will appear in the system on the platform bus. This is useful for locating the associated debugfs directory under ``/sys/kernel/debug/gpio-virtuser/$dev_name``.h](hThe read-only }(hjhhhNhNubh)}(h ``dev_name``h]hdev_name}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh attribute exposes the name of the device as it will appear in the system on the platform bus. This is useful for locating the associated debugfs directory under }(hjhhhNhNubh)}(h-``/sys/kernel/debug/gpio-virtuser/$dev_name``h]h)/sys/kernel/debug/gpio-virtuser/$dev_name}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK%hhhhubh)}(hThe ``'live'`` attribute allows to trigger the actual creation of the device once it's fully configured. The accepted values are: ``'1'`` to enable the virtual device and ``'0'`` to disable and tear it down.h](hThe }(hj2hhhNhNubh)}(h ``'live'``h]h'live'}(hj:hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj2ubhv attribute allows to trigger the actual creation of the device once it’s fully configured. The accepted values are: }(hj2hhhNhNubh)}(h``'1'``h]h'1'}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj2ubh" to enable the virtual device and }(hj2hhhNhNubh)}(h``'0'``h]h'0'}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj2ubh to disable and tear it down.}(hj2hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK*hhhhubeh}(h]creating-gpio-consumersah ]h"]creating gpio consumersah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hCreating GPIO lookup tablesh]hCreating GPIO lookup tables}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj~hhhhhK/ubh)}(hDUsers can create a number of configfs groups under the device group:h]hDUsers can create a number of configfs groups under the device group:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK1hj~hhubh)}(h8**Group:** ``/config/gpio-consumer/example-name/con_id``h](j?)}(h **Group:**h]hGroup:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j>hjubh }(hjhhhNhNubh)}(h-``/config/gpio-consumer/example-name/con_id``h]h)/config/gpio-consumer/example-name/con_id}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhK3hj~hhubh)}(hThe ``'con_id'`` directory represents a single GPIO lookup and its value maps to the ``'con_id'`` argument of the ``gpiod_get()`` function. For example: ``con_id`` == ``'reset'`` maps to the ``reset-gpios`` device property.h](hThe }(hjhhhNhNubh)}(h ``'con_id'``h]h'con_id'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhE directory represents a single GPIO lookup and its value maps to the }(hjhhhNhNubh)}(h ``'con_id'``h]h'con_id'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh argument of the }(hjhhhNhNubh)}(h``gpiod_get()``h]h gpiod_get()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh function. For example: }(hjhhhNhNubh)}(h ``con_id``h]hcon_id}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh == }(hjhhhNhNubh)}(h ``'reset'``h]h'reset'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh maps to the }(hjhhhNhNubh)}(h``reset-gpios``h]h reset-gpios}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh device property.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK5hj~hhubh)}(hUsers can assign a number of GPIOs to each lookup. Each GPIO is a sub-directory with a user-defined name under the ``'con_id'`` group.h](hsUsers can assign a number of GPIOs to each lookup. Each GPIO is a sub-directory with a user-defined name under the }(hjAhhhNhNubh)}(h ``'con_id'``h]h'con_id'}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjAubh group.}(hjAhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK9hj~hhubh)}(hB**Attribute:** ``/config/gpio-consumer/example-name/con_id/0/key``h](j?)}(h**Attribute:**h]h Attribute:}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1j>hjaubh }(hjahhhNhNubh)}(h3``/config/gpio-consumer/example-name/con_id/0/key``h]h//config/gpio-consumer/example-name/con_id/0/key}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjaubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubh }(hjhhhNhNubh)}(h6``/config/gpio-consumer/example-name/con_id/0/offset``h]h2/config/gpio-consumer/example-name/con_id/0/offset}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhK>hj~hhubh)}(hD**Attribute:** ``/config/gpio-consumer/example-name/con_id/0/drive``h](j?)}(h**Attribute:**h]h Attribute:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j>hjubh }(hjhhhNhNubh)}(h5``/config/gpio-consumer/example-name/con_id/0/drive``h]h1/config/gpio-consumer/example-name/con_id/0/drive}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhK@hj~hhubh)}(hC**Attribute:** ``/config/gpio-consumer/example-name/con_id/0/pull``h](j?)}(h**Attribute:**h]h Attribute:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j>hjubh }(hjhhhNhNubh)}(h4``/config/gpio-consumer/example-name/con_id/0/pull``h]h0/config/gpio-consumer/example-name/con_id/0/pull}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhKBhj~hhubh)}(hI**Attribute:** ``/config/gpio-consumer/example-name/con_id/0/active_low``h](j?)}(h**Attribute:**h]h Attribute:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j>hj ubh }(hj hhhNhNubh)}(h:``/config/gpio-consumer/example-name/con_id/0/active_low``h]h6/config/gpio-consumer/example-name/con_id/0/active_low}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubeh}(h]h ]h"]h$]h&]uh1hhhhKDhj~hhubh)}(hI**Attribute:** ``/config/gpio-consumer/example-name/con_id/0/transitory``h](j?)}(h**Attribute:**h]h Attribute:}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1j>hj3ubh }(hj3hhhNhNubh)}(h:``/config/gpio-consumer/example-name/con_id/0/transitory``h]h6/config/gpio-consumer/example-name/con_id/0/transitory}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj3ubeh}(h]h ]h"]h$]h&]uh1hhhhKFhj~hhubh)}(hJThis is a group describing a single GPIO in the ``con_id-gpios`` property.h](h0This is a group describing a single GPIO in the }(hj]hhhNhNubh)}(h``con_id-gpios``h]h con_id-gpios}(hjehhhNhNubah}(h]h ]h"]h$]h&]uh1hhj]ubh property.}(hj]hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKHhj~hhubh)}(hFor virtual consumers created using configfs we use machine lookup tables so this group can be considered as a mapping between the filesystem and the fields of a single entry in ``'struct gpiod_lookup'``.h](hFor virtual consumers created using configfs we use machine lookup tables so this group can be considered as a mapping between the filesystem and the fields of a single entry in }(hj}hhhNhNubh)}(h``'struct gpiod_lookup'``h]h'struct gpiod_lookup'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj}ubh.}(hj}hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKJhj~hhubh)}(hX~The ``'key'`` attribute represents either the name of the chip this GPIO belongs to or the GPIO line name. This depends on the value of the ``'offset'`` attribute: if its value is >= 0, then ``'key'`` represents the label of the chip to lookup while ``'offset'`` represents the offset of the line in that chip. If ``'offset'`` is < 0, then ``'key'`` represents the name of the line.h](hThe }(hjhhhNhNubh)}(h ``'key'``h]h'key'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh attribute represents either the name of the chip this GPIO belongs to or the GPIO line name. This depends on the value of the }(hjhhhNhNubh)}(h ``'offset'``h]h'offset'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh' attribute: if its value is >= 0, then }(hjhhhNhNubh)}(h ``'key'``h]h'key'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh2 represents the label of the chip to lookup while }(hjhhhNhNubh)}(h ``'offset'``h]h'offset'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh4 represents the offset of the line in that chip. If }(hjhhhNhNubh)}(h ``'offset'``h]h'offset'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh is < 0, then }(hjhhhNhNubh)}(h ``'key'``h]h'key'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh! represents the name of the line.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKNhj~hhubh)}(hThe remaining attributes map to the ``'flags'`` field of the GPIO lookup struct. The first two take string values as arguments:h](h$The remaining attributes map to the }(hjhhhNhNubh)}(h ``'flags'``h]h'flags'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhP field of the GPIO lookup struct. The first two take string values as arguments:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKThj~hhubh)}(h**``'drive'``:** ``'push-pull'``, ``'open-drain'``, ``'open-source'`` **``'pull'``:** ``'pull-up'``, ``'pull-down'``, ``'pull-disabled'``, ``'as-is'``h](j?)}(h**``'drive'``:**h]h``’drive’``:}(hj;hhhNhNubah}(h]h ]h"]h$]h&]uh1j>hj7ubh }(hj7hhhNhNubh)}(h``'push-pull'``h]h 'push-pull'}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj7ubh, }(hj7hhhNhNubh)}(h``'open-drain'``h]h 'open-drain'}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj7ubh, }hj7sbh)}(h``'open-source'``h]h 'open-source'}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj7ubh }(hj7hhhNhNubj?)}(h**``'pull'``:**h]h``’pull’``:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j>hj7ubh }hj7sbh)}(h ``'pull-up'``h]h 'pull-up'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj7ubh, }hj7sbh)}(h``'pull-down'``h]h 'pull-down'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj7ubh, }hj7sbh)}(h``'pull-disabled'``h]h'pull-disabled'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj7ubh, }hj7sbh)}(h ``'as-is'``h]h'as-is'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj7ubeh}(h]h ]h"]h$]h&]uh1hhhhKWhj~hhubh)}(h=``'active_low'`` and ``'transitory'`` are boolean attributes.h](h)}(h``'active_low'``h]h 'active_low'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh and }(hjhhhNhNubh)}(h``'transitory'``h]h 'transitory'}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh are boolean attributes.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKZhj~hhubeh}(h]creating-gpio-lookup-tablesah ]h"]creating gpio lookup tablesah$]h&]uh1hhhhhhhhK/ubh)}(hhh](h)}(hActivating GPIO consumersh]hActivating GPIO consumers}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK]ubh)}(hXOOnce the configuration is complete, the ``'live'`` attribute must be set to 1 in order to instantiate the consumer. It can be set back to 0 to destroy the virtual device. The module will synchronously wait for the new simulated device to be successfully probed and if this doesn't happen, writing to ``'live'`` will result in an error.h](h(Once the configuration is complete, the }(hj&hhhNhNubh)}(h ``'live'``h]h'live'}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj&ubh attribute must be set to 1 in order to instantiate the consumer. It can be set back to 0 to destroy the virtual device. The module will synchronously wait for the new simulated device to be successfully probed and if this doesn’t happen, writing to }(hj&hhhNhNubh)}(h ``'live'``h]h'live'}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj&ubh will result in an error.}(hj&hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK_hjhhubeh}(h]activating-gpio-consumersah ]h"]activating gpio consumersah$]h&]uh1hhhhhhhhK]ubh)}(hhh](h)}(h Device-treeh]h Device-tree}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1hhj`hhhhhKfubh)}(hVirtual GPIO consumers can also be defined in device-tree. The compatible string must be: ``"gpio-virtuser"`` with at least one property following the standardized GPIO pattern.h](hZVirtual GPIO consumers can also be defined in device-tree. The compatible string must be: }(hjqhhhNhNubh)}(h``"gpio-virtuser"``h]h"gpio-virtuser"}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjqubhD with at least one property following the standardized GPIO pattern.}(hjqhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhj`hhubh)}(h=An example device-tree code defining a virtual GPIO consumer:h]h=An example device-tree code defining a virtual GPIO consumer:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKlhj`hhubh literal_block)}(hgpio-virt-consumer { compatible = "gpio-virtuser"; foo-gpios = <&gpio0 5 GPIO_ACTIVE_LOW>, <&gpio1 2 0>; bar-gpios = <&gpio0 6 0>; };h]hgpio-virt-consumer { compatible = "gpio-virtuser"; foo-gpios = <&gpio0 5 GPIO_ACTIVE_LOW>, <&gpio1 2 0>; bar-gpios = <&gpio0 6 0>; };}hjsbah}(h]h ]h"]h$]h&]hhforcelanguagenonehighlight_args}uh1jhhhKnhj`hhubeh}(h] device-treeah ]h"] device-treeah$]h&]uh1hhhhhhhhKfubh)}(hhh](h)}(h"Controlling virtual GPIO consumersh]h"Controlling virtual GPIO consumers}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKxubh)}(hOnce active, the device will export debugfs attributes for controlling GPIO arrays as well as each requested GPIO line separately. Let's consider the following device property: ``foo-gpios = <&gpio0 0 0>, <&gpio0 4 0>;``.h](hOnce active, the device will export debugfs attributes for controlling GPIO arrays as well as each requested GPIO line separately. Let’s consider the following device property: }(hjhhhNhNubh)}(h+``foo-gpios = <&gpio0 0 0>, <&gpio0 4 0>;``h]h'foo-gpios = <&gpio0 0 0>, <&gpio0 4 0>;}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKzhjhhubh)}(h7The following debugfs attribute groups will be created:h]h7The following debugfs attribute groups will be created:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK~hjhhubh)}(hC**Group:** ``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo/``h](j?)}(h **Group:**h]hGroup:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j>hjubh }(hjhhhNhNubh)}(h8``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo/``h]h4/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo/}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hMThis is the group that will contain the attributes for the entire GPIO array.h]hMThis is the group that will contain the attributes for the entire GPIO array.}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hM**Attribute:** ``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo/values``h](j?)}(h**Attribute:**h]h Attribute:}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1j>hj3ubh }(hj3hhhNhNubh)}(h>``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo/values``h]h:/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo/values}(hjIhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj3ubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hT**Attribute:** ``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo/values_atomic``h](j?)}(h**Attribute:**h]h Attribute:}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1j>hj]ubh }(hj]hhhNhNubh)}(hE``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo/values_atomic``h]hA/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo/values_atomic}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1hhj]ubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXBoth attributes allow to read and set arrays of GPIO values. User must pass exactly the number of values that the array contains in the form of a string containing zeroes and ones representing inactive and active GPIO states respectively. In this example: ``echo 11 > values``.h](hXBoth attributes allow to read and set arrays of GPIO values. User must pass exactly the number of values that the array contains in the form of a string containing zeroes and ones representing inactive and active GPIO states respectively. In this example: }(hjhhhNhNubh)}(h``echo 11 > values``h]hecho 11 > values}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hThe ``values_atomic`` attribute works the same as ``values`` but the kernel will execute the GPIO driver callbacks in interrupt context.h](hThe }(hjhhhNhNubh)}(h``values_atomic``h]h values_atomic}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh attribute works the same as }(hjhhhNhNubh)}(h ``values``h]hvalues}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubhL but the kernel will execute the GPIO driver callbacks in interrupt context.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hJ**Group:** ``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/``h](j?)}(h **Group:**h]hGroup:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j>hjubh }(hjhhhNhNubh)}(h?``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/``h]h;/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(h\This is a group that represents a single GPIO with ``$index`` being its offset in the array.h](h3This is a group that represents a single GPIO with }(hjhhhNhNubh)}(h ``$index``h]h$index}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh being its offset in the array.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hV**Attribute:** ``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/consumer``h](j?)}(h**Attribute:**h]h Attribute:}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1j>hj#ubh }(hj#hhhNhNubh)}(hG``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/consumer``h]hC/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/consumer}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj#ubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(h;Allows to set and read the consumer label of the GPIO line.h]h;Allows to set and read the consumer label of the GPIO line.}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hV**Attribute:** ``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/debounce``h](j?)}(h**Attribute:**h]h Attribute:}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1j>hj[ubh }(hj[hhhNhNubh)}(hG``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/debounce``h]hC/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/debounce}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj[ubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hhjubh }(hjhhhNhNubh)}(hH``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/direction``h]hD/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/direction}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(h^**Attribute:** ``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/direction_atomic``h](j?)}(h**Attribute:**h]h Attribute:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j>hjubh }(hjhhhNhNubh)}(hO``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/direction_atomic``h]hK/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/direction_atomic}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hThese two attributes allow to set the direction of the GPIO line. They accept "input" and "output" as values. The atomic variant executes the driver callback in interrupt context.h]hThese two attributes allow to set the direction of the GPIO line. They accept “input” and “output” as values. The atomic variant executes the driver callback in interrupt context.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hX**Attribute:** ``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/interrupts``h](j?)}(h**Attribute:**h]h Attribute:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j>hjubh }(hjhhhNhNubh)}(hI``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/interrupts``h]hE/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/interrupts}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXIf the line is requested in input mode, writing ``1`` to this attribute will make the module listen for edge interrupts on the GPIO. Writing ``0`` disables the monitoring. Reading this attribute returns the current number of registered interrupts (both edges).h](h0If the line is requested in input mode, writing }(hj hhhNhNubh)}(h``1``h]h1}(hj' hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubhX to this attribute will make the module listen for edge interrupts on the GPIO. Writing }(hj hhhNhNubh)}(h``0``h]h0}(hj9 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubhr disables the monitoring. Reading this attribute returns the current number of registered interrupts (both edges).}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hS**Attribute:** ``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/value``h](j?)}(h**Attribute:**h]h Attribute:}(hjU hhhNhNubah}(h]h ]h"]h$]h&]uh1j>hjQ ubh }(hjQ hhhNhNubh)}(hD``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/value``h]h@/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/value}(hjg hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjQ ubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hZ**Attribute:** ``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/value_atomic``h](j?)}(h**Attribute:**h]h Attribute:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j>hj{ ubh }(hj{ hhhNhNubh)}(hK``/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/value_atomic``h]hG/sys/kernel/debug/gpio-virtuser/$dev_name/gpiod:foo:$index/value_atomic}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj{ ubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hBoth attributes allow to read and set values of individual requested GPIO lines. They accept the following values: ``1`` and ``0``.h](hsBoth attributes allow to read and set values of individual requested GPIO lines. They accept the following values: }(hj hhhNhNubh)}(h``1``h]h1}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh and }(hj hhhNhNubh)}(h``0``h]h0}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]"controlling-virtual-gpio-consumersah ]h"]"controlling virtual gpio consumersah$]h&]uh1hhhhhhhhKxubeh}(h]virtual-gpio-consumerah ]h"]virtual gpio consumerah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerj error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(j j j{jxjjj]jZjjj j u nametypes}(j j{jj]jj uh}(j hjxhjj~jZjjj`j ju footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.