[media] go7007: simplify the PX-TV402U board ID handling
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 11 Mar 2013 09:11:03 +0000 (06:11 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 24 Mar 2013 15:48:45 +0000 (12:48 -0300)
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>
drivers/staging/media/go7007/go7007-priv.h
drivers/staging/media/go7007/go7007-usb.c
drivers/staging/media/go7007/go7007-v4l2.c

index c2fafb2..a6ef67b 100644 (file)
@@ -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)
index 14d1cda..53c5b16 100644 (file)
@@ -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,
@@ -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;
@@ -1200,7 +1200,7 @@ 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");
@@ -1208,14 +1208,12 @@ static int go7007_usb_probe(struct usb_interface *intf,
                }
                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;
@@ -1223,7 +1221,6 @@ static int go7007_usb_probe(struct usb_interface *intf,
                                        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",
index 70a5274..4d9a998 100644 (file)
@@ -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);
 }