lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 26 Sep 2022 08:44:28 +0000
From:   Wei Yongjun <weiyongjun@...weicloud.com>
To:     Bartosz Golaszewski <brgl@...ev.pl>,
        Thomas Gleixner <tglx@...utronix.de>,
        Linus Walleij <linus.walleij@...aro.org>
Cc:     Wei Yongjun <weiyongjun1@...wei.com>, linux-gpio@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH v2 3/3] gpio: sim: document use case for interrupt controller

From: Wei Yongjun <weiyongjun1@...wei.com>

Add document for using GPIO sim as interrupt controller.

Signed-off-by: Wei Yongjun <weiyongjun1@...wei.com>
---
 Documentation/admin-guide/gpio/gpio-sim.rst | 44 +++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/Documentation/admin-guide/gpio/gpio-sim.rst b/Documentation/admin-guide/gpio/gpio-sim.rst
index d8a90c81b9ee..7ccb3f80c90e 100644
--- a/Documentation/admin-guide/gpio/gpio-sim.rst
+++ b/Documentation/admin-guide/gpio/gpio-sim.rst
@@ -132,3 +132,47 @@ group there are two attibutes:
     ``value`` - allows to read the current value of the line which may be
                 different from the pull if the line is being driven from
                 user-space
+
+An example device-tree code defining a GPIO simulator as interrupt controller:
+
+.. code-block :: none
+
+    gpio-sim {
+        compatible = "gpio-simulator";
+
+        bank0 {
+            gpio-controller;
+            #gpio-cells = <2>;
+            ngpios = <16>;
+
+            interrupt-controller;
+            #interrupt-cells = <2>;
+
+            line0 {
+                gpio-hog;
+                gpios = <0 1>;
+                input;
+                line-name = "irq-sim";
+            }
+        };
+    };
+
+    spi: spi {
+        compatible = "spi-mockup";
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        can0: can@1 {
+            compatible = "microchip,mcp2515";
+            reg = <1>;
+            interrupt-parent = <&bank0>;
+            interrupts = <0 IRQ_TYPE_EDGE_BOTH>;
+        }
+    };
+
+Trigger irq by writing value to pull setting:
+
+.. code-block :: none
+
+    $ echo pull-down > /sys/devices/platform/gpio-sim/gpiochipX/sim_gpio0/pull
+    $ echo pull-up > /sys/devices/platform/gpio-sim/gpiochipX/sim_gpio0/pull
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ