int sn9c102_probe_ov7630(struct sn9c102_device* cam) { const struct usb_device_id ov7630_id_table[] = { { USB_DEVICE(0x0c45, 0x602c), }, { USB_DEVICE(0x0c45, 0x602d), }, { USB_DEVICE(0x0c45, 0x608f), }, { USB_DEVICE(0x0c45, 0x60b0), }, { } }; int err = 0; if (!sn9c102_match_id(cam, ov7630_id_table)) return -ENODEV; err += sn9c102_write_reg(cam, 0x01, 0x01); err += sn9c102_write_reg(cam, 0x00, 0x01); err += sn9c102_write_reg(cam, 0x28, 0x17); if (err) return -EIO; err += sn9c102_i2c_try_write(cam, &ov7630, 0x0b, 0); if (err) return -ENODEV; sn9c102_attach_sensor(cam, &ov7630); return 0; }
int sn9c102_probe_mi0360(struct sn9c102_device *cam) { u8 data[2]; switch (sn9c102_get_bridge(cam)) { case BRIDGE_SN9C103: if (sn9c102_write_const_regs(cam, {0x01, 0x01}, {0x00, 0x01}, {0x28, 0x17})) return -EIO; break; case BRIDGE_SN9C105: case BRIDGE_SN9C120: if (sn9c102_write_const_regs(cam, {0x01, 0xf1}, {0x00, 0xf1}, {0x01, 0x01}, {0x00, 0x01}, {0x28, 0x17})) return -EIO; break; default: break; } if (sn9c102_i2c_try_raw_read(cam, &mi0360, mi0360.i2c_slave_id, 0x00, 2, data) < 0) return -EIO; if (data[0] != 0x82 || data[1] != 0x43) return -ENODEV; sn9c102_attach_sensor(cam, &mi0360); return 0; }
int sn9c102_probe_tas5110c1b(struct sn9c102_device* cam) { /* This sensor has no identifiers, so let's attach it anyway */ sn9c102_attach_sensor(cam, &tas5110c1b); /* At the moment, sensor detection is based on USB pid/vid */ if (tas5110c1b.usbdev->descriptor.idProduct != 0x6001 && tas5110c1b.usbdev->descriptor.idProduct != 0x6005) return -ENODEV; return 0; }
int sn9c102_probe_tas5110d(struct sn9c102_device* cam) { const struct usb_device_id tas5110d_id_table[] = { { USB_DEVICE(0x0c45, 0x6007), }, { } }; if (!sn9c102_match_id(cam, tas5110d_id_table)) return -ENODEV; sn9c102_attach_sensor(cam, &tas5110d); return 0; }
int sn9c102_probe_tas5130d1b(struct sn9c102_device* cam) { /* This sensor has no identifiers, so let's attach it anyway */ sn9c102_attach_sensor(cam, &tas5130d1b); /* At the moment, only devices whose PID is 0x6025 have this sensor */ if (tas5130d1b.usbdev->descriptor.idProduct != 0x6025) return -ENODEV; dev_info(tas5130d1b.dev, "TAS5130D1B detected, but the support for it " "is disabled at the moment - needs further " "testing -\n"); return -ENODEV; }
int sn9c102_probe_tas5130d1b(struct sn9c102_device* cam) { const struct usb_device_id tas5130d1b_id_table[] = { { USB_DEVICE(0x0c45, 0x6025), }, { USB_DEVICE(0x0c45, 0x60aa), }, { } }; /* Sensor detection is based on USB pid/vid */ if (!sn9c102_match_id(cam, tas5130d1b_id_table)) return -ENODEV; sn9c102_attach_sensor(cam, &tas5130d1b); return 0; }
int sn9c102_probe_hv7131r(struct sn9c102_device* cam) { int devid, err; err = sn9c102_write_const_regs(cam, {0x09, 0x01}, {0x44, 0x02}, {0x34, 0x01}, {0x20, 0x17}, {0x34, 0x01}, {0x46, 0x01}); devid = sn9c102_i2c_try_read(cam, &hv7131r, 0x00); if (err || devid < 0) return -EIO; if (devid != 0x02) return -ENODEV; sn9c102_attach_sensor(cam, &hv7131r); return 0; }
int sn9c102_probe_mi0343(struct sn9c102_device* cam) { u8 data[2]; if (sn9c102_write_const_regs(cam, {0x01, 0x01}, {0x00, 0x01}, {0x28, 0x17})) return -EIO; if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, 0x00, 2, data) < 0) return -EIO; if (data[1] != 0x42 || data[0] != 0xe3) return -ENODEV; sn9c102_attach_sensor(cam, &mi0343); return 0; }
int sn9c102_probe_hv7131d(struct sn9c102_device* cam) { int r0 = 0, r1 = 0, err; err = sn9c102_write_const_regs(cam, {0x01, 0x01}, {0x00, 0x01}, {0x28, 0x17}); r0 = sn9c102_i2c_try_read(cam, &hv7131d, 0x00); r1 = sn9c102_i2c_try_read(cam, &hv7131d, 0x01); if (err || r0 < 0 || r1 < 0) return -EIO; if ((r0 != 0x00 && r0 != 0x01) || r1 != 0x04) return -ENODEV; sn9c102_attach_sensor(cam, &hv7131d); return 0; }
int sn9c102_probe_ov7648(struct sn9c102_device* cam) { int pid, ver, err; err = sn9c102_write_const_regs(cam, {0x01, 0xf1}, {0x00, 0xf1}, {0x29, 0x01}, {0x74, 0x02}, {0x0e, 0x01}, {0x44, 0x01}); pid = sn9c102_i2c_try_read(cam, &ov7648, 0x0a); ver = sn9c102_i2c_try_read(cam, &ov7648, 0x0b); if (err || pid < 0 || ver < 0) return -EIO; if (pid != 0x76 || ver != 0x48) return -ENODEV; sn9c102_attach_sensor(cam, &ov7648); return 0; }
int sn9c102_probe_ov7660(struct sn9c102_device* cam) { int pid, ver, err = 0; err += sn9c102_write_reg(cam, 0x01, 0xf1); err += sn9c102_write_reg(cam, 0x00, 0xf1); err += sn9c102_write_reg(cam, 0x01, 0x01); err += sn9c102_write_reg(cam, 0x00, 0x01); err += sn9c102_write_reg(cam, 0x28, 0x17); pid = sn9c102_i2c_try_read(cam, &ov7660, 0x0a); ver = sn9c102_i2c_try_read(cam, &ov7660, 0x0b); if (err || pid < 0 || ver < 0) return -EIO; if (pid != 0x76 || ver != 0x60) return -ENODEV; sn9c102_attach_sensor(cam, &ov7660); return 0; }
int sn9c102_probe_mi0343(struct sn9c102_device* cam) { int err = 0; err += sn9c102_write_reg(cam, 0x01, 0x01); err += sn9c102_write_reg(cam, 0x00, 0x01); err += sn9c102_write_reg(cam, 0x28, 0x17); if (err) return -EIO; if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, 0x00, 2, mi0343_i2c_data) < 0) return -EIO; if (mi0343_i2c_data[4] != 0x32 && mi0343_i2c_data[3] != 0xe3) return -ENODEV; sn9c102_attach_sensor(cam, &mi0343); return 0; }
int sn9c102_probe_hv7131d(struct sn9c102_device* cam) { int r0 = 0, r1 = 0, err = 0; err += sn9c102_write_reg(cam, 0x01, 0x01); err += sn9c102_write_reg(cam, 0x00, 0x01); err += sn9c102_write_reg(cam, 0x28, 0x17); if (err) return -EIO; r0 = sn9c102_i2c_try_read(cam, &hv7131d, 0x00); r1 = sn9c102_i2c_try_read(cam, &hv7131d, 0x01); if (r0 < 0 || r1 < 0) return -EIO; if (r0 != 0x00 && r1 != 0x04) return -ENODEV; sn9c102_attach_sensor(cam, &hv7131d); return 0; }
int sn9c102_probe_ov7630(struct sn9c102_device* cam) { int pid, ver, err = 0; switch (sn9c102_get_bridge(cam)) { case BRIDGE_SN9C101: case BRIDGE_SN9C102: err = sn9c102_write_const_regs(cam, {0x01, 0x01}, {0x00, 0x01}, {0x28, 0x17}); break; case BRIDGE_SN9C103: /* */ err = sn9c102_write_const_regs(cam, {0x09, 0x01}, {0x42, 0x01}, {0x28, 0x17}, {0x44, 0x02}); pid = sn9c102_i2c_try_read(cam, &ov7630, 0x0a); if (err || pid < 0) /* */ err += sn9c102_write_const_regs(cam, {0x01, 0x01}, {0x00, 0x01}); break; case BRIDGE_SN9C105: case BRIDGE_SN9C120: err = sn9c102_write_const_regs(cam, {0x01, 0xf1}, {0x00, 0xf1}, {0x29, 0x01}, {0x74, 0x02}, {0x0e, 0x01}, {0x44, 0x01}); break; default: break; } pid = sn9c102_i2c_try_read(cam, &ov7630, 0x0a); ver = sn9c102_i2c_try_read(cam, &ov7630, 0x0b); if (err || pid < 0 || ver < 0) return -EIO; if (pid != 0x76 || ver != 0x31) return -ENODEV; sn9c102_attach_sensor(cam, &ov7630); return 0; }
int sn9c102_probe_mt9v111(struct sn9c102_device *cam) { u8 data[2]; int err = 0; err += sn9c102_write_const_regs(cam, {0x01, 0xf1}, {0x00, 0xf1}, {0x29, 0x01}, {0x42, 0x17}, {0x62, 0x17}, {0x08, 0x01}); err += sn9c102_i2c_try_raw_write(cam, &mt9v111, 4, mt9v111.i2c_slave_id, 0x01, 0x00, 0x04, 0, 0); if (err || sn9c102_i2c_try_raw_read(cam, &mt9v111, mt9v111.i2c_slave_id, 0x36, 2, data) < 0) return -EIO; if (data[0] != 0x82 || data[1] != 0x3a) return -ENODEV; sn9c102_attach_sensor(cam, &mt9v111); return 0; }
int sn9c102_probe_pas202bca(struct sn9c102_device* cam) { const struct usb_device_id pas202bca_id_table[] = { { USB_DEVICE(0x0c45, 0x60af), }, { } }; int err = 0; if (!sn9c102_match_id(cam,pas202bca_id_table)) return -ENODEV; err += sn9c102_write_reg(cam, 0x01, 0x01); err += sn9c102_write_reg(cam, 0x40, 0x01); err += sn9c102_write_reg(cam, 0x28, 0x17); if (err) return -EIO; if (sn9c102_i2c_try_write(cam, &pas202bca, 0x10, 0)) /* try to write */ return -ENODEV; sn9c102_attach_sensor(cam, &pas202bca); return 0; }