Want to add wakeup source for waking up device via gpio interupt

Hello i am using sc600t device for aosp10,

i am sending device in suspend state(S2R) via echo mem > /sys/power/state this command.
now i want to wakeup device via gpio interupt with adding wakeup source , how i can do this ?

HI, gath:
You can use GPIO-KEY, the driver code is supported by default.
You can choose the GPIO which has triangle symbol.

Thank you @Great.Zheng-Q
just confirm my device tree modification in msm8953.dtsi for GPIO-KEY drive

image

hi,
Take GPIO97 as example, please refer to the patch I provide.
SC600_A10_gpio_wakeup.zip (619 Bytes)
How to test:
Press key:
sendevent /dev/input/event2 1 143 1
sendevent /dev/input/event2 0 0 0

Releae key:
sendevent /dev/input/event2 1 143 0
sendevent /dev/input/event2 0 0 0

@Great.Zheng-Q Thank you so much

echo mem > /sys/power/state + type c usb cable removed - but it is not going suspend properly it is reboot to recovery,

Debug UART logs

+ª¢rª²Ê] f_cdev_poll: Failed due to NULL device or disconnected.
[ 54.473461] ch_notify on a closed smd_pkt_dev id:3
[ 54.539028] hvdcp_opti: 4 output lines suppressed due to ratelimiting
Terminated

[ 54.592064] QSEECOM: __qseecom_unload_app: App (131074) is unloaded
L?¹Í½±:/ # [ 54.674770] msm_flash_subdev_ioctl:894 fctrl->func_tbl NULL
[ 54.674836] msm_csiphy_release csiphy dev NULL / ref_count ZERO
[ 54.679173] msm_csiphy_release csiphy dev NULL / ref_count ZERO
+ª¢rºÂÊ] msm_csiphy_release csiphy dev NULL / ref_count ZERO
[ 54.700961] msm_csid_release: csid invalid state 1
[ 54.705642] msm_csid_release: csid invalid state 1
[ 54.710502] msm_csid_release: csid invalid state 1
[ 54.715350] msm_cci_release invalid ref count 0 / cci state 1
[ 54.720062] MSM-SENSOR-INIT msm_sensor_init_subdev_ioctl:122 default
[ 54.720062]
[ 54.725965] MSM-CPP msm_cpp_subdev_ioctl:3531 shutdown cpp node. open cnt:0
55.125145] ipa-wan __ipa_wwan_close:1026 [rmnet_ipa0]: ipa2_deregister_intf failed -22
[ 55.128156] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_ipa0
[ 55.137196] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_data0
[ 55.221862] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_ipa0
[ 55.222049] ipa-wan ipa_del_dflt_wan_rt_tables:392 Deleting Route hdl:(0x9) with ip type: 0
[ 55.232839] ipa-wan ipa_del_dflt_wan_rt_tables:401 Deleting Route hdl:(0xb) with ip type: 1
55.294707] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_data0
[ 55.296325] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_data1
[ 55.361518] rmt_storage:INFO:rmt_storage_rw_iovec_cb: Write iovec request (req_h 0x9 wr_count 1) received for /boot/modem_fs2
[ 55.361751] rmt_storage:INFO:rmt_storage_client_thread: Calling Write [offset=0, size=1572864, req_h 0x9, wr_count 1] for /boot/modem_fs2!
[ 55.382105] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_data1
[ 55.386871] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_data2
[ 55.446302] rmt_storage:INFO:rmt_storage_client_thread: Done Write (bytes = 1572864, req_h 0x9, wr_count 1) for /boot/modem_fs2!
[ 55.472104] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_data2
[ 55.473841] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_data3
[ 55.562564] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_data3
[ 55.564247] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_data4
[ 55.571219] pil-q6v5-mss 4080000.qcom,mss: Port ffffff800b05f000 halt timeout
55.642152] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_data4
[ 55.644423] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_data5
[ 55.678294] pil-q6v5-mss 4080000.qcom,mss: Port ffffff800b061000 halt timeout
[ 55.689267] ipa ipa_uc_reset_pipe:743 Invalid IPA client
[ 55.690419] ipa ipa_uc_reset_pipe:743 Invalid IPA client
[ 55.697003] ipa ipa_uc_reset_pipe:743 Invalid IPA client
[ 55.698980] ipa ipa_uc_reset_pipe:743 Invalid IPA client
[ 55.704381] ipa ipa_uc_reset_pipe:743 Invalid IPA client
[ 55.723355] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_data5
[ 55.725569] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_data6
[ 55.802539] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_data6
[ 55.806426] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_data7
+ªªrº¢²ª
] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister rmnet_data7
[ 55.876963] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data0
[ 55.944796] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data0
[ 55.948411] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data1
[ 56.002550] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data1
[ 56.009514] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data2
[ 56.034804] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data2
[ 56.041561] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data3
[ 56.065853] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data3
[ 56.072975] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data4
[ 56.104184] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data4
[ 56.110114] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data5
56.135325] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data5
[ 56.142044] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data6
[ 56.165093] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data6
[ 56.170660] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data7
+ª²r
?
] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data7
[ 56.200639] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data8
[ 56.224546] [RMNET:HI] rmnet_config_notify_cb(): Kernel is trying to unregister r_rmnet_data8
[ 57.786964] logd.auditd: 79 output lines suppressed due to ratelimiting
[ 58.448605] reboot: Restarting system with command ‘recovery’
[ 58.451023] Going down for rest

Hi,
Please enable Airplane mode and use UART to send the command.

Hello @Great.Zheng-Q
Thank you for your response,

echo mem > /sys/power/state whenever we are sending device in suspend state. device is automatically wake up.
even we find all wakeup source from /sys file using find ./ -name wakeup. and disabled it. still device is auto wakeuping.
Please help me into that