diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2007-02-24 01:27:26 +0100 |
---|---|---|
committer | Hans Verkuil <hverkuil@xs4all.nl> | 2007-02-24 01:27:26 +0100 |
commit | 2be3674b75c83865e9a131c6c54aaee005df47ed (patch) | |
tree | cc5e7a7c47afcd0254c0a40459f5c5629574c26e /linux/drivers/media/video/cx25840 | |
parent | f3e6f8836e980f471dbd3e9746a40199cd121f72 (diff) | |
download | mediapointer-dvb-s2-2be3674b75c83865e9a131c6c54aaee005df47ed.tar.gz mediapointer-dvb-s2-2be3674b75c83865e9a131c6c54aaee005df47ed.tar.bz2 |
Add support for VIDIOC_G_CHIP_IDENT
From: Hans Verkuil <hverkuil@xs4all.nl>
VIDIOC_G_CHIP_IDENT improves debugging of card problems: it can be
used to detect which chips are on the board and based on that information
selected register dumps can be made, making it easy to debug complicated
media chips containing tens or hundreds of registers.
This ioctl replaces the internal VIDIOC_INT_G_CHIP_IDENT ioctl.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
CC: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'linux/drivers/media/video/cx25840')
-rw-r--r-- | linux/drivers/media/video/cx25840/cx25840-core.c | 15 | ||||
-rw-r--r-- | linux/drivers/media/video/cx25840/cx25840-core.h | 3 |
2 files changed, 14 insertions, 4 deletions
diff --git a/linux/drivers/media/video/cx25840/cx25840-core.c b/linux/drivers/media/video/cx25840/cx25840-core.c index 5fafe6b23..d5a0789bc 100644 --- a/linux/drivers/media/video/cx25840/cx25840-core.c +++ b/linux/drivers/media/video/cx25840/cx25840-core.c @@ -35,6 +35,7 @@ #include <linux/videodev2.h> #include <linux/i2c.h> #include <media/v4l2-common.h> +#include <media/v4l2-chip-ident.h> #include <media/cx25840.h> #include "compat.h" #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) @@ -838,9 +839,16 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, cx25840_initialize(client, 0); break; - case VIDIOC_INT_G_CHIP_IDENT: - *(enum v4l2_chip_ident *)arg = state->id; + case VIDIOC_G_CHIP_IDENT: + { + struct v4l2_chip_ident *chip = arg; + + if (!v4l2_chip_match_i2c_client(client, chip->match_type, chip->match_chip)) + return -EINVAL; + chip->ident = state->id; + chip->revision = state->rev; break; + } default: return -EINVAL; @@ -861,7 +869,7 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address, { struct i2c_client *client; struct cx25840_state *state; - enum v4l2_chip_ident id; + u32 id; u16 device_id; /* Check if the adapter supports the needed features @@ -923,6 +931,7 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address, state->audmode = V4L2_TUNER_MODE_LANG1; state->vbi_line_offset = 8; state->id = id; + state->rev = device_id; i2c_attach_client(client); diff --git a/linux/drivers/media/video/cx25840/cx25840-core.h b/linux/drivers/media/video/cx25840/cx25840-core.h index 2bfedc95d..bcb624124 100644 --- a/linux/drivers/media/video/cx25840/cx25840-core.h +++ b/linux/drivers/media/video/cx25840/cx25840-core.h @@ -44,7 +44,8 @@ struct cx25840_state { u32 audclk_freq; int audmode; int vbi_line_offset; - enum v4l2_chip_ident id; + u32 id; + u32 rev; int is_cx25836; }; |