aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.h66
-rw-r--r--drivers/media/video/ivtv/ivtv-fb.c2
-rw-r--r--drivers/media/video/ivtv/ivtv-irq.c10
3 files changed, 38 insertions, 40 deletions
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h
index 2c27515d8731..332d16415ebf 100644
--- a/drivers/media/video/ivtv/ivtv-driver.h
+++ b/drivers/media/video/ivtv/ivtv-driver.h
@@ -180,11 +180,11 @@ extern int ivtv_debug;
180#define IVTV_MAX_PGM_INDEX (400) 180#define IVTV_MAX_PGM_INDEX (400)
181 181
182struct ivtv_options { 182struct ivtv_options {
183 int kilobytes[IVTV_MAX_STREAMS]; /* Size in kilobytes of each stream */ 183 int kilobytes[IVTV_MAX_STREAMS]; /* size in kilobytes of each stream */
184 int cardtype; /* force card type on load */ 184 int cardtype; /* force card type on load */
185 int tuner; /* set tuner on load */ 185 int tuner; /* set tuner on load */
186 int radio; /* enable/disable radio */ 186 int radio; /* enable/disable radio */
187 int newi2c; /* New I2C algorithm */ 187 int newi2c; /* new I2C algorithm */
188}; 188};
189 189
190/* ivtv-specific mailbox template */ 190/* ivtv-specific mailbox template */
@@ -231,10 +231,10 @@ struct ivtv_mailbox_data {
231#define IVTV_F_I_DMA 0 /* DMA in progress */ 231#define IVTV_F_I_DMA 0 /* DMA in progress */
232#define IVTV_F_I_UDMA 1 /* UDMA in progress */ 232#define IVTV_F_I_UDMA 1 /* UDMA in progress */
233#define IVTV_F_I_UDMA_PENDING 2 /* UDMA pending */ 233#define IVTV_F_I_UDMA_PENDING 2 /* UDMA pending */
234#define IVTV_F_I_SPEED_CHANGE 3 /* A speed change is in progress */ 234#define IVTV_F_I_SPEED_CHANGE 3 /* a speed change is in progress */
235#define IVTV_F_I_EOS 4 /* End of encoder stream reached */ 235#define IVTV_F_I_EOS 4 /* end of encoder stream reached */
236#define IVTV_F_I_RADIO_USER 5 /* The radio tuner is selected */ 236#define IVTV_F_I_RADIO_USER 5 /* the radio tuner is selected */
237#define IVTV_F_I_DIG_RST 6 /* Reset digitizer */ 237#define IVTV_F_I_DIG_RST 6 /* reset digitizer */
238#define IVTV_F_I_DEC_YUV 7 /* YUV instead of MPG is being decoded */ 238#define IVTV_F_I_DEC_YUV 7 /* YUV instead of MPG is being decoded */
239#define IVTV_F_I_UPDATE_CC 9 /* CC should be updated */ 239#define IVTV_F_I_UPDATE_CC 9 /* CC should be updated */
240#define IVTV_F_I_UPDATE_WSS 10 /* WSS should be updated */ 240#define IVTV_F_I_UPDATE_WSS 10 /* WSS should be updated */
@@ -242,7 +242,7 @@ struct ivtv_mailbox_data {
242#define IVTV_F_I_DECODING_YUV 12 /* this stream is YUV frame decoding */ 242#define IVTV_F_I_DECODING_YUV 12 /* this stream is YUV frame decoding */
243#define IVTV_F_I_ENC_PAUSED 13 /* the encoder is paused */ 243#define IVTV_F_I_ENC_PAUSED 13 /* the encoder is paused */
244#define IVTV_F_I_VALID_DEC_TIMINGS 14 /* last_dec_timing is valid */ 244#define IVTV_F_I_VALID_DEC_TIMINGS 14 /* last_dec_timing is valid */
245#define IVTV_F_I_HAVE_WORK 15 /* Used in the interrupt handler: there is work to be done */ 245#define IVTV_F_I_HAVE_WORK 15 /* used in the interrupt handler: there is work to be done */
246#define IVTV_F_I_WORK_HANDLER_VBI 16 /* there is work to be done for VBI */ 246#define IVTV_F_I_WORK_HANDLER_VBI 16 /* there is work to be done for VBI */
247#define IVTV_F_I_WORK_HANDLER_YUV 17 /* there is work to be done for YUV */ 247#define IVTV_F_I_WORK_HANDLER_YUV 17 /* there is work to be done for YUV */
248#define IVTV_F_I_WORK_HANDLER_PIO 18 /* there is work to be done for PIO */ 248#define IVTV_F_I_WORK_HANDLER_PIO 18 /* there is work to be done for PIO */
@@ -295,19 +295,18 @@ struct ivtv_buffer {
295 unsigned short b_flags; 295 unsigned short b_flags;
296 unsigned short dma_xfer_cnt; 296 unsigned short dma_xfer_cnt;
297 char *buf; 297 char *buf;
298
299 u32 bytesused; 298 u32 bytesused;
300 u32 readpos; 299 u32 readpos;
301}; 300};
302 301
303struct ivtv_queue { 302struct ivtv_queue {
304 struct list_head list; 303 struct list_head list; /* the list of buffers in this queue */
305 u32 buffers; 304 u32 buffers; /* number of buffers in this queue */
306 u32 length; 305 u32 length; /* total number of bytes of available buffer space */
307 u32 bytesused; 306 u32 bytesused; /* total number of bytes used in this queue */
308}; 307};
309 308
310struct ivtv; /* forward reference */ 309struct ivtv; /* forward reference */
311 310
312struct ivtv_stream { 311struct ivtv_stream {
313 /* These first four fields are always set, even if the stream 312 /* These first four fields are always set, even if the stream
@@ -318,11 +317,9 @@ struct ivtv_stream {
318 int type; /* stream type */ 317 int type; /* stream type */
319 318
320 u32 id; 319 u32 id;
321 spinlock_t qlock; /* locks access to the queues */ 320 spinlock_t qlock; /* locks access to the queues */
322 unsigned long s_flags; /* status flags, see above */ 321 unsigned long s_flags; /* status flags, see above */
323 int dma; /* can be PCI_DMA_TODEVICE, 322 int dma; /* can be PCI_DMA_TODEVICE, PCI_DMA_FROMDEVICE or PCI_DMA_NONE */
324 PCI_DMA_FROMDEVICE or
325 PCI_DMA_NONE */
326 u32 pending_offset; 323 u32 pending_offset;
327 u32 pending_backup; 324 u32 pending_backup;
328 u64 pending_pts; 325 u64 pending_pts;
@@ -365,10 +362,10 @@ struct ivtv_stream {
365}; 362};
366 363
367struct ivtv_open_id { 364struct ivtv_open_id {
368 u32 open_id; 365 u32 open_id; /* unique ID for this file descriptor */
369 int type; 366 int type; /* stream type */
370 int yuv_frames; 367 int yuv_frames; /* 1: started OUT_UDMA_YUV output mode */
371 enum v4l2_priority prio; 368 enum v4l2_priority prio; /* priority */
372 struct ivtv *itv; 369 struct ivtv *itv;
373}; 370};
374 371
@@ -493,6 +490,14 @@ struct yuv_playback_info
493 490
494/* VBI data */ 491/* VBI data */
495struct vbi_info { 492struct vbi_info {
493 /* VBI general fixed card data */
494 u32 raw_decoder_line_size; /* raw VBI line size from digitizer */
495 u8 raw_decoder_sav_odd_field; /* raw VBI Start Active Video digitizer code of odd field */
496 u8 raw_decoder_sav_even_field; /* raw VBI Start Active Video digitizer code of even field */
497 u32 sliced_decoder_line_size; /* sliced VBI line size from digitizer */
498 u8 sliced_decoder_sav_odd_field; /* sliced VBI Start Active Video digitizer code of odd field */
499 u8 sliced_decoder_sav_even_field; /* sliced VBI Start Active Video digitizer code of even field */
500
496 u32 dec_start; 501 u32 dec_start;
497 u32 enc_start, enc_size; 502 u32 enc_start, enc_size;
498 int fpi; 503 int fpi;
@@ -506,12 +511,6 @@ struct vbi_info {
506 int wss; 511 int wss;
507 u8 wss_found; 512 u8 wss_found;
508 u8 wss_no_update; 513 u8 wss_no_update;
509 u32 raw_decoder_line_size;
510 u8 raw_decoder_sav_odd_field;
511 u8 raw_decoder_sav_even_field;
512 u32 sliced_decoder_line_size;
513 u8 sliced_decoder_sav_odd_field;
514 u8 sliced_decoder_sav_even_field;
515 struct v4l2_format in; 514 struct v4l2_format in;
516 /* convenience pointer to sliced struct in vbi_in union */ 515 /* convenience pointer to sliced struct in vbi_in union */
517 struct v4l2_sliced_vbi_format *sliced_in; 516 struct v4l2_sliced_vbi_format *sliced_in;
@@ -592,8 +591,7 @@ struct ivtv {
592 591
593 /* Locking */ 592 /* Locking */
594 spinlock_t lock; /* lock access to this struct */ 593 spinlock_t lock; /* lock access to this struct */
595 /* mutex used to serialize open/close/start/stop/ioctl operations */ 594 struct mutex serialize_lock; /* mutex used to serialize open/close/start/stop/ioctl operations */
596 struct mutex serialize_lock;
597 595
598 596
599 /* Streams */ 597 /* Streams */
@@ -616,7 +614,7 @@ struct ivtv {
616 int dma_retries; /* current DMA retry attempt */ 614 int dma_retries; /* current DMA retry attempt */
617 struct ivtv_user_dma udma; /* user based DMA for OSD */ 615 struct ivtv_user_dma udma; /* user based DMA for OSD */
618 struct timer_list dma_timer; /* timer used to catch unfinished DMAs */ 616 struct timer_list dma_timer; /* timer used to catch unfinished DMAs */
619 u32 last_vsync_frame; /* last seen vsync field */ 617 u32 last_vsync_field; /* last seen vsync field */
620 wait_queue_head_t dma_waitq; /* wake up when the current DMA is finished */ 618 wait_queue_head_t dma_waitq; /* wake up when the current DMA is finished */
621 wait_queue_head_t eos_waitq; /* wake up when EOS arrives */ 619 wait_queue_head_t eos_waitq; /* wake up when EOS arrives */
622 wait_queue_head_t event_waitq; /* wake up when the next decoder event arrives */ 620 wait_queue_head_t event_waitq; /* wake up when the next decoder event arrives */
diff --git a/drivers/media/video/ivtv/ivtv-fb.c b/drivers/media/video/ivtv/ivtv-fb.c
index f5ed2cf1cd87..e80564aed632 100644
--- a/drivers/media/video/ivtv/ivtv-fb.c
+++ b/drivers/media/video/ivtv/ivtv-fb.c
@@ -405,7 +405,7 @@ static int ivtvfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long ar
405 if (itv->is_50hz && trace > 312) trace -= 312; 405 if (itv->is_50hz && trace > 312) trace -= 312;
406 else if (itv->is_60hz && trace > 262) trace -= 262; 406 else if (itv->is_60hz && trace > 262) trace -= 262;
407 if (trace == 1) vblank.flags |= FB_VBLANK_VSYNCING; 407 if (trace == 1) vblank.flags |= FB_VBLANK_VSYNCING;
408 vblank.count = itv->last_vsync_frame; 408 vblank.count = itv->last_vsync_field;
409 vblank.vcount = trace; 409 vblank.vcount = trace;
410 vblank.hcount = 0; 410 vblank.hcount = 0;
411 if (copy_to_user((void __user *)arg, &vblank, sizeof(vblank))) 411 if (copy_to_user((void __user *)arg, &vblank, sizeof(vblank)))
diff --git a/drivers/media/video/ivtv/ivtv-irq.c b/drivers/media/video/ivtv/ivtv-irq.c
index 4ec3df58e247..66d0da22389f 100644
--- a/drivers/media/video/ivtv/ivtv-irq.c
+++ b/drivers/media/video/ivtv/ivtv-irq.c
@@ -750,8 +750,8 @@ static void ivtv_irq_vsync(struct ivtv *itv)
750 if (0) IVTV_DEBUG_IRQ("DEC VSYNC\n"); 750 if (0) IVTV_DEBUG_IRQ("DEC VSYNC\n");
751 751
752 if (((frame ^ itv->yuv_info.sync_field[last_dma_frame]) == 0 && 752 if (((frame ^ itv->yuv_info.sync_field[last_dma_frame]) == 0 &&
753 ((itv->last_vsync_frame & 1) ^ itv->yuv_info.sync_field[last_dma_frame])) || 753 ((itv->last_vsync_field & 1) ^ itv->yuv_info.sync_field[last_dma_frame])) ||
754 (frame != (itv->last_vsync_frame & 1) && !itv->yuv_info.frame_interlaced)) { 754 (frame != (itv->last_vsync_field & 1) && !itv->yuv_info.frame_interlaced)) {
755 int next_dma_frame = last_dma_frame; 755 int next_dma_frame = last_dma_frame;
756 756
757 if (!(itv->yuv_info.frame_interlaced && itv->yuv_info.field_delay[next_dma_frame] && itv->yuv_info.fields_lapsed < 1)) { 757 if (!(itv->yuv_info.frame_interlaced && itv->yuv_info.field_delay[next_dma_frame] && itv->yuv_info.fields_lapsed < 1)) {
@@ -766,10 +766,10 @@ static void ivtv_irq_vsync(struct ivtv *itv)
766 } 766 }
767 } 767 }
768 } 768 }
769 if (frame != (itv->last_vsync_frame & 1)) { 769 if (frame != (itv->last_vsync_field & 1)) {
770 struct ivtv_stream *s = ivtv_get_output_stream(itv); 770 struct ivtv_stream *s = ivtv_get_output_stream(itv);
771 771
772 itv->last_vsync_frame += 1; 772 itv->last_vsync_field += 1;
773 if (frame == 0) { 773 if (frame == 0) {
774 clear_bit(IVTV_F_I_VALID_DEC_TIMINGS, &itv->i_flags); 774 clear_bit(IVTV_F_I_VALID_DEC_TIMINGS, &itv->i_flags);
775 clear_bit(IVTV_F_I_EV_VSYNC_FIELD, &itv->i_flags); 775 clear_bit(IVTV_F_I_EV_VSYNC_FIELD, &itv->i_flags);
@@ -834,7 +834,7 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id)
834 */ 834 */
835 if (~itv->irqmask & IVTV_IRQ_DEC_VSYNC) { 835 if (~itv->irqmask & IVTV_IRQ_DEC_VSYNC) {
836 /* vsync is enabled, see if we're in a new field */ 836 /* vsync is enabled, see if we're in a new field */
837 if ((itv->last_vsync_frame & 1) != (read_reg(0x28c0) & 1)) { 837 if ((itv->last_vsync_field & 1) != (read_reg(0x28c0) & 1)) {
838 /* New field, looks like we missed it */ 838 /* New field, looks like we missed it */
839 IVTV_DEBUG_YUV("VSync interrupt missed %d\n",read_reg(0x28c0)>>16); 839 IVTV_DEBUG_YUV("VSync interrupt missed %d\n",read_reg(0x28c0)>>16);
840 vsync_force = 1; 840 vsync_force = 1;