Linux-GPIO Archive on lore.kernel.org
 help / color / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Serge Semin <fancer.lancer@gmail.com>
Cc: "open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Lee Jones <lee.jones@linaro.org>
Subject: Re: [PATCH v1 0/6] mfd: Make use of software nodes
Date: Thu, 18 Jun 2020 11:56:54 +0300
Message-ID: <20200618085654.GL2428291@smile.fi.intel.com> (raw)
In-Reply-To: <20200616225648.eqzugzapatblndcy@mobilestation>

On Wed, Jun 17, 2020 at 01:56:48AM +0300, Serge Semin wrote:
> On Wed, Jun 17, 2020 at 12:40:35AM +0300, Andy Shevchenko wrote:
> > On Tue, Jun 16, 2020 at 11:03 PM Serge Semin <fancer.lancer@gmail.com> wrote:
> > > On Mon, Jun 08, 2020 at 04:42:54PM +0300, Andy Shevchenko wrote:
> > > > Some devices would need to have a hierarchy of properties and
> > > > child nodes passed to the child or children of MFD. For such case
> > > > we may utilize software nodes, which is superior on device properties.
> > > >
> > > > Add support of software nodes to MFD core and convert one driver
> > > > to show how it looks like. This allows to get rid of legacy platform
> > > > data.
> > > >
> > > > The change has been tested on Intel Galileo Gen 2.
> > >
> > > I am wondering whether we could move the {gpio_base, ngpio, irq_shared}
> > > part into the gpio-dwapb.c driver and use either the ACPI-based or
> > > platform_device_id-based matching to get the device-specific resources
> > > info through the driver_data field. By doing so you wouldn't need to
> > > introduce a new "snps,gpio-base"-like property and propagate
> > > software_node-based properties, but still you could get rid of the
> > > dwapb_platform_data structure since all the info would be locally
> > > available.
> > 
> > The idea is to get rid of the driver being dependent on some quirks
> > when we may do it clearly and nicely.
> 
> Yes, I've got that and in most of the aspects I like what you suggested
> in this parchset. But it seems to me that the maintainers are mostly prone
> to having some of the platform-specifics being locally (in-driver) defined.

You are a maintainer of the dwapb-gpio. Is it what you insist?

> So I proposed an alternative solution, which might do to satisfy their
> requirement.

I'm puzzled whom about you are talking.

> Note saying that you want to get rid of the quirks and
> introducing something like "gpio-base" firmware property seems contradicting
> a bit. 

Maybe I need to elaborate that under quirks I meant quirk-clean GPIO driver,
so, it wouldn't care about what platform(s) require base and what do not.

> > We, by applying this series, make (keep) layers independent: board
> > code vs. driver code. Mixing them more is the opposite to what I
> > propose.
> > 
> > WRT property.
> > snps,gpio-base can be easily changed to *already in use* gpio-base or
> > being both converted to linux,gpio-base to explicitly show people that
> > this is internal stuff that must not be present in firmware nodes.
> 
> As I see it the part with "gpio-base" and the irq_shared can be moved to the
> gpio-dwapb.c driver to be defined as the quark-specific quirks. Adding a
> property like "gpio-base" seems like a quirk anyway, so I'd leave it defined in
> the driver.

Huh?! The whole idea is make GPIO driver agnostic from platforms and their quirks.

> * Note I don't really like replacing the irq_shared flag with to_of_node()
> because in general to_of_node() doesn't mean the IRQ line is shared, so
> selecting the shared and non-shared interrupt request paths based on that macro
> seems hackish.

This I can understand, but can you propose better alternative?

> > > If ACPI-based matching doesn't uniquely address the Quark GPIO node,
> > > then you could just replace the intel_quark_mfd_cells[0].name with
> > > something like "gpio-dwapb-quark", which then by the MFD core will be
> > > copied to the corresponding platform_device->name due to calling
> > > platform_device_alloc() with cell-name passed. That name will be used
> > > to match a platform_driver with id_table having that new name added.
> > 
> > Oh, that doesn't sound right. It makes things ugly.
> 
> I may have said that a bit unclearly. The only thing you'd need to do is to
> add an unique name to the Quark GPIO cell, like:
> drivers/mfd/intel_quark_i2c_gpio.c:
> static struct mfd_cell intel_quark_mfd_cells[] = {
>         {
>                 .name = "gpio-dwapb-quark",
>         }
> 
> Then make the gpio-dwapb.c driver being compatible with that device by declaring
> the id_table with that device name and passing the table to the DW APB GPIO
> "struct platform_driver" descriptor. The MFD/platform cores already provide the
> functionality of matching those two device and driver. If ACPI node uniquely
> defines the Quark GPIO with all that quirks applicable then you wouldn't even
> need to do the platform_device-driver-based matching. Just use the acpi_device_id
> to get the quirks flags/descriptors. 

What you are talking about? Can you provide a code we can discuss?

> * Though indeed it would be better to mark the "snps,nr-gpios" as deprecated in
> the DT schema and have the "ngpios" supported as well.

Actually I used to have that piece in my first patches, but decided to remove
due to this property being (semi-)internal. I would like to hear GPIO
maintainers about this.

Bart, Linus?

-- 
With Best Regards,
Andy Shevchenko



  reply index

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08 13:42 Andy Shevchenko
2020-06-08 13:42 ` [PATCH v1 1/6] gpio: dwapb: Replace irq_shared flag with fwnode type check Andy Shevchenko
2020-06-08 13:42 ` [PATCH v1 2/6] gpio: dwapb: Read GPIO base from snps,gpio-base property Andy Shevchenko
2020-06-10 11:26   ` Linus Walleij
2020-06-10 13:41     ` Andy Shevchenko
2020-06-08 13:42 ` [PATCH v1 3/6] mfd: core: Propagate software node group to the sub devices Andy Shevchenko
2020-06-08 19:25   ` Lee Jones
2020-06-09 12:40     ` Andy Shevchenko
2020-06-17 12:51       ` Lee Jones
2020-06-08 13:42 ` [PATCH v1 4/6] mfd: intel_quark_i2c_gpio: Convert to use software nodes Andy Shevchenko
2020-06-10 11:38   ` Linus Walleij
2020-06-10 13:43     ` Andy Shevchenko
2020-06-08 13:42 ` [PATCH v1 5/6] gpio: dwapb: Get rid of legacy platform data Andy Shevchenko
2020-06-10 11:39   ` Linus Walleij
2020-06-10 13:47     ` Andy Shevchenko
2020-06-08 13:43 ` [PATCH v1 6/6] gpio: dwapb: Define magic number for IRQ and GPIO lines Andy Shevchenko
2020-06-16 20:02 ` [PATCH v1 0/6] mfd: Make use of software nodes Serge Semin
2020-06-16 21:40   ` Andy Shevchenko
2020-06-16 22:56     ` Serge Semin
2020-06-18  8:56       ` Andy Shevchenko [this message]
2020-06-19 22:12         ` Serge Semin
2020-06-20 10:13           ` Andy Shevchenko
2020-06-23  1:49             ` Serge Semin
2020-06-24 12:43               ` Andy Shevchenko

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=20200618085654.GL2428291@smile.fi.intel.com \
    --to=andy.shevchenko@gmail.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=fancer.lancer@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.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

Linux-GPIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-gpio/0 linux-gpio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-gpio linux-gpio/ https://lore.kernel.org/linux-gpio \
		linux-gpio@vger.kernel.org
	public-inbox-index linux-gpio

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-gpio


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git