I have created a device tree (DT) overlay file based on the examples in 
/lib/firmware for a GPIO pin to be used to control a relay that powers a 
peripheral.  As long as the GPIO is output/high the relay is closed and the 
peripheral has power,   So consequentially, I need the GPIO pin to have a 
default state of "high" as soon as possible after BBB is powered up.

Everything seems to work (after disabling HDMI!), but I don't seem to be 
able to get it to set the pin state to high by default.  I'm loading the DT 
overlay via the uEnv command line, but it seems that until I manually go 
and export the GPIO pin and set the direction to "high" in /sys/class/gpio, 
the initial state of the pin stays low until explicitly set high.

I handle the pinmux as follows:

fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
my_gpio_pins: pinmux_my_gpio_pins {
pinctrl-single,pins = <
/* the gpio pin(s) */
0x0B4 0x0F /* P8 42 GPIO2_11: lcd_data5.gpio2_11 | MODE7 | OUTPUT */
>;
};
};
};

And add it as an OCP as follows:

fragment@2 {
target = <&ocp>;
__overlay__ {

my_gpio {
compatible = "gpio-of-helper";
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&my_gpio_pins>;

/* declare your gpios */
my_relay {
gpio-name = "my_relay";
gpio = <&gpio3 11 0x00>; /* gpio3 is gpio2 */
output;
*init-high;*
};
};
};
};

Shouldn't the "init-high" cause the pin to go high as soon as the DT 
overlay is loaded?  If not, how do I accomplish this?  I realize I can 
write an rc script to export the gpio and set direction=high, but we're 
probably talking 10 seconds after power up before that happens.

I have also tried using default-state="on" in the my_relay{} section which 
doesn't do anything either.

Finally, a question -- the gpio-name of "my_relay", what is this for?  I 
kind of assumed it would be an alias in the /sys/class/gpio tree to gpio75, 
but I don't find any references to "my_relay" anywhere in the /sys/class 
tree (or even in dmesg output for that matter).

Thanks!


-W

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to