From 547bf60a782e5d6397e4ed6c001bd1ae0633d8f0 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 24 Feb 2007 00:55:14 +0100 Subject: Improve chip matching in v4l2_register for VIDIOC_DBG_G/S_REGISTER From: Hans Verkuil The chip matching in struct v4l2_register was rather primitive. It could not be extended to other busses besides i2c and it lacked a way to differentiate between two i2c chips driven by the same driver on one board (e.g. a PVR500 with two tuner chips, one for analog TV and one for radio). It has now been improved making it much more powerful. Signed-off-by: Hans Verkuil CC: Mike Isely CC: Trent Piepho --- linux/drivers/media/video/saa7127.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux/drivers/media/video/saa7127.c') diff --git a/linux/drivers/media/video/saa7127.c b/linux/drivers/media/video/saa7127.c index 89a889591..455c6f74a 100644 --- a/linux/drivers/media/video/saa7127.c +++ b/linux/drivers/media/video/saa7127.c @@ -631,7 +631,7 @@ static int saa7127_command(struct i2c_client *client, { struct v4l2_register *reg = arg; - if (reg->i2c_id != I2C_DRIVERID_SAA7127) + if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip)) return -EINVAL; if (!capable(CAP_SYS_ADMIN)) return -EPERM; -- cgit v1.2.3 From 2be3674b75c83865e9a131c6c54aaee005df47ed Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 24 Feb 2007 01:27:26 +0100 Subject: Add support for VIDIOC_G_CHIP_IDENT From: Hans Verkuil 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 CC: Jonathan Corbet --- linux/drivers/media/video/saa7127.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'linux/drivers/media/video/saa7127.c') diff --git a/linux/drivers/media/video/saa7127.c b/linux/drivers/media/video/saa7127.c index 455c6f74a..28306f15d 100644 --- a/linux/drivers/media/video/saa7127.c +++ b/linux/drivers/media/video/saa7127.c @@ -54,6 +54,7 @@ #include #include #include +#include #include #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #include "i2c-compat.h" @@ -246,7 +247,7 @@ static struct i2c_reg_value saa7127_init_config_50hz[] = { struct saa7127_state { v4l2_std_id std; - enum v4l2_chip_ident ident; + u32 ident; enum saa7127_input_type input_type; enum saa7127_output_type output_type; int video_enable; @@ -662,9 +663,16 @@ static int saa7127_command(struct i2c_client *client, break; } - case VIDIOC_INT_G_CHIP_IDENT: - *(enum v4l2_chip_ident *)arg = state->ident; + 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->ident; + chip->revision = 0; break; + } default: return -EINVAL; -- cgit v1.2.3