Skip to content

Commit

Permalink
[media] go7007: simplify the PX-TV402U board ID handling
Browse files Browse the repository at this point in the history
There really is no need to split out the board IDs for each tuner.
That's what the tuner_type is for, after all.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Mar 24, 2013
1 parent 35d2d76 commit 9ff76e3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 24 deletions.
15 changes: 6 additions & 9 deletions drivers/staging/media/go7007/go7007-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,12 @@ struct go7007;
#define GO7007_BOARDID_XMEN_II 5
#define GO7007_BOARDID_XMEN_III 6
#define GO7007_BOARDID_MATRIX_REV 7
#define GO7007_BOARDID_PX_M402U 16
#define GO7007_BOARDID_PX_TV402U_ANY 17 /* need to check tuner model */
#define GO7007_BOARDID_PX_TV402U_NA 18 /* detected NTSC tuner */
#define GO7007_BOARDID_PX_TV402U_EU 19 /* detected PAL tuner */
#define GO7007_BOARDID_PX_TV402U_JP 20 /* detected NTSC-J tuner */
#define GO7007_BOARDID_LIFEVIEW_LR192 21 /* TV Walker Ultra */
#define GO7007_BOARDID_ENDURA 22
#define GO7007_BOARDID_ADLINK_MPG24 23
#define GO7007_BOARDID_SENSORAY_2250 24 /* Sensoray 2250/2251 */
#define GO7007_BOARDID_PX_M402U 8
#define GO7007_BOARDID_PX_TV402U 9
#define GO7007_BOARDID_LIFEVIEW_LR192 10 /* TV Walker Ultra */
#define GO7007_BOARDID_ENDURA 11
#define GO7007_BOARDID_ADLINK_MPG24 12
#define GO7007_BOARDID_SENSORAY_2250 13 /* Sensoray 2250/2251 */

/* Various characteristics of each board */
#define GO7007_BOARD_HAS_AUDIO (1<<0)
Expand Down
9 changes: 3 additions & 6 deletions drivers/staging/media/go7007/go7007-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ static const struct usb_device_id go7007_usb_id_table[] = {
.idProduct = 0xa104, /* Product ID of TV402U */
.bcdDevice_lo = 0x1,
.bcdDevice_hi = 0x1,
.driver_info = (kernel_ulong_t)GO7007_BOARDID_PX_TV402U_ANY,
.driver_info = (kernel_ulong_t)GO7007_BOARDID_PX_TV402U,
},
{
.match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION,
Expand Down Expand Up @@ -1079,7 +1079,7 @@ static int go7007_usb_probe(struct usb_interface *intf,
name = "Plextor PX-M402U";
board = &board_matrix_ii;
break;
case GO7007_BOARDID_PX_TV402U_ANY:
case GO7007_BOARDID_PX_TV402U:
name = "Plextor PX-TV402U (unknown tuner)";
board = &board_px_tv402u;
break;
Expand Down Expand Up @@ -1200,30 +1200,27 @@ static int go7007_usb_probe(struct usb_interface *intf,
num_i2c_devs = go->board_info->num_i2c_devs;

/* Probe the tuner model on the TV402U */
if (go->board_id == GO7007_BOARDID_PX_TV402U_ANY) {
if (go->board_id == GO7007_BOARDID_PX_TV402U) {
/* Board strapping indicates tuner model */
if (go7007_usb_vendor_request(go, 0x41, 0, 0, go->usb_buf, 3, 1) < 0) {
printk(KERN_ERR "go7007-usb: GPIO read failed!\n");
goto initfail;
}
switch (go->usb_buf[0] >> 6) {
case 1:
go->board_id = GO7007_BOARDID_PX_TV402U_EU;
go->tuner_type = TUNER_SONY_BTF_PG472Z;
go->std = V4L2_STD_PAL;
strncpy(go->name, "Plextor PX-TV402U-EU",
sizeof(go->name));
break;
case 2:
go->board_id = GO7007_BOARDID_PX_TV402U_JP;
go->tuner_type = TUNER_SONY_BTF_PK467Z;
go->std = V4L2_STD_NTSC_M_JP;
num_i2c_devs -= 2;
strncpy(go->name, "Plextor PX-TV402U-JP",
sizeof(go->name));
break;
case 3:
go->board_id = GO7007_BOARDID_PX_TV402U_NA;
go->tuner_type = TUNER_SONY_BTF_PB463Z;
num_i2c_devs -= 2;
strncpy(go->name, "Plextor PX-TV402U-NA",
Expand Down
9 changes: 0 additions & 9 deletions drivers/staging/media/go7007/go7007-v4l2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1075,15 +1075,6 @@ static int vidioc_s_tuner(struct file *file, void *priv,
if (t->index != 0)
return -EINVAL;

switch (go->board_id) {
case GO7007_BOARDID_PX_TV402U_NA:
case GO7007_BOARDID_PX_TV402U_JP:
/* No selectable options currently */
if (t->audmode != V4L2_TUNER_MODE_STEREO)
return -EINVAL;
break;
}

return call_all(&go->v4l2_dev, tuner, s_tuner, t);
}

Expand Down

0 comments on commit 9ff76e3

Please sign in to comment.