Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 124455
b: refs/heads/master
c: 14983d8
h: refs/heads/master
i:
  124453: f66da1a
  124451: 0b0472e
  124447: 29ca304
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Dec 30, 2008
1 parent f71fff1 commit 8e07493
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 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: bc97430510960846b6e8f2d62c503653031991e1
refs/heads/master: 14983d8163c78826386404b27ee5bfc72e25a9d4
46 changes: 41 additions & 5 deletions trunk/drivers/media/video/em28xx/em28xx-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "em28xx.h"
#include <media/v4l2-common.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-chip-ident.h>
#include <media/msp3400.h>
#include <media/tuner.h>

Expand Down Expand Up @@ -1214,14 +1215,30 @@ static int em28xx_reg_len(int reg)
}
}

static int vidioc_g_chip_ident(struct file *file, void *priv,
struct v4l2_chip_ident *chip)
{
struct em28xx_fh *fh = priv;
struct em28xx *dev = fh->dev;

chip->ident = V4L2_IDENT_NONE;
chip->revision = 0;

em28xx_i2c_call_clients(dev, VIDIOC_G_CHIP_IDENT, chip);

return 0;
}


static int vidioc_g_register(struct file *file, void *priv,
struct v4l2_register *reg)
{
struct em28xx_fh *fh = priv;
struct em28xx *dev = fh->dev;
int ret;

if (reg->match_type == V4L2_CHIP_MATCH_AC97) {
switch (reg->match_type) {
case V4L2_CHIP_MATCH_AC97:
mutex_lock(&dev->lock);
ret = em28xx_read_ac97(dev, reg->reg);
mutex_unlock(&dev->lock);
Expand All @@ -1230,11 +1247,18 @@ static int vidioc_g_register(struct file *file, void *priv,

reg->val = ret;
return 0;
}

if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
case V4L2_CHIP_MATCH_I2C_DRIVER:
em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_REGISTER, reg);
return 0;
case V4L2_CHIP_MATCH_I2C_ADDR:
/* Not supported yet */
return -EINVAL;
default:
if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
return -EINVAL;
}

/* Match host */
if (em28xx_reg_len(reg->reg) == 1) {
mutex_lock(&dev->lock);
ret = em28xx_read_reg(dev, reg->reg);
Expand Down Expand Up @@ -1267,14 +1291,25 @@ static int vidioc_s_register(struct file *file, void *priv,
__le64 buf;
int rc;

if (reg->match_type == V4L2_CHIP_MATCH_AC97) {
switch (reg->match_type) {
case V4L2_CHIP_MATCH_AC97:
mutex_lock(&dev->lock);
rc = em28xx_write_ac97(dev, reg->reg, reg->val);
mutex_unlock(&dev->lock);

return rc;
case V4L2_CHIP_MATCH_I2C_DRIVER:
em28xx_i2c_call_clients(dev, VIDIOC_DBG_S_REGISTER, reg);
return 0;
case V4L2_CHIP_MATCH_I2C_ADDR:
/* Not supported yet */
return -EINVAL;
default:
if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
return -EINVAL;
}

/* Match host */
buf = cpu_to_le64(reg->val);

mutex_lock(&dev->lock);
Expand Down Expand Up @@ -1927,6 +1962,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
#ifdef CONFIG_VIDEO_ADV_DEBUG
.vidioc_g_register = vidioc_g_register,
.vidioc_s_register = vidioc_s_register,
.vidioc_g_chip_ident = vidioc_g_chip_ident,
#endif
#ifdef CONFIG_VIDEO_V4L1_COMPAT
.vidiocgmbuf = vidiocgmbuf,
Expand Down

0 comments on commit 8e07493

Please sign in to comment.