mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hector Palacios <hector.palacios@digi.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: linus.walleij@linaro.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, andy@kernel.org,
	conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de,
	kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com,
	stefan@agner.ch, linux-gpio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/3] gpio: vf610: add support to DT 'ngpios' property
Date: Thu, 18 Jan 2024 13:44:23 +0100	[thread overview]
Message-ID: <9b370036-bf3a-49d3-99a0-5c11eaca4e6f@digi.com> (raw)
In-Reply-To: <CAMRc=MfAW5NDJHtZ1333-xrcCyQfft-pQF1-0Vv_ehY16agShw@mail.gmail.com>

On 1/18/24 13:03, Bartosz Golaszewski wrote:
> 
> On Thu, Jan 18, 2024 at 10:04 AM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
>>
>> On Thu, Jan 18, 2024 at 10:25 AM Hector Palacios
>> <hector.palacios@digi.com> wrote:
>>> On 1/17/24 21:51, Andy Shevchenko wrote:
>>>>> Some SoCs, such as i.MX93, don't have all 32 pins available
>>>>> per port. Allow optional generic 'ngpios' property to be
>>>>> specified from the device tree and default to
>>>>> VF610_GPIO_PER_PORT (32) if the property does not exist.
>>
>> ...
>>
>>>>> +       ret = device_property_read_u32(dev, "ngpios", &ngpios);
>>>>> +       if (ret || ngpios > VF610_GPIO_PER_PORT)
>>>>> +               gc->ngpio = VF610_GPIO_PER_PORT;
>>>>> +       else
>>>>> +               gc->ngpio = (u16)ngpios;
>>>>
>>>> This property is being read by the GPIOLIB core. Why do you need to repeat this?
>>>
>>> My apologies; I had not seen this.
>>> I'll use gpiochip_get_ngpios() on the next iteration.
>>
>> But still why?
>> https://elixir.bootlin.com/linux/latest/source/drivers/gpio/gpiolib.c#L867
>>
>> It's called for every driver.
>>
>> Maybe it's needed to be refactored to allow fallbacks? Then can the
>> GPIO MMIO case also be updated?
>>
> 
> I guess it's because Hector wants to set an upper limit on the number of GPIOs?

I think Andy is suggesting to rework the gpio-vf610 driver to use 
bgpio_chip struct (it doesn't currently), and then I guess the 'ngpio' 
property gets read automatically if you call bgpio_init().
-- 
Héctor Palacios


  reply	other threads:[~2024-01-18 12:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-17  8:32 [PATCH v3 0/3] gpio: support i.MX93 truly available GPIO pins Hector Palacios
2024-01-17  8:32 ` [PATCH v3 1/3] gpio: vf610: add support to DT 'ngpios' property Hector Palacios
2024-01-17 20:51   ` Andy Shevchenko
2024-01-18  8:25     ` Hector Palacios
2024-01-18  9:03       ` Andy Shevchenko
2024-01-18 12:03         ` Bartosz Golaszewski
2024-01-18 12:44           ` Hector Palacios [this message]
2024-01-18 12:59             ` Bartosz Golaszewski
2024-01-17  8:32 ` [PATCH v3 2/3] dt-bindings: gpio: vf610: add optional 'ngpios' Hector Palacios
2024-01-17  8:55   ` Krzysztof Kozlowski
2024-01-17  8:32 ` [PATCH v3 3/3] arm64: dts: imx93: specify available 'ngpios' per GPIO port Hector Palacios

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=9b370036-bf3a-49d3-99a0-5c11eaca4e6f@digi.com \
    --to=hector.palacios@digi.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=brgl@bgdev.pl \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=stefan@agner.ch \
    /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

all inboxes | Powered by JetHome®