summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-12-30 11:14:19 +0100
committerHans Verkuil <hverkuil@xs4all.nl>2008-12-30 11:14:19 +0100
commit1b466c7ec5d6b66905c47c49fd3cbc59569e7b4e (patch)
tree38f6fbe937eb1d5c22f018e7730f1b1a3cbb9a78
parent033f7befdeeb65b662a90b0685f24ea62dfcbbd5 (diff)
downloadmediapointer-dvb-s2-1b466c7ec5d6b66905c47c49fd3cbc59569e7b4e.tar.gz
mediapointer-dvb-s2-1b466c7ec5d6b66905c47c49fd3cbc59569e7b4e.tar.bz2
v4l2: debugging API changed to match against driver name instead of ID.
From: Hans Verkuil <hverkuil@xs4all.nl> 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. Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
-rw-r--r--linux/Documentation/video4linux/v4l2-framework.txt2
-rw-r--r--linux/drivers/media/video/bt8xx/bttv-driver.c9
-rw-r--r--linux/drivers/media/video/cafe_ccic.c7
-rw-r--r--linux/drivers/media/video/cs5345.c13
-rw-r--r--linux/drivers/media/video/cs53l32a.c2
-rw-r--r--linux/drivers/media/video/cx18/cx18-i2c.c28
-rw-r--r--linux/drivers/media/video/cx18/cx18-i2c.h1
-rw-r--r--linux/drivers/media/video/cx18/cx18-ioctl.c41
-rw-r--r--linux/drivers/media/video/cx23885/cx23885-video.c8
-rw-r--r--linux/drivers/media/video/cx25840/cx25840-core.c13
-rw-r--r--linux/drivers/media/video/cx88/cx88-video.c13
-rw-r--r--linux/drivers/media/video/em28xx/em28xx-video.c28
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-driver.c7
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-ioctl.c21
-rw-r--r--linux/drivers/media/video/m52790.c13
-rw-r--r--linux/drivers/media/video/msp3400-driver.c2
-rw-r--r--linux/drivers/media/video/mt9m001.c19
-rw-r--r--linux/drivers/media/video/mt9m111.c19
-rw-r--r--linux/drivers/media/video/mt9t031.c18
-rw-r--r--linux/drivers/media/video/mt9v022.c19
-rw-r--r--linux/drivers/media/video/ov7670.c2
-rw-r--r--linux/drivers/media/video/ov772x.c7
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c11
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h4
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c6
-rw-r--r--linux/drivers/media/video/saa7115.c13
-rw-r--r--linux/drivers/media/video/saa7127.c13
-rw-r--r--linux/drivers/media/video/saa7134/saa6752hs.c2
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-empress.c14
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-video.c9
-rw-r--r--linux/drivers/media/video/saa717x.c9
-rw-r--r--linux/drivers/media/video/soc_camera.c6
-rw-r--r--linux/drivers/media/video/tvaudio.c2
-rw-r--r--linux/drivers/media/video/tvp5150.c13
-rw-r--r--linux/drivers/media/video/tw9910.c6
-rw-r--r--linux/drivers/media/video/upd64031a.c13
-rw-r--r--linux/drivers/media/video/upd64083.c13
-rw-r--r--linux/drivers/media/video/usbvision/usbvision-video.c9
-rw-r--r--linux/drivers/media/video/v4l2-common.c29
-rw-r--r--linux/drivers/media/video/v4l2-compat-ioctl32.c3
-rw-r--r--linux/drivers/media/video/v4l2-ioctl.c15
-rw-r--r--linux/drivers/media/video/v4l2-subdev.c2
-rw-r--r--linux/drivers/media/video/vp27smpx.c2
-rw-r--r--linux/drivers/media/video/wm8739.c2
-rw-r--r--linux/drivers/media/video/wm8775.c2
-rw-r--r--linux/include/linux/videodev2.h51
-rw-r--r--linux/include/media/soc_camera.h6
-rw-r--r--linux/include/media/v4l2-chip-ident.h4
-rw-r--r--linux/include/media/v4l2-common.h6
-rw-r--r--linux/include/media/v4l2-int-device.h2
-rw-r--r--linux/include/media/v4l2-ioctl.h6
-rw-r--r--linux/include/media/v4l2-subdev.h6
-rw-r--r--v4l2-apps/test/ioctl-test.c8
-rw-r--r--v4l2-apps/util/Makefile11
-rw-r--r--v4l2-apps/util/cx18-ctl.c12
-rw-r--r--v4l2-apps/util/ivtv-ctl.c12
-rw-r--r--v4l2-apps/util/v4l2-compliance.cpp36
-rw-r--r--v4l2-apps/util/v4l2-dbg.cpp177
58 files changed, 397 insertions, 430 deletions
diff --git a/linux/Documentation/video4linux/v4l2-framework.txt b/linux/Documentation/video4linux/v4l2-framework.txt
index 3b483c1e0..ff124374e 100644
--- a/linux/Documentation/video4linux/v4l2-framework.txt
+++ b/linux/Documentation/video4linux/v4l2-framework.txt
@@ -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);
...
diff --git a/linux/drivers/media/video/bt8xx/bttv-driver.c b/linux/drivers/media/video/bt8xx/bttv-driver.c
index 4994afb1e..690e09b91 100644
--- a/linux/drivers/media/video/bt8xx/bttv-driver.c
+++ b/linux/drivers/media/video/bt8xx/bttv-driver.c
@@ -2067,7 +2067,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;
@@ -2075,18 +2075,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(&reg->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;
@@ -2094,7 +2095,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(&reg->match))
return -EINVAL;
/* bt848 has a 12-bit register space */
diff --git a/linux/drivers/media/video/cafe_ccic.c b/linux/drivers/media/video/cafe_ccic.c
index 48ecd5d35..bb8959386 100644
--- a/linux/drivers/media/video/cafe_ccic.c
+++ b/linux/drivers/media/video/cafe_ccic.c
@@ -866,7 +866,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);
@@ -876,8 +876,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;
diff --git a/linux/drivers/media/video/cs5345.c b/linux/drivers/media/video/cs5345.c
index 1af0f53dd..9d19970ce 100644
--- a/linux/drivers/media/video/cs5345.c
+++ b/linux/drivers/media/video/cs5345.c
@@ -101,25 +101,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, &reg->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, &reg->match))
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
@@ -128,7 +127,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);
diff --git a/linux/drivers/media/video/cs53l32a.c b/linux/drivers/media/video/cs53l32a.c
index 0620c4af4..842a8e4ed 100644
--- a/linux/drivers/media/video/cs53l32a.c
+++ b/linux/drivers/media/video/cs53l32a.c
@@ -103,7 +103,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);
diff --git a/linux/drivers/media/video/cx18/cx18-i2c.c b/linux/drivers/media/video/cx18/cx18-i2c.c
index c0a79ecd4..efae2301a 100644
--- a/linux/drivers/media/video/cx18/cx18-i2c.c
+++ b/linux/drivers/media/video/cx18/cx18-i2c.c
@@ -268,7 +268,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;
@@ -294,17 +294,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)
{
@@ -352,21 +341,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)
{
diff --git a/linux/drivers/media/video/cx18/cx18-i2c.h b/linux/drivers/media/video/cx18/cx18-i2c.h
index 113c3f9a2..486973901 100644
--- a/linux/drivers/media/video/cx18/cx18-i2c.h
+++ b/linux/drivers/media/video/cx18/cx18-i2c.h
@@ -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);
diff --git a/linux/drivers/media/video/cx18/cx18-ioctl.c b/linux/drivers/media/video/cx18/cx18-ioctl.c
index 4529f26b0..84d6381aa 100644
--- a/linux/drivers/media/video/cx18/cx18-ioctl.c
+++ b/linux/drivers/media/video/cx18/cx18-ioctl.c
@@ -326,30 +326,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))
@@ -358,6 +352,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
@@ -367,31 +362,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(&reg->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(&reg->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
diff --git a/linux/drivers/media/video/cx23885/cx23885-video.c b/linux/drivers/media/video/cx23885/cx23885-video.c
index 26f8b8efa..838b3ac5a 100644
--- a/linux/drivers/media/video/cx23885/cx23885-video.c
+++ b/linux/drivers/media/video/cx23885/cx23885-video.c
@@ -1415,11 +1415,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(&reg->match))
return -EINVAL;
cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_G_REGISTER, reg);
@@ -1428,11 +1428,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(&reg->match))
return -EINVAL;
cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_S_REGISTER, reg);
diff --git a/linux/drivers/media/video/cx25840/cx25840-core.c b/linux/drivers/media/video/cx25840/cx25840-core.c
index 52a2a5799..9bac0e67a 100644
--- a/linux/drivers/media/video/cx25840/cx25840-core.c
+++ b/linux/drivers/media/video/cx25840/cx25840-core.c
@@ -1139,25 +1139,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, &reg->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, &reg->match))
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
@@ -1381,7 +1380,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);
diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c
index 0f551f845..a95bcb0ea 100644
--- a/linux/drivers/media/video/cx88/cx88-video.c
+++ b/linux/drivers/media/video/cx88/cx88-video.c
@@ -1713,25 +1713,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(&reg->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(&reg->match))
return -EINVAL;
- cx_write(reg->reg&0xffffff, reg->val);
+ cx_write(reg->reg & 0xffffff, reg->val);
return 0;
}
#endif
diff --git a/linux/drivers/media/video/em28xx/em28xx-video.c b/linux/drivers/media/video/em28xx/em28xx-video.c
index dd3f49140..eb3a87e0a 100644
--- a/linux/drivers/media/video/em28xx/em28xx-video.c
+++ b/linux/drivers/media/video/em28xx/em28xx-video.c
@@ -1164,7 +1164,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;
@@ -1172,20 +1172,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);
@@ -1194,6 +1194,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);
@@ -1202,12 +1203,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(&reg->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);
@@ -1217,7 +1219,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);
@@ -1225,21 +1227,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);
@@ -1253,12 +1255,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(&reg->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,
diff --git a/linux/drivers/media/video/ivtv/ivtv-driver.c b/linux/drivers/media/video/ivtv/ivtv-driver.c
index b29625ca2..b712c29e7 100644
--- a/linux/drivers/media/video/ivtv/ivtv-driver.c
+++ b/linux/drivers/media/video/ivtv/ivtv-driver.c
@@ -906,18 +906,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;
diff --git a/linux/drivers/media/video/ivtv/ivtv-ioctl.c b/linux/drivers/media/video/ivtv/ivtv-ioctl.c
index 1f6ca93b9..f6b3ef6e6 100644
--- a/linux/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/linux/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -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(&reg->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(&reg->match))
return ivtv_itvc(itv, VIDIOC_DBG_S_REGISTER, reg);
/* TODO: subdev errors should not be ignored, this should become a
subdev helper function. */
diff --git a/linux/drivers/media/video/m52790.c b/linux/drivers/media/video/m52790.c
index 1976451e0..af179cf4b 100644
--- a/linux/drivers/media/video/m52790.c
+++ b/linux/drivers/media/video/m52790.c
@@ -86,29 +86,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, &reg->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, &reg->match))
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
@@ -121,7 +120,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);
diff --git a/linux/drivers/media/video/msp3400-driver.c b/linux/drivers/media/video/msp3400-driver.c
index d59f7a537..053f168bf 100644
--- a/linux/drivers/media/video/msp3400-driver.c
+++ b/linux/drivers/media/video/msp3400-driver.c
@@ -738,7 +738,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);
diff --git a/linux/drivers/media/video/mt9m001.c b/linux/drivers/media/video/mt9m001.c
index dd1435d41..3d8e6ed8d 100644
--- a/linux/drivers/media/video/mt9m001.c
+++ b/linux/drivers/media/video/mt9m001.c
@@ -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)
diff --git a/linux/drivers/media/video/mt9m111.c b/linux/drivers/media/video/mt9m111.c
index 39f2e83cf..cdf3f38e2 100644
--- a/linux/drivers/media/video/mt9m111.c
+++ b/linux/drivers/media/video/mt9m111.c
@@ -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)
diff --git a/linux/drivers/media/video/mt9t031.c b/linux/drivers/media/video/mt9t031.c
index 1a9d53966..349d8e365 100644
--- a/linux/drivers/media/video/mt9t031.c
+++ b/linux/drivers/media/video/mt9t031.c
@@ -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)
diff --git a/linux/drivers/media/video/mt9v022.c b/linux/drivers/media/video/mt9v022.c
index e2579559d..9601884ca 100644
--- a/linux/drivers/media/video/mt9v022.c
+++ b/linux/drivers/media/video/mt9v022.c
@@ -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)
diff --git a/linux/drivers/media/video/ov7670.c b/linux/drivers/media/video/ov7670.c
index 9cf1aa2bc..ef9d7c022 100644
--- a/linux/drivers/media/video/ov7670.c
+++ b/linux/drivers/media/video/ov7670.c
@@ -1354,7 +1354,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:
diff --git a/linux/drivers/media/video/ov772x.c b/linux/drivers/media/video/ov772x.c
index 932444623..ce389cacf 100644
--- a/linux/drivers/media/video/ov772x.c
+++ b/linux/drivers/media/video/ov772x.c
@@ -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);
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 447fcede8..21fdc66b4 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -4867,26 +4867,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(
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h
index 29fb0729d..732546fa3 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h
@@ -248,8 +248,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. */
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index 36ce7ebf9..7340f4815 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -852,11 +852,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;
}
diff --git a/linux/drivers/media/video/saa7115.c b/linux/drivers/media/video/saa7115.c
index e9edd4d37..40b0196e6 100644
--- a/linux/drivers/media/video/saa7115.c
+++ b/linux/drivers/media/video/saa7115.c
@@ -1372,25 +1372,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, &reg->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, &reg->match))
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
@@ -1399,7 +1398,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);
diff --git a/linux/drivers/media/video/saa7127.c b/linux/drivers/media/video/saa7127.c
index 5414b027f..79c947ca0 100644
--- a/linux/drivers/media/video/saa7127.c
+++ b/linux/drivers/media/video/saa7127.c
@@ -629,25 +629,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, &reg->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, &reg->match))
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
@@ -656,7 +655,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);
diff --git a/linux/drivers/media/video/saa7134/saa6752hs.c b/linux/drivers/media/video/saa7134/saa6752hs.c
index 8ccca4d56..f2d4aea16 100644
--- a/linux/drivers/media/video/saa7134/saa6752hs.c
+++ b/linux/drivers/media/video/saa7134/saa6752hs.c
@@ -839,7 +839,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);
diff --git a/linux/drivers/media/video/saa7134/saa7134-empress.c b/linux/drivers/media/video/saa7134/saa7134-empress.c
index 37235c4d0..6955db2fe 100644
--- a/linux/drivers/media/video/saa7134/saa7134-empress.c
+++ b/linux/drivers/media/video/saa7134/saa7134-empress.c
@@ -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;
}
diff --git a/linux/drivers/media/video/saa7134/saa7134-video.c b/linux/drivers/media/video/saa7134/saa7134-video.c
index 1fcf2693d..37dec30a4 100644
--- a/linux/drivers/media/video/saa7134/saa7134-video.c
+++ b/linux/drivers/media/video/saa7134/saa7134-video.c
@@ -2254,24 +2254,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(&reg->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(&reg->match))
return -EINVAL;
saa_writeb(reg->reg&0xffffff, reg->val);
return 0;
diff --git a/linux/drivers/media/video/saa717x.c b/linux/drivers/media/video/saa717x.c
index 2d667e66a..65bcf6dad 100644
--- a/linux/drivers/media/video/saa717x.c
+++ b/linux/drivers/media/video/saa717x.c
@@ -1177,25 +1177,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, &reg->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);
u16 addr = reg->reg & 0xffff;
u8 val = reg->val & 0xff;
- if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip))
+ if (!v4l2_chip_match_i2c_client(client, &reg->match))
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
diff --git a/linux/drivers/media/video/soc_camera.c b/linux/drivers/media/video/soc_camera.c
index 4909b74db..356b77e10 100644
--- a/linux/drivers/media/video/soc_camera.c
+++ b/linux/drivers/media/video/soc_camera.c
@@ -700,7 +700,7 @@ static int soc_camera_s_crop(struct file *file, void *fh,
}
static int soc_camera_g_chip_ident(struct file *file, void *fh,
- struct v4l2_chip_ident *id)
+ struct v4l2_dbg_chip_ident *id)
{
struct soc_camera_file *icf = file->private_data;
struct soc_camera_device *icd = icf->icd;
@@ -713,7 +713,7 @@ static int soc_camera_g_chip_ident(struct file *file, void *fh,
#ifdef CONFIG_VIDEO_ADV_DEBUG
static int soc_camera_g_register(struct file *file, void *fh,
- struct v4l2_register *reg)
+ struct v4l2_dbg_register *reg)
{
struct soc_camera_file *icf = file->private_data;
struct soc_camera_device *icd = icf->icd;
@@ -725,7 +725,7 @@ static int soc_camera_g_register(struct file *file, void *fh,
}
static int soc_camera_s_register(struct file *file, void *fh,
- struct v4l2_register *reg)
+ struct v4l2_dbg_register *reg)
{
struct soc_camera_file *icf = file->private_data;
struct soc_camera_device *icd = icf->icd;
diff --git a/linux/drivers/media/video/tvaudio.c b/linux/drivers/media/video/tvaudio.c
index 492da4d8e..3ca242af5 100644
--- a/linux/drivers/media/video/tvaudio.c
+++ b/linux/drivers/media/video/tvaudio.c
@@ -1770,7 +1770,7 @@ static int tvaudio_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *fr
return 0;
}
-static int tvaudio_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip)
+static int tvaudio_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
diff --git a/linux/drivers/media/video/tvp5150.c b/linux/drivers/media/video/tvp5150.c
index 404df4aa2..f968e8941 100644
--- a/linux/drivers/media/video/tvp5150.c
+++ b/linux/drivers/media/video/tvp5150.c
@@ -1030,7 +1030,7 @@ static int tvp5150_decode_vbi_line(struct v4l2_subdev *sd,
#endif
static int tvp5150_g_chip_ident(struct v4l2_subdev *sd,
- struct v4l2_chip_ident *chip)
+ struct v4l2_dbg_chip_ident *chip)
{
int rev;
struct i2c_client *client = v4l2_get_subdevdata(sd);
@@ -1044,25 +1044,24 @@ static int tvp5150_g_chip_ident(struct v4l2_subdev *sd,
#ifdef CONFIG_VIDEO_ADV_DEBUG
-static int tvp5150_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
+static int tvp5150_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, &reg->match))
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
reg->val = tvp5150_read(sd, reg->reg & 0xff);
+ reg->size = 1;
return 0;
}
-static int tvp5150_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
+static int tvp5150_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, &reg->match))
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
diff --git a/linux/drivers/media/video/tw9910.c b/linux/drivers/media/video/tw9910.c
index d5cdc4be1..52c0357fa 100644
--- a/linux/drivers/media/video/tw9910.c
+++ b/linux/drivers/media/video/tw9910.c
@@ -575,7 +575,7 @@ static unsigned long tw9910_query_bus_param(struct soc_camera_device *icd)
}
static int tw9910_get_chip_id(struct soc_camera_device *icd,
- struct v4l2_chip_ident *id)
+ struct v4l2_dbg_chip_ident *id)
{
id->ident = V4L2_IDENT_TW9910;
id->revision = 0;
@@ -606,7 +606,7 @@ static int tw9910_enum_input(struct soc_camera_device *icd,
#ifdef CONFIG_VIDEO_ADV_DEBUG
static int tw9910_get_register(struct soc_camera_device *icd,
- struct v4l2_register *reg)
+ struct v4l2_dbg_register *reg)
{
struct tw9910_priv *priv = container_of(icd, struct tw9910_priv, icd);
int ret;
@@ -627,7 +627,7 @@ static int tw9910_get_register(struct soc_camera_device *icd,
}
static int tw9910_set_register(struct soc_camera_device *icd,
- struct v4l2_register *reg)
+ struct v4l2_dbg_register *reg)
{
struct tw9910_priv *priv = container_of(icd, struct tw9910_priv, icd);
diff --git a/linux/drivers/media/video/upd64031a.c b/linux/drivers/media/video/upd64031a.c
index df5f4b0c8..eb1dfe312 100644
--- a/linux/drivers/media/video/upd64031a.c
+++ b/linux/drivers/media/video/upd64031a.c
@@ -153,7 +153,7 @@ static int upd64031a_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing
return upd64031a_s_frequency(sd, NULL);
}
-static int upd64031a_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip)
+static int upd64031a_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
@@ -168,25 +168,24 @@ static int upd64031a_log_status(struct v4l2_subdev *sd)
}
#ifdef CONFIG_VIDEO_ADV_DEBUG
-static int upd64031a_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
+static int upd64031a_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, &reg->match))
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
reg->val = upd64031a_read(sd, reg->reg & 0xff);
+ reg->size = 1;
return 0;
}
-static int upd64031a_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
+static int upd64031a_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, &reg->match))
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
diff --git a/linux/drivers/media/video/upd64083.c b/linux/drivers/media/video/upd64083.c
index fe71b038b..7bc2f2fa6 100644
--- a/linux/drivers/media/video/upd64083.c
+++ b/linux/drivers/media/video/upd64083.c
@@ -126,25 +126,24 @@ static int upd64083_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing
}
#ifdef CONFIG_VIDEO_ADV_DEBUG
-static int upd64083_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
+static int upd64083_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, &reg->match))
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
reg->val = upd64083_read(sd, reg->reg & 0xff);
+ reg->size = 1;
return 0;
}
-static int upd64083_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg)
+static int upd64083_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, &reg->match))
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
@@ -153,7 +152,7 @@ static int upd64083_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg
}
#endif
-static int upd64083_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip)
+static int upd64083_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
diff --git a/linux/drivers/media/video/usbvision/usbvision-video.c b/linux/drivers/media/video/usbvision/usbvision-video.c
index 1c9c2188a..71be57774 100644
--- a/linux/drivers/media/video/usbvision/usbvision-video.c
+++ b/linux/drivers/media/video/usbvision/usbvision-video.c
@@ -477,12 +477,12 @@ static int usbvision_v4l2_close(struct file *file)
*/
#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 usb_usbvision *usbvision = video_drvdata(file);
int errCode;
- if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
+ if (!v4l2_chip_match_host(&reg->match))
return -EINVAL;
/* NT100x has a 8-bit register space */
errCode = usbvision_read_reg(usbvision, reg->reg&0xff);
@@ -492,16 +492,17 @@ static int vidioc_g_register (struct file *file, void *priv,
return errCode;
}
reg->val = errCode;
+ 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 usb_usbvision *usbvision = video_drvdata(file);
int errCode;
- if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
+ if (!v4l2_chip_match_host(&reg->match))
return -EINVAL;
/* NT100x has a 8-bit register space */
errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val);
diff --git a/linux/drivers/media/video/v4l2-common.c b/linux/drivers/media/video/v4l2-common.c
index 02eb97fa4..27af4d97a 100644
--- a/linux/drivers/media/video/v4l2-common.c
+++ b/linux/drivers/media/video/v4l2-common.c
@@ -798,11 +798,11 @@ u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id)
}
EXPORT_SYMBOL(v4l2_ctrl_next);
-int v4l2_chip_match_host(u32 match_type, u32 match_chip)
+int v4l2_chip_match_host(const struct v4l2_dbg_match *match)
{
- switch (match_type) {
+ switch (match->type) {
case V4L2_CHIP_MATCH_HOST:
- return match_chip == 0;
+ return match->addr == 0;
default:
return 0;
}
@@ -810,23 +810,34 @@ int v4l2_chip_match_host(u32 match_type, u32 match_chip)
EXPORT_SYMBOL(v4l2_chip_match_host);
#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
-int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_chip)
+int v4l2_chip_match_i2c_client(struct i2c_client *c, const struct v4l2_dbg_match *match)
{
- switch (match_type) {
+ int len;
+
+ if (c == NULL || match == NULL)
+ return 0;
+
+ switch (match->type) {
case V4L2_CHIP_MATCH_I2C_DRIVER:
- return (c != NULL && c->driver != NULL && c->driver->id == match_chip);
+ if (c->driver == NULL || c->driver->driver.name == NULL)
+ return 0;
+ len = strlen(c->driver->driver.name);
+ /* legacy drivers have a ' suffix, don't try to match that */
+ if (len && c->driver->driver.name[len - 1] == '\'')
+ len--;
+ return len && !strncmp(c->driver->driver.name, match->name, len);
case V4L2_CHIP_MATCH_I2C_ADDR:
- return (c != NULL && c->addr == match_chip);
+ return c->addr == match->addr;
default:
return 0;
}
}
EXPORT_SYMBOL(v4l2_chip_match_i2c_client);
-int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip,
+int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_dbg_chip_ident *chip,
u32 ident, u32 revision)
{
- if (!v4l2_chip_match_i2c_client(c, chip->match_type, chip->match_chip))
+ if (!v4l2_chip_match_i2c_client(c, &chip->match))
return 0;
if (chip->ident == V4L2_IDENT_NONE) {
chip->ident = ident;
diff --git a/linux/drivers/media/video/v4l2-compat-ioctl32.c b/linux/drivers/media/video/v4l2-compat-ioctl32.c
index dedd0dea3..05a356776 100644
--- a/linux/drivers/media/video/v4l2-compat-ioctl32.c
+++ b/linux/drivers/media/video/v4l2-compat-ioctl32.c
@@ -1051,7 +1051,8 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
case VIDIOC_TRY_ENCODER_CMD:
case VIDIOC_DBG_S_REGISTER:
case VIDIOC_DBG_G_REGISTER:
- case VIDIOC_G_CHIP_IDENT:
+ case VIDIOC_DBG_G_CHIP_IDENT:
+ case VIDIOC_G_CHIP_IDENT_OLD:
case VIDIOC_S_HW_FREQ_SEEK:
ret = do_video_ioctl(file, cmd, arg);
break;
diff --git a/linux/drivers/media/video/v4l2-ioctl.c b/linux/drivers/media/video/v4l2-ioctl.c
index c1d46bbd0..165bc9005 100644
--- a/linux/drivers/media/video/v4l2-ioctl.c
+++ b/linux/drivers/media/video/v4l2-ioctl.c
@@ -267,7 +267,7 @@ static const char *v4l2_ioctls[] = {
[_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER",
[_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER",
- [_IOC_NR(VIDIOC_G_CHIP_IDENT)] = "VIDIOC_G_CHIP_IDENT",
+ [_IOC_NR(VIDIOC_DBG_G_CHIP_IDENT)] = "VIDIOC_DBG_G_CHIP_IDENT",
[_IOC_NR(VIDIOC_S_HW_FREQ_SEEK)] = "VIDIOC_S_HW_FREQ_SEEK",
#endif
};
@@ -1721,7 +1721,7 @@ static long __video_do_ioctl(struct file *file,
#ifdef CONFIG_VIDEO_ADV_DEBUG
case VIDIOC_DBG_G_REGISTER:
{
- struct v4l2_register *p = arg;
+ struct v4l2_dbg_register *p = arg;
if (!capable(CAP_SYS_ADMIN))
ret = -EPERM;
@@ -1731,7 +1731,7 @@ static long __video_do_ioctl(struct file *file,
}
case VIDIOC_DBG_S_REGISTER:
{
- struct v4l2_register *p = arg;
+ struct v4l2_dbg_register *p = arg;
if (!capable(CAP_SYS_ADMIN))
ret = -EPERM;
@@ -1740,9 +1740,9 @@ static long __video_do_ioctl(struct file *file,
break;
}
#endif
- case VIDIOC_G_CHIP_IDENT:
+ case VIDIOC_DBG_G_CHIP_IDENT:
{
- struct v4l2_chip_ident *p = arg;
+ struct v4l2_dbg_chip_ident *p = arg;
if (!ops->vidioc_g_chip_ident)
break;
@@ -1751,6 +1751,11 @@ static long __video_do_ioctl(struct file *file,
dbgarg(cmd, "chip_ident=%u, revision=0x%x\n", p->ident, p->revision);
break;
}
+ case VIDIOC_G_CHIP_IDENT_OLD:
+ printk(KERN_ERR "VIDIOC_G_CHIP_IDENT has been deprecated and will disappear in 2.6.30.\n");
+ printk(KERN_ERR "It is a debugging ioctl and must not be used in applications!\n");
+ return -EINVAL;
+
case VIDIOC_S_HW_FREQ_SEEK:
{
struct v4l2_hw_freq_seek *p = arg;
diff --git a/linux/drivers/media/video/v4l2-subdev.c b/linux/drivers/media/video/v4l2-subdev.c
index e3612f29d..fbe9cc0d4 100644
--- a/linux/drivers/media/video/v4l2-subdev.c
+++ b/linux/drivers/media/video/v4l2-subdev.c
@@ -37,7 +37,7 @@ int v4l2_subdev_command(struct v4l2_subdev *sd, unsigned cmd, void *arg)
return v4l2_subdev_call(sd, core, queryctrl, arg);
case VIDIOC_LOG_STATUS:
return v4l2_subdev_call(sd, core, log_status);
- case VIDIOC_G_CHIP_IDENT:
+ case VIDIOC_DBG_G_CHIP_IDENT:
return v4l2_subdev_call(sd, core, g_chip_ident, arg);
case VIDIOC_INT_S_STANDBY:
return v4l2_subdev_call(sd, core, s_standby, arg ? (*(u32 *)arg) : 0);
diff --git a/linux/drivers/media/video/vp27smpx.c b/linux/drivers/media/video/vp27smpx.c
index cd9df6a1c..b3b3ee61d 100644
--- a/linux/drivers/media/video/vp27smpx.c
+++ b/linux/drivers/media/video/vp27smpx.c
@@ -119,7 +119,7 @@ static int vp27smpx_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
return 0;
}
-static int vp27smpx_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip)
+static int vp27smpx_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
diff --git a/linux/drivers/media/video/wm8739.c b/linux/drivers/media/video/wm8739.c
index ea311672c..ac81c6442 100644
--- a/linux/drivers/media/video/wm8739.c
+++ b/linux/drivers/media/video/wm8739.c
@@ -239,7 +239,7 @@ static int wm8739_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
return -EINVAL;
}
-static int wm8739_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip)
+static int wm8739_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
diff --git a/linux/drivers/media/video/wm8775.c b/linux/drivers/media/video/wm8775.c
index 526926635..3140c1313 100644
--- a/linux/drivers/media/video/wm8775.c
+++ b/linux/drivers/media/video/wm8775.c
@@ -131,7 +131,7 @@ static int wm8775_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
return 0;
}
-static int wm8775_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip)
+static int wm8775_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
diff --git a/linux/include/linux/videodev2.h b/linux/include/linux/videodev2.h
index 0aae06946..b0c501074 100644
--- a/linux/include/linux/videodev2.h
+++ b/linux/include/linux/videodev2.h
@@ -1370,25 +1370,41 @@ struct v4l2_streamparm {
/*
* A D V A N C E D D E B U G G I N G
*
- * NOTE: EXPERIMENTAL API
+ * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS!
+ * FOR DEBUGGING, TESTING AND INTERNAL USE ONLY!
*/
/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */
#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */
-#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver ID */
+#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */
#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */
#define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */
-struct v4l2_register {
- __u32 match_type; /* Match type */
- __u32 match_chip; /* Match this chip, meaning determined by match_type */
+struct v4l2_dbg_match {
+ __u32 type; /* Match type */
+ union { /* Match this chip, meaning determined by type */
+ __u32 addr;
+ char name[32];
+ };
+} __attribute__ ((packed));
+
+struct v4l2_dbg_register {
+ struct v4l2_dbg_match match;
+ __u32 size; /* register size in bytes */
__u64 reg;
__u64 val;
-};
+} __attribute__ ((packed));
+
+/* VIDIOC_DBG_G_CHIP_IDENT */
+struct v4l2_dbg_chip_ident {
+ struct v4l2_dbg_match match;
+ __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */
+ __u32 revision; /* chip revision, chip specific */
+} __attribute__ ((packed));
-/* VIDIOC_G_CHIP_IDENT */
-struct v4l2_chip_ident {
+/* VIDIOC_G_CHIP_IDENT_OLD: Deprecated, do not use */
+struct v4l2_chip_ident_old {
__u32 match_type; /* Match type */
__u32 match_chip; /* Match this chip, meaning determined by match_type */
__u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */
@@ -1460,13 +1476,22 @@ struct v4l2_chip_ident {
#define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx)
#define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd)
#define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd)
+#endif
-/* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */
-#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_register)
-#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_register)
-
-#define VIDIOC_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_chip_ident)
+#if 1 /*KEEP*/
+/* Experimental, meant for debugging, testing and internal use.
+ Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined.
+ You must be root to use these ioctls. Never use these in applications! */
+#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register)
+#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register)
+
+/* Experimental, meant for debugging, testing and internal use.
+ Never use this ioctl in applications! */
+#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident)
+/* This is deprecated and will go away in 2.6.30 */
+#define VIDIOC_G_CHIP_IDENT_OLD _IOWR('V', 81, struct v4l2_chip_ident_old)
#endif
+
#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
/* Reminder: when adding new ioctls please add support for them to
drivers/media/video/v4l2-compat-ioctl32.c as well! */
diff --git a/linux/include/media/soc_camera.h b/linux/include/media/soc_camera.h
index 425b6a98c..7440d9250 100644
--- a/linux/include/media/soc_camera.h
+++ b/linux/include/media/soc_camera.h
@@ -164,12 +164,12 @@ struct soc_camera_ops {
unsigned long (*query_bus_param)(struct soc_camera_device *);
int (*set_bus_param)(struct soc_camera_device *, unsigned long);
int (*get_chip_id)(struct soc_camera_device *,
- struct v4l2_chip_ident *);
+ struct v4l2_dbg_chip_ident *);
int (*set_std)(struct soc_camera_device *, v4l2_std_id *);
int (*enum_input)(struct soc_camera_device *, struct v4l2_input *);
#ifdef CONFIG_VIDEO_ADV_DEBUG
- int (*get_register)(struct soc_camera_device *, struct v4l2_register *);
- int (*set_register)(struct soc_camera_device *, struct v4l2_register *);
+ int (*get_register)(struct soc_camera_device *, struct v4l2_dbg_register *);
+ int (*set_register)(struct soc_camera_device *, struct v4l2_dbg_register *);
#endif
int (*get_control)(struct soc_camera_device *, struct v4l2_control *);
int (*set_control)(struct soc_camera_device *, struct v4l2_control *);
diff --git a/linux/include/media/v4l2-chip-ident.h b/linux/include/media/v4l2-chip-ident.h
index 43dbb659f..9aaf652b2 100644
--- a/linux/include/media/v4l2-chip-ident.h
+++ b/linux/include/media/v4l2-chip-ident.h
@@ -2,7 +2,7 @@
v4l2 chip identifiers header
This header provides a list of chip identifiers that can be returned
- through the VIDIOC_G_CHIP_IDENT ioctl.
+ through the VIDIOC_DBG_G_CHIP_IDENT ioctl.
Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
@@ -24,7 +24,7 @@
#ifndef V4L2_CHIP_IDENT_H_
#define V4L2_CHIP_IDENT_H_
-/* VIDIOC_G_CHIP_IDENT: identifies the actual chip installed on the board */
+/* VIDIOC_DBG_G_CHIP_IDENT: identifies the actual chip installed on the board */
enum {
/* general idents: reserved range 0-49 */
V4L2_IDENT_NONE = 0, /* No chip matched */
diff --git a/linux/include/media/v4l2-common.h b/linux/include/media/v4l2-common.h
index f99c866d8..95e74f187 100644
--- a/linux/include/media/v4l2-common.h
+++ b/linux/include/media/v4l2-common.h
@@ -114,10 +114,10 @@ u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id);
/* Register/chip ident helper function */
struct i2c_client; /* forward reference */
-int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 id_type, u32 chip_id);
-int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip,
+int v4l2_chip_match_i2c_client(struct i2c_client *c, const struct v4l2_dbg_match *match);
+int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_dbg_chip_ident *chip,
u32 ident, u32 revision);
-int v4l2_chip_match_host(u32 id_type, u32 chip_id);
+int v4l2_chip_match_host(const struct v4l2_dbg_match *match);
/* ------------------------------------------------------------------------- */
diff --git a/linux/include/media/v4l2-int-device.h b/linux/include/media/v4l2-int-device.h
index ecda3c725..fbf585561 100644
--- a/linux/include/media/v4l2-int-device.h
+++ b/linux/include/media/v4l2-int-device.h
@@ -219,7 +219,7 @@ enum v4l2_int_ioctl_num {
vidioc_int_reset_num,
/* VIDIOC_INT_INIT */
vidioc_int_init_num,
- /* VIDIOC_INT_G_CHIP_IDENT */
+ /* VIDIOC_DBG_G_CHIP_IDENT */
vidioc_int_g_chip_ident_num,
/*
diff --git a/linux/include/media/v4l2-ioctl.h b/linux/include/media/v4l2-ioctl.h
index bf0e723a9..b01c04486 100644
--- a/linux/include/media/v4l2-ioctl.h
+++ b/linux/include/media/v4l2-ioctl.h
@@ -225,12 +225,12 @@ struct v4l2_ioctl_ops {
/* Debugging ioctls */
#ifdef CONFIG_VIDEO_ADV_DEBUG
int (*vidioc_g_register) (struct file *file, void *fh,
- struct v4l2_register *reg);
+ struct v4l2_dbg_register *reg);
int (*vidioc_s_register) (struct file *file, void *fh,
- struct v4l2_register *reg);
+ struct v4l2_dbg_register *reg);
#endif
int (*vidioc_g_chip_ident) (struct file *file, void *fh,
- struct v4l2_chip_ident *chip);
+ struct v4l2_dbg_chip_ident *chip);
int (*vidioc_enum_framesizes) (struct file *file, void *fh,
struct v4l2_frmsizeenum *fsize);
diff --git a/linux/include/media/v4l2-subdev.h b/linux/include/media/v4l2-subdev.h
index 251734431..37b09e56e 100644
--- a/linux/include/media/v4l2-subdev.h
+++ b/linux/include/media/v4l2-subdev.h
@@ -69,7 +69,7 @@ struct tuner_setup;
not yet implemented) since ops provide proper type-checking.
*/
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);
int (*s_standby)(struct v4l2_subdev *sd, u32 standby);
@@ -81,8 +81,8 @@ struct v4l2_subdev_core_ops {
int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
#ifdef CONFIG_VIDEO_ADV_DEBUG
- int (*g_register)(struct v4l2_subdev *sd, struct v4l2_register *reg);
- int (*s_register)(struct v4l2_subdev *sd, struct v4l2_register *reg);
+ int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
+ int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
#endif
};
diff --git a/v4l2-apps/test/ioctl-test.c b/v4l2-apps/test/ioctl-test.c
index 37a0e2374..f9ac1cad5 100644
--- a/v4l2-apps/test/ioctl-test.c
+++ b/v4l2-apps/test/ioctl-test.c
@@ -88,8 +88,9 @@ union v4l_parms {
struct v4l2_frmivalenum p_v4l2_frmivalenum;
struct v4l2_enc_idx p_v4l2_enc_idx;
struct v4l2_encoder_cmd p_v4l2_encoder_cmd;
- struct v4l2_register p_v4l2_register;
- struct v4l2_chip_ident p_v4l2_chip_ident;
+ struct v4l2_dbg_register p_v4l2_dbg_register;
+ struct v4l2_dbg_chip_ident p_v4l2_dbg_chip_ident;
+ struct v4l2_chip_ident_old p_v4l2_chip_ident_old;
struct v4l2_hw_freq_seek p_v4l2_hw_freq_seek;
};
@@ -195,7 +196,8 @@ static const struct {
ioc(VIDIOC_TRY_ENCODER_CMD), /* struct v4l2_encoder_cmd */
ioc(VIDIOC_DBG_S_REGISTER), /* struct v4l2_register */
ioc(VIDIOC_DBG_G_REGISTER), /* struct v4l2_register */
- ioc(VIDIOC_G_CHIP_IDENT), /* struct v4l2_chip_ident */
+ ioc(VIDIOC_DBG_G_CHIP_IDENT), /* struct v4l2_dbg_chip_ident */
+ ioc(VIDIOC_G_CHIP_IDENT_OLD), /* struct v4l2_chip_ident_old */
ioc(VIDIOC_S_HW_FREQ_SEEK), /* struct v4l2_hw_freq_seek */
#ifdef __OLD_VIDIOC_
ioc(VIDIOC_OVERLAY_OLD), /* int */
diff --git a/v4l2-apps/util/Makefile b/v4l2-apps/util/Makefile
index 0a28e7da9..b80de190b 100644
--- a/v4l2-apps/util/Makefile
+++ b/v4l2-apps/util/Makefile
@@ -18,18 +18,18 @@ endif
all: $(binaries) qv4l2 keytable
clean::
- rm -f $(binaries) v4l2-driverids.cpp v4l2-chipids.cpp
+ rm -f $(binaries) v4l2-chipids.cpp
-if [ -f qv4l2/Makefile ]; then make -C qv4l2 $@; fi
-rm -f qv4l2/qv4l2 qv4l2/Makefile
make -C xc3028-firmware $@
- rm -f v4l2-driverids.cpp v4l2-chipids.cpp
+ rm -f v4l2-chipids.cpp
rm -rf keycodes parse.h keytable
qv4l2:
-if [ ! -f qv4l2/Makefile ]; then (cd qv4l2; qmake); fi
$(MAKE) -C qv4l2
-v4l2-dbg: v4l2-dbg.o v4l2-driverids.o v4l2-chipids.o
+v4l2-dbg: v4l2-dbg.o v4l2-chipids.o
$(CXX) $^ -o $@
v4l2-dbg.o: v4l2-dbg.h v4l2-dbg-bttv.h v4l2-dbg-em28xx.h v4l2-dbg-saa7134.h
@@ -59,11 +59,6 @@ keytables:
keytable: keytable.c parse.h keytables
-v4l2-driverids.cpp: ../include/linux/i2c-id.h
- @echo "struct driverid { const char *name; unsigned id; } driverids[] = {" >$@
- @grep I2C_DRIVERID_ $^ | sed -e 's/.*I2C_DRIVERID_\([0-9A-Z_]*\)[^0-9]*\([0-9]*\).*/{ "\1", \2 },/' | tr A-Z a-z >>$@
- @echo "{ 0, 0 }};" >>$@
-
v4l2-chipids.cpp: ../include/media/v4l2-chip-ident.h
@echo "struct chipid { const char *name; unsigned id; } chipids[] = {" >$@
@grep V4L2_IDENT_ $^ | sed -e 's/.*V4L2_IDENT_\([0-9A-Z_]*\)[^=]*=[^0-9]*\([0-9]*\).*/{ "\1", \2 },/' | tr A-Z a-z >>$@
diff --git a/v4l2-apps/util/cx18-ctl.c b/v4l2-apps/util/cx18-ctl.c
index 4081f3aef..3d8ff385d 100644
--- a/v4l2-apps/util/cx18-ctl.c
+++ b/v4l2-apps/util/cx18-ctl.c
@@ -419,10 +419,10 @@ int main(int argc, char **argv)
doioctl(fd, VIDIOC_INT_S_AUDIO_ROUTING, &route, "VIDIOC_INT_S_AUDIO_ROUTING");
if (options[OptSetGPIO]) {
- struct v4l2_register reg;
+ struct v4l2_dbg_register reg;
- reg.match_type = V4L2_CHIP_MATCH_HOST;
- reg.match_chip = 0;
+ reg.match.type = V4L2_CHIP_MATCH_HOST;
+ reg.match.addr = 0;
reg.reg = CX18_REG_GPIO_DIR1;
reg.val = (unsigned)((gpio_dir & 0xffff) << 16);
if (gpio_set_dir && doioctl(fd, VIDIOC_DBG_S_REGISTER, &reg,
@@ -446,10 +446,10 @@ int main(int argc, char **argv)
}
if (options[OptListGPIO]) {
- struct v4l2_register reg;
+ struct v4l2_dbg_register reg;
- reg.match_type = V4L2_CHIP_MATCH_HOST;
- reg.match_chip = 0;
+ reg.match.type = V4L2_CHIP_MATCH_HOST;
+ reg.match.addr = 0;
reg.reg = CX18_REG_GPIO_IN;
if (ioctl(fd, VIDIOC_DBG_G_REGISTER, &reg) == 0)
printf("GPIO in: 0x%04llx\n", reg.val);
diff --git a/v4l2-apps/util/ivtv-ctl.c b/v4l2-apps/util/ivtv-ctl.c
index af84164e3..a05dcbba2 100644
--- a/v4l2-apps/util/ivtv-ctl.c
+++ b/v4l2-apps/util/ivtv-ctl.c
@@ -564,10 +564,10 @@ int main(int argc, char **argv)
}
if (options[OptSetGPIO]) {
- struct v4l2_register reg;
+ struct v4l2_dbg_register reg;
- reg.match_type = V4L2_CHIP_MATCH_HOST;
- reg.match_chip = 0;
+ reg.match.type = V4L2_CHIP_MATCH_HOST;
+ reg.match.addr = 0;
reg.reg = IVTV_REG_GPIO_DIR_OFFSET;
reg.val = gpio_dir;
if (gpio_set_dir && doioctl(fd, VIDIOC_DBG_S_REGISTER, &reg,
@@ -581,10 +581,10 @@ int main(int argc, char **argv)
}
if (options[OptListGPIO]) {
- struct v4l2_register reg;
+ struct v4l2_dbg_register reg;
- reg.match_type = V4L2_CHIP_MATCH_HOST;
- reg.match_chip = 0;
+ reg.match.type = V4L2_CHIP_MATCH_HOST;
+ reg.match.addr = 0;
reg.reg = IVTV_REG_GPIO_IN_OFFSET;
if (ioctl(fd, VIDIOC_DBG_G_REGISTER, &reg) == 0)
printf("GPIO in: 0x%04llx\n", reg.val);
diff --git a/v4l2-apps/util/v4l2-compliance.cpp b/v4l2-apps/util/v4l2-compliance.cpp
index 2fe5292fe..3780f982e 100644
--- a/v4l2-apps/util/v4l2-compliance.cpp
+++ b/v4l2-apps/util/v4l2-compliance.cpp
@@ -910,23 +910,25 @@ static int testCap(int fd)
static int testChipIdent(int fd)
{
- struct v4l2_chip_ident chip;
+ struct v4l2_dbg_chip_ident chip;
int ret;
- chip.match_type = V4L2_CHIP_MATCH_HOST;
- chip.match_chip = 0;
- ret = doioctl(fd, VIDIOC_G_CHIP_IDENT, &chip, "VIDIOC_G_CHIP_IDENT");
+ memset(&chip, 0, sizeof(chip));
+ chip.match.type = V4L2_CHIP_MATCH_HOST;
+ chip.match.addr = 0;
+ ret = doioctl(fd, VIDIOC_DBG_G_CHIP_IDENT, &chip, "VIDIOC_DBG_G_CHIP_IDENT");
// Must return either 0 (OK) or EINVAL (not supported)
if (ret == 0) {
- struct v4l2_chip_ident orig;
+ struct v4l2_dbg_chip_ident orig;
+ memset(&orig, 0, sizeof(orig));
// set invalid match_type
- chip.match_type = V4L2_CHIP_MATCH_I2C_ADDR + 1;
- chip.match_chip = 0xdeadbeef;
+ chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR + 1;
+ chip.match.addr = 0xdeadbeef;
chip.ident = 0xdeadbeef;
chip.revision = 0xdeadbeef;
orig = chip;
- ret = doioctl(fd, VIDIOC_G_CHIP_IDENT, &chip, "VIDIOC_G_CHIP_IDENT");
+ ret = doioctl(fd, VIDIOC_DBG_G_CHIP_IDENT, &chip, "VIDIOC_DBG_G_CHIP_IDENT");
if (ret != EINVAL) {
if (verbose)
printf("Invalid match_type accepted\n");
@@ -944,13 +946,13 @@ static int testChipIdent(int fd)
static int testRegister(int fd)
{
- struct v4l2_register reg;
- struct v4l2_chip_ident chip;
+ struct v4l2_dbg_register reg;
+ struct v4l2_dbg_chip_ident chip;
int ret;
int uid = getuid();
- reg.match_type = V4L2_CHIP_MATCH_HOST;
- reg.match_chip = 0;
+ reg.match.type = V4L2_CHIP_MATCH_HOST;
+ reg.match.addr = 0;
reg.reg = 0;
ret = doioctl(fd, VIDIOC_DBG_G_REGISTER, &reg, "VIDIOC_DBG_G_REGISTER");
if (ret == EINVAL)
@@ -963,10 +965,10 @@ static int testRegister(int fd)
printf("Not allowed to call VIDIOC_DBG_G_REGISTER even though we are root\n");
return -1;
}
- chip.match_type = V4L2_CHIP_MATCH_HOST;
- chip.match_chip = 0;
- if (doioctl(fd, VIDIOC_G_CHIP_IDENT, &chip, "VIDIOC_G_CHIP_IDENT")) {
- printf("Must support VIDIOC_G_CHIP_IDENT\n");
+ chip.match.type = V4L2_CHIP_MATCH_HOST;
+ chip.match.addr = 0;
+ if (doioctl(fd, VIDIOC_DBG_G_CHIP_IDENT, &chip, "VIDIOC_DBG_G_CHIP_IDENT")) {
+ printf("Must support VIDIOC_DBG_G_CHIP_IDENT\n");
return -1;
}
if (uid) {
@@ -1111,7 +1113,7 @@ int main(int argc, char **argv)
printf("Debug ioctls:\n");
if (test[TestChipIdent])
- printf("\ttest VIDIOC_G_CHIP_IDENT: %s\n", ok(testChipIdent(fd)));
+ printf("\ttest VIDIOC_DBG_G_CHIP_IDENT: %s\n", ok(testChipIdent(fd)));
if (test[TestRegister])
printf("\ttest VIDIOC_DBG_G/S_REGISTER: %s\n", ok(testRegister(fd)));
if (test[TestLogStatus])
diff --git a/v4l2-apps/util/v4l2-dbg.cpp b/v4l2-apps/util/v4l2-dbg.cpp
index 577c8585e..b38d18cf0 100644
--- a/v4l2-apps/util/v4l2-dbg.cpp
+++ b/v4l2-apps/util/v4l2-dbg.cpp
@@ -103,13 +103,6 @@ static const struct board_list boards[] = {
},
};
-struct driverid {
- const char *name;
- unsigned id;
-};
-
-extern struct driverid driverids[];
-
struct chipid {
const char *name;
unsigned id;
@@ -138,7 +131,6 @@ enum Option {
OptLogStatus = 128,
OptVerbose,
- OptListDriverIDs,
OptListSymbols,
OptLast = 256
};
@@ -159,7 +151,6 @@ static struct option long_options[] = {
{"info", no_argument, 0, OptGetDriverInfo},
{"verbose", no_argument, 0, OptVerbose},
{"log-status", no_argument, 0, OptLogStatus},
- {"list-driverids", no_argument, 0, OptListDriverIDs},
{"list-symbols", no_argument, 0, OptListSymbols},
{"wide", required_argument, 0, OptSetStride},
{0, 0, 0, 0}
@@ -175,7 +166,7 @@ static void usage(void)
" --verbose Turn on verbose ioctl error reporting\n"
" -c, --chip=<chip> The chip identifier to use with other commands\n"
" It can be one of:\n"
- " I2C driver ID (see --list-driverids)\n"
+ " I2C driver name\n"
" I2C 7-bit address\n"
" AC97: for ac97 anciliary mixer\n"
" host<num>: host chip number <num>\n"
@@ -188,25 +179,16 @@ static void usage(void)
" Set the register with the commandline arguments\n"
" The register will autoincrement [VIDIOC_DBG_S_REGISTER]\n"
" -S, --scan-chip-idents\n"
- " Scan the available host and i2c chips [VIDIOC_G_CHIP_IDENT]\n"
+ " Scan the available host and i2c chips [VIDIOC_DBG_G_CHIP_IDENT]\n"
" -i, --get-chip-ident\n"
- " Get the chip identifier [VIDIOC_G_CHIP_IDENT]\n"
+ " Get the chip identifier [VIDIOC_DBG_G_CHIP_IDENT]\n"
" -w, --wide=<reg length>\n"
" Sets step between two registers\n"
" --list-symbols List the symbolic register names you can use, if any\n"
- " --log-status Log the board status in the kernel log [VIDIOC_LOG_STATUS]\n"
- " --list-driverids List the known I2C driver IDs for use with the i2cdrv type\n");
+ " --log-status Log the board status in the kernel log [VIDIOC_LOG_STATUS]\n");
exit(0);
}
-static unsigned parse_chip(const std::string &s)
-{
- for (int i = 0; driverids[i].name; i++)
- if (!strcasecmp(s.c_str(), driverids[i].name))
- return driverids[i].id;
- return 0;
-}
-
static std::string cap2s(unsigned cap)
{
std::string s;
@@ -244,7 +226,7 @@ static std::string cap2s(unsigned cap)
return s;
}
-static void print_regs(int fd, struct v4l2_register *reg, unsigned long min, unsigned long max, int stride)
+static void print_regs(int fd, struct v4l2_dbg_register *reg, unsigned long min, unsigned long max, int stride)
{
unsigned long mask = stride > 1 ? 0x1f : 0x0f;
unsigned long i;
@@ -278,7 +260,7 @@ static void print_regs(int fd, struct v4l2_register *reg, unsigned long min, uns
printf("\n");
}
-static void print_chip(struct v4l2_chip_ident *chip)
+static void print_chip(struct v4l2_dbg_chip_ident *chip)
{
const char *name = NULL;
@@ -403,9 +385,9 @@ int main(int argc, char **argv)
int ch;
const char *device = "/dev/video0"; /* -d device */
struct v4l2_capability vcap; /* list_cap */
- struct v4l2_register set_reg;
- struct v4l2_register get_reg;
- struct v4l2_chip_ident chip_id;
+ struct v4l2_dbg_register set_reg;
+ struct v4l2_dbg_register get_reg;
+ struct v4l2_dbg_chip_ident chip_id;
const struct board_list *curr_bd = NULL;
char short_options[26 * 2 * 2 + 1];
int idx = 0;
@@ -413,10 +395,11 @@ int main(int argc, char **argv)
std::string reg_set_arg;
unsigned long long reg_min = 0, reg_max = 0;
std::vector<std::string> get_regs;
- int match_type = V4L2_CHIP_MATCH_HOST;
- int match_chip = 0;
char driver[255];
+ struct v4l2_dbg_match match;
+ match.type = V4L2_CHIP_MATCH_HOST;
+ match.addr = 0;
memset(&set_reg, 0, sizeof(set_reg));
memset(&get_reg, 0, sizeof(get_reg));
memset(&chip_id, 0, sizeof(chip_id));
@@ -460,26 +443,23 @@ int main(int argc, char **argv)
case OptChip:
if (isdigit(optarg[0])) {
- match_type = V4L2_CHIP_MATCH_I2C_ADDR;
- match_chip = strtoul(optarg, NULL, 0);
+ match.type = V4L2_CHIP_MATCH_I2C_ADDR;
+ match.addr = strtoul(optarg, NULL, 0);
break;
}
if (!memcmp(optarg, "host", 4)) {
- match_type = V4L2_CHIP_MATCH_HOST;
- match_chip = strtoul(optarg + 4, NULL, 0);
+ match.type = V4L2_CHIP_MATCH_HOST;
+ match.addr = strtoul(optarg + 4, NULL, 0);
break;
}
if (!strcasecmp(optarg, "ac97")) {
- match_type = V4L2_CHIP_MATCH_AC97;
+ match.type = V4L2_CHIP_MATCH_AC97;
+ match.addr = 0;
break;
}
- match_type = V4L2_CHIP_MATCH_I2C_DRIVER;
- strcpy(driver, optarg);
- match_chip = parse_chip(optarg);
- if (!match_chip) {
- fprintf(stderr, "unknown driver ID %s\n", optarg);
- exit(-1);
- }
+ match.type = V4L2_CHIP_MATCH_I2C_DRIVER;
+ strncpy(match.name, optarg, sizeof(match.name));
+ match.name[sizeof(match.name) - 1] = '\0';
break;
case OptSetRegister:
@@ -558,16 +538,16 @@ int main(int argc, char **argv)
printf("%s", cap2s(vcap.capabilities).c_str());
}
- if (match_type == V4L2_CHIP_MATCH_AC97) {
+ if (match.type == V4L2_CHIP_MATCH_AC97) {
curr_bd = &boards[AC97_BOARD];
- } else if (match_type == V4L2_CHIP_MATCH_HOST) {
+ } else if (match.type == V4L2_CHIP_MATCH_HOST) {
for (int board = ARRAY_SIZE(boards) - 1; board >= 0; board--) {
if (!strcasecmp((char *)vcap.driver, boards[board].name)) {
curr_bd = &boards[board];
break;
}
}
- } else if (match_type == V4L2_CHIP_MATCH_I2C_DRIVER) {
+ } else if (match.type == V4L2_CHIP_MATCH_I2C_DRIVER) {
for (int board = ARRAY_SIZE(boards) - 1; board >= 0; board--) {
if (!strcasecmp(driver, boards[board].name)) {
curr_bd = &boards[board];
@@ -579,8 +559,7 @@ int main(int argc, char **argv)
/* Set options */
if (options[OptSetRegister]) {
- set_reg.match_type = match_type;
- set_reg.match_chip = match_chip;
+ set_reg.match = match;
if (optind >= argc)
usage();
set_reg.reg = parse_reg(curr_bd, reg_set_arg);
@@ -607,28 +586,27 @@ int main(int argc, char **argv)
}
if (options[OptGetChipIdent]) {
- chip_id.match_type = match_type;
- chip_id.match_chip = match_chip;
- if (doioctl(fd, VIDIOC_G_CHIP_IDENT, &chip_id, "VIDIOC_G_CHIP_IDENT") == 0)
+ chip_id.match = match;
+ if (doioctl(fd, VIDIOC_DBG_G_CHIP_IDENT, &chip_id, "VIDIOC_DBG_G_CHIP_IDENT") == 0)
print_chip(&chip_id);
}
if (options[OptScanChipIdents]) {
int i;
- chip_id.match_type = V4L2_CHIP_MATCH_HOST;
- chip_id.match_chip = 0;
+ chip_id.match.type = V4L2_CHIP_MATCH_HOST;
+ chip_id.match.addr = 0;
- while (doioctl(fd, VIDIOC_G_CHIP_IDENT, &chip_id, "VIDIOC_G_CHIP_IDENT") == 0 && chip_id.ident) {
- printf("host%d: ", chip_id.match_chip);
+ while (doioctl(fd, VIDIOC_DBG_G_CHIP_IDENT, &chip_id, "VIDIOC_DBG_G_CHIP_IDENT") == 0 && chip_id.ident) {
+ printf("host%d: ", chip_id.match.addr);
print_chip(&chip_id);
- chip_id.match_chip++;
+ chip_id.match.addr++;
}
- chip_id.match_type = V4L2_CHIP_MATCH_I2C_ADDR;
+ chip_id.match.type = V4L2_CHIP_MATCH_I2C_ADDR;
for (i = 0; i < 128; i++) {
- chip_id.match_chip = i;
- if (doioctl(fd, VIDIOC_G_CHIP_IDENT, &chip_id, "VIDIOC_G_CHIP_IDENT") == 0 && chip_id.ident) {
+ chip_id.match.addr = i;
+ if (doioctl(fd, VIDIOC_DBG_G_CHIP_IDENT, &chip_id, "VIDIOC_DBG_G_CHIP_IDENT") == 0 && chip_id.ident) {
printf("i2c 0x%02x: ", i);
print_chip(&chip_id);
}
@@ -638,8 +616,7 @@ int main(int argc, char **argv)
if (options[OptGetRegister]) {
int stride = 1;
- get_reg.match_type = match_type;
- get_reg.match_chip = match_chip;
+ get_reg.match = match;
printf("ioctl: VIDIOC_DBG_G_REGISTER\n");
for (std::vector<std::string>::iterator iter = get_regs.begin();
@@ -665,16 +642,14 @@ int main(int argc, char **argv)
}
if (options[OptListRegisters]) {
+ std::string name;
int stride = 1;
- get_reg.match_type = match_type;
- get_reg.match_chip = match_chip;
-
+ get_reg.match = match;
if (forcedstride) {
stride = forcedstride;
- } else {
- if (get_reg.match_type == V4L2_CHIP_MATCH_HOST)
- stride = 4;
+ } else if (get_reg.match.type == V4L2_CHIP_MATCH_HOST) {
+ stride = 4;
}
printf("ioctl: VIDIOC_DBG_G_REGISTER\n");
@@ -726,57 +701,47 @@ int main(int argc, char **argv)
goto list_done;
}
- /* try to match the i2c chip */
- switch (get_reg.match_chip) {
- case I2C_DRIVERID_SAA711X:
- print_regs(fd, &get_reg, 0, 0xff, stride);
+ /* try to figure out which chip it is */
+ chip_id.match = match;
+ if (doioctl(fd, VIDIOC_DBG_G_CHIP_IDENT, &chip_id, "VIDIOC_DBG_G_CHIP_IDENT") != 0) {
+ chip_id.ident = V4L2_IDENT_NONE;
+ }
+ switch (chip_id.ident) {
+ case V4L2_IDENT_CX23415:
+ case V4L2_IDENT_CX23416:
+ name = "cx23416";
+ break;
+ case V4L2_IDENT_CX23418:
+ name = "cx23418";
break;
- case I2C_DRIVERID_SAA717X:
+ default:
+ if (get_reg.match.type == V4L2_CHIP_MATCH_I2C_DRIVER)
+ name = get_reg.match.name;
+ break;
+ }
+
+ if (name == "saa7115") {
+ print_regs(fd, &get_reg, 0, 0xff, stride);
+ } else if (name == "saa717x") {
// FIXME: use correct reg regions
print_regs(fd, &get_reg, 0, 0xff, stride);
- break;
- case I2C_DRIVERID_SAA7127:
+ } else if (name == "saa7127") {
print_regs(fd, &get_reg, 0, 0x7f, stride);
- break;
- case I2C_DRIVERID_CX25840:
+ } else if (name == "cx25840") {
print_regs(fd, &get_reg, 0, 2, stride);
print_regs(fd, &get_reg, 0x100, 0x15f, stride);
print_regs(fd, &get_reg, 0x200, 0x23f, stride);
print_regs(fd, &get_reg, 0x400, 0x4bf, stride);
print_regs(fd, &get_reg, 0x800, 0x9af, stride);
- break;
- case I2C_DRIVERID_CS5345:
+ } else if (name == "cs5345") {
print_regs(fd, &get_reg, 1, 0x10, stride);
- break;
- case 0:
- /* host chip, handle later */
- break;
- default:
- /* unknown i2c chip, dump 0-0xff by default */
- print_regs(fd, &get_reg, 0, 0xff, stride);
- break;
- }
- if (get_reg.match_chip != 0) {
- /* found i2c chip, we're done */
- goto list_done;
- }
- /* try to figure out which host chip it is */
- if (doioctl(fd, VIDIOC_G_CHIP_IDENT, &chip_id, "VIDIOC_G_CHIP_IDENT") != 0) {
- chip_id.ident = V4L2_IDENT_NONE;
- }
-
- switch (chip_id.ident) {
- case V4L2_IDENT_CX23415:
- case V4L2_IDENT_CX23416:
+ } else if (name == "cx23416") {
print_regs(fd, &get_reg, 0x02000000, 0x020000ff, stride);
- break;
- case V4L2_IDENT_CX23418:
+ } else if (name == "cx23418") {
print_regs(fd, &get_reg, 0x02c40000, 0x02c409c7, stride);
- break;
- default:
- /* By default print range 0-0xff */
+ } else {
+ /* unknown chip, dump 0-0xff by default */
print_regs(fd, &get_reg, 0, 0xff, stride);
- break;
}
}
list_done:
@@ -808,12 +773,6 @@ list_done:
}
}
- if (options[OptListDriverIDs]) {
- printf("Known I2C driver IDs:\n");
- for (int i = 0; driverids[i].name; i++)
- printf("%s\n", driverids[i].name);
- }
-
if (options[OptListSymbols]) {
if (curr_bd == NULL) {
printf("No symbols found for driver %s\n", vcap.driver);