mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-30 08:04:13 +08:00
V4L/DVB (9970): em28xx: Allow get/set registers for debug on i2c slave chips
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
bc97430510
commit
14983d8163
@ -39,6 +39,7 @@
|
|||||||
#include "em28xx.h"
|
#include "em28xx.h"
|
||||||
#include <media/v4l2-common.h>
|
#include <media/v4l2-common.h>
|
||||||
#include <media/v4l2-ioctl.h>
|
#include <media/v4l2-ioctl.h>
|
||||||
|
#include <media/v4l2-chip-ident.h>
|
||||||
#include <media/msp3400.h>
|
#include <media/msp3400.h>
|
||||||
#include <media/tuner.h>
|
#include <media/tuner.h>
|
||||||
|
|
||||||
@ -1214,6 +1215,21 @@ 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,
|
static int vidioc_g_register(struct file *file, void *priv,
|
||||||
struct v4l2_register *reg)
|
struct v4l2_register *reg)
|
||||||
{
|
{
|
||||||
@ -1221,7 +1237,8 @@ static int vidioc_g_register(struct file *file, void *priv,
|
|||||||
struct em28xx *dev = fh->dev;
|
struct em28xx *dev = fh->dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (reg->match_type == V4L2_CHIP_MATCH_AC97) {
|
switch (reg->match_type) {
|
||||||
|
case V4L2_CHIP_MATCH_AC97:
|
||||||
mutex_lock(&dev->lock);
|
mutex_lock(&dev->lock);
|
||||||
ret = em28xx_read_ac97(dev, reg->reg);
|
ret = em28xx_read_ac97(dev, reg->reg);
|
||||||
mutex_unlock(&dev->lock);
|
mutex_unlock(&dev->lock);
|
||||||
@ -1230,11 +1247,18 @@ static int vidioc_g_register(struct file *file, void *priv,
|
|||||||
|
|
||||||
reg->val = ret;
|
reg->val = ret;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
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))
|
if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Match host */
|
||||||
if (em28xx_reg_len(reg->reg) == 1) {
|
if (em28xx_reg_len(reg->reg) == 1) {
|
||||||
mutex_lock(&dev->lock);
|
mutex_lock(&dev->lock);
|
||||||
ret = em28xx_read_reg(dev, reg->reg);
|
ret = em28xx_read_reg(dev, reg->reg);
|
||||||
@ -1267,14 +1291,25 @@ static int vidioc_s_register(struct file *file, void *priv,
|
|||||||
__le64 buf;
|
__le64 buf;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (reg->match_type == V4L2_CHIP_MATCH_AC97) {
|
switch (reg->match_type) {
|
||||||
|
case V4L2_CHIP_MATCH_AC97:
|
||||||
mutex_lock(&dev->lock);
|
mutex_lock(&dev->lock);
|
||||||
rc = em28xx_write_ac97(dev, reg->reg, reg->val);
|
rc = em28xx_write_ac97(dev, reg->reg, reg->val);
|
||||||
mutex_unlock(&dev->lock);
|
mutex_unlock(&dev->lock);
|
||||||
|
|
||||||
return rc;
|
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);
|
buf = cpu_to_le64(reg->val);
|
||||||
|
|
||||||
mutex_lock(&dev->lock);
|
mutex_lock(&dev->lock);
|
||||||
@ -1927,6 +1962,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
|
|||||||
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
||||||
.vidioc_g_register = vidioc_g_register,
|
.vidioc_g_register = vidioc_g_register,
|
||||||
.vidioc_s_register = vidioc_s_register,
|
.vidioc_s_register = vidioc_s_register,
|
||||||
|
.vidioc_g_chip_ident = vidioc_g_chip_ident,
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_VIDEO_V4L1_COMPAT
|
#ifdef CONFIG_VIDEO_V4L1_COMPAT
|
||||||
.vidiocgmbuf = vidiocgmbuf,
|
.vidiocgmbuf = vidiocgmbuf,
|
||||||
|
Loading…
Reference in New Issue
Block a user