From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Cc: "Linus Walleij" <linus.walleij@linaro.org>,
"Lee Jones" <lee@kernel.org>, "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Kamel Bouhara" <kamel.bouhara@bootlin.com>,
"Bartosz Golaszewski" <brgl@bgdev.pl>,
"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
"Uwe Kleine-König" <ukleinek@kernel.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-input@vger.kernel.org,
linux-pwm@vger.kernel.org,
"Grégory Clement" <gregory.clement@bootlin.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v3 4/7] gpio: max7360: Add MAX7360 gpio support
Date: Mon, 27 Jan 2025 14:52:08 +0200 [thread overview]
Message-ID: <Z5eBeGhoBVVVUmDr@smile.fi.intel.com> (raw)
In-Reply-To: <D74G95A3DHG3.OD522T88GX83@bootlin.com>
On Fri, Jan 17, 2025 at 04:22:33PM +0100, Mathieu Dubois-Briand wrote:
> On Tue Jan 14, 2025 at 3:33 PM CET, Linus Walleij wrote:
> > On Mon, Jan 13, 2025 at 1:43 PM Mathieu Dubois-Briand
> > My most generic feedback is if you have looked at using
> > select GPIO_REGMAP for this driver?
> >
> > The regmap utility library is very helpful, look how other driver
> > selecting GPIO_REGMAP gets default implementations
> > from the library just git grep GPIO_REGMAP drivers/gpio/
>
> I tried to switch to GPIO_REGMAP and I really like it overall, as it
> does simplify a lot the code. However, I identified two features that I
> was not able to port so far: the request()/free() callbacks and the
> interrupts.
You can easily extend the config to provide both if needed.
So, update gpio-regmap.c itself as a prerequisite.
> So for the request()/free() callbacks, I cannot add them anymore, as
> they are set on the gpio_chip structure, and this structure is hidden
> behind the gpio_regmap structure. I could easily modify the
> gpio_regmap_config structure and gpio_regmap_register() to allow to
> provide these callbacks, but is this acceptable? Or should I switch to a
> different way to prevent concurrent use of the same pin? I saw you
> mentioned the possibility of defining pin control.
>
> On the IRQ side, before switching to GPIO_REGMAP, I was able to define
> the IRQ configuration using the irq member of the gpio_chip structure.
> This does create the IRQ domain for me in a quite straightforward way.
> Again, I will not be able to do that anymore, as the gpio_chip structure
> is hidden.
Look how it's done in, e.g., drivers/gpio/gpio-104-idi-48.c.
It's pretty straightforward. You create and register an IRQ chip with
devm_regmap_add_irq_chip(). It creates a domain for you.
> I saw I can specify my own irq_domain in gpio_regmap_config, so that
> would be a way, but I was wondering if there is any way to have
> something as easy as previously.
>
> I had a quick look at existing drivers using GPIO_REGMAP and providing
> IRQ support: I believe they are all using REGMAP_IRQ. And I believe I
> cannot use REGMAP_IRQ here, as if I understood correctly, I would need
> to have a register telling me exactly on which GPIO I have a pending
> interrupt and I don't have such a thing: all I know is there was an
> interrupt related to the GPIOs, and then I have to compare each GPIO
> with the previous known state to know which pin is affected.
>
> Do you have any thought about this?
I briefly looked at the code of regmap IRQ and I don't see big impediments
for your case. So, you seems to have mask, unmask, and input registers.
What you most likely want to do is to use input as status (regmap IRQ
supports configuration without status registers).
What seems to be needed is the logic that uses previous state to handle a new
one. This is not only this chip that may need this type of handling, so it
will be beneficial for others that may be converted to use gpio-regmap.c.
So, I don't think we need full bypass of the GPIO IRQ chip through
gpio-regmap.c.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-01-27 12:52 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 12:42 [PATCH v3 0/7] Add support for MAX7360 Mathieu Dubois-Briand
2025-01-13 12:42 ` [PATCH v3 1/7] dt-bindings: mfd: gpio: Add MAX7360 Mathieu Dubois-Briand
2025-01-14 8:11 ` Krzysztof Kozlowski
2025-01-14 13:02 ` Mathieu Dubois-Briand
2025-01-13 12:42 ` [PATCH v3 2/7] mfd: Add max7360 support mathieu.dubois-briand
2025-01-15 15:42 ` Lee Jones
2025-01-17 10:38 ` Mathieu Dubois-Briand
2025-01-13 12:42 ` [PATCH v3 3/7] pwm: max7360: Add MAX7360 PWM support mathieu.dubois-briand
2025-01-17 9:33 ` Uwe Kleine-König
2025-01-17 14:11 ` Mathieu Dubois-Briand
2025-01-17 14:40 ` Uwe Kleine-König
2025-01-17 15:47 ` Mathieu Dubois-Briand
2025-01-20 14:13 ` Uwe Kleine-König
2025-01-22 12:37 ` Mathieu Dubois-Briand
2025-01-13 12:42 ` [PATCH v3 4/7] gpio: max7360: Add MAX7360 gpio support Mathieu Dubois-Briand
2025-01-14 14:33 ` Linus Walleij
2025-01-14 17:57 ` Mathieu Dubois-Briand
2025-01-17 15:22 ` Mathieu Dubois-Briand
2025-01-22 13:18 ` Linus Walleij
2025-01-27 12:52 ` Andy Shevchenko [this message]
2025-01-27 13:07 ` Andy Shevchenko
2025-02-12 12:57 ` Mathieu Dubois-Briand
2025-02-12 15:14 ` Andy Shevchenko
2025-02-12 16:08 ` Mathieu Dubois-Briand
2025-02-12 16:17 ` Andy Shevchenko
2025-02-13 10:59 ` Mathieu Dubois-Briand
2025-02-13 13:45 ` Mathieu Dubois-Briand
2025-02-13 19:47 ` Andy Shevchenko
2025-02-14 8:42 ` Mathieu Dubois-Briand
2025-01-13 12:42 ` [PATCH v3 5/7] input: keyboard: Add support for MAX7360 keypad Mathieu Dubois-Briand
2025-01-13 12:42 ` [PATCH v3 6/7] input: misc: Add support for MAX7360 rotary Mathieu Dubois-Briand
2025-01-14 13:16 ` Mathieu Dubois-Briand
2025-01-13 12:42 ` [PATCH v3 7/7] MAINTAINERS: Add entry on MAX7360 driver Mathieu Dubois-Briand
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=Z5eBeGhoBVVVUmDr@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=gregory.clement@bootlin.com \
--cc=kamel.bouhara@bootlin.com \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=mathieu.dubois-briand@bootlin.com \
--cc=robh@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=ukleinek@kernel.org \
/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).