diff options
21 files changed, 368 insertions, 169 deletions
diff --git a/drivers/media/common/Kconfig b/drivers/media/common/Kconfig index c120114c241b..5c63c8e24ee7 100644 --- a/drivers/media/common/Kconfig +++ b/drivers/media/common/Kconfig | |||
@@ -4,5 +4,6 @@ config VIDEO_SAA7146 | |||
4 | 4 | ||
5 | config VIDEO_SAA7146_VV | 5 | config VIDEO_SAA7146_VV |
6 | tristate | 6 | tristate |
7 | depends on VIDEO_DEV | ||
7 | select VIDEO_BUF | 8 | select VIDEO_BUF |
8 | select VIDEO_SAA7146 | 9 | select VIDEO_SAA7146 |
diff --git a/drivers/media/dvb/b2c2/Makefile b/drivers/media/dvb/b2c2/Makefile index 1a1c3bca55fa..bff00b58bf65 100644 --- a/drivers/media/dvb/b2c2/Makefile +++ b/drivers/media/dvb/b2c2/Makefile | |||
@@ -1,8 +1,11 @@ | |||
1 | b2c2-flexcop-objs = flexcop.o flexcop-fe-tuner.o flexcop-i2c.o \ | 1 | b2c2-flexcop-objs = flexcop.o flexcop-fe-tuner.o flexcop-i2c.o \ |
2 | flexcop-sram.o flexcop-eeprom.o flexcop-misc.o flexcop-hw-filter.o \ | 2 | flexcop-sram.o flexcop-eeprom.o flexcop-misc.o flexcop-hw-filter.o |
3 | flexcop-dma.o | ||
4 | obj-$(CONFIG_DVB_B2C2_FLEXCOP) += b2c2-flexcop.o | 3 | obj-$(CONFIG_DVB_B2C2_FLEXCOP) += b2c2-flexcop.o |
5 | 4 | ||
5 | ifneq ($(CONFIG_DVB_B2C2_FLEXCOP_PCI),) | ||
6 | b2c2-flexcop-objs += flexcop-dma.o | ||
7 | endif | ||
8 | |||
6 | b2c2-flexcop-pci-objs = flexcop-pci.o | 9 | b2c2-flexcop-pci-objs = flexcop-pci.o |
7 | obj-$(CONFIG_DVB_B2C2_FLEXCOP_PCI) += b2c2-flexcop-pci.o | 10 | obj-$(CONFIG_DVB_B2C2_FLEXCOP_PCI) += b2c2-flexcop-pci.o |
8 | 11 | ||
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index 34d7abc900d7..6aba5b39ed14 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c | |||
@@ -519,8 +519,7 @@ static int cinergyt2_release (struct inode *inode, struct file *file) | |||
519 | struct dvb_device *dvbdev = file->private_data; | 519 | struct dvb_device *dvbdev = file->private_data; |
520 | struct cinergyt2 *cinergyt2 = dvbdev->priv; | 520 | struct cinergyt2 *cinergyt2 = dvbdev->priv; |
521 | 521 | ||
522 | if (mutex_lock_interruptible(&cinergyt2->sem)) | 522 | mutex_lock(&cinergyt2->sem); |
523 | return -ERESTARTSYS; | ||
524 | 523 | ||
525 | if (!cinergyt2->disconnect_pending && (file->f_flags & O_ACCMODE) != O_RDONLY) { | 524 | if (!cinergyt2->disconnect_pending && (file->f_flags & O_ACCMODE) != O_RDONLY) { |
526 | cancel_delayed_work(&cinergyt2->query_work); | 525 | cancel_delayed_work(&cinergyt2->query_work); |
diff --git a/drivers/media/dvb/frontends/tda10086.c b/drivers/media/dvb/frontends/tda10086.c index ccc429cbbad0..0f2d4b415560 100644 --- a/drivers/media/dvb/frontends/tda10086.c +++ b/drivers/media/dvb/frontends/tda10086.c | |||
@@ -41,6 +41,7 @@ struct tda10086_state { | |||
41 | /* private demod data */ | 41 | /* private demod data */ |
42 | u32 frequency; | 42 | u32 frequency; |
43 | u32 symbol_rate; | 43 | u32 symbol_rate; |
44 | bool has_lock; | ||
44 | }; | 45 | }; |
45 | 46 | ||
46 | static int debug = 0; | 47 | static int debug = 0; |
@@ -116,7 +117,7 @@ static int tda10086_init(struct dvb_frontend* fe) | |||
116 | // misc setup | 117 | // misc setup |
117 | tda10086_write_byte(state, 0x01, 0x94); | 118 | tda10086_write_byte(state, 0x01, 0x94); |
118 | tda10086_write_byte(state, 0x02, 0x35); // NOTE: TT drivers appear to disable CSWP | 119 | tda10086_write_byte(state, 0x02, 0x35); // NOTE: TT drivers appear to disable CSWP |
119 | tda10086_write_byte(state, 0x03, 0x64); | 120 | tda10086_write_byte(state, 0x03, 0xe4); |
120 | tda10086_write_byte(state, 0x04, 0x43); | 121 | tda10086_write_byte(state, 0x04, 0x43); |
121 | tda10086_write_byte(state, 0x0c, 0x0c); | 122 | tda10086_write_byte(state, 0x0c, 0x0c); |
122 | tda10086_write_byte(state, 0x1b, 0xb0); // noise threshold | 123 | tda10086_write_byte(state, 0x1b, 0xb0); // noise threshold |
@@ -146,7 +147,7 @@ static int tda10086_init(struct dvb_frontend* fe) | |||
146 | // setup AGC | 147 | // setup AGC |
147 | tda10086_write_byte(state, 0x05, 0x0B); | 148 | tda10086_write_byte(state, 0x05, 0x0B); |
148 | tda10086_write_byte(state, 0x37, 0x63); | 149 | tda10086_write_byte(state, 0x37, 0x63); |
149 | tda10086_write_byte(state, 0x3f, 0x03); // NOTE: flydvb uses 0x0a and varies it | 150 | tda10086_write_byte(state, 0x3f, 0x0a); // NOTE: flydvb varies it |
150 | tda10086_write_byte(state, 0x40, 0x64); | 151 | tda10086_write_byte(state, 0x40, 0x64); |
151 | tda10086_write_byte(state, 0x41, 0x4f); | 152 | tda10086_write_byte(state, 0x41, 0x4f); |
152 | tda10086_write_byte(state, 0x42, 0x43); | 153 | tda10086_write_byte(state, 0x42, 0x43); |
@@ -398,6 +399,10 @@ static int tda10086_set_frontend(struct dvb_frontend* fe, | |||
398 | 399 | ||
399 | dprintk ("%s\n", __FUNCTION__); | 400 | dprintk ("%s\n", __FUNCTION__); |
400 | 401 | ||
402 | // modify parameters for tuning | ||
403 | tda10086_write_byte(state, 0x02, 0x35); | ||
404 | state->has_lock = false; | ||
405 | |||
401 | // set params | 406 | // set params |
402 | if (fe->ops.tuner_ops.set_params) { | 407 | if (fe->ops.tuner_ops.set_params) { |
403 | fe->ops.tuner_ops.set_params(fe, fe_params); | 408 | fe->ops.tuner_ops.set_params(fe, fe_params); |
@@ -542,8 +547,14 @@ static int tda10086_read_status(struct dvb_frontend* fe, fe_status_t *fe_status) | |||
542 | *fe_status |= FE_HAS_VITERBI; | 547 | *fe_status |= FE_HAS_VITERBI; |
543 | if (val & 0x08) | 548 | if (val & 0x08) |
544 | *fe_status |= FE_HAS_SYNC; | 549 | *fe_status |= FE_HAS_SYNC; |
545 | if (val & 0x10) | 550 | if (val & 0x10) { |
546 | *fe_status |= FE_HAS_LOCK; | 551 | *fe_status |= FE_HAS_LOCK; |
552 | if (!state->has_lock) { | ||
553 | state->has_lock = true; | ||
554 | // modify parameters for stable reception | ||
555 | tda10086_write_byte(state, 0x02, 0x00); | ||
556 | } | ||
557 | } | ||
547 | 558 | ||
548 | return 0; | 559 | return 0; |
549 | } | 560 | } |
@@ -555,7 +566,7 @@ static int tda10086_read_signal_strength(struct dvb_frontend* fe, u16 * signal) | |||
555 | 566 | ||
556 | dprintk ("%s\n", __FUNCTION__); | 567 | dprintk ("%s\n", __FUNCTION__); |
557 | 568 | ||
558 | _str = tda10086_read_byte(state, 0x43); | 569 | _str = 0xff - tda10086_read_byte(state, 0x43); |
559 | *signal = (_str << 8) | _str; | 570 | *signal = (_str << 8) | _str; |
560 | 571 | ||
561 | return 0; | 572 | return 0; |
@@ -568,7 +579,7 @@ static int tda10086_read_snr(struct dvb_frontend* fe, u16 * snr) | |||
568 | 579 | ||
569 | dprintk ("%s\n", __FUNCTION__); | 580 | dprintk ("%s\n", __FUNCTION__); |
570 | 581 | ||
571 | _snr = tda10086_read_byte(state, 0x1c); | 582 | _snr = 0xff - tda10086_read_byte(state, 0x1c); |
572 | *snr = (_snr << 8) | _snr; | 583 | *snr = (_snr << 8) | _snr; |
573 | 584 | ||
574 | return 0; | 585 | return 0; |
diff --git a/drivers/media/dvb/frontends/tda826x.c b/drivers/media/dvb/frontends/tda826x.c index 79f971dc52b6..bd3ebc284835 100644 --- a/drivers/media/dvb/frontends/tda826x.c +++ b/drivers/media/dvb/frontends/tda826x.c | |||
@@ -89,8 +89,8 @@ static int tda826x_set_params(struct dvb_frontend *fe, struct dvb_frontend_param | |||
89 | buf[2] = (1<<5) | 0x0b; // 1Mhz + 0.45 VCO | 89 | buf[2] = (1<<5) | 0x0b; // 1Mhz + 0.45 VCO |
90 | buf[3] = div >> 7; | 90 | buf[3] = div >> 7; |
91 | buf[4] = div << 1; | 91 | buf[4] = div << 1; |
92 | buf[5] = 0xff; // basedband filter to max | 92 | buf[5] = 0x77; // baseband cut-off 19 MHz |
93 | buf[6] = 0xfe; // gains at max + no RF attenuation | 93 | buf[6] = 0xfe; // baseband gain 9 db + no RF attenuation |
94 | buf[7] = 0x83; // charge pumps at high, tests off | 94 | buf[7] = 0x83; // charge pumps at high, tests off |
95 | buf[8] = 0x80; // recommended value 4 for AMPVCO + disable ports. | 95 | buf[8] = 0x80; // recommended value 4 for AMPVCO + disable ports. |
96 | buf[9] = 0x1a; // normal caltime + recommended values for SELTH + SELVTL | 96 | buf[9] = 0x1a; // normal caltime + recommended values for SELTH + SELVTL |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 5cb3f54b548b..4cca55170e21 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -347,7 +347,7 @@ endmenu # encoder / decoder chips | |||
347 | 347 | ||
348 | config VIDEO_VIVI | 348 | config VIDEO_VIVI |
349 | tristate "Virtual Video Driver" | 349 | tristate "Virtual Video Driver" |
350 | depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 && PCI | 350 | depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 && PCI && VIDEO_DEV |
351 | select VIDEO_BUF | 351 | select VIDEO_BUF |
352 | default n | 352 | default n |
353 | ---help--- | 353 | ---help--- |
diff --git a/drivers/media/video/ivtv/ivtv-cards.h b/drivers/media/video/ivtv/ivtv-cards.h index 15012f88b802..91e9e90c14a5 100644 --- a/drivers/media/video/ivtv/ivtv-cards.h +++ b/drivers/media/video/ivtv/ivtv-cards.h | |||
@@ -86,7 +86,7 @@ | |||
86 | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE | \ | 86 | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE | \ |
87 | V4L2_CAP_SLICED_VBI_CAPTURE) | 87 | V4L2_CAP_SLICED_VBI_CAPTURE) |
88 | #define IVTV_CAP_DECODER (V4L2_CAP_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT | \ | 88 | #define IVTV_CAP_DECODER (V4L2_CAP_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT | \ |
89 | V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_OVERLAY | V4L2_CAP_VIDEO_OUTPUT_POS) | 89 | V4L2_CAP_SLICED_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_OVERLAY) |
90 | 90 | ||
91 | struct ivtv_card_video_input { | 91 | struct ivtv_card_video_input { |
92 | u8 video_type; /* video input type */ | 92 | u8 video_type; /* video input type */ |
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index e29f949adf57..efc66355339a 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
@@ -652,6 +652,7 @@ static int __devinit ivtv_init_struct1(struct ivtv *itv) | |||
652 | itv->dma_timer.data = (unsigned long)itv; | 652 | itv->dma_timer.data = (unsigned long)itv; |
653 | 653 | ||
654 | itv->cur_dma_stream = -1; | 654 | itv->cur_dma_stream = -1; |
655 | itv->cur_pio_stream = -1; | ||
655 | itv->audio_stereo_mode = AUDIO_STEREO; | 656 | itv->audio_stereo_mode = AUDIO_STEREO; |
656 | itv->audio_bilingual_mode = AUDIO_MONO_LEFT; | 657 | itv->audio_bilingual_mode = AUDIO_MONO_LEFT; |
657 | 658 | ||
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h index 552f04511ead..e6e56f175f3f 100644 --- a/drivers/media/video/ivtv/ivtv-driver.h +++ b/drivers/media/video/ivtv/ivtv-driver.h | |||
@@ -237,6 +237,7 @@ extern const u32 yuv_offset[4]; | |||
237 | #define IVTV_IRQ_ENC_VBI_CAP (0x1 << 29) | 237 | #define IVTV_IRQ_ENC_VBI_CAP (0x1 << 29) |
238 | #define IVTV_IRQ_ENC_VIM_RST (0x1 << 28) | 238 | #define IVTV_IRQ_ENC_VIM_RST (0x1 << 28) |
239 | #define IVTV_IRQ_ENC_DMA_COMPLETE (0x1 << 27) | 239 | #define IVTV_IRQ_ENC_DMA_COMPLETE (0x1 << 27) |
240 | #define IVTV_IRQ_ENC_PIO_COMPLETE (0x1 << 25) | ||
240 | #define IVTV_IRQ_DEC_AUD_MODE_CHG (0x1 << 24) | 241 | #define IVTV_IRQ_DEC_AUD_MODE_CHG (0x1 << 24) |
241 | #define IVTV_IRQ_DEC_DATA_REQ (0x1 << 22) | 242 | #define IVTV_IRQ_DEC_DATA_REQ (0x1 << 22) |
242 | #define IVTV_IRQ_DEC_DMA_COMPLETE (0x1 << 20) | 243 | #define IVTV_IRQ_DEC_DMA_COMPLETE (0x1 << 20) |
@@ -247,7 +248,8 @@ extern const u32 yuv_offset[4]; | |||
247 | #define IVTV_IRQ_DEC_VSYNC (0x1 << 10) | 248 | #define IVTV_IRQ_DEC_VSYNC (0x1 << 10) |
248 | 249 | ||
249 | /* IRQ Masks */ | 250 | /* IRQ Masks */ |
250 | #define IVTV_IRQ_MASK_INIT (IVTV_IRQ_DMA_ERR|IVTV_IRQ_ENC_DMA_COMPLETE|IVTV_IRQ_DMA_READ) | 251 | #define IVTV_IRQ_MASK_INIT (IVTV_IRQ_DMA_ERR|IVTV_IRQ_ENC_DMA_COMPLETE|\ |
252 | IVTV_IRQ_DMA_READ|IVTV_IRQ_ENC_PIO_COMPLETE) | ||
251 | 253 | ||
252 | #define IVTV_IRQ_MASK_CAPTURE (IVTV_IRQ_ENC_START_CAP | IVTV_IRQ_ENC_EOS) | 254 | #define IVTV_IRQ_MASK_CAPTURE (IVTV_IRQ_ENC_START_CAP | IVTV_IRQ_ENC_EOS) |
253 | #define IVTV_IRQ_MASK_DECODE (IVTV_IRQ_DEC_DATA_REQ|IVTV_IRQ_DEC_AUD_MODE_CHG) | 255 | #define IVTV_IRQ_MASK_DECODE (IVTV_IRQ_DEC_DATA_REQ|IVTV_IRQ_DEC_AUD_MODE_CHG) |
@@ -374,6 +376,9 @@ struct ivtv_mailbox_data { | |||
374 | #define IVTV_F_S_STREAMOFF 7 /* signal end of stream EOS */ | 376 | #define IVTV_F_S_STREAMOFF 7 /* signal end of stream EOS */ |
375 | #define IVTV_F_S_APPL_IO 8 /* this stream is used read/written by an application */ | 377 | #define IVTV_F_S_APPL_IO 8 /* this stream is used read/written by an application */ |
376 | 378 | ||
379 | #define IVTV_F_S_PIO_PENDING 9 /* this stream has pending PIO */ | ||
380 | #define IVTV_F_S_PIO_HAS_VBI 1 /* the current PIO request also requests VBI data */ | ||
381 | |||
377 | /* per-ivtv, i_flags */ | 382 | /* per-ivtv, i_flags */ |
378 | #define IVTV_F_I_DMA 0 /* DMA in progress */ | 383 | #define IVTV_F_I_DMA 0 /* DMA in progress */ |
379 | #define IVTV_F_I_UDMA 1 /* UDMA in progress */ | 384 | #define IVTV_F_I_UDMA 1 /* UDMA in progress */ |
@@ -390,8 +395,11 @@ struct ivtv_mailbox_data { | |||
390 | #define IVTV_F_I_DECODING_YUV 12 /* this stream is YUV frame decoding */ | 395 | #define IVTV_F_I_DECODING_YUV 12 /* this stream is YUV frame decoding */ |
391 | #define IVTV_F_I_ENC_PAUSED 13 /* the encoder is paused */ | 396 | #define IVTV_F_I_ENC_PAUSED 13 /* the encoder is paused */ |
392 | #define IVTV_F_I_VALID_DEC_TIMINGS 14 /* last_dec_timing is valid */ | 397 | #define IVTV_F_I_VALID_DEC_TIMINGS 14 /* last_dec_timing is valid */ |
393 | #define IVTV_F_I_WORK_HANDLER_VBI 15 /* there is work to be done for VBI */ | 398 | #define IVTV_F_I_HAVE_WORK 15 /* Used in the interrupt handler: there is work to be done */ |
394 | #define IVTV_F_I_WORK_HANDLER_YUV 16 /* there is work to be done for YUV */ | 399 | #define IVTV_F_I_WORK_HANDLER_VBI 16 /* there is work to be done for VBI */ |
400 | #define IVTV_F_I_WORK_HANDLER_YUV 17 /* there is work to be done for YUV */ | ||
401 | #define IVTV_F_I_WORK_HANDLER_PIO 18 /* there is work to be done for PIO */ | ||
402 | #define IVTV_F_I_PIO 19 /* PIO in progress */ | ||
395 | 403 | ||
396 | /* Event notifications */ | 404 | /* Event notifications */ |
397 | #define IVTV_F_I_EV_DEC_STOPPED 28 /* decoder stopped event */ | 405 | #define IVTV_F_I_EV_DEC_STOPPED 28 /* decoder stopped event */ |
@@ -484,6 +492,7 @@ struct ivtv_stream { | |||
484 | 492 | ||
485 | /* Base Dev SG Array for cx23415/6 */ | 493 | /* Base Dev SG Array for cx23415/6 */ |
486 | struct ivtv_SG_element *SGarray; | 494 | struct ivtv_SG_element *SGarray; |
495 | struct ivtv_SG_element *PIOarray; | ||
487 | dma_addr_t SG_handle; | 496 | dma_addr_t SG_handle; |
488 | int SG_length; | 497 | int SG_length; |
489 | 498 | ||
@@ -706,6 +715,7 @@ struct ivtv { | |||
706 | atomic_t decoding; /* count number of active decoding streams */ | 715 | atomic_t decoding; /* count number of active decoding streams */ |
707 | u32 irq_rr_idx; /* Round-robin stream index */ | 716 | u32 irq_rr_idx; /* Round-robin stream index */ |
708 | int cur_dma_stream; /* index of stream doing DMA */ | 717 | int cur_dma_stream; /* index of stream doing DMA */ |
718 | int cur_pio_stream; /* index of stream doing PIO */ | ||
709 | u32 dma_data_req_offset; | 719 | u32 dma_data_req_offset; |
710 | u32 dma_data_req_size; | 720 | u32 dma_data_req_size; |
711 | int output_mode; /* NONE, MPG, YUV, UDMA YUV, passthrough */ | 721 | int output_mode; /* NONE, MPG, YUV, UDMA YUV, passthrough */ |
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c index 8976487a65f3..555d5e6369c3 100644 --- a/drivers/media/video/ivtv/ivtv-fileops.c +++ b/drivers/media/video/ivtv/ivtv-fileops.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #include "ivtv-yuv.h" | 32 | #include "ivtv-yuv.h" |
33 | #include "ivtv-controls.h" | 33 | #include "ivtv-controls.h" |
34 | #include "ivtv-ioctl.h" | 34 | #include "ivtv-ioctl.h" |
35 | #include "ivtv-cards.h" | ||
36 | #include <media/saa7115.h> | ||
35 | 37 | ||
36 | /* This function tries to claim the stream for a specific file descriptor. | 38 | /* This function tries to claim the stream for a specific file descriptor. |
37 | If no one else is using this stream then the stream is claimed and | 39 | If no one else is using this stream then the stream is claimed and |
@@ -786,6 +788,13 @@ int ivtv_v4l2_close(struct inode *inode, struct file *filp) | |||
786 | ivtv_call_i2c_clients(itv, VIDIOC_S_STD, &itv->std); | 788 | ivtv_call_i2c_clients(itv, VIDIOC_S_STD, &itv->std); |
787 | /* Select correct audio input (i.e. TV tuner or Line in) */ | 789 | /* Select correct audio input (i.e. TV tuner or Line in) */ |
788 | ivtv_audio_set_io(itv); | 790 | ivtv_audio_set_io(itv); |
791 | if (itv->hw_flags & IVTV_HW_SAA711X) | ||
792 | { | ||
793 | struct v4l2_crystal_freq crystal_freq; | ||
794 | crystal_freq.freq = SAA7115_FREQ_32_11_MHZ; | ||
795 | crystal_freq.flags = 0; | ||
796 | ivtv_saa7115(itv, VIDIOC_INT_S_CRYSTAL_FREQ, &crystal_freq); | ||
797 | } | ||
789 | /* Done! Unmute and continue. */ | 798 | /* Done! Unmute and continue. */ |
790 | ivtv_unmute(itv); | 799 | ivtv_unmute(itv); |
791 | ivtv_release_stream(s); | 800 | ivtv_release_stream(s); |
@@ -872,6 +881,13 @@ int ivtv_v4l2_open(struct inode *inode, struct file *filp) | |||
872 | set_bit(IVTV_F_I_RADIO_USER, &itv->i_flags); | 881 | set_bit(IVTV_F_I_RADIO_USER, &itv->i_flags); |
873 | /* Select the correct audio input (i.e. radio tuner) */ | 882 | /* Select the correct audio input (i.e. radio tuner) */ |
874 | ivtv_audio_set_io(itv); | 883 | ivtv_audio_set_io(itv); |
884 | if (itv->hw_flags & IVTV_HW_SAA711X) | ||
885 | { | ||
886 | struct v4l2_crystal_freq crystal_freq; | ||
887 | crystal_freq.freq = SAA7115_FREQ_32_11_MHZ; | ||
888 | crystal_freq.flags = SAA7115_FREQ_FL_APLL; | ||
889 | ivtv_saa7115(itv, VIDIOC_INT_S_CRYSTAL_FREQ, &crystal_freq); | ||
890 | } | ||
875 | /* Done! Unmute and continue. */ | 891 | /* Done! Unmute and continue. */ |
876 | ivtv_unmute(itv); | 892 | ivtv_unmute(itv); |
877 | } | 893 | } |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 1989ec1cb973..57af1762de1f 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -532,11 +532,6 @@ static int ivtv_try_or_set_fmt(struct ivtv *itv, int streamtype, | |||
532 | itv->yuv_info.yuv_forced_update = 1; | 532 | itv->yuv_info.yuv_forced_update = 1; |
533 | return 0; | 533 | return 0; |
534 | } | 534 | } |
535 | if (!ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4, | ||
536 | r.width, r.height, r.left, r.top)) | ||
537 | itv->main_rect = r; | ||
538 | else | ||
539 | return -EINVAL; | ||
540 | } | 535 | } |
541 | return 0; | 536 | return 0; |
542 | } | 537 | } |
@@ -799,9 +794,39 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void | |||
799 | return ivtv_get_fmt(itv, id->type, fmt); | 794 | return ivtv_get_fmt(itv, id->type, fmt); |
800 | } | 795 | } |
801 | 796 | ||
797 | case VIDIOC_CROPCAP: { | ||
798 | struct v4l2_cropcap *cropcap = arg; | ||
799 | |||
800 | if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && | ||
801 | cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) | ||
802 | return -EINVAL; | ||
803 | cropcap->bounds.top = cropcap->bounds.left = 0; | ||
804 | cropcap->bounds.width = 720; | ||
805 | if (cropcap->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
806 | cropcap->bounds.height = itv->is_50hz ? 576 : 480; | ||
807 | cropcap->pixelaspect.numerator = itv->is_50hz ? 59 : 10; | ||
808 | cropcap->pixelaspect.denominator = itv->is_50hz ? 54 : 11; | ||
809 | } else { | ||
810 | cropcap->bounds.height = itv->is_out_50hz ? 576 : 480; | ||
811 | cropcap->pixelaspect.numerator = itv->is_out_50hz ? 59 : 10; | ||
812 | cropcap->pixelaspect.denominator = itv->is_out_50hz ? 54 : 11; | ||
813 | } | ||
814 | cropcap->defrect = cropcap->bounds; | ||
815 | return 0; | ||
816 | } | ||
817 | |||
802 | case VIDIOC_S_CROP: { | 818 | case VIDIOC_S_CROP: { |
803 | struct v4l2_crop *crop = arg; | 819 | struct v4l2_crop *crop = arg; |
804 | 820 | ||
821 | if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT && | ||
822 | (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) { | ||
823 | if (!ivtv_vapi(itv, CX2341X_OSD_SET_FRAMEBUFFER_WINDOW, 4, | ||
824 | crop->c.width, crop->c.height, crop->c.left, crop->c.top)) { | ||
825 | itv->main_rect = crop->c; | ||
826 | return 0; | ||
827 | } | ||
828 | return -EINVAL; | ||
829 | } | ||
805 | if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 830 | if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
806 | return -EINVAL; | 831 | return -EINVAL; |
807 | return itv->video_dec_func(itv, VIDIOC_S_CROP, arg); | 832 | return itv->video_dec_func(itv, VIDIOC_S_CROP, arg); |
@@ -810,6 +835,11 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void | |||
810 | case VIDIOC_G_CROP: { | 835 | case VIDIOC_G_CROP: { |
811 | struct v4l2_crop *crop = arg; | 836 | struct v4l2_crop *crop = arg; |
812 | 837 | ||
838 | if (crop->type == V4L2_BUF_TYPE_VIDEO_OUTPUT && | ||
839 | (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) { | ||
840 | crop->c = itv->main_rect; | ||
841 | return 0; | ||
842 | } | ||
813 | if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 843 | if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
814 | return -EINVAL; | 844 | return -EINVAL; |
815 | return itv->video_dec_func(itv, VIDIOC_G_CROP, arg); | 845 | return itv->video_dec_func(itv, VIDIOC_G_CROP, arg); |
@@ -977,7 +1007,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void | |||
977 | if (itv->hw_flags & IVTV_HW_CX25840) { | 1007 | if (itv->hw_flags & IVTV_HW_CX25840) { |
978 | itv->vbi.sliced_decoder_line_size = itv->is_60hz ? 272 : 284; | 1008 | itv->vbi.sliced_decoder_line_size = itv->is_60hz ? 272 : 284; |
979 | } | 1009 | } |
980 | IVTV_DEBUG_INFO("Switching standard to %llx.\n", itv->std); | 1010 | IVTV_DEBUG_INFO("Switching standard to %llx.\n", (unsigned long long)itv->std); |
981 | 1011 | ||
982 | /* Tuner */ | 1012 | /* Tuner */ |
983 | ivtv_call_i2c_clients(itv, VIDIOC_S_STD, &itv->std); | 1013 | ivtv_call_i2c_clients(itv, VIDIOC_S_STD, &itv->std); |
@@ -1207,7 +1237,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void | |||
1207 | (s->buffers - s->q_free.buffers) * 100 / s->buffers, | 1237 | (s->buffers - s->q_free.buffers) * 100 / s->buffers, |
1208 | (s->buffers * s->buf_size) / 1024, s->buffers); | 1238 | (s->buffers * s->buf_size) / 1024, s->buffers); |
1209 | } | 1239 | } |
1210 | IVTV_INFO("Read MPEG/VBI: %lld/%lld bytes\n", itv->mpg_data_received, itv->vbi_data_inserted); | 1240 | IVTV_INFO("Read MPEG/VBI: %lld/%lld bytes\n", (long long)itv->mpg_data_received, (long long)itv->vbi_data_inserted); |
1211 | IVTV_INFO("================== END STATUS CARD #%d ==================\n", itv->num); | 1241 | IVTV_INFO("================== END STATUS CARD #%d ==================\n", itv->num); |
1212 | break; | 1242 | break; |
1213 | } | 1243 | } |
@@ -1455,6 +1485,7 @@ static int ivtv_v4l2_do_ioctl(struct inode *inode, struct file *filp, | |||
1455 | case VIDIOC_S_FMT: | 1485 | case VIDIOC_S_FMT: |
1456 | case VIDIOC_TRY_FMT: | 1486 | case VIDIOC_TRY_FMT: |
1457 | case VIDIOC_ENUM_FMT: | 1487 | case VIDIOC_ENUM_FMT: |
1488 | case VIDIOC_CROPCAP: | ||
1458 | case VIDIOC_G_CROP: | 1489 | case VIDIOC_G_CROP: |
1459 | case VIDIOC_S_CROP: | 1490 | case VIDIOC_S_CROP: |
1460 | case VIDIOC_G_FREQUENCY: | 1491 | case VIDIOC_G_FREQUENCY: |
diff --git a/drivers/media/video/ivtv/ivtv-irq.c b/drivers/media/video/ivtv/ivtv-irq.c index c3a047b381b3..ba98bf054f2e 100644 --- a/drivers/media/video/ivtv/ivtv-irq.c +++ b/drivers/media/video/ivtv/ivtv-irq.c | |||
@@ -31,8 +31,6 @@ | |||
31 | 31 | ||
32 | #define DMA_MAGIC_COOKIE 0x000001fe | 32 | #define DMA_MAGIC_COOKIE 0x000001fe |
33 | 33 | ||
34 | #define SLICED_VBI_PIO 1 | ||
35 | |||
36 | static void ivtv_dma_dec_start(struct ivtv_stream *s); | 34 | static void ivtv_dma_dec_start(struct ivtv_stream *s); |
37 | 35 | ||
38 | static const int ivtv_stream_map[] = { | 36 | static const int ivtv_stream_map[] = { |
@@ -42,12 +40,40 @@ static const int ivtv_stream_map[] = { | |||
42 | IVTV_ENC_STREAM_TYPE_VBI, | 40 | IVTV_ENC_STREAM_TYPE_VBI, |
43 | }; | 41 | }; |
44 | 42 | ||
45 | static inline int ivtv_use_pio(struct ivtv_stream *s) | 43 | |
44 | static void ivtv_pio_work_handler(struct ivtv *itv) | ||
46 | { | 45 | { |
47 | struct ivtv *itv = s->itv; | 46 | struct ivtv_stream *s = &itv->streams[itv->cur_pio_stream]; |
47 | struct ivtv_buffer *buf; | ||
48 | struct list_head *p; | ||
49 | int i = 0; | ||
50 | |||
51 | IVTV_DEBUG_DMA("ivtv_pio_work_handler\n"); | ||
52 | if (itv->cur_pio_stream < 0 || itv->cur_pio_stream >= IVTV_MAX_STREAMS || | ||
53 | s->v4l2dev == NULL || !ivtv_use_pio(s)) { | ||
54 | itv->cur_pio_stream = -1; | ||
55 | /* trigger PIO complete user interrupt */ | ||
56 | write_reg(IVTV_IRQ_ENC_PIO_COMPLETE, 0x44); | ||
57 | return; | ||
58 | } | ||
59 | IVTV_DEBUG_DMA("Process PIO %s\n", s->name); | ||
60 | buf = list_entry(s->q_dma.list.next, struct ivtv_buffer, list); | ||
61 | list_for_each(p, &s->q_dma.list) { | ||
62 | struct ivtv_buffer *buf = list_entry(p, struct ivtv_buffer, list); | ||
63 | u32 size = s->PIOarray[i].size & 0x3ffff; | ||
48 | 64 | ||
49 | return s->dma == PCI_DMA_NONE || | 65 | /* Copy the data from the card to the buffer */ |
50 | (SLICED_VBI_PIO && s->type == IVTV_ENC_STREAM_TYPE_VBI && itv->vbi.sliced_in->service_set); | 66 | if (s->type == IVTV_DEC_STREAM_TYPE_VBI) { |
67 | memcpy_fromio(buf->buf, itv->dec_mem + s->PIOarray[i].src - IVTV_DECODER_OFFSET, size); | ||
68 | } | ||
69 | else { | ||
70 | memcpy_fromio(buf->buf, itv->enc_mem + s->PIOarray[i].src, size); | ||
71 | } | ||
72 | if (s->PIOarray[i].size & 0x80000000) | ||
73 | break; | ||
74 | i++; | ||
75 | } | ||
76 | write_reg(IVTV_IRQ_ENC_PIO_COMPLETE, 0x44); | ||
51 | } | 77 | } |
52 | 78 | ||
53 | void ivtv_irq_work_handler(struct work_struct *work) | 79 | void ivtv_irq_work_handler(struct work_struct *work) |
@@ -56,8 +82,11 @@ void ivtv_irq_work_handler(struct work_struct *work) | |||
56 | 82 | ||
57 | DEFINE_WAIT(wait); | 83 | DEFINE_WAIT(wait); |
58 | 84 | ||
85 | if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_PIO, &itv->i_flags)) | ||
86 | ivtv_pio_work_handler(itv); | ||
87 | |||
59 | if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_VBI, &itv->i_flags)) | 88 | if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_VBI, &itv->i_flags)) |
60 | vbi_work_handler(itv); | 89 | ivtv_vbi_work_handler(itv); |
61 | 90 | ||
62 | if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_YUV, &itv->i_flags)) | 91 | if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_YUV, &itv->i_flags)) |
63 | ivtv_yuv_work_handler(itv); | 92 | ivtv_yuv_work_handler(itv); |
@@ -173,8 +202,7 @@ static int stream_enc_dma_append(struct ivtv_stream *s, u32 data[CX2341X_MBOX_MA | |||
173 | } | 202 | } |
174 | s->buffers_stolen = rc; | 203 | s->buffers_stolen = rc; |
175 | 204 | ||
176 | /* got the buffers, now fill in SGarray (DMA) or copy the data from the card | 205 | /* got the buffers, now fill in SGarray (DMA) */ |
177 | to the buffers (PIO). */ | ||
178 | buf = list_entry(s->q_predma.list.next, struct ivtv_buffer, list); | 206 | buf = list_entry(s->q_predma.list.next, struct ivtv_buffer, list); |
179 | memset(buf->buf, 0, 128); | 207 | memset(buf->buf, 0, 128); |
180 | list_for_each(p, &s->q_predma.list) { | 208 | list_for_each(p, &s->q_predma.list) { |
@@ -182,21 +210,11 @@ static int stream_enc_dma_append(struct ivtv_stream *s, u32 data[CX2341X_MBOX_MA | |||
182 | 210 | ||
183 | if (skip_bufs-- > 0) | 211 | if (skip_bufs-- > 0) |
184 | continue; | 212 | continue; |
185 | if (!ivtv_use_pio(s)) { | 213 | s->SGarray[idx].dst = cpu_to_le32(buf->dma_handle); |
186 | s->SGarray[idx].dst = cpu_to_le32(buf->dma_handle); | 214 | s->SGarray[idx].src = cpu_to_le32(offset); |
187 | s->SGarray[idx].src = cpu_to_le32(offset); | 215 | s->SGarray[idx].size = cpu_to_le32(s->buf_size); |
188 | s->SGarray[idx].size = cpu_to_le32(s->buf_size); | ||
189 | } | ||
190 | buf->bytesused = (size < s->buf_size) ? size : s->buf_size; | 216 | buf->bytesused = (size < s->buf_size) ? size : s->buf_size; |
191 | 217 | ||
192 | /* If PIO, then copy the data from the card to the buffer */ | ||
193 | if (s->type == IVTV_DEC_STREAM_TYPE_VBI) { | ||
194 | memcpy_fromio(buf->buf, itv->dec_mem + offset - IVTV_DECODER_OFFSET, buf->bytesused); | ||
195 | } | ||
196 | else if (ivtv_use_pio(s)) { | ||
197 | memcpy_fromio(buf->buf, itv->enc_mem + offset, buf->bytesused); | ||
198 | } | ||
199 | |||
200 | s->q_predma.bytesused += buf->bytesused; | 218 | s->q_predma.bytesused += buf->bytesused; |
201 | size -= buf->bytesused; | 219 | size -= buf->bytesused; |
202 | offset += s->buf_size; | 220 | offset += s->buf_size; |
@@ -224,11 +242,6 @@ static void dma_post(struct ivtv_stream *s) | |||
224 | u32 *u32buf; | 242 | u32 *u32buf; |
225 | int x = 0; | 243 | int x = 0; |
226 | 244 | ||
227 | if (ivtv_use_pio(s)) { | ||
228 | if (s->q_predma.bytesused) | ||
229 | ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused); | ||
230 | s->SG_length = 0; | ||
231 | } | ||
232 | IVTV_DEBUG_DMA("%s %s completed (%x)\n", ivtv_use_pio(s) ? "PIO" : "DMA", | 245 | IVTV_DEBUG_DMA("%s %s completed (%x)\n", ivtv_use_pio(s) ? "PIO" : "DMA", |
233 | s->name, s->dma_offset); | 246 | s->name, s->dma_offset); |
234 | list_for_each(p, &s->q_dma.list) { | 247 | list_for_each(p, &s->q_dma.list) { |
@@ -278,10 +291,14 @@ static void dma_post(struct ivtv_stream *s) | |||
278 | if (buf) | 291 | if (buf) |
279 | buf->bytesused += s->dma_last_offset; | 292 | buf->bytesused += s->dma_last_offset; |
280 | if (buf && s->type == IVTV_DEC_STREAM_TYPE_VBI) { | 293 | if (buf && s->type == IVTV_DEC_STREAM_TYPE_VBI) { |
281 | /* Parse and Groom VBI Data */ | 294 | list_for_each(p, &s->q_dma.list) { |
282 | s->q_dma.bytesused -= buf->bytesused; | 295 | buf = list_entry(p, struct ivtv_buffer, list); |
283 | ivtv_process_vbi_data(itv, buf, 0, s->type); | 296 | |
284 | s->q_dma.bytesused += buf->bytesused; | 297 | /* Parse and Groom VBI Data */ |
298 | s->q_dma.bytesused -= buf->bytesused; | ||
299 | ivtv_process_vbi_data(itv, buf, 0, s->type); | ||
300 | s->q_dma.bytesused += buf->bytesused; | ||
301 | } | ||
285 | if (s->id == -1) { | 302 | if (s->id == -1) { |
286 | ivtv_queue_move(s, &s->q_dma, NULL, &s->q_free, 0); | 303 | ivtv_queue_move(s, &s->q_dma, NULL, &s->q_free, 0); |
287 | return; | 304 | return; |
@@ -351,10 +368,14 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s) | |||
351 | struct ivtv_stream *s_vbi = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; | 368 | struct ivtv_stream *s_vbi = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; |
352 | int i; | 369 | int i; |
353 | 370 | ||
371 | IVTV_DEBUG_DMA("start %s for %s\n", ivtv_use_dma(s) ? "DMA" : "PIO", s->name); | ||
372 | |||
354 | if (s->q_predma.bytesused) | 373 | if (s->q_predma.bytesused) |
355 | ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused); | 374 | ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused); |
356 | IVTV_DEBUG_DMA("start DMA for %s\n", s->name); | 375 | |
357 | s->SGarray[s->SG_length - 1].size = cpu_to_le32(le32_to_cpu(s->SGarray[s->SG_length - 1].size) + 256); | 376 | if (ivtv_use_dma(s)) |
377 | s->SGarray[s->SG_length - 1].size = | ||
378 | cpu_to_le32(le32_to_cpu(s->SGarray[s->SG_length - 1].size) + 256); | ||
358 | 379 | ||
359 | /* If this is an MPEG stream, and VBI data is also pending, then append the | 380 | /* If this is an MPEG stream, and VBI data is also pending, then append the |
360 | VBI DMA to the MPEG DMA and transfer both sets of data at once. | 381 | VBI DMA to the MPEG DMA and transfer both sets of data at once. |
@@ -368,7 +389,8 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s) | |||
368 | if (s->type == IVTV_ENC_STREAM_TYPE_MPG && s_vbi->SG_length && | 389 | if (s->type == IVTV_ENC_STREAM_TYPE_MPG && s_vbi->SG_length && |
369 | s->SG_length + s_vbi->SG_length <= s->buffers) { | 390 | s->SG_length + s_vbi->SG_length <= s->buffers) { |
370 | ivtv_queue_move(s_vbi, &s_vbi->q_predma, NULL, &s_vbi->q_dma, s_vbi->q_predma.bytesused); | 391 | ivtv_queue_move(s_vbi, &s_vbi->q_predma, NULL, &s_vbi->q_dma, s_vbi->q_predma.bytesused); |
371 | s_vbi->SGarray[s_vbi->SG_length - 1].size = cpu_to_le32(le32_to_cpu(s_vbi->SGarray[s->SG_length - 1].size) + 256); | 392 | if (ivtv_use_dma(s_vbi)) |
393 | s_vbi->SGarray[s_vbi->SG_length - 1].size = cpu_to_le32(le32_to_cpu(s_vbi->SGarray[s->SG_length - 1].size) + 256); | ||
372 | for (i = 0; i < s_vbi->SG_length; i++) { | 394 | for (i = 0; i < s_vbi->SG_length; i++) { |
373 | s->SGarray[s->SG_length++] = s_vbi->SGarray[i]; | 395 | s->SGarray[s->SG_length++] = s_vbi->SGarray[i]; |
374 | } | 396 | } |
@@ -381,14 +403,26 @@ static void ivtv_dma_enc_start(struct ivtv_stream *s) | |||
381 | /* Mark last buffer size for Interrupt flag */ | 403 | /* Mark last buffer size for Interrupt flag */ |
382 | s->SGarray[s->SG_length - 1].size |= cpu_to_le32(0x80000000); | 404 | s->SGarray[s->SG_length - 1].size |= cpu_to_le32(0x80000000); |
383 | 405 | ||
384 | /* Sync Hardware SG List of buffers */ | 406 | if (ivtv_use_pio(s)) { |
385 | ivtv_stream_sync_for_device(s); | 407 | for (i = 0; i < s->SG_length; i++) { |
386 | write_reg(s->SG_handle, IVTV_REG_ENCDMAADDR); | 408 | s->PIOarray[i].src = le32_to_cpu(s->SGarray[i].src); |
387 | write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x02, IVTV_REG_DMAXFER); | 409 | s->PIOarray[i].size = le32_to_cpu(s->SGarray[i].size); |
388 | set_bit(IVTV_F_I_DMA, &itv->i_flags); | 410 | } |
389 | itv->cur_dma_stream = s->type; | 411 | set_bit(IVTV_F_I_WORK_HANDLER_PIO, &itv->i_flags); |
390 | itv->dma_timer.expires = jiffies + HZ / 10; | 412 | set_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags); |
391 | add_timer(&itv->dma_timer); | 413 | set_bit(IVTV_F_I_PIO, &itv->i_flags); |
414 | itv->cur_pio_stream = s->type; | ||
415 | } | ||
416 | else { | ||
417 | /* Sync Hardware SG List of buffers */ | ||
418 | ivtv_stream_sync_for_device(s); | ||
419 | write_reg(s->SG_handle, IVTV_REG_ENCDMAADDR); | ||
420 | write_reg_sync(read_reg(IVTV_REG_DMAXFER) | 0x02, IVTV_REG_DMAXFER); | ||
421 | set_bit(IVTV_F_I_DMA, &itv->i_flags); | ||
422 | itv->cur_dma_stream = s->type; | ||
423 | itv->dma_timer.expires = jiffies + HZ / 10; | ||
424 | add_timer(&itv->dma_timer); | ||
425 | } | ||
392 | } | 426 | } |
393 | 427 | ||
394 | static void ivtv_dma_dec_start(struct ivtv_stream *s) | 428 | static void ivtv_dma_dec_start(struct ivtv_stream *s) |
@@ -489,6 +523,40 @@ static void ivtv_irq_enc_dma_complete(struct ivtv *itv) | |||
489 | wake_up(&itv->dma_waitq); | 523 | wake_up(&itv->dma_waitq); |
490 | } | 524 | } |
491 | 525 | ||
526 | static void ivtv_irq_enc_pio_complete(struct ivtv *itv) | ||
527 | { | ||
528 | struct ivtv_stream *s; | ||
529 | |||
530 | if (itv->cur_pio_stream < 0 || itv->cur_pio_stream >= IVTV_MAX_STREAMS) { | ||
531 | itv->cur_pio_stream = -1; | ||
532 | return; | ||
533 | } | ||
534 | s = &itv->streams[itv->cur_pio_stream]; | ||
535 | IVTV_DEBUG_IRQ("ENC PIO COMPLETE %s\n", s->name); | ||
536 | s->SG_length = 0; | ||
537 | clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags); | ||
538 | clear_bit(IVTV_F_I_PIO, &itv->i_flags); | ||
539 | itv->cur_pio_stream = -1; | ||
540 | dma_post(s); | ||
541 | if (s->type == IVTV_ENC_STREAM_TYPE_MPG) | ||
542 | ivtv_vapi(itv, CX2341X_ENC_SCHED_DMA_TO_HOST, 3, 0, 0, 0); | ||
543 | else if (s->type == IVTV_ENC_STREAM_TYPE_YUV) | ||
544 | ivtv_vapi(itv, CX2341X_ENC_SCHED_DMA_TO_HOST, 3, 0, 0, 1); | ||
545 | else if (s->type == IVTV_ENC_STREAM_TYPE_PCM) | ||
546 | ivtv_vapi(itv, CX2341X_ENC_SCHED_DMA_TO_HOST, 3, 0, 0, 2); | ||
547 | clear_bit(IVTV_F_I_PIO, &itv->i_flags); | ||
548 | if (test_and_clear_bit(IVTV_F_S_DMA_HAS_VBI, &s->s_flags)) { | ||
549 | u32 tmp; | ||
550 | |||
551 | s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; | ||
552 | tmp = s->dma_offset; | ||
553 | s->dma_offset = itv->vbi.dma_offset; | ||
554 | dma_post(s); | ||
555 | s->dma_offset = tmp; | ||
556 | } | ||
557 | wake_up(&itv->dma_waitq); | ||
558 | } | ||
559 | |||
492 | static void ivtv_irq_dma_err(struct ivtv *itv) | 560 | static void ivtv_irq_dma_err(struct ivtv *itv) |
493 | { | 561 | { |
494 | u32 data[CX2341X_MBOX_MAX_DATA]; | 562 | u32 data[CX2341X_MBOX_MAX_DATA]; |
@@ -532,13 +600,7 @@ static void ivtv_irq_enc_start_cap(struct ivtv *itv) | |||
532 | clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags); | 600 | clear_bit(IVTV_F_I_ENC_VBI, &itv->i_flags); |
533 | s = &itv->streams[ivtv_stream_map[data[0]]]; | 601 | s = &itv->streams[ivtv_stream_map[data[0]]]; |
534 | if (!stream_enc_dma_append(s, data)) { | 602 | if (!stream_enc_dma_append(s, data)) { |
535 | if (ivtv_use_pio(s)) { | 603 | set_bit(ivtv_use_pio(s) ? IVTV_F_S_PIO_PENDING : IVTV_F_S_DMA_PENDING, &s->s_flags); |
536 | dma_post(s); | ||
537 | ivtv_vapi(itv, CX2341X_ENC_SCHED_DMA_TO_HOST, 3, 0, 0, data[0]); | ||
538 | } | ||
539 | else { | ||
540 | set_bit(IVTV_F_S_DMA_PENDING, &s->s_flags); | ||
541 | } | ||
542 | } | 604 | } |
543 | } | 605 | } |
544 | 606 | ||
@@ -551,15 +613,6 @@ static void ivtv_irq_enc_vbi_cap(struct ivtv *itv) | |||
551 | IVTV_DEBUG_IRQ("ENC START VBI CAP\n"); | 613 | IVTV_DEBUG_IRQ("ENC START VBI CAP\n"); |
552 | s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; | 614 | s = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI]; |
553 | 615 | ||
554 | if (ivtv_use_pio(s)) { | ||
555 | if (stream_enc_dma_append(s, data)) | ||
556 | return; | ||
557 | if (s->q_predma.bytesused) | ||
558 | ivtv_queue_move(s, &s->q_predma, NULL, &s->q_dma, s->q_predma.bytesused); | ||
559 | s->SG_length = 0; | ||
560 | dma_post(s); | ||
561 | return; | ||
562 | } | ||
563 | /* If more than two VBI buffers are pending, then | 616 | /* If more than two VBI buffers are pending, then |
564 | clear the old ones and start with this new one. | 617 | clear the old ones and start with this new one. |
565 | This can happen during transition stages when MPEG capturing is | 618 | This can happen during transition stages when MPEG capturing is |
@@ -582,11 +635,11 @@ static void ivtv_irq_enc_vbi_cap(struct ivtv *itv) | |||
582 | if (!stream_enc_dma_append(s, data) && | 635 | if (!stream_enc_dma_append(s, data) && |
583 | !test_bit(IVTV_F_S_STREAMING, &s_mpg->s_flags)) { | 636 | !test_bit(IVTV_F_S_STREAMING, &s_mpg->s_flags)) { |
584 | set_bit(IVTV_F_I_ENC_VBI, &itv->i_flags); | 637 | set_bit(IVTV_F_I_ENC_VBI, &itv->i_flags); |
585 | set_bit(IVTV_F_S_DMA_PENDING, &s->s_flags); | 638 | set_bit(ivtv_use_pio(s) ? IVTV_F_S_PIO_PENDING : IVTV_F_S_DMA_PENDING, &s->s_flags); |
586 | } | 639 | } |
587 | } | 640 | } |
588 | 641 | ||
589 | static void ivtv_irq_dev_vbi_reinsert(struct ivtv *itv) | 642 | static void ivtv_irq_dec_vbi_reinsert(struct ivtv *itv) |
590 | { | 643 | { |
591 | u32 data[CX2341X_MBOX_MAX_DATA]; | 644 | u32 data[CX2341X_MBOX_MAX_DATA]; |
592 | struct ivtv_stream *s = &itv->streams[IVTV_DEC_STREAM_TYPE_VBI]; | 645 | struct ivtv_stream *s = &itv->streams[IVTV_DEC_STREAM_TYPE_VBI]; |
@@ -594,7 +647,7 @@ static void ivtv_irq_dev_vbi_reinsert(struct ivtv *itv) | |||
594 | IVTV_DEBUG_IRQ("DEC VBI REINSERT\n"); | 647 | IVTV_DEBUG_IRQ("DEC VBI REINSERT\n"); |
595 | if (test_bit(IVTV_F_S_CLAIMED, &s->s_flags) && | 648 | if (test_bit(IVTV_F_S_CLAIMED, &s->s_flags) && |
596 | !stream_enc_dma_append(s, data)) { | 649 | !stream_enc_dma_append(s, data)) { |
597 | dma_post(s); | 650 | set_bit(IVTV_F_S_PIO_PENDING, &s->s_flags); |
598 | } | 651 | } |
599 | } | 652 | } |
600 | 653 | ||
@@ -657,7 +710,6 @@ static void ivtv_irq_vsync(struct ivtv *itv) | |||
657 | } | 710 | } |
658 | if (frame != (itv->lastVsyncFrame & 1)) { | 711 | if (frame != (itv->lastVsyncFrame & 1)) { |
659 | struct ivtv_stream *s = ivtv_get_output_stream(itv); | 712 | struct ivtv_stream *s = ivtv_get_output_stream(itv); |
660 | int work = 0; | ||
661 | 713 | ||
662 | itv->lastVsyncFrame += 1; | 714 | itv->lastVsyncFrame += 1; |
663 | if (frame == 0) { | 715 | if (frame == 0) { |
@@ -678,7 +730,7 @@ static void ivtv_irq_vsync(struct ivtv *itv) | |||
678 | /* Send VBI to saa7127 */ | 730 | /* Send VBI to saa7127 */ |
679 | if (frame) { | 731 | if (frame) { |
680 | set_bit(IVTV_F_I_WORK_HANDLER_VBI, &itv->i_flags); | 732 | set_bit(IVTV_F_I_WORK_HANDLER_VBI, &itv->i_flags); |
681 | work = 1; | 733 | set_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags); |
682 | } | 734 | } |
683 | 735 | ||
684 | /* Check if we need to update the yuv registers */ | 736 | /* Check if we need to update the yuv registers */ |
@@ -691,11 +743,9 @@ static void ivtv_irq_vsync(struct ivtv *itv) | |||
691 | itv->yuv_info.new_frame_info[last_dma_frame].update = 0; | 743 | itv->yuv_info.new_frame_info[last_dma_frame].update = 0; |
692 | itv->yuv_info.yuv_forced_update = 0; | 744 | itv->yuv_info.yuv_forced_update = 0; |
693 | set_bit(IVTV_F_I_WORK_HANDLER_YUV, &itv->i_flags); | 745 | set_bit(IVTV_F_I_WORK_HANDLER_YUV, &itv->i_flags); |
694 | work = 1; | 746 | set_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags); |
695 | } | 747 | } |
696 | } | 748 | } |
697 | if (work) | ||
698 | queue_work(itv->irq_work_queues, &itv->irq_work_queue); | ||
699 | } | 749 | } |
700 | } | 750 | } |
701 | 751 | ||
@@ -755,6 +805,10 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id) | |||
755 | ivtv_irq_enc_dma_complete(itv); | 805 | ivtv_irq_enc_dma_complete(itv); |
756 | } | 806 | } |
757 | 807 | ||
808 | if (combo & IVTV_IRQ_ENC_PIO_COMPLETE) { | ||
809 | ivtv_irq_enc_pio_complete(itv); | ||
810 | } | ||
811 | |||
758 | if (combo & IVTV_IRQ_DMA_ERR) { | 812 | if (combo & IVTV_IRQ_DMA_ERR) { |
759 | ivtv_irq_dma_err(itv); | 813 | ivtv_irq_dma_err(itv); |
760 | } | 814 | } |
@@ -768,7 +822,7 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id) | |||
768 | } | 822 | } |
769 | 823 | ||
770 | if (combo & IVTV_IRQ_DEC_VBI_RE_INSERT) { | 824 | if (combo & IVTV_IRQ_DEC_VBI_RE_INSERT) { |
771 | ivtv_irq_dev_vbi_reinsert(itv); | 825 | ivtv_irq_dec_vbi_reinsert(itv); |
772 | } | 826 | } |
773 | 827 | ||
774 | if (combo & IVTV_IRQ_ENC_EOS) { | 828 | if (combo & IVTV_IRQ_ENC_EOS) { |
@@ -813,6 +867,22 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id) | |||
813 | } | 867 | } |
814 | } | 868 | } |
815 | 869 | ||
870 | if ((combo & IVTV_IRQ_DMA) && !test_bit(IVTV_F_I_PIO, &itv->i_flags)) { | ||
871 | for (i = 0; i < IVTV_MAX_STREAMS; i++) { | ||
872 | int idx = (i + itv->irq_rr_idx++) % IVTV_MAX_STREAMS; | ||
873 | struct ivtv_stream *s = &itv->streams[idx]; | ||
874 | |||
875 | if (!test_and_clear_bit(IVTV_F_S_PIO_PENDING, &s->s_flags)) | ||
876 | continue; | ||
877 | if (s->type == IVTV_DEC_STREAM_TYPE_VBI || s->type < IVTV_DEC_STREAM_TYPE_MPG) | ||
878 | ivtv_dma_enc_start(s); | ||
879 | break; | ||
880 | } | ||
881 | } | ||
882 | |||
883 | if (test_and_clear_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags)) | ||
884 | queue_work(itv->irq_work_queues, &itv->irq_work_queue); | ||
885 | |||
816 | spin_unlock(&itv->dma_reg_lock); | 886 | spin_unlock(&itv->dma_reg_lock); |
817 | 887 | ||
818 | /* If we've just handled a 'forced' vsync, it's safest to say it | 888 | /* If we've just handled a 'forced' vsync, it's safest to say it |
diff --git a/drivers/media/video/ivtv/ivtv-queue.c b/drivers/media/video/ivtv/ivtv-queue.c index ccfcef1ad91a..a04f9387f63d 100644 --- a/drivers/media/video/ivtv/ivtv-queue.c +++ b/drivers/media/video/ivtv/ivtv-queue.c | |||
@@ -195,14 +195,26 @@ int ivtv_stream_alloc(struct ivtv_stream *s) | |||
195 | s->dma != PCI_DMA_NONE ? "DMA " : "", | 195 | s->dma != PCI_DMA_NONE ? "DMA " : "", |
196 | s->name, s->buffers, s->buf_size, s->buffers * s->buf_size / 1024); | 196 | s->name, s->buffers, s->buf_size, s->buffers * s->buf_size / 1024); |
197 | 197 | ||
198 | /* Allocate DMA SG Arrays */ | 198 | if (ivtv_might_use_pio(s)) { |
199 | if (s->dma != PCI_DMA_NONE) { | 199 | s->PIOarray = (struct ivtv_SG_element *)kzalloc(SGsize, GFP_KERNEL); |
200 | s->SGarray = (struct ivtv_SG_element *)kzalloc(SGsize, GFP_KERNEL); | 200 | if (s->PIOarray == NULL) { |
201 | if (s->SGarray == NULL) { | 201 | IVTV_ERR("Could not allocate PIOarray for %s stream\n", s->name); |
202 | IVTV_ERR("Could not allocate SGarray for %s stream\n", s->name); | ||
203 | return -ENOMEM; | 202 | return -ENOMEM; |
204 | } | 203 | } |
205 | s->SG_length = 0; | 204 | } |
205 | |||
206 | /* Allocate DMA SG Arrays */ | ||
207 | s->SGarray = (struct ivtv_SG_element *)kzalloc(SGsize, GFP_KERNEL); | ||
208 | if (s->SGarray == NULL) { | ||
209 | IVTV_ERR("Could not allocate SGarray for %s stream\n", s->name); | ||
210 | if (ivtv_might_use_pio(s)) { | ||
211 | kfree(s->PIOarray); | ||
212 | s->PIOarray = NULL; | ||
213 | } | ||
214 | return -ENOMEM; | ||
215 | } | ||
216 | s->SG_length = 0; | ||
217 | if (ivtv_might_use_dma(s)) { | ||
206 | s->SG_handle = pci_map_single(itv->dev, s->SGarray, SGsize, s->dma); | 218 | s->SG_handle = pci_map_single(itv->dev, s->SGarray, SGsize, s->dma); |
207 | ivtv_stream_sync_for_cpu(s); | 219 | ivtv_stream_sync_for_cpu(s); |
208 | } | 220 | } |
@@ -219,7 +231,7 @@ int ivtv_stream_alloc(struct ivtv_stream *s) | |||
219 | break; | 231 | break; |
220 | } | 232 | } |
221 | INIT_LIST_HEAD(&buf->list); | 233 | INIT_LIST_HEAD(&buf->list); |
222 | if (s->dma != PCI_DMA_NONE) { | 234 | if (ivtv_might_use_dma(s)) { |
223 | buf->dma_handle = pci_map_single(s->itv->dev, | 235 | buf->dma_handle = pci_map_single(s->itv->dev, |
224 | buf->buf, s->buf_size + 256, s->dma); | 236 | buf->buf, s->buf_size + 256, s->dma); |
225 | ivtv_buf_sync_for_cpu(s, buf); | 237 | ivtv_buf_sync_for_cpu(s, buf); |
@@ -242,7 +254,7 @@ void ivtv_stream_free(struct ivtv_stream *s) | |||
242 | 254 | ||
243 | /* empty q_free */ | 255 | /* empty q_free */ |
244 | while ((buf = ivtv_dequeue(s, &s->q_free))) { | 256 | while ((buf = ivtv_dequeue(s, &s->q_free))) { |
245 | if (s->dma != PCI_DMA_NONE) | 257 | if (ivtv_might_use_dma(s)) |
246 | pci_unmap_single(s->itv->dev, buf->dma_handle, | 258 | pci_unmap_single(s->itv->dev, buf->dma_handle, |
247 | s->buf_size + 256, s->dma); | 259 | s->buf_size + 256, s->dma); |
248 | kfree(buf->buf); | 260 | kfree(buf->buf); |
@@ -256,6 +268,9 @@ void ivtv_stream_free(struct ivtv_stream *s) | |||
256 | sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE); | 268 | sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE); |
257 | s->SG_handle = IVTV_DMA_UNMAPPED; | 269 | s->SG_handle = IVTV_DMA_UNMAPPED; |
258 | } | 270 | } |
271 | kfree(s->SGarray); | ||
272 | kfree(s->PIOarray); | ||
273 | s->PIOarray = NULL; | ||
259 | s->SGarray = NULL; | 274 | s->SGarray = NULL; |
260 | s->SG_length = 0; | 275 | s->SG_length = 0; |
261 | } | 276 | } |
diff --git a/drivers/media/video/ivtv/ivtv-queue.h b/drivers/media/video/ivtv/ivtv-queue.h index 903edd4b4381..2ed8d548255d 100644 --- a/drivers/media/video/ivtv/ivtv-queue.h +++ b/drivers/media/video/ivtv/ivtv-queue.h | |||
@@ -20,18 +20,43 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #define IVTV_DMA_UNMAPPED ((u32) -1) | 22 | #define IVTV_DMA_UNMAPPED ((u32) -1) |
23 | #define SLICED_VBI_PIO 1 | ||
23 | 24 | ||
24 | /* ivtv_buffer utility functions */ | 25 | /* ivtv_buffer utility functions */ |
26 | |||
27 | static inline int ivtv_might_use_pio(struct ivtv_stream *s) | ||
28 | { | ||
29 | return s->dma == PCI_DMA_NONE || (SLICED_VBI_PIO && s->type == IVTV_ENC_STREAM_TYPE_VBI); | ||
30 | } | ||
31 | |||
32 | static inline int ivtv_use_pio(struct ivtv_stream *s) | ||
33 | { | ||
34 | struct ivtv *itv = s->itv; | ||
35 | |||
36 | return s->dma == PCI_DMA_NONE || | ||
37 | (SLICED_VBI_PIO && s->type == IVTV_ENC_STREAM_TYPE_VBI && itv->vbi.sliced_in->service_set); | ||
38 | } | ||
39 | |||
40 | static inline int ivtv_might_use_dma(struct ivtv_stream *s) | ||
41 | { | ||
42 | return s->dma != PCI_DMA_NONE; | ||
43 | } | ||
44 | |||
45 | static inline int ivtv_use_dma(struct ivtv_stream *s) | ||
46 | { | ||
47 | return !ivtv_use_pio(s); | ||
48 | } | ||
49 | |||
25 | static inline void ivtv_buf_sync_for_cpu(struct ivtv_stream *s, struct ivtv_buffer *buf) | 50 | static inline void ivtv_buf_sync_for_cpu(struct ivtv_stream *s, struct ivtv_buffer *buf) |
26 | { | 51 | { |
27 | if (s->dma != PCI_DMA_NONE) | 52 | if (ivtv_use_dma(s)) |
28 | pci_dma_sync_single_for_cpu(s->itv->dev, buf->dma_handle, | 53 | pci_dma_sync_single_for_cpu(s->itv->dev, buf->dma_handle, |
29 | s->buf_size + 256, s->dma); | 54 | s->buf_size + 256, s->dma); |
30 | } | 55 | } |
31 | 56 | ||
32 | static inline void ivtv_buf_sync_for_device(struct ivtv_stream *s, struct ivtv_buffer *buf) | 57 | static inline void ivtv_buf_sync_for_device(struct ivtv_stream *s, struct ivtv_buffer *buf) |
33 | { | 58 | { |
34 | if (s->dma != PCI_DMA_NONE) | 59 | if (ivtv_use_dma(s)) |
35 | pci_dma_sync_single_for_device(s->itv->dev, buf->dma_handle, | 60 | pci_dma_sync_single_for_device(s->itv->dev, buf->dma_handle, |
36 | s->buf_size + 256, s->dma); | 61 | s->buf_size + 256, s->dma); |
37 | } | 62 | } |
@@ -53,12 +78,14 @@ void ivtv_stream_free(struct ivtv_stream *s); | |||
53 | 78 | ||
54 | static inline void ivtv_stream_sync_for_cpu(struct ivtv_stream *s) | 79 | static inline void ivtv_stream_sync_for_cpu(struct ivtv_stream *s) |
55 | { | 80 | { |
56 | pci_dma_sync_single_for_cpu(s->itv->dev, s->SG_handle, | 81 | if (ivtv_use_dma(s)) |
57 | sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE); | 82 | pci_dma_sync_single_for_cpu(s->itv->dev, s->SG_handle, |
83 | sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE); | ||
58 | } | 84 | } |
59 | 85 | ||
60 | static inline void ivtv_stream_sync_for_device(struct ivtv_stream *s) | 86 | static inline void ivtv_stream_sync_for_device(struct ivtv_stream *s) |
61 | { | 87 | { |
62 | pci_dma_sync_single_for_device(s->itv->dev, s->SG_handle, | 88 | if (ivtv_use_dma(s)) |
63 | sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE); | 89 | pci_dma_sync_single_for_device(s->itv->dev, s->SG_handle, |
90 | sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE); | ||
64 | } | 91 | } |
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index 01a41a844a30..6af88ae9295f 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c | |||
@@ -868,7 +868,7 @@ int ivtv_stop_v4l2_decode_stream(struct ivtv_stream *s, int flags, u64 pts) | |||
868 | if (!test_bit(IVTV_F_S_STREAMING, &s->s_flags)) | 868 | if (!test_bit(IVTV_F_S_STREAMING, &s->s_flags)) |
869 | return 0; | 869 | return 0; |
870 | 870 | ||
871 | IVTV_DEBUG_INFO("Stop Decode at %llu, flags: %x\n", pts, flags); | 871 | IVTV_DEBUG_INFO("Stop Decode at %llu, flags: %x\n", (unsigned long long)pts, flags); |
872 | 872 | ||
873 | /* Stop Decoder */ | 873 | /* Stop Decoder */ |
874 | if (!(flags & VIDEO_CMD_STOP_IMMEDIATELY) || pts) { | 874 | if (!(flags & VIDEO_CMD_STOP_IMMEDIATELY) || pts) { |
diff --git a/drivers/media/video/ivtv/ivtv-vbi.c b/drivers/media/video/ivtv/ivtv-vbi.c index 5efa5a867818..3ba46e07ea1f 100644 --- a/drivers/media/video/ivtv/ivtv-vbi.c +++ b/drivers/media/video/ivtv/ivtv-vbi.c | |||
@@ -450,7 +450,7 @@ void ivtv_disable_vbi(struct ivtv *itv) | |||
450 | } | 450 | } |
451 | 451 | ||
452 | 452 | ||
453 | void vbi_work_handler(struct ivtv *itv) | 453 | void ivtv_vbi_work_handler(struct ivtv *itv) |
454 | { | 454 | { |
455 | struct v4l2_sliced_vbi_data data; | 455 | struct v4l2_sliced_vbi_data data; |
456 | 456 | ||
diff --git a/drivers/media/video/ivtv/ivtv-vbi.h b/drivers/media/video/ivtv/ivtv-vbi.h index cdaea697b3ec..ec211b49702c 100644 --- a/drivers/media/video/ivtv/ivtv-vbi.h +++ b/drivers/media/video/ivtv/ivtv-vbi.h | |||
@@ -23,4 +23,4 @@ void ivtv_process_vbi_data(struct ivtv *itv, struct ivtv_buffer *buf, | |||
23 | int ivtv_used_line(struct ivtv *itv, int line, int field); | 23 | int ivtv_used_line(struct ivtv *itv, int line, int field); |
24 | void ivtv_disable_vbi(struct ivtv *itv); | 24 | void ivtv_disable_vbi(struct ivtv *itv); |
25 | void ivtv_set_vbi(unsigned long arg); | 25 | void ivtv_set_vbi(unsigned long arg); |
26 | void vbi_work_handler(struct ivtv *itv); | 26 | void ivtv_vbi_work_handler(struct ivtv *itv); |
diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c index 74839f98b7c4..c1a392e47170 100644 --- a/drivers/media/video/saa7111.c +++ b/drivers/media/video/saa7111.c | |||
@@ -75,10 +75,6 @@ struct saa7111 { | |||
75 | int norm; | 75 | int norm; |
76 | int input; | 76 | int input; |
77 | int enable; | 77 | int enable; |
78 | int bright; | ||
79 | int contrast; | ||
80 | int hue; | ||
81 | int sat; | ||
82 | }; | 78 | }; |
83 | 79 | ||
84 | #define I2C_SAA7111 0x48 | 80 | #define I2C_SAA7111 0x48 |
@@ -96,6 +92,17 @@ saa7111_write (struct i2c_client *client, | |||
96 | return i2c_smbus_write_byte_data(client, reg, value); | 92 | return i2c_smbus_write_byte_data(client, reg, value); |
97 | } | 93 | } |
98 | 94 | ||
95 | static inline void | ||
96 | saa7111_write_if_changed(struct i2c_client *client, u8 reg, u8 value) | ||
97 | { | ||
98 | struct saa7111 *decoder = i2c_get_clientdata(client); | ||
99 | |||
100 | if (decoder->reg[reg] != value) { | ||
101 | decoder->reg[reg] = value; | ||
102 | i2c_smbus_write_byte_data(client, reg, value); | ||
103 | } | ||
104 | } | ||
105 | |||
99 | static int | 106 | static int |
100 | saa7111_write_block (struct i2c_client *client, | 107 | saa7111_write_block (struct i2c_client *client, |
101 | const u8 *data, | 108 | const u8 *data, |
@@ -439,28 +446,14 @@ saa7111_command (struct i2c_client *client, | |||
439 | { | 446 | { |
440 | struct video_picture *pic = arg; | 447 | struct video_picture *pic = arg; |
441 | 448 | ||
442 | if (decoder->bright != pic->brightness) { | 449 | /* We want 0 to 255 we get 0-65535 */ |
443 | /* We want 0 to 255 we get 0-65535 */ | 450 | saa7111_write_if_changed(client, 0x0a, pic->brightness >> 8); |
444 | decoder->bright = pic->brightness; | 451 | /* We want 0 to 127 we get 0-65535 */ |
445 | saa7111_write(client, 0x0a, decoder->bright >> 8); | 452 | saa7111_write(client, 0x0b, pic->contrast >> 9); |
446 | } | 453 | /* We want 0 to 127 we get 0-65535 */ |
447 | if (decoder->contrast != pic->contrast) { | 454 | saa7111_write(client, 0x0c, pic->colour >> 9); |
448 | /* We want 0 to 127 we get 0-65535 */ | 455 | /* We want -128 to 127 we get 0-65535 */ |
449 | decoder->contrast = pic->contrast; | 456 | saa7111_write(client, 0x0d, (pic->hue - 32768) >> 8); |
450 | saa7111_write(client, 0x0b, | ||
451 | decoder->contrast >> 9); | ||
452 | } | ||
453 | if (decoder->sat != pic->colour) { | ||
454 | /* We want 0 to 127 we get 0-65535 */ | ||
455 | decoder->sat = pic->colour; | ||
456 | saa7111_write(client, 0x0c, decoder->sat >> 9); | ||
457 | } | ||
458 | if (decoder->hue != pic->hue) { | ||
459 | /* We want -128 to 127 we get 0-65535 */ | ||
460 | decoder->hue = pic->hue; | ||
461 | saa7111_write(client, 0x0d, | ||
462 | (decoder->hue - 32768) >> 8); | ||
463 | } | ||
464 | } | 457 | } |
465 | break; | 458 | break; |
466 | 459 | ||
@@ -524,10 +517,6 @@ saa7111_detect_client (struct i2c_adapter *adapter, | |||
524 | decoder->norm = VIDEO_MODE_NTSC; | 517 | decoder->norm = VIDEO_MODE_NTSC; |
525 | decoder->input = 0; | 518 | decoder->input = 0; |
526 | decoder->enable = 1; | 519 | decoder->enable = 1; |
527 | decoder->bright = 32768; | ||
528 | decoder->contrast = 32768; | ||
529 | decoder->hue = 32768; | ||
530 | decoder->sat = 32768; | ||
531 | i2c_set_clientdata(client, decoder); | 520 | i2c_set_clientdata(client, decoder); |
532 | 521 | ||
533 | i = i2c_attach_client(client); | 522 | i = i2c_attach_client(client); |
diff --git a/drivers/media/video/usbvision/usbvision-core.c b/drivers/media/video/usbvision/usbvision-core.c index 9118a6227ea6..7df071eb0a3b 100644 --- a/drivers/media/video/usbvision/usbvision-core.c +++ b/drivers/media/video/usbvision/usbvision-core.c | |||
@@ -1414,6 +1414,11 @@ static void usbvision_isocIrq(struct urb *urb) | |||
1414 | if (!USBVISION_IS_OPERATIONAL(usbvision)) | 1414 | if (!USBVISION_IS_OPERATIONAL(usbvision)) |
1415 | return; | 1415 | return; |
1416 | 1416 | ||
1417 | /* any urb with wrong status is ignored without acknowledgement */ | ||
1418 | if (urb->status == -ENOENT) { | ||
1419 | return; | ||
1420 | } | ||
1421 | |||
1417 | f = &usbvision->curFrame; | 1422 | f = &usbvision->curFrame; |
1418 | 1423 | ||
1419 | /* Manage streaming interruption */ | 1424 | /* Manage streaming interruption */ |
@@ -1436,18 +1441,21 @@ static void usbvision_isocIrq(struct urb *urb) | |||
1436 | if (usbvision->streaming == Stream_On) { | 1441 | if (usbvision->streaming == Stream_On) { |
1437 | 1442 | ||
1438 | /* If we collected enough data let's parse! */ | 1443 | /* If we collected enough data let's parse! */ |
1439 | if (scratch_len(usbvision) > USBVISION_HEADER_LENGTH) { /* 12 == header_length */ | 1444 | if ((scratch_len(usbvision) > USBVISION_HEADER_LENGTH) && |
1440 | /*If we don't have a frame we're current working on, complain */ | 1445 | (!list_empty(&(usbvision->inqueue))) ) { |
1441 | if(!list_empty(&(usbvision->inqueue))) { | 1446 | if (!(*f)) { |
1442 | if (!(*f)) { | 1447 | (*f) = list_entry(usbvision->inqueue.next, |
1443 | (*f) = list_entry(usbvision->inqueue.next,struct usbvision_frame, frame); | 1448 | struct usbvision_frame, |
1444 | } | 1449 | frame); |
1445 | usbvision_parse_data(usbvision); | ||
1446 | } | ||
1447 | else { | ||
1448 | PDEBUG(DBG_IRQ, "received data, but no one needs it"); | ||
1449 | scratch_reset(usbvision); | ||
1450 | } | 1450 | } |
1451 | usbvision_parse_data(usbvision); | ||
1452 | } | ||
1453 | else { | ||
1454 | /*If we don't have a frame | ||
1455 | we're current working on, complain */ | ||
1456 | PDEBUG(DBG_IRQ, | ||
1457 | "received data, but no one needs it"); | ||
1458 | scratch_reset(usbvision); | ||
1451 | } | 1459 | } |
1452 | } | 1460 | } |
1453 | else { | 1461 | else { |
@@ -1466,10 +1474,10 @@ static void usbvision_isocIrq(struct urb *urb) | |||
1466 | urb->dev = usbvision->dev; | 1474 | urb->dev = usbvision->dev; |
1467 | errCode = usb_submit_urb (urb, GFP_ATOMIC); | 1475 | errCode = usb_submit_urb (urb, GFP_ATOMIC); |
1468 | 1476 | ||
1469 | /* Disable this warning. By design of the driver. */ | 1477 | if(errCode) { |
1470 | // if(errCode) { | 1478 | err("%s: usb_submit_urb failed: error %d", |
1471 | // err("%s: usb_submit_urb failed: error %d", __FUNCTION__, errCode); | 1479 | __FUNCTION__, errCode); |
1472 | // } | 1480 | } |
1473 | 1481 | ||
1474 | return; | 1482 | return; |
1475 | } | 1483 | } |
@@ -2394,7 +2402,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) | |||
2394 | { | 2402 | { |
2395 | struct usb_device *dev = usbvision->dev; | 2403 | struct usb_device *dev = usbvision->dev; |
2396 | int bufIdx, errCode, regValue; | 2404 | int bufIdx, errCode, regValue; |
2397 | const int sb_size = USBVISION_URB_FRAMES * USBVISION_MAX_ISOC_PACKET_SIZE; | 2405 | int sb_size; |
2398 | 2406 | ||
2399 | if (!USBVISION_IS_OPERATIONAL(usbvision)) | 2407 | if (!USBVISION_IS_OPERATIONAL(usbvision)) |
2400 | return -EFAULT; | 2408 | return -EFAULT; |
@@ -2408,11 +2416,14 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) | |||
2408 | usbvision->last_error = errCode; | 2416 | usbvision->last_error = errCode; |
2409 | return -EBUSY; | 2417 | return -EBUSY; |
2410 | } | 2418 | } |
2419 | sb_size = USBVISION_URB_FRAMES * usbvision->isocPacketSize; | ||
2411 | 2420 | ||
2412 | regValue = (16 - usbvision_read_reg(usbvision, USBVISION_ALTER_REG)) & 0x0F; | 2421 | regValue = (16 - usbvision_read_reg(usbvision, |
2422 | USBVISION_ALTER_REG)) & 0x0F; | ||
2413 | 2423 | ||
2414 | usbvision->usb_bandwidth = regValue >> 1; | 2424 | usbvision->usb_bandwidth = regValue >> 1; |
2415 | PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", usbvision->usb_bandwidth); | 2425 | PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", |
2426 | usbvision->usb_bandwidth); | ||
2416 | 2427 | ||
2417 | 2428 | ||
2418 | 2429 | ||
@@ -2428,7 +2439,11 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) | |||
2428 | return -ENOMEM; | 2439 | return -ENOMEM; |
2429 | } | 2440 | } |
2430 | usbvision->sbuf[bufIdx].urb = urb; | 2441 | usbvision->sbuf[bufIdx].urb = urb; |
2431 | usbvision->sbuf[bufIdx].data = usb_buffer_alloc(usbvision->dev, sb_size, GFP_KERNEL,&urb->transfer_dma); | 2442 | usbvision->sbuf[bufIdx].data = |
2443 | usb_buffer_alloc(usbvision->dev, | ||
2444 | sb_size, | ||
2445 | GFP_KERNEL, | ||
2446 | &urb->transfer_dma); | ||
2432 | urb->dev = dev; | 2447 | urb->dev = dev; |
2433 | urb->context = usbvision; | 2448 | urb->context = usbvision; |
2434 | urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp); | 2449 | urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp); |
@@ -2442,21 +2457,26 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) | |||
2442 | for (j = k = 0; j < USBVISION_URB_FRAMES; j++, | 2457 | for (j = k = 0; j < USBVISION_URB_FRAMES; j++, |
2443 | k += usbvision->isocPacketSize) { | 2458 | k += usbvision->isocPacketSize) { |
2444 | urb->iso_frame_desc[j].offset = k; | 2459 | urb->iso_frame_desc[j].offset = k; |
2445 | urb->iso_frame_desc[j].length = usbvision->isocPacketSize; | 2460 | urb->iso_frame_desc[j].length = |
2461 | usbvision->isocPacketSize; | ||
2446 | } | 2462 | } |
2447 | } | 2463 | } |
2448 | 2464 | ||
2449 | 2465 | ||
2450 | /* Submit all URBs */ | 2466 | /* Submit all URBs */ |
2451 | for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { | 2467 | for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { |
2452 | errCode = usb_submit_urb(usbvision->sbuf[bufIdx].urb, GFP_KERNEL); | 2468 | errCode = usb_submit_urb(usbvision->sbuf[bufIdx].urb, |
2469 | GFP_KERNEL); | ||
2453 | if (errCode) { | 2470 | if (errCode) { |
2454 | err("%s: usb_submit_urb(%d) failed: error %d", __FUNCTION__, bufIdx, errCode); | 2471 | err("%s: usb_submit_urb(%d) failed: error %d", |
2472 | __FUNCTION__, bufIdx, errCode); | ||
2455 | } | 2473 | } |
2456 | } | 2474 | } |
2457 | 2475 | ||
2458 | usbvision->streaming = Stream_Idle; | 2476 | usbvision->streaming = Stream_Idle; |
2459 | PDEBUG(DBG_ISOC, "%s: streaming=1 usbvision->video_endp=$%02x", __FUNCTION__, usbvision->video_endp); | 2477 | PDEBUG(DBG_ISOC, "%s: streaming=1 usbvision->video_endp=$%02x", |
2478 | __FUNCTION__, | ||
2479 | usbvision->video_endp); | ||
2460 | return 0; | 2480 | return 0; |
2461 | } | 2481 | } |
2462 | 2482 | ||
@@ -2470,7 +2490,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) | |||
2470 | void usbvision_stop_isoc(struct usb_usbvision *usbvision) | 2490 | void usbvision_stop_isoc(struct usb_usbvision *usbvision) |
2471 | { | 2491 | { |
2472 | int bufIdx, errCode, regValue; | 2492 | int bufIdx, errCode, regValue; |
2473 | const int sb_size = USBVISION_URB_FRAMES * USBVISION_MAX_ISOC_PACKET_SIZE; | 2493 | int sb_size = USBVISION_URB_FRAMES * usbvision->isocPacketSize; |
2474 | 2494 | ||
2475 | if ((usbvision->streaming == Stream_Off) || (usbvision->dev == NULL)) | 2495 | if ((usbvision->streaming == Stream_Off) || (usbvision->dev == NULL)) |
2476 | return; | 2496 | return; |
@@ -2499,15 +2519,19 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision) | |||
2499 | errCode = usb_set_interface(usbvision->dev, usbvision->iface, | 2519 | errCode = usb_set_interface(usbvision->dev, usbvision->iface, |
2500 | usbvision->ifaceAlt); | 2520 | usbvision->ifaceAlt); |
2501 | if (errCode < 0) { | 2521 | if (errCode < 0) { |
2502 | err("%s: usb_set_interface() failed: error %d", __FUNCTION__, errCode); | 2522 | err("%s: usb_set_interface() failed: error %d", |
2523 | __FUNCTION__, errCode); | ||
2503 | usbvision->last_error = errCode; | 2524 | usbvision->last_error = errCode; |
2504 | } | 2525 | } |
2505 | regValue = (16 - usbvision_read_reg(usbvision, USBVISION_ALTER_REG)) & 0x0F; | 2526 | regValue = (16-usbvision_read_reg(usbvision, USBVISION_ALTER_REG)) & 0x0F; |
2506 | usbvision->isocPacketSize = (regValue == 0) ? 0 : (regValue * 64) - 1; | 2527 | usbvision->isocPacketSize = |
2507 | PDEBUG(DBG_ISOC, "ISO Packet Length:%d", usbvision->isocPacketSize); | 2528 | (regValue == 0) ? 0 : (regValue * 64) - 1; |
2529 | PDEBUG(DBG_ISOC, "ISO Packet Length:%d", | ||
2530 | usbvision->isocPacketSize); | ||
2508 | 2531 | ||
2509 | usbvision->usb_bandwidth = regValue >> 1; | 2532 | usbvision->usb_bandwidth = regValue >> 1; |
2510 | PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", usbvision->usb_bandwidth); | 2533 | PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", |
2534 | usbvision->usb_bandwidth); | ||
2511 | } | 2535 | } |
2512 | } | 2536 | } |
2513 | 2537 | ||
diff --git a/drivers/media/video/usbvision/usbvision.h b/drivers/media/video/usbvision/usbvision.h index bd6f6422ed54..c759d00d7014 100644 --- a/drivers/media/video/usbvision/usbvision.h +++ b/drivers/media/video/usbvision/usbvision.h | |||
@@ -146,7 +146,6 @@ | |||
146 | #define USBVISION_CLIPMASK_SIZE (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT / 8) //bytesize of clipmask | 146 | #define USBVISION_CLIPMASK_SIZE (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT / 8) //bytesize of clipmask |
147 | 147 | ||
148 | #define USBVISION_URB_FRAMES 32 | 148 | #define USBVISION_URB_FRAMES 32 |
149 | #define USBVISION_MAX_ISOC_PACKET_SIZE 959 // NT1003 Specs Document says 1023 | ||
150 | 149 | ||
151 | #define USBVISION_NUM_HEADERMARKER 20 | 150 | #define USBVISION_NUM_HEADERMARKER 20 |
152 | #define USBVISION_NUMFRAMES 3 /* Maximum number of frames an application can get */ | 151 | #define USBVISION_NUMFRAMES 3 /* Maximum number of frames an application can get */ |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index e7560389079c..d16a2b57dc81 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -243,8 +243,7 @@ struct v4l2_capability | |||
243 | #define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ | 243 | #define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ |
244 | #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ | 244 | #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ |
245 | #define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ | 245 | #define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ |
246 | #define V4L2_CAP_VIDEO_OUTPUT_POS 0x00000200 /* Video output can have x,y coords */ | 246 | #define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */ |
247 | #define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000400 /* Can do video output overlay */ | ||
248 | 247 | ||
249 | #define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ | 248 | #define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ |
250 | #define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ | 249 | #define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ |
@@ -616,12 +615,16 @@ struct v4l2_framebuffer | |||
616 | #define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 | 615 | #define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 |
617 | #define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 | 616 | #define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 |
618 | #define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 | 617 | #define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 |
618 | #define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 | ||
619 | #define V4L2_FBUF_CAP_GLOBAL_INV_ALPHA 0x0080 | ||
619 | /* Flags for the 'flags' field. */ | 620 | /* Flags for the 'flags' field. */ |
620 | #define V4L2_FBUF_FLAG_PRIMARY 0x0001 | 621 | #define V4L2_FBUF_FLAG_PRIMARY 0x0001 |
621 | #define V4L2_FBUF_FLAG_OVERLAY 0x0002 | 622 | #define V4L2_FBUF_FLAG_OVERLAY 0x0002 |
622 | #define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 | 623 | #define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 |
623 | #define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 | 624 | #define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 |
624 | #define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 | 625 | #define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 |
626 | #define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 | ||
627 | #define V4L2_FBUF_FLAG_GLOBAL_INV_ALPHA 0x0040 | ||
625 | 628 | ||
626 | struct v4l2_clip | 629 | struct v4l2_clip |
627 | { | 630 | { |