高通プラットフォームgpio簡単デバッグ
3106 ワード
0. gpio :/system/bin/r
Android9.0 :
system/core/toolbox/r.c
system/core/toolbox/Android.bp
cc_binary {
name: "r",
defaults: ["toolbox_defaults"],
srcs: ["r.c"],
}
# cd system/core/toolbox
# mm
# push r /system/bin
: gpio70 , .dts , 。
1. gpio70
# cat /sys/kernel/debug/gpio // gpio
# cd /sys/class/gpio
# echo 70 > export
# cd gpio70
# echo out > direction
# echo 1 > value
2.// GPIO pull up
gpio , .
***************************************************************************
msm8996 gpio : gpio + gpio * 0x1000( gpio :70->0x46)
sdm845 gpio : gpio + 0x500000 + gpio *0x1000(gpio :70->0x46)
1、SDM845 GPIO46 , 46 16 2E, GPIO
3 , / 、 / 、 。
:
0x3400000 + 0x500000 + 0x1000*2E = 0x392E000
0x3400000 + 0x500000 + 0x1000*2E = 0x392E004
0x3400000 + 0x500000 + 0x1000*2E = 0x392E008
:
/system/bin/r 0x392E000 --》0x392E000: 00000201 //0x201:out
/system/bin/r 0x392E004 --》0x392E004: 00000003 //0x03:high; 0x00;low
/system/bin/r 0x392E008 --》0x392E008: 000000e2 //0xe2:
:
<1>.0x201:1000000001 ---->out and pull down
9 =1 ;
6-8 0, 2mA;
2-5 0, GPIO ;
0-1=1:pull down; 2:keeper; 3:pull up; 4:no pull
0x202: out and keeper
0x203: out and pull up
0x204: out and no pull
<2>0x3: ; echo 1 > value
0x0: ; echo 0 > value
<3>.e2:11100010
0, disable
***************************************************************************
// gpio : 0x1010000,
# cat /sys/kernel/debug/gpio"
GPIOs 0-149, platform/1010000.pinctrl, 1010000.pinctrl
70 10 , 16 :0x46
gpio :0x46 * 0x1000 + 0x1010000 = 0x1056000
3.// gpio70 :
# /system/bin/r 0x1056000
01056000: 000002c6 //gpio70 :
:
0x000002c5: pull down
0x000002c6: keeper
0x000002c5: pull up
4.// gpio70 0x000002c7, pull up
# /system/bin/r 0x1056000 0x000002c7
# 0x1056000
# /system/bin/r 0x1056000
01056000: 000002c7
gpio70 , , 0V 。