diff options
Diffstat (limited to 'drivers/media/video/ivtv')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-driver.c | 10 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-driver.h | 1 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-fileops.c | 19 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-firmware.c | 11 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 142 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.h | 3 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-streams.c | 4 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-vbi.c | 2 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-version.h | 7 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtvfb.c | 33 |
10 files changed, 122 insertions, 110 deletions
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index a4e4dfdbc2f..0fb75524484 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
@@ -1328,6 +1328,8 @@ int ivtv_init_on_first_open(struct ivtv *itv) | |||
1328 | if (!itv->has_cx23415) | 1328 | if (!itv->has_cx23415) |
1329 | write_reg_sync(0x03, IVTV_REG_DMACONTROL); | 1329 | write_reg_sync(0x03, IVTV_REG_DMACONTROL); |
1330 | 1330 | ||
1331 | ivtv_s_std_enc(itv, &itv->tuner_std); | ||
1332 | |||
1331 | /* Default interrupts enabled. For the PVR350 this includes the | 1333 | /* Default interrupts enabled. For the PVR350 this includes the |
1332 | decoder VSYNC interrupt, which is always on. It is not only used | 1334 | decoder VSYNC interrupt, which is always on. It is not only used |
1333 | during decoding but also by the OSD. | 1335 | during decoding but also by the OSD. |
@@ -1336,12 +1338,10 @@ int ivtv_init_on_first_open(struct ivtv *itv) | |||
1336 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { | 1338 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { |
1337 | ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT | IVTV_IRQ_DEC_VSYNC); | 1339 | ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT | IVTV_IRQ_DEC_VSYNC); |
1338 | ivtv_set_osd_alpha(itv); | 1340 | ivtv_set_osd_alpha(itv); |
1339 | } | 1341 | ivtv_s_std_dec(itv, &itv->tuner_std); |
1340 | else | 1342 | } else { |
1341 | ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT); | 1343 | ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT); |
1342 | 1344 | } | |
1343 | /* For cards with video out, this call needs interrupts enabled */ | ||
1344 | ivtv_s_std(NULL, &fh, &itv->tuner_std); | ||
1345 | 1345 | ||
1346 | /* Setup initial controls */ | 1346 | /* Setup initial controls */ |
1347 | cx2341x_handler_setup(&itv->cxhdl); | 1347 | cx2341x_handler_setup(&itv->cxhdl); |
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h index 84bdf0f42a8..8f9cc17b518 100644 --- a/drivers/media/video/ivtv/ivtv-driver.h +++ b/drivers/media/video/ivtv/ivtv-driver.h | |||
@@ -36,7 +36,6 @@ | |||
36 | * using information provided by Jiun-Kuei Jung @ AVerMedia. | 36 | * using information provided by Jiun-Kuei Jung @ AVerMedia. |
37 | */ | 37 | */ |
38 | 38 | ||
39 | #include <linux/version.h> | ||
40 | #include <linux/module.h> | 39 | #include <linux/module.h> |
41 | #include <linux/init.h> | 40 | #include <linux/init.h> |
42 | #include <linux/delay.h> | 41 | #include <linux/delay.h> |
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c index a7f54b010a5..38f052257f4 100644 --- a/drivers/media/video/ivtv/ivtv-fileops.c +++ b/drivers/media/video/ivtv/ivtv-fileops.c | |||
@@ -722,8 +722,8 @@ unsigned int ivtv_v4l2_dec_poll(struct file *filp, poll_table *wait) | |||
722 | 722 | ||
723 | /* If there are subscribed events, then only use the new event | 723 | /* If there are subscribed events, then only use the new event |
724 | API instead of the old video.h based API. */ | 724 | API instead of the old video.h based API. */ |
725 | if (!list_empty(&id->fh.events->subscribed)) { | 725 | if (!list_empty(&id->fh.subscribed)) { |
726 | poll_wait(filp, &id->fh.events->wait, wait); | 726 | poll_wait(filp, &id->fh.wait, wait); |
727 | /* Turn off the old-style vsync events */ | 727 | /* Turn off the old-style vsync events */ |
728 | clear_bit(IVTV_F_I_EV_VSYNC_ENABLED, &itv->i_flags); | 728 | clear_bit(IVTV_F_I_EV_VSYNC_ENABLED, &itv->i_flags); |
729 | if (v4l2_event_pending(&id->fh)) | 729 | if (v4l2_event_pending(&id->fh)) |
@@ -750,6 +750,7 @@ unsigned int ivtv_v4l2_enc_poll(struct file *filp, poll_table * wait) | |||
750 | struct ivtv *itv = id->itv; | 750 | struct ivtv *itv = id->itv; |
751 | struct ivtv_stream *s = &itv->streams[id->type]; | 751 | struct ivtv_stream *s = &itv->streams[id->type]; |
752 | int eof = test_bit(IVTV_F_S_STREAMOFF, &s->s_flags); | 752 | int eof = test_bit(IVTV_F_S_STREAMOFF, &s->s_flags); |
753 | unsigned res = 0; | ||
753 | 754 | ||
754 | /* Start a capture if there is none */ | 755 | /* Start a capture if there is none */ |
755 | if (!eof && !test_bit(IVTV_F_S_STREAMING, &s->s_flags)) { | 756 | if (!eof && !test_bit(IVTV_F_S_STREAMING, &s->s_flags)) { |
@@ -769,12 +770,16 @@ unsigned int ivtv_v4l2_enc_poll(struct file *filp, poll_table * wait) | |||
769 | /* add stream's waitq to the poll list */ | 770 | /* add stream's waitq to the poll list */ |
770 | IVTV_DEBUG_HI_FILE("Encoder poll\n"); | 771 | IVTV_DEBUG_HI_FILE("Encoder poll\n"); |
771 | poll_wait(filp, &s->waitq, wait); | 772 | poll_wait(filp, &s->waitq, wait); |
773 | if (v4l2_event_pending(&id->fh)) | ||
774 | res |= POLLPRI; | ||
775 | else | ||
776 | poll_wait(filp, &id->fh.wait, wait); | ||
772 | 777 | ||
773 | if (s->q_full.length || s->q_io.length) | 778 | if (s->q_full.length || s->q_io.length) |
774 | return POLLIN | POLLRDNORM; | 779 | return res | POLLIN | POLLRDNORM; |
775 | if (eof) | 780 | if (eof) |
776 | return POLLHUP; | 781 | return res | POLLHUP; |
777 | return 0; | 782 | return res; |
778 | } | 783 | } |
779 | 784 | ||
780 | void ivtv_stop_capture(struct ivtv_open_id *id, int gop_end) | 785 | void ivtv_stop_capture(struct ivtv_open_id *id, int gop_end) |
@@ -961,10 +966,6 @@ static int ivtv_serialized_open(struct ivtv_stream *s, struct file *filp) | |||
961 | return -ENOMEM; | 966 | return -ENOMEM; |
962 | } | 967 | } |
963 | v4l2_fh_init(&item->fh, s->vdev); | 968 | v4l2_fh_init(&item->fh, s->vdev); |
964 | if (s->type == IVTV_DEC_STREAM_TYPE_YUV || | ||
965 | s->type == IVTV_DEC_STREAM_TYPE_MPG) { | ||
966 | res = v4l2_event_alloc(&item->fh, 60); | ||
967 | } | ||
968 | if (res < 0) { | 969 | if (res < 0) { |
969 | v4l2_fh_exit(&item->fh); | 970 | v4l2_fh_exit(&item->fh); |
970 | kfree(item); | 971 | kfree(item); |
diff --git a/drivers/media/video/ivtv/ivtv-firmware.c b/drivers/media/video/ivtv/ivtv-firmware.c index 14a1cea1d70..02c5adebf51 100644 --- a/drivers/media/video/ivtv/ivtv-firmware.c +++ b/drivers/media/video/ivtv/ivtv-firmware.c | |||
@@ -280,8 +280,6 @@ int ivtv_firmware_restart(struct ivtv *itv) | |||
280 | { | 280 | { |
281 | int rc = 0; | 281 | int rc = 0; |
282 | v4l2_std_id std; | 282 | v4l2_std_id std; |
283 | struct ivtv_open_id fh; | ||
284 | fh.itv = itv; | ||
285 | 283 | ||
286 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) | 284 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) |
287 | /* Display test image during restart */ | 285 | /* Display test image during restart */ |
@@ -301,14 +299,19 @@ int ivtv_firmware_restart(struct ivtv *itv) | |||
301 | /* Allow settings to reload */ | 299 | /* Allow settings to reload */ |
302 | ivtv_mailbox_cache_invalidate(itv); | 300 | ivtv_mailbox_cache_invalidate(itv); |
303 | 301 | ||
304 | /* Restore video standard */ | 302 | /* Restore encoder video standard */ |
305 | std = itv->std; | 303 | std = itv->std; |
306 | itv->std = 0; | 304 | itv->std = 0; |
307 | ivtv_s_std(NULL, &fh, &std); | 305 | ivtv_s_std_enc(itv, &std); |
308 | 306 | ||
309 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { | 307 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { |
310 | ivtv_init_mpeg_decoder(itv); | 308 | ivtv_init_mpeg_decoder(itv); |
311 | 309 | ||
310 | /* Restore decoder video standard */ | ||
311 | std = itv->std_out; | ||
312 | itv->std_out = 0; | ||
313 | ivtv_s_std_dec(itv, &std); | ||
314 | |||
312 | /* Restore framebuffer if active */ | 315 | /* Restore framebuffer if active */ |
313 | if (itv->ivtvfb_restore) | 316 | if (itv->ivtvfb_restore) |
314 | itv->ivtvfb_restore(itv); | 317 | itv->ivtvfb_restore(itv); |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 1689783cd19..3e5c090af11 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -757,7 +757,6 @@ static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vc | |||
757 | strlcpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver)); | 757 | strlcpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver)); |
758 | strlcpy(vcap->card, itv->card_name, sizeof(vcap->card)); | 758 | strlcpy(vcap->card, itv->card_name, sizeof(vcap->card)); |
759 | snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(itv->pdev)); | 759 | snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(itv->pdev)); |
760 | vcap->version = IVTV_DRIVER_VERSION; /* version */ | ||
761 | vcap->capabilities = itv->v4l2_cap; /* capabilities */ | 760 | vcap->capabilities = itv->v4l2_cap; /* capabilities */ |
762 | return 0; | 761 | return 0; |
763 | } | 762 | } |
@@ -1071,28 +1070,8 @@ static int ivtv_g_std(struct file *file, void *fh, v4l2_std_id *std) | |||
1071 | return 0; | 1070 | return 0; |
1072 | } | 1071 | } |
1073 | 1072 | ||
1074 | int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std) | 1073 | void ivtv_s_std_enc(struct ivtv *itv, v4l2_std_id *std) |
1075 | { | 1074 | { |
1076 | DEFINE_WAIT(wait); | ||
1077 | struct ivtv *itv = fh2id(fh)->itv; | ||
1078 | struct yuv_playback_info *yi = &itv->yuv_info; | ||
1079 | int f; | ||
1080 | |||
1081 | if ((*std & V4L2_STD_ALL) == 0) | ||
1082 | return -EINVAL; | ||
1083 | |||
1084 | if (*std == itv->std) | ||
1085 | return 0; | ||
1086 | |||
1087 | if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) || | ||
1088 | atomic_read(&itv->capturing) > 0 || | ||
1089 | atomic_read(&itv->decoding) > 0) { | ||
1090 | /* Switching standard would turn off the radio or mess | ||
1091 | with already running streams, prevent that by | ||
1092 | returning EBUSY. */ | ||
1093 | return -EBUSY; | ||
1094 | } | ||
1095 | |||
1096 | itv->std = *std; | 1075 | itv->std = *std; |
1097 | itv->is_60hz = (*std & V4L2_STD_525_60) ? 1 : 0; | 1076 | itv->is_60hz = (*std & V4L2_STD_525_60) ? 1 : 0; |
1098 | itv->is_50hz = !itv->is_60hz; | 1077 | itv->is_50hz = !itv->is_60hz; |
@@ -1106,48 +1085,79 @@ int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std) | |||
1106 | if (itv->hw_flags & IVTV_HW_CX25840) | 1085 | if (itv->hw_flags & IVTV_HW_CX25840) |
1107 | itv->vbi.sliced_decoder_line_size = itv->is_60hz ? 272 : 284; | 1086 | itv->vbi.sliced_decoder_line_size = itv->is_60hz ? 272 : 284; |
1108 | 1087 | ||
1109 | IVTV_DEBUG_INFO("Switching standard to %llx.\n", (unsigned long long)itv->std); | ||
1110 | |||
1111 | /* Tuner */ | 1088 | /* Tuner */ |
1112 | ivtv_call_all(itv, core, s_std, itv->std); | 1089 | ivtv_call_all(itv, core, s_std, itv->std); |
1090 | } | ||
1113 | 1091 | ||
1114 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { | 1092 | void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id *std) |
1115 | /* set display standard */ | 1093 | { |
1116 | itv->std_out = *std; | 1094 | struct yuv_playback_info *yi = &itv->yuv_info; |
1117 | itv->is_out_60hz = itv->is_60hz; | 1095 | DEFINE_WAIT(wait); |
1118 | itv->is_out_50hz = itv->is_50hz; | 1096 | int f; |
1119 | ivtv_call_all(itv, video, s_std_output, itv->std_out); | 1097 | |
1120 | 1098 | /* set display standard */ | |
1121 | /* | 1099 | itv->std_out = *std; |
1122 | * The next firmware call is time sensitive. Time it to | 1100 | itv->is_out_60hz = (*std & V4L2_STD_525_60) ? 1 : 0; |
1123 | * avoid risk of a hard lock, by trying to ensure the call | 1101 | itv->is_out_50hz = !itv->is_out_60hz; |
1124 | * happens within the first 100 lines of the top field. | 1102 | ivtv_call_all(itv, video, s_std_output, itv->std_out); |
1125 | * Make 4 attempts to sync to the decoder before giving up. | 1103 | |
1126 | */ | 1104 | /* |
1127 | for (f = 0; f < 4; f++) { | 1105 | * The next firmware call is time sensitive. Time it to |
1128 | prepare_to_wait(&itv->vsync_waitq, &wait, | 1106 | * avoid risk of a hard lock, by trying to ensure the call |
1129 | TASK_UNINTERRUPTIBLE); | 1107 | * happens within the first 100 lines of the top field. |
1130 | if ((read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16) < 100) | 1108 | * Make 4 attempts to sync to the decoder before giving up. |
1131 | break; | 1109 | */ |
1132 | schedule_timeout(msecs_to_jiffies(25)); | 1110 | for (f = 0; f < 4; f++) { |
1133 | } | 1111 | prepare_to_wait(&itv->vsync_waitq, &wait, |
1134 | finish_wait(&itv->vsync_waitq, &wait); | 1112 | TASK_UNINTERRUPTIBLE); |
1135 | 1113 | if ((read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16) < 100) | |
1136 | if (f == 4) | 1114 | break; |
1137 | IVTV_WARN("Mode change failed to sync to decoder\n"); | 1115 | schedule_timeout(msecs_to_jiffies(25)); |
1138 | 1116 | } | |
1139 | ivtv_vapi(itv, CX2341X_DEC_SET_STANDARD, 1, itv->is_out_50hz); | 1117 | finish_wait(&itv->vsync_waitq, &wait); |
1140 | itv->main_rect.left = itv->main_rect.top = 0; | 1118 | |
1141 | itv->main_rect.width = 720; | 1119 | if (f == 4) |
1142 | itv->main_rect.height = itv->cxhdl.height; | 1120 | IVTV_WARN("Mode change failed to sync to decoder\n"); |
1143 | ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4, | 1121 | |
1144 | 720, itv->main_rect.height, 0, 0); | 1122 | ivtv_vapi(itv, CX2341X_DEC_SET_STANDARD, 1, itv->is_out_50hz); |
1145 | yi->main_rect = itv->main_rect; | 1123 | itv->main_rect.left = 0; |
1146 | if (!itv->osd_info) { | 1124 | itv->main_rect.top = 0; |
1147 | yi->osd_full_w = 720; | 1125 | itv->main_rect.width = 720; |
1148 | yi->osd_full_h = itv->is_out_50hz ? 576 : 480; | 1126 | itv->main_rect.height = itv->is_out_50hz ? 576 : 480; |
1149 | } | 1127 | ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4, |
1128 | 720, itv->main_rect.height, 0, 0); | ||
1129 | yi->main_rect = itv->main_rect; | ||
1130 | if (!itv->osd_info) { | ||
1131 | yi->osd_full_w = 720; | ||
1132 | yi->osd_full_h = itv->is_out_50hz ? 576 : 480; | ||
1150 | } | 1133 | } |
1134 | } | ||
1135 | |||
1136 | int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std) | ||
1137 | { | ||
1138 | struct ivtv *itv = fh2id(fh)->itv; | ||
1139 | |||
1140 | if ((*std & V4L2_STD_ALL) == 0) | ||
1141 | return -EINVAL; | ||
1142 | |||
1143 | if (*std == itv->std) | ||
1144 | return 0; | ||
1145 | |||
1146 | if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) || | ||
1147 | atomic_read(&itv->capturing) > 0 || | ||
1148 | atomic_read(&itv->decoding) > 0) { | ||
1149 | /* Switching standard would mess with already running | ||
1150 | streams, prevent that by returning EBUSY. */ | ||
1151 | return -EBUSY; | ||
1152 | } | ||
1153 | |||
1154 | IVTV_DEBUG_INFO("Switching standard to %llx.\n", | ||
1155 | (unsigned long long)itv->std); | ||
1156 | |||
1157 | ivtv_s_std_enc(itv, std); | ||
1158 | if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) | ||
1159 | ivtv_s_std_dec(itv, std); | ||
1160 | |||
1151 | return 0; | 1161 | return 0; |
1152 | } | 1162 | } |
1153 | 1163 | ||
@@ -1173,14 +1183,10 @@ static int ivtv_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) | |||
1173 | 1183 | ||
1174 | ivtv_call_all(itv, tuner, g_tuner, vt); | 1184 | ivtv_call_all(itv, tuner, g_tuner, vt); |
1175 | 1185 | ||
1176 | if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags)) { | 1186 | if (vt->type == V4L2_TUNER_RADIO) |
1177 | strlcpy(vt->name, "ivtv Radio Tuner", sizeof(vt->name)); | 1187 | strlcpy(vt->name, "ivtv Radio Tuner", sizeof(vt->name)); |
1178 | vt->type = V4L2_TUNER_RADIO; | 1188 | else |
1179 | } else { | ||
1180 | strlcpy(vt->name, "ivtv TV Tuner", sizeof(vt->name)); | 1189 | strlcpy(vt->name, "ivtv TV Tuner", sizeof(vt->name)); |
1181 | vt->type = V4L2_TUNER_ANALOG_TV; | ||
1182 | } | ||
1183 | |||
1184 | return 0; | 1190 | return 0; |
1185 | } | 1191 | } |
1186 | 1192 | ||
@@ -1444,11 +1450,11 @@ static int ivtv_subscribe_event(struct v4l2_fh *fh, struct v4l2_event_subscripti | |||
1444 | switch (sub->type) { | 1450 | switch (sub->type) { |
1445 | case V4L2_EVENT_VSYNC: | 1451 | case V4L2_EVENT_VSYNC: |
1446 | case V4L2_EVENT_EOS: | 1452 | case V4L2_EVENT_EOS: |
1447 | break; | 1453 | case V4L2_EVENT_CTRL: |
1454 | return v4l2_event_subscribe(fh, sub, 0); | ||
1448 | default: | 1455 | default: |
1449 | return -EINVAL; | 1456 | return -EINVAL; |
1450 | } | 1457 | } |
1451 | return v4l2_event_subscribe(fh, sub); | ||
1452 | } | 1458 | } |
1453 | 1459 | ||
1454 | static int ivtv_log_status(struct file *file, void *fh) | 1460 | static int ivtv_log_status(struct file *file, void *fh) |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.h b/drivers/media/video/ivtv/ivtv-ioctl.h index 58f003412af..89185caeafa 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.h +++ b/drivers/media/video/ivtv/ivtv-ioctl.h | |||
@@ -27,7 +27,8 @@ u16 ivtv_get_service_set(struct v4l2_sliced_vbi_format *fmt); | |||
27 | void ivtv_set_osd_alpha(struct ivtv *itv); | 27 | void ivtv_set_osd_alpha(struct ivtv *itv); |
28 | int ivtv_set_speed(struct ivtv *itv, int speed); | 28 | int ivtv_set_speed(struct ivtv *itv, int speed); |
29 | void ivtv_set_funcs(struct video_device *vdev); | 29 | void ivtv_set_funcs(struct video_device *vdev); |
30 | int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std); | 30 | void ivtv_s_std_enc(struct ivtv *itv, v4l2_std_id *std); |
31 | void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id *std); | ||
31 | int ivtv_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf); | 32 | int ivtv_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf); |
32 | int ivtv_s_input(struct file *file, void *fh, unsigned int inp); | 33 | int ivtv_s_input(struct file *file, void *fh, unsigned int inp); |
33 | long ivtv_v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); | 34 | long ivtv_v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); |
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index 94268333655..e7794dc1330 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c | |||
@@ -589,7 +589,7 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s) | |||
589 | v4l2_subdev_call(itv->sd_audio, audio, s_stream, 1); | 589 | v4l2_subdev_call(itv->sd_audio, audio, s_stream, 1); |
590 | /* Avoid unpredictable PCI bus hang - disable video clocks */ | 590 | /* Avoid unpredictable PCI bus hang - disable video clocks */ |
591 | v4l2_subdev_call(itv->sd_video, video, s_stream, 0); | 591 | v4l2_subdev_call(itv->sd_video, video, s_stream, 0); |
592 | ivtv_msleep_timeout(300, 1); | 592 | ivtv_msleep_timeout(300, 0); |
593 | ivtv_vapi(itv, CX2341X_ENC_INITIALIZE_INPUT, 0); | 593 | ivtv_vapi(itv, CX2341X_ENC_INITIALIZE_INPUT, 0); |
594 | v4l2_subdev_call(itv->sd_video, video, s_stream, 1); | 594 | v4l2_subdev_call(itv->sd_video, video, s_stream, 1); |
595 | } | 595 | } |
@@ -834,7 +834,7 @@ int ivtv_stop_v4l2_encode_stream(struct ivtv_stream *s, int gop_end) | |||
834 | } | 834 | } |
835 | 835 | ||
836 | /* Handle any pending interrupts */ | 836 | /* Handle any pending interrupts */ |
837 | ivtv_msleep_timeout(100, 1); | 837 | ivtv_msleep_timeout(100, 0); |
838 | } | 838 | } |
839 | 839 | ||
840 | atomic_dec(&itv->capturing); | 840 | atomic_dec(&itv->capturing); |
diff --git a/drivers/media/video/ivtv/ivtv-vbi.c b/drivers/media/video/ivtv/ivtv-vbi.c index b6eb51ce773..293db806d93 100644 --- a/drivers/media/video/ivtv/ivtv-vbi.c +++ b/drivers/media/video/ivtv/ivtv-vbi.c | |||
@@ -71,7 +71,7 @@ static void ivtv_set_wss(struct ivtv *itv, int enabled, int mode) | |||
71 | Turning this signal on and off can confuse certain | 71 | Turning this signal on and off can confuse certain |
72 | TVs. As far as I can tell there is no reason not to | 72 | TVs. As far as I can tell there is no reason not to |
73 | transmit this signal. */ | 73 | transmit this signal. */ |
74 | if ((itv->std & V4L2_STD_625_50) && !enabled) { | 74 | if ((itv->std_out & V4L2_STD_625_50) && !enabled) { |
75 | enabled = 1; | 75 | enabled = 1; |
76 | mode = 0x08; /* 4x3 full format */ | 76 | mode = 0x08; /* 4x3 full format */ |
77 | } | 77 | } |
diff --git a/drivers/media/video/ivtv/ivtv-version.h b/drivers/media/video/ivtv/ivtv-version.h index b67a4048f5a..a20f346fcad 100644 --- a/drivers/media/video/ivtv/ivtv-version.h +++ b/drivers/media/video/ivtv/ivtv-version.h | |||
@@ -21,11 +21,6 @@ | |||
21 | #define IVTV_VERSION_H | 21 | #define IVTV_VERSION_H |
22 | 22 | ||
23 | #define IVTV_DRIVER_NAME "ivtv" | 23 | #define IVTV_DRIVER_NAME "ivtv" |
24 | #define IVTV_DRIVER_VERSION_MAJOR 1 | 24 | #define IVTV_VERSION "1.4.3" |
25 | #define IVTV_DRIVER_VERSION_MINOR 4 | ||
26 | #define IVTV_DRIVER_VERSION_PATCHLEVEL 2 | ||
27 | |||
28 | #define IVTV_VERSION __stringify(IVTV_DRIVER_VERSION_MAJOR) "." __stringify(IVTV_DRIVER_VERSION_MINOR) "." __stringify(IVTV_DRIVER_VERSION_PATCHLEVEL) | ||
29 | #define IVTV_DRIVER_VERSION KERNEL_VERSION(IVTV_DRIVER_VERSION_MAJOR,IVTV_DRIVER_VERSION_MINOR,IVTV_DRIVER_VERSION_PATCHLEVEL) | ||
30 | 25 | ||
31 | #endif | 26 | #endif |
diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c index 17247451c69..6b7c9c82333 100644 --- a/drivers/media/video/ivtv/ivtvfb.c +++ b/drivers/media/video/ivtv/ivtvfb.c | |||
@@ -247,7 +247,7 @@ static int ivtvfb_set_osd_coords(struct ivtv *itv, const struct ivtv_osd_coords | |||
247 | 247 | ||
248 | static int ivtvfb_set_display_window(struct ivtv *itv, struct v4l2_rect *ivtv_window) | 248 | static int ivtvfb_set_display_window(struct ivtv *itv, struct v4l2_rect *ivtv_window) |
249 | { | 249 | { |
250 | int osd_height_limit = itv->is_50hz ? 576 : 480; | 250 | int osd_height_limit = itv->is_out_50hz ? 576 : 480; |
251 | 251 | ||
252 | /* Only fail if resolution too high, otherwise fudge the start coords. */ | 252 | /* Only fail if resolution too high, otherwise fudge the start coords. */ |
253 | if ((ivtv_window->height > osd_height_limit) || (ivtv_window->width > IVTV_OSD_MAX_WIDTH)) | 253 | if ((ivtv_window->height > osd_height_limit) || (ivtv_window->width > IVTV_OSD_MAX_WIDTH)) |
@@ -471,9 +471,9 @@ static int ivtvfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long ar | |||
471 | vblank.flags = FB_VBLANK_HAVE_COUNT |FB_VBLANK_HAVE_VCOUNT | | 471 | vblank.flags = FB_VBLANK_HAVE_COUNT |FB_VBLANK_HAVE_VCOUNT | |
472 | FB_VBLANK_HAVE_VSYNC; | 472 | FB_VBLANK_HAVE_VSYNC; |
473 | trace = read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16; | 473 | trace = read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16; |
474 | if (itv->is_50hz && trace > 312) | 474 | if (itv->is_out_50hz && trace > 312) |
475 | trace -= 312; | 475 | trace -= 312; |
476 | else if (itv->is_60hz && trace > 262) | 476 | else if (itv->is_out_60hz && trace > 262) |
477 | trace -= 262; | 477 | trace -= 262; |
478 | if (trace == 1) | 478 | if (trace == 1) |
479 | vblank.flags |= FB_VBLANK_VSYNCING; | 479 | vblank.flags |= FB_VBLANK_VSYNCING; |
@@ -656,7 +656,7 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv) | |||
656 | IVTVFB_DEBUG_INFO("ivtvfb_check_var\n"); | 656 | IVTVFB_DEBUG_INFO("ivtvfb_check_var\n"); |
657 | 657 | ||
658 | /* Set base references for mode calcs. */ | 658 | /* Set base references for mode calcs. */ |
659 | if (itv->is_50hz) { | 659 | if (itv->is_out_50hz) { |
660 | pixclock = 84316; | 660 | pixclock = 84316; |
661 | hlimit = 776; | 661 | hlimit = 776; |
662 | vlimit = 591; | 662 | vlimit = 591; |
@@ -784,12 +784,12 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv) | |||
784 | If the margins are too large, just center the screen | 784 | If the margins are too large, just center the screen |
785 | (enforcing margins causes too many problems) */ | 785 | (enforcing margins causes too many problems) */ |
786 | 786 | ||
787 | if (var->left_margin + var->xres > IVTV_OSD_MAX_WIDTH + 1) { | 787 | if (var->left_margin + var->xres > IVTV_OSD_MAX_WIDTH + 1) |
788 | var->left_margin = 1 + ((IVTV_OSD_MAX_WIDTH - var->xres) / 2); | 788 | var->left_margin = 1 + ((IVTV_OSD_MAX_WIDTH - var->xres) / 2); |
789 | } | 789 | |
790 | if (var->upper_margin + var->yres > (itv->is_50hz ? 577 : 481)) { | 790 | if (var->upper_margin + var->yres > (itv->is_out_50hz ? 577 : 481)) |
791 | var->upper_margin = 1 + (((itv->is_50hz ? 576 : 480) - var->yres) / 2); | 791 | var->upper_margin = 1 + (((itv->is_out_50hz ? 576 : 480) - |
792 | } | 792 | var->yres) / 2); |
793 | 793 | ||
794 | /* Maintain overall 'size' for a constant refresh rate */ | 794 | /* Maintain overall 'size' for a constant refresh rate */ |
795 | var->right_margin = hlimit - var->left_margin - var->xres; | 795 | var->right_margin = hlimit - var->left_margin - var->xres; |
@@ -836,7 +836,12 @@ static int ivtvfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *inf | |||
836 | u32 osd_pan_index; | 836 | u32 osd_pan_index; |
837 | struct ivtv *itv = (struct ivtv *) info->par; | 837 | struct ivtv *itv = (struct ivtv *) info->par; |
838 | 838 | ||
839 | osd_pan_index = (var->xoffset + (var->yoffset * var->xres_virtual))*var->bits_per_pixel/8; | 839 | if (var->yoffset + info->var.yres > info->var.yres_virtual || |
840 | var->xoffset + info->var.xres > info->var.xres_virtual) | ||
841 | return -EINVAL; | ||
842 | |||
843 | osd_pan_index = var->yoffset * info->fix.line_length | ||
844 | + var->xoffset * info->var.bits_per_pixel / 8; | ||
840 | write_reg(osd_pan_index, 0x02A0C); | 845 | write_reg(osd_pan_index, 0x02A0C); |
841 | 846 | ||
842 | /* Pass this info back the yuv handler */ | 847 | /* Pass this info back the yuv handler */ |
@@ -1003,19 +1008,21 @@ static int ivtvfb_init_vidmode(struct ivtv *itv) | |||
1003 | /* Hardware coords start at 0, user coords start at 1. */ | 1008 | /* Hardware coords start at 0, user coords start at 1. */ |
1004 | osd_left--; | 1009 | osd_left--; |
1005 | 1010 | ||
1006 | start_window.left = osd_left >= 0 ? osd_left : ((IVTV_OSD_MAX_WIDTH - start_window.width) / 2); | 1011 | start_window.left = osd_left >= 0 ? |
1012 | osd_left : ((IVTV_OSD_MAX_WIDTH - start_window.width) / 2); | ||
1007 | 1013 | ||
1008 | oi->display_byte_stride = | 1014 | oi->display_byte_stride = |
1009 | start_window.width * oi->bytes_per_pixel; | 1015 | start_window.width * oi->bytes_per_pixel; |
1010 | 1016 | ||
1011 | /* Vertical size & position */ | 1017 | /* Vertical size & position */ |
1012 | 1018 | ||
1013 | max_height = itv->is_50hz ? 576 : 480; | 1019 | max_height = itv->is_out_50hz ? 576 : 480; |
1014 | 1020 | ||
1015 | if (osd_yres > max_height) | 1021 | if (osd_yres > max_height) |
1016 | osd_yres = max_height; | 1022 | osd_yres = max_height; |
1017 | 1023 | ||
1018 | start_window.height = osd_yres ? osd_yres : itv->is_50hz ? 480 : 400; | 1024 | start_window.height = osd_yres ? |
1025 | osd_yres : itv->is_out_50hz ? 480 : 400; | ||
1019 | 1026 | ||
1020 | /* Check vertical start (osd_upper). */ | 1027 | /* Check vertical start (osd_upper). */ |
1021 | if (osd_upper + start_window.height > max_height + 1) { | 1028 | if (osd_upper + start_window.height > max_height + 1) { |