Esempio n. 1
0
/* Calls i2c device based on I2C driver ID. */
int cx18_i2c_id(struct cx18 *cx, u32 id, unsigned int cmd, void *arg)
{
	int addr;

	addr = cx18_i2c_id_addr(cx, id);
	if (addr < 0) {
		if (cmd != VIDIOC_G_CHIP_IDENT)
			CX18_ERR("i2c ID 0x%08x (%s) not found for cmd 0x%x!\n",
				id, cx18_i2c_id_name(id), cmd);
		return addr;
	}
	return cx18_call_i2c_client(cx, addr, cmd, arg);
}
Esempio n. 2
0
static int cx18_s_register(struct file *file, void *fh,
				struct v4l2_register *reg)
{
	struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;

	if (v4l2_chip_match_host(reg->match_type, reg->match_chip))
		return cx18_cxc(cx, VIDIOC_DBG_S_REGISTER, reg);
	if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER)
		return cx18_i2c_id(cx, reg->match_chip, VIDIOC_DBG_S_REGISTER,
					reg);
	return cx18_call_i2c_client(cx, reg->match_chip, VIDIOC_DBG_S_REGISTER,
					reg);
}
Esempio n. 3
0
/* Calls i2c device based on CX18_HW_ flag. If hw == 0, then do nothing.
   If hw == CX18_HW_GPIO then call the gpio handler. */
int cx18_i2c_hw(struct cx18 *cx, u32 hw, unsigned int cmd, void *arg)
{
	int addr;

	if (hw == CX18_HW_GPIO || hw == 0)
		return 0;
	if (hw == CX18_HW_CX23418)
		return cx18_av_cmd(cx, cmd, arg);

	addr = cx18_i2c_hw_addr(cx, hw);
	if (addr < 0) {
		CX18_ERR("i2c hardware 0x%08x (%s) not found for cmd 0x%x!\n",
			       hw, cx18_i2c_hw_name(hw), cmd);
		return addr;
	}
	return cx18_call_i2c_client(cx, addr, cmd, arg);
}
Esempio n. 4
0
static int cx18_g_chip_ident(struct file *file, void *fh,
				struct v4l2_chip_ident *chip)
{
	struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;

	chip->ident = V4L2_IDENT_NONE;
	chip->revision = 0;
	if (chip->match_type == V4L2_CHIP_MATCH_HOST) {
		if (v4l2_chip_match_host(chip->match_type, chip->match_chip))
			chip->ident = V4L2_IDENT_CX23418;
		return 0;
	}
	if (chip->match_type == V4L2_CHIP_MATCH_I2C_DRIVER)
		return cx18_i2c_id(cx, chip->match_chip, VIDIOC_G_CHIP_IDENT,
					chip);
	if (chip->match_type == V4L2_CHIP_MATCH_I2C_ADDR)
		return cx18_call_i2c_client(cx, chip->match_chip,
						VIDIOC_G_CHIP_IDENT, chip);
	return -EINVAL;
}