mirror of
https://github.com/adulau/aha.git
synced 2025-02-15 11:27:26 +00:00
V4L/DVB (10141): v4l2: debugging API changed to match against driver name instead of ID.
Since the i2c driver ID will be removed in the near future we have to modify the v4l2 debugging API to use the driver name instead of driver ID. Note that this API is not used in applications other than v4l2-dbg.cpp as it is for debugging and testing only. Should anyone use the old VIDIOC_G_CHIP_IDENT, then this will be logged with a warning that it is deprecated and will be removed in 2.6.30. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
da1b5c95e4
commit
aecde8b53b
52 changed files with 291 additions and 282 deletions
|
@ -184,7 +184,7 @@ may be NULL if the subdev driver does not support anything from that category.
|
|||
It looks like this:
|
||||
|
||||
struct v4l2_subdev_core_ops {
|
||||
int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip);
|
||||
int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
|
||||
int (*log_status)(struct v4l2_subdev *sd);
|
||||
int (*init)(struct v4l2_subdev *sd, u32 val);
|
||||
...
|
||||
|
|
|
@ -2039,7 +2039,7 @@ static int bttv_log_status(struct file *file, void *f)
|
|||
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
static int bttv_g_register(struct file *file, void *f,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct bttv_fh *fh = f;
|
||||
struct bttv *btv = fh->btv;
|
||||
|
@ -2047,18 +2047,19 @@ static int bttv_g_register(struct file *file, void *f,
|
|||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_host(®->match))
|
||||
return -EINVAL;
|
||||
|
||||
/* bt848 has a 12-bit register space */
|
||||
reg->reg &= 0xfff;
|
||||
reg->val = btread(reg->reg);
|
||||
reg->size = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bttv_s_register(struct file *file, void *f,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct bttv_fh *fh = f;
|
||||
struct bttv *btv = fh->btv;
|
||||
|
@ -2066,7 +2067,7 @@ static int bttv_s_register(struct file *file, void *f,
|
|||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_host(®->match))
|
||||
return -EINVAL;
|
||||
|
||||
/* bt848 has a 12-bit register space */
|
||||
|
|
|
@ -859,7 +859,7 @@ static int __cafe_cam_reset(struct cafe_camera *cam)
|
|||
*/
|
||||
static int cafe_cam_init(struct cafe_camera *cam)
|
||||
{
|
||||
struct v4l2_chip_ident chip = { V4L2_CHIP_MATCH_I2C_ADDR, 0, 0, 0 };
|
||||
struct v4l2_dbg_chip_ident chip;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&cam->s_mutex);
|
||||
|
@ -869,8 +869,9 @@ static int cafe_cam_init(struct cafe_camera *cam)
|
|||
ret = __cafe_cam_reset(cam);
|
||||
if (ret)
|
||||
goto out;
|
||||
chip.match_chip = cam->sensor->addr;
|
||||
ret = __cafe_cam_cmd(cam, VIDIOC_G_CHIP_IDENT, &chip);
|
||||
chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR;
|
||||
chip.match.addr = cam->sensor->addr;
|
||||
ret = __cafe_cam_cmd(cam, VIDIOC_DBG_G_CHIP_IDENT, &chip);
|
||||
if (ret)
|
||||
goto out;
|
||||
cam->sensor_type = chip.ident;
|
||||
|
|
|
@ -95,25 +95,24 @@ static int cs5345_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
static int cs5345_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
|
||||
static int cs5345_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
||||
if (!v4l2_chip_match_i2c_client(client,
|
||||
reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_i2c_client(client, ®->match))
|
||||
return -EINVAL;
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
reg->size = 1;
|
||||
reg->val = cs5345_read(sd, reg->reg & 0x1f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cs5345_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
|
||||
static int cs5345_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
||||
if (!v4l2_chip_match_i2c_client(client,
|
||||
reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_i2c_client(client, ®->match))
|
||||
return -EINVAL;
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
@ -122,7 +121,7 @@ static int cs5345_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int cs5345_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip)
|
||||
static int cs5345_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ static int cs53l32a_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cs53l32a_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip)
|
||||
static int cs53l32a_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ int cx18_call_i2c_client(struct cx18 *cx, int addr, unsigned cmd, void *arg)
|
|||
return retval;
|
||||
}
|
||||
}
|
||||
if (cmd != VIDIOC_G_CHIP_IDENT)
|
||||
if (cmd != VIDIOC_DBG_G_CHIP_IDENT)
|
||||
CX18_ERR("i2c addr 0x%02x not found for cmd 0x%x!\n",
|
||||
addr, cmd);
|
||||
return -ENODEV;
|
||||
|
@ -268,17 +268,6 @@ static int cx18_i2c_id_addr(struct cx18 *cx, u32 id)
|
|||
return retval;
|
||||
}
|
||||
|
||||
/* Find the i2c device name matching the DRIVERID */
|
||||
static const char *cx18_i2c_id_name(u32 id)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
|
||||
if (hw_driverids[i] == id)
|
||||
return hw_devicenames[i];
|
||||
return "unknown device";
|
||||
}
|
||||
|
||||
/* Find the i2c device name matching the CX18_HW_ flag */
|
||||
static const char *cx18_i2c_hw_name(u32 hw)
|
||||
{
|
||||
|
@ -326,21 +315,6 @@ int cx18_i2c_hw(struct cx18 *cx, u32 hw, unsigned int cmd, void *arg)
|
|||
return cx18_call_i2c_client(cx, addr, cmd, arg);
|
||||
}
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
/* broadcast cmd for all I2C clients and for the gpio subsystem */
|
||||
void cx18_call_i2c_clients(struct cx18 *cx, unsigned int cmd, void *arg)
|
||||
{
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
int cx18_i2c_hw_addr(struct cx18 *cx, u32 hw);
|
||||
int cx18_i2c_hw(struct cx18 *cx, u32 hw, unsigned int cmd, void *arg);
|
||||
int cx18_i2c_id(struct cx18 *cx, u32 id, unsigned int cmd, void *arg);
|
||||
int cx18_call_i2c_client(struct cx18 *cx, int addr, unsigned cmd, void *arg);
|
||||
void cx18_call_i2c_clients(struct cx18 *cx, unsigned int cmd, void *arg);
|
||||
int cx18_i2c_register(struct cx18 *cx, unsigned idx);
|
||||
|
|
|
@ -254,30 +254,24 @@ static int cx18_s_fmt_sliced_vbi_cap(struct file *file, void *fh,
|
|||
}
|
||||
|
||||
static int cx18_g_chip_ident(struct file *file, void *fh,
|
||||
struct v4l2_chip_ident *chip)
|
||||
struct v4l2_dbg_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;
|
||||
if (v4l2_chip_match_host(&chip->match)) {
|
||||
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;
|
||||
cx18_call_i2c_clients(cx, VIDIOC_DBG_G_CHIP_IDENT, chip);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg)
|
||||
{
|
||||
struct v4l2_register *regs = arg;
|
||||
struct v4l2_dbg_register *regs = arg;
|
||||
unsigned long flags;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
|
@ -286,6 +280,7 @@ static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg)
|
|||
return -EINVAL;
|
||||
|
||||
spin_lock_irqsave(&cx18_cards_lock, flags);
|
||||
regs->size = 4;
|
||||
if (cmd == VIDIOC_DBG_G_REGISTER)
|
||||
regs->val = cx18_read_enc(cx, regs->reg);
|
||||
else
|
||||
|
@ -295,31 +290,25 @@ static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg)
|
|||
}
|
||||
|
||||
static int cx18_g_register(struct file *file, void *fh,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
|
||||
|
||||
if (v4l2_chip_match_host(reg->match_type, reg->match_chip))
|
||||
if (v4l2_chip_match_host(®->match))
|
||||
return cx18_cxc(cx, VIDIOC_DBG_G_REGISTER, reg);
|
||||
if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER)
|
||||
return cx18_i2c_id(cx, reg->match_chip, VIDIOC_DBG_G_REGISTER,
|
||||
reg);
|
||||
return cx18_call_i2c_client(cx, reg->match_chip, VIDIOC_DBG_G_REGISTER,
|
||||
reg);
|
||||
cx18_call_i2c_clients(cx, VIDIOC_DBG_G_REGISTER, reg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cx18_s_register(struct file *file, void *fh,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
|
||||
|
||||
if (v4l2_chip_match_host(reg->match_type, reg->match_chip))
|
||||
if (v4l2_chip_match_host(®->match))
|
||||
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);
|
||||
cx18_call_i2c_clients(cx, VIDIOC_DBG_S_REGISTER, reg);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1326,11 +1326,11 @@ static int vidioc_s_frequency(struct file *file, void *priv,
|
|||
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
static int vidioc_g_register(struct file *file, void *fh,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev;
|
||||
|
||||
if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_host(®->match))
|
||||
return -EINVAL;
|
||||
|
||||
cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_G_REGISTER, reg);
|
||||
|
@ -1339,11 +1339,11 @@ static int vidioc_g_register(struct file *file, void *fh,
|
|||
}
|
||||
|
||||
static int vidioc_s_register(struct file *file, void *fh,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev;
|
||||
|
||||
if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_host(®->match))
|
||||
return -EINVAL;
|
||||
|
||||
cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_S_REGISTER, reg);
|
||||
|
|
|
@ -1120,25 +1120,24 @@ static int cx25840_init(struct v4l2_subdev *sd, u32 val)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
static int cx25840_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
|
||||
static int cx25840_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
||||
if (!v4l2_chip_match_i2c_client(client,
|
||||
reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_i2c_client(client, ®->match))
|
||||
return -EINVAL;
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
reg->size = 1;
|
||||
reg->val = cx25840_read(client, reg->reg & 0x0fff);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cx25840_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
|
||||
static int cx25840_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
||||
if (!v4l2_chip_match_i2c_client(client,
|
||||
reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_i2c_client(client, ®->match))
|
||||
return -EINVAL;
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
@ -1362,7 +1361,7 @@ static int cx25840_reset(struct v4l2_subdev *sd, u32 val)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cx25840_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip)
|
||||
static int cx25840_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
|
||||
{
|
||||
struct cx25840_state *state = to_state(sd);
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
|
|
@ -1447,25 +1447,26 @@ static int vidioc_s_frequency (struct file *file, void *priv,
|
|||
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
static int vidioc_g_register (struct file *file, void *fh,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core;
|
||||
|
||||
if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_host(®->match))
|
||||
return -EINVAL;
|
||||
/* cx2388x has a 24-bit register space */
|
||||
reg->val = cx_read(reg->reg&0xffffff);
|
||||
reg->val = cx_read(reg->reg & 0xffffff);
|
||||
reg->size = 4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_s_register (struct file *file, void *fh,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core;
|
||||
|
||||
if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_host(®->match))
|
||||
return -EINVAL;
|
||||
cx_write(reg->reg&0xffffff, reg->val);
|
||||
cx_write(reg->reg & 0xffffff, reg->val);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1154,7 +1154,7 @@ static int em28xx_reg_len(int reg)
|
|||
}
|
||||
|
||||
static int vidioc_g_chip_ident(struct file *file, void *priv,
|
||||
struct v4l2_chip_ident *chip)
|
||||
struct v4l2_dbg_chip_ident *chip)
|
||||
{
|
||||
struct em28xx_fh *fh = priv;
|
||||
struct em28xx *dev = fh->dev;
|
||||
|
@ -1162,20 +1162,20 @@ static int vidioc_g_chip_ident(struct file *file, void *priv,
|
|||
chip->ident = V4L2_IDENT_NONE;
|
||||
chip->revision = 0;
|
||||
|
||||
em28xx_i2c_call_clients(dev, VIDIOC_G_CHIP_IDENT, chip);
|
||||
em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_CHIP_IDENT, chip);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int vidioc_g_register(struct file *file, void *priv,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct em28xx_fh *fh = priv;
|
||||
struct em28xx *dev = fh->dev;
|
||||
int ret;
|
||||
|
||||
switch (reg->match_type) {
|
||||
switch (reg->match.type) {
|
||||
case V4L2_CHIP_MATCH_AC97:
|
||||
mutex_lock(&dev->lock);
|
||||
ret = em28xx_read_ac97(dev, reg->reg);
|
||||
|
@ -1184,6 +1184,7 @@ static int vidioc_g_register(struct file *file, void *priv,
|
|||
return ret;
|
||||
|
||||
reg->val = ret;
|
||||
reg->size = 1;
|
||||
return 0;
|
||||
case V4L2_CHIP_MATCH_I2C_DRIVER:
|
||||
em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_REGISTER, reg);
|
||||
|
@ -1192,12 +1193,13 @@ static int vidioc_g_register(struct file *file, void *priv,
|
|||
/* Not supported yet */
|
||||
return -EINVAL;
|
||||
default:
|
||||
if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_host(®->match))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Match host */
|
||||
if (em28xx_reg_len(reg->reg) == 1) {
|
||||
reg->size = em28xx_reg_len(reg->reg);
|
||||
if (reg->size == 1) {
|
||||
mutex_lock(&dev->lock);
|
||||
ret = em28xx_read_reg(dev, reg->reg);
|
||||
mutex_unlock(&dev->lock);
|
||||
|
@ -1207,7 +1209,7 @@ static int vidioc_g_register(struct file *file, void *priv,
|
|||
|
||||
reg->val = ret;
|
||||
} else {
|
||||
__le64 val = 0;
|
||||
__le16 val = 0;
|
||||
mutex_lock(&dev->lock);
|
||||
ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS,
|
||||
reg->reg, (char *)&val, 2);
|
||||
|
@ -1215,21 +1217,21 @@ static int vidioc_g_register(struct file *file, void *priv,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
reg->val = le64_to_cpu(val);
|
||||
reg->val = le16_to_cpu(val);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_s_register(struct file *file, void *priv,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct em28xx_fh *fh = priv;
|
||||
struct em28xx *dev = fh->dev;
|
||||
__le64 buf;
|
||||
__le16 buf;
|
||||
int rc;
|
||||
|
||||
switch (reg->match_type) {
|
||||
switch (reg->match.type) {
|
||||
case V4L2_CHIP_MATCH_AC97:
|
||||
mutex_lock(&dev->lock);
|
||||
rc = em28xx_write_ac97(dev, reg->reg, reg->val);
|
||||
|
@ -1243,12 +1245,12 @@ static int vidioc_s_register(struct file *file, void *priv,
|
|||
/* Not supported yet */
|
||||
return -EINVAL;
|
||||
default:
|
||||
if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_host(®->match))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Match host */
|
||||
buf = cpu_to_le64(reg->val);
|
||||
buf = cpu_to_le16(reg->val);
|
||||
|
||||
mutex_lock(&dev->lock);
|
||||
rc = em28xx_write_regs(dev, reg->reg, (char *)&buf,
|
||||
|
|
|
@ -902,18 +902,19 @@ static void ivtv_load_and_init_modules(struct ivtv *itv)
|
|||
}
|
||||
|
||||
if (hw & IVTV_HW_SAA711X) {
|
||||
struct v4l2_chip_ident v = { V4L2_CHIP_MATCH_I2C_DRIVER, I2C_DRIVERID_SAA711X };
|
||||
struct v4l2_dbg_chip_ident v;
|
||||
|
||||
/* determine the exact saa711x model */
|
||||
itv->hw_flags &= ~IVTV_HW_SAA711X;
|
||||
|
||||
v.match.type = V4L2_CHIP_MATCH_I2C_DRIVER;
|
||||
strlcpy(v.match.name, "saa7115", sizeof(v.match.name));
|
||||
ivtv_call_hw(itv, IVTV_HW_SAA711X, core, g_chip_ident, &v);
|
||||
if (v.ident == V4L2_IDENT_SAA7114) {
|
||||
itv->hw_flags |= IVTV_HW_SAA7114;
|
||||
/* VBI is not yet supported by the saa7114 driver. */
|
||||
itv->v4l2_cap &= ~(V4L2_CAP_SLICED_VBI_CAPTURE|V4L2_CAP_VBI_CAPTURE);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
itv->hw_flags |= IVTV_HW_SAA7115;
|
||||
}
|
||||
itv->vbi.raw_decoder_line_size = 1443;
|
||||
|
|
|
@ -674,19 +674,19 @@ static int ivtv_s_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_f
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int ivtv_g_chip_ident(struct file *file, void *fh, struct v4l2_chip_ident *chip)
|
||||
static int ivtv_g_chip_ident(struct file *file, void *fh, struct v4l2_dbg_chip_ident *chip)
|
||||
{
|
||||
struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
|
||||
|
||||
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))
|
||||
if (chip->match.type == V4L2_CHIP_MATCH_HOST) {
|
||||
if (v4l2_chip_match_host(&chip->match))
|
||||
chip->ident = itv->has_cx23415 ? V4L2_IDENT_CX23415 : V4L2_IDENT_CX23416;
|
||||
return 0;
|
||||
}
|
||||
if (chip->match_type != V4L2_CHIP_MATCH_I2C_DRIVER &&
|
||||
chip->match_type != V4L2_CHIP_MATCH_I2C_ADDR)
|
||||
if (chip->match.type != V4L2_CHIP_MATCH_I2C_DRIVER &&
|
||||
chip->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
|
||||
return -EINVAL;
|
||||
/* TODO: is this correct? */
|
||||
return ivtv_call_all_err(itv, core, g_chip_ident, chip);
|
||||
|
@ -695,7 +695,7 @@ static int ivtv_g_chip_ident(struct file *file, void *fh, struct v4l2_chip_ident
|
|||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg)
|
||||
{
|
||||
struct v4l2_register *regs = arg;
|
||||
struct v4l2_dbg_register *regs = arg;
|
||||
volatile u8 __iomem *reg_start;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
|
@ -710,6 +710,7 @@ static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg)
|
|||
else
|
||||
return -EINVAL;
|
||||
|
||||
regs->size = 4;
|
||||
if (cmd == VIDIOC_DBG_G_REGISTER)
|
||||
regs->val = readl(regs->reg + reg_start);
|
||||
else
|
||||
|
@ -717,11 +718,11 @@ static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ivtv_g_register(struct file *file, void *fh, struct v4l2_register *reg)
|
||||
static int ivtv_g_register(struct file *file, void *fh, struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
|
||||
|
||||
if (v4l2_chip_match_host(reg->match_type, reg->match_chip))
|
||||
if (v4l2_chip_match_host(®->match))
|
||||
return ivtv_itvc(itv, VIDIOC_DBG_G_REGISTER, reg);
|
||||
/* TODO: subdev errors should not be ignored, this should become a
|
||||
subdev helper function. */
|
||||
|
@ -729,11 +730,11 @@ static int ivtv_g_register(struct file *file, void *fh, struct v4l2_register *re
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ivtv_s_register(struct file *file, void *fh, struct v4l2_register *reg)
|
||||
static int ivtv_s_register(struct file *file, void *fh, struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
|
||||
|
||||
if (v4l2_chip_match_host(reg->match_type, reg->match_chip))
|
||||
if (v4l2_chip_match_host(®->match))
|
||||
return ivtv_itvc(itv, VIDIOC_DBG_S_REGISTER, reg);
|
||||
/* TODO: subdev errors should not be ignored, this should become a
|
||||
subdev helper function. */
|
||||
|
|
|
@ -80,29 +80,28 @@ static int m52790_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *r
|
|||
}
|
||||
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
static int m52790_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
|
||||
static int m52790_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct m52790_state *state = to_state(sd);
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
||||
if (!v4l2_chip_match_i2c_client(client,
|
||||
reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_i2c_client(client, ®->match))
|
||||
return -EINVAL;
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
if (reg->reg != 0)
|
||||
return -EINVAL;
|
||||
reg->size = 1;
|
||||
reg->val = state->input | state->output;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int m52790_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
|
||||
static int m52790_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct m52790_state *state = to_state(sd);
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
||||
if (!v4l2_chip_match_i2c_client(client,
|
||||
reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_i2c_client(client, ®->match))
|
||||
return -EINVAL;
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
@ -115,7 +114,7 @@ static int m52790_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int m52790_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip)
|
||||
static int m52790_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
||||
|
|
|
@ -733,7 +733,7 @@ static int msp_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int msp_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip)
|
||||
static int msp_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
|
||||
{
|
||||
struct msp_state *state = to_state(sd);
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
|
|
@ -343,14 +343,14 @@ static int mt9m001_try_fmt(struct soc_camera_device *icd,
|
|||
}
|
||||
|
||||
static int mt9m001_get_chip_id(struct soc_camera_device *icd,
|
||||
struct v4l2_chip_ident *id)
|
||||
struct v4l2_dbg_chip_ident *id)
|
||||
{
|
||||
struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
|
||||
|
||||
if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR)
|
||||
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
|
||||
return -EINVAL;
|
||||
|
||||
if (id->match_chip != mt9m001->client->addr)
|
||||
if (id->match.addr != mt9m001->client->addr)
|
||||
return -ENODEV;
|
||||
|
||||
id->ident = mt9m001->model;
|
||||
|
@ -361,16 +361,17 @@ static int mt9m001_get_chip_id(struct soc_camera_device *icd,
|
|||
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
static int mt9m001_get_register(struct soc_camera_device *icd,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
|
||||
|
||||
if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
|
||||
if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
|
||||
return -EINVAL;
|
||||
|
||||
if (reg->match_chip != mt9m001->client->addr)
|
||||
if (reg->match.addr != mt9m001->client->addr)
|
||||
return -ENODEV;
|
||||
|
||||
reg->size = 2;
|
||||
reg->val = reg_read(icd, reg->reg);
|
||||
|
||||
if (reg->val > 0xffff)
|
||||
|
@ -380,14 +381,14 @@ static int mt9m001_get_register(struct soc_camera_device *icd,
|
|||
}
|
||||
|
||||
static int mt9m001_set_register(struct soc_camera_device *icd,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd);
|
||||
|
||||
if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
|
||||
if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
|
||||
return -EINVAL;
|
||||
|
||||
if (reg->match_chip != mt9m001->client->addr)
|
||||
if (reg->match.addr != mt9m001->client->addr)
|
||||
return -ENODEV;
|
||||
|
||||
if (reg_write(icd, reg->reg, reg->val) < 0)
|
||||
|
|
|
@ -514,14 +514,14 @@ static int mt9m111_try_fmt(struct soc_camera_device *icd,
|
|||
}
|
||||
|
||||
static int mt9m111_get_chip_id(struct soc_camera_device *icd,
|
||||
struct v4l2_chip_ident *id)
|
||||
struct v4l2_dbg_chip_ident *id)
|
||||
{
|
||||
struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
|
||||
|
||||
if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR)
|
||||
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
|
||||
return -EINVAL;
|
||||
|
||||
if (id->match_chip != mt9m111->client->addr)
|
||||
if (id->match.addr != mt9m111->client->addr)
|
||||
return -ENODEV;
|
||||
|
||||
id->ident = mt9m111->model;
|
||||
|
@ -532,18 +532,19 @@ static int mt9m111_get_chip_id(struct soc_camera_device *icd,
|
|||
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
static int mt9m111_get_register(struct soc_camera_device *icd,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
int val;
|
||||
|
||||
struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
|
||||
|
||||
if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff)
|
||||
if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff)
|
||||
return -EINVAL;
|
||||
if (reg->match_chip != mt9m111->client->addr)
|
||||
if (reg->match.addr != mt9m111->client->addr)
|
||||
return -ENODEV;
|
||||
|
||||
val = mt9m111_reg_read(icd, reg->reg);
|
||||
reg->size = 2;
|
||||
reg->val = (u64)val;
|
||||
|
||||
if (reg->val > 0xffff)
|
||||
|
@ -553,14 +554,14 @@ static int mt9m111_get_register(struct soc_camera_device *icd,
|
|||
}
|
||||
|
||||
static int mt9m111_set_register(struct soc_camera_device *icd,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
|
||||
|
||||
if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff)
|
||||
if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff)
|
||||
return -EINVAL;
|
||||
|
||||
if (reg->match_chip != mt9m111->client->addr)
|
||||
if (reg->match.addr != mt9m111->client->addr)
|
||||
return -ENODEV;
|
||||
|
||||
if (mt9m111_reg_write(icd, reg->reg, reg->val) < 0)
|
||||
|
|
|
@ -326,14 +326,14 @@ static int mt9t031_try_fmt(struct soc_camera_device *icd,
|
|||
}
|
||||
|
||||
static int mt9t031_get_chip_id(struct soc_camera_device *icd,
|
||||
struct v4l2_chip_ident *id)
|
||||
struct v4l2_dbg_chip_ident *id)
|
||||
{
|
||||
struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd);
|
||||
|
||||
if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR)
|
||||
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
|
||||
return -EINVAL;
|
||||
|
||||
if (id->match_chip != mt9t031->client->addr)
|
||||
if (id->match.addr != mt9t031->client->addr)
|
||||
return -ENODEV;
|
||||
|
||||
id->ident = mt9t031->model;
|
||||
|
@ -344,14 +344,14 @@ static int mt9t031_get_chip_id(struct soc_camera_device *icd,
|
|||
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
static int mt9t031_get_register(struct soc_camera_device *icd,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd);
|
||||
|
||||
if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
|
||||
if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
|
||||
return -EINVAL;
|
||||
|
||||
if (reg->match_chip != mt9t031->client->addr)
|
||||
if (reg->match.addr != mt9t031->client->addr)
|
||||
return -ENODEV;
|
||||
|
||||
reg->val = reg_read(icd, reg->reg);
|
||||
|
@ -363,14 +363,14 @@ static int mt9t031_get_register(struct soc_camera_device *icd,
|
|||
}
|
||||
|
||||
static int mt9t031_set_register(struct soc_camera_device *icd,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd);
|
||||
|
||||
if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
|
||||
if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
|
||||
return -EINVAL;
|
||||
|
||||
if (reg->match_chip != mt9t031->client->addr)
|
||||
if (reg->match.addr != mt9t031->client->addr)
|
||||
return -ENODEV;
|
||||
|
||||
if (reg_write(icd, reg->reg, reg->val) < 0)
|
||||
|
|
|
@ -422,14 +422,14 @@ static int mt9v022_try_fmt(struct soc_camera_device *icd,
|
|||
}
|
||||
|
||||
static int mt9v022_get_chip_id(struct soc_camera_device *icd,
|
||||
struct v4l2_chip_ident *id)
|
||||
struct v4l2_dbg_chip_ident *id)
|
||||
{
|
||||
struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd);
|
||||
|
||||
if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR)
|
||||
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
|
||||
return -EINVAL;
|
||||
|
||||
if (id->match_chip != mt9v022->client->addr)
|
||||
if (id->match.addr != mt9v022->client->addr)
|
||||
return -ENODEV;
|
||||
|
||||
id->ident = mt9v022->model;
|
||||
|
@ -440,16 +440,17 @@ static int mt9v022_get_chip_id(struct soc_camera_device *icd,
|
|||
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
static int mt9v022_get_register(struct soc_camera_device *icd,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd);
|
||||
|
||||
if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
|
||||
if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
|
||||
return -EINVAL;
|
||||
|
||||
if (reg->match_chip != mt9v022->client->addr)
|
||||
if (reg->match.addr != mt9v022->client->addr)
|
||||
return -ENODEV;
|
||||
|
||||
reg->size = 2;
|
||||
reg->val = reg_read(icd, reg->reg);
|
||||
|
||||
if (reg->val > 0xffff)
|
||||
|
@ -459,14 +460,14 @@ static int mt9v022_get_register(struct soc_camera_device *icd,
|
|||
}
|
||||
|
||||
static int mt9v022_set_register(struct soc_camera_device *icd,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd);
|
||||
|
||||
if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
|
||||
if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
|
||||
return -EINVAL;
|
||||
|
||||
if (reg->match_chip != mt9v022->client->addr)
|
||||
if (reg->match.addr != mt9v022->client->addr)
|
||||
return -ENODEV;
|
||||
|
||||
if (reg_write(icd, reg->reg, reg->val) < 0)
|
||||
|
|
|
@ -1310,7 +1310,7 @@ static int ov7670_command(struct i2c_client *client, unsigned int cmd,
|
|||
void *arg)
|
||||
{
|
||||
switch (cmd) {
|
||||
case VIDIOC_G_CHIP_IDENT:
|
||||
case VIDIOC_DBG_G_CHIP_IDENT:
|
||||
return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_OV7670, 0);
|
||||
|
||||
case VIDIOC_INT_RESET:
|
||||
|
|
|
@ -724,7 +724,7 @@ static unsigned long ov772x_query_bus_param(struct soc_camera_device *icd)
|
|||
}
|
||||
|
||||
static int ov772x_get_chip_id(struct soc_camera_device *icd,
|
||||
struct v4l2_chip_ident *id)
|
||||
struct v4l2_dbg_chip_ident *id)
|
||||
{
|
||||
struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
|
||||
|
||||
|
@ -736,11 +736,12 @@ static int ov772x_get_chip_id(struct soc_camera_device *icd,
|
|||
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
static int ov772x_get_register(struct soc_camera_device *icd,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
|
||||
int ret;
|
||||
|
||||
reg->size = 1;
|
||||
if (reg->reg > 0xff)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -754,7 +755,7 @@ static int ov772x_get_register(struct soc_camera_device *icd,
|
|||
}
|
||||
|
||||
static int ov772x_set_register(struct soc_camera_device *icd,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd);
|
||||
|
||||
|
|
|
@ -4732,26 +4732,25 @@ static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw)
|
|||
|
||||
|
||||
int pvr2_hdw_register_access(struct pvr2_hdw *hdw,
|
||||
u32 match_type, u32 match_chip, u64 reg_id,
|
||||
int setFl,u64 *val_ptr)
|
||||
struct v4l2_dbg_match *match, u64 reg_id,
|
||||
int setFl, u64 *val_ptr)
|
||||
{
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
struct pvr2_i2c_client *cp;
|
||||
struct v4l2_register req;
|
||||
struct v4l2_dbg_register req;
|
||||
int stat = 0;
|
||||
int okFl = 0;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN)) return -EPERM;
|
||||
|
||||
req.match_type = match_type;
|
||||
req.match_chip = match_chip;
|
||||
req.match = *match;
|
||||
req.reg = reg_id;
|
||||
if (setFl) req.val = *val_ptr;
|
||||
mutex_lock(&hdw->i2c_list_lock); do {
|
||||
list_for_each_entry(cp, &hdw->i2c_clients, list) {
|
||||
if (!v4l2_chip_match_i2c_client(
|
||||
cp->client,
|
||||
req.match_type, req.match_chip)) {
|
||||
&req.match)) {
|
||||
continue;
|
||||
}
|
||||
stat = pvr2_i2c_client_cmd(
|
||||
|
|
|
@ -242,8 +242,8 @@ void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,
|
|||
setFl - true to set the register, false to read it
|
||||
val_ptr - storage location for source / result. */
|
||||
int pvr2_hdw_register_access(struct pvr2_hdw *,
|
||||
u32 match_type, u32 match_chip,u64 reg_id,
|
||||
int setFl,u64 *val_ptr);
|
||||
struct v4l2_dbg_match *match, u64 reg_id,
|
||||
int setFl, u64 *val_ptr);
|
||||
|
||||
/* The following entry points are all lower level things you normally don't
|
||||
want to worry about. */
|
||||
|
|
|
@ -851,11 +851,11 @@ static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
|
|||
case VIDIOC_DBG_G_REGISTER:
|
||||
{
|
||||
u64 val;
|
||||
struct v4l2_register *req = (struct v4l2_register *)arg;
|
||||
struct v4l2_dbg_register *req = (struct v4l2_dbg_register *)arg;
|
||||
if (cmd == VIDIOC_DBG_S_REGISTER) val = req->val;
|
||||
ret = pvr2_hdw_register_access(
|
||||
hdw,req->match_type,req->match_chip,req->reg,
|
||||
cmd == VIDIOC_DBG_S_REGISTER,&val);
|
||||
hdw, &req->match, req->reg,
|
||||
cmd == VIDIOC_DBG_S_REGISTER, &val);
|
||||
if (cmd == VIDIOC_DBG_G_REGISTER) req->val = val;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1371,25 +1371,24 @@ static int saa711x_g_vbi_data(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_dat
|
|||
}
|
||||
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
static int saa711x_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
|
||||
static int saa711x_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
||||
if (!v4l2_chip_match_i2c_client(client,
|
||||
reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_i2c_client(client, ®->match))
|
||||
return -EINVAL;
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
reg->val = saa711x_read(sd, reg->reg & 0xff);
|
||||
reg->size = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int saa711x_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
|
||||
static int saa711x_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
||||
if (!v4l2_chip_match_i2c_client(client,
|
||||
reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_i2c_client(client, ®->match))
|
||||
return -EINVAL;
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
@ -1398,7 +1397,7 @@ static int saa711x_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int saa711x_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip)
|
||||
static int saa711x_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
|
||||
{
|
||||
struct saa711x_state *state = to_state(sd);
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
|
|
@ -623,25 +623,24 @@ static int saa7127_s_vbi_data(struct v4l2_subdev *sd, const struct v4l2_sliced_v
|
|||
}
|
||||
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
static int saa7127_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
|
||||
static int saa7127_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
||||
if (!v4l2_chip_match_i2c_client(client,
|
||||
reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_i2c_client(client, ®->match))
|
||||
return -EINVAL;
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
reg->val = saa7127_read(sd, reg->reg & 0xff);
|
||||
reg->size = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int saa7127_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
|
||||
static int saa7127_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
||||
if (!v4l2_chip_match_i2c_client(client,
|
||||
reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_i2c_client(client, ®->match))
|
||||
return -EINVAL;
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
@ -650,7 +649,7 @@ static int saa7127_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
|
|||
}
|
||||
#endif
|
||||
|
||||
static int saa7127_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip)
|
||||
static int saa7127_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
|
||||
{
|
||||
struct saa7127_state *state = to_state(sd);
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
|
|
@ -838,7 +838,7 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg)
|
|||
h->standard = *((v4l2_std_id *) arg);
|
||||
break;
|
||||
|
||||
case VIDIOC_G_CHIP_IDENT:
|
||||
case VIDIOC_DBG_G_CHIP_IDENT:
|
||||
return v4l2_chip_ident_i2c_client(client,
|
||||
arg, h->chip, h->revision);
|
||||
|
||||
|
|
|
@ -405,7 +405,7 @@ static int empress_querymenu(struct file *file, void *priv,
|
|||
}
|
||||
|
||||
static int empress_g_chip_ident(struct file *file, void *fh,
|
||||
struct v4l2_chip_ident *chip)
|
||||
struct v4l2_dbg_chip_ident *chip)
|
||||
{
|
||||
struct saa7134_dev *dev = file->private_data;
|
||||
|
||||
|
@ -413,12 +413,12 @@ static int empress_g_chip_ident(struct file *file, void *fh,
|
|||
chip->revision = 0;
|
||||
if (dev->mpeg_i2c_client == NULL)
|
||||
return -EINVAL;
|
||||
if (chip->match_type == V4L2_CHIP_MATCH_I2C_DRIVER &&
|
||||
chip->match_chip == I2C_DRIVERID_SAA6752HS)
|
||||
return saa7134_i2c_call_saa6752(dev, VIDIOC_G_CHIP_IDENT, chip);
|
||||
if (chip->match_type == V4L2_CHIP_MATCH_I2C_ADDR &&
|
||||
chip->match_chip == dev->mpeg_i2c_client->addr)
|
||||
return saa7134_i2c_call_saa6752(dev, VIDIOC_G_CHIP_IDENT, chip);
|
||||
if (chip->match.type == V4L2_CHIP_MATCH_I2C_DRIVER &&
|
||||
!strcmp(chip->match.name, "saa6752hs"))
|
||||
return saa7134_i2c_call_saa6752(dev, VIDIOC_DBG_G_CHIP_IDENT, chip);
|
||||
if (chip->match.type == V4L2_CHIP_MATCH_I2C_ADDR &&
|
||||
chip->match.addr == dev->mpeg_i2c_client->addr)
|
||||
return saa7134_i2c_call_saa6752(dev, VIDIOC_DBG_G_CHIP_IDENT, chip);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -2247,24 +2247,25 @@ static int saa7134_g_parm(struct file *file, void *fh,
|
|||
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
static int vidioc_g_register (struct file *file, void *priv,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct saa7134_fh *fh = priv;
|
||||
struct saa7134_dev *dev = fh->dev;
|
||||
|
||||
if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_host(®->match))
|
||||
return -EINVAL;
|
||||
reg->val = saa_readb(reg->reg);
|
||||
reg->size = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vidioc_s_register (struct file *file, void *priv,
|
||||
struct v4l2_register *reg)
|
||||
struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct saa7134_fh *fh = priv;
|
||||
struct saa7134_dev *dev = fh->dev;
|
||||
|
||||
if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_host(®->match))
|
||||
return -EINVAL;
|
||||
saa_writeb(reg->reg&0xffffff, reg->val);
|
||||
return 0;
|
||||
|
|
|
@ -1171,25 +1171,26 @@ static int saa717x_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||
static int saa717x_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
|
||||
static int saa717x_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
||||
if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip))
|
||||
if (!v4l2_chip_match_i2c_client(client, ®->match))
|
||||
return -EINVAL;
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
reg->val = saa717x_read(sd, reg->reg);
|
||||
reg->size = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int saa717x_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
|
||||
static int saa717x_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
|
||||
{
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||