Hi, Just as my last post. I want to know if it is possible to wakeup opi3 after I switch its state to "mem" or "disk" using gpio on CON12.
I have doing some reasch but I don't know if it is right: PL/PM port can be used as wakeup source. PF/G/H/L/M port support interrupt event. PC/D didn't support interrupt.
But when I try to write a device tree file, but it just report some error with error code -22.
My device three is like this:
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h6";
/*
* This fragment is needed only for the internal pull-up activation,
* external pull-up resistor is highly recommended if using long wires
*/
fragment@0 {
target = <&r_pio>;
__overlay__ {
gpio_key_wakeup: gpio_key_wakeup {
pins = "PL8";
function = "gpio_in";
bias-pull-up;
};
};
};
fragment@1 {
target-path = "/";
__overlay__ {
gpio-keys-user {
/*
* Use "gpio-keys" for EINT capable pins, "gpio-keys-polled" for other pins
* add "poll-interval" property if using "gpio-keys-polled"
*/
compatible = "gpio-keys";
autorepeat;
pinctrl-names = "default";
pinctrl-0 = <&gpio_key_wakeup>;
key_wakeup{
label = "GPIO KEY_WAKEUP";
linux,code = <143>; /* KEY_WAKEUP, see include/uapi/linux/input-event-codes.h */
gpios = <&r_pio 0 8 1>; /* PL8 GPIO_ACTIVE_LOW */
};
};
};
};
};
I am still a newbie and I don't know enough thing about how to write the right DTS file. Please give me some help. Thanks
(I have tested KEY_POWER it seems everything OK. I don't know what is the error part about KEY_WAKEUP)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
Finally, I fulfill it now.
dts is like this:
one pin for sleep:
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h6";
/*
* This fragment is needed only for the internal pull-up activation,
* external pull-up resistor is highly recommended if using long wires
*/
fragment@0 {
target = <&pio>;
__overlay__ {
gpio_but_sleep: gpio_but_sleep {
pins = "PH3";
function = "gpio_in";
bias-pull-up;
};
};
};
fragment@1 {
target-path = "/";
__overlay__ {
gpio-keys-user {
/*
* Use "gpio-keys" for EINT capable pins, "gpio-keys-polled" for other pins
* add "poll-interval" property if using "gpio-keys-polled"
*/
compatible = "gpio-keys";
autorepeat;
pinctrl-names = "default";
pinctrl-0 = <&gpio_but_sleep>;
sleep_button {
label = "KEY_SLEEP";
linux,code = <142>; /* KEY_SLEEP, see include/uapi/linux/input-event-codes.h */
linux,input-type = <1>; // EV_KEY
gpios = <&pio 7 3 1>; /* PD15 GPIO_ACTIVE_LOW */
gpio-key;
};
};
};
};
};
one pin for wakeup:
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun8i-h3";
fragment@0 {
target = <&pio>;
__overlay__ {
poweroff_pins:poweroff_pins {
allwinner,pins = "PA13";
allwinner,function = "gpio_out";
};
};
};
fragment@1 {
target-path = "/";
__overlay__ {
poweroff: poweroff {
compatible = "gpio-poweroff";
gpios = <&pio 0 13 1>;
};
};
};
};
But some weird things happend: after I wakeup again. I can connect to opi3 via debug port(uart0). But can not connect it from ssh again. Even after I setup a new static ip for it.
And when I test "who", I find it still connect with the old ssh. But when I try to ping gatway "ping 192.168.1.1":
it show: From 192.168.1.108 icmp_seq=1 Destination Host Unreachable
It is so wried.