Lines Matching refs:pdev
126 struct pwc_device *pdev; member
243 static int pwc_allocate_buffers(struct pwc_device *pdev) in pwc_allocate_buffers() argument
248 Trace(TRACE_MEMORY, ">> pwc_allocate_buffers(pdev = 0x%p)\n", pdev); in pwc_allocate_buffers()
250 if (pdev == NULL) in pwc_allocate_buffers()
254 if (pdev->magic != PWC_MAGIC) { in pwc_allocate_buffers()
261 if (pdev->sbuf[i].data == NULL) { in pwc_allocate_buffers()
268 pdev->sbuf[i].data = kbuf; in pwc_allocate_buffers()
274 if (pdev->fbuf == NULL) { in pwc_allocate_buffers()
281 pdev->fbuf = kbuf; in pwc_allocate_buffers()
286 if (pdev->fbuf[i].data == NULL) { in pwc_allocate_buffers()
293 pdev->fbuf[i].data = kbuf; in pwc_allocate_buffers()
300 if (pdev->decompressor != NULL) { in pwc_allocate_buffers()
301 kbuf = kmalloc(pdev->decompressor->table_size, GFP_KERNEL); in pwc_allocate_buffers()
308 pdev->decompress_data = kbuf; in pwc_allocate_buffers()
311 kbuf = rvmalloc(default_mbufs * pdev->len_per_image); in pwc_allocate_buffers()
317 pdev->image_data = kbuf; in pwc_allocate_buffers()
319 pdev->image_ptr[i] = kbuf + i * pdev->len_per_image; in pwc_allocate_buffers()
321 pdev->image_ptr[i] = NULL; in pwc_allocate_buffers()
329 static void pwc_free_buffers(struct pwc_device *pdev) in pwc_free_buffers() argument
333 Trace(TRACE_MEMORY, "Entering free_buffers(%p).\n", pdev); in pwc_free_buffers()
335 if (pdev == NULL) in pwc_free_buffers()
338 if (pdev->magic != PWC_MAGIC) { in pwc_free_buffers()
346 if (pdev->sbuf[i].data != NULL) { in pwc_free_buffers()
347 Trace(TRACE_MEMORY, "Freeing ISO buffer at %p.\n", pdev->sbuf[i].data); in pwc_free_buffers()
348 kfree(pdev->sbuf[i].data); in pwc_free_buffers()
349 pdev->sbuf[i].data = NULL; in pwc_free_buffers()
353 if (pdev->fbuf != NULL) { in pwc_free_buffers()
355 if (pdev->fbuf[i].data != NULL) { in pwc_free_buffers()
356 Trace(TRACE_MEMORY, "Freeing frame buffer %d at %p.\n", i, pdev->fbuf[i].data); in pwc_free_buffers()
357 vfree(pdev->fbuf[i].data); in pwc_free_buffers()
358 pdev->fbuf[i].data = NULL; in pwc_free_buffers()
361 kfree(pdev->fbuf); in pwc_free_buffers()
362 pdev->fbuf = NULL; in pwc_free_buffers()
366 if (pdev->decompress_data != NULL) { in pwc_free_buffers()
367 Trace(TRACE_MEMORY, "Freeing decompression buffer at %p.\n", pdev->decompress_data); in pwc_free_buffers()
368 kfree(pdev->decompress_data); in pwc_free_buffers()
369 pdev->decompress_data = NULL; in pwc_free_buffers()
371 pdev->decompressor = NULL; in pwc_free_buffers()
374 if (pdev->image_data != NULL) { in pwc_free_buffers()
375 Trace(TRACE_MEMORY, "Freeing image buffer at %p.\n", pdev->image_data); in pwc_free_buffers()
376 rvfree(pdev->image_data, default_mbufs * pdev->len_per_image); in pwc_free_buffers()
378 pdev->image_data = NULL; in pwc_free_buffers()
440 static inline int pwc_next_fill_frame(struct pwc_device *pdev) in pwc_next_fill_frame() argument
446 spin_lock_irqsave(&pdev->ptrlock, flags); in pwc_next_fill_frame()
447 if (pdev->fill_frame != NULL) { in pwc_next_fill_frame()
449 if (pdev->full_frames == NULL) { in pwc_next_fill_frame()
450 pdev->full_frames = pdev->fill_frame; in pwc_next_fill_frame()
451 pdev->full_frames_tail = pdev->full_frames; in pwc_next_fill_frame()
454 pdev->full_frames_tail->next = pdev->fill_frame; in pwc_next_fill_frame()
455 pdev->full_frames_tail = pdev->fill_frame; in pwc_next_fill_frame()
458 if (pdev->empty_frames != NULL) { in pwc_next_fill_frame()
460 pdev->fill_frame = pdev->empty_frames; in pwc_next_fill_frame()
461 pdev->empty_frames = pdev->empty_frames->next; in pwc_next_fill_frame()
467 if (pdev->full_frames == NULL) { in pwc_next_fill_frame()
469 spin_unlock_irqrestore(&pdev->ptrlock, flags); in pwc_next_fill_frame()
473 pdev->fill_frame = pdev->full_frames; in pwc_next_fill_frame()
474 pdev->full_frames = pdev->full_frames->next; in pwc_next_fill_frame()
477 pdev->fill_frame->next = NULL; in pwc_next_fill_frame()
479 Trace(TRACE_SEQUENCE, "Assigning sequence number %d.\n", pdev->sequence); in pwc_next_fill_frame()
480 pdev->fill_frame->sequence = pdev->sequence++; in pwc_next_fill_frame()
482 spin_unlock_irqrestore(&pdev->ptrlock, flags); in pwc_next_fill_frame()
492 static void pwc_reset_buffers(struct pwc_device *pdev) in pwc_reset_buffers() argument
497 spin_lock_irqsave(&pdev->ptrlock, flags); in pwc_reset_buffers()
498 pdev->full_frames = NULL; in pwc_reset_buffers()
499 pdev->full_frames_tail = NULL; in pwc_reset_buffers()
501 pdev->fbuf[i].filled = 0; in pwc_reset_buffers()
503 pdev->fbuf[i].next = &pdev->fbuf[i - 1]; in pwc_reset_buffers()
505 pdev->fbuf->next = NULL; in pwc_reset_buffers()
507 pdev->empty_frames = &pdev->fbuf[default_fbufs - 1]; in pwc_reset_buffers()
508 pdev->empty_frames_tail = pdev->fbuf; in pwc_reset_buffers()
509 pdev->read_frame = NULL; in pwc_reset_buffers()
510 pdev->fill_frame = pdev->empty_frames; in pwc_reset_buffers()
511 pdev->empty_frames = pdev->empty_frames->next; in pwc_reset_buffers()
513 pdev->image_read_pos = 0; in pwc_reset_buffers()
514 pdev->fill_image = 0; in pwc_reset_buffers()
515 spin_unlock_irqrestore(&pdev->ptrlock, flags); in pwc_reset_buffers()
522 static int pwc_handle_frame(struct pwc_device *pdev) in pwc_handle_frame() argument
527 spin_lock_irqsave(&pdev->ptrlock, flags); in pwc_handle_frame()
530 if (pdev->read_frame != NULL) { in pwc_handle_frame()
535 if (pdev->full_frames == NULL) { in pwc_handle_frame()
539 pdev->read_frame = pdev->full_frames; in pwc_handle_frame()
540 pdev->full_frames = pdev->full_frames->next; in pwc_handle_frame()
541 pdev->read_frame->next = NULL; in pwc_handle_frame()
544 if (pdev->read_frame != NULL) { in pwc_handle_frame()
546 Trace(TRACE_SEQUENCE, "Decompressing frame %d\n", pdev->read_frame->sequence); in pwc_handle_frame()
552 spin_unlock_irqrestore(&pdev->ptrlock, flags); in pwc_handle_frame()
553 ret = pwc_decompress(pdev); in pwc_handle_frame()
554 spin_lock_irqsave(&pdev->ptrlock, flags); in pwc_handle_frame()
557 if (pdev->empty_frames == NULL) { in pwc_handle_frame()
558 pdev->empty_frames = pdev->read_frame; in pwc_handle_frame()
559 pdev->empty_frames_tail = pdev->empty_frames; in pwc_handle_frame()
562 pdev->empty_frames_tail->next = pdev->read_frame; in pwc_handle_frame()
563 pdev->empty_frames_tail = pdev->read_frame; in pwc_handle_frame()
565 pdev->read_frame = NULL; in pwc_handle_frame()
568 spin_unlock_irqrestore(&pdev->ptrlock, flags); in pwc_handle_frame()
575 static inline void pwc_next_image(struct pwc_device *pdev) in pwc_next_image() argument
577 pdev->image_used[pdev->fill_image] = 0; in pwc_next_image()
578 pdev->fill_image = (pdev->fill_image + 1) % default_mbufs; in pwc_next_image()
588 struct pwc_device *pdev; in pwc_isoc_handler() local
595 pdev = (struct pwc_device *)urb->context; in pwc_isoc_handler()
596 if (pdev == NULL) { in pwc_isoc_handler()
601 if (pdev->magic != PWC_MAGIC) { in pwc_isoc_handler()
626 if (++pdev->visoc_errors > MAX_ISOC_ERRORS) in pwc_isoc_handler()
629 pdev->error_status = EIO; in pwc_isoc_handler()
636 fbuf = pdev->fill_frame; in pwc_isoc_handler()
646 wake_up_interruptible(&pdev->frameq); in pwc_isoc_handler()
651 pdev->visoc_errors = 0; in pwc_isoc_handler()
664 if (pdev->vsync > 0) { /* ...and we are not sync-hunting... */ in pwc_isoc_handler()
665 pdev->vsync = 2; in pwc_isoc_handler()
668 if (flen + fbuf->filled > pdev->frame_size) { in pwc_isoc_handler()
669 …Trace(TRACE_FLOW, "Frame buffer overflow (flen = %d, frame_size = %d).\n", flen, pdev->frame_size); in pwc_isoc_handler()
670 pdev->vsync = 0; /* Hmm, let's wait for an EOF (end-of-frame) */ in pwc_isoc_handler()
671 pdev->vframes_error++; in pwc_isoc_handler()
681 if (flen < pdev->vlast_packet_size) { in pwc_isoc_handler()
686 if (pdev->vsync == 2) { in pwc_isoc_handler()
691 if (pdev->type == 730) { in pwc_isoc_handler()
698 pdev->drop_frames += 2; in pwc_isoc_handler()
699 pdev->vframes_error++; in pwc_isoc_handler()
701 if ((ptr[0] ^ pdev->vmirror) & 0x01) { in pwc_isoc_handler()
707 if ((ptr[0] ^ pdev->vmirror) & 0x02) { in pwc_isoc_handler()
713 pdev->vmirror = ptr[0] & 0x03; in pwc_isoc_handler()
724 pdev->drop_frames++; in pwc_isoc_handler()
730 if (pdev->drop_frames > 0) in pwc_isoc_handler()
731 pdev->drop_frames--; in pwc_isoc_handler()
734 if (fbuf->filled < pdev->frame_size) { in pwc_isoc_handler()
736 pdev->vframes_error++; in pwc_isoc_handler()
746 if (pwc_next_fill_frame(pdev)) { in pwc_isoc_handler()
747 pdev->vframes_dumped++; in pwc_isoc_handler()
748 if ((pdev->vframe_count > FRAME_LOWMARK) && (pwc_trace & TRACE_FLOW)) { in pwc_isoc_handler()
749 if (pdev->vframes_dumped < 20) in pwc_isoc_handler()
750 Trace(TRACE_FLOW, "Dumping frame %d.\n", pdev->vframe_count); in pwc_isoc_handler()
751 if (pdev->vframes_dumped == 20) in pwc_isoc_handler()
752 Trace(TRACE_FLOW, "Dumping frame %d (last message).\n", pdev->vframe_count); in pwc_isoc_handler()
755 fbuf = pdev->fill_frame; in pwc_isoc_handler()
758 pdev->vframe_count++; in pwc_isoc_handler()
762 pdev->vsync = 1; in pwc_isoc_handler()
764 pdev->vlast_packet_size = flen; in pwc_isoc_handler()
777 wake_up_interruptible(&pdev->frameq); in pwc_isoc_handler()
781 static int pwc_isoc_init(struct pwc_device *pdev) in pwc_isoc_init() argument
789 if (pdev == NULL) in pwc_isoc_init()
791 if (pdev->iso_init) in pwc_isoc_init()
793 pdev->vsync = 0; in pwc_isoc_init()
794 udev = pdev->udev; in pwc_isoc_init()
799 idesc = &udev->actconfig->interface[0].altsetting[pdev->valternate]; in pwc_isoc_init()
804 pdev->vmax_packet_size = -1; in pwc_isoc_init()
806 if ((idesc->endpoint[i].bEndpointAddress & 0xF) == pdev->vendpoint) { in pwc_isoc_init()
807 pdev->vmax_packet_size = idesc->endpoint[i].wMaxPacketSize; in pwc_isoc_init()
811 if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) { in pwc_isoc_init()
818 Trace(TRACE_OPEN, "Setting alternate interface %d\n", pdev->valternate); in pwc_isoc_init()
819 ret = usb_set_interface(pdev->udev, 0, pdev->valternate); in pwc_isoc_init()
830 pdev->sbuf[i].urb = urb; in pwc_isoc_init()
836 if (pdev->sbuf[i].urb != NULL) in pwc_isoc_init()
837 usb_free_urb(pdev->sbuf[i].urb); in pwc_isoc_init()
838 pdev->sbuf[i].urb = NULL; in pwc_isoc_init()
846 urb = pdev->sbuf[i].urb; in pwc_isoc_init()
848 urb->next = pdev->sbuf[(i + 1) % MAX_ISO_BUFS].urb; in pwc_isoc_init()
850 urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint); in pwc_isoc_init()
852 urb->transfer_buffer = pdev->sbuf[i].data; in pwc_isoc_init()
855 urb->context = pdev; in pwc_isoc_init()
860 urb->iso_frame_desc[j].length = pdev->vmax_packet_size; in pwc_isoc_init()
866 ret = usb_submit_urb(pdev->sbuf[i].urb); in pwc_isoc_init()
870 Trace(TRACE_OPEN, "URB 0x%p submitted.\n", pdev->sbuf[i].urb); in pwc_isoc_init()
874 pdev->iso_init = 1; in pwc_isoc_init()
879 static void pwc_isoc_cleanup(struct pwc_device *pdev) in pwc_isoc_cleanup() argument
884 if (pdev == NULL) in pwc_isoc_cleanup()
891 urb = pdev->sbuf[i].urb; in pwc_isoc_cleanup()
893 if (pdev->iso_init) { in pwc_isoc_cleanup()
899 pdev->sbuf[i].urb = NULL; in pwc_isoc_cleanup()
906 if (pdev->error_status && pdev->error_status != EPIPE) { in pwc_isoc_cleanup()
908 usb_set_interface(pdev->udev, 0, 0); in pwc_isoc_cleanup()
911 pdev->iso_init = 0; in pwc_isoc_cleanup()
915 int pwc_try_video_mode(struct pwc_device *pdev, int width, int height, int new_fps, int new_compres… in pwc_try_video_mode() argument
919 pwc_isoc_cleanup(pdev); in pwc_try_video_mode()
921 pwc_reset_buffers(pdev); in pwc_try_video_mode()
923 ret = pwc_set_video_mode(pdev, width, height, new_fps, new_compression, new_snapshot); in pwc_try_video_mode()
925 …ret = pwc_set_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, pdev->vcompression, pdev… in pwc_try_video_mode()
927 if (pwc_isoc_init(pdev) < 0) in pwc_try_video_mode()
929 pdev->drop_frames++; /* try to avoid garbage during switch */ in pwc_try_video_mode()
940 struct pwc_device *pdev; in pwc_video_open() local
946 pdev = (struct pwc_device *)vdev->priv; in pwc_video_open()
947 if (pdev == NULL) in pwc_video_open()
949 if (pdev->vopen) in pwc_video_open()
952 down(&pdev->modlock); in pwc_video_open()
953 if (!pdev->usb_init) { in pwc_video_open()
955 pdev->usb_init = 1; in pwc_video_open()
961 i = pwc_get_cmos_sensor(pdev); in pwc_video_open()
977 Info("This %s camera is equipped with a %s (%d).\n", pdev->vdev.name, sensor_type, i); in pwc_video_open()
983 i = pwc_camera_power(pdev, 1); in pwc_video_open()
988 if (pwc_set_leds(pdev, led_on, led_off) < 0) in pwc_video_open()
992 pdev->decompressor = pwc_find_decompressor(pdev->type); in pwc_video_open()
994 Debug("Found decompressor for %d at 0x%p\n", pdev->type, pdev->decompressor); in pwc_video_open()
998 i = pwc_allocate_buffers(pdev); in pwc_video_open()
1001 up(&pdev->modlock); in pwc_video_open()
1006 pwc_reset_buffers(pdev); in pwc_video_open()
1008 pdev->image_used[i] = 0; in pwc_video_open()
1009 pdev->vframe_count = 0; in pwc_video_open()
1010 pdev->vframes_dumped = 0; in pwc_video_open()
1011 pdev->vframes_error = 0; in pwc_video_open()
1012 pdev->visoc_errors = 0; in pwc_video_open()
1013 pdev->error_status = 0; in pwc_video_open()
1015 pdev->sequence = 0; in pwc_video_open()
1019 pdev->vsnapshot = 0; in pwc_video_open()
1025 …i = pwc_set_video_mode(pdev, pwc_image_sizes[pdev->vsize].x, pwc_image_sizes[pdev->vsize].y, pdev-… in pwc_video_open()
1028 if (pdev->type == 730 || pdev->type == 740 || pdev->type == 750) in pwc_video_open()
1029 …i = pwc_set_video_mode(pdev, pwc_image_sizes[PSZ_QSIF].x, pwc_image_sizes[PSZ_QSIF].y, 10, pdev->v… in pwc_video_open()
1031 …i = pwc_set_video_mode(pdev, pwc_image_sizes[PSZ_QCIF].x, pwc_image_sizes[PSZ_QCIF].y, 10, pdev->v… in pwc_video_open()
1035 up(&pdev->modlock); in pwc_video_open()
1039 i = pwc_isoc_init(pdev); in pwc_video_open()
1042 up(&pdev->modlock); in pwc_video_open()
1046 pdev->vopen++; in pwc_video_open()
1051 if (pdev->decompressor != NULL) in pwc_video_open()
1052 pdev->decompressor->lock(); in pwc_video_open()
1053 up(&pdev->modlock); in pwc_video_open()
1058 static void pwc_cleanup(struct pwc_device *pdev) in pwc_cleanup() argument
1060 video_unregister_device(&pdev->vdev); in pwc_cleanup()
1066 struct pwc_device *pdev; in pwc_video_close() local
1071 pdev = (struct pwc_device *)vdev->priv; in pwc_video_close()
1072 if (pdev->vopen == 0) in pwc_video_close()
1079 if (pdev->vframe_count > 20) in pwc_video_close()
1080 …ceived, dumped %d frames, %d frames with errors.\n", pdev->vframe_count, pdev->vframes_dumped, pde… in pwc_video_close()
1082 if (pdev->decompressor != NULL) { in pwc_video_close()
1083 pdev->decompressor->exit(); in pwc_video_close()
1084 pdev->decompressor->unlock(); in pwc_video_close()
1085 pdev->decompressor = NULL; in pwc_video_close()
1088 pwc_isoc_cleanup(pdev); in pwc_video_close()
1089 pwc_free_buffers(pdev); in pwc_video_close()
1093 if (!pdev->unplugged) { in pwc_video_close()
1094 if (pwc_set_leds(pdev, 0, 0) < 0) in pwc_video_close()
1097 i = pwc_camera_power(pdev, 0); in pwc_video_close()
1101 pdev->vopen = 0; in pwc_video_close()
1104 pwc_cleanup(pdev); in pwc_video_close()
1106 kfree(pdev); in pwc_video_close()
1109 if (device_hint[hint].pdev == pdev) in pwc_video_close()
1110 device_hint[hint].pdev = NULL; in pwc_video_close()
1129 struct pwc_device *pdev; in pwc_video_read() local
1135 pdev = vdev->priv; in pwc_video_read()
1136 if (pdev == NULL) in pwc_video_read()
1138 if (pdev->error_status) in pwc_video_read()
1139 return -pdev->error_status; /* Something happened, report what. */ in pwc_video_read()
1142 if (pdev->image_read_pos == 0) { in pwc_video_read()
1144 add_wait_queue(&pdev->frameq, &wait); in pwc_video_read()
1145 while (pdev->full_frames == NULL) { in pwc_video_read()
1147 if (pdev->error_status) { in pwc_video_read()
1148 remove_wait_queue(&pdev->frameq, &wait); in pwc_video_read()
1150 return -pdev->error_status ; in pwc_video_read()
1153 remove_wait_queue(&pdev->frameq, &wait); in pwc_video_read()
1158 remove_wait_queue(&pdev->frameq, &wait); in pwc_video_read()
1165 remove_wait_queue(&pdev->frameq, &wait); in pwc_video_read()
1169 if (pwc_handle_frame(pdev)) in pwc_video_read()
1175 if (count + pdev->image_read_pos > pdev->view.size) in pwc_video_read()
1176 count = pdev->view.size - pdev->image_read_pos; in pwc_video_read()
1177 if (copy_to_user(buf, pdev->image_ptr[pdev->fill_image] + pdev->image_read_pos, count)) in pwc_video_read()
1179 pdev->image_read_pos += count; in pwc_video_read()
1180 if (pdev->image_read_pos >= pdev->view.size) { /* All data has been read */ in pwc_video_read()
1181 pdev->image_read_pos = 0; in pwc_video_read()
1182 pwc_next_image(pdev); in pwc_video_read()
1195 struct pwc_device *pdev; in pwc_video_poll() local
1199 pdev = vdev->priv; in pwc_video_poll()
1200 if (pdev == NULL) in pwc_video_poll()
1203 poll_wait(file, &pdev->frameq, wait); in pwc_video_poll()
1204 if (pdev->error_status) in pwc_video_poll()
1206 if (pdev->full_frames != NULL) /* we have frames waiting */ in pwc_video_poll()
1214 struct pwc_device *pdev; in pwc_video_ioctl() local
1219 pdev = vdev->priv; in pwc_video_ioctl()
1220 if (pdev == NULL) in pwc_video_ioctl()
1233 caps.minwidth = pdev->view_min.x; in pwc_video_ioctl()
1234 caps.minheight = pdev->view_min.y; in pwc_video_ioctl()
1235 caps.maxwidth = pdev->view_max.x; in pwc_video_ioctl()
1236 caps.maxheight = pdev->view_max.y; in pwc_video_ioctl()
1289 val = pwc_get_brightness(pdev); in pwc_video_ioctl()
1294 val = pwc_get_contrast(pdev); in pwc_video_ioctl()
1300 val = pwc_get_gamma(pdev); in pwc_video_ioctl()
1305 val = pwc_get_saturation(pdev); in pwc_video_ioctl()
1334 pwc_set_brightness(pdev, p.brightness); in pwc_video_ioctl()
1335 pwc_set_contrast(pdev, p.contrast); in pwc_video_ioctl()
1336 pwc_set_gamma(pdev, p.whiteness); in pwc_video_ioctl()
1337 pwc_set_saturation(pdev, p.colour); in pwc_video_ioctl()
1351 vw.width = pdev->view.x; in pwc_video_ioctl()
1352 vw.height = pdev->view.y; in pwc_video_ioctl()
1354 vw.flags = (pdev->vframes << PWC_FPS_SHIFT) | in pwc_video_ioctl()
1355 (pdev->vsnapshot ? PWC_FPS_SNAPSHOT : 0); in pwc_video_ioctl()
1373 fps = pdev->vframes; in pwc_video_ioctl()
1374 …if (pdev->view.x == vw.width && pdev->view.y && fps == pdev->vframes && snapshot == pdev->vsnapsho… in pwc_video_ioctl()
1376 ret = pwc_try_video_mode(pdev, vw.width, vw.height, fps, pdev->vcompression, snapshot); in pwc_video_ioctl()
1406 vm.size = default_mbufs * pdev->len_per_image; in pwc_video_ioctl()
1409 vm.offsets[i] = i * pdev->len_per_image; in pwc_video_ioctl()
1435 if ((vm.width != pdev->view.x || vm.height != pdev->view.y) && in pwc_video_ioctl()
1436 (vm.width >= pdev->view_min.x && vm.height >= pdev->view_min.y)) { in pwc_video_ioctl()
1440 …ret = pwc_try_video_mode(pdev, vm.width, vm.height, pdev->vframes, pdev->vcompression, pdev->vsnap… in pwc_video_ioctl()
1446 if (pdev->image_used[vm.frame]) in pwc_video_ioctl()
1448 pdev->image_used[vm.frame] = 1; in pwc_video_ioctl()
1489 if (pdev->image_used[mbuf] == 0) in pwc_video_ioctl()
1499 add_wait_queue(&pdev->frameq, &wait); in pwc_video_ioctl()
1500 while (pdev->full_frames == NULL) { in pwc_video_ioctl()
1501 if (pdev->error_status) { in pwc_video_ioctl()
1502 remove_wait_queue(&pdev->frameq, &wait); in pwc_video_ioctl()
1504 return -pdev->error_status; in pwc_video_ioctl()
1507 remove_wait_queue(&pdev->frameq, &wait); in pwc_video_ioctl()
1514 remove_wait_queue(&pdev->frameq, &wait); in pwc_video_ioctl()
1524 pdev->fill_image = mbuf; /* tell in which buffer we want the image to be expanded */ in pwc_video_ioctl()
1526 ret = pwc_handle_frame(pdev); in pwc_video_ioctl()
1527 pdev->image_used[mbuf] = 0; in pwc_video_ioctl()
1566 vu.video = pdev->vdev.minor & 0x3F; in pwc_video_ioctl()
1576 return pwc_ioctl(pdev, cmd, arg); in pwc_video_ioctl()
1583 struct pwc_device *pdev; in pwc_video_mmap() local
1588 pdev = vdev->priv; in pwc_video_mmap()
1590 pos = (unsigned long)pdev->image_data; in pwc_video_mmap()
1616 struct pwc_device *pdev = NULL; in usb_pwc_probe() local
1818 pdev = kmalloc(sizeof(struct pwc_device), GFP_KERNEL); in usb_pwc_probe()
1819 if (pdev == NULL) { in usb_pwc_probe()
1823 memset(pdev, 0, sizeof(struct pwc_device)); in usb_pwc_probe()
1824 pdev->type = type_id; in usb_pwc_probe()
1825 pwc_construct(pdev); in usb_pwc_probe()
1826 pdev->vsize = default_size; in usb_pwc_probe()
1827 pdev->vframes = default_fps; in usb_pwc_probe()
1829 init_MUTEX(&pdev->modlock); in usb_pwc_probe()
1830 pdev->ptrlock = SPIN_LOCK_UNLOCKED; in usb_pwc_probe()
1832 pdev->udev = udev; in usb_pwc_probe()
1833 init_waitqueue_head(&pdev->frameq); in usb_pwc_probe()
1834 pdev->vcompression = pwc_preferred_compression; in usb_pwc_probe()
1836 memcpy(&pdev->vdev, &pwc_template, sizeof(pwc_template)); in usb_pwc_probe()
1837 strcpy(pdev->vdev.name, name); in usb_pwc_probe()
1838 SET_MODULE_OWNER(&pdev->vdev); in usb_pwc_probe()
1839 pdev->vdev.priv = pdev; in usb_pwc_probe()
1841 pdev->release = udev->descriptor.bcdDevice; in usb_pwc_probe()
1842 Trace(TRACE_PROBE, "Release: %04x\n", pdev->release); in usb_pwc_probe()
1846 if (((device_hint[hint].type == -1) || (device_hint[hint].type == pdev->type)) && in usb_pwc_probe()
1847 (device_hint[hint].pdev == NULL)) { in usb_pwc_probe()
1858 i = video_register_device(&pdev->vdev, VFL_TYPE_GRABBER, video_nr); in usb_pwc_probe()
1861 kfree(pdev); /* Oops, no memory leaks please */ in usb_pwc_probe()
1865 Info("Registered as /dev/video%d.\n", pdev->vdev.minor & 0x3F); in usb_pwc_probe()
1869 device_hint[hint].pdev = pdev; in usb_pwc_probe()
1871 Trace(TRACE_PROBE, "probe() function returning struct at 0x%p.\n", pdev); in usb_pwc_probe()
1872 return pdev; in usb_pwc_probe()
1878 struct pwc_device *pdev; in usb_pwc_disconnect() local
1882 pdev = (struct pwc_device *)ptr; in usb_pwc_disconnect()
1883 if (pdev == NULL) { in usb_pwc_disconnect()
1888 if (pdev->udev == NULL) { in usb_pwc_disconnect()
1889 Err("pwc_disconnect() already called for %p\n", pdev); in usb_pwc_disconnect()
1893 if (pdev->udev != udev) { in usb_pwc_disconnect()
1899 if (pdev->magic != PWC_MAGIC) { in usb_pwc_disconnect()
1907 if (pdev->vopen) { in usb_pwc_disconnect()
1909 pdev->error_status = EPIPE; in usb_pwc_disconnect()
1913 wake_up_interruptible(&pdev->frameq); in usb_pwc_disconnect()
1915 if(pdev->vopen) { in usb_pwc_disconnect()
1916 pdev->unplugged = 1; in usb_pwc_disconnect()
1920 pwc_cleanup(pdev); in usb_pwc_disconnect()
1922 kfree(pdev); in usb_pwc_disconnect()
1926 if (device_hint[hint].pdev == pdev) in usb_pwc_disconnect()
1927 device_hint[hint].pdev = NULL; in usb_pwc_disconnect()
2062 device_hint[i].pdev = NULL; in usb_pwc_init()