aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv/ivtv-driver.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-03-11 13:16:42 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-04-27 14:44:35 -0400
commitfee73165ee0ff7cfbffad4233a70f56b821f434e (patch)
tree2228c47e5540cd3b362a6ae4a40712a5573d9fe2 /drivers/media/video/ivtv/ivtv-driver.c
parent6816b1991fd4bcb457c9534e8136476e45bfee0a (diff)
V4L/DVB (5420): Initialize the inputs before registering the devices.
Once the devices have been registered anyone can start changing the inputs or TV standard before they have been initialized by the driver. This leads to cases were the input is changed in an udev rule, but after that rule is triggered the tail-end of the ivtv driver initialization can override that by selecting the tuner input. The correct sequence is to first setup the input, initial frequency and TV standard before finally registering the video devices. This prevents any udev rules from being triggered prematurely. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-driver.c')
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c77
1 files changed, 37 insertions, 40 deletions
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index d00811a820f7..c7648e2a3a67 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -1134,46 +1134,6 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
1134 if (itv->options.radio > 0) 1134 if (itv->options.radio > 0)
1135 itv->v4l2_cap |= V4L2_CAP_RADIO; 1135 itv->v4l2_cap |= V4L2_CAP_RADIO;
1136 1136
1137 retval = ivtv_streams_setup(itv);
1138 if (retval) {
1139 IVTV_ERR("Error %d setting up streams\n", retval);
1140 goto free_i2c;
1141 }
1142
1143 /* Start Threads */
1144 IVTV_DEBUG_INFO("Starting Threads\n");
1145
1146 /* Decoder Thread */
1147 if (itv->card->v4l2_capabilities & V4L2_CAP_VIDEO_OUTPUT) {
1148 ivtv_init_mpeg_decoder(itv);
1149 }
1150
1151 IVTV_DEBUG_IRQ("Masking interrupts\n");
1152 /* clear interrupt mask, effectively disabling interrupts */
1153 ivtv_set_irq_mask(itv, 0xffffffff);
1154
1155 /* Register IRQ */
1156 retval = request_irq(itv->dev->irq, ivtv_irq_handler,
1157 IRQF_SHARED | IRQF_DISABLED, itv->name, (void *)itv);
1158 if (retval) {
1159 IVTV_ERR("Failed to register irq %d\n", retval);
1160 goto free_streams;
1161 }
1162
1163 /* On a cx23416 this seems to be able to enable DMA to the chip? */
1164 if (!itv->has_cx23415)
1165 write_reg_sync(0x03, IVTV_REG_DMACONTROL);
1166
1167 /* Default interrupts enabled. For the PVR350 this includes the
1168 decoder VSYNC interrupt, which is always on. It is not only used
1169 during decoding but also by the OSD.
1170 Some old PVR250 cards had a cx23415, so testing for that is too
1171 general. Instead test if the card has video output capability. */
1172 if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)
1173 ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT | IVTV_IRQ_DEC_VSYNC);
1174 else
1175 ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT);
1176
1177 if (itv->options.tuner > -1) { 1137 if (itv->options.tuner > -1) {
1178 struct tuner_setup setup; 1138 struct tuner_setup setup;
1179 1139
@@ -1212,6 +1172,43 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
1212 itv->std_out = itv->std; 1172 itv->std_out = itv->std;
1213 ivtv_v4l2_ioctls(itv, NULL, VIDIOC_S_STD, &itv->tuner_std); 1173 ivtv_v4l2_ioctls(itv, NULL, VIDIOC_S_STD, &itv->tuner_std);
1214 ivtv_v4l2_ioctls(itv, NULL, VIDIOC_S_FREQUENCY, &vf); 1174 ivtv_v4l2_ioctls(itv, NULL, VIDIOC_S_FREQUENCY, &vf);
1175
1176 retval = ivtv_streams_setup(itv);
1177 if (retval) {
1178 IVTV_ERR("Error %d setting up streams\n", retval);
1179 goto free_i2c;
1180 }
1181
1182 if (itv->card->v4l2_capabilities & V4L2_CAP_VIDEO_OUTPUT) {
1183 ivtv_init_mpeg_decoder(itv);
1184 }
1185
1186 IVTV_DEBUG_IRQ("Masking interrupts\n");
1187 /* clear interrupt mask, effectively disabling interrupts */
1188 ivtv_set_irq_mask(itv, 0xffffffff);
1189
1190 /* Register IRQ */
1191 retval = request_irq(itv->dev->irq, ivtv_irq_handler,
1192 IRQF_SHARED | IRQF_DISABLED, itv->name, (void *)itv);
1193 if (retval) {
1194 IVTV_ERR("Failed to register irq %d\n", retval);
1195 goto free_streams;
1196 }
1197
1198 /* On a cx23416 this seems to be able to enable DMA to the chip? */
1199 if (!itv->has_cx23415)
1200 write_reg_sync(0x03, IVTV_REG_DMACONTROL);
1201
1202 /* Default interrupts enabled. For the PVR350 this includes the
1203 decoder VSYNC interrupt, which is always on. It is not only used
1204 during decoding but also by the OSD.
1205 Some old PVR250 cards had a cx23415, so testing for that is too
1206 general. Instead test if the card has video output capability. */
1207 if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)
1208 ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT | IVTV_IRQ_DEC_VSYNC);
1209 else
1210 ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT);
1211
1215 if (itv->has_cx23415) 1212 if (itv->has_cx23415)
1216 ivtv_set_osd_alpha(itv); 1213 ivtv_set_osd_alpha(itv);
1217 1214