Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
[pandora-kernel.git] / drivers / media / video / ivtv / ivtv-cards.c
index f23c6b8..4e05f91 100644 (file)
@@ -40,6 +40,8 @@
 #define MSP_MONO   MSP_INPUT(MSP_IN_MONO, MSP_IN_TUNER1, \
                                MSP_DSP_IN_SCART, MSP_DSP_IN_SCART)
 
+#define V4L2_STD_PAL_SECAM (V4L2_STD_PAL|V4L2_STD_SECAM)
+
 /* usual i2c tuner addresses to probe */
 static struct ivtv_card_tuner_i2c ivtv_i2c_std = {
        .radio = { I2C_CLIENT_END },
@@ -298,7 +300,7 @@ static const struct ivtv_card ivtv_card_mpg600 = {
        .gpio_audio_detect = { .mask = 0x0900, .stereo = 0x0100 },
        .tuners = {
                /* The PAL tuner is confirmed */
-               { .std = V4L2_STD_625_50, .tuner = TUNER_PHILIPS_FQ1216ME },
+               { .std = V4L2_STD_PAL_SECAM, .tuner = TUNER_PHILIPS_FQ1216ME },
                { .std = V4L2_STD_ALL, .tuner = TUNER_PHILIPS_FQ1286 },
        },
        .pci_list = ivtv_pci_mpg600,
@@ -339,7 +341,7 @@ static const struct ivtv_card ivtv_card_mpg160 = {
                              .lang1 = 0x0004, .lang2  = 0x0000, .both   = 0x0008 },
        .gpio_audio_detect = { .mask = 0x0900, .stereo = 0x0100 },
        .tuners = {
-               { .std = V4L2_STD_625_50, .tuner = TUNER_PHILIPS_FQ1216ME },
+               { .std = V4L2_STD_PAL_SECAM, .tuner = TUNER_PHILIPS_FQ1216ME },
                { .std = V4L2_STD_ALL, .tuner = TUNER_PHILIPS_FQ1286 },
        },
        .pci_list = ivtv_pci_mpg160,
@@ -375,7 +377,7 @@ static const struct ivtv_card ivtv_card_pg600 = {
                { IVTV_CARD_INPUT_LINE_IN1,   CX25840_AUDIO_SERIAL },
        },
        .tuners = {
-               { .std = V4L2_STD_625_50, .tuner = TUNER_PHILIPS_FQ1216ME },
+               { .std = V4L2_STD_PAL_SECAM, .tuner = TUNER_PHILIPS_FQ1216ME },
                { .std = V4L2_STD_ALL, .tuner = TUNER_PHILIPS_FQ1286 },
        },
        .pci_list = ivtv_pci_pg600,
@@ -416,11 +418,10 @@ static const struct ivtv_card ivtv_card_avc2410 = {
           on the country/region setting of the user to decide which tuner
           is available. */
        .tuners = {
-               /* This tuner has been verified for the AVC2410 */
-               { .std = V4L2_STD_625_50, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
-               /* This is a good guess, but I'm not totally sure this is
-                  the correct tuner for NTSC. */
-               { .std = V4L2_STD_ALL, .tuner = TUNER_PHILIPS_FM1236_MK3 },
+               { .std = V4L2_STD_PAL_SECAM, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
+               { .std = V4L2_STD_ALL - V4L2_STD_NTSC_M_JP,
+                       .tuner = TUNER_PHILIPS_FM1236_MK3 },
+               { .std = V4L2_STD_NTSC_M_JP, .tuner = TUNER_PHILIPS_FQ1286 },
        },
        .pci_list = ivtv_pci_avc2410,
        .i2c = &ivtv_i2c_std,
@@ -491,7 +492,7 @@ static const struct ivtv_card ivtv_card_tg5000tv = {
        .gpio_video_input  = { .mask = 0x0030, .tuner  = 0x0000,
                          .composite = 0x0010, .svideo = 0x0020 },
        .tuners = {
-               { .std = V4L2_STD_525_60, .tuner = TUNER_PHILIPS_FQ1286 },
+               { .std = V4L2_STD_MN, .tuner = TUNER_PHILIPS_FQ1286 },
        },
        .pci_list = ivtv_pci_tg5000tv,
        .i2c = &ivtv_i2c_std,
@@ -522,7 +523,7 @@ static const struct ivtv_card ivtv_card_va2000 = {
                { IVTV_CARD_INPUT_AUD_TUNER, MSP_TUNER },
        },
        .tuners = {
-               { .std = V4L2_STD_525_60, .tuner = TUNER_PHILIPS_FQ1286 },
+               { .std = V4L2_STD_MN, .tuner = TUNER_PHILIPS_FQ1286 },
        },
        .pci_list = ivtv_pci_va2000,
        .i2c = &ivtv_i2c_std,
@@ -566,7 +567,7 @@ static const struct ivtv_card ivtv_card_cx23416gyc = {
        .gpio_audio_freq   = { .mask = 0xc000, .f32000 = 0x0000,
                             .f44100 = 0x4000, .f48000 = 0x8000 },
        .tuners = {
-               { .std = V4L2_STD_625_50, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
+               { .std = V4L2_STD_PAL_SECAM, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
                { .std = V4L2_STD_ALL, .tuner = TUNER_PHILIPS_FM1236_MK3 },
        },
        .pci_list = ivtv_pci_cx23416gyc,
@@ -598,7 +599,7 @@ static const struct ivtv_card ivtv_card_cx23416gyc_nogr = {
        .gpio_audio_freq   = { .mask = 0xc000, .f32000 = 0x0000,
                             .f44100 = 0x4000, .f48000 = 0x8000 },
        .tuners = {
-               { .std = V4L2_STD_625_50, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
+               { .std = V4L2_STD_PAL_SECAM, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
                { .std = V4L2_STD_ALL, .tuner = TUNER_PHILIPS_FM1236_MK3 },
        },
        .i2c = &ivtv_i2c_std,
@@ -628,7 +629,7 @@ static const struct ivtv_card ivtv_card_cx23416gyc_nogrycs = {
        .gpio_audio_freq   = { .mask = 0xc000, .f32000 = 0x0000,
                             .f44100 = 0x4000, .f48000 = 0x8000 },
        .tuners = {
-               { .std = V4L2_STD_625_50, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
+               { .std = V4L2_STD_PAL_SECAM, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
                { .std = V4L2_STD_ALL, .tuner = TUNER_PHILIPS_FM1236_MK3 },
        },
        .i2c = &ivtv_i2c_std,
@@ -668,7 +669,7 @@ static const struct ivtv_card ivtv_card_gv_mvprx = {
        .gpio_audio_input  = { .mask = 0xffff, .tuner  = 0x0200, .linein = 0x0300 },
        .tuners = {
                /* This card has the Panasonic VP27 tuner */
-               { .std = V4L2_STD_525_60, .tuner = TUNER_PANASONIC_VP27 },
+               { .std = V4L2_STD_MN, .tuner = TUNER_PANASONIC_VP27 },
        },
        .pci_list = ivtv_pci_gv_mvprx,
        .i2c = &ivtv_i2c_std,
@@ -705,7 +706,7 @@ static const struct ivtv_card ivtv_card_gv_mvprx2e = {
        .gpio_audio_input  = { .mask = 0xffff, .tuner  = 0x0200, .linein = 0x0300 },
        .tuners = {
                /* This card has the Panasonic VP27 tuner */
-               { .std = V4L2_STD_525_60, .tuner = TUNER_PANASONIC_VP27 },
+               { .std = V4L2_STD_MN, .tuner = TUNER_PANASONIC_VP27 },
        },
        .pci_list = ivtv_pci_gv_mvprx2e,
        .i2c = &ivtv_i2c_std,
@@ -740,7 +741,7 @@ static const struct ivtv_card ivtv_card_gotview_pci_dvd = {
        .gpio_init = { .direction = 0xf000, .initial_value = 0xA000 },
        .tuners = {
                /* This card has a Philips FQ1216ME MK3 tuner */
-               { .std = V4L2_STD_625_50, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
+               { .std = V4L2_STD_PAL_SECAM, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
        },
        .pci_list = ivtv_pci_gotview_pci_dvd,
        .i2c = &ivtv_i2c_std,
@@ -779,7 +780,7 @@ static const struct ivtv_card ivtv_card_gotview_pci_dvd2 = {
        .gpio_audio_input  = { .mask = 0x0800, .tuner = 0, .linein = 0, .radio = 0x0800 },
        .tuners = {
                /* This card has a Philips FQ1216ME MK5 tuner */
-               { .std = V4L2_STD_625_50, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
+               { .std = V4L2_STD_PAL_SECAM, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
        },
        .pci_list = ivtv_pci_gotview_pci_dvd2,
        .i2c = &ivtv_i2c_std,
@@ -857,7 +858,7 @@ static const struct ivtv_card ivtv_card_dctmvtvp1 = {
        .gpio_video_input  = { .mask = 0x0030, .tuner  = 0x0000,
                               .composite = 0x0010, .svideo = 0x0020},
        .tuners = {
-               { .std = V4L2_STD_525_60, .tuner = TUNER_PHILIPS_FQ1286 },
+               { .std = V4L2_STD_MN, .tuner = TUNER_PHILIPS_FQ1286 },
        },
        .pci_list = ivtv_pci_dctmvtvp1,
        .i2c = &ivtv_i2c_std,
@@ -876,6 +877,7 @@ static const struct ivtv_card_pci_info ivtv_pci_pg600v2[] = {
 static const struct ivtv_card ivtv_card_pg600v2 = {
        .type = IVTV_CARD_PG600V2,
        .name = "Yuan PG600-2, GotView PCI DVD Lite",
+       .comment = "only Composite and S-Video inputs are supported, not the tuner\n",
        .v4l2_capabilities = IVTV_CAP_ENCODER,
        .hw_video = IVTV_HW_CX25840,
        .hw_audio = IVTV_HW_CX25840,
@@ -921,7 +923,7 @@ static const struct ivtv_card ivtv_card_club3d = {
                { IVTV_CARD_INPUT_LINE_IN1,   CX25840_AUDIO_SERIAL },
        },
        .radio_input = { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO5 },
-       .gpio_init = { .direction = 0x1000, .initial_value = 0x1000 }, /* tuner reset */
+       .xceive_pin = 12,
        .tuners = {
                { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
        },
@@ -945,15 +947,22 @@ static const struct ivtv_card ivtv_card_avertv_mce116 = {
        .hw_video = IVTV_HW_CX25840,
        .hw_audio = IVTV_HW_CX25840,
        .hw_audio_ctrl = IVTV_HW_CX25840,
-       .hw_all = IVTV_HW_CX25840 | IVTV_HW_WM8739,
+       .hw_all = IVTV_HW_CX25840 | IVTV_HW_TUNER | IVTV_HW_WM8739,
        .video_inputs = {
-               { IVTV_CARD_INPUT_SVIDEO1,    0, CX25840_SVIDEO3    },
-               { IVTV_CARD_INPUT_COMPOSITE1, 0, CX25840_COMPOSITE1 },
+               { IVTV_CARD_INPUT_VID_TUNER,  0, CX25840_COMPOSITE2 },
+               { IVTV_CARD_INPUT_SVIDEO1,    1, CX25840_SVIDEO3    },
+               { IVTV_CARD_INPUT_COMPOSITE1, 1, CX25840_COMPOSITE1 },
        },
        .audio_inputs = {
+               { IVTV_CARD_INPUT_AUD_TUNER,  CX25840_AUDIO5       },
                { IVTV_CARD_INPUT_LINE_IN1,   CX25840_AUDIO_SERIAL, 1 },
        },
-       .gpio_init = { .direction = 0xe000, .initial_value = 0x4000 }, /* enable line-in */
+       /* enable line-in */
+       .gpio_init = { .direction = 0xe000, .initial_value = 0x4000 },
+       .xceive_pin = 10,
+       .tuners = {
+               { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
+       },
        .pci_list = ivtv_pci_avertv_mce116,
        .i2c = &ivtv_i2c_std,
 };
@@ -991,7 +1000,7 @@ static const struct ivtv_card ivtv_card_aver_pvr150 = {
        .gpio_audio_input  = { .mask = 0x0800, .tuner = 0, .linein = 0, .radio = 0x0800 },
        .tuners = {
                /* This card has a Partsnic PTI-5NF05 tuner */
-               { .std = V4L2_STD_525_60, .tuner = TUNER_TCL_2002N },
+               { .std = V4L2_STD_MN, .tuner = TUNER_TCL_2002N },
        },
        .pci_list = ivtv_pci_aver_pvr150,
        .i2c = &ivtv_i2c_radio,
@@ -1059,12 +1068,83 @@ static const struct ivtv_card ivtv_card_asus_falcon2 = {
        },
        .radio_input = { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO_SERIAL, M52790_IN_TUNER },
        .tuners = {
-               { .std = V4L2_STD_525_60, .tuner = TUNER_PHILIPS_FM1236_MK3 },
+               { .std = V4L2_STD_MN, .tuner = TUNER_PHILIPS_FM1236_MK3 },
        },
        .pci_list = ivtv_pci_asus_falcon2,
        .i2c = &ivtv_i2c_std,
 };
 
+/* ------------------------------------------------------------------------- */
+
+/* AVerMedia M104 miniPCI card */
+
+static const struct ivtv_card_pci_info ivtv_pci_aver_m104[] = {
+       { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_AVERMEDIA, 0xc136 },
+       { 0, 0, 0 }
+};
+
+static const struct ivtv_card ivtv_card_aver_m104 = {
+       .type = IVTV_CARD_AVER_M104,
+       .name = "AVerMedia M104",
+       .comment = "Not yet supported!\n",
+       .v4l2_capabilities = 0, /*IVTV_CAP_ENCODER,*/
+       .hw_video = IVTV_HW_CX25840,
+       .hw_audio = IVTV_HW_CX25840,
+       .hw_audio_ctrl = IVTV_HW_CX25840,
+       .hw_all = IVTV_HW_CX25840 | IVTV_HW_TUNER | IVTV_HW_WM8739,
+       .video_inputs = {
+               { IVTV_CARD_INPUT_SVIDEO1,    0, CX25840_SVIDEO3    },
+               { IVTV_CARD_INPUT_COMPOSITE1, 0, CX25840_COMPOSITE1 },
+       },
+       .audio_inputs = {
+               { IVTV_CARD_INPUT_LINE_IN1,   CX25840_AUDIO_SERIAL, 1 },
+       },
+       .radio_input = { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO_SERIAL, 2 },
+       /* enable line-in + reset tuner */
+       .gpio_init = { .direction = 0xe000, .initial_value = 0x4000 },
+       .xceive_pin = 10,
+       .tuners = {
+               { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
+       },
+       .pci_list = ivtv_pci_aver_m104,
+       .i2c = &ivtv_i2c_std,
+};
+
+/* ------------------------------------------------------------------------- */
+
+/* Buffalo PC-MV5L/PCI cards */
+
+static const struct ivtv_card_pci_info ivtv_pci_buffalo[] = {
+       { PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_MELCO, 0x052b },
+       { 0, 0, 0 }
+};
+
+static const struct ivtv_card ivtv_card_buffalo = {
+       .type = IVTV_CARD_BUFFALO_MV5L,
+       .name = "Buffalo PC-MV5L/PCI",
+       .v4l2_capabilities = IVTV_CAP_ENCODER,
+       .hw_video = IVTV_HW_CX25840,
+       .hw_audio = IVTV_HW_CX25840,
+       .hw_audio_ctrl = IVTV_HW_CX25840,
+       .hw_all = IVTV_HW_CX25840 | IVTV_HW_TUNER,
+       .video_inputs = {
+               { IVTV_CARD_INPUT_VID_TUNER,  0, CX25840_COMPOSITE2 },
+               { IVTV_CARD_INPUT_SVIDEO1,    1,
+                       CX25840_SVIDEO_LUMA3 | CX25840_SVIDEO_CHROMA4 },
+               { IVTV_CARD_INPUT_COMPOSITE1, 1, CX25840_COMPOSITE1 },
+       },
+       .audio_inputs = {
+               { IVTV_CARD_INPUT_AUD_TUNER,  CX25840_AUDIO5       },
+               { IVTV_CARD_INPUT_LINE_IN1,   CX25840_AUDIO_SERIAL },
+       },
+       .xceive_pin = 12,
+       .tuners = {
+               { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
+       },
+       .pci_list = ivtv_pci_buffalo,
+       .i2c = &ivtv_i2c_std,
+};
+
 static const struct ivtv_card *ivtv_card_list[] = {
        &ivtv_card_pvr250,
        &ivtv_card_pvr350,
@@ -1090,6 +1170,8 @@ static const struct ivtv_card *ivtv_card_list[] = {
        &ivtv_card_asus_falcon2,
        &ivtv_card_aver_pvr150,
        &ivtv_card_aver_ezmaker,
+       &ivtv_card_aver_m104,
+       &ivtv_card_buffalo,
 
        /* Variations of standard cards but with the same PCI IDs.
           These cards must come last in this list. */
@@ -1121,7 +1203,8 @@ int ivtv_get_input(struct ivtv *itv, u16 index, struct v4l2_input *input)
        if (index >= itv->nof_inputs)
                return -EINVAL;
        input->index = index;
-       strcpy(input->name, input_strs[card_input->video_type - 1]);
+       strlcpy(input->name, input_strs[card_input->video_type - 1],
+                       sizeof(input->name));
        input->type = (card_input->video_type == IVTV_CARD_INPUT_VID_TUNER ?
                        V4L2_INPUT_TYPE_TUNER : V4L2_INPUT_TYPE_CAMERA);
        input->audioset = (1 << itv->nof_audio_inputs) - 1;
@@ -1138,7 +1221,7 @@ int ivtv_get_output(struct ivtv *itv, u16 index, struct v4l2_output *output)
        if (index >= itv->card->nof_outputs)
                return -EINVAL;
        output->index = index;
-       strcpy(output->name, card_output->name);
+       strlcpy(output->name, card_output->name, sizeof(output->name));
        output->type = V4L2_OUTPUT_TYPE_ANALOG;
        output->audioset = 1;
        output->std = V4L2_STD_ALL;
@@ -1157,7 +1240,8 @@ int ivtv_get_audio_input(struct ivtv *itv, u16 index, struct v4l2_audio *audio)
        memset(audio, 0, sizeof(*audio));
        if (index >= itv->nof_audio_inputs)
                return -EINVAL;
-       strcpy(audio->name, input_strs[aud_input->audio_type - 1]);
+       strlcpy(audio->name, input_strs[aud_input->audio_type - 1],
+                       sizeof(audio->name));
        audio->index = index;
        audio->capability = V4L2_AUDCAP_STEREO;
        return 0;
@@ -1168,6 +1252,6 @@ int ivtv_get_audio_output(struct ivtv *itv, u16 index, struct v4l2_audioout *aud
        memset(aud_output, 0, sizeof(*aud_output));
        if (itv->card->video_outputs == NULL || index != 0)
                return -EINVAL;
-       strcpy(aud_output->name, "A/V Audio Out");
+       strlcpy(aud_output->name, "A/V Audio Out", sizeof(aud_output->name));
        return 0;
 }