From 6ae635c4f36d7a0b931feb4bb6dad6e5f18187cf Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Apr 2010 11:24:18 -0300 Subject: V4L/DVB: tm6000: Properly set alternate when preparing to stream Although the code is getting the better alternates, it is not really using it. Get the interface/alternate numbers and use it where needed. This patch implements also one small fix at the last_line set, as proposed by Bee Hock Goh . Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'drivers/staging/tm6000/tm6000-video.c') diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index be6fcb79ef07..92edb4185868 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -151,7 +151,8 @@ static inline void get_next_buf(struct tm6000_dmaqueue *dma_q, /* Cleans up buffer - Usefull for testing for frame/URB loss */ outp = videobuf_to_vmalloc(&(*buf)->vb); - memset(outp, 0, (*buf)->vb.size); + if (outp) + memset(outp, 0, (*buf)->vb.size); return; } @@ -284,7 +285,8 @@ static int copy_packet(struct urb *urb, u32 header, u8 **ptr, u8 *endp, start_line=line; last_field=field; } - last_line=line; + if (cmd == TM6000_URB_MSG_VIDEO) + last_line = line; pktsize = TM6000_URB_MSG_LEN; } else { @@ -616,14 +618,18 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, unsigned int framesize) /* De-allocates all pending stuff */ tm6000_uninit_isoc(dev); + usb_set_interface(dev->udev, + dev->isoc_in.bInterfaceNumber, + dev->isoc_in.bAlternateSetting); + pipe = usb_rcvisocpipe(dev->udev, - dev->isoc_in->desc.bEndpointAddress & + dev->isoc_in.endp->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); size = usb_maxpacket(dev->udev, pipe, usb_pipeout(pipe)); - if (size > dev->max_isoc_in) - size = dev->max_isoc_in; + if (size > dev->isoc_in.maxsize) + size = dev->isoc_in.maxsize; dev->isoc_ctl.max_pkt_size = size; @@ -653,8 +659,7 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, unsigned int framesize) dprintk(dev, V4L2_DEBUG_QUEUE, "Allocating %d x %d packets" " (%d bytes) of %d bytes each to handle %u size\n", max_packets, num_bufs, sb_size, - dev->max_isoc_in, size); - + dev->isoc_in.maxsize, size); /* allocate urbs and transfer buffers */ for (i = 0; i < dev->isoc_ctl.num_bufs; i++) { @@ -682,7 +687,7 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, unsigned int framesize) usb_fill_bulk_urb(urb, dev->udev, pipe, dev->isoc_ctl.transfer_buffer[i], sb_size, tm6000_irq_callback, dma_q); - urb->interval = dev->isoc_in->desc.bInterval; + urb->interval = dev->isoc_in.endp->desc.bInterval; urb->number_of_packets = max_packets; urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; -- cgit v1.2.3