Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 124442
b: refs/heads/master
c: 531c98e
h: refs/heads/master
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Dec 30, 2008
1 parent da5e39a commit 70c1216
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 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: 4b00eb25340c1a9b9eedaf0bc5b0f0d18eddb028
refs/heads/master: 531c98e71805b32e9ea35a218119100bbd2b7615
4 changes: 2 additions & 2 deletions trunk/drivers/media/video/em28xx/em28xx-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ static int em28xx_is_ac97_ready(struct em28xx *dev)
* em28xx_read_ac97()
* write a 16 bit value to the specified AC97 address (LSB first!)
*/
static int em28xx_read_ac97(struct em28xx *dev, u8 reg)
int em28xx_read_ac97(struct em28xx *dev, u8 reg)
{
int ret;
u8 addr = (reg & 0x7f) | 0x80;
Expand All @@ -285,7 +285,7 @@ static int em28xx_read_ac97(struct em28xx *dev, u8 reg)
* em28xx_write_ac97()
* write a 16 bit value to the specified AC97 address (LSB first!)
*/
static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u16 val)
int em28xx_write_ac97(struct em28xx *dev, u8 reg, u16 val)
{
int ret;
u8 addr = reg & 0x7f;
Expand Down
19 changes: 19 additions & 0 deletions trunk/drivers/media/video/em28xx/em28xx-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,17 @@ static int vidioc_g_register(struct file *file, void *priv,
struct em28xx *dev = fh->dev;
int ret;

if (reg->match_type == V4L2_CHIP_MATCH_AC97) {
mutex_lock(&dev->lock);
ret = em28xx_read_ac97(dev, reg->reg);
mutex_unlock(&dev->lock);
if (ret < 0)
return ret;

reg->val = ret;
return 0;
}

if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
return -EINVAL;

Expand Down Expand Up @@ -1256,6 +1267,14 @@ static int vidioc_s_register(struct file *file, void *priv,
__le64 buf;
int rc;

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

return rc;
}

buf = cpu_to_le64(reg->val);

mutex_lock(&dev->lock);
Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/media/video/em28xx/em28xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,9 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
int em28xx_write_regs(struct em28xx *dev, u16 reg, char *buf, int len);
int em28xx_write_reg(struct em28xx *dev, u16 reg, u8 val);

int em28xx_read_ac97(struct em28xx *dev, u8 reg);
int em28xx_write_ac97(struct em28xx *dev, u8 reg, u16 val);

int em28xx_audio_analog_set(struct em28xx *dev);
int em28xx_audio_setup(struct em28xx *dev);

Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/videodev2.h
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,7 @@ struct v4l2_streamparm {
#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_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 */
Expand Down

0 comments on commit 70c1216

Please sign in to comment.