[media] go7007: add support for ADS Tech DVD Xpress DX2
authorHans Verkuil <hans.verkuil@cisco.com>
Sun, 17 Mar 2013 13:15:03 +0000 (10:15 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 24 Mar 2013 16:07:08 +0000 (13:07 -0300)
Taken from the 0.9.8-5 version of the out-of-tree wis-go7007 driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/staging/media/go7007/Kconfig
drivers/staging/media/go7007/go7007-driver.c
drivers/staging/media/go7007/go7007-priv.h
drivers/staging/media/go7007/go7007-usb.c
drivers/staging/media/go7007/go7007-v4l2.c

index 957277c4f06d107f03609b7dd55716b0be9c3588..b10f99684ffb0d5bd503aa1c0befb64dcc164c40 100644 (file)
@@ -9,6 +9,7 @@ config VIDEO_GO7007
        select VIDEO_SAA711X if MEDIA_SUBDRV_AUTOSELECT
        select VIDEO_TW2804 if MEDIA_SUBDRV_AUTOSELECT
        select VIDEO_TW9903 if MEDIA_SUBDRV_AUTOSELECT
+       select VIDEO_TW9906 if MEDIA_SUBDRV_AUTOSELECT
        select VIDEO_OV7640 if MEDIA_SUBDRV_AUTOSELECT
        select VIDEO_UDA1342 if MEDIA_SUBDRV_AUTOSELECT
        default N
index 3d7705eff1c5956cb7b64e7e01498961d4f07f5e..a5ca99d7c0b29bad2d13d392fa5ef881df541092 100644 (file)
@@ -166,15 +166,24 @@ static int go7007_init_encoder(struct go7007 *go)
                go7007_write_addr(go, 0x1000, 0x0811);
                go7007_write_addr(go, 0x1000, 0x0c11);
        }
-       if (go->board_id == GO7007_BOARDID_MATRIX_REV) {
+       switch (go->board_id) {
+       case GO7007_BOARDID_MATRIX_REV:
                /* Set GPIO pin 0 to be an output (audio clock control) */
                go7007_write_addr(go, 0x3c82, 0x0001);
                go7007_write_addr(go, 0x3c80, 0x00fe);
-       }
-       if (go->board_id == GO7007_BOARDID_ADLINK_MPG24) {
+               break;
+       case GO7007_BOARDID_ADLINK_MPG24:
                /* set GPIO5 to be an output, currently low */
                go7007_write_addr(go, 0x3c82, 0x0000);
                go7007_write_addr(go, 0x3c80, 0x00df);
+               break;
+       case GO7007_BOARDID_ADS_USBAV_709:
+               /* GPIO pin 0: audio clock control */
+               /*      pin 2: TW9906 reset */
+               /*      pin 3: capture LED */
+               go7007_write_addr(go, 0x3c82, 0x000d);
+               go7007_write_addr(go, 0x3c80, 0x00f2);
+               break;
        }
        return 0;
 }
@@ -282,6 +291,12 @@ int go7007_register_encoder(struct go7007 *go, unsigned num_i2c_devs)
                go->i2c_adapter_online = 1;
        }
        if (go->i2c_adapter_online) {
+               if (go->board_id == GO7007_BOARDID_ADS_USBAV_709) {
+                       /* Reset the TW9906 */
+                       go7007_write_addr(go, 0x3c82, 0x0009);
+                       msleep(50);
+                       go7007_write_addr(go, 0x3c82, 0x000d);
+               }
                for (i = 0; i < num_i2c_devs; ++i)
                        init_i2c_module(&go->i2c_adapter, &go->board_info->i2c_devs[i]);
 
index 31adc7074441d183dc55bdd1ae6b739288ffa561..8bde187e4f900f48b75250d1a8a59f6b6282af5e 100644 (file)
@@ -43,6 +43,7 @@ struct go7007;
 #define GO7007_BOARDID_ENDURA          11
 #define GO7007_BOARDID_ADLINK_MPG24    12
 #define GO7007_BOARDID_SENSORAY_2250   13 /* Sensoray 2250/2251 */
+#define GO7007_BOARDID_ADS_USBAV_709    14
 
 /* Various characteristics of each board */
 #define GO7007_BOARD_HAS_AUDIO         (1<<0)
index 31c18f5bbae7d2254a37b6c35d5856fda2c19ee7..08235069bde716cc48eac407b4e52103f280bd8c 100644 (file)
@@ -476,6 +476,43 @@ static const struct go7007_usb_board board_sensoray_2250 = {
        },
 };
 
+static const struct go7007_usb_board board_ads_usbav_709 = {
+       .flags          = GO7007_USB_EZUSB,
+       .main_info      = {
+               .flags           = GO7007_BOARD_HAS_AUDIO |
+                                       GO7007_BOARD_USE_ONBOARD_I2C,
+               .audio_flags     = GO7007_AUDIO_I2S_MODE_1 |
+                                       GO7007_AUDIO_I2S_MASTER |
+                                       GO7007_AUDIO_WORD_16,
+               .audio_rate      = 48000,
+               .audio_bclk_div  = 8,
+               .audio_main_div  = 2,
+               .hpi_buffer_cap  = 7,
+               .sensor_flags    = GO7007_SENSOR_656 |
+                                       GO7007_SENSOR_TV |
+                                       GO7007_SENSOR_VBI,
+               .num_i2c_devs    = 1,
+               .i2c_devs        = {
+                       {
+                               .type   = "tw9906",
+                               .is_video = 1,
+                               .addr   = 0x44,
+                       },
+               },
+               .num_inputs      = 2,
+               .inputs          = {
+                       {
+                               .video_input    = 0,
+                               .name           = "Composite",
+                       },
+                       {
+                               .video_input    = 10,
+                               .name           = "S-Video",
+                       },
+               },
+       },
+};
+
 static const struct usb_device_id go7007_usb_id_table[] = {
        {
                .match_flags    = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION |
@@ -577,6 +614,14 @@ static const struct usb_device_id go7007_usb_id_table[] = {
                .bcdDevice_hi   = 0x1,
                .driver_info    = (kernel_ulong_t)GO7007_BOARDID_SENSORAY_2250,
        },
+       {
+               .match_flags    = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION,
+               .idVendor       = 0x06e1,  /* Vendor ID of ADS Technologies */
+               .idProduct      = 0x0709,  /* Product ID of DVD Xpress DX2 */
+               .bcdDevice_lo   = 0x204,
+               .bcdDevice_hi   = 0x204,
+               .driver_info    = (kernel_ulong_t)GO7007_BOARDID_ADS_USBAV_709,
+       },
        { }                                     /* Terminating entry */
 };
 
@@ -1086,6 +1131,10 @@ static int go7007_usb_probe(struct usb_interface *intf,
                name = "Sensoray 2250/2251";
                board = &board_sensoray_2250;
                break;
+       case GO7007_BOARDID_ADS_USBAV_709:
+               name = "ADS Tech DVD Xpress DX2";
+               board = &board_ads_usbav_709;
+               break;
        default:
                printk(KERN_ERR "go7007-usb: unknown board ID %d!\n",
                                (unsigned int)id->driver_info);
index 45be5189e9446d07b73a7063b98dd9022e831da9..24ba50e5d82afdc177bdb1516ad74e804648b808 100644 (file)
@@ -512,6 +512,9 @@ static int go7007_start_streaming(struct vb2_queue *q, unsigned int count)
        v4l2_ctrl_grab(go->mpeg_video_gop_closure, true);
        v4l2_ctrl_grab(go->mpeg_video_bitrate, true);
        v4l2_ctrl_grab(go->mpeg_video_aspect_ratio, true);
+       /* Turn on Capture LED */
+       if (go->board_id == GO7007_BOARDID_ADS_USBAV_709)
+               go7007_write_addr(go, 0x3c82, 0x0005);
        return ret;
 }
 
@@ -534,6 +537,9 @@ static int go7007_stop_streaming(struct vb2_queue *q)
        v4l2_ctrl_grab(go->mpeg_video_gop_closure, false);
        v4l2_ctrl_grab(go->mpeg_video_bitrate, false);
        v4l2_ctrl_grab(go->mpeg_video_aspect_ratio, false);
+       /* Turn on Capture LED */
+       if (go->board_id == GO7007_BOARDID_ADS_USBAV_709)
+               go7007_write_addr(go, 0x3c82, 0x000d);
        return 0;
 }