新手入门
- 积分
- 9
- 金钱
- 9
- 注册时间
- 2023-1-2
- 在线时间
- 2 小时
|
楼主 |
发表于 2023-1-12 00:43:51
|
显示全部楼层
static int ov2640_video_probe(struct i2c_client *client)
964 {
965 struct ov2640_priv *priv = to_ov2640(client);
966 u8 pid, ver, midh, midl;
967 const char *devname;
968 int ret;
969
970 ret = ov2640_s_power(&priv->subdev, 1);
971 if (ret < 0)
972 return ret;
973
974 /*
975 * check and show product ID and manufacturer ID
976 */
977 i2c_smbus_write_byte_data(client, BANK_SEL, BANK_SEL_SENS);
978 pid = i2c_smbus_read_byte_data(client, PID);
979 ver = i2c_smbus_read_byte_data(client, VER);
980 midh = i2c_smbus_read_byte_data(client, MIDH);
981 midl = i2c_smbus_read_byte_data(client, MIDL);
982
983 switch (VERSION(pid, ver)) {
984 case PID_OV2640:
985 devname = "ov2640";
986 break;
987 default:
988 dev_err(&client->dev,
989 "Product ID error %x:%x\n", pid, ver);
990 ret = -ENODEV;
991 goto done;
992 }
993
994 dev_info(&client->dev,
995 "%s Product ID %0x:%0x Manufacturer ID %x:%x\n",
996 devname, pid, ver, midh, midl);
997
998 ret = v4l2_ctrl_handler_setup(&priv->hdl);
999
1000 done:
1001 ov2640_s_power(&priv->subdev, 0);
1002 return ret;
1003 } |
|