Example #1
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;
}
Example #2
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;
}
Example #3
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;
}
Example #4
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;
}
Example #6
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;
}