bttvp.h revision 402aa76aa5e57801b4db5ccf8c7beea9f580bb1b
11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds bttv - Bt848 frame grabber driver 41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds bttv's *private* header file -- nobody other than bttv itself 61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds should ever include this file. 71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds (c) 2000-2002 Gerd Knorr <kraxel@bytesex.org> 91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds This program is free software; you can redistribute it and/or modify 111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds it under the terms of the GNU General Public License as published by 121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds the Free Software Foundation; either version 2 of the License, or 131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds (at your option) any later version. 141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds This program is distributed in the hope that it will be useful, 161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds but WITHOUT ANY WARRANTY; without even the implied warranty of 171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds GNU General Public License for more details. 191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds You should have received a copy of the GNU General Public License 211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds along with this program; if not, write to the Free Software 221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/ 241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef _BTTVP_H_ 261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define _BTTVP_H_ 271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2810b89ee387fd6cc38532a881f64b3d35f338ea0bMauro Carvalho Chehab#include <linux/version.h> 29e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek#define BTTV_VERSION_CODE KERNEL_VERSION(0,9,17) 301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/types.h> 321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/wait.h> 331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/i2c.h> 341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/i2c-algo-bit.h> 351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/videodev.h> 361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/pci.h> 371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/input.h> 38bd5f0ac930168899003952110c45d110958a5c55Ingo Molnar#include <linux/mutex.h> 3987ae9afdcada236d0a1b38ce2c465a65916961dcAdrian Bunk#include <linux/scatterlist.h> 401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <asm/io.h> 4118f3fa1e2eab297a2f7ec704385fa0ecfda0de55Mauro Carvalho Chehab#include <media/v4l2-common.h> 421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/device.h> 44c1accaa21bdef38ec0f36eaaf7ce3384fff9d0c5Mauro Carvalho Chehab#include <media/videobuf-dma-sg.h> 451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <media/tuner.h> 461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <media/tveeprom.h> 471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <media/ir-common.h> 481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 49674434c691e10015660022fc00b04985a23ef87bMauro Carvalho Chehab 501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include "bt848.h" 511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include "bttv.h" 521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include "btcx-risc.h" 531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef __KERNEL__ 551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define FORMAT_FLAGS_DITHER 0x01 571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define FORMAT_FLAGS_PACKED 0x02 581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define FORMAT_FLAGS_PLANAR 0x04 591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define FORMAT_FLAGS_RAW 0x08 601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define FORMAT_FLAGS_CrCb 0x10 611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RISC_SLOT_O_VBI 4 631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RISC_SLOT_O_FIELD 6 641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RISC_SLOT_E_VBI 10 651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RISC_SLOT_E_FIELD 12 661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RISC_SLOT_LOOP 14 671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RESOURCE_OVERLAY 1 69e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek#define RESOURCE_VIDEO_STREAM 2 701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RESOURCE_VBI 4 71e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek#define RESOURCE_VIDEO_READ 8 721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RAW_LINES 640 741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RAW_BPL 1024 751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define UNSET (-1U) 771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 78e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek/* Min. value in VDELAY register. */ 79e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek#define MIN_VDELAY 2 80e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek/* Even to get Cb first, odd for Cr. */ 81e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek#define MAX_HDELAY (0x3FF & -2) 82e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek/* Limits scaled width, which must be a multiple of 4. */ 83e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek#define MAX_HACTIVE (0x3FF & -4) 84e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek 8567f1570a0659abba5efbf55cc986187af61bdd52Michael H. Schimek#define clamp(x, low, high) min (max (low, x), high) 8667f1570a0659abba5efbf55cc986187af61bdd52Michael H. Schimek 87402aa76aa5e57801b4db5ccf8c7beea9f580bb1bDouglas Schilling Landgraf#define BTTV_NORMS (\ 88402aa76aa5e57801b4db5ccf8c7beea9f580bb1bDouglas Schilling Landgraf V4L2_STD_PAL | V4L2_STD_PAL_N | \ 89402aa76aa5e57801b4db5ccf8c7beea9f580bb1bDouglas Schilling Landgraf V4L2_STD_PAL_Nc | V4L2_STD_SECAM | \ 90402aa76aa5e57801b4db5ccf8c7beea9f580bb1bDouglas Schilling Landgraf V4L2_STD_NTSC | V4L2_STD_PAL_M | \ 91402aa76aa5e57801b4db5ccf8c7beea9f580bb1bDouglas Schilling Landgraf V4L2_STD_PAL_60) 921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* ---------------------------------------------------------- */ 931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct bttv_tvnorm { 951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int v4l2_id; 961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds char *name; 974ac97914c6c35f6bf132071c718e034d0846b9f5Mauro Carvalho Chehab u32 Fsc; 984ac97914c6c35f6bf132071c718e034d0846b9f5Mauro Carvalho Chehab u16 swidth, sheight; /* scaled standard width, height */ 991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 totalwidth; 1001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 adelay, bdelay, iform; 1011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u32 scaledtwidth; 1021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 hdelayx1, hactivex1; 1031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 vdelay; 1044ac97914c6c35f6bf132071c718e034d0846b9f5Mauro Carvalho Chehab u8 vbipack; 1051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 vtotal; 1061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int sram; 10767f1570a0659abba5efbf55cc986187af61bdd52Michael H. Schimek /* ITU-R frame line number of the first VBI line we can 108e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek capture, of the first and second field. The last possible line 109e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek is determined by cropcap.bounds. */ 11067f1570a0659abba5efbf55cc986187af61bdd52Michael H. Schimek u16 vbistart[2]; 111e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek /* Horizontally this counts fCLKx1 samples following the leading 112e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek edge of the horizontal sync pulse, vertically ITU-R frame line 113e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek numbers of the first field times two (2, 4, 6, ... 524 or 624). */ 114e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek struct v4l2_cropcap cropcap; 1151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 1161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern const struct bttv_tvnorm bttv_tvnorms[]; 1171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct bttv_format { 1191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds char *name; 1201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int fourcc; /* video4linux 2 */ 1211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int btformat; /* BT848_COLOR_FMT_* */ 1221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int btswap; /* BT848_COLOR_CTL_* */ 1231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int depth; /* bit/pixel */ 1241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int flags; 1251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int hshift,vshift; /* for planar modes */ 1261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 1271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* ---------------------------------------------------------- */ 1291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct bttv_geometry { 1311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u8 vtc,crop,comb; 1321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 width,hscale,hdelay; 1331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u16 sheight,vscale,vdelay,vtotal; 1341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 1351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct bttv_buffer { 1371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* common v4l buffer stuff -- must be first */ 1381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct videobuf_buffer vb; 1391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* bttv specific */ 1411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds const struct bttv_format *fmt; 1421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int tvnorm; 1431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int btformat; 1441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int btswap; 1451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct bttv_geometry geo; 1461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct btcx_riscmem top; 1471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct btcx_riscmem bottom; 148e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek struct v4l2_rect crop; 149e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek unsigned int vbi_skip[2]; 150e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek unsigned int vbi_count[2]; 1511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 1521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct bttv_buffer_set { 1541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct bttv_buffer *top; /* top field buffer */ 1551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct bttv_buffer *bottom; /* bottom field buffer */ 1561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int top_irq; 1571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int frame_irq; 1581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 1591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct bttv_overlay { 1611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int tvnorm; 1621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct v4l2_rect w; 1631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds enum v4l2_field field; 1641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct v4l2_clip *clips; 1651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int nclips; 1661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int setup_ok; 1671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 1681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 169e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimekstruct bttv_vbi_fmt { 170e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek struct v4l2_vbi_format fmt; 171e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek 172e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek /* fmt.start[] and count[] refer to this video standard. */ 173e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek const struct bttv_tvnorm *tvnorm; 174e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek 175e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek /* Earliest possible start of video capturing with this 176e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek v4l2_vbi_format, in struct bttv_crop.rect units. */ 177e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek __s32 end; 178e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek}; 179e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek 180e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek/* bttv-vbi.c */ 181e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimekvoid bttv_vbi_fmt_reset(struct bttv_vbi_fmt *f, int norm); 182e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek 183e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimekstruct bttv_crop { 184e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek /* A cropping rectangle in struct bttv_tvnorm.cropcap units. */ 185e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek struct v4l2_rect rect; 186e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek 187e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek /* Scaled image size limits with this crop rect. Divide 188e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek max_height, but not min_height, by two when capturing 189e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek single fields. See also bttv_crop_reset() and 190e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek bttv_crop_adjust() in bttv-driver.c. */ 191e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek __s32 min_scaled_width; 192e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek __s32 min_scaled_height; 193e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek __s32 max_scaled_width; 194e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek __s32 max_scaled_height; 195e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek}; 196e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek 1971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct bttv_fh { 1981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct bttv *btv; 1991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int resources; 2001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef VIDIOC_G_PRIORITY 2011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds enum v4l2_priority prio; 2021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 2031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds enum v4l2_buf_type type; 2041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* video capture */ 2061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct videobuf_queue cap; 2071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds const struct bttv_format *fmt; 2081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int width; 2091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int height; 2101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 211e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek /* video overlay */ 2121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds const struct bttv_format *ovfmt; 2131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct bttv_overlay ov; 2141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 215e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek /* Application called VIDIOC_S_CROP. */ 216e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek int do_crop; 217e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek 218e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek /* vbi capture */ 2191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct videobuf_queue vbi; 220e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek /* Current VBI capture window as seen through this fh (cannot 221e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek be global for compatibility with earlier drivers). Protected 222e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek by struct bttv.lock and struct bttv_fh.vbi.lock. */ 223e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek struct bttv_vbi_fmt vbi_fmt; 2241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 2251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* ---------------------------------------------------------- */ 2271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* bttv-risc.c */ 2281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* risc code generators - capture */ 2301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc, 2311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct scatterlist *sglist, 2321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int offset, unsigned int bpl, 233e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek unsigned int pitch, unsigned int skip_lines, 234e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek unsigned int store_lines); 2351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* control dma register + risc main loop */ 2371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsvoid bttv_set_dma(struct bttv *btv, int override); 2381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint bttv_risc_init_main(struct bttv *btv); 2391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint bttv_risc_hook(struct bttv *btv, int slot, struct btcx_riscmem *risc, 2401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int irqflags); 2411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* capture buffer handling */ 2431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf); 2441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint bttv_buffer_activate_video(struct bttv *btv, 2451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct bttv_buffer_set *set); 2461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint bttv_buffer_activate_vbi(struct bttv *btv, 2471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct bttv_buffer *vbi); 248c7b0ac0546985fc6361a8d92cf808d46da797677Mauro Carvalho Chehabvoid bttv_dma_free(struct videobuf_queue *q, struct bttv *btv, 249c7b0ac0546985fc6361a8d92cf808d46da797677Mauro Carvalho Chehab struct bttv_buffer *buf); 2501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* overlay handling */ 2521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint bttv_overlay_risc(struct bttv *btv, struct bttv_overlay *ov, 2531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds const struct bttv_format *fmt, 2541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct bttv_buffer *buf); 2551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* ---------------------------------------------------------- */ 2581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* bttv-vbi.c */ 2591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 260402aa76aa5e57801b4db5ccf8c7beea9f580bb1bDouglas Schilling Landgrafint vidioc_try_fmt_vbi(struct file *file, void *fh, struct v4l2_format *f); 261402aa76aa5e57801b4db5ccf8c7beea9f580bb1bDouglas Schilling Landgrafint vidioc_g_fmt_vbi(struct file *file, void *fh, struct v4l2_format *f); 262402aa76aa5e57801b4db5ccf8c7beea9f580bb1bDouglas Schilling Landgrafint vidioc_s_fmt_vbi(struct file *file, void *fh, struct v4l2_format *f); 2631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern struct videobuf_queue_ops bttv_vbi_qops; 2651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* ---------------------------------------------------------- */ 2671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* bttv-gpio.c */ 2681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern struct bus_type bttv_sub_bus_type; 2711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint bttv_sub_add_device(struct bttv_core *core, char *name); 2721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsint bttv_sub_del_devices(struct bttv_core *core); 2731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* ---------------------------------------------------------- */ 2761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* bttv-driver.c */ 2771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* insmod options */ 2791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern unsigned int bttv_verbose; 2801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern unsigned int bttv_debug; 2811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern unsigned int bttv_gpio; 2821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern void bttv_gpio_tracking(struct bttv *btv, char *comment); 2831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int init_bttv_i2c(struct bttv *btv); 2841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern int fini_bttv_i2c(struct bttv *btv); 2851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 286e1e70a262d5cb5a02d2fc171e0178197849482d4Bernd Petrovitsch#define bttv_printk if (bttv_verbose) printk 2871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define dprintk if (bttv_debug >= 1) printk 2881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define d2printk if (bttv_debug >= 2) printk 2891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BTTV_MAX_FBUF 0x208000 291fe06fe0a4d0f781f8ae0570e4d7e517a81878c1dMauro Carvalho Chehab#define BTTV_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */ 292fe06fe0a4d0f781f8ae0570e4d7e517a81878c1dMauro Carvalho Chehab#define BTTV_FREE_IDLE msecs_to_jiffies(1000) /* one second */ 2931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 2951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct bttv_pll_info { 2961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int pll_ifreq; /* PLL input frequency */ 2971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int pll_ofreq; /* PLL output frequency */ 2981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int pll_crystal; /* Crystal used for input */ 2991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int pll_current; /* Currently programmed ofreq */ 3001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 3011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* for gpio-connected remote control */ 3031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct bttv_input { 304b7df3910c1298fee8ed7b9dfd2da74b85df5539cDmitry Torokhov struct input_dev *dev; 3051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct ir_input_state ir; 3061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds char name[32]; 3071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds char phys[32]; 3081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u32 mask_keycode; 3091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u32 mask_keydown; 3101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 3111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct bttv_suspend_state { 3131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u32 gpio_enable; 3141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds u32 gpio_data; 3151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int disabled; 3161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int loop_irq; 3171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct bttv_buffer_set video; 3181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct bttv_buffer *vbi; 3191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 3201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct bttv { 3221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct bttv_core c; 3231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* pci device config */ 3251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned short id; 3261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned char revision; 3271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned char __iomem *bt848_mmio; /* pointer to mmio */ 3281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* card configuration info */ 3301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int cardid; /* pci subsystem id (bt878 based ones) */ 3314ac97914c6c35f6bf132071c718e034d0846b9f5Mauro Carvalho Chehab unsigned int tuner_type; /* tuner chip type */ 33239e8f40da20a803a17e16304e73fd31050b1871cHans Verkuil unsigned int tda9887_conf; 3331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int svhs; 3341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct bttv_pll_info pll; 3351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int triton1; 3361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int gpioirq; 3374abdfed5676e5ef7f2461bb76f5929068a9cc9cfRicardo Cerqueira int (*custom_irq)(struct bttv *btv); 3384abdfed5676e5ef7f2461bb76f5929068a9cc9cfRicardo Cerqueira 3391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int use_i2c_hw; 3401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* old gpio interface */ 3421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds wait_queue_head_t gpioq; 3431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int shutdown; 3444b9b936f278163614543d66f8e8c93d5484dd148Nickolay V. Shmyrev 3454b9b936f278163614543d66f8e8c93d5484dd148Nickolay V. Shmyrev void (*volume_gpio)(struct bttv *btv, __u16 volume); 3464b9b936f278163614543d66f8e8c93d5484dd148Nickolay V. Shmyrev void (*audio_mode_gpio)(struct bttv *btv, struct v4l2_tuner *tuner, int set); 3474b9b936f278163614543d66f8e8c93d5484dd148Nickolay V. Shmyrev 3481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* new gpio interface */ 3491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds spinlock_t gpio_lock; 3501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* i2c layer */ 3521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct i2c_algo_bit_data i2c_algo; 3531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct i2c_client i2c_client; 3541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int i2c_state, i2c_rc; 3551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int i2c_done; 3561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds wait_queue_head_t i2c_queue; 3578bf2f8e747700419cc5bbc56c4496774eb8f2f1fHans Verkuil struct i2c_client *i2c_msp34xx_client; 3588bf2f8e747700419cc5bbc56c4496774eb8f2f1fHans Verkuil struct i2c_client *i2c_tvaudio_client; 3591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* video4linux (1) */ 3611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct video_device *video_dev; 3621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct video_device *radio_dev; 3631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct video_device *vbi_dev; 3641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* infrared remote */ 3661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int has_remote; 3679160723ed620f31bf38332dee02041b1cb4c9967Hermann Pitton struct card_ir *remote; 3681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* locking */ 3701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds spinlock_t s_lock; 371bd5f0ac930168899003952110c45d110958a5c55Ingo Molnar struct mutex lock; 3721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int resources; 3731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef VIDIOC_G_PRIORITY 3741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct v4l2_prio_state prio; 3751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 3761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* video state */ 3781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int input; 3791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int audio; 3808bf2f8e747700419cc5bbc56c4496774eb8f2f1fHans Verkuil unsigned int mute; 3811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned long freq; 3821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int tvnorm,hue,contrast,bright,saturation; 3831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct v4l2_framebuffer fbuf; 3841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int field_count; 3851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* various options */ 3871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int opt_combfilter; 3881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int opt_lumafilter; 3891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int opt_automute; 3901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int opt_chroma_agc; 3911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int opt_adc_crush; 3921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int opt_vcr_hack; 3931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int opt_whitecrush_upper; 3941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int opt_whitecrush_lower; 395060d3027f26aab9adeac8ff6d1184bca67c7d174Mauro Carvalho Chehab int opt_uv_ratio; 396060d3027f26aab9adeac8ff6d1184bca67c7d174Mauro Carvalho Chehab int opt_full_luma_range; 397060d3027f26aab9adeac8ff6d1184bca67c7d174Mauro Carvalho Chehab int opt_coring; 3981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 3991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* radio data/state */ 4001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int has_radio; 4011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int radio_user; 4021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* miro/pinnacle + Aimslab VHX 4041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds philips matchbox (tea5757 radio tuner) support */ 4051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int has_matchbox; 4061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int mbox_we; 4071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int mbox_data; 4081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int mbox_clk; 4091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int mbox_most; 4101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int mbox_mask; 4111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* ISA stuff (Terratec Active Radio Upgrade) */ 4131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int mbox_ior; 4141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int mbox_iow; 4151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int mbox_csel; 4161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* risc memory management data 4180418726bb5c7b5a70c7e7e82e860d5979d0c78cfAdrian Bunk - must acquire s_lock before changing these 4191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds - only the irq handler is supported to touch top + bottom + vcurr */ 4201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct btcx_riscmem main; 4211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct bttv_buffer *screen; /* overlay */ 4221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct list_head capture; /* video capture queue */ 4231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct list_head vcapture; /* vbi capture queue */ 4241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct bttv_buffer_set curr; /* active buffers */ 4251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct bttv_buffer *cvbi; /* active vbi buffer */ 4261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int loop_irq; 4271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int new_input; 4281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned long cap_ctl; 4301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned long dma_on; 4311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct timer_list timeout; 4321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct bttv_suspend_state state; 4331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds /* stats */ 4351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int errors; 4361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int framedrop; 4371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int irq_total; 4381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int irq_me; 4391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds unsigned int users; 4411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct bttv_fh init; 442e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek 443f992a497c71981e215b1415759fc13593ed2919fJarod Wilson /* used to make dvb-bt8xx autoloadable */ 444f992a497c71981e215b1415759fc13593ed2919fJarod Wilson struct work_struct request_module_wk; 445f992a497c71981e215b1415759fc13593ed2919fJarod Wilson 446e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek /* Default (0) and current (1) video capturing and overlay 447e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek cropping parameters in bttv_tvnorm.cropcap units. Protected 448e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek by bttv.lock. */ 449e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek struct bttv_crop crop[2]; 450e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek 451e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek /* Earliest possible start of video capturing in 452e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek bttv_tvnorm.cropcap line units. Set by check_alloc_btres() 453e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek and free_btres(). Protected by bttv.lock. */ 454e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek __s32 vbi_end; 455e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek 456e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek /* Latest possible end of VBI capturing (= crop[x].rect.top when 457e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek VIDEO_RESOURCES are locked). Set by check_alloc_btres() 458e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek and free_btres(). Protected by bttv.lock. */ 459e5bd0260e7d3d806e66c12859f50733dca43bbcfMichael Schimek __s32 crop_start; 4601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds}; 4612d03e289ea4b13d78ce55f1ea0b0d45b8f1b34c3Mauro Carvalho Chehab 4622d03e289ea4b13d78ce55f1ea0b0d45b8f1b34c3Mauro Carvalho Chehab/* our devices */ 4632d03e289ea4b13d78ce55f1ea0b0d45b8f1b34c3Mauro Carvalho Chehab#define BTTV_MAX 16 4642d03e289ea4b13d78ce55f1ea0b0d45b8f1b34c3Mauro Carvalho Chehabextern unsigned int bttv_num; 4651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsextern struct bttv bttvs[BTTV_MAX]; 4661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif 4681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define btwrite(dat,adr) writel((dat), btv->bt848_mmio+(adr)) 4701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define btread(adr) readl(btv->bt848_mmio+(adr)) 4711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define btand(dat,adr) btwrite((dat) & btread(adr), adr) 4731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define btor(dat,adr) btwrite((dat) | btread(adr), adr) 4741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define btaor(dat,mask,adr) btwrite((dat) | ((mask) & btread(adr)), adr) 4751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif /* _BTTVP_H_ */ 4771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 4781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 4791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Local variables: 4801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * c-basic-offset: 8 4811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * End: 4821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 483