Firefly开源社区

打印 上一主题 下一主题

RK3288 linux下ov摄像头驱动问题

17

积分

0

威望

0

贡献

技术小白

积分
17

RK3288 linux下ov摄像头驱动问题

发表于 2021-5-25 09:14:41      浏览:3479 | 回复:1        打印      只看该作者   [复制链接] 楼主
各位大神们好!我最近在做rk3288平台上ov426+ov6946的方案。
驱动在读取摄像头ID这里遇到了问题。
驱动的读i2c代码
static int ov6946_read_reg(struct i2c_client *client, u16 reg,
                            unsigned int len, u32 *val)
{       
        struct i2c_msg msg[2];
        u8 buf[2]= { reg >> 8, reg & 0xff };
        int ret;

        msg[0].addr = client->addr;
        msg[0].flags = client->flags;
        msg[0].buf = buf;
        msg[0].len = sizeof(buf);

        msg[1].addr = client->addr;
        msg[1].flags = client->flags | I2C_M_RD;
        msg[1].buf = buf;
        msg[1].len = 1;

        ret = i2c_transfer(client->adapter, msg, 2);
        if (ret >= 0) {
                *val = buf[0];
                return 0;
        }

        dev_err(&client->dev,
                "read reg:0x%x result:0x%x failed  !\n", reg,buf[0]);

        return ret;
}
打印log出来是这样的
[root@rk3288:/]# dmesg | grep ov6946
[    3.168255] ov6946 3-0036: driver version: 00.01.02
[    3.168276] ov6946 3-0036: GPIO lookup for consumer reset
[    3.168279] ov6946 3-0036: using device tree for GPIO lookup
[    3.168299] of_get_named_gpiod_flags: parsed 'reset-gpios' property of node '/i2c@ff150000/ov6946@36[0]' - status (0)
[    3.168323] ov6946 3-0036: GPIO lookup for consumer pwdn
[    3.168327] ov6946 3-0036: using device tree for GPIO lookup
[    3.168344] of_get_named_gpiod_flags: parsed 'pwdn-gpios' property of node '/i2c@ff150000/ov6946@36[0]' - status (0)
[    3.168512] ov6946 3-0036: could not get default pinstate
[    3.168517] ov6946 3-0036: could not get sleep pinstate
[    3.168535] ov6946 3-0036: ERROR init controls(0)
[    3.168543] ov6946 3-0036: ERROR init controls(0)
[    3.170337] ov6946 3-0036: read reg:0x300a result:0x30 failed  !
[    3.170341] ov6946 3-0036: Unexpected sensor id(000000), ret(-6)

但奇怪的是在用户空间里可以正常读写
[root@rk3288:/]# i2cdetect -y 3
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- 36 -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --                        
[root@rk3288:/]# i2ctransfer -y 3 w2@0x36 0x30 0x0a r1
0x69

麻烦大神们帮忙看一下!
回复

使用道具 举报

17

积分

0

威望

0

贡献

技术小白

积分
17
发表于 2021-5-25 13:20:07        只看该作者  沙发
顶一顶,有大神看看吗
回复

使用道具 举报

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

本版积分规则

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