[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 4/8] gpiolib: Add support for GPIO lookup by line name
From: |
Linus Walleij |
Subject: |
Re: [PATCH v6 4/8] gpiolib: Add support for GPIO lookup by line name |
Date: |
Thu, 26 Mar 2020 22:18:39 +0100 |
On Tue, Mar 24, 2020 at 2:57 PM Geert Uytterhoeven
<address@hidden> wrote:
> Currently a GPIO lookup table can only refer to a specific GPIO by a
> tuple, consisting of a GPIO controller label and a GPIO offset inside
> the controller.
>
> However, a GPIO may also carry a line name, defined by DT or ACPI.
> If present, the line name is the most use-centric way to refer to a
> GPIO. Hence add support for looking up GPIOs by line name.
>
> Implement this by reusing the existing gpiod_lookup infrastructure.
> Rename gpiod_lookup.chip_label to gpiod_lookup.key, to make it clear
> that this field can have two meanings, and update the kerneldoc and
> GPIO_LOOKUP*() macros.
>
> Signed-off-by: Geert Uytterhoeven <address@hidden>
> Reviewed-by: Ulrich Hecht <address@hidden>
> Reviewed-by: Eugeniu Rosca <address@hidden>
> Tested-by: Eugeniu Rosca <address@hidden>
I kind of like this approach, however there are things here that
need to be considered: the line name is in no way globally unique,
and I think there are already quite a few GPIO chips that
have the same line names assigned for every instance of that
chip.
gpiochip_set_desc_names() only warns if there is a line with
the same name on the same gpio_chip.
I suppose we need to document that the line name look-up
will be on a first-come-first-served basis: whatever line
we find first with this name is what you will get a reference
to, no matter what chip it is on, and it is possible albeit
not recommended that some other chip has a line with the
same name.
Yours,
Linus Walleij
- [PATCH v6 0/8] gpio: Add GPIO Aggregator, Geert Uytterhoeven, 2020/03/24
- [PATCH v6 1/8] ARM: integrator: impd1: Use GPIO_LOOKUP() helper macro, Geert Uytterhoeven, 2020/03/24
- [PATCH v6 8/8] MAINTAINERS: Add GPIO Aggregator section, Geert Uytterhoeven, 2020/03/24
- [PATCH v6 7/8] docs: gpio: Add GPIO Aggregator documentation, Geert Uytterhoeven, 2020/03/24
- [PATCH v6 3/8] mfd: sm501: Use GPIO_LOOKUP_IDX() helper macro, Geert Uytterhoeven, 2020/03/24
- [PATCH v6 2/8] i2c: i801: Use GPIO_LOOKUP() helper macro, Geert Uytterhoeven, 2020/03/24
- [PATCH v6 6/8] gpio: Add GPIO Aggregator, Geert Uytterhoeven, 2020/03/24
- [PATCH v6 4/8] gpiolib: Add support for GPIO lookup by line name, Geert Uytterhoeven, 2020/03/24
- Re: [PATCH v6 4/8] gpiolib: Add support for GPIO lookup by line name,
Linus Walleij <=
- [PATCH v6 5/8] gpiolib: Introduce gpiod_set_config(), Geert Uytterhoeven, 2020/03/24
- Re: [PATCH v6 5/8] gpiolib: Introduce gpiod_set_config(), Linus Walleij, 2020/03/27
- Re: [PATCH v6 1/8] ARM: integrator: impd1: Use GPIO_LOOKUP() helper macro, Linus Walleij, 2020/03/26