diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/media |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/audiochip.h | 35 | ||||
-rw-r--r-- | include/media/id.h | 37 | ||||
-rw-r--r-- | include/media/ir-common.h | 67 | ||||
-rw-r--r-- | include/media/ovcamchip.h | 104 | ||||
-rw-r--r-- | include/media/saa6752hs.h | 75 | ||||
-rw-r--r-- | include/media/saa7146.h | 452 | ||||
-rw-r--r-- | include/media/saa7146_vv.h | 270 | ||||
-rw-r--r-- | include/media/tuner.h | 199 | ||||
-rw-r--r-- | include/media/tveeprom.h | 23 | ||||
-rw-r--r-- | include/media/video-buf-dvb.h | 36 | ||||
-rw-r--r-- | include/media/video-buf.h | 260 |
11 files changed, 1558 insertions, 0 deletions
diff --git a/include/media/audiochip.h b/include/media/audiochip.h new file mode 100644 index 000000000000..d3e9e30608dc --- /dev/null +++ b/include/media/audiochip.h | |||
@@ -0,0 +1,35 @@ | |||
1 | #ifndef AUDIOCHIP_H | ||
2 | #define AUDIOCHIP_H | ||
3 | |||
4 | /* ---------------------------------------------------------------------- */ | ||
5 | |||
6 | /* v4l device was opened in Radio mode */ | ||
7 | #define AUDC_SET_RADIO _IO('m',2) | ||
8 | /* select from TV,radio,extern,MUTE */ | ||
9 | #define AUDC_SET_INPUT _IOW('m',17,int) | ||
10 | |||
11 | /* audio inputs */ | ||
12 | #define AUDIO_TUNER 0x00 | ||
13 | #define AUDIO_RADIO 0x01 | ||
14 | #define AUDIO_EXTERN 0x02 | ||
15 | #define AUDIO_INTERN 0x03 | ||
16 | #define AUDIO_OFF 0x04 | ||
17 | #define AUDIO_ON 0x05 | ||
18 | #define AUDIO_EXTERN_1 AUDIO_EXTERN | ||
19 | #define AUDIO_EXTERN_2 0x06 | ||
20 | #define AUDIO_MUTE 0x80 | ||
21 | #define AUDIO_UNMUTE 0x81 | ||
22 | |||
23 | /* all the stuff below is obsolete and just here for reference. I'll | ||
24 | * remove it once the driver is tested and works fine. | ||
25 | * | ||
26 | * Instead creating alot of tiny API's for all kinds of different | ||
27 | * chips, we'll just pass throuth the v4l ioctl structs (v4l2 not | ||
28 | * yet...). It is a bit less flexible, but most/all used i2c chips | ||
29 | * make sense in v4l context only. So I think that's acceptable... | ||
30 | */ | ||
31 | |||
32 | /* misc stuff to pass around config info to i2c chips */ | ||
33 | #define AUDC_CONFIG_PINNACLE _IOW('m',32,int) | ||
34 | |||
35 | #endif /* AUDIOCHIP_H */ | ||
diff --git a/include/media/id.h b/include/media/id.h new file mode 100644 index 000000000000..1b0320dc8f73 --- /dev/null +++ b/include/media/id.h | |||
@@ -0,0 +1,37 @@ | |||
1 | /* FIXME: this temporarely, until these are included in linux/i2c-id.h */ | ||
2 | |||
3 | /* drivers */ | ||
4 | #ifndef I2C_DRIVERID_TVMIXER | ||
5 | # define I2C_DRIVERID_TVMIXER I2C_DRIVERID_EXP0 | ||
6 | #endif | ||
7 | #ifndef I2C_DRIVERID_TVAUDIO | ||
8 | # define I2C_DRIVERID_TVAUDIO I2C_DRIVERID_EXP1 | ||
9 | #endif | ||
10 | |||
11 | /* chips */ | ||
12 | #ifndef I2C_DRIVERID_DPL3518 | ||
13 | # define I2C_DRIVERID_DPL3518 I2C_DRIVERID_EXP2 | ||
14 | #endif | ||
15 | #ifndef I2C_DRIVERID_TDA9873 | ||
16 | # define I2C_DRIVERID_TDA9873 I2C_DRIVERID_EXP3 | ||
17 | #endif | ||
18 | #ifndef I2C_DRIVERID_TDA9875 | ||
19 | # define I2C_DRIVERID_TDA9875 I2C_DRIVERID_EXP0+4 | ||
20 | #endif | ||
21 | #ifndef I2C_DRIVERID_PIC16C54_PV951 | ||
22 | # define I2C_DRIVERID_PIC16C54_PV951 I2C_DRIVERID_EXP0+5 | ||
23 | #endif | ||
24 | #ifndef I2C_DRIVERID_TDA7432 | ||
25 | # define I2C_DRIVERID_TDA7432 I2C_DRIVERID_EXP0+6 | ||
26 | #endif | ||
27 | #ifndef I2C_DRIVERID_TDA9874 | ||
28 | # define I2C_DRIVERID_TDA9874 I2C_DRIVERID_EXP0+7 | ||
29 | #endif | ||
30 | #ifndef I2C_DRIVERID_SAA6752HS | ||
31 | # define I2C_DRIVERID_SAA6752HS I2C_DRIVERID_EXP0+8 | ||
32 | #endif | ||
33 | |||
34 | /* algorithms */ | ||
35 | #ifndef I2C_ALGO_SAA7134 | ||
36 | # define I2C_ALGO_SAA7134 0x090000 | ||
37 | #endif | ||
diff --git a/include/media/ir-common.h b/include/media/ir-common.h new file mode 100644 index 000000000000..62c963a52d86 --- /dev/null +++ b/include/media/ir-common.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | * $Id: ir-common.h,v 1.8 2005/02/22 12:28:40 kraxel Exp $ | ||
3 | * | ||
4 | * some common structs and functions to handle infrared remotes via | ||
5 | * input layer ... | ||
6 | * | ||
7 | * (c) 2003 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | */ | ||
23 | |||
24 | #include <linux/version.h> | ||
25 | #include <linux/input.h> | ||
26 | |||
27 | |||
28 | #define IR_TYPE_RC5 1 | ||
29 | #define IR_TYPE_OTHER 99 | ||
30 | |||
31 | #define IR_KEYTAB_TYPE u32 | ||
32 | #define IR_KEYTAB_SIZE 128 // enougth for rc5, probably need more some day ... | ||
33 | |||
34 | #define IR_KEYCODE(tab,code) (((unsigned)code < IR_KEYTAB_SIZE) \ | ||
35 | ? tab[code] : KEY_RESERVED) | ||
36 | |||
37 | struct ir_input_state { | ||
38 | /* configuration */ | ||
39 | int ir_type; | ||
40 | IR_KEYTAB_TYPE ir_codes[IR_KEYTAB_SIZE]; | ||
41 | |||
42 | /* key info */ | ||
43 | u32 ir_raw; /* raw data */ | ||
44 | u32 ir_key; /* ir key code */ | ||
45 | u32 keycode; /* linux key code */ | ||
46 | int keypressed; /* current state */ | ||
47 | }; | ||
48 | |||
49 | extern IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE]; | ||
50 | extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE]; | ||
51 | extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE]; | ||
52 | extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE]; | ||
53 | |||
54 | void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, | ||
55 | int ir_type, IR_KEYTAB_TYPE *ir_codes); | ||
56 | void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir); | ||
57 | void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, | ||
58 | u32 ir_key, u32 ir_raw); | ||
59 | u32 ir_extract_bits(u32 data, u32 mask); | ||
60 | int ir_dump_samples(u32 *samples, int count); | ||
61 | int ir_decode_biphase(u32 *samples, int count, int low, int high); | ||
62 | |||
63 | /* | ||
64 | * Local variables: | ||
65 | * c-basic-offset: 8 | ||
66 | * End: | ||
67 | */ | ||
diff --git a/include/media/ovcamchip.h b/include/media/ovcamchip.h new file mode 100644 index 000000000000..cb7c0aa96f22 --- /dev/null +++ b/include/media/ovcamchip.h | |||
@@ -0,0 +1,104 @@ | |||
1 | /* OmniVision* camera chip driver API | ||
2 | * | ||
3 | * Copyright (c) 1999-2004 Mark McClelland | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
8 | * option) any later version. NO WARRANTY OF ANY KIND is expressed or implied. | ||
9 | * | ||
10 | * * OmniVision is a trademark of OmniVision Technologies, Inc. This driver | ||
11 | * is not sponsored or developed by them. | ||
12 | */ | ||
13 | |||
14 | #ifndef __LINUX_OVCAMCHIP_H | ||
15 | #define __LINUX_OVCAMCHIP_H | ||
16 | |||
17 | #include <linux/videodev.h> | ||
18 | #include <linux/i2c.h> | ||
19 | |||
20 | /* Remove these once they are officially defined */ | ||
21 | #ifndef I2C_DRIVERID_OVCAMCHIP | ||
22 | #define I2C_DRIVERID_OVCAMCHIP 0xf00f | ||
23 | #endif | ||
24 | #ifndef I2C_HW_SMBUS_OV511 | ||
25 | #define I2C_HW_SMBUS_OV511 0xfe | ||
26 | #endif | ||
27 | #ifndef I2C_HW_SMBUS_OV518 | ||
28 | #define I2C_HW_SMBUS_OV518 0xff | ||
29 | #endif | ||
30 | #ifndef I2C_HW_SMBUS_OVFX2 | ||
31 | #define I2C_HW_SMBUS_OVFX2 0xfd | ||
32 | #endif | ||
33 | |||
34 | /* --------------------------------- */ | ||
35 | /* ENUMERATIONS */ | ||
36 | /* --------------------------------- */ | ||
37 | |||
38 | /* Controls */ | ||
39 | enum { | ||
40 | OVCAMCHIP_CID_CONT, /* Contrast */ | ||
41 | OVCAMCHIP_CID_BRIGHT, /* Brightness */ | ||
42 | OVCAMCHIP_CID_SAT, /* Saturation */ | ||
43 | OVCAMCHIP_CID_HUE, /* Hue */ | ||
44 | OVCAMCHIP_CID_EXP, /* Exposure */ | ||
45 | OVCAMCHIP_CID_FREQ, /* Light frequency */ | ||
46 | OVCAMCHIP_CID_BANDFILT, /* Banding filter */ | ||
47 | OVCAMCHIP_CID_AUTOBRIGHT, /* Auto brightness */ | ||
48 | OVCAMCHIP_CID_AUTOEXP, /* Auto exposure */ | ||
49 | OVCAMCHIP_CID_BACKLIGHT, /* Back light compensation */ | ||
50 | OVCAMCHIP_CID_MIRROR, /* Mirror horizontally */ | ||
51 | }; | ||
52 | |||
53 | /* Chip types */ | ||
54 | #define NUM_CC_TYPES 9 | ||
55 | enum { | ||
56 | CC_UNKNOWN, | ||
57 | CC_OV76BE, | ||
58 | CC_OV7610, | ||
59 | CC_OV7620, | ||
60 | CC_OV7620AE, | ||
61 | CC_OV6620, | ||
62 | CC_OV6630, | ||
63 | CC_OV6630AE, | ||
64 | CC_OV6630AF, | ||
65 | }; | ||
66 | |||
67 | /* --------------------------------- */ | ||
68 | /* I2C ADDRESSES */ | ||
69 | /* --------------------------------- */ | ||
70 | |||
71 | #define OV7xx0_SID (0x42 >> 1) | ||
72 | #define OV6xx0_SID (0xC0 >> 1) | ||
73 | |||
74 | /* --------------------------------- */ | ||
75 | /* API */ | ||
76 | /* --------------------------------- */ | ||
77 | |||
78 | struct ovcamchip_control { | ||
79 | __u32 id; | ||
80 | __s32 value; | ||
81 | }; | ||
82 | |||
83 | struct ovcamchip_window { | ||
84 | int x; | ||
85 | int y; | ||
86 | int width; | ||
87 | int height; | ||
88 | int format; | ||
89 | int quarter; /* Scale width and height down 2x */ | ||
90 | |||
91 | /* This stuff will be removed eventually */ | ||
92 | int clockdiv; /* Clock divisor setting */ | ||
93 | }; | ||
94 | |||
95 | /* Commands */ | ||
96 | #define OVCAMCHIP_CMD_Q_SUBTYPE _IOR (0x88, 0x00, int) | ||
97 | #define OVCAMCHIP_CMD_INITIALIZE _IOW (0x88, 0x01, int) | ||
98 | /* You must call OVCAMCHIP_CMD_INITIALIZE before any of commands below! */ | ||
99 | #define OVCAMCHIP_CMD_S_CTRL _IOW (0x88, 0x02, struct ovcamchip_control) | ||
100 | #define OVCAMCHIP_CMD_G_CTRL _IOWR (0x88, 0x03, struct ovcamchip_control) | ||
101 | #define OVCAMCHIP_CMD_S_MODE _IOW (0x88, 0x04, struct ovcamchip_window) | ||
102 | #define OVCAMCHIP_MAX_CMD _IO (0x88, 0x3f) | ||
103 | |||
104 | #endif | ||
diff --git a/include/media/saa6752hs.h b/include/media/saa6752hs.h new file mode 100644 index 000000000000..791bad2b86e9 --- /dev/null +++ b/include/media/saa6752hs.h | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | saa6752hs.h - definition for saa6752hs MPEG encoder | ||
3 | |||
4 | Copyright (C) 2003 Andrew de Quincey <adq@lidskialf.net> | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #if 0 /* ndef _SAA6752HS_H */ | ||
22 | #define _SAA6752HS_H | ||
23 | |||
24 | enum mpeg_video_bitrate_mode { | ||
25 | MPEG_VIDEO_BITRATE_MODE_VBR = 0, /* Variable bitrate */ | ||
26 | MPEG_VIDEO_BITRATE_MODE_CBR = 1, /* Constant bitrate */ | ||
27 | |||
28 | MPEG_VIDEO_BITRATE_MODE_MAX | ||
29 | }; | ||
30 | |||
31 | enum mpeg_audio_bitrate { | ||
32 | MPEG_AUDIO_BITRATE_256 = 0, /* 256 kBit/sec */ | ||
33 | MPEG_AUDIO_BITRATE_384 = 1, /* 384 kBit/sec */ | ||
34 | |||
35 | MPEG_AUDIO_BITRATE_MAX | ||
36 | }; | ||
37 | |||
38 | enum mpeg_video_format { | ||
39 | MPEG_VIDEO_FORMAT_D1 = 0, | ||
40 | MPEG_VIDEO_FORMAT_2_3_D1 = 1, | ||
41 | MPEG_VIDEO_FORMAT_1_2_D1 = 2, | ||
42 | MPEG_VIDEO_FORMAT_SIF = 3, | ||
43 | |||
44 | MPEG_VIDEO_FORMAT_MAX | ||
45 | }; | ||
46 | |||
47 | #define MPEG_VIDEO_TARGET_BITRATE_MAX 27000 | ||
48 | #define MPEG_VIDEO_MAX_BITRATE_MAX 27000 | ||
49 | #define MPEG_TOTAL_BITRATE_MAX 27000 | ||
50 | #define MPEG_PID_MAX ((1 << 14) - 1) | ||
51 | |||
52 | struct mpeg_params { | ||
53 | enum mpeg_video_bitrate_mode video_bitrate_mode; | ||
54 | unsigned int video_target_bitrate; | ||
55 | unsigned int video_max_bitrate; // only used for VBR | ||
56 | enum mpeg_audio_bitrate audio_bitrate; | ||
57 | unsigned int total_bitrate; | ||
58 | |||
59 | unsigned int pmt_pid; | ||
60 | unsigned int video_pid; | ||
61 | unsigned int audio_pid; | ||
62 | unsigned int pcr_pid; | ||
63 | |||
64 | enum mpeg_video_format video_format; | ||
65 | }; | ||
66 | |||
67 | #define MPEG_SETPARAMS _IOW('6',100,struct mpeg_params) | ||
68 | |||
69 | #endif // _SAA6752HS_H | ||
70 | |||
71 | /* | ||
72 | * Local variables: | ||
73 | * c-basic-offset: 8 | ||
74 | * End: | ||
75 | */ | ||
diff --git a/include/media/saa7146.h b/include/media/saa7146.h new file mode 100644 index 000000000000..3dfb8d670eb7 --- /dev/null +++ b/include/media/saa7146.h | |||
@@ -0,0 +1,452 @@ | |||
1 | #ifndef __SAA7146__ | ||
2 | #define __SAA7146__ | ||
3 | |||
4 | #include <linux/version.h> /* for version macros */ | ||
5 | #include <linux/module.h> /* for module-version */ | ||
6 | #include <linux/delay.h> /* for delay-stuff */ | ||
7 | #include <linux/slab.h> /* for kmalloc/kfree */ | ||
8 | #include <linux/pci.h> /* for pci-config-stuff, vendor ids etc. */ | ||
9 | #include <linux/init.h> /* for "__init" */ | ||
10 | #include <linux/interrupt.h> /* for IMMEDIATE_BH */ | ||
11 | #include <linux/kmod.h> /* for kernel module loader */ | ||
12 | #include <linux/i2c.h> /* for i2c subsystem */ | ||
13 | #include <asm/io.h> /* for accessing devices */ | ||
14 | #include <linux/stringify.h> | ||
15 | #include <linux/vmalloc.h> /* for vmalloc() */ | ||
16 | #include <linux/mm.h> /* for vmalloc_to_page() */ | ||
17 | |||
18 | /* ugly, but necessary to build the dvb stuff under 2.4. */ | ||
19 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51) | ||
20 | #include "dvb_functions.h" | ||
21 | #endif | ||
22 | |||
23 | #define SAA7146_VERSION_CODE KERNEL_VERSION(0,5,0) | ||
24 | |||
25 | #define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr))) | ||
26 | #define saa7146_read(sxy,adr) readl(sxy->mem+(adr)) | ||
27 | |||
28 | extern unsigned int saa7146_debug; | ||
29 | |||
30 | //#define DEBUG_PROLOG printk("(0x%08x)(0x%08x) %s: %s(): ",(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,RPS_ADDR0))),(dev==0?-1:(dev->mem==0?-1:saa7146_read(dev,IER))),__stringify(KBUILD_MODNAME),__FUNCTION__) | ||
31 | |||
32 | #ifndef DEBUG_VARIABLE | ||
33 | #define DEBUG_VARIABLE saa7146_debug | ||
34 | #endif | ||
35 | |||
36 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51) | ||
37 | #define DEBUG_PROLOG printk("%s: %s(): ",__stringify(KBUILD_BASENAME),__FUNCTION__) | ||
38 | #define INFO(x) { printk("%s: ",__stringify(KBUILD_BASENAME)); printk x; } | ||
39 | #else | ||
40 | #define DEBUG_PROLOG printk("%s: %s(): ",__stringify(KBUILD_MODNAME),__FUNCTION__) | ||
41 | #define INFO(x) { printk("%s: ",__stringify(KBUILD_MODNAME)); printk x; } | ||
42 | #endif | ||
43 | |||
44 | #define ERR(x) { DEBUG_PROLOG; printk x; } | ||
45 | |||
46 | #define DEB_S(x) if (0!=(DEBUG_VARIABLE&0x01)) { DEBUG_PROLOG; printk x; } /* simple debug messages */ | ||
47 | #define DEB_D(x) if (0!=(DEBUG_VARIABLE&0x02)) { DEBUG_PROLOG; printk x; } /* more detailed debug messages */ | ||
48 | #define DEB_EE(x) if (0!=(DEBUG_VARIABLE&0x04)) { DEBUG_PROLOG; printk x; } /* print enter and exit of functions */ | ||
49 | #define DEB_I2C(x) if (0!=(DEBUG_VARIABLE&0x08)) { DEBUG_PROLOG; printk x; } /* i2c debug messages */ | ||
50 | #define DEB_VBI(x) if (0!=(DEBUG_VARIABLE&0x10)) { DEBUG_PROLOG; printk x; } /* vbi debug messages */ | ||
51 | #define DEB_INT(x) if (0!=(DEBUG_VARIABLE&0x20)) { DEBUG_PROLOG; printk x; } /* interrupt debug messages */ | ||
52 | #define DEB_CAP(x) if (0!=(DEBUG_VARIABLE&0x40)) { DEBUG_PROLOG; printk x; } /* capture debug messages */ | ||
53 | |||
54 | #define SAA7146_IER_DISABLE(x,y) \ | ||
55 | saa7146_write(x, IER, saa7146_read(x, IER) & ~(y)); | ||
56 | #define SAA7146_IER_ENABLE(x,y) \ | ||
57 | saa7146_write(x, IER, saa7146_read(x, IER) | (y)); | ||
58 | #define SAA7146_ISR_CLEAR(x,y) \ | ||
59 | saa7146_write(x, ISR, (y)); | ||
60 | |||
61 | struct saa7146_dev; | ||
62 | struct saa7146_extension; | ||
63 | struct saa7146_vv; | ||
64 | |||
65 | /* saa7146 page table */ | ||
66 | struct saa7146_pgtable { | ||
67 | unsigned int size; | ||
68 | u32 *cpu; | ||
69 | dma_addr_t dma; | ||
70 | /* used for offsets for u,v planes for planar capture modes */ | ||
71 | unsigned long offset; | ||
72 | /* used for custom pagetables (used for example by budget dvb cards) */ | ||
73 | struct scatterlist *slist; | ||
74 | }; | ||
75 | |||
76 | struct saa7146_pci_extension_data { | ||
77 | struct saa7146_extension *ext; | ||
78 | void *ext_priv; /* most likely a name string */ | ||
79 | }; | ||
80 | |||
81 | #define MAKE_EXTENSION_PCI(x_var, x_vendor, x_device) \ | ||
82 | { \ | ||
83 | .vendor = PCI_VENDOR_ID_PHILIPS, \ | ||
84 | .device = PCI_DEVICE_ID_PHILIPS_SAA7146, \ | ||
85 | .subvendor = x_vendor, \ | ||
86 | .subdevice = x_device, \ | ||
87 | .driver_data = (unsigned long)& x_var, \ | ||
88 | } | ||
89 | |||
90 | struct saa7146_extension | ||
91 | { | ||
92 | char name[32]; /* name of the device */ | ||
93 | #define SAA7146_USE_I2C_IRQ 0x1 | ||
94 | #define SAA7146_I2C_SHORT_DELAY 0x2 | ||
95 | int flags; | ||
96 | |||
97 | /* pairs of subvendor and subdevice ids for | ||
98 | supported devices, last entry 0xffff, 0xfff */ | ||
99 | struct module *module; | ||
100 | struct pci_driver driver; | ||
101 | struct pci_device_id *pci_tbl; | ||
102 | |||
103 | /* extension functions */ | ||
104 | int (*probe)(struct saa7146_dev *); | ||
105 | int (*attach)(struct saa7146_dev *, struct saa7146_pci_extension_data *); | ||
106 | int (*detach)(struct saa7146_dev*); | ||
107 | |||
108 | u32 irq_mask; /* mask to indicate, which irq-events are handled by the extension */ | ||
109 | void (*irq_func)(struct saa7146_dev*, u32* irq_mask); | ||
110 | }; | ||
111 | |||
112 | struct saa7146_dma | ||
113 | { | ||
114 | dma_addr_t dma_handle; | ||
115 | u32 *cpu_addr; | ||
116 | }; | ||
117 | |||
118 | struct saa7146_dev | ||
119 | { | ||
120 | struct module *module; | ||
121 | |||
122 | struct list_head item; | ||
123 | |||
124 | /* different device locks */ | ||
125 | spinlock_t slock; | ||
126 | struct semaphore lock; | ||
127 | |||
128 | unsigned char __iomem *mem; /* pointer to mapped IO memory */ | ||
129 | int revision; /* chip revision; needed for bug-workarounds*/ | ||
130 | |||
131 | /* pci-device & irq stuff*/ | ||
132 | char name[32]; | ||
133 | struct pci_dev *pci; | ||
134 | u32 int_todo; | ||
135 | spinlock_t int_slock; | ||
136 | |||
137 | /* extension handling */ | ||
138 | struct saa7146_extension *ext; /* indicates if handled by extension */ | ||
139 | void *ext_priv; /* pointer for extension private use (most likely some private data) */ | ||
140 | struct saa7146_ext_vv *ext_vv_data; | ||
141 | |||
142 | /* per device video/vbi informations (if available) */ | ||
143 | struct saa7146_vv *vv_data; | ||
144 | void (*vv_callback)(struct saa7146_dev *dev, unsigned long status); | ||
145 | |||
146 | /* i2c-stuff */ | ||
147 | struct semaphore i2c_lock; | ||
148 | u32 i2c_bitrate; | ||
149 | struct saa7146_dma d_i2c; /* pointer to i2c memory */ | ||
150 | wait_queue_head_t i2c_wq; | ||
151 | int i2c_op; | ||
152 | |||
153 | /* memories */ | ||
154 | struct saa7146_dma d_rps0; | ||
155 | struct saa7146_dma d_rps1; | ||
156 | }; | ||
157 | |||
158 | /* from saa7146_i2c.c */ | ||
159 | int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate); | ||
160 | int saa7146_i2c_transfer(struct saa7146_dev *saa, const struct i2c_msg *msgs, int num, int retries); | ||
161 | |||
162 | /* from saa7146_core.c */ | ||
163 | extern struct list_head saa7146_devices; | ||
164 | extern struct semaphore saa7146_devices_lock; | ||
165 | int saa7146_register_extension(struct saa7146_extension*); | ||
166 | int saa7146_unregister_extension(struct saa7146_extension*); | ||
167 | struct saa7146_format* format_by_fourcc(struct saa7146_dev *dev, int fourcc); | ||
168 | int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt); | ||
169 | void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt); | ||
170 | int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt, struct scatterlist *list, int length ); | ||
171 | char *saa7146_vmalloc_build_pgtable(struct pci_dev *pci, long length, struct saa7146_pgtable *pt); | ||
172 | void saa7146_setgpio(struct saa7146_dev *dev, int port, u32 data); | ||
173 | int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop); | ||
174 | |||
175 | /* some memory sizes */ | ||
176 | #define SAA7146_I2C_MEM ( 1*PAGE_SIZE) | ||
177 | #define SAA7146_RPS_MEM ( 1*PAGE_SIZE) | ||
178 | |||
179 | /* some i2c constants */ | ||
180 | #define SAA7146_I2C_TIMEOUT 100 /* i2c-timeout-value in ms */ | ||
181 | #define SAA7146_I2C_RETRIES 3 /* how many times shall we retry an i2c-operation? */ | ||
182 | #define SAA7146_I2C_DELAY 5 /* time we wait after certain i2c-operations */ | ||
183 | |||
184 | /* unsorted defines */ | ||
185 | #define ME1 0x0000000800 | ||
186 | #define PV1 0x0000000008 | ||
187 | |||
188 | /* gpio defines */ | ||
189 | #define SAA7146_GPIO_INPUT 0x00 | ||
190 | #define SAA7146_GPIO_IRQHI 0x10 | ||
191 | #define SAA7146_GPIO_IRQLO 0x20 | ||
192 | #define SAA7146_GPIO_IRQHL 0x30 | ||
193 | #define SAA7146_GPIO_OUTLO 0x40 | ||
194 | #define SAA7146_GPIO_OUTHI 0x50 | ||
195 | |||
196 | /* debi defines */ | ||
197 | #define DEBINOSWAP 0x000e0000 | ||
198 | |||
199 | /* define for the register programming sequencer (rps) */ | ||
200 | #define CMD_NOP 0x00000000 /* No operation */ | ||
201 | #define CMD_CLR_EVENT 0x00000000 /* Clear event */ | ||
202 | #define CMD_SET_EVENT 0x10000000 /* Set signal event */ | ||
203 | #define CMD_PAUSE 0x20000000 /* Pause */ | ||
204 | #define CMD_CHECK_LATE 0x30000000 /* Check late */ | ||
205 | #define CMD_UPLOAD 0x40000000 /* Upload */ | ||
206 | #define CMD_STOP 0x50000000 /* Stop */ | ||
207 | #define CMD_INTERRUPT 0x60000000 /* Interrupt */ | ||
208 | #define CMD_JUMP 0x80000000 /* Jump */ | ||
209 | #define CMD_WR_REG 0x90000000 /* Write (load) register */ | ||
210 | #define CMD_RD_REG 0xa0000000 /* Read (store) register */ | ||
211 | #define CMD_WR_REG_MASK 0xc0000000 /* Write register with mask */ | ||
212 | |||
213 | #define CMD_OAN MASK_27 | ||
214 | #define CMD_INV MASK_26 | ||
215 | #define CMD_SIG4 MASK_25 | ||
216 | #define CMD_SIG3 MASK_24 | ||
217 | #define CMD_SIG2 MASK_23 | ||
218 | #define CMD_SIG1 MASK_22 | ||
219 | #define CMD_SIG0 MASK_21 | ||
220 | #define CMD_O_FID_B MASK_14 | ||
221 | #define CMD_E_FID_B MASK_13 | ||
222 | #define CMD_O_FID_A MASK_12 | ||
223 | #define CMD_E_FID_A MASK_11 | ||
224 | |||
225 | /* some events and command modifiers for rps1 squarewave generator */ | ||
226 | #define EVT_HS (1<<15) // Source Line Threshold reached | ||
227 | #define EVT_VBI_B (1<<9) // VSYNC Event | ||
228 | #define RPS_OAN (1<<27) // 1: OR events, 0: AND events | ||
229 | #define RPS_INV (1<<26) // Invert (compound) event | ||
230 | #define GPIO3_MSK 0xFF000000 // GPIO #3 control bits | ||
231 | |||
232 | /* Bit mask constants */ | ||
233 | #define MASK_00 0x00000001 /* Mask value for bit 0 */ | ||
234 | #define MASK_01 0x00000002 /* Mask value for bit 1 */ | ||
235 | #define MASK_02 0x00000004 /* Mask value for bit 2 */ | ||
236 | #define MASK_03 0x00000008 /* Mask value for bit 3 */ | ||
237 | #define MASK_04 0x00000010 /* Mask value for bit 4 */ | ||
238 | #define MASK_05 0x00000020 /* Mask value for bit 5 */ | ||
239 | #define MASK_06 0x00000040 /* Mask value for bit 6 */ | ||
240 | #define MASK_07 0x00000080 /* Mask value for bit 7 */ | ||
241 | #define MASK_08 0x00000100 /* Mask value for bit 8 */ | ||
242 | #define MASK_09 0x00000200 /* Mask value for bit 9 */ | ||
243 | #define MASK_10 0x00000400 /* Mask value for bit 10 */ | ||
244 | #define MASK_11 0x00000800 /* Mask value for bit 11 */ | ||
245 | #define MASK_12 0x00001000 /* Mask value for bit 12 */ | ||
246 | #define MASK_13 0x00002000 /* Mask value for bit 13 */ | ||
247 | #define MASK_14 0x00004000 /* Mask value for bit 14 */ | ||
248 | #define MASK_15 0x00008000 /* Mask value for bit 15 */ | ||
249 | #define MASK_16 0x00010000 /* Mask value for bit 16 */ | ||
250 | #define MASK_17 0x00020000 /* Mask value for bit 17 */ | ||
251 | #define MASK_18 0x00040000 /* Mask value for bit 18 */ | ||
252 | #define MASK_19 0x00080000 /* Mask value for bit 19 */ | ||
253 | #define MASK_20 0x00100000 /* Mask value for bit 20 */ | ||
254 | #define MASK_21 0x00200000 /* Mask value for bit 21 */ | ||
255 | #define MASK_22 0x00400000 /* Mask value for bit 22 */ | ||
256 | #define MASK_23 0x00800000 /* Mask value for bit 23 */ | ||
257 | #define MASK_24 0x01000000 /* Mask value for bit 24 */ | ||
258 | #define MASK_25 0x02000000 /* Mask value for bit 25 */ | ||
259 | #define MASK_26 0x04000000 /* Mask value for bit 26 */ | ||
260 | #define MASK_27 0x08000000 /* Mask value for bit 27 */ | ||
261 | #define MASK_28 0x10000000 /* Mask value for bit 28 */ | ||
262 | #define MASK_29 0x20000000 /* Mask value for bit 29 */ | ||
263 | #define MASK_30 0x40000000 /* Mask value for bit 30 */ | ||
264 | #define MASK_31 0x80000000 /* Mask value for bit 31 */ | ||
265 | |||
266 | #define MASK_B0 0x000000ff /* Mask value for byte 0 */ | ||
267 | #define MASK_B1 0x0000ff00 /* Mask value for byte 1 */ | ||
268 | #define MASK_B2 0x00ff0000 /* Mask value for byte 2 */ | ||
269 | #define MASK_B3 0xff000000 /* Mask value for byte 3 */ | ||
270 | |||
271 | #define MASK_W0 0x0000ffff /* Mask value for word 0 */ | ||
272 | #define MASK_W1 0xffff0000 /* Mask value for word 1 */ | ||
273 | |||
274 | #define MASK_PA 0xfffffffc /* Mask value for physical address */ | ||
275 | #define MASK_PR 0xfffffffe /* Mask value for protection register */ | ||
276 | #define MASK_ER 0xffffffff /* Mask value for the entire register */ | ||
277 | |||
278 | #define MASK_NONE 0x00000000 /* No mask */ | ||
279 | |||
280 | /* register aliases */ | ||
281 | #define BASE_ODD1 0x00 /* Video DMA 1 registers */ | ||
282 | #define BASE_EVEN1 0x04 | ||
283 | #define PROT_ADDR1 0x08 | ||
284 | #define PITCH1 0x0C | ||
285 | #define BASE_PAGE1 0x10 /* Video DMA 1 base page */ | ||
286 | #define NUM_LINE_BYTE1 0x14 | ||
287 | |||
288 | #define BASE_ODD2 0x18 /* Video DMA 2 registers */ | ||
289 | #define BASE_EVEN2 0x1C | ||
290 | #define PROT_ADDR2 0x20 | ||
291 | #define PITCH2 0x24 | ||
292 | #define BASE_PAGE2 0x28 /* Video DMA 2 base page */ | ||
293 | #define NUM_LINE_BYTE2 0x2C | ||
294 | |||
295 | #define BASE_ODD3 0x30 /* Video DMA 3 registers */ | ||
296 | #define BASE_EVEN3 0x34 | ||
297 | #define PROT_ADDR3 0x38 | ||
298 | #define PITCH3 0x3C | ||
299 | #define BASE_PAGE3 0x40 /* Video DMA 3 base page */ | ||
300 | #define NUM_LINE_BYTE3 0x44 | ||
301 | |||
302 | #define PCI_BT_V1 0x48 /* Video/FIFO 1 */ | ||
303 | #define PCI_BT_V2 0x49 /* Video/FIFO 2 */ | ||
304 | #define PCI_BT_V3 0x4A /* Video/FIFO 3 */ | ||
305 | #define PCI_BT_DEBI 0x4B /* DEBI */ | ||
306 | #define PCI_BT_A 0x4C /* Audio */ | ||
307 | |||
308 | #define DD1_INIT 0x50 /* Init setting of DD1 interface */ | ||
309 | |||
310 | #define DD1_STREAM_B 0x54 /* DD1 B video data stream handling */ | ||
311 | #define DD1_STREAM_A 0x56 /* DD1 A video data stream handling */ | ||
312 | |||
313 | #define BRS_CTRL 0x58 /* BRS control register */ | ||
314 | #define HPS_CTRL 0x5C /* HPS control register */ | ||
315 | #define HPS_V_SCALE 0x60 /* HPS vertical scale */ | ||
316 | #define HPS_V_GAIN 0x64 /* HPS vertical ACL and gain */ | ||
317 | #define HPS_H_PRESCALE 0x68 /* HPS horizontal prescale */ | ||
318 | #define HPS_H_SCALE 0x6C /* HPS horizontal scale */ | ||
319 | #define BCS_CTRL 0x70 /* BCS control */ | ||
320 | #define CHROMA_KEY_RANGE 0x74 | ||
321 | #define CLIP_FORMAT_CTRL 0x78 /* HPS outputs formats & clipping */ | ||
322 | |||
323 | #define DEBI_CONFIG 0x7C | ||
324 | #define DEBI_COMMAND 0x80 | ||
325 | #define DEBI_PAGE 0x84 | ||
326 | #define DEBI_AD 0x88 | ||
327 | |||
328 | #define I2C_TRANSFER 0x8C | ||
329 | #define I2C_STATUS 0x90 | ||
330 | |||
331 | #define BASE_A1_IN 0x94 /* Audio 1 input DMA */ | ||
332 | #define PROT_A1_IN 0x98 | ||
333 | #define PAGE_A1_IN 0x9C | ||
334 | |||
335 | #define BASE_A1_OUT 0xA0 /* Audio 1 output DMA */ | ||
336 | #define PROT_A1_OUT 0xA4 | ||
337 | #define PAGE_A1_OUT 0xA8 | ||
338 | |||
339 | #define BASE_A2_IN 0xAC /* Audio 2 input DMA */ | ||
340 | #define PROT_A2_IN 0xB0 | ||
341 | #define PAGE_A2_IN 0xB4 | ||
342 | |||
343 | #define BASE_A2_OUT 0xB8 /* Audio 2 output DMA */ | ||
344 | #define PROT_A2_OUT 0xBC | ||
345 | #define PAGE_A2_OUT 0xC0 | ||
346 | |||
347 | #define RPS_PAGE0 0xC4 /* RPS task 0 page register */ | ||
348 | #define RPS_PAGE1 0xC8 /* RPS task 1 page register */ | ||
349 | |||
350 | #define RPS_THRESH0 0xCC /* HBI threshold for task 0 */ | ||
351 | #define RPS_THRESH1 0xD0 /* HBI threshold for task 1 */ | ||
352 | |||
353 | #define RPS_TOV0 0xD4 /* RPS timeout for task 0 */ | ||
354 | #define RPS_TOV1 0xD8 /* RPS timeout for task 1 */ | ||
355 | |||
356 | #define IER 0xDC /* Interrupt enable register */ | ||
357 | |||
358 | #define GPIO_CTRL 0xE0 /* GPIO 0-3 register */ | ||
359 | |||
360 | #define EC1SSR 0xE4 /* Event cnt set 1 source select */ | ||
361 | #define EC2SSR 0xE8 /* Event cnt set 2 source select */ | ||
362 | #define ECT1R 0xEC /* Event cnt set 1 thresholds */ | ||
363 | #define ECT2R 0xF0 /* Event cnt set 2 thresholds */ | ||
364 | |||
365 | #define ACON1 0xF4 | ||
366 | #define ACON2 0xF8 | ||
367 | |||
368 | #define MC1 0xFC /* Main control register 1 */ | ||
369 | #define MC2 0x100 /* Main control register 2 */ | ||
370 | |||
371 | #define RPS_ADDR0 0x104 /* RPS task 0 address register */ | ||
372 | #define RPS_ADDR1 0x108 /* RPS task 1 address register */ | ||
373 | |||
374 | #define ISR 0x10C /* Interrupt status register */ | ||
375 | #define PSR 0x110 /* Primary status register */ | ||
376 | #define SSR 0x114 /* Secondary status register */ | ||
377 | |||
378 | #define EC1R 0x118 /* Event counter set 1 register */ | ||
379 | #define EC2R 0x11C /* Event counter set 2 register */ | ||
380 | |||
381 | #define PCI_VDP1 0x120 /* Video DMA pointer of FIFO 1 */ | ||
382 | #define PCI_VDP2 0x124 /* Video DMA pointer of FIFO 2 */ | ||
383 | #define PCI_VDP3 0x128 /* Video DMA pointer of FIFO 3 */ | ||
384 | #define PCI_ADP1 0x12C /* Audio DMA pointer of audio out 1 */ | ||
385 | #define PCI_ADP2 0x130 /* Audio DMA pointer of audio in 1 */ | ||
386 | #define PCI_ADP3 0x134 /* Audio DMA pointer of audio out 2 */ | ||
387 | #define PCI_ADP4 0x138 /* Audio DMA pointer of audio in 2 */ | ||
388 | #define PCI_DMA_DDP 0x13C /* DEBI DMA pointer */ | ||
389 | |||
390 | #define LEVEL_REP 0x140, | ||
391 | #define A_TIME_SLOT1 0x180, /* from 180 - 1BC */ | ||
392 | #define A_TIME_SLOT2 0x1C0, /* from 1C0 - 1FC */ | ||
393 | |||
394 | /* isr masks */ | ||
395 | #define SPCI_PPEF 0x80000000 /* PCI parity error */ | ||
396 | #define SPCI_PABO 0x40000000 /* PCI access error (target or master abort) */ | ||
397 | #define SPCI_PPED 0x20000000 /* PCI parity error on 'real time data' */ | ||
398 | #define SPCI_RPS_I1 0x10000000 /* Interrupt issued by RPS1 */ | ||
399 | #define SPCI_RPS_I0 0x08000000 /* Interrupt issued by RPS0 */ | ||
400 | #define SPCI_RPS_LATE1 0x04000000 /* RPS task 1 is late */ | ||
401 | #define SPCI_RPS_LATE0 0x02000000 /* RPS task 0 is late */ | ||
402 | #define SPCI_RPS_E1 0x01000000 /* RPS error from task 1 */ | ||
403 | #define SPCI_RPS_E0 0x00800000 /* RPS error from task 0 */ | ||
404 | #define SPCI_RPS_TO1 0x00400000 /* RPS timeout task 1 */ | ||
405 | #define SPCI_RPS_TO0 0x00200000 /* RPS timeout task 0 */ | ||
406 | #define SPCI_UPLD 0x00100000 /* RPS in upload */ | ||
407 | #define SPCI_DEBI_S 0x00080000 /* DEBI status */ | ||
408 | #define SPCI_DEBI_E 0x00040000 /* DEBI error */ | ||
409 | #define SPCI_IIC_S 0x00020000 /* I2C status */ | ||
410 | #define SPCI_IIC_E 0x00010000 /* I2C error */ | ||
411 | #define SPCI_A2_IN 0x00008000 /* Audio 2 input DMA protection / limit */ | ||
412 | #define SPCI_A2_OUT 0x00004000 /* Audio 2 output DMA protection / limit */ | ||
413 | #define SPCI_A1_IN 0x00002000 /* Audio 1 input DMA protection / limit */ | ||
414 | #define SPCI_A1_OUT 0x00001000 /* Audio 1 output DMA protection / limit */ | ||
415 | #define SPCI_AFOU 0x00000800 /* Audio FIFO over- / underflow */ | ||
416 | #define SPCI_V_PE 0x00000400 /* Video protection address */ | ||
417 | #define SPCI_VFOU 0x00000200 /* Video FIFO over- / underflow */ | ||
418 | #define SPCI_FIDA 0x00000100 /* Field ID video port A */ | ||
419 | #define SPCI_FIDB 0x00000080 /* Field ID video port B */ | ||
420 | #define SPCI_PIN3 0x00000040 /* GPIO pin 3 */ | ||
421 | #define SPCI_PIN2 0x00000020 /* GPIO pin 2 */ | ||
422 | #define SPCI_PIN1 0x00000010 /* GPIO pin 1 */ | ||
423 | #define SPCI_PIN0 0x00000008 /* GPIO pin 0 */ | ||
424 | #define SPCI_ECS 0x00000004 /* Event counter 1, 2, 4, 5 */ | ||
425 | #define SPCI_EC3S 0x00000002 /* Event counter 3 */ | ||
426 | #define SPCI_EC0S 0x00000001 /* Event counter 0 */ | ||
427 | |||
428 | /* i2c */ | ||
429 | #define SAA7146_I2C_ABORT (1<<7) | ||
430 | #define SAA7146_I2C_SPERR (1<<6) | ||
431 | #define SAA7146_I2C_APERR (1<<5) | ||
432 | #define SAA7146_I2C_DTERR (1<<4) | ||
433 | #define SAA7146_I2C_DRERR (1<<3) | ||
434 | #define SAA7146_I2C_AL (1<<2) | ||
435 | #define SAA7146_I2C_ERR (1<<1) | ||
436 | #define SAA7146_I2C_BUSY (1<<0) | ||
437 | |||
438 | #define SAA7146_I2C_START (0x3) | ||
439 | #define SAA7146_I2C_CONT (0x2) | ||
440 | #define SAA7146_I2C_STOP (0x1) | ||
441 | #define SAA7146_I2C_NOP (0x0) | ||
442 | |||
443 | #define SAA7146_I2C_BUS_BIT_RATE_6400 (0x500) | ||
444 | #define SAA7146_I2C_BUS_BIT_RATE_3200 (0x100) | ||
445 | #define SAA7146_I2C_BUS_BIT_RATE_480 (0x400) | ||
446 | #define SAA7146_I2C_BUS_BIT_RATE_320 (0x600) | ||
447 | #define SAA7146_I2C_BUS_BIT_RATE_240 (0x700) | ||
448 | #define SAA7146_I2C_BUS_BIT_RATE_120 (0x000) | ||
449 | #define SAA7146_I2C_BUS_BIT_RATE_80 (0x200) | ||
450 | #define SAA7146_I2C_BUS_BIT_RATE_60 (0x300) | ||
451 | |||
452 | #endif | ||
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h new file mode 100644 index 000000000000..f3aa24f8131c --- /dev/null +++ b/include/media/saa7146_vv.h | |||
@@ -0,0 +1,270 @@ | |||
1 | #ifndef __SAA7146_VV__ | ||
2 | #define __SAA7146_VV__ | ||
3 | |||
4 | #include <linux/videodev2.h> | ||
5 | |||
6 | #include <media/saa7146.h> | ||
7 | #include <media/video-buf.h> | ||
8 | |||
9 | #define MAX_SAA7146_CAPTURE_BUFFERS 32 /* arbitrary */ | ||
10 | #define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */ | ||
11 | |||
12 | #define WRITE_RPS0(x) do { \ | ||
13 | dev->d_rps0.cpu_addr[ count++ ] = cpu_to_le32(x); \ | ||
14 | } while (0); | ||
15 | |||
16 | #define WRITE_RPS1(x) do { \ | ||
17 | dev->d_rps1.cpu_addr[ count++ ] = cpu_to_le32(x); \ | ||
18 | } while (0); | ||
19 | |||
20 | struct saa7146_video_dma { | ||
21 | u32 base_odd; | ||
22 | u32 base_even; | ||
23 | u32 prot_addr; | ||
24 | u32 pitch; | ||
25 | u32 base_page; | ||
26 | u32 num_line_byte; | ||
27 | }; | ||
28 | |||
29 | #define FORMAT_BYTE_SWAP 0x1 | ||
30 | #define FORMAT_IS_PLANAR 0x2 | ||
31 | |||
32 | struct saa7146_format { | ||
33 | char *name; | ||
34 | u32 pixelformat; | ||
35 | u32 trans; | ||
36 | u8 depth; | ||
37 | u8 flags; | ||
38 | u8 swap; | ||
39 | }; | ||
40 | |||
41 | struct saa7146_standard | ||
42 | { | ||
43 | char *name; | ||
44 | v4l2_std_id id; | ||
45 | |||
46 | int v_offset; /* number of lines of vertical offset before processing */ | ||
47 | int v_field; /* number of lines in a field for HPS to process */ | ||
48 | |||
49 | int h_offset; /* horizontal offset of processing window */ | ||
50 | int h_pixels; /* number of horizontal pixels to process */ | ||
51 | |||
52 | int v_max_out; | ||
53 | int h_max_out; | ||
54 | }; | ||
55 | |||
56 | /* buffer for one video/vbi frame */ | ||
57 | struct saa7146_buf { | ||
58 | /* common v4l buffer stuff -- must be first */ | ||
59 | struct videobuf_buffer vb; | ||
60 | |||
61 | /* saa7146 specific */ | ||
62 | struct v4l2_pix_format *fmt; | ||
63 | int (*activate)(struct saa7146_dev *dev, | ||
64 | struct saa7146_buf *buf, | ||
65 | struct saa7146_buf *next); | ||
66 | |||
67 | /* page tables */ | ||
68 | struct saa7146_pgtable pt[3]; | ||
69 | }; | ||
70 | |||
71 | struct saa7146_dmaqueue { | ||
72 | struct saa7146_dev *dev; | ||
73 | struct saa7146_buf *curr; | ||
74 | struct list_head queue; | ||
75 | struct timer_list timeout; | ||
76 | }; | ||
77 | |||
78 | struct saa7146_overlay { | ||
79 | struct saa7146_fh *fh; | ||
80 | struct v4l2_window win; | ||
81 | struct v4l2_clip clips[16]; | ||
82 | int nclips; | ||
83 | }; | ||
84 | |||
85 | /* per open data */ | ||
86 | struct saa7146_fh { | ||
87 | struct saa7146_dev *dev; | ||
88 | /* if this is a vbi or capture open */ | ||
89 | enum v4l2_buf_type type; | ||
90 | |||
91 | /* video overlay */ | ||
92 | struct saa7146_overlay ov; | ||
93 | |||
94 | /* video capture */ | ||
95 | struct videobuf_queue video_q; | ||
96 | struct v4l2_pix_format video_fmt; | ||
97 | |||
98 | /* vbi capture */ | ||
99 | struct videobuf_queue vbi_q; | ||
100 | struct v4l2_vbi_format vbi_fmt; | ||
101 | struct timer_list vbi_read_timeout; | ||
102 | |||
103 | unsigned int resources; /* resource management for device open */ | ||
104 | }; | ||
105 | |||
106 | #define STATUS_OVERLAY 0x01 | ||
107 | #define STATUS_CAPTURE 0x02 | ||
108 | |||
109 | struct saa7146_vv | ||
110 | { | ||
111 | int vbi_minor; | ||
112 | |||
113 | /* vbi capture */ | ||
114 | struct saa7146_dmaqueue vbi_q; | ||
115 | /* vbi workaround interrupt queue */ | ||
116 | wait_queue_head_t vbi_wq; | ||
117 | int vbi_fieldcount; | ||
118 | struct saa7146_fh *vbi_streaming; | ||
119 | |||
120 | int video_minor; | ||
121 | |||
122 | int video_status; | ||
123 | struct saa7146_fh *video_fh; | ||
124 | |||
125 | /* video overlay */ | ||
126 | struct v4l2_framebuffer ov_fb; | ||
127 | struct saa7146_format *ov_fmt; | ||
128 | struct saa7146_overlay *ov_data; | ||
129 | struct saa7146_fh *ov_suspend; | ||
130 | |||
131 | /* video capture */ | ||
132 | struct saa7146_dmaqueue video_q; | ||
133 | enum v4l2_field last_field; | ||
134 | |||
135 | /* common: fixme? shouldn't this be in saa7146_fh? | ||
136 | (this leads to a more complicated question: shall the driver | ||
137 | store the different settings (for example S_INPUT) for every open | ||
138 | and restore it appropriately, or should all settings be common for | ||
139 | all opens? currently, we do the latter, like all other | ||
140 | drivers do... */ | ||
141 | struct saa7146_standard *standard; | ||
142 | |||
143 | int vflip; | ||
144 | int hflip; | ||
145 | int current_hps_source; | ||
146 | int current_hps_sync; | ||
147 | |||
148 | struct saa7146_dma d_clipping; /* pointer to clipping memory */ | ||
149 | |||
150 | unsigned int resources; /* resource management for device */ | ||
151 | }; | ||
152 | |||
153 | #define SAA7146_EXCLUSIVE 0x1 | ||
154 | #define SAA7146_BEFORE 0x2 | ||
155 | #define SAA7146_AFTER 0x4 | ||
156 | |||
157 | struct saa7146_extension_ioctls | ||
158 | { | ||
159 | unsigned int cmd; | ||
160 | int flags; | ||
161 | }; | ||
162 | |||
163 | /* flags */ | ||
164 | #define SAA7146_USE_PORT_B_FOR_VBI 0x2 /* use input port b for vbi hardware bug workaround */ | ||
165 | |||
166 | struct saa7146_ext_vv | ||
167 | { | ||
168 | /* informations about the video capabilities of the device */ | ||
169 | int inputs; | ||
170 | int audios; | ||
171 | u32 capabilities; | ||
172 | int flags; | ||
173 | |||
174 | /* additionally supported transmission standards */ | ||
175 | struct saa7146_standard *stds; | ||
176 | int num_stds; | ||
177 | int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *); | ||
178 | |||
179 | struct saa7146_extension_ioctls *ioctls; | ||
180 | int (*ioctl)(struct saa7146_fh*, unsigned int cmd, void *arg); | ||
181 | }; | ||
182 | |||
183 | struct saa7146_use_ops { | ||
184 | void (*init)(struct saa7146_dev *, struct saa7146_vv *); | ||
185 | int(*open)(struct saa7146_dev *, struct file *); | ||
186 | void (*release)(struct saa7146_dev *, struct file *); | ||
187 | void (*irq_done)(struct saa7146_dev *, unsigned long status); | ||
188 | ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); | ||
189 | }; | ||
190 | |||
191 | /* from saa7146_fops.c */ | ||
192 | int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, char *name, int type); | ||
193 | int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev); | ||
194 | void saa7146_buffer_finish(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, int state); | ||
195 | void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi); | ||
196 | int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf); | ||
197 | void saa7146_buffer_timeout(unsigned long data); | ||
198 | void saa7146_dma_free(struct saa7146_dev *dev,struct saa7146_buf *buf); | ||
199 | |||
200 | int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv); | ||
201 | int saa7146_vv_release(struct saa7146_dev* dev); | ||
202 | |||
203 | /* from saa7146_hlp.c */ | ||
204 | int saa7146_enable_overlay(struct saa7146_fh *fh); | ||
205 | void saa7146_disable_overlay(struct saa7146_fh *fh); | ||
206 | |||
207 | void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next); | ||
208 | void saa7146_write_out_dma(struct saa7146_dev* dev, int which, struct saa7146_video_dma* vdma) ; | ||
209 | void saa7146_set_hps_source_and_sync(struct saa7146_dev *saa, int source, int sync); | ||
210 | void saa7146_set_gpio(struct saa7146_dev *saa, u8 pin, u8 data); | ||
211 | |||
212 | /* from saa7146_video.c */ | ||
213 | extern struct saa7146_use_ops saa7146_video_uops; | ||
214 | int saa7146_start_preview(struct saa7146_fh *fh); | ||
215 | int saa7146_stop_preview(struct saa7146_fh *fh); | ||
216 | |||
217 | /* from saa7146_vbi.c */ | ||
218 | extern struct saa7146_use_ops saa7146_vbi_uops; | ||
219 | |||
220 | /* resource management functions */ | ||
221 | int saa7146_res_get(struct saa7146_fh *fh, unsigned int bit); | ||
222 | void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits); | ||
223 | |||
224 | #define RESOURCE_DMA1_HPS 0x1 | ||
225 | #define RESOURCE_DMA2_CLP 0x2 | ||
226 | #define RESOURCE_DMA3_BRS 0x4 | ||
227 | |||
228 | /* saa7146 source inputs */ | ||
229 | #define SAA7146_HPS_SOURCE_PORT_A 0x00 | ||
230 | #define SAA7146_HPS_SOURCE_PORT_B 0x01 | ||
231 | #define SAA7146_HPS_SOURCE_YPB_CPA 0x02 | ||
232 | #define SAA7146_HPS_SOURCE_YPA_CPB 0x03 | ||
233 | |||
234 | /* sync inputs */ | ||
235 | #define SAA7146_HPS_SYNC_PORT_A 0x00 | ||
236 | #define SAA7146_HPS_SYNC_PORT_B 0x01 | ||
237 | |||
238 | /* some memory sizes */ | ||
239 | #define SAA7146_CLIPPING_MEM (14*PAGE_SIZE) | ||
240 | |||
241 | /* some defines for the various clipping-modes */ | ||
242 | #define SAA7146_CLIPPING_RECT 0x4 | ||
243 | #define SAA7146_CLIPPING_RECT_INVERTED 0x5 | ||
244 | #define SAA7146_CLIPPING_MASK 0x6 | ||
245 | #define SAA7146_CLIPPING_MASK_INVERTED 0x7 | ||
246 | |||
247 | /* output formats: each entry holds four informations */ | ||
248 | #define RGB08_COMPOSED 0x0217 /* composed is used in the sense of "not-planar" */ | ||
249 | /* this means: planar?=0, yuv2rgb-conversation-mode=2, dither=yes(=1), format-mode = 7 */ | ||
250 | #define RGB15_COMPOSED 0x0213 | ||
251 | #define RGB16_COMPOSED 0x0210 | ||
252 | #define RGB24_COMPOSED 0x0201 | ||
253 | #define RGB32_COMPOSED 0x0202 | ||
254 | |||
255 | #define Y8 0x0006 | ||
256 | #define YUV411_COMPOSED 0x0003 | ||
257 | #define YUV422_COMPOSED 0x0000 | ||
258 | /* this means: planar?=1, yuv2rgb-conversion-mode=0, dither=no(=0), format-mode = b */ | ||
259 | #define YUV411_DECOMPOSED 0x100b | ||
260 | #define YUV422_DECOMPOSED 0x1009 | ||
261 | #define YUV420_DECOMPOSED 0x100a | ||
262 | |||
263 | #define IS_PLANAR(x) (x & 0xf000) | ||
264 | |||
265 | /* misc defines */ | ||
266 | #define SAA7146_NO_SWAP (0x0) | ||
267 | #define SAA7146_TWO_BYTE_SWAP (0x1) | ||
268 | #define SAA7146_FOUR_BYTE_SWAP (0x2) | ||
269 | |||
270 | #endif | ||
diff --git a/include/media/tuner.h b/include/media/tuner.h new file mode 100644 index 000000000000..156a9c51ffec --- /dev/null +++ b/include/media/tuner.h | |||
@@ -0,0 +1,199 @@ | |||
1 | |||
2 | /* | ||
3 | tuner.h - definition for different tuners | ||
4 | |||
5 | Copyright (C) 1997 Markus Schroeder (schroedm@uni-duesseldorf.de) | ||
6 | minor modifications by Ralph Metzler (rjkm@thp.uni-koeln.de) | ||
7 | |||
8 | This program is free software; you can redistribute it and/or modify | ||
9 | it under the terms of the GNU General Public License as published by | ||
10 | the Free Software Foundation; either version 2 of the License, or | ||
11 | (at your option) any later version. | ||
12 | |||
13 | This program is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | GNU General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU General Public License | ||
19 | along with this program; if not, write to the Free Software | ||
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | */ | ||
22 | |||
23 | #ifndef _TUNER_H | ||
24 | #define _TUNER_H | ||
25 | |||
26 | #include "id.h" | ||
27 | |||
28 | #define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ | ||
29 | #define TUNER_PHILIPS_PAL_I 1 | ||
30 | #define TUNER_PHILIPS_NTSC 2 | ||
31 | #define TUNER_PHILIPS_SECAM 3 /* you must actively select B/G, L, L` */ | ||
32 | |||
33 | #define TUNER_ABSENT 4 | ||
34 | #define TUNER_PHILIPS_PAL 5 | ||
35 | #define TUNER_TEMIC_NTSC 6 /* 4032 FY5 (3X 7004, 9498, 9789) */ | ||
36 | #define TUNER_TEMIC_PAL_I 7 /* 4062 FY5 (3X 8501, 9957) */ | ||
37 | |||
38 | #define TUNER_TEMIC_4036FY5_NTSC 8 /* 4036 FY5 (3X 1223, 1981, 7686) */ | ||
39 | #define TUNER_ALPS_TSBH1_NTSC 9 | ||
40 | #define TUNER_ALPS_TSBE1_PAL 10 | ||
41 | #define TUNER_ALPS_TSBB5_PAL_I 11 | ||
42 | |||
43 | #define TUNER_ALPS_TSBE5_PAL 12 | ||
44 | #define TUNER_ALPS_TSBC5_PAL 13 | ||
45 | #define TUNER_TEMIC_4006FH5_PAL 14 /* 4006 FH5 (3X 9500, 9501, 7291) */ | ||
46 | #define TUNER_ALPS_TSHC6_NTSC 15 | ||
47 | |||
48 | #define TUNER_TEMIC_PAL_DK 16 /* 4016 FY5 (3X 1392, 1393) */ | ||
49 | #define TUNER_PHILIPS_NTSC_M 17 | ||
50 | #define TUNER_TEMIC_4066FY5_PAL_I 18 /* 4066 FY5 (3X 7032, 7035) */ | ||
51 | #define TUNER_TEMIC_4006FN5_MULTI_PAL 19 /* B/G, I and D/K autodetected (3X 7595, 7606, 7657)*/ | ||
52 | |||
53 | #define TUNER_TEMIC_4009FR5_PAL 20 /* incl. FM radio (3X 7607, 7488, 7711)*/ | ||
54 | #define TUNER_TEMIC_4039FR5_NTSC 21 /* incl. FM radio (3X 7246, 7578, 7732)*/ | ||
55 | #define TUNER_TEMIC_4046FM5 22 /* you must actively select B/G, D/K, I, L, L` ! (3X 7804, 7806, 8103, 8104)*/ | ||
56 | #define TUNER_PHILIPS_PAL_DK 23 | ||
57 | |||
58 | #define TUNER_PHILIPS_FQ1216ME 24 /* you must actively select B/G/D/K, I, L, L` */ | ||
59 | #define TUNER_LG_PAL_I_FM 25 | ||
60 | #define TUNER_LG_PAL_I 26 | ||
61 | #define TUNER_LG_NTSC_FM 27 | ||
62 | |||
63 | #define TUNER_LG_PAL_FM 28 | ||
64 | #define TUNER_LG_PAL 29 | ||
65 | #define TUNER_TEMIC_4009FN5_MULTI_PAL_FM 30 /* B/G, I and D/K autodetected (3X 8155, 8160, 8163)*/ | ||
66 | #define TUNER_SHARP_2U5JF5540_NTSC 31 | ||
67 | |||
68 | #define TUNER_Samsung_PAL_TCPM9091PD27 32 | ||
69 | #define TUNER_MT2032 33 | ||
70 | #define TUNER_TEMIC_4106FH5 34 /* 4106 FH5 (3X 7808, 7865)*/ | ||
71 | #define TUNER_TEMIC_4012FY5 35 /* 4012 FY5 (3X 0971, 1099)*/ | ||
72 | |||
73 | #define TUNER_TEMIC_4136FY5 36 /* 4136 FY5 (3X 7708, 7746)*/ | ||
74 | #define TUNER_LG_PAL_NEW_TAPC 37 | ||
75 | #define TUNER_PHILIPS_FM1216ME_MK3 38 | ||
76 | #define TUNER_LG_NTSC_NEW_TAPC 39 | ||
77 | |||
78 | #define TUNER_HITACHI_NTSC 40 | ||
79 | #define TUNER_PHILIPS_PAL_MK 41 | ||
80 | #define TUNER_PHILIPS_ATSC 42 | ||
81 | #define TUNER_PHILIPS_FM1236_MK3 43 | ||
82 | |||
83 | #define TUNER_PHILIPS_4IN1 44 /* ATI TV Wonder Pro - Conexant */ | ||
84 | /* Microtune mergeged with Temic 12/31/1999 partially financed by Alps - these may be similar to Temic */ | ||
85 | #define TUNER_MICROTUNE_4049FM5 45 | ||
86 | #define TUNER_LG_NTSC_TAPE 47 | ||
87 | |||
88 | #define TUNER_TNF_8831BGFF 48 | ||
89 | #define TUNER_MICROTUNE_4042FI5 49 /* FusionHDTV 3 Gold - 4042 FI5 (3X 8147) */ | ||
90 | #define TUNER_TCL_2002N 50 | ||
91 | #define TUNER_PHILIPS_FM1256_IH3 51 | ||
92 | |||
93 | #define TUNER_THOMSON_DTT7610 52 | ||
94 | #define TUNER_PHILIPS_FQ1286 53 | ||
95 | #define TUNER_PHILIPS_TDA8290 54 | ||
96 | #define TUNER_LG_PAL_TAPE 55 /* Hauppauge PVR-150 PAL */ | ||
97 | |||
98 | #define TUNER_PHILIPS_FQ1216AME_MK4 56 /* Hauppauge PVR-150 PAL */ | ||
99 | #define TUNER_PHILIPS_FQ1236A_MK4 57 /* Hauppauge PVR-500MCE NTSC */ | ||
100 | |||
101 | #define NOTUNER 0 | ||
102 | #define PAL 1 /* PAL_BG */ | ||
103 | #define PAL_I 2 | ||
104 | #define NTSC 3 | ||
105 | #define SECAM 4 | ||
106 | #define ATSC 5 | ||
107 | |||
108 | #define NoTuner 0 | ||
109 | #define Philips 1 | ||
110 | #define TEMIC 2 | ||
111 | #define Sony 3 | ||
112 | #define Alps 4 | ||
113 | #define LGINNOTEK 5 | ||
114 | #define SHARP 6 | ||
115 | #define Samsung 7 | ||
116 | #define Microtune 8 | ||
117 | #define HITACHI 9 | ||
118 | #define Panasonic 10 | ||
119 | #define TCL 11 | ||
120 | #define THOMSON 12 | ||
121 | |||
122 | #define TUNER_SET_TYPE _IOW('t',1,int) /* set tuner type */ | ||
123 | #define TUNER_SET_TVFREQ _IOW('t',2,int) /* set tv freq */ | ||
124 | |||
125 | #define TDA9887_SET_CONFIG _IOW('t',5,int) | ||
126 | /* tv card specific */ | ||
127 | # define TDA9887_PRESENT (1<<0) | ||
128 | # define TDA9887_PORT1_INACTIVE (1<<1) | ||
129 | # define TDA9887_PORT2_INACTIVE (1<<2) | ||
130 | # define TDA9887_QSS (1<<3) | ||
131 | # define TDA9887_INTERCARRIER (1<<4) | ||
132 | # define TDA9887_PORT1_ACTIVE (1<<5) | ||
133 | # define TDA9887_PORT2_ACTIVE (1<<6) | ||
134 | /* config options */ | ||
135 | # define TDA9887_DEEMPHASIS_MASK (3<<16) | ||
136 | # define TDA9887_DEEMPHASIS_NONE (1<<16) | ||
137 | # define TDA9887_DEEMPHASIS_50 (2<<16) | ||
138 | # define TDA9887_DEEMPHASIS_75 (3<<16) | ||
139 | # define TDA9887_AUTOMUTE (1<<18) | ||
140 | |||
141 | #ifdef __KERNEL__ | ||
142 | |||
143 | #define I2C_ADDR_TDA8290 0x4b | ||
144 | #define I2C_ADDR_TDA8275 0x61 | ||
145 | |||
146 | struct tuner { | ||
147 | /* device */ | ||
148 | struct i2c_client i2c; | ||
149 | |||
150 | /* state + config */ | ||
151 | unsigned int initialized; | ||
152 | unsigned int type; /* chip type */ | ||
153 | unsigned int freq; /* keep track of the current settings */ | ||
154 | v4l2_std_id std; | ||
155 | int using_v4l2; | ||
156 | |||
157 | enum v4l2_tuner_type mode; | ||
158 | unsigned int input; | ||
159 | |||
160 | /* used by MT2032 */ | ||
161 | unsigned int xogc; | ||
162 | unsigned int radio_if2; | ||
163 | |||
164 | /* used by tda8290 */ | ||
165 | unsigned char i2c_easy_mode[2]; | ||
166 | unsigned char i2c_set_freq[8]; | ||
167 | |||
168 | /* function ptrs */ | ||
169 | void (*tv_freq)(struct i2c_client *c, unsigned int freq); | ||
170 | void (*radio_freq)(struct i2c_client *c, unsigned int freq); | ||
171 | int (*has_signal)(struct i2c_client *c); | ||
172 | int (*is_stereo)(struct i2c_client *c); | ||
173 | }; | ||
174 | |||
175 | extern unsigned int tuner_debug; | ||
176 | extern unsigned const int tuner_count; | ||
177 | |||
178 | extern int microtune_init(struct i2c_client *c); | ||
179 | extern int tda8290_init(struct i2c_client *c); | ||
180 | extern int default_tuner_init(struct i2c_client *c); | ||
181 | |||
182 | #define tuner_warn(fmt, arg...) \ | ||
183 | dev_printk(KERN_WARNING , &t->i2c.dev , fmt , ## arg) | ||
184 | #define tuner_info(fmt, arg...) \ | ||
185 | dev_printk(KERN_INFO , &t->i2c.dev , fmt , ## arg) | ||
186 | #define tuner_dbg(fmt, arg...) \ | ||
187 | if (tuner_debug) dev_printk(KERN_DEBUG , &t->i2c.dev , fmt , ## arg) | ||
188 | |||
189 | #endif /* __KERNEL__ */ | ||
190 | |||
191 | #endif | ||
192 | |||
193 | /* | ||
194 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
195 | * --------------------------------------------------------------------------- | ||
196 | * Local variables: | ||
197 | * c-basic-offset: 8 | ||
198 | * End: | ||
199 | */ | ||
diff --git a/include/media/tveeprom.h b/include/media/tveeprom.h new file mode 100644 index 000000000000..627603e561a6 --- /dev/null +++ b/include/media/tveeprom.h | |||
@@ -0,0 +1,23 @@ | |||
1 | struct tveeprom { | ||
2 | u32 has_radio; | ||
3 | |||
4 | u32 tuner_type; | ||
5 | u32 tuner_formats; | ||
6 | |||
7 | u32 digitizer; | ||
8 | u32 digitizer_formats; | ||
9 | |||
10 | u32 audio_processor; | ||
11 | /* a_p_fmts? */ | ||
12 | |||
13 | u32 model; | ||
14 | u32 revision; | ||
15 | u32 serial_number; | ||
16 | char rev_str[5]; | ||
17 | }; | ||
18 | |||
19 | void tveeprom_hauppauge_analog(struct tveeprom *tvee, | ||
20 | unsigned char *eeprom_data); | ||
21 | |||
22 | int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len); | ||
23 | int tveeprom_dump(unsigned char *eedata, int len); | ||
diff --git a/include/media/video-buf-dvb.h b/include/media/video-buf-dvb.h new file mode 100644 index 000000000000..94bd33619aa5 --- /dev/null +++ b/include/media/video-buf-dvb.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #include <dvbdev.h> | ||
2 | #include <dmxdev.h> | ||
3 | #include <dvb_demux.h> | ||
4 | #include <dvb_net.h> | ||
5 | #include <dvb_frontend.h> | ||
6 | |||
7 | struct videobuf_dvb { | ||
8 | /* filling that the job of the driver */ | ||
9 | char *name; | ||
10 | struct dvb_frontend *frontend; | ||
11 | struct videobuf_queue dvbq; | ||
12 | |||
13 | /* video-buf-dvb state info */ | ||
14 | struct semaphore lock; | ||
15 | struct task_struct *thread; | ||
16 | int nfeeds; | ||
17 | |||
18 | /* videobuf_dvb_(un)register manges this */ | ||
19 | struct dvb_adapter *adapter; | ||
20 | struct dvb_demux demux; | ||
21 | struct dmxdev dmxdev; | ||
22 | struct dmx_frontend fe_hw; | ||
23 | struct dmx_frontend fe_mem; | ||
24 | struct dvb_net net; | ||
25 | }; | ||
26 | |||
27 | int videobuf_dvb_register(struct videobuf_dvb *dvb, | ||
28 | struct module *module, | ||
29 | void *adapter_priv); | ||
30 | void videobuf_dvb_unregister(struct videobuf_dvb *dvb); | ||
31 | |||
32 | /* | ||
33 | * Local variables: | ||
34 | * c-basic-offset: 8 | ||
35 | * End: | ||
36 | */ | ||
diff --git a/include/media/video-buf.h b/include/media/video-buf.h new file mode 100644 index 000000000000..ae6da6de98de --- /dev/null +++ b/include/media/video-buf.h | |||
@@ -0,0 +1,260 @@ | |||
1 | /* | ||
2 | * $Id: video-buf.h,v 1.9 2004/11/07 13:17:15 kraxel Exp $ | ||
3 | * | ||
4 | * generic helper functions for video4linux capture buffers, to handle | ||
5 | * memory management and PCI DMA. Right now bttv + saa7134 use it. | ||
6 | * | ||
7 | * The functions expect the hardware being able to scatter gatter | ||
8 | * (i.e. the buffers are not linear in physical memory, but fragmented | ||
9 | * into PAGE_SIZE chunks). They also assume the driver does not need | ||
10 | * to touch the video data (thus it is probably not useful for USB as | ||
11 | * data often must be uncompressed by the drivers). | ||
12 | * | ||
13 | * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org> | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | ||
16 | * it under the terms of the GNU General Public License as published by | ||
17 | * the Free Software Foundation; either version 2 of the License, or | ||
18 | * (at your option) any later version. | ||
19 | */ | ||
20 | |||
21 | #include <linux/videodev.h> | ||
22 | |||
23 | #define UNSET (-1U) | ||
24 | |||
25 | /* --------------------------------------------------------------------- */ | ||
26 | |||
27 | /* | ||
28 | * Return a scatterlist for some page-aligned vmalloc()'ed memory | ||
29 | * block (NULL on errors). Memory for the scatterlist is allocated | ||
30 | * using kmalloc. The caller must free the memory. | ||
31 | */ | ||
32 | struct scatterlist* videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages); | ||
33 | |||
34 | /* | ||
35 | * Return a scatterlist for a an array of userpages (NULL on errors). | ||
36 | * Memory for the scatterlist is allocated using kmalloc. The caller | ||
37 | * must free the memory. | ||
38 | */ | ||
39 | struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, | ||
40 | int offset); | ||
41 | |||
42 | /* --------------------------------------------------------------------- */ | ||
43 | |||
44 | /* | ||
45 | * A small set of helper functions to manage buffers (both userland | ||
46 | * and kernel) for DMA. | ||
47 | * | ||
48 | * videobuf_dma_init_*() | ||
49 | * creates a buffer. The userland version takes a userspace | ||
50 | * pointer + length. The kernel version just wants the size and | ||
51 | * does memory allocation too using vmalloc_32(). | ||
52 | * | ||
53 | * videobuf_dma_pci_*() | ||
54 | * see Documentation/DMA-mapping.txt, these functions to | ||
55 | * basically the same. The map function does also build a | ||
56 | * scatterlist for the buffer (and unmap frees it ...) | ||
57 | * | ||
58 | * videobuf_dma_free() | ||
59 | * no comment ... | ||
60 | * | ||
61 | */ | ||
62 | |||
63 | struct videobuf_dmabuf { | ||
64 | u32 magic; | ||
65 | |||
66 | /* for userland buffer */ | ||
67 | int offset; | ||
68 | struct page **pages; | ||
69 | |||
70 | /* for kernel buffers */ | ||
71 | void *vmalloc; | ||
72 | |||
73 | /* for overlay buffers (pci-pci dma) */ | ||
74 | dma_addr_t bus_addr; | ||
75 | |||
76 | /* common */ | ||
77 | struct scatterlist *sglist; | ||
78 | int sglen; | ||
79 | int nr_pages; | ||
80 | int direction; | ||
81 | }; | ||
82 | |||
83 | void videobuf_dma_init(struct videobuf_dmabuf *dma); | ||
84 | int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction, | ||
85 | unsigned long data, unsigned long size); | ||
86 | int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, | ||
87 | int nr_pages); | ||
88 | int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, | ||
89 | dma_addr_t addr, int nr_pages); | ||
90 | int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma); | ||
91 | int videobuf_dma_pci_sync(struct pci_dev *dev, | ||
92 | struct videobuf_dmabuf *dma); | ||
93 | int videobuf_dma_pci_unmap(struct pci_dev *dev, struct videobuf_dmabuf *dma); | ||
94 | int videobuf_dma_free(struct videobuf_dmabuf *dma); | ||
95 | |||
96 | /* --------------------------------------------------------------------- */ | ||
97 | |||
98 | /* | ||
99 | * A small set of helper functions to manage video4linux buffers. | ||
100 | * | ||
101 | * struct videobuf_buffer holds the data structures used by the helper | ||
102 | * functions, additionally some commonly used fields for v4l buffers | ||
103 | * (width, height, lists, waitqueue) are in there. That struct should | ||
104 | * be used as first element in the drivers buffer struct. | ||
105 | * | ||
106 | * about the mmap helpers (videobuf_mmap_*): | ||
107 | * | ||
108 | * The mmaper function allows to map any subset of contingous buffers. | ||
109 | * This includes one mmap() call for all buffers (which the original | ||
110 | * video4linux API uses) as well as one mmap() for every single buffer | ||
111 | * (which v4l2 uses). | ||
112 | * | ||
113 | * If there is a valid mapping for a buffer, buffer->baddr/bsize holds | ||
114 | * userspace address + size which can be feeded into the | ||
115 | * videobuf_dma_init_user function listed above. | ||
116 | * | ||
117 | */ | ||
118 | |||
119 | struct videobuf_buffer; | ||
120 | struct videobuf_queue; | ||
121 | |||
122 | struct videobuf_mapping { | ||
123 | unsigned int count; | ||
124 | unsigned long start; | ||
125 | unsigned long end; | ||
126 | struct videobuf_queue *q; | ||
127 | }; | ||
128 | |||
129 | enum videobuf_state { | ||
130 | STATE_NEEDS_INIT = 0, | ||
131 | STATE_PREPARED = 1, | ||
132 | STATE_QUEUED = 2, | ||
133 | STATE_ACTIVE = 3, | ||
134 | STATE_DONE = 4, | ||
135 | STATE_ERROR = 5, | ||
136 | STATE_IDLE = 6, | ||
137 | }; | ||
138 | |||
139 | struct videobuf_buffer { | ||
140 | unsigned int i; | ||
141 | u32 magic; | ||
142 | |||
143 | /* info about the buffer */ | ||
144 | unsigned int width; | ||
145 | unsigned int height; | ||
146 | unsigned int bytesperline; /* use only if != 0 */ | ||
147 | unsigned long size; | ||
148 | unsigned int input; | ||
149 | enum v4l2_field field; | ||
150 | enum videobuf_state state; | ||
151 | struct videobuf_dmabuf dma; | ||
152 | struct list_head stream; /* QBUF/DQBUF list */ | ||
153 | |||
154 | /* for mmap'ed buffers */ | ||
155 | enum v4l2_memory memory; | ||
156 | size_t boff; /* buffer offset (mmap + overlay) */ | ||
157 | size_t bsize; /* buffer size */ | ||
158 | unsigned long baddr; /* buffer addr (userland ptr!) */ | ||
159 | struct videobuf_mapping *map; | ||
160 | |||
161 | /* touched by irq handler */ | ||
162 | struct list_head queue; | ||
163 | wait_queue_head_t done; | ||
164 | unsigned int field_count; | ||
165 | struct timeval ts; | ||
166 | }; | ||
167 | |||
168 | struct videobuf_queue_ops { | ||
169 | int (*buf_setup)(struct videobuf_queue *q, | ||
170 | unsigned int *count, unsigned int *size); | ||
171 | int (*buf_prepare)(struct videobuf_queue *q, | ||
172 | struct videobuf_buffer *vb, | ||
173 | enum v4l2_field field); | ||
174 | void (*buf_queue)(struct videobuf_queue *q, | ||
175 | struct videobuf_buffer *vb); | ||
176 | void (*buf_release)(struct videobuf_queue *q, | ||
177 | struct videobuf_buffer *vb); | ||
178 | }; | ||
179 | |||
180 | struct videobuf_queue { | ||
181 | struct semaphore lock; | ||
182 | spinlock_t *irqlock; | ||
183 | struct pci_dev *pci; | ||
184 | |||
185 | enum v4l2_buf_type type; | ||
186 | unsigned int inputs; /* for V4L2_BUF_FLAG_INPUT */ | ||
187 | unsigned int msize; | ||
188 | enum v4l2_field field; | ||
189 | enum v4l2_field last; /* for field=V4L2_FIELD_ALTERNATE */ | ||
190 | struct videobuf_buffer *bufs[VIDEO_MAX_FRAME]; | ||
191 | struct videobuf_queue_ops *ops; | ||
192 | |||
193 | /* capture via mmap() + ioctl(QBUF/DQBUF) */ | ||
194 | unsigned int streaming; | ||
195 | struct list_head stream; | ||
196 | |||
197 | /* capture via read() */ | ||
198 | unsigned int reading; | ||
199 | unsigned int read_off; | ||
200 | struct videobuf_buffer *read_buf; | ||
201 | |||
202 | /* driver private data */ | ||
203 | void *priv_data; | ||
204 | }; | ||
205 | |||
206 | void* videobuf_alloc(unsigned int size); | ||
207 | int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); | ||
208 | int videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb, | ||
209 | struct v4l2_framebuffer *fbuf); | ||
210 | |||
211 | void videobuf_queue_init(struct videobuf_queue *q, | ||
212 | struct videobuf_queue_ops *ops, | ||
213 | struct pci_dev *pci, | ||
214 | spinlock_t *irqlock, | ||
215 | enum v4l2_buf_type type, | ||
216 | enum v4l2_field field, | ||
217 | unsigned int msize, | ||
218 | void *priv); | ||
219 | int videobuf_queue_is_busy(struct videobuf_queue *q); | ||
220 | void videobuf_queue_cancel(struct videobuf_queue *q); | ||
221 | |||
222 | enum v4l2_field videobuf_next_field(struct videobuf_queue *q); | ||
223 | void videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb, | ||
224 | enum v4l2_buf_type type); | ||
225 | int videobuf_reqbufs(struct videobuf_queue *q, | ||
226 | struct v4l2_requestbuffers *req); | ||
227 | int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b); | ||
228 | int videobuf_qbuf(struct videobuf_queue *q, | ||
229 | struct v4l2_buffer *b); | ||
230 | int videobuf_dqbuf(struct videobuf_queue *q, | ||
231 | struct v4l2_buffer *b, int nonblocking); | ||
232 | int videobuf_streamon(struct videobuf_queue *q); | ||
233 | int videobuf_streamoff(struct videobuf_queue *q); | ||
234 | |||
235 | int videobuf_read_start(struct videobuf_queue *q); | ||
236 | void videobuf_read_stop(struct videobuf_queue *q); | ||
237 | ssize_t videobuf_read_stream(struct videobuf_queue *q, | ||
238 | char __user *data, size_t count, loff_t *ppos, | ||
239 | int vbihack, int nonblocking); | ||
240 | ssize_t videobuf_read_one(struct videobuf_queue *q, | ||
241 | char __user *data, size_t count, loff_t *ppos, | ||
242 | int nonblocking); | ||
243 | unsigned int videobuf_poll_stream(struct file *file, | ||
244 | struct videobuf_queue *q, | ||
245 | poll_table *wait); | ||
246 | |||
247 | int videobuf_mmap_setup(struct videobuf_queue *q, | ||
248 | unsigned int bcount, unsigned int bsize, | ||
249 | enum v4l2_memory memory); | ||
250 | int videobuf_mmap_free(struct videobuf_queue *q); | ||
251 | int videobuf_mmap_mapper(struct videobuf_queue *q, | ||
252 | struct vm_area_struct *vma); | ||
253 | |||
254 | /* --------------------------------------------------------------------- */ | ||
255 | |||
256 | /* | ||
257 | * Local variables: | ||
258 | * c-basic-offset: 8 | ||
259 | * End: | ||
260 | */ | ||