linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Wei Yongjun <weiyongjun1@huawei.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Linus Walleij <linus.walleij@linaro.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next 0/2] allow gpio simulator be used as interrupt controller
Date: Wed, 31 Aug 2022 18:08:53 +0200	[thread overview]
Message-ID: <CAMRc=Mc-m7JfDqM3ALy43T+S9DdpV8boEy+J6ruQZjLkqbZHPw@mail.gmail.com> (raw)
In-Reply-To: <20220826080230.1712978-1-weiyongjun1@huawei.com>

On Fri, Aug 26, 2022 at 9:44 AM Wei Yongjun <weiyongjun1@huawei.com> wrote:
>
> This series allow gpio simulator be used as interrupt controller, the use
> case is mockup some device which using GPIO as interrupt controller, such
> as mcp2515 CAN device. With the dts [1], we can mockup a mcp2515 device,
> and trigger irq by following commands:
>
>  $ echo pull-down > /sys/bus/gpio/devices/gpiochip0/sim_gpio0/pull
>  $ echo pull-up > /sys/bus/gpio/devices/gpiochip0/sim_gpio0/pull
>
>
> --[1]---------------------------------------------------------
> /dts-v1/;
>
> #include <dt-bindings/interrupt-controller/irq.h>
>
> / {
>         clk24m: clk24m {
>                 compatible = "fixed-clock";
>                 clock-output-names = "clk24m";
>                 clock-frequency = <24000000>;
>                 #clock-cells = <0>;
>         };
>
>         gpio-sim {
>                 compatible = "gpio-simulator";
>
>                 bank0: bank0 {
>                         gpio-controller;
>                         #gpio-cells = <2>;
>                         ngpios = <16>;
>
>                         interrupt-controller;
>                         #interrupt-cells = <2>;
>
>                         line_b-hog {
>                                 gpio-hog;
>                                 gpios = <0 1>;
>                                 input;
>                                 line-name = "irq-sim";
>                         };

Why do you need this hog? The GPIO will be marked as requested once
the interrupt is taken by the driver.

>                 };
>         };
>
>         spi: spi {
>                 compatible = "spi-mockup";
>
>                 #address-cells = <1>;
>                 #size-cells = <0>;
>
>                 can0: can@1 {
>                         compatible = "microchip,mcp2515";
>                         reg = <1>;
>                         clocks = <&clk24m>;
>                         interrupt-parent = <&bank0>;
>                         interrupts = <0 IRQ_TYPE_EDGE_BOTH>;
>                 };
>
>         };
> };
> ------------------------------><-----------------------------
>
> Wei Yongjun (2):
>   genirq/irq_sim: Allow both one and two cell bindings
>   gpio: sim: make gpio simulator can be used as interrupt controller
>
>  drivers/gpio/gpio-sim.c | 2 +-
>  kernel/irq/irq_sim.c    | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> --
> 2.34.1
>

Can you add some info about this to the documentation?

Otherwise looks good.

Bart

  parent reply	other threads:[~2022-08-31 16:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26  8:02 [PATCH -next 0/2] allow gpio simulator be used as interrupt controller Wei Yongjun
2022-08-26  8:02 ` [PATCH -next 1/2] genirq/irq_sim: Allow both one and two cell bindings Wei Yongjun
2022-08-26  8:02 ` [PATCH -next 2/2] gpio: sim: make gpio simulator can be used as interrupt controller Wei Yongjun
2022-08-31 16:08 ` Bartosz Golaszewski [this message]
2022-09-26  6:57   ` [PATCH -next 0/2] allow gpio simulator " Wei Yongjun
2022-09-26  7:38     ` Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMRc=Mc-m7JfDqM3ALy43T+S9DdpV8boEy+J6ruQZjLkqbZHPw@mail.gmail.com' \
    --to=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=weiyongjun1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).