diff options
author | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2005-07-12 16:58:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-12 19:01:06 -0400 |
commit | f7ce3cc67052de63a29bad90110640b687d12058 (patch) | |
tree | f3978eb08434d0e87b2467949bd22513c3535416 /include/media | |
parent | ebe4c6fa535b0410e58e9c8352320896d07e2efb (diff) |
[PATCH] v4l: I2C Tuner
- Fixed a trouble on tuner-core that generates erros on computers with more
than one TV card.
- Rename tuner structures fields.
- Tail spaces removed.
- I2C cleanups and converged to a basic reference structure.
- Removed unused structures.
- Fix setting frequency on tda8290.
- Added code for TEA5767 autodetection.
- Standby mode support implemented. It is used to disable
a non used tuner. Currenlty implemented on tea5767.
- New macro: set_type disables other tuner when changing mode.
- Some cleanups.
- Use 50 kHz step when tunning radio for most tuners to improve precision.
Signed-off-by: Fabien Perrot <perrot1983@yahoo.fr>
Signed-off-by: Michael Krufky <mkrufky@m1k.net>
Signed-off-By: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/tuner.h | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/include/media/tuner.h b/include/media/tuner.h index 4794c5632360..d8c0a5563289 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h | |||
@@ -1,5 +1,5 @@ | |||
1 | 1 | ||
2 | /* $Id: tuner.h,v 1.33 2005/06/21 14:58:08 mkrufky Exp $ | 2 | /* $Id: tuner.h,v 1.42 2005/07/06 09:42:19 mchehab Exp $ |
3 | * | 3 | * |
4 | tuner.h - definition for different tuners | 4 | tuner.h - definition for different tuners |
5 | 5 | ||
@@ -26,8 +26,6 @@ | |||
26 | 26 | ||
27 | #include <linux/videodev2.h> | 27 | #include <linux/videodev2.h> |
28 | 28 | ||
29 | #include "id.h" | ||
30 | |||
31 | #define ADDR_UNSET (255) | 29 | #define ADDR_UNSET (255) |
32 | 30 | ||
33 | #define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ | 31 | #define TUNER_TEMIC_PAL 0 /* 4002 FH5 (3X 7756, 9483) */ |
@@ -111,8 +109,6 @@ | |||
111 | #define TUNER_TEA5767 62 /* Only FM Radio Tuner */ | 109 | #define TUNER_TEA5767 62 /* Only FM Radio Tuner */ |
112 | #define TUNER_PHILIPS_FMD1216ME_MK3 63 | 110 | #define TUNER_PHILIPS_FMD1216ME_MK3 63 |
113 | 111 | ||
114 | #define TEA5767_TUNER_NAME "Philips TEA5767HN FM Radio" | ||
115 | |||
116 | #define NOTUNER 0 | 112 | #define NOTUNER 0 |
117 | #define PAL 1 /* PAL_BG */ | 113 | #define PAL 1 /* PAL_BG */ |
118 | #define PAL_I 2 | 114 | #define PAL_I 2 |
@@ -135,19 +131,8 @@ | |||
135 | #define TCL 11 | 131 | #define TCL 11 |
136 | #define THOMSON 12 | 132 | #define THOMSON 12 |
137 | 133 | ||
138 | enum v4l_radio_tuner { | 134 | #define TUNER_SET_TYPE_ADDR _IOW('T',3,int) |
139 | TEA5767_LOW_LO_32768 = 0, | 135 | #define TDA9887_SET_CONFIG _IOW('t',5,int) |
140 | TEA5767_HIGH_LO_32768 = 1, | ||
141 | TEA5767_LOW_LO_13MHz = 2, | ||
142 | TEA5767_HIGH_LO_13MHz = 3, | ||
143 | }; | ||
144 | |||
145 | |||
146 | #define TUNER_SET_TYPE _IOW('t',1,int) /* set tuner type */ | ||
147 | #define TUNER_SET_TVFREQ _IOW('t',2,int) /* set tv freq */ | ||
148 | #define TUNER_SET_TYPE_ADDR _IOW('T',3,int) /* set tuner type and I2C addr */ | ||
149 | |||
150 | #define TDA9887_SET_CONFIG _IOW('t',5,int) | ||
151 | 136 | ||
152 | /* tv card specific */ | 137 | /* tv card specific */ |
153 | # define TDA9887_PRESENT (1<<0) | 138 | # define TDA9887_PRESENT (1<<0) |
@@ -169,25 +154,34 @@ enum v4l_radio_tuner { | |||
169 | #define I2C_ADDR_TDA8290 0x4b | 154 | #define I2C_ADDR_TDA8290 0x4b |
170 | #define I2C_ADDR_TDA8275 0x61 | 155 | #define I2C_ADDR_TDA8275 0x61 |
171 | 156 | ||
172 | struct tuner_addr { | 157 | enum tuner_mode { |
173 | enum v4l2_tuner_type v4l2_tuner; | 158 | T_UNINITIALIZED = 0, |
174 | unsigned int type; | 159 | T_RADIO = 1 << V4L2_TUNER_RADIO, |
160 | T_ANALOG_TV = 1 << V4L2_TUNER_ANALOG_TV, | ||
161 | T_DIGITAL_TV = 1 << V4L2_TUNER_DIGITAL_TV, | ||
162 | T_STANDBY = 1 << 31 | ||
163 | }; | ||
164 | |||
165 | struct tuner_setup { | ||
175 | unsigned short addr; | 166 | unsigned short addr; |
167 | unsigned int type; | ||
168 | unsigned int mode_mask; | ||
176 | }; | 169 | }; |
177 | 170 | ||
178 | struct tuner { | 171 | struct tuner { |
179 | /* device */ | 172 | /* device */ |
180 | struct i2c_client i2c; | 173 | struct i2c_client i2c; |
181 | 174 | ||
182 | /* state + config */ | ||
183 | unsigned int initialized; | ||
184 | unsigned int type; /* chip type */ | 175 | unsigned int type; /* chip type */ |
176 | |||
177 | unsigned int mode; | ||
178 | unsigned int mode_mask; /* Combination of allowable modes */ | ||
179 | |||
185 | unsigned int freq; /* keep track of the current settings */ | 180 | unsigned int freq; /* keep track of the current settings */ |
181 | unsigned int audmode; | ||
186 | v4l2_std_id std; | 182 | v4l2_std_id std; |
187 | int using_v4l2; | ||
188 | 183 | ||
189 | enum v4l2_tuner_type mode; | 184 | int using_v4l2; |
190 | unsigned int input; | ||
191 | 185 | ||
192 | /* used by MT2032 */ | 186 | /* used by MT2032 */ |
193 | unsigned int xogc; | 187 | unsigned int xogc; |
@@ -197,15 +191,11 @@ struct tuner { | |||
197 | unsigned char i2c_easy_mode[2]; | 191 | unsigned char i2c_easy_mode[2]; |
198 | unsigned char i2c_set_freq[8]; | 192 | unsigned char i2c_set_freq[8]; |
199 | 193 | ||
200 | /* used to keep track of audmode */ | ||
201 | unsigned int audmode; | ||
202 | |||
203 | /* function ptrs */ | 194 | /* function ptrs */ |
204 | void (*tv_freq)(struct i2c_client *c, unsigned int freq); | 195 | void (*tv_freq)(struct i2c_client *c, unsigned int freq); |
205 | void (*radio_freq)(struct i2c_client *c, unsigned int freq); | 196 | void (*radio_freq)(struct i2c_client *c, unsigned int freq); |
206 | int (*has_signal)(struct i2c_client *c); | 197 | int (*has_signal)(struct i2c_client *c); |
207 | int (*is_stereo)(struct i2c_client *c); | 198 | int (*is_stereo)(struct i2c_client *c); |
208 | int (*set_tuner)(struct i2c_client *c, struct v4l2_tuner *v); | ||
209 | }; | 199 | }; |
210 | 200 | ||
211 | extern unsigned int tuner_debug; | 201 | extern unsigned int tuner_debug; |
@@ -215,6 +205,7 @@ extern int microtune_init(struct i2c_client *c); | |||
215 | extern int tda8290_init(struct i2c_client *c); | 205 | extern int tda8290_init(struct i2c_client *c); |
216 | extern int tea5767_tuner_init(struct i2c_client *c); | 206 | extern int tea5767_tuner_init(struct i2c_client *c); |
217 | extern int default_tuner_init(struct i2c_client *c); | 207 | extern int default_tuner_init(struct i2c_client *c); |
208 | extern int tea5767_autodetection(struct i2c_client *c); | ||
218 | 209 | ||
219 | #define tuner_warn(fmt, arg...) \ | 210 | #define tuner_warn(fmt, arg...) \ |
220 | dev_printk(KERN_WARNING , &t->i2c.dev , fmt , ## arg) | 211 | dev_printk(KERN_WARNING , &t->i2c.dev , fmt , ## arg) |