In the absence of any more expert information, I looked into this more
myself, and am convinced that someone just got lost in this code and
the initialization that is under if (autoload) {} isn't supposed to be
there. Many things besides VBI fail to get initialized unless you
autoload.
The patch below fixes it. It also moves the ifdefs so the code is easier
to read.
The changes are much smaller than the patch makes it look, because of
indentation changes. All the patch does is put the autoload test on
the actual autoloads instead of a whole block of initialization, and
fold the ifdef into that test.
--
Bryan Henderson San Jose, California
This patch is to
http://ivtvdriver.org/svn/ivtv/branches/0.4
Index: driver/ivtv-driver.c
===================================================================
--- driver/ivtv-driver.c (revision 4097)
+++ driver/ivtv-driver.c (working copy)
@@ -868,6 +868,47 @@
}
}
+
+static int __devinit must_autoload_tveeprom(void) {
+#ifdef CONFIG_VIDEO_TVEEPROM
+ return autoload;
+#else
+ return 0;
+#endif
+}
+
+static int __devinit must_autoload_tuner(void) {
+#ifdef CONFIG_VIDEO_TUNER
+ return autoload;
+#else
+ return 0;
+#endif
+}
+
+static int __devinit must_autoload_decoder(void) {
+#ifdef CONFIG_VIDEO_DECODER
+ return autoload;
+#else
+ return 0;
+#endif
+}
+
+static int __devinit must_autoload_audio_decoder(void) {
+#ifdef CONFIG_VIDEO_AUDIO_DECODER
+ return autoload;
+#else
+ return 0;
+#endif
+}
+
+static int __devinit must_autoload_bt848(void) {
+#ifdef CONFIG_VIDEO_BT848
+ return autoload;
+#else
+ return 0;
+#endif
+}
+
static int __devinit ivtv_probe(struct pci_dev *dev,
const struct pci_device_id *pci_id)
{
@@ -1004,10 +1045,8 @@
case IVTV_CARD_PVR_150:
case IVTV_CARD_PVR_250:
case IVTV_CARD_PVR_350:
-#ifndef CONFIG_VIDEO_TVEEPROM
- if (autoload)
+ if (must_autoload_tveeprom())
ivtv_request_module(itv, "tveeprom");
-#endif /* CONFIG_VIDEO_TVEEPROM */
itv->hw_flags |= IVTV_HW_TVEEPROM;
// Based on the model number the cardtype may be changed.
// The PCI IDs are not always reliable.
@@ -1021,95 +1060,88 @@
// initialization.
ivtv_init_struct2(itv);
- if (autoload) {
-#ifndef CONFIG_VIDEO_TUNER
- ivtv_request_module(itv, "tuner");
-#endif /* CONFIG_VIDEO_TUNER */
- if (itv->card->type == IVTV_CARD_PVR_150 ||
- itv->card->type == IVTV_CARD_PG600) {
- struct v4l2_control ctrl;
+ if (must_autoload_tuner())
+ ivtv_request_module(itv, "tuner");
- ctrl.id = V4L2_CID_PRIVATE_BASE; /*
CX25840_CID_CARDTYPE */
- if (itv->card->type == IVTV_CARD_PG600)
- ctrl.value = 1;
- else
- ctrl.value = itv->pvr150_workaround ? 2 : 0;
+ if (itv->card->type == IVTV_CARD_PVR_150 ||
+ itv->card->type == IVTV_CARD_PG600) {
+ struct v4l2_control ctrl;
-#ifndef CONFIG_VIDEO_DECODER
- ivtv_request_module(itv, "cx25840");
-#endif /* CONFIG_VIDEO_DECODER */
- itv->card->video_dec_func(itv, VIDIOC_S_CTRL, &ctrl);
- itv->has_cx25840 = 1;
- itv->hw_flags |= IVTV_HW_CX25840;
- itv->vbi_raw_decoder_line_size = 1444;
- itv->vbi_raw_decoder_sav_odd_field = 0x20;
- itv->vbi_raw_decoder_sav_even_field = 0x60;
- itv->vbi_sliced_decoder_line_size = 272;
- itv->vbi_sliced_decoder_sav_odd_field = 0xB0;
- itv->vbi_sliced_decoder_sav_even_field = 0xF0;
- if (itv->card->type == IVTV_CARD_PVR_150) {
-#ifndef CONFIG_VIDEO_AUDIO_DECODER
- ivtv_request_module(itv, "wm8775");
-#endif /* CONFIG_VIDEO_AUDIO_DECODER */
- itv->hw_flags |= IVTV_HW_WM8775;
- }
- } else {
- enum v4l2_chip_ident v;
+ ctrl.id = V4L2_CID_PRIVATE_BASE; /* CX25840_CID_CARDTYPE */
+ if (itv->card->type == IVTV_CARD_PG600)
+ ctrl.value = 1;
+ else
+ ctrl.value = itv->pvr150_workaround ? 2 : 0;
-#ifndef CONFIG_VIDEO_DECODER
- ivtv_request_module(itv, "saa7115");
-#endif /* CONFIG_VIDEO_DECODER */
- ivtv_saa7115(itv, VIDIOC_INT_G_CHIP_IDENT, &v);
- if (v == V4L2_IDENT_SAA7114) {
- itv->has_saa7114 = 1;
- itv->hw_flags |= IVTV_HW_SAA7114;
- }
- else {
- itv->has_saa7115 = 1;
- itv->hw_flags |= IVTV_HW_SAA7115;
- }
- itv->vbi_raw_decoder_line_size = 1443;
- itv->vbi_raw_decoder_sav_odd_field = 0x25;
- itv->vbi_raw_decoder_sav_even_field = 0x62;
- itv->vbi_sliced_decoder_line_size = 51;
- itv->vbi_sliced_decoder_sav_odd_field = 0xAB;
- itv->vbi_sliced_decoder_sav_even_field = 0xEC;
- }
- if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) {
-#ifndef CONFIG_VIDEO_DECODER
- ivtv_request_module(itv, "saa7127");
-#endif /* CONFIG_VIDEO_DECODER */
- itv->hw_flags |= IVTV_HW_SAA7127;
- }
- if (itv->card->audio_selector == USE_MSP34XX) {
-#ifndef CONFIG_VIDEO_BT848
- ivtv_request_module(itv, "msp3400");
-#endif /* CONFIG_VIDEO_TUNER */
- itv->hw_flags |= IVTV_HW_MSP34XX;
- }
- if (itv->card->audio_selector == USE_CS53L32A ||
- itv->card->type == IVTV_CARD_AVC2410) {
-#ifndef CONFIG_VIDEO_AUDIO_DECODER
- ivtv_request_module(itv, "cs53l32a");
-#endif /* CONFIG_VIDEO_AUDIO_DECODER */
- itv->hw_flags |= IVTV_HW_CS53132A;
- }
- // -2 == autodetect, -1 == no tda9887
- if (itv->options.tda9887 != -1) {
-#ifndef CONFIG_VIDEO_TUNER
- ivtv_request_module(itv, "tda9887");
-#endif /* CONFIG_VIDEO_TUNER */
- }
- /* when tda9887 is loaded and detects the chip it will
- call attach_inform() in ivtv-i2c.c which will set the
- itv->has_tda9887 variable to 1. */
- if (itv->has_tda9887) {
- itv->hw_flags |= IVTV_HW_TDA9887;
- }
- if (itv->options.tda9887 == -2 && itv->has_tda9887)
- itv->options.tda9887 = 0;
- }
+ if (must_autoload_decoder())
+ ivtv_request_module(itv, "cx25840");
+ itv->card->video_dec_func(itv, VIDIOC_S_CTRL, &ctrl);
+ itv->has_cx25840 = 1;
+ itv->hw_flags |= IVTV_HW_CX25840;
+ itv->vbi_raw_decoder_line_size = 1444;
+ itv->vbi_raw_decoder_sav_odd_field = 0x20;
+ itv->vbi_raw_decoder_sav_even_field = 0x60;
+ itv->vbi_sliced_decoder_line_size = 272;
+ itv->vbi_sliced_decoder_sav_odd_field = 0xB0;
+ itv->vbi_sliced_decoder_sav_even_field = 0xF0;
+ if (itv->card->type == IVTV_CARD_PVR_150) {
+ if (must_autoload_audio_decoder())
+ ivtv_request_module(itv, "wm8775");
+ itv->hw_flags |= IVTV_HW_WM8775;
+ }
+ } else {
+ enum v4l2_chip_ident v;
+
+ if (must_autoload_decoder())
+ ivtv_request_module(itv, "saa7115");
+
+ ivtv_saa7115(itv, VIDIOC_INT_G_CHIP_IDENT, &v);
+ if (v == V4L2_IDENT_SAA7114) {
+ itv->has_saa7114 = 1;
+ itv->hw_flags |= IVTV_HW_SAA7114;
+ }
+ else {
+ itv->has_saa7115 = 1;
+ itv->hw_flags |= IVTV_HW_SAA7115;
+ }
+ itv->vbi_raw_decoder_line_size = 1443;
+ itv->vbi_raw_decoder_sav_odd_field = 0x25;
+ itv->vbi_raw_decoder_sav_even_field = 0x62;
+ itv->vbi_sliced_decoder_line_size = 51;
+ itv->vbi_sliced_decoder_sav_odd_field = 0xAB;
+ itv->vbi_sliced_decoder_sav_even_field = 0xEC;
+ }
+ if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) {
+ if (must_autoload_decoder())
+ ivtv_request_module(itv, "saa7127");
+ itv->hw_flags |= IVTV_HW_SAA7127;
+ }
+ if (itv->card->audio_selector == USE_MSP34XX) {
+ if (must_autoload_bt848())
+ ivtv_request_module(itv, "msp3400");
+ itv->hw_flags |= IVTV_HW_MSP34XX;
+ }
+ if (itv->card->audio_selector == USE_CS53L32A ||
+ itv->card->type == IVTV_CARD_AVC2410) {
+ if (must_autoload_audio_decoder())
+ ivtv_request_module(itv, "cs53l32a");
+ itv->hw_flags |= IVTV_HW_CS53132A;
+ }
+ // -2 == autodetect, -1 == no tda9887
+ if (itv->options.tda9887 != -1) {
+ if (must_autoload_tuner())
+ ivtv_request_module(itv, "tda9887");
+ }
+ /* when tda9887 is loaded and detects the chip it will
+ call attach_inform() in ivtv-i2c.c which will set the
+ itv->has_tda9887 variable to 1. */
+ if (itv->has_tda9887) {
+ itv->hw_flags |= IVTV_HW_TDA9887;
+ }
+ if (itv->options.tda9887 == -2 && itv->has_tda9887)
+ itv->options.tda9887 = 0;
+
if (itv->std <= 0) {
IVTV_ERR("Could not detect tuner standard, defaulting to
NTSC.\n");
itv->std = V4L2_STD_NTSC;
_______________________________________________
ivtv-devel mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-devel