public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: andy.shevchenko@gmail.com
To: Asmaa Mnebhi <asmaa@nvidia.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] gpio: mmio: handle "ngpios" properly in bgpio_init()
Date: Sat, 25 Feb 2023 00:39:45 +0200	[thread overview]
Message-ID: <Y/k8sVtDhDiT1Iy3@surfacebook> (raw)
In-Reply-To: <CH2PR12MB3895688618F6465904E7ADD9D7A89@CH2PR12MB3895.namprd12.prod.outlook.com>

Fri, Feb 24, 2023 at 09:31:23PM +0000, Asmaa Mnebhi kirjoitti:

...

> > The problem with this change is that you need to provide bgpio_bits.
> > 
> > So, if there is a property when bgpio_bits will be updated?
> > 
> > That's said what you need is something like this:
> > 1) split "ngpios" handling code (lines ~718-744 in gpiolib.c)  into a helper
> > function that is available inside drivers/gpio;
> > 2) use it in bgpio_init() by overriding bgpio_bits.
> > 
> > ret = new_helper();
> > if (ret)
> >     gc->bgpio_bits = sz * 8;
> > else
> >     ... = gc->ngpio;
> 
> So this new_helper() which reads the ngpios property, would be called from
> bgpio_init() and From gpiochip_add_data_with_key() correct? Since there are
> some drivers that don’t use bgpio_init().

Correct.

> Also, shouldn't "gc->bgpio_bits = = sz * 8;" be independent of new_helper()

Nope. You need to link them anyway.

> function?  "bgpio_bits" is described as "number of register bits used for a
> generic GPIO i.e. <register width> * 8" which seems different from "ngpio"
> described as "the number of GPIOs handled by this controller"

But you are right, this should be = round_up(gc->ngpio, 8); to match the logic
with sz.

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2023-02-24 22:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 19:20 [PATCH v2] gpio: mmio: handle "ngpios" properly in bgpio_init() Asmaa Mnebhi
2023-02-24 20:48 ` Andy Shevchenko
2023-02-24 21:31   ` Asmaa Mnebhi
2023-02-24 22:39     ` andy.shevchenko [this message]

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=Y/k8sVtDhDiT1Iy3@surfacebook \
    --to=andy.shevchenko@gmail.com \
    --cc=asmaa@nvidia.com \
    --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
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