/* * Copyright (c) 2013 Lubomir Rintel * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions, and the following disclaimer, * without modification. * 2. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL"). * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * Fushicai USBTV007 Audio-Video Grabber Driver * * No physical hardware was harmed running Windows during the * reverse-engineering activity */ #include <linux/module.h> #include <linux/slab.h> #include <linux/usb.h> #include <media/v4l2-device.h> #include <media/v4l2-ctrls.h> #include <media/videobuf2-v4l2.h> #include <media/videobuf2-vmalloc.h> /* Hardware. */ #define USBTV_VIDEO_ENDP … #define USBTV_AUDIO_ENDP … #define USBTV_BASE … #define USBTV_CONTROL_REG … #define USBTV_REQUEST_REG … /* Number of concurrent isochronous urbs submitted. * Higher numbers was seen to overly saturate the USB bus. */ #define USBTV_ISOC_TRANSFERS … #define USBTV_ISOC_PACKETS … #define USBTV_CHUNK_SIZE … #define USBTV_CHUNK … #define USBTV_AUDIO_URBSIZE … #define USBTV_AUDIO_HDRSIZE … #define USBTV_AUDIO_BUFFER … /* Chunk header. */ #define USBTV_MAGIC_OK(chunk) … #define USBTV_FRAME_ID(chunk) … #define USBTV_ODD(chunk) … #define USBTV_CHUNK_NO(chunk) … #define USBTV_TV_STD … /* parameters for supported TV norms */ struct usbtv_norm_params { … }; /* A single videobuf2 frame buffer. */ struct usbtv_buf { … }; /* Per-device structure. */ struct usbtv { … }; int usbtv_set_regs(struct usbtv *usbtv, const u16 regs[][2], int size); int usbtv_video_init(struct usbtv *usbtv); void usbtv_video_free(struct usbtv *usbtv); int usbtv_audio_init(struct usbtv *usbtv); void usbtv_audio_free(struct usbtv *usbtv); void usbtv_audio_suspend(struct usbtv *usbtv); void usbtv_audio_resume(struct usbtv *usbtv);