aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 16:59:51 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 16:59:51 -0500
commitb31fde6db2b76a9f7f59bf016652b46cff43f8da (patch)
tree2af4c48ae97b9800604fc0b36bc5c274d46d4aa3 /include
parentf31c338675872875e24f124af0689131b0c72600 (diff)
parenta999337b49fcdd2c4a475e97e4b8337ebdfa4abf (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (509 commits) V4L/DVB (7078): radio: fix sf16fmi section mismatch V4L/DVB (7077): bt878: remove handcrafted PCI subsystem ID check V4L/DVB (7075): Make a local function static V4L/DVB (7074): DiB7000P: correct tuning problem for 7MHz channel V4L/DVB (7073): DiB7070: Reception quality improved V4L/DVB (7072): sets the MT2060 IF1 frequency according to EEPROM V4L/DVB (7071): DiB0700: Start streaming the right way V4L/DVB (7070): Fix some tuning problems V4L/DVB (7069): Support for myTV.t V4L/DVB (7068): Add support for WinTV Nova-T-CE driver V4L/DVB (7067): fix autoserach in the Hauppauge NOVA-T 500 V4L/DVB (7066): ASUS My Cinema U3000 Mini DVBT Tuner V4L/DVB (7065): Artec T14BR patches V4L/DVB (7063): xc5000: Fix OOPS caused by missing firmware V4L/DVB (7062): radio-si570x: Some fixes and new USB ID addition V4L/DVB (7061): radio-si470x: Some cleanups V4L/DVB (7060): em28xx: remove has_tuner V4L/DVB (7059): cx88: Ensure the tuner is reset correctly V4L/DVB (7058): IR corrections for the Pinnacle 800i V4L/DVB (7056): tuner: suppress obsolete tuner i2c address warning for XC5000 tuners ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/i2c-id.h2
-rw-r--r--include/media/cs5345.h39
-rw-r--r--include/media/cx2341x.h2
-rw-r--r--include/media/cx25840.h19
-rw-r--r--include/media/ir-common.h3
-rw-r--r--include/media/m52790.h93
-rw-r--r--include/media/saa7146_vv.h1
-rw-r--r--include/media/tuner.h5
-rw-r--r--include/media/v4l2-chip-ident.h6
-rw-r--r--include/media/v4l2-common.h18
-rw-r--r--include/media/v4l2-i2c-drv-legacy.h140
-rw-r--r--include/media/v4l2-i2c-drv.h68
-rw-r--r--include/media/v4l2-int-device.h5
-rw-r--r--include/media/videobuf-core.h20
14 files changed, 402 insertions, 19 deletions
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index e18017d45758..c7a51a196f51 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -125,6 +125,8 @@
125#define I2C_DRIVERID_LM4857 92 /* LM4857 Audio Amplifier */ 125#define I2C_DRIVERID_LM4857 92 /* LM4857 Audio Amplifier */
126#define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */ 126#define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */
127#define I2C_DRIVERID_CS4270 94 /* Cirrus Logic 4270 audio codec */ 127#define I2C_DRIVERID_CS4270 94 /* Cirrus Logic 4270 audio codec */
128#define I2C_DRIVERID_M52790 95 /* Mitsubishi M52790SP/FP AV switch */
129#define I2C_DRIVERID_CS5345 96 /* cs5345 audio processor */
128 130
129#define I2C_DRIVERID_I2CDEV 900 131#define I2C_DRIVERID_I2CDEV 900
130#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ 132#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
diff --git a/include/media/cs5345.h b/include/media/cs5345.h
new file mode 100644
index 000000000000..6ccae24e65ed
--- /dev/null
+++ b/include/media/cs5345.h
@@ -0,0 +1,39 @@
1/*
2 cs5345.h - definition for cs5345 inputs and outputs
3
4 Copyright (C) 2007 Hans Verkuil (hverkuil@xs4all.nl)
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#ifndef _CS5345_H_
22#define _CS5345_H_
23
24/* CS5345 HW inputs */
25#define CS5345_IN_MIC 0
26#define CS5345_IN_1 1
27#define CS5345_IN_2 2
28#define CS5345_IN_3 3
29#define CS5345_IN_4 4
30#define CS5345_IN_5 5
31#define CS5345_IN_6 6
32
33#define CS5345_MCLK_1 0x00
34#define CS5345_MCLK_1_5 0x10
35#define CS5345_MCLK_2 0x20
36#define CS5345_MCLK_3 0x30
37#define CS5345_MCLK_4 0x40
38
39#endif
diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h
index af8071d7620d..5f4608e88476 100644
--- a/include/media/cx2341x.h
+++ b/include/media/cx2341x.h
@@ -83,7 +83,7 @@ struct cx2341x_mpeg_params {
83#define CX2341X_MBOX_MAX_DATA 16 83#define CX2341X_MBOX_MAX_DATA 16
84 84
85extern const u32 cx2341x_mpeg_ctrls[]; 85extern const u32 cx2341x_mpeg_ctrls[];
86typedef int (*cx2341x_mbox_func)(void *priv, int cmd, int in, int out, 86typedef int (*cx2341x_mbox_func)(void *priv, u32 cmd, int in, int out,
87 u32 data[CX2341X_MBOX_MAX_DATA]); 87 u32 data[CX2341X_MBOX_MAX_DATA]);
88int cx2341x_update(void *priv, cx2341x_mbox_func func, 88int cx2341x_update(void *priv, cx2341x_mbox_func func,
89 const struct cx2341x_mpeg_params *old, 89 const struct cx2341x_mpeg_params *old,
diff --git a/include/media/cx25840.h b/include/media/cx25840.h
index 8e7e52d659a0..cd599ad29fb2 100644
--- a/include/media/cx25840.h
+++ b/include/media/cx25840.h
@@ -49,6 +49,25 @@ enum cx25840_video_input {
49 CX25840_SVIDEO2 = 0x620, 49 CX25840_SVIDEO2 = 0x620,
50 CX25840_SVIDEO3 = 0x730, 50 CX25840_SVIDEO3 = 0x730,
51 CX25840_SVIDEO4 = 0x840, 51 CX25840_SVIDEO4 = 0x840,
52
53 /* Allow frames to specify specific input configurations */
54 CX25840_VIN1_CH1 = 0x80000000,
55 CX25840_VIN2_CH1 = 0x80000001,
56 CX25840_VIN3_CH1 = 0x80000002,
57 CX25840_VIN4_CH1 = 0x80000003,
58 CX25840_VIN5_CH1 = 0x80000004,
59 CX25840_VIN6_CH1 = 0x80000005,
60 CX25840_VIN7_CH1 = 0x80000006,
61 CX25840_VIN8_CH1 = 0x80000007,
62 CX25840_VIN4_CH2 = 0x80000000,
63 CX25840_VIN5_CH2 = 0x80000010,
64 CX25840_VIN6_CH2 = 0x80000020,
65 CX25840_NONE_CH2 = 0x80000030,
66 CX25840_VIN7_CH3 = 0x80000000,
67 CX25840_VIN8_CH3 = 0x80000040,
68 CX25840_NONE0_CH3 = 0x80000080,
69 CX25840_NONE1_CH3 = 0x800000c0,
70 CX25840_SVIDEO_ON = 0x80000100,
52}; 71};
53 72
54enum cx25840_audio_input { 73enum cx25840_audio_input {
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 7a785fa77212..831547d79683 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -97,7 +97,6 @@ int ir_dump_samples(u32 *samples, int count);
97int ir_decode_biphase(u32 *samples, int count, int low, int high); 97int ir_decode_biphase(u32 *samples, int count, int low, int high);
98int ir_decode_pulsedistance(u32 *samples, int count, int low, int high); 98int ir_decode_pulsedistance(u32 *samples, int count, int low, int high);
99 99
100u32 ir_rc5_decode(unsigned int code);
101void ir_rc5_timer_end(unsigned long data); 100void ir_rc5_timer_end(unsigned long data);
102void ir_rc5_timer_keyup(unsigned long data); 101void ir_rc5_timer_keyup(unsigned long data);
103 102
@@ -141,6 +140,8 @@ extern IR_KEYTAB_TYPE ir_codes_asus_pc39[IR_KEYTAB_SIZE];
141extern IR_KEYTAB_TYPE ir_codes_encore_enltv[IR_KEYTAB_SIZE]; 140extern IR_KEYTAB_TYPE ir_codes_encore_enltv[IR_KEYTAB_SIZE];
142extern IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE]; 141extern IR_KEYTAB_TYPE ir_codes_tt_1500[IR_KEYTAB_SIZE];
143extern IR_KEYTAB_TYPE ir_codes_fusionhdtv_mce[IR_KEYTAB_SIZE]; 142extern IR_KEYTAB_TYPE ir_codes_fusionhdtv_mce[IR_KEYTAB_SIZE];
143extern IR_KEYTAB_TYPE ir_codes_behold[IR_KEYTAB_SIZE];
144extern IR_KEYTAB_TYPE ir_codes_pinnacle_pctv_hd[IR_KEYTAB_SIZE];
144 145
145#endif 146#endif
146 147
diff --git a/include/media/m52790.h b/include/media/m52790.h
new file mode 100644
index 000000000000..7ddffae31a67
--- /dev/null
+++ b/include/media/m52790.h
@@ -0,0 +1,93 @@
1/*
2 m52790.h - definition for m52790 inputs and outputs
3
4 Copyright (C) 2007 Hans Verkuil (hverkuil@xs4all.nl)
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#ifndef _M52790_H_
22#define _M52790_H_
23
24/* Input routing switch 1 */
25
26#define M52790_SW1_IN_MASK 0x0003
27#define M52790_SW1_IN_TUNER 0x0000
28#define M52790_SW1_IN_V2 0x0001
29#define M52790_SW1_IN_V3 0x0002
30#define M52790_SW1_IN_V4 0x0003
31
32/* Selects component input instead of composite */
33#define M52790_SW1_YCMIX 0x0004
34
35
36/* Input routing switch 2 */
37
38#define M52790_SW2_IN_MASK 0x0300
39#define M52790_SW2_IN_TUNER 0x0000
40#define M52790_SW2_IN_V2 0x0100
41#define M52790_SW2_IN_V3 0x0200
42#define M52790_SW2_IN_V4 0x0300
43
44/* Selects component input instead of composite */
45#define M52790_SW2_YCMIX 0x0400
46
47
48/* Output routing switch 1 */
49
50/* Enable 6dB amplifier for composite out */
51#define M52790_SW1_V_AMP 0x0008
52
53/* Enable 6dB amplifier for component out */
54#define M52790_SW1_YC_AMP 0x0010
55
56/* Audio output mode */
57#define M52790_SW1_AUDIO_MASK 0x00c0
58#define M52790_SW1_AUDIO_MUTE 0x0000
59#define M52790_SW1_AUDIO_R 0x0040
60#define M52790_SW1_AUDIO_L 0x0080
61#define M52790_SW1_AUDIO_STEREO 0x00c0
62
63
64/* Output routing switch 2 */
65
66/* Enable 6dB amplifier for composite out */
67#define M52790_SW2_V_AMP 0x0800
68
69/* Enable 6dB amplifier for component out */
70#define M52790_SW2_YC_AMP 0x1000
71
72/* Audio output mode */
73#define M52790_SW2_AUDIO_MASK 0xc000
74#define M52790_SW2_AUDIO_MUTE 0x0000
75#define M52790_SW2_AUDIO_R 0x4000
76#define M52790_SW2_AUDIO_L 0x8000
77#define M52790_SW2_AUDIO_STEREO 0xc000
78
79
80/* Common values */
81#define M52790_IN_TUNER (M52790_SW1_IN_TUNER | M52790_SW2_IN_TUNER)
82#define M52790_IN_V2 (M52790_SW1_IN_V2 | M52790_SW2_IN_V2)
83#define M52790_IN_V3 (M52790_SW1_IN_V3 | M52790_SW2_IN_V3)
84#define M52790_IN_V4 (M52790_SW1_IN_V4 | M52790_SW2_IN_V4)
85
86#define M52790_OUT_STEREO (M52790_SW1_AUDIO_STEREO | \
87 M52790_SW2_AUDIO_STEREO)
88#define M52790_OUT_AMP_STEREO (M52790_SW1_AUDIO_STEREO | \
89 M52790_SW1_V_AMP | \
90 M52790_SW2_AUDIO_STEREO | \
91 M52790_SW2_V_AMP)
92
93#endif
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index e49f7e156061..89c442eb8849 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -1,7 +1,6 @@
1#ifndef __SAA7146_VV__ 1#ifndef __SAA7146_VV__
2#define __SAA7146_VV__ 2#define __SAA7146_VV__
3 3
4#include <linux/videodev.h>
5#include <media/v4l2-common.h> 4#include <media/v4l2-common.h>
6#include <media/saa7146.h> 5#include <media/saa7146.h>
7#include <media/videobuf-dma-sg.h> 6#include <media/videobuf-dma-sg.h>
diff --git a/include/media/tuner.h b/include/media/tuner.h
index c03dceb92605..1bf24a6ed8f1 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -24,8 +24,6 @@
24 24
25#include <linux/videodev2.h> 25#include <linux/videodev2.h>
26 26
27extern int tuner_debug;
28
29#define ADDR_UNSET (255) 27#define ADDR_UNSET (255)
30 28
31#define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ 29#define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */
@@ -117,12 +115,13 @@ extern int tuner_debug;
117#define TUNER_PHILIPS_TUV1236D 68 /* ATI HDTV Wonder */ 115#define TUNER_PHILIPS_TUV1236D 68 /* ATI HDTV Wonder */
118#define TUNER_TNF_5335MF 69 /* Sabrent Bt848 */ 116#define TUNER_TNF_5335MF 69 /* Sabrent Bt848 */
119#define TUNER_SAMSUNG_TCPN_2121P30A 70 /* Hauppauge PVR-500MCE NTSC */ 117#define TUNER_SAMSUNG_TCPN_2121P30A 70 /* Hauppauge PVR-500MCE NTSC */
120#define TUNER_XCEIVE_XC3028 71 118#define TUNER_XC2028 71
121 119
122#define TUNER_THOMSON_FE6600 72 /* DViCO FusionHDTV DVB-T Hybrid */ 120#define TUNER_THOMSON_FE6600 72 /* DViCO FusionHDTV DVB-T Hybrid */
123#define TUNER_SAMSUNG_TCPG_6121P30A 73 /* Hauppauge PVR-500 PAL */ 121#define TUNER_SAMSUNG_TCPG_6121P30A 73 /* Hauppauge PVR-500 PAL */
124#define TUNER_TDA9887 74 /* This tuner should be used only internally */ 122#define TUNER_TDA9887 74 /* This tuner should be used only internally */
125#define TUNER_TEA5761 75 /* Only FM Radio Tuner */ 123#define TUNER_TEA5761 75 /* Only FM Radio Tuner */
124#define TUNER_XC5000 76 /* Xceive Silicon Tuner */
126 125
127/* tv card specific */ 126/* tv card specific */
128#define TDA9887_PRESENT (1<<0) 127#define TDA9887_PRESENT (1<<0)
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 8ae42c41dd08..032bb75f69c2 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -68,6 +68,9 @@ enum {
68 /* module vp27smpx: just ident 2700 */ 68 /* module vp27smpx: just ident 2700 */
69 V4L2_IDENT_VP27SMPX = 2700, 69 V4L2_IDENT_VP27SMPX = 2700,
70 70
71 /* module cs5345: just ident 5345 */
72 V4L2_IDENT_CS5345 = 5345,
73
71 /* module wm8739: just ident 8739 */ 74 /* module wm8739: just ident 8739 */
72 V4L2_IDENT_WM8739 = 8739, 75 V4L2_IDENT_WM8739 = 8739,
73 76
@@ -83,6 +86,9 @@ enum {
83 /* module upd64083: just ident 64083 */ 86 /* module upd64083: just ident 64083 */
84 V4L2_IDENT_UPD64083 = 64083, 87 V4L2_IDENT_UPD64083 = 64083,
85 88
89 /* module m52790: just ident 52790 */
90 V4L2_IDENT_M52790 = 52790,
91
86 /* module msp34xx: reserved range 34000-34999 */ 92 /* module msp34xx: reserved range 34000-34999 */
87 V4L2_IDENT_MSP3400B = 34002, 93 V4L2_IDENT_MSP3400B = 34002,
88 V4L2_IDENT_MSP3410B = 34102, 94 V4L2_IDENT_MSP3410B = 34102,
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 181a40c46a52..475d0d8275e0 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -104,6 +104,17 @@ int v4l2_chip_match_host(u32 id_type, u32 chip_id);
104 104
105/* ------------------------------------------------------------------------- */ 105/* ------------------------------------------------------------------------- */
106 106
107/* Helper function for I2C legacy drivers */
108
109struct i2c_driver;
110struct i2c_adapter;
111struct i2c_client;
112
113int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver *driver,
114 const char *name, int (*probe)(struct i2c_client *));
115
116/* ------------------------------------------------------------------------- */
117
107/* Internal ioctls */ 118/* Internal ioctls */
108 119
109/* VIDIOC_INT_DECODE_VBI_LINE */ 120/* VIDIOC_INT_DECODE_VBI_LINE */
@@ -116,6 +127,11 @@ struct v4l2_decode_vbi_line {
116 u32 type; /* VBI service type (V4L2_SLICED_*). 0 if no service found */ 127 u32 type; /* VBI service type (V4L2_SLICED_*). 0 if no service found */
117}; 128};
118 129
130struct v4l2_priv_tun_config {
131 int tuner;
132 void *priv;
133};
134
119/* audio ioctls */ 135/* audio ioctls */
120 136
121/* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */ 137/* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */
@@ -131,7 +147,7 @@ struct v4l2_decode_vbi_line {
131#define TUNER_SET_STANDBY _IOW('d', 91, int) 147#define TUNER_SET_STANDBY _IOW('d', 91, int)
132 148
133/* Sets tda9887 specific stuff, like port1, port2 and qss */ 149/* Sets tda9887 specific stuff, like port1, port2 and qss */
134#define TDA9887_SET_CONFIG _IOW('d', 92, int) 150#define TUNER_SET_CONFIG _IOW('d', 92, struct v4l2_priv_tun_config)
135 151
136/* Switch the tuner to a specific tuner mode. Replacement of AUDC_SET_RADIO */ 152/* Switch the tuner to a specific tuner mode. Replacement of AUDC_SET_RADIO */
137#define VIDIOC_INT_S_TUNER_MODE _IOW('d', 93, enum v4l2_tuner_type) 153#define VIDIOC_INT_S_TUNER_MODE _IOW('d', 93, enum v4l2_tuner_type)
diff --git a/include/media/v4l2-i2c-drv-legacy.h b/include/media/v4l2-i2c-drv-legacy.h
new file mode 100644
index 000000000000..241854229d6f
--- /dev/null
+++ b/include/media/v4l2-i2c-drv-legacy.h
@@ -0,0 +1,140 @@
1/*
2 * v4l2-i2c-drv-legacy.h - contains I2C handling code that's identical
3 * for all V4L2 I2C drivers. Use this header if the
4 * I2C driver is used by both legacy drivers and
5 * drivers converted to the bus-based I2C API.
6 *
7 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
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., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24struct v4l2_i2c_driver_data {
25 const char * const name;
26 int driverid;
27 int (*command)(struct i2c_client *client, unsigned int cmd, void *arg);
28 int (*probe)(struct i2c_client *client);
29 int (*remove)(struct i2c_client *client);
30 int (*suspend)(struct i2c_client *client, pm_message_t state);
31 int (*resume)(struct i2c_client *client);
32 int (*legacy_probe)(struct i2c_adapter *adapter);
33 int legacy_class;
34};
35
36static struct v4l2_i2c_driver_data v4l2_i2c_data;
37static struct i2c_client_address_data addr_data;
38static struct i2c_driver v4l2_i2c_driver_legacy;
39static char v4l2_i2c_drv_name_legacy[32];
40
41static int v4l2_i2c_drv_attach_legacy(struct i2c_adapter *adapter, int address, int kind)
42{
43 return v4l2_i2c_attach(adapter, address, &v4l2_i2c_driver_legacy,
44 v4l2_i2c_drv_name_legacy, v4l2_i2c_data.probe);
45}
46
47static int v4l2_i2c_drv_probe_legacy(struct i2c_adapter *adapter)
48{
49 if (v4l2_i2c_data.legacy_probe) {
50 if (v4l2_i2c_data.legacy_probe(adapter))
51 return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy);
52 return 0;
53 }
54 if (adapter->class & v4l2_i2c_data.legacy_class)
55 return i2c_probe(adapter, &addr_data, v4l2_i2c_drv_attach_legacy);
56 return 0;
57}
58
59static int v4l2_i2c_drv_detach_legacy(struct i2c_client *client)
60{
61 int err;
62
63 if (v4l2_i2c_data.remove)
64 v4l2_i2c_data.remove(client);
65
66 err = i2c_detach_client(client);
67 if (err)
68 return err;
69 kfree(client);
70
71 return 0;
72}
73
74static int v4l2_i2c_drv_suspend_helper(struct i2c_client *client, pm_message_t state)
75{
76 return v4l2_i2c_data.suspend ? v4l2_i2c_data.suspend(client, state) : 0;
77}
78
79static int v4l2_i2c_drv_resume_helper(struct i2c_client *client)
80{
81 return v4l2_i2c_data.resume ? v4l2_i2c_data.resume(client) : 0;
82}
83
84/* ----------------------------------------------------------------------- */
85
86/* i2c implementation */
87static struct i2c_driver v4l2_i2c_driver_legacy = {
88 .driver = {
89 .owner = THIS_MODULE,
90 },
91 .attach_adapter = v4l2_i2c_drv_probe_legacy,
92 .detach_client = v4l2_i2c_drv_detach_legacy,
93 .suspend = v4l2_i2c_drv_suspend_helper,
94 .resume = v4l2_i2c_drv_resume_helper,
95};
96
97/* ----------------------------------------------------------------------- */
98
99/* i2c implementation */
100static struct i2c_driver v4l2_i2c_driver = {
101 .suspend = v4l2_i2c_drv_suspend_helper,
102 .resume = v4l2_i2c_drv_resume_helper,
103};
104
105static int __init v4l2_i2c_drv_init(void)
106{
107 int err;
108
109 strlcpy(v4l2_i2c_drv_name_legacy, v4l2_i2c_data.name, sizeof(v4l2_i2c_drv_name_legacy));
110 strlcat(v4l2_i2c_drv_name_legacy, "'", sizeof(v4l2_i2c_drv_name_legacy));
111
112 if (v4l2_i2c_data.legacy_class == 0)
113 v4l2_i2c_data.legacy_class = I2C_CLASS_TV_ANALOG;
114
115 v4l2_i2c_driver_legacy.driver.name = v4l2_i2c_drv_name_legacy;
116 v4l2_i2c_driver_legacy.id = v4l2_i2c_data.driverid;
117 v4l2_i2c_driver_legacy.command = v4l2_i2c_data.command;
118 err = i2c_add_driver(&v4l2_i2c_driver_legacy);
119
120 if (err)
121 return err;
122 v4l2_i2c_driver.driver.name = v4l2_i2c_data.name;
123 v4l2_i2c_driver.id = v4l2_i2c_data.driverid;
124 v4l2_i2c_driver.command = v4l2_i2c_data.command;
125 v4l2_i2c_driver.probe = v4l2_i2c_data.probe;
126 v4l2_i2c_driver.remove = v4l2_i2c_data.remove;
127 err = i2c_add_driver(&v4l2_i2c_driver);
128 if (err)
129 i2c_del_driver(&v4l2_i2c_driver_legacy);
130 return err;
131}
132
133static void __exit v4l2_i2c_drv_cleanup(void)
134{
135 i2c_del_driver(&v4l2_i2c_driver_legacy);
136 i2c_del_driver(&v4l2_i2c_driver);
137}
138
139module_init(v4l2_i2c_drv_init);
140module_exit(v4l2_i2c_drv_cleanup);
diff --git a/include/media/v4l2-i2c-drv.h b/include/media/v4l2-i2c-drv.h
new file mode 100644
index 000000000000..9e4bab276915
--- /dev/null
+++ b/include/media/v4l2-i2c-drv.h
@@ -0,0 +1,68 @@
1/*
2 * v4l2-i2c-drv.h - contains I2C handling code that's identical for
3 * all V4L2 I2C drivers. Use this header if the
4 * I2C driver is only used by drivers converted
5 * to the bus-based I2C API.
6 *
7 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
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., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#ifndef __V4L2_I2C_DRV_H__
25#define __V4L2_I2C_DRV_H__
26
27#include <media/v4l2-common.h>
28
29struct v4l2_i2c_driver_data {
30 const char * const name;
31 int driverid;
32 int (*command)(struct i2c_client *client, unsigned int cmd, void *arg);
33 int (*probe)(struct i2c_client *client);
34 int (*remove)(struct i2c_client *client);
35 int (*suspend)(struct i2c_client *client, pm_message_t state);
36 int (*resume)(struct i2c_client *client);
37 int (*legacy_probe)(struct i2c_adapter *adapter);
38 int legacy_class;
39};
40
41static struct v4l2_i2c_driver_data v4l2_i2c_data;
42static struct i2c_driver v4l2_i2c_driver;
43
44
45/* Bus-based I2C implementation for kernels >= 2.6.22 */
46
47static int __init v4l2_i2c_drv_init(void)
48{
49 v4l2_i2c_driver.driver.name = v4l2_i2c_data.name;
50 v4l2_i2c_driver.id = v4l2_i2c_data.driverid;
51 v4l2_i2c_driver.command = v4l2_i2c_data.command;
52 v4l2_i2c_driver.probe = v4l2_i2c_data.probe;
53 v4l2_i2c_driver.remove = v4l2_i2c_data.remove;
54 v4l2_i2c_driver.suspend = v4l2_i2c_data.suspend;
55 v4l2_i2c_driver.resume = v4l2_i2c_data.resume;
56 return i2c_add_driver(&v4l2_i2c_driver);
57}
58
59
60static void __exit v4l2_i2c_drv_cleanup(void)
61{
62 i2c_del_driver(&v4l2_i2c_driver);
63}
64
65module_init(v4l2_i2c_drv_init);
66module_exit(v4l2_i2c_drv_cleanup);
67
68#endif /* __V4L2_I2C_DRV_H__ */
diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h
index 066ebfc4f983..c8b80e0f0651 100644
--- a/include/media/v4l2-int-device.h
+++ b/include/media/v4l2-int-device.h
@@ -44,9 +44,8 @@ enum v4l2_int_type {
44struct v4l2_int_device; 44struct v4l2_int_device;
45 45
46struct v4l2_int_master { 46struct v4l2_int_master {
47 int (*attach)(struct v4l2_int_device *master, 47 int (*attach)(struct v4l2_int_device *slave);
48 struct v4l2_int_device *slave); 48 void (*detach)(struct v4l2_int_device *slave);
49 void (*detach)(struct v4l2_int_device *master);
50}; 49};
51 50
52typedef int (v4l2_int_ioctl_func)(struct v4l2_int_device *); 51typedef int (v4l2_int_ioctl_func)(struct v4l2_int_device *);
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index 4fd5d0eaa935..97f14d469595 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -56,13 +56,13 @@ struct videobuf_mapping {
56}; 56};
57 57
58enum videobuf_state { 58enum videobuf_state {
59 STATE_NEEDS_INIT = 0, 59 VIDEOBUF_NEEDS_INIT = 0,
60 STATE_PREPARED = 1, 60 VIDEOBUF_PREPARED = 1,
61 STATE_QUEUED = 2, 61 VIDEOBUF_QUEUED = 2,
62 STATE_ACTIVE = 3, 62 VIDEOBUF_ACTIVE = 3,
63 STATE_DONE = 4, 63 VIDEOBUF_DONE = 4,
64 STATE_ERROR = 5, 64 VIDEOBUF_ERROR = 5,
65 STATE_IDLE = 6, 65 VIDEOBUF_IDLE = 6,
66}; 66};
67 67
68struct videobuf_buffer { 68struct videobuf_buffer {
@@ -162,12 +162,14 @@ struct videobuf_queue {
162 struct videobuf_queue_ops *ops; 162 struct videobuf_queue_ops *ops;
163 struct videobuf_qtype_ops *int_ops; 163 struct videobuf_qtype_ops *int_ops;
164 164
165 unsigned int streaming:1;
166 unsigned int reading:1;
167 unsigned int is_mmapped:1;
168
165 /* capture via mmap() + ioctl(QBUF/DQBUF) */ 169 /* capture via mmap() + ioctl(QBUF/DQBUF) */
166 unsigned int streaming;
167 struct list_head stream; 170 struct list_head stream;
168 171
169 /* capture via read() */ 172 /* capture via read() */
170 unsigned int reading;
171 unsigned int read_off; 173 unsigned int read_off;
172 struct videobuf_buffer *read_buf; 174 struct videobuf_buffer *read_buf;
173 175