|
【Linux】
RK3399 I2C使用问题请教
发表于 2019-6-5 16:09:01
浏览:8966
|
回复:5
打印
只看该作者
[复制链接]
楼主
刚拿到板子,想添加一个I2C设备,但是怎么都进不去probe , 请教下各位是哪里的问题啊.
板子是RK3399-JD4 , Kernel的编译参数是make -j8 ARCH=arm64 rk3399-firefly-aiojd4.img
在rk3399-firefly-port.dtsi 文件I2C1里面添加设备信息如下:
- &i2c1 {
- status = "okay";
- i2c-scl-rising-time-ns = <300>;
- i2c-scl-falling-time-ns = <15>;
- rt5640: rt5640@1c {
- #sound-dai-cells = <0>;
- compatible = "realtek,rt5640";
- reg = <0x1c>;
- clocks = <&cru SCLK_I2S_8CH_OUT>;
- clock-names = "mclk";
- realtek,in1-differential;
- pinctrl-names = "default";
- pinctrl-0 = <&rt5640_hpcon &i2s_8ch_mclk>;
- hp-con-gpio = <&gpio4 21 GPIO_ACTIVE_HIGH>;
- //hp-det-gpio = <&gpio4 28 GPIO_ACTIVE_LOW>;
- io-channels = <&saradc 4>;
- hp-det-adc-value = <500>;
- };
- cymbr3116@7A {
- compatible = "cymbr3116";
- reg = <0x7A>;
- status = "okay";
- };
- };
复制代码
其中cymbr3116是我添加的设备信息, I2C1我从/sys/bus/i2c/device看是已经挂在上了的.
然后设备驱动源码如下:
- #if CONFIG_OF
- static struct of_device_id cy311x_of_mach[] = {
- {.compatible = "cymbr3116" , },
- {},
- };
- MODULE_DEVICE_TABLE(of, cy311x_of_mach);
- #endif
- static int cy3x_tk_probe(struct i2c_client *client,
- const struct i2c_device_id *id)
- {
- printk("cymbr311x into probe.\n");
- return 0;
- }
- static int cy3x_tk_remove(struct i2c_client *client)
- {
- printk("cymbr311x into remove.\n");
- return 0;
- }
- static const struct i2c_device_id cy3xctouch_id[] = {
- { "cymbr3116", 0 },
- { },
- };
- MODULE_DEVICE_TABLE(i2c, cy3xctouch_id);
- static struct i2c_driver cy3xtouch_i2c_driver = {
- .driver = {
- .name = "cymbr3116",
- #if CONFIG_OF
- .of_match_table = of_match_ptr(cy311x_of_mach),
- #endif
- },
- .probe = cy3x_tk_probe,
- .remove = cy3x_tk_remove,
- .id_table = cy3xctouch_id,
- };
- module_i2c_driver(cy3xtouch_i2c_driver);
复制代码
但是怎么都进不去probe , 请教下是哪里有错误啊.
谢谢!!!!
|
|