20220320在MT6739的android10下调试GPIO引脚 2022/3/20 10:48
1、完整编译MT6739的android10: time(./oneCmdMake 9186TOF_S5080BS_SKY_MV88_QGO eng)
2、 https://linus.blog.csdn.net/article/details/105760139 LinuxGPIO操作和MTK平台GPIO
串口: console:/ $ su console:/ #? console:/ # echo "0 0 0 0" > /proc/sys/kernel/printk console:/ #?
?
这里以GPIO12为例:(右上角的110引脚)
PS:当时和硬件确认,110引脚号是哪一个(GPIO_96/EINT12),GPIO96还是GPIO12。
——GPIO96!(浪费了2天时间!【在我调的快怀疑人生的时候】最后确认是GPIO12。)
?
https://blog.csdn.net/h_bpdwn/article/details/91425599 adb shell input keyevent (具体操作) -- 模拟按键事件 KeyCode
//可以解锁屏幕 adb shell input keyevent ?82?
console:/ #? console:/ # input keyevent 82 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? console:/ #? console:/ #? console:/ # time ? ? 0m03.35s user ? ? 0m03.28s system console:/ #? console:/ # date Fri Mar 25 10:55:13 GMT 2022 console:/ #? console:/ #? console:/ # ll total 148 drwxr-xr-x ?21 root ? root ? ?4096 2022-03-25 10:25 . drwxr-xr-x ?21 root ? root ? ?4096 2022-03-25 10:25 .. dr-xr-xr-x ?48 root ? root ? ? ? 0 2022-03-25 10:51 acct drwxr-xr-x ?14 root ? root ? ? 280 2022-03-25 10:52 apex lrw-r--r-- ? 1 root ? root ? ? ?11 2022-03-25 10:25 bin -> /system/bin lrw-r--r-- ? 1 root ? root ? ? ?50 2022-03-25 10:25 bugreports -> /data/user_de/0/com.android.shell/files/bugreports drwxrwx--- ? 6 system cache ? 4096 2019-01-01 00:00 cache lrw-r--r-- ? 1 root ? root ? ? ?19 2022-03-25 10:25 charger -> /system/bin/charger drwxr-xr-x ? 4 root ? root ? ? ? 0 1970-01-01 00:00 config lrw-r--r-- ? 1 root ? root ? ? ?17 2022-03-25 10:25 d -> /sys/kernel/debug drwxrwx--x ?55 system system ?4096 2022-03-25 10:53 data drwxr-xr-x ? 2 root ? root ? ?4096 2022-03-25 08:00 debug_ramdisk lrw------- ? 1 root ? root ? ? ?23 2022-03-25 10:25 default.prop -> system/etc/prop.default drwxr-xr-x ?21 root ? root ? ?4300 2022-03-25 10:52 dev lrw-r--r-- ? 1 root ? root ? ? ?11 2022-03-25 10:25 etc -> /system/etc lrwxr-x--- ? 1 root ? shell ? ? 16 2022-03-25 10:25 init -> /system/bin/init -rwxr-x--- ? 1 root ? shell ? 2255 2022-03-25 08:00 init.environ.rc -rwxr-x--- ? 1 root ? shell ? ? 62 2022-03-25 10:10 init.preload.rc -rwxr-x--- ? 1 root ? shell ?33397 2022-03-25 10:14 init.rc -rwxr-x--- ? 1 root ? shell ? 7690 2022-03-25 09:31 init.usb.configfs.rc -rwxr-x--- ? 1 root ? shell ? 5649 2022-03-25 09:31 init.usb.rc -rwxr-x--- ? 1 root ? shell ? ?563 2022-03-25 09:31 init.zygote32.rc drwx------ ? 2 root ? root ? 16384 2022-03-25 10:25 lost+found drwxr-xr-x ? 7 root ? root ? ?4096 2019-01-01 00:00 metadata drwxr-xr-x ?13 root ? system ? 280 2022-03-25 10:52 mnt drwxr-xr-x ? 2 root ? root ? ?4096 2022-03-25 08:00 odm drwxr-xr-x ? 2 root ? root ? ?4096 2022-03-25 08:00 oem dr-xr-xr-x 398 root ? root ? ? ? 0 1970-01-01 00:00 proc drwxr-xr-x ? 8 root ? root ? ?4096 2022-03-25 10:23 product lrw-r--r-- ? 1 root ? root ? ? ?24 2022-03-25 10:25 product_services -> /system/product_services drwxr-x--- ? 2 root ? shell ? 4096 2022-03-25 08:00 sbin lrw-r--r-- ? 1 root ? root ? ? ?21 2022-03-25 10:25 sdcard -> /storage/self/primary drwxr-xr-x ? 4 root ? root ? ? 100 2022-03-25 10:53 storage dr-xr-xr-x ?16 root ? root ? ? ? 0 2022-03-25 10:51 sys drwxr-xr-x ?13 root ? root ? ?4096 2022-03-25 10:25 system -rw-r--r-- ? 1 root ? root ? ?2880 2022-03-25 08:00 ueventd.rc drwxr-xr-x ?12 root ? root ? ?4096 2022-03-25 10:13 vendor -rw-r--r-- ? 1 root ? root ? ? 524 2022-03-25 10:14 verity_key console:/ #? console:/ #? console:/ # cat /pr proc/ ? ? ? ? ? ? ? product/ ? ? ? ? ? ?product_services console:/ # cat /proc/version ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Linux version 4.14.141 (nobody@android-build) (gcc version 4.9.x 20150123 (prerelease) (GCC)) #1 SMP PREEMPT Fri Mar 25 16:16:13 CST 2022 console:/ #? console:/ # cd /sys/devices/platform/1000b000.pinctrl/ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? < console:/sys/devices/platform/1000b000.pinctrl #? console:/sys/devices/platform/1000b000.pinctrl # ll total 0 drwxr-xr-x ? 4 root root ? ?0 2022-03-25 10:57 . drwxr-xr-x 311 root root ? ?0 2022-03-25 10:51 .. lrwxrwxrwx ? 1 root root ? ?0 2022-03-25 10:57 driver -> ../../../bus/platform/drivers/mt6739-pinctrl -rw-r--r-- ? 1 root root 4096 2022-03-25 10:57 driver_override drwxr-xr-x ? 3 root root ? ?0 2022-03-25 10:57 gpiochip0 -r--r--r-- ? 1 root root 4096 2022-03-25 10:57 modalias -r--r--r-- ? 1 root root 4096 2022-03-25 10:57 mt_gpio lrwxrwxrwx ? 1 root root ? ?0 2022-03-25 10:57 of_node -> ../../../firmware/devicetree/base/1000b000.pinctrl drwxr-xr-x ? 2 root root ? ?0 2022-03-25 10:57 power lrwxrwxrwx ? 1 root root ? ?0 2022-03-25 10:57 subsystem -> ../../../bus/platform -rw-r--r-- ? 1 root root 4096 2022-03-25 10:57 uevent console:/sys/devices/platform/1000b000.pinctrl #? console:/sys/devices/platform/1000b000.pinctrl #? console:/sys/devices/platform/1000b000.pinctrl # echo mode 12 0 > mt_gpio /system/bin/sh: can't create mt_gpio: Permission denied 1|console:/sys/devices/platform/1000b000.pinctrl # chmod 777 mt_gpio ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?< console:/sys/devices/platform/1000b000.pinctrl #? console:/sys/devices/platform/1000b000.pinctrl # ll total 0 drwxr-xr-x ? 4 root root ? ?0 2022-03-25 10:57 . drwxr-xr-x 311 root root ? ?0 2022-03-25 10:51 .. lrwxrwxrwx ? 1 root root ? ?0 2022-03-25 10:57 driver -> ../../../bus/platform/drivers/mt6739-pinctrl -rw-r--r-- ? 1 root root 4096 2022-03-25 10:57 driver_override drwxr-xr-x ? 3 root root ? ?0 2022-03-25 10:57 gpiochip0 -r--r--r-- ? 1 root root 4096 2022-03-25 10:57 modalias -rwxrwxrwx ? 1 root root 4096 2022-03-25 10:59 mt_gpio lrwxrwxrwx ? 1 root root ? ?0 2022-03-25 10:57 of_node -> ../../../firmware/devicetree/base/1000b000.pinctrl drwxr-xr-x ? 2 root root ? ?0 2022-03-25 10:57 power lrwxrwxrwx ? 1 root root ? ?0 2022-03-25 10:57 subsystem -> ../../../bus/platform -rw-r--r-- ? 1 root root 4096 2022-03-25 10:57 uevent console:/sys/devices/platform/1000b000.pinctrl #? console:/sys/devices/platform/1000b000.pinctrl # cat mt_gpio ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?< pins base: 343, pins count: 169 PIN: (MODE)(DIR)(DOUT)(DIN)(DRIVE)(SMT)(IES)(PULL_EN)(PULL_SEL)(R1 R0) 000: 0000001110 (0 1) 001: 0001001100 (0 0) 002: 0000001110 (0 1) 003: 0000001110 (0 1) 004: 0001001111 (0 1) 005: 0000001110 (0 1) 006: 0001001111 007: 0000001110 008: 0000001110 009: 0000001110 010: 0001000110 011: 0001000110 012: 0100001100 013: 0100001100
?
?
?
配置GPIO12为GPIO引脚: console:/sys/devices/platform/1000b000.pinctrl #? console:/sys/devices/platform/1000b000.pinctrl # echo mode 12 0 > mt_gpio console:/sys/devices/platform/1000b000.pinctrl # cat mt_gpio ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?< pins base: 343, pins count: 169 PIN: (MODE)(DIR)(DOUT)(DIN)(DRIVE)(SMT)(IES)(PULL_EN)(PULL_SEL)(R1 R0) 000: 0000001110 (0 1) 001: 0001001100 (0 0) 002: 0000001110 (0 1) 003: 0000001110 (0 1) 004: 0001001111 (0 1) 005: 0000001110 (0 1) 006: 0001001111 007: 0000001110 008: 0000001110 009: 0000001110 010: 0001000110 011: 0001000110 012: 0100001100 013: 0100001100
?
配置GPIO12为输出引脚: console:/sys/devices/platform/1000b000.pinctrl #? console:/sys/devices/platform/1000b000.pinctrl #? console:/sys/devices/platform/1000b000.pinctrl #? console:/sys/devices/platform/1000b000.pinctrl # echo dir 12 1 > mt_gpio console:/sys/devices/platform/1000b000.pinctrl # cat mt_gpio ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?< pins base: 343, pins count: 169 PIN: (MODE)(DIR)(DOUT)(DIN)(DRIVE)(SMT)(IES)(PULL_EN)(PULL_SEL)(R1 R0) 000: 0000001110 (0 1) 001: 0001001100 (0 0) 002: 0000001110 (0 1) 003: 0000001110 (0 1) 004: 0001001111 (0 1) 005: 0000001110 (0 1) 006: 0001001111 007: 0000001110 008: 0000001110 009: 0000001110 010: 0001000110 011: 0001000110 012: 0100001100 013: 0100001100
?
配置GPIO12为输出高,这时候可以通过万用表看到GPIO12引脚位高:1.97/2.16V console:/sys/devices/platform/1000b000.pinctrl #? console:/sys/devices/platform/1000b000.pinctrl # echo out 12 1 > mt_gpio console:/sys/devices/platform/1000b000.pinctrl # cat mt_gpio ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?< pins base: 343, pins count: 169 PIN: (MODE)(DIR)(DOUT)(DIN)(DRIVE)(SMT)(IES)(PULL_EN)(PULL_SEL)(R1 R0) 000: 0000001110 (0 1) 001: 0001001100 (0 0) 002: 0000001110 (0 1) 003: 0000001110 (0 1) 004: 0001001111 (0 1) 005: 0000001110 (0 1) 006: 0001001111 007: 0000001110 008: 0000001110 009: 0000001110 010: 0001000110 011: 0001000110 012: 0111001100 013: 0100001100
?
?
?
console:/sys/devices/platform/1000b000.pinctrl #? console:/sys/devices/platform/1000b000.pinctrl #? console:/sys/devices/platform/1000b000.pinctrl # echo out 12 0 > mt_gpio console:/sys/devices/platform/1000b000.pinctrl # cat mt_gpio ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?< pins base: 343, pins count: 169 PIN: (MODE)(DIR)(DOUT)(DIN)(DRIVE)(SMT)(IES)(PULL_EN)(PULL_SEL)(R1 R0) 000: 0000001110 (0 1) 001: 0001001100 (0 0) 002: 0000001110 (0 1) 003: 0000001110 (0 1) 004: 0001001111 (0 1) 005: 0000001110 (0 1) 006: 0001001111 007: 0000001110 008: 0000001110 009: 0000001110 010: 0001000110 011: 0001000110 012: 0000001100 013: 0100001100
?
?
?
|