Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125529
b: refs/heads/master
c: aecde8b
h: refs/heads/master
i:
  125527: 6091f7a
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Jan 2, 2009
1 parent 1b77241 commit e9bdde7
Show file tree
Hide file tree
Showing 53 changed files with 291 additions and 282 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: da1b5c95e49bb564ae8c61ed135d34ed09acbb66
refs/heads/master: aecde8b53b8ee1330a5a8206200f0d6b8845a6e0
2 changes: 1 addition & 1 deletion trunk/Documentation/video4linux/v4l2-framework.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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);
...
Expand Down
9 changes: 5 additions & 4 deletions trunk/drivers/media/video/bt8xx/bttv-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2039,34 +2039,35 @@ 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;

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;

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 */
Expand Down
7 changes: 4 additions & 3 deletions trunk/drivers/media/video/cafe_ccic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down
13 changes: 6 additions & 7 deletions trunk/drivers/media/video/cs5345.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, &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;
Expand All @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/media/video/cs53l32a.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
28 changes: 1 addition & 27 deletions trunk/drivers/media/video/cx18/cx18-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/media/video/cx18/cx18-i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
41 changes: 15 additions & 26 deletions trunk/drivers/media/video/cx18/cx18-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand All @@ -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(&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

Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/media/video/cx23885/cx23885-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(&reg->match))
return -EINVAL;

cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_G_REGISTER, reg);
Expand All @@ -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(&reg->match))
return -EINVAL;

cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_S_REGISTER, reg);
Expand Down
13 changes: 6 additions & 7 deletions trunk/drivers/media/video/cx25840/cx25840-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, &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;
Expand Down Expand Up @@ -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);
Expand Down
13 changes: 7 additions & 6 deletions trunk/drivers/media/video/cx88/cx88-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(&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
Expand Down
Loading

0 comments on commit e9bdde7

Please sign in to comment.