[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y/k8sVtDhDiT1Iy3@surfacebook>
Date: Sat, 25 Feb 2023 00:39:45 +0200
From: andy.shevchenko@...il.com
To: Asmaa Mnebhi <asmaa@...dia.com>
Cc: Andy Shevchenko <andy.shevchenko@...il.com>,
"linus.walleij@...aro.org" <linus.walleij@...aro.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] gpio: mmio: handle "ngpios" properly in bgpio_init()
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
Powered by blists - more mailing lists