-
Notifications
You must be signed in to change notification settings - Fork 7.7k
drivers: led: gpio: Add pinctrl support #89797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
12b5afe
to
1700944
Compare
Allow specifying pinmuxing in gpio-leds. A lot of board have on-board LEDs, so allowing specifying pinmux in these nodes helps keep the base GPIO node cleaner, and easier to write overlays for. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
1700944
to
156d111
Compare
|
Since they are just regular E.g. how would this look using pinmuxing?: leds: leds {
compatible = "gpio-leds";
green_led_1: led_1 {
gpios = <&gpiob 0 GPIO_ACTIVE_HIGH>;
label = "User LD1";
};
yellow_led_1: led_2 {
gpios = <&gpiof 4 GPIO_ACTIVE_HIGH>;
label = "User LD2";
};
red_led_1: led_3 {
gpios = <&gpiog 4 GPIO_ACTIVE_HIGH>;
label = "User LD3";
};
}; If it makes sense. |
So, I might be a bit biased since I am coming from linux dt. Here is how I currently need to do pimuxing:
Now, if I want to add a new LED for a single application, I can write the following overlay:
As you can see, the overlay for If pinmuxing is supported in the gpio-leds itself, then things become a bit cleaner. The base dt will be as follows:
And overlay:
|
I have only used pinmuxing when the GPIO is used with a non-gpio driver, e.g. ADC, PWM, SPI, etc. Are you sure you need pinmuxing? |
Well, not sure about other boards, but at least on beagles (which use Ti chipsets), each pin can pretty much be used as any peripheral. So GPIO is just another pinmux on most pins, the same as I2C, SPI, etc. Normally, in case of boards like PocketBeagle 2, we try to have 3 modes documented for each pin. So pinmuxing is quite important. |
if (err < 0 && err != -ENOENT) { | ||
LOG_ERR("failed to apply pinctrl"); | ||
return err; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Linux, the default pin configuration is not applied by the end drivers but by the pinctrl driver. I am not sure that's the right way to do that. Let's ask for some advice. @gmarull, what do you think ?
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
Allow specifying pinmuxing in gpio-leds. A lot of board have on-board LEDs, so allowing specifying pinmux in these nodes helps keep the base GPIO node cleaner, and easier to write overlays for.