Re: [PATCH v1 1/1] pinctrl: tangier: Move default strength assignment to a switch-case

From: Andy Shevchenko
Date: Thu Nov 02 2023 - 08:38:11 EST


On Thu, Nov 02, 2023 at 02:34:30PM +0200, Andy Shevchenko wrote:
> On Thu, Nov 02, 2023 at 08:36:11AM +0100, Linus Walleij wrote:
> > On Mon, Oct 30, 2023 at 4:54 PM Andy Shevchenko
> > <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

(...)

> > > + case 1: /* Set default strength value in case none is given */
> >
> > So where does this 1 come from in the end? That's the piece I
> > am missing in this explanation. Somewhere, someone decided
> > to pass 1 to indicate "pull to default resistance".
> >
> > Is it coming from ACPI firmware?
>
> No, it's pure Linux kernel decision.
> gpio_set_bias() is who made that. That's why it needs to be chosen on global
> level.
>
> We may even document somewhere that arguments let's say up to 10 do not make
> any sense in real life, as even for 1.2 v it will give 120 mA current on a single
> pin. Yet, theoretically that's possible for discrete industrial GPIOs, so we
> can choose "very big number" if such case appears in the future. I don't want

Just realized that "very big number" is limited to 16-bit value right now and
65 kOhm is quite reasonable value for the pull bias (yet we can use exact
0xffff for the "special" case).

> to change 1 to something else right now as it may break things.
>
> > for default pull" should be added to the constant definition in the
> > code.

--
With Best Regards,
Andy Shevchenko