How to add a GPIO device to the DeviceTree and set it's default pinstate


I’m attempting to add a few GPIO devices to my device tree so that I can set the default pin output to initialize a few components that I’m using on boot.

I’m sure that I’m missing something here but I’m not sure what it is. The pins are to be configured as plain old gpio pins, that I want to set the pinstate on (e.g. boot with pin high/low) this example I want to boot it low so that the led does not illuminate on boot. Other examples I can post upon request, that so far don’t do a whole lot.

So far I haven’t seen much results from the following:
led_red {
pinctrl-names = “default”;`
pinctrl-0 = <&led_red>;
compatible = “qcom,msm8916-pinctrl”;
label = “led-red”;
gpios = <&msmgpio 21 GPIO_ACTIVE_HIGH>;
status = “okay”;

led_red: led_red {
pinmux {
function = “gpio”;
pins = “gpio21”;
pinconf {
pins = “gpio21”;
function = “gpio”;

Did you ever solve this? I am also trying to setup basic GPIOs, (with similar setup to yours) but I must be missing some bit of understanding to make it work…

This one is to be able to control gpio from the driver, itself, I don’t think this is what you need.