Hi Team,
Device tree related description
leds { compatible = "gpio-leds"; pinctrl-names = "default"; pinctrl-0 = <&usr_led_pins_default>; status = "disabled" led-0 { label = "heartbeat"; gpios = <&main_gpio0 42 GPIO_ACTIVE_HIGH>; linux,default-trigger = "heartbeat"; function = LED_FUNCTION_HEARTBEAT; default-state = "off"; }; led-1 { label = "led1"; gpios = <&main_gpio1 16 GPIO_ACTIVE_HIGH>; linux,default-trigger = "timer"; led-pattern = <200 800>; default-state = "on"; }; led-2 { label = "led2"; gpios = <&main_gpio1 17 GPIO_ACTIVE_HIGH>; linux,default-trigger = "timer"; led-pattern = <300 700>; default-state = "on"; }; led-3 { label = "led3"; gpios = <&main_gpio1 18 GPIO_ACTIVE_HIGH>; linux,default-trigger = "timer"; led-pattern = <400 600>; default-state = "on"; }; led-4 { label = "led4"; gpios = <&main_gpio1 19 GPIO_ACTIVE_HIGH>; linux,default-trigger = "timer"; led-pattern = <500 500>; default-state = "on"; }; }; ..... &main_pmx0 { ...... usr_led_pins_default: usr-led-pins-default { pinctrl-single,pins = < AM62X_IOPAD(0x0ac, PIN_OUTPUT, 7) /* (L21) GPMC0_CSn1.GPIO0_42 */ AM62X_IOPAD(0x1b8, PIN_OUTPUT, 7) /* (C13) SPI0_CS1.GPIO1_16 */ AM62X_IOPAD(0x1bc, PIN_OUTPUT, 7) /* (A14) SPI0_CLK.GPIO1_17*/ AM62X_IOPAD(0x1c0, PIN_OUTPUT, 7) /* (B13) SPI0_D0.GPIO1_18 */ AM62X_IOPAD(0x1c4, PIN_OUTPUT, 7) /* (B14) SPI0_D1.GPIO1_19 */ >; }; ...... };
Reboot after changing the device tree
First operation:
echo 330 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio330/direction
echo 1 >/sys/class/gpio/gpio330/value
echo 0 >/sys/class/gpio/gpio330/value
The led light connected to the gpio will be on and off normally, the value of the GPIO register is
The GPIO is not released (echo 330> / sys / class / gpio / unexport) and there have three below cases:
reboot
Do the same operation after rebooting, the led light turns on and off normally, all the operation is the same as the first one .
reset
GPIO is not exported this time
when export the button, the error appears
The power button turn off and then turn on
The GPIO is also not exported currently , and the exported GPIO doesn’t report an error, but cannot write the value. Writes 1 or 0, cat is 0. The value of pin register is
Is this the bug of drive or GPIO pin has a mechanism of protection?
Beat Regards,
Susan Ren