Firefly开源社区

[Linux] RK3399 I2C使用问题请教

32

积分

0

威望

0

贡献

技术小白

积分
32
发表于 2019-6-5 16:09:01     
刚拿到板子,想添加一个I2C设备,但是怎么都进不去probe , 请教下各位是哪里的问题啊.

板子是RK3399-JD4 , Kernel的编译参数是make -j8 ARCH=arm64 rk3399-firefly-aiojd4.img

在rk3399-firefly-port.dtsi 文件I2C1里面添加设备信息如下:
  1. &i2c1 {
  2.         status = "okay";
  3.         i2c-scl-rising-time-ns = <300>;
  4.         i2c-scl-falling-time-ns = <15>;

  5.         rt5640: rt5640@1c {
  6.                 #sound-dai-cells = <0>;
  7.                 compatible = "realtek,rt5640";
  8.                 reg = <0x1c>;
  9.                 clocks = <&cru SCLK_I2S_8CH_OUT>;
  10.                 clock-names = "mclk";
  11.                 realtek,in1-differential;
  12.                 pinctrl-names = "default";
  13.                 pinctrl-0 = <&rt5640_hpcon &i2s_8ch_mclk>;
  14.                 hp-con-gpio = <&gpio4 21 GPIO_ACTIVE_HIGH>;
  15.                 //hp-det-gpio = <&gpio4 28 GPIO_ACTIVE_LOW>;
  16.                 io-channels = <&saradc 4>;
  17.                 hp-det-adc-value = <500>;
  18.         };

  19.         cymbr3116@7A {
  20.                 compatible = "cymbr3116";
  21.                 reg = <0x7A>;
  22.                 status = "okay";
  23.         };
  24. };
复制代码

其中cymbr3116是我添加的设备信息,  I2C1我从/sys/bus/i2c/device看是已经挂在上了的.


然后设备驱动源码如下:
  1. #if CONFIG_OF
  2. static struct of_device_id cy311x_of_mach[] = {
  3.     {.compatible = "cymbr3116" , },
  4.     {},
  5. };
  6. MODULE_DEVICE_TABLE(of, cy311x_of_mach);
  7. #endif

  8. static int  cy3x_tk_probe(struct i2c_client *client,
  9.                         const struct i2c_device_id *id)
  10. {
  11.     printk("cymbr311x into probe.\n");
  12.     return 0;
  13. }

  14. static int cy3x_tk_remove(struct i2c_client *client)
  15. {
  16.     printk("cymbr311x into remove.\n");
  17.     return 0;
  18. }

  19. static const struct i2c_device_id cy3xctouch_id[] = {
  20.         { "cymbr3116", 0 },
  21.         { },
  22. };
  23. MODULE_DEVICE_TABLE(i2c, cy3xctouch_id);

  24. static struct i2c_driver cy3xtouch_i2c_driver  = {
  25.         .driver = {
  26.                 .name  = "cymbr3116",
  27.         #if CONFIG_OF
  28.                 .of_match_table = of_match_ptr(cy311x_of_mach),
  29.         #endif
  30.         },
  31.         .probe                = cy3x_tk_probe,
  32.         .remove                = cy3x_tk_remove,
  33.         .id_table        = cy3xctouch_id,
  34. };

  35. module_i2c_driver(cy3xtouch_i2c_driver);
复制代码

但是怎么都进不去probe , 请教下是哪里有错误啊.

谢谢!!!!


回复

使用道具 举报

32

积分

0

威望

0

贡献

技术小白

积分
32
发表于 2019-6-5 16:17:16     
补充下,  I2C的驱动应该是成功了的,   /sys/bus/i2c/drivers  里面能看到驱动
回复

使用道具 举报

32

积分

0

威望

0

贡献

技术小白

积分
32
发表于 2019-6-5 16:33:00     
我看官方WIKI 里面的DEMO , gslx680 , 也进不去probe   , 我已经吧状态从disabled 修改为okay了. ,还是进不去.
  1. &i2c4 {
  2.     gsl3680: gsl3680@41 {
  3.               status = "okay";
  4.               compatible = "gslX680";
  5.               reg = <0x41>;
  6.               screen_max_x = <1536>;
  7.               screen_max_y = <2048>;
  8.               touch-gpio = <&gpio1 20 IRQ_TYPE_LEVEL_LOW>;
  9.               reset-gpio = <&gpio0 12 GPIO_ACTIVE_HIGH>;
  10.       };

  11.         mpu6050:mpu@68{
  12.             status = "disabled";
  13.             compatible = "invensense,mpu6050";
  14.             reg = <0x68>;
  15.             mpu-int_config = <0x10>;
  16.             mpu-level_shifter = <0>;
  17.             mpu-orientation = <0 1 0 1 0 0 0 0 1>;
  18.             orientation-x= <1>;
  19.             orientation-y= <1>;
  20.             orientation-z= <1>;
  21.             irq-gpio = <&gpio1 4 IRQ_TYPE_LEVEL_LOW>;
  22.             mpu-debug = <1>;
  23.         };

  24. };
复制代码
回复

使用道具 举报

32

积分

0

威望

0

贡献

技术小白

积分
32
发表于 2019-6-5 22:49:05     
我貌似找到问题了,  编译kernel生成的resource.img ,我没有烧写。

所以dtb并没有更新。

小白伤不起, 晚上没板子, 明天验证下。

回复

使用道具 举报

66

积分

0

威望

0

贡献

技术小白

积分
66
发表于 2020-7-15 20:50:48     
解决了吗?
回复

使用道具 举报

9

积分

0

威望

0

贡献

技术小白

积分
9
发表于 2020-11-2 15:18:06     
111
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

友情链接 : 爱板网 电子发烧友论坛 云汉电子社区 粤ICP备14022046号-2
快速回复 返回顶部 返回列表