diff options
Diffstat (limited to 'linux/drivers/media/video/usbvision/usbvision-core.c')
-rw-r--r-- | linux/drivers/media/video/usbvision/usbvision-core.c | 77 |
1 files changed, 18 insertions, 59 deletions
diff --git a/linux/drivers/media/video/usbvision/usbvision-core.c b/linux/drivers/media/video/usbvision/usbvision-core.c index 81a4f6eb5..071b11e75 100644 --- a/linux/drivers/media/video/usbvision/usbvision-core.c +++ b/linux/drivers/media/video/usbvision/usbvision-core.c @@ -414,7 +414,7 @@ static void scratch_reset(struct usb_usbvision *usbvision) int usbvision_scratch_alloc(struct usb_usbvision *usbvision) { - usbvision->scratch = vmalloc(scratch_buf_size); + usbvision->scratch = vmalloc_32(scratch_buf_size); scratch_reset(usbvision); if(usbvision->scratch == NULL) { err("%s: unable to allocate %d bytes for scratch", @@ -525,7 +525,7 @@ static void usbvision_testpattern(struct usb_usbvision *usbvision, int usbvision_decompress_alloc(struct usb_usbvision *usbvision) { int IFB_size = MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT * 3 / 2; - usbvision->IntraFrameBuffer = vmalloc(IFB_size); + usbvision->IntraFrameBuffer = vmalloc_32(IFB_size); if (usbvision->IntraFrameBuffer == NULL) { err("%s: unable to allocate %d for compr. frame buffer", __FUNCTION__, IFB_size); return -ENOMEM; @@ -2268,18 +2268,7 @@ int usbvision_power_on(struct usb_usbvision *usbvision) usbvision_write_reg(usbvision, USBVISION_PWR_REG, USBVISION_SSPND_EN); usbvision_write_reg(usbvision, USBVISION_PWR_REG, USBVISION_SSPND_EN | USBVISION_RES2); -#if 0 - /* Set input format expected from decoder, should this be moved to usbvision_set_input() ?? */ - if(usbvision_device_data[usbvision->DevModel].Codec == CODEC_SAA7113) { - /* SAA7113 uses 8 bit output */ - usbvision_write_reg(usbvision, USBVISION_VIN_REG1, USBVISION_8_422_SYNC); - } else { - /* I'm sure only about d2-d0 [010] 16 bit 4:2:2 usin sync pulses - * as that is how saa7111 is configured */ - usbvision_write_reg(usbvision, USBVISION_VIN_REG1, USBVISION_16_422_SYNC); - /* | USBVISION_VSNC_POL | USBVISION_VCLK_POL);*/ - } -#endif + usbvision_write_reg(usbvision, USBVISION_PWR_REG, USBVISION_SSPND_EN | USBVISION_PWR_VID); errCode = usbvision_write_reg(usbvision, USBVISION_PWR_REG, @@ -2431,51 +2420,6 @@ int usbvision_setup(struct usb_usbvision *usbvision,int format) return USBVISION_IS_OPERATIONAL(usbvision); } - -int usbvision_sbuf_alloc(struct usb_usbvision *usbvision) -{ - int i, errCode = 0; - const int sb_size = USBVISION_URB_FRAMES * USBVISION_MAX_ISOC_PACKET_SIZE; - - /* Clean pointers so we know if we allocated something */ - for (i = 0; i < USBVISION_NUMSBUF; i++) - usbvision->sbuf[i].data = NULL; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) - for (i = 0; i < USBVISION_NUMSBUF; i++) { - usbvision->sbuf[i].data = kmalloc(sb_size, GFP_KERNEL); - if (usbvision->sbuf[i].data == NULL) { - err("%s: unable to allocate %d bytes for sbuf", __FUNCTION__, sb_size); - errCode = -ENOMEM; - break; - } - } -#else - for (i = 0; i < USBVISION_NUMSBUF; i++) { - usbvision->sbuf[i].data = kzalloc(sb_size, GFP_KERNEL); - if (usbvision->sbuf[i].data == NULL) { - err("%s: unable to allocate %d bytes for sbuf", __FUNCTION__, sb_size); - errCode = -ENOMEM; - break; - } - } -#endif - return errCode; -} - - -void usbvision_sbuf_free(struct usb_usbvision *usbvision) -{ - int i; - - for (i = 0; i < USBVISION_NUMSBUF; i++) { - if (usbvision->sbuf[i].data != NULL) { - kfree(usbvision->sbuf[i].data); - usbvision->sbuf[i].data = NULL; - } - } -} - /* * usbvision_init_isoc() * @@ -2484,6 +2428,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) { struct usb_device *dev = usbvision->dev; int bufIdx, errCode, regValue; + const int sb_size = USBVISION_URB_FRAMES * USBVISION_MAX_ISOC_PACKET_SIZE; if (!USBVISION_IS_OPERATIONAL(usbvision)) return -EFAULT; @@ -2523,6 +2468,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) return -ENOMEM; } usbvision->sbuf[bufIdx].urb = urb; + usbvision->sbuf[bufIdx].data = usb_buffer_alloc(usbvision->dev, sb_size, GFP_KERNEL,&urb->transfer_dma); urb->dev = dev; urb->context = usbvision; urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp); @@ -2583,6 +2529,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) void usbvision_stop_isoc(struct usb_usbvision *usbvision) { int bufIdx, errCode, regValue; + const int sb_size = USBVISION_URB_FRAMES * USBVISION_MAX_ISOC_PACKET_SIZE; if ((usbvision->streaming == Stream_Off) || (usbvision->dev == NULL)) return; @@ -2591,6 +2538,12 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision) #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9) for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { usb_kill_urb(usbvision->sbuf[bufIdx].urb); + if (usbvision->sbuf[bufIdx].data){ + usb_buffer_free(usbvision->dev, + sb_size, + usbvision->sbuf[bufIdx].data, + usbvision->sbuf[bufIdx].urb->transfer_dma); + } usb_free_urb(usbvision->sbuf[bufIdx].urb); usbvision->sbuf[bufIdx].urb = NULL; } @@ -2601,6 +2554,12 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision) err("%s: usb_unlink_urb() failed: error %d", __FUNCTION__, errCode); } + if (usbvision->sbuf[bufIdx].data){ + usb_buffer_free(usbvision->dev, + (EM28XX_NUM_PACKETS*usbvision->max_pkt_size), + usbvision->sbuf[bufIdx].data, + usbvision->sbuf[bufIdx].urb->transfer_dma); + } /* Delete them all */ for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) usb_free_urb(usbvision->sbuf[bufIdx].urb); |