Exemple #1
0
static int vidioc_g_register(struct file *file, void *priv,
			     struct v4l2_dbg_register *reg)
{
	struct stk1160 *dev = video_drvdata(file);
	int rc;
	u8 val;

	switch (reg->match.type) {
	case V4L2_CHIP_MATCH_AC97:
		/* TODO: Support me please :-( */
		return -EINVAL;
	case V4L2_CHIP_MATCH_I2C_DRIVER:
		v4l2_device_call_all(&dev->v4l2_dev, 0, core, g_register, reg);
		return 0;
	case V4L2_CHIP_MATCH_I2C_ADDR:
		/* TODO: is this correct? */
		v4l2_device_call_all(&dev->v4l2_dev, 0, core, g_register, reg);
		return 0;
	default:
		if (!v4l2_chip_match_host(&reg->match))
			return -EINVAL;
	}

	/* Match host */
	rc = stk1160_read_reg(dev, reg->reg, &val);
	reg->val = val;
	reg->size = 1;

	return rc;
}
Exemple #2
0
static int cx18_s_register(struct file *file, void *fh,
				struct v4l2_dbg_register *reg)
{
	struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;

	if (v4l2_chip_match_host(&reg->match))
		return cx18_cxc(cx, VIDIOC_DBG_S_REGISTER, reg);
	cx18_call_i2c_clients(cx, VIDIOC_DBG_S_REGISTER, reg);
	return 0;
}
Exemple #3
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);
}
Exemple #4
0
static int cx18_g_chip_ident(struct file *file, void *fh,
				struct v4l2_dbg_chip_ident *chip)
{
	struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;

	chip->ident = V4L2_IDENT_NONE;
	chip->revision = 0;
	if (v4l2_chip_match_host(&chip->match)) {
		chip->ident = V4L2_IDENT_CX23418;
		return 0;
	}
	cx18_call_i2c_clients(cx, VIDIOC_DBG_G_CHIP_IDENT, chip);
	return 0;
}
static int vidioc_g_chip_ident(struct file *file, void *__fh,
		struct v4l2_dbg_chip_ident *chip)
{
	struct saa7146_fh *fh = __fh;
	struct saa7146_dev *dev = fh->dev;

	chip->ident = V4L2_IDENT_NONE;
	chip->revision = 0;
	if (chip->match.type == V4L2_CHIP_MATCH_HOST) {
		if (v4l2_chip_match_host(&chip->match))
			chip->ident = V4L2_IDENT_SAA7146;
		return 0;
	}
	if (chip->match.type != V4L2_CHIP_MATCH_I2C_DRIVER &&
	    chip->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
		return -EINVAL;
	return v4l2_device_call_until_err(&dev->v4l2_dev, 0,
			core, g_chip_ident, chip);
}
Exemple #6
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;
}
Exemple #7
0
static int vidioc_s_register(struct file *file, void *priv,
			     struct v4l2_dbg_register *reg)
{
	struct stk1160 *dev = video_drvdata(file);

	switch (reg->match.type) {
	case V4L2_CHIP_MATCH_AC97:
		return -EINVAL;
	case V4L2_CHIP_MATCH_I2C_DRIVER:
		v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_register, reg);
		return 0;
	case V4L2_CHIP_MATCH_I2C_ADDR:
		/* TODO: is this correct? */
		v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_register, reg);
		return 0;
	default:
		if (!v4l2_chip_match_host(&reg->match))
			return -EINVAL;
	}

	/* Match host */
	return stk1160_write_reg(dev, reg->reg, cpu_to_le16(reg->val));
}