Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb

* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb:
V4L/DVB (5751): Ivtv: fix ia64 printk format warnings.
V4L/DVB (5761): Fix broken b2c2 dependency on non x86 architectures
V4L/DVB (5673): Fix audio stuttering for saa711x/ivtv when in radio mode.
V4L/DVB (5736): Add V4L2_FBUF_CAP/FLAG_LOCAL/GLOBAL_INV_ALPHA
V4L/DVB (5732): Add ivtv CROPCAP support and fix ivtv S_CROP for video output.
V4L/DVB (5730): Remove unused V4L2_CAP_VIDEO_OUTPUT_POS
V4L/DVB (5720): Usbvision: fix urb allocation and submits
V4L/DVB (5716): Tda10086,tda826x: fix tuning, STR/SNR values
V4L/DVB (5675): Move big PIO accesses from the interrupt handler to a workhandler
V4L/DVB (5699): Cinergyt2: fix file release handler
V4L/DVB (5700): Saa7111: fix picture settings cache bug
V4L/DVB (5702): Fix Kconfig items to avoid linkedition errors

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