20240629在飞凌开发板OK3588-C上使用Rockchip原厂的SDK跑通I2C扩展GPIO芯片TCA6424ARGJRR

20240629在飞凌开发板OK3588-C上使用Rockchip原厂的SDK跑通I2C扩展GPIO芯片TCA6424ARGJRR

2024/6/29 18:02

1、替换DTS了:

Z:\repo_RK3588_Buildroot20240508\kernel\arch\arm64\boot\dts\rockchip

viewpro@viewpro-ThinkBook-16-G5-IRH:~/repo_RK3588_Buildroot20240508/kernel/arch/arm64/boot/dts/rockchip$ ll

total 1244

drwx------ 2 viewpro viewpro 4096 6月 29 18:12 ./

drwxrwxr-x 34 viewpro viewpro 4096 6月 29 17:15 ../
-rw-rw-r-- 1 viewpro viewpro 3917 12月 21 2023 FET3588-C.dtsi
-rw-rw-r-- 1 viewpro viewpro 7758 12月 21 2023 Makefile
-rw-rw-r-- 1 viewpro viewpro 14850 12月 21 2023 OK3588-C-Camera.dtsi
-rw-rw-r-- 1 viewpro viewpro 32947 12月 21 2023 OK3588-C-common.dtsi
-rw-rw-r-- 1 viewpro viewpro 2363 12月 21 2023 OK3588-C-Linux.dts
-rw-rw-r-- 1 viewpro viewpro 246717 5月 24 17:56 OK3588-C-Linux.dump.dts
-rw-rw-r-- 1 viewpro viewpro 27858 12月 21 2023 rk3588.dtsi
-rw-rw-r-- 1 viewpro viewpro 280681 6月 29 18:12 rk3588-evb7-v11-linux.dtb
-rw-rw-r-- 1 viewpro viewpro 3061 6月 29 18:12 .rk3588-evb7-v11-linux.dtb.cmd
-rw-rw-r-- 1 viewpro viewpro 120 6月 29 18:12 .rk3588-evb7-v11-linux.dtb.d.dtc.tmp
-rw-rw-r-- 1 viewpro viewpro 1693 6月 29 18:12 .rk3588-evb7-v11-linux.dtb.d.pre.tmp
-rw-rw-r-- 1 viewpro viewpro 326518 6月 29 18:12 .rk3588-evb7-v11-linux.dtb.dts.tmp
-rwx------ 1 viewpro viewpro 2363 6月 21 11:40 rk3588-evb7-v11-linux.dts*
-rw-rw-r-- 1 viewpro viewpro 9573 12月 21 2023 rk3588-rk806-single.dtsi
-rw-rw-r-- 1 viewpro viewpro 185703 12月 21 2023 rk3588s.dtsi
-rw-rw-r-- 1 viewpro viewpro 67505 12月 21 2023 rk3588s-pinctrl.dtsi
-rw-rw-r-- 1 viewpro viewpro 9865 12月 21 2023 rk3588-vccio3-pinctrl.dtsi
-rw-rw-r-- 1 viewpro viewpro 7448 12月 21 2023 rockchip-pinconf.dtsi

viewpro@viewpro-ThinkBook-16-G5-IRH:~/repo_RK3588_Buildroot20240508/kernel/arch/arm64/boot/dts/rockchip$

确认驱动没有加载好:没有找到gpiochip485!

root@rk3588-buildroot:/#

root@rk3588-buildroot:/#

root@rk3588-buildroot:/#

Display all 910 possibilities? (y or n)^C

root@rk3588-buildroot:/#

root@rk3588-buildroot:/# cd /sys/class/gpio/

root@rk3588-buildroot:/sys/class/gpio#

root@rk3588-buildroot:/sys/class/gpio# ls -l

total 0

--w------- 1 root root 4096 Jan 1 00:00 export

lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip0 -> ../../devices/platform/pinctrl/fd8a0000.gpio/gpio/gpiochip0

lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip128 -> ../../devices/platform/pinctrl/fec50000.gpio/gpio/gpiochip128

lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip32 -> ../../devices/platform/pinctrl/fec20000.gpio/gpio/gpiochip32
lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip509 -> ../../devices/platform/feb20000.spi/spi_master/spi2/spi2.0/rk806-pinctrl.0.auto/gpio/gpiochip509

lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip64 -> ../../devices/platform/pinctrl/fec30000.gpio/gpio/gpiochip64

lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip96 -> ../../devices/platform/pinctrl/fec40000.gpio/gpio/gpiochip96

--w------- 1 root root 4096 Jan 1 00:00 unexport

root@rk3588-buildroot:/sys/class/gpio#
root@rk3588-buildroot:/sys/class/gpio#
root@rk3588-buildroot:/sys/class/gpio# echo 508 > export

297.960946\] export_store: invalid GPIO 508 sh: echo: write error: Invalid argument root@rk3588-buildroot:/sys/class/gpio# root@rk3588-buildroot:/sys/class/gpio# Z:\\repo_RK3588_Buildroot20240508\\kernel\\include\\dt-bindings\\pinctrl\\rockchip.h /\* SPDX-License-Identifier: GPL-2.0-or-later \*/ /\* \* Header providing constants for Rockchip pinctrl bindings. \* \* Copyright (c) 2013 MundoReader S.L. \* Author: Heiko Stuebner \ \*/ #ifndef __DT_BINDINGS_ROCKCHIP_PINCTRL_H__ #define __DT_BINDINGS_ROCKCHIP_PINCTRL_H__ #define RK_PA0 0 #define RK_PA1 1 #define RK_PA2 2 #define RK_PA3 3 #define RK_PA4 4 #define RK_PA5 5 #define RK_PA6 6 #define RK_PA7 7 #define RK_PB0 8 #define RK_PB1 9 #define RK_PB2 10 #define RK_PB3 11 #define RK_PB4 12 #define RK_PB5 13 #define RK_PB6 14 #define RK_PB7 15 #define RK_PC0 16 #define RK_PC1 17 #define RK_PC2 18 #define RK_PC3 19 #define RK_PC4 20 #define RK_PC5 21 #define RK_PC6 22 #define RK_PC7 23 #define RK_PD0 24 #define RK_PD1 25 #define RK_PD2 26 #define RK_PD3 27 #define RK_PD4 28 #define RK_PD5 29 #define RK_PD6 30 #define RK_PD7 31 #define RK_FUNC_GPIO 0 #define EXTIO_GPIO_P00 0 #define EXTIO_GPIO_P01 1 #define EXTIO_GPIO_P02 2 #define EXTIO_GPIO_P03 3 #define EXTIO_GPIO_P04 4 #define EXTIO_GPIO_P05 5 #define EXTIO_GPIO_P06 6 #define EXTIO_GPIO_P07 7 #define EXTIO_GPIO_P10 8 #define EXTIO_GPIO_P11 9 #define EXTIO_GPIO_P12 10 #define EXTIO_GPIO_P13 11 #define EXTIO_GPIO_P14 12 #define EXTIO_GPIO_P15 13 #define EXTIO_GPIO_P16 14 #define EXTIO_GPIO_P17 15 #define EXTIO_GPIO_P20 16 #define EXTIO_GPIO_P21 17 #define EXTIO_GPIO_P22 18 #define EXTIO_GPIO_P23 19 #define EXTIO_GPIO_P24 20 #define EXTIO_GPIO_P25 21 #define EXTIO_GPIO_P26 22 #define EXTIO_GPIO_P27 23 #endif ![](https://img-blog.csdnimg.cn/direct/9d451e43a00f450fbea60cc108181fe7.png) 2、更新驱动的部分: Z:\\repo_RK3588_Buildroot20240508\\kernel\\.config # # I2C GPIO expanders # # CONFIG_GPIO_ADP5588 is not set # CONFIG_GPIO_ADNP is not set # CONFIG_GPIO_AW9110 is not set # CONFIG_GPIO_GW_PLD is not set # CONFIG_GPIO_MAX7300 is not set # CONFIG_GPIO_MAX732X is not set # CONFIG_GPIO_NCA9539 is not set CONFIG_GPIO_PCA953X=y # CONFIG_GPIO_PCA953X_IRQ is not set # CONFIG_GPIO_PCA9570 is not set # CONFIG_GPIO_PCF857X is not set # CONFIG_GPIO_TPIC2810 is not set # end of I2C GPIO expanders CONFIG_GPIO_ROCKCHIP=y # CONFIG_GPIO_SAMA5D2_PIOBU is not set # CONFIG_GPIO_SIFIVE is not set CONFIG_GPIO_SYSCON=y # CONFIG_GPIO_XGENE is not set # CONFIG_GPIO_XILINX is not set # CONFIG_GPIO_AMD_FCH is not set # end of Memory mapped GPIO drivers # # I2C GPIO expanders # # CONFIG_GPIO_ADP5588 is not set # CONFIG_GPIO_ADNP is not set # CONFIG_GPIO_AW9110 is not set # CONFIG_GPIO_GW_PLD is not set # CONFIG_GPIO_MAX7300 is not set # CONFIG_GPIO_MAX732X is not set # CONFIG_GPIO_NCA9539 is not set # CONFIG_GPIO_PCA953X is not set # CONFIG_GPIO_PCA9570 is not set # CONFIG_GPIO_PCF857X is not set # CONFIG_GPIO_TPIC2810 is not set # end of I2C GPIO expanders # # MFD GPIO expanders # # CONFIG_GPIO_TPS6586X is not set # end of MFD GPIO expanders 【相关的驱动部分:】 viewpro@viewpro-ThinkBook-16-G5-IRH:\~/repo_RK3588_Buildroot20240508/kernel/arch/arm64/configs$ grep CONFIG_GPIO_SYSCON . -R ./rockchip_defconfig:CONFIG_GPIO_SYSCON=y ./rockchip_linux_defconfig:CONFIG_GPIO_SYSCON=y viewpro@viewpro-ThinkBook-16-G5-IRH:\~/repo_RK3588_Buildroot20240508/kernel/arch/arm64/configs$ Z:\\repo_RK3588_Buildroot20240508\\kernel\\arch\\arm64\\configs\\rk3588_linux.config # CONFIG_BCMDHD_SDIO=y is not set CONFIG_BCMDHD_PCIE=y CONFIG_MALI_CSF_SUPPORT=y CONFIG_GPIO_PCA953X=y ![](https://img-blog.csdnimg.cn/direct/32a10a68b82a4ccb88f430d5f1287c7f.png) Z:\\repo_RK3588_Buildroot20240508\\kernel\\drivers\\gpio\\gpio-pca953x.c 【这里不要动了,强制修改的!】 Z:\\repo_RK3588_Buildroot20240508\\kernel\\drivers\\gpio\\Makefile obj-$(CONFIG_GPIO_MXC) += gpio-mxc.o obj-$(CONFIG_GPIO_MXS) += gpio-mxs.o obj-$(CONFIG_GPIO_NCA9539) += gpio-nca9539.o obj-$(CONFIG_GPIO_OCTEON) += gpio-octeon.o obj-$(CONFIG_GPIO_OMAP) += gpio-omap.o obj-$(CONFIG_GPIO_PALMAS) += gpio-palmas.o #obj-$(CONFIG_GPIO_PCA953X) += gpio-pca953x.o obj-y += gpio-pca953x.o obj-$(CONFIG_GPIO_PCA9570) += gpio-pca9570.o obj-$(CONFIG_GPIO_PCF857X) += gpio-pcf857x.o obj-$(CONFIG_GPIO_PCH) += gpio-pch.o ![](https://img-blog.csdnimg.cn/direct/5e6d6dbf59724aafbd67f1d2de74b01f.png) ![](https://img-blog.csdnimg.cn/direct/bc0ef8937a4949129b392b16206bbba3.png) 确认的LOG: 高:3.299V 低:0.001V root@rk3588-buildroot:/# root@rk3588-buildroot:/# root@rk3588-buildroot:/# root@rk3588-buildroot:/# cd /sys/class/gpio/ root@rk3588-buildroot:/sys/class/gpio# ls -l total 0 --w------- 1 root root 4096 Jan 1 00:00 export lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip0 -\> ../../devices/platform/pinctrl/fd8a0000.gpio/gpio/gpiochip0 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip128 -\> ../../devices/platform/pinctrl/fec50000.gpio/gpio/gpiochip128 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip32 -\> ../../devices/platform/pinctrl/fec20000.gpio/gpio/gpiochip32 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip485 -\> ../../devices/platform/feaa0000.i2c/i2c-2/2-0023/gpio/gpiochip485 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip509 -\> ../../devices/platform/feb20000.spi/spi_master/spi2/spi2.0/rk806-pinctrl.0.auto/gpio/gpiochip509 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip64 -\> ../../devices/platform/pinctrl/fec30000.gpio/gpio/gpiochip64 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip96 -\> ../../devices/platform/pinctrl/fec40000.gpio/gpio/gpiochip96 --w------- 1 root root 4096 Jan 1 00:00 unexport root@rk3588-buildroot:/sys/class/gpio# root@rk3588-buildroot:/sys/class/gpio# echo 508 \> export root@rk3588-buildroot:/sys/class/gpio# root@rk3588-buildroot:/sys/class/gpio# ls -l total 0 --w------- 1 root root 4096 Jan 1 00:01 export lrwxrwxrwx 1 root root 0 Jan 1 00:01 gpio508 -\> ../../devices/platform/feaa0000.i2c/i2c-2/2-0023/gpiochip6/gpio/gpio508 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip0 -\> ../../devices/platform/pinctrl/fd8a0000.gpio/gpio/gpiochip0 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip128 -\> ../../devices/platform/pinctrl/fec50000.gpio/gpio/gpiochip128 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip32 -\> ../../devices/platform/pinctrl/fec20000.gpio/gpio/gpiochip32 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip485 -\> ../../devices/platform/feaa0000.i2c/i2c-2/2-0023/gpio/gpiochip485 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip509 -\> ../../devices/platform/feb20000.spi/spi_master/spi2/spi2.0/rk806-pinctrl.0.auto/gpio/gpiochip509 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip64 -\> ../../devices/platform/pinctrl/fec30000.gpio/gpio/gpiochip64 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip96 -\> ../../devices/platform/pinctrl/fec40000.gpio/gpio/gpiochip96 --w------- 1 root root 4096 Jan 1 00:00 unexport root@rk3588-buildroot:/sys/class/gpio# root@rk3588-buildroot:/sys/class/gpio# cd gpio508 root@rk3588-buildroot:/sys/class/gpio/gpio508# root@rk3588-buildroot:/sys/class/gpio/gpio508# ls -l total 0 -rw-r--r-- 1 root root 4096 Jan 1 00:01 active_low lrwxrwxrwx 1 root root 0 Jan 1 00:01 device -\> ../../../gpiochip6 -rw-r--r-- 1 root root 4096 Jan 1 00:01 direction drwxr-xr-x 2 root root 0 Jan 1 00:01 power lrwxrwxrwx 1 root root 0 Jan 1 00:01 subsystem -\> ../../../../../../../../class/gpio -rw-r--r-- 1 root root 4096 Jan 1 00:01 uevent -rw-r--r-- 1 root root 4096 Jan 1 00:01 value root@rk3588-buildroot:/sys/class/gpio/gpio508# root@rk3588-buildroot:/sys/class/gpio/gpio508# cat direction in root@rk3588-buildroot:/sys/class/gpio/gpio508# cat value 0 root@rk3588-buildroot:/sys/class/gpio/gpio508# root@rk3588-buildroot:/sys/class/gpio/gpio508# echo out \> direction root@rk3588-buildroot:/sys/class/gpio/gpio508# echo 1 \> value root@rk3588-buildroot:/sys/class/gpio/gpio508# root@rk3588-buildroot:/sys/class/gpio/gpio508# cat direction out root@rk3588-buildroot:/sys/class/gpio/gpio508# cat value 1 root@rk3588-buildroot:/sys/class/gpio/gpio508# \^C root@rk3588-buildroot:/sys/class/gpio/gpio508# root@rk3588-buildroot:/sys/class/gpio/gpio508# root@rk3588-buildroot:/sys/class/gpio/gpio508# cd .. root@rk3588-buildroot:/sys/class/gpio# root@rk3588-buildroot:/sys/class/gpio# root@rk3588-buildroot:/sys/class/gpio# ls -l total 0 --w------- 1 root root 4096 Jan 1 00:01 export lrwxrwxrwx 1 root root 0 Jan 1 00:01 gpio508 -\> ../../devices/platform/feaa0000.i2c/i2c-2/2-0023/gpiochip6/gpio/gpio508 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip0 -\> ../../devices/platform/pinctrl/fd8a0000.gpio/gpio/gpiochip0 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip128 -\> ../../devices/platform/pinctrl/fec50000.gpio/gpio/gpiochip128 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip32 -\> ../../devices/platform/pinctrl/fec20000.gpio/gpio/gpiochip32 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip485 -\> ../../devices/platform/feaa0000.i2c/i2c-2/2-0023/gpio/gpiochip485 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip509 -\> ../../devices/platform/feb20000.spi/spi_master/spi2/spi2.0/rk806-pinctrl.0.auto/gpio/gpiochip509 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip64 -\> ../../devices/platform/pinctrl/fec30000.gpio/gpio/gpiochip64 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip96 -\> ../../devices/platform/pinctrl/fec40000.gpio/gpio/gpiochip96 --w------- 1 root root 4096 Jan 1 00:00 unexport root@rk3588-buildroot:/sys/class/gpio# root@rk3588-buildroot:/sys/class/gpio# root@rk3588-buildroot:/sys/class/gpio# echo 507 \> export root@rk3588-buildroot:/sys/class/gpio# ls -l total 0 --w------- 1 root root 4096 Jan 1 00:09 export lrwxrwxrwx 1 root root 0 Jan 1 00:09 gpio507 -\> ../../devices/platform/feaa0000.i2c/i2c-2/2-0023/gpiochip6/gpio/gpio507 lrwxrwxrwx 1 root root 0 Jan 1 00:01 gpio508 -\> ../../devices/platform/feaa0000.i2c/i2c-2/2-0023/gpiochip6/gpio/gpio508 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip0 -\> ../../devices/platform/pinctrl/fd8a0000.gpio/gpio/gpiochip0 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip128 -\> ../../devices/platform/pinctrl/fec50000.gpio/gpio/gpiochip128 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip32 -\> ../../devices/platform/pinctrl/fec20000.gpio/gpio/gpiochip32 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip485 -\> ../../devices/platform/feaa0000.i2c/i2c-2/2-0023/gpio/gpiochip485 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip509 -\> ../../devices/platform/feb20000.spi/spi_master/spi2/spi2.0/rk806-pinctrl.0.auto/gpio/gpiochip509 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip64 -\> ../../devices/platform/pinctrl/fec30000.gpio/gpio/gpiochip64 lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip96 -\> ../../devices/platform/pinctrl/fec40000.gpio/gpio/gpiochip96 --w------- 1 root root 4096 Jan 1 00:00 unexport root@rk3588-buildroot:/sys/class/gpio# cd gpio507/ root@rk3588-buildroot:/sys/class/gpio/gpio507# ll sh: ll: command not found root@rk3588-buildroot:/sys/class/gpio/gpio507# ls -l total 0 -rw-r--r-- 1 root root 4096 Jan 1 00:09 active_low lrwxrwxrwx 1 root root 0 Jan 1 00:09 device -\> ../../../gpiochip6 -rw-r--r-- 1 root root 4096 Jan 1 00:09 direction drwxr-xr-x 2 root root 0 Jan 1 00:09 power lrwxrwxrwx 1 root root 0 Jan 1 00:09 subsystem -\> ../../../../../../../../class/gpio -rw-r--r-- 1 root root 4096 Jan 1 00:09 uevent -rw-r--r-- 1 root root 4096 Jan 1 00:09 value root@rk3588-buildroot:/sys/class/gpio/gpio507# root@rk3588-buildroot:/sys/class/gpio/gpio507# root@rk3588-buildroot:/sys/class/gpio/gpio507# echo out \> direction root@rk3588-buildroot:/sys/class/gpio/gpio507# echo 1 \> value root@rk3588-buildroot:/sys/class/gpio/gpio507# cat direction out root@rk3588-buildroot:/sys/class/gpio/gpio507# cat value 1 root@rk3588-buildroot:/sys/class/gpio/gpio507# root@rk3588-buildroot:/sys/class/gpio/gpio507# echo 0 \> value root@rk3588-buildroot:/sys/class/gpio/gpio507#

相关推荐
倒霉蛋小马7 分钟前
【Java集合】LinkedList源码深度分析
java·开发语言
pk_xz12345611 分钟前
python加载训练好的模型并进行叶片实例分割预测
开发语言·python
独好紫罗兰12 分钟前
洛谷题单3-P1075 [NOIP 2012 普及组] 质因数分解-python-流程图重构
开发语言·python·算法
编程咕咕gu-1 小时前
从零开始玩python--python版植物大战僵尸来袭
开发语言·python·python基础·pygame·python教程
柏木乃一1 小时前
双向链表增删改查的模拟实现
开发语言·数据结构·算法·链表
cherryc_2 小时前
JavaSE基础——第六章 类与对象(二)
java·开发语言
永恒迷星.by6 小时前
文件操作(c语言)
c语言·c++·算法·文件操作
Qlittleboy6 小时前
windows如何安装wkhtmltoimage 给PHP使用根据HTML生成图片
开发语言·windows·php
水w7 小时前
【Android Studio】解决报错问题Algorithm HmacPBESHA256 not available
android·开发语言·android studio
冷琅辞8 小时前
Elixir语言的云计算
开发语言·后端·golang