diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2005-06-25 09:27:27 -0400 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-06-25 09:27:27 -0400 |
commit | 38b22b6e9f46ab8f73ef5734f0e0a000766a9258 (patch) | |
tree | 2ccc41ef55918d3af43e444bde7648562a031559 /drivers/media | |
parent | 3357d4c75f1fb67e7304998c4ad4e9a9fed66fa4 (diff) | |
parent | b3e112bcc19abd8e9657dca34a87316786e096f3 (diff) |
Automerge with /usr/src/ntfs-2.6.git.
Diffstat (limited to 'drivers/media')
98 files changed, 7324 insertions, 3062 deletions
diff --git a/drivers/media/common/ir-common.c b/drivers/media/common/ir-common.c index 84a49d2ec919..4adb2843f8be 100644 --- a/drivers/media/common/ir-common.c +++ b/drivers/media/common/ir-common.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ir-common.c,v 1.8 2005/02/22 12:28:40 kraxel Exp $ | 2 | * $Id: ir-common.c,v 1.10 2005/05/22 19:23:39 nsh Exp $ |
3 | * | 3 | * |
4 | * some common structs and functions to handle infrared remotes via | 4 | * some common structs and functions to handle infrared remotes via |
5 | * input layer ... | 5 | * input layer ... |
@@ -131,10 +131,10 @@ IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE] = { | |||
131 | [ 18 ] = KEY_KP0, | 131 | [ 18 ] = KEY_KP0, |
132 | 132 | ||
133 | [ 0 ] = KEY_POWER, | 133 | [ 0 ] = KEY_POWER, |
134 | [ 27 ] = KEY_LANGUAGE, //MTS button | 134 | // [ 27 ] = MTS button |
135 | [ 2 ] = KEY_TUNER, // TV/FM | 135 | [ 2 ] = KEY_TUNER, // TV/FM |
136 | [ 30 ] = KEY_VIDEO, | 136 | [ 30 ] = KEY_VIDEO, |
137 | [ 22 ] = KEY_INFO, //display button | 137 | // [ 22 ] = display button |
138 | [ 4 ] = KEY_VOLUMEUP, | 138 | [ 4 ] = KEY_VOLUMEUP, |
139 | [ 8 ] = KEY_VOLUMEDOWN, | 139 | [ 8 ] = KEY_VOLUMEDOWN, |
140 | [ 12 ] = KEY_CHANNELUP, | 140 | [ 12 ] = KEY_CHANNELUP, |
@@ -142,7 +142,7 @@ IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE] = { | |||
142 | [ 3 ] = KEY_ZOOM, // fullscreen | 142 | [ 3 ] = KEY_ZOOM, // fullscreen |
143 | [ 31 ] = KEY_SUBTITLE, // closed caption/teletext | 143 | [ 31 ] = KEY_SUBTITLE, // closed caption/teletext |
144 | [ 32 ] = KEY_SLEEP, | 144 | [ 32 ] = KEY_SLEEP, |
145 | [ 41 ] = KEY_SEARCH, //boss key | 145 | // [ 41 ] = boss key |
146 | [ 20 ] = KEY_MUTE, | 146 | [ 20 ] = KEY_MUTE, |
147 | [ 43 ] = KEY_RED, | 147 | [ 43 ] = KEY_RED, |
148 | [ 44 ] = KEY_GREEN, | 148 | [ 44 ] = KEY_GREEN, |
@@ -150,17 +150,17 @@ IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE] = { | |||
150 | [ 46 ] = KEY_BLUE, | 150 | [ 46 ] = KEY_BLUE, |
151 | [ 24 ] = KEY_KPPLUS, //fine tune + | 151 | [ 24 ] = KEY_KPPLUS, //fine tune + |
152 | [ 25 ] = KEY_KPMINUS, //fine tune - | 152 | [ 25 ] = KEY_KPMINUS, //fine tune - |
153 | [ 42 ] = KEY_ANGLE, //picture in picture | 153 | // [ 42 ] = picture in picture |
154 | [ 33 ] = KEY_KPDOT, | 154 | [ 33 ] = KEY_KPDOT, |
155 | [ 19 ] = KEY_KPENTER, | 155 | [ 19 ] = KEY_KPENTER, |
156 | [ 17 ] = KEY_AGAIN, //recall | 156 | // [ 17 ] = recall |
157 | [ 34 ] = KEY_BACK, | 157 | [ 34 ] = KEY_BACK, |
158 | [ 35 ] = KEY_PLAYPAUSE, | 158 | [ 35 ] = KEY_PLAYPAUSE, |
159 | [ 36 ] = KEY_NEXT, | 159 | [ 36 ] = KEY_NEXT, |
160 | [ 37 ] = KEY_T, //time shifting | 160 | // [ 37 ] = time shifting |
161 | [ 38 ] = KEY_STOP, | 161 | [ 38 ] = KEY_STOP, |
162 | [ 39 ] = KEY_RECORD, | 162 | [ 39 ] = KEY_RECORD |
163 | [ 40 ] = KEY_SHUFFLE //snapshot | 163 | // [ 40 ] = snapshot |
164 | }; | 164 | }; |
165 | EXPORT_SYMBOL_GPL(ir_codes_winfast); | 165 | EXPORT_SYMBOL_GPL(ir_codes_winfast); |
166 | 166 | ||
@@ -184,18 +184,30 @@ IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE] = { | |||
184 | [ 0x07 ] = KEY_KP7, // 7 | 184 | [ 0x07 ] = KEY_KP7, // 7 |
185 | [ 0x08 ] = KEY_KP8, // 8 | 185 | [ 0x08 ] = KEY_KP8, // 8 |
186 | [ 0x09 ] = KEY_KP9, // 9 | 186 | [ 0x09 ] = KEY_KP9, // 9 |
187 | [ 0x0a ] = KEY_TEXT, // keypad asterisk as well | ||
187 | [ 0x0b ] = KEY_RED, // red button | 188 | [ 0x0b ] = KEY_RED, // red button |
188 | [ 0x0c ] = KEY_OPTION, // black key without text | 189 | [ 0x0c ] = KEY_RADIO, // radio |
189 | [ 0x0d ] = KEY_MENU, // menu | 190 | [ 0x0d ] = KEY_MENU, // menu |
191 | [ 0x0e ] = KEY_SUBTITLE, // also the # key | ||
190 | [ 0x0f ] = KEY_MUTE, // mute | 192 | [ 0x0f ] = KEY_MUTE, // mute |
191 | [ 0x10 ] = KEY_VOLUMEUP, // volume + | 193 | [ 0x10 ] = KEY_VOLUMEUP, // volume + |
192 | [ 0x11 ] = KEY_VOLUMEDOWN, // volume - | 194 | [ 0x11 ] = KEY_VOLUMEDOWN, // volume - |
193 | [ 0x1e ] = KEY_NEXT, // skip >| | 195 | [ 0x12 ] = KEY_PREVIOUS, // previous channel |
196 | [ 0x14 ] = KEY_UP, // up | ||
197 | [ 0x15 ] = KEY_DOWN, // down | ||
198 | [ 0x16 ] = KEY_LEFT, // left | ||
199 | [ 0x17 ] = KEY_RIGHT, // right | ||
200 | [ 0x18 ] = KEY_VIDEO, // Videos | ||
201 | [ 0x19 ] = KEY_AUDIO, // Music | ||
202 | [ 0x1a ] = KEY_MHP, // Pictures - presume this means "Multimedia Home Platform"- no "PICTURES" key in input.h | ||
203 | [ 0x1b ] = KEY_EPG, // Guide | ||
204 | [ 0x1c ] = KEY_TV, // TV | ||
205 | [ 0x1e ] = KEY_NEXTSONG, // skip >| | ||
194 | [ 0x1f ] = KEY_EXIT, // back/exit | 206 | [ 0x1f ] = KEY_EXIT, // back/exit |
195 | [ 0x20 ] = KEY_CHANNELUP, // channel / program + | 207 | [ 0x20 ] = KEY_CHANNELUP, // channel / program + |
196 | [ 0x21 ] = KEY_CHANNELDOWN, // channel / program - | 208 | [ 0x21 ] = KEY_CHANNELDOWN, // channel / program - |
197 | [ 0x22 ] = KEY_CHANNEL, // source (old black remote) | 209 | [ 0x22 ] = KEY_CHANNEL, // source (old black remote) |
198 | [ 0x24 ] = KEY_PREVIOUS, // replay |< | 210 | [ 0x24 ] = KEY_PREVIOUSSONG, // replay |< |
199 | [ 0x25 ] = KEY_ENTER, // OK | 211 | [ 0x25 ] = KEY_ENTER, // OK |
200 | [ 0x26 ] = KEY_SLEEP, // minimize (old black remote) | 212 | [ 0x26 ] = KEY_SLEEP, // minimize (old black remote) |
201 | [ 0x29 ] = KEY_BLUE, // blue key | 213 | [ 0x29 ] = KEY_BLUE, // blue key |
@@ -213,6 +225,39 @@ IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE] = { | |||
213 | }; | 225 | }; |
214 | EXPORT_SYMBOL(ir_codes_hauppauge_new); | 226 | EXPORT_SYMBOL(ir_codes_hauppauge_new); |
215 | 227 | ||
228 | IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE] = { | ||
229 | [ 2 ] = KEY_KP0, | ||
230 | [ 1 ] = KEY_KP1, | ||
231 | [ 11 ] = KEY_KP2, | ||
232 | [ 27 ] = KEY_KP3, | ||
233 | [ 5 ] = KEY_KP4, | ||
234 | [ 9 ] = KEY_KP5, | ||
235 | [ 21 ] = KEY_KP6, | ||
236 | [ 6 ] = KEY_KP7, | ||
237 | [ 10 ] = KEY_KP8, | ||
238 | [ 18 ] = KEY_KP9, | ||
239 | |||
240 | [ 3 ] = KEY_TUNER, // TV/FM | ||
241 | [ 7 ] = KEY_SEARCH, // scan | ||
242 | [ 28 ] = KEY_ZOOM, // full screen | ||
243 | [ 30 ] = KEY_POWER, | ||
244 | [ 23 ] = KEY_VOLUMEDOWN, | ||
245 | [ 31 ] = KEY_VOLUMEUP, | ||
246 | [ 20 ] = KEY_CHANNELDOWN, | ||
247 | [ 22 ] = KEY_CHANNELUP, | ||
248 | [ 24 ] = KEY_MUTE, | ||
249 | |||
250 | [ 0 ] = KEY_LIST, // source | ||
251 | [ 19 ] = KEY_INFO, // loop | ||
252 | [ 16 ] = KEY_LAST, // +100 | ||
253 | [ 13 ] = KEY_CLEAR, // reset | ||
254 | [ 12 ] = BTN_RIGHT, // fun++ | ||
255 | [ 4 ] = BTN_LEFT, // fun-- | ||
256 | [ 14 ] = KEY_GOTO, // function | ||
257 | [ 15 ] = KEY_STOP, // freeze | ||
258 | }; | ||
259 | EXPORT_SYMBOL(ir_codes_pixelview); | ||
260 | |||
216 | /* -------------------------------------------------------------------------- */ | 261 | /* -------------------------------------------------------------------------- */ |
217 | 262 | ||
218 | static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir) | 263 | static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir) |
@@ -379,3 +424,4 @@ EXPORT_SYMBOL_GPL(ir_decode_biphase); | |||
379 | * c-basic-offset: 8 | 424 | * c-basic-offset: 8 |
380 | * End: | 425 | * End: |
381 | */ | 426 | */ |
427 | |||
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index cb826c9adfe7..c04fd11526e0 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c | |||
@@ -403,7 +403,7 @@ static struct file_operations video_fops = | |||
403 | .llseek = no_llseek, | 403 | .llseek = no_llseek, |
404 | }; | 404 | }; |
405 | 405 | ||
406 | void vv_callback(struct saa7146_dev *dev, unsigned long status) | 406 | static void vv_callback(struct saa7146_dev *dev, unsigned long status) |
407 | { | 407 | { |
408 | u32 isr = status; | 408 | u32 isr = status; |
409 | 409 | ||
diff --git a/drivers/media/dvb/Kconfig b/drivers/media/dvb/Kconfig index 4983e1b1bb1d..01387f883cdf 100644 --- a/drivers/media/dvb/Kconfig +++ b/drivers/media/dvb/Kconfig | |||
@@ -27,9 +27,9 @@ source "drivers/media/dvb/ttpci/Kconfig" | |||
27 | 27 | ||
28 | comment "Supported USB Adapters" | 28 | comment "Supported USB Adapters" |
29 | depends on DVB_CORE && USB | 29 | depends on DVB_CORE && USB |
30 | source "drivers/media/dvb/dvb-usb/Kconfig" | ||
30 | source "drivers/media/dvb/ttusb-budget/Kconfig" | 31 | source "drivers/media/dvb/ttusb-budget/Kconfig" |
31 | source "drivers/media/dvb/ttusb-dec/Kconfig" | 32 | source "drivers/media/dvb/ttusb-dec/Kconfig" |
32 | source "drivers/media/dvb/dibusb/Kconfig" | ||
33 | source "drivers/media/dvb/cinergyT2/Kconfig" | 33 | source "drivers/media/dvb/cinergyT2/Kconfig" |
34 | 34 | ||
35 | comment "Supported FlexCopII (B2C2) Adapters" | 35 | comment "Supported FlexCopII (B2C2) Adapters" |
diff --git a/drivers/media/dvb/Makefile b/drivers/media/dvb/Makefile index 520fc3902819..3c6ff1619103 100644 --- a/drivers/media/dvb/Makefile +++ b/drivers/media/dvb/Makefile | |||
@@ -2,4 +2,4 @@ | |||
2 | # Makefile for the kernel multimedia device drivers. | 2 | # Makefile for the kernel multimedia device drivers. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := dvb-core/ frontends/ ttpci/ ttusb-dec/ ttusb-budget/ b2c2/ bt8xx/ dibusb/ cinergyT2/ | 5 | obj-y := dvb-core/ frontends/ ttpci/ ttusb-dec/ ttusb-budget/ b2c2/ bt8xx/ cinergyT2/ dvb-usb/ |
diff --git a/drivers/media/dvb/b2c2/Kconfig b/drivers/media/dvb/b2c2/Kconfig index 99bd675df955..fafd0ab3a28f 100644 --- a/drivers/media/dvb/b2c2/Kconfig +++ b/drivers/media/dvb/b2c2/Kconfig | |||
@@ -6,6 +6,7 @@ config DVB_B2C2_FLEXCOP | |||
6 | select DVB_MT312 | 6 | select DVB_MT312 |
7 | select DVB_NXT2002 | 7 | select DVB_NXT2002 |
8 | select DVB_STV0297 | 8 | select DVB_STV0297 |
9 | select DVB_BCM3510 | ||
9 | help | 10 | help |
10 | Support for the digital TV receiver chip made by B2C2 Inc. included in | 11 | Support for the digital TV receiver chip made by B2C2 Inc. included in |
11 | Technisats PCI cards and USB boxes. | 12 | Technisats PCI cards and USB boxes. |
diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c index 71be400e9aeb..0410cc96a48e 100644 --- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c +++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include "stv0299.h" | 10 | #include "stv0299.h" |
11 | #include "mt352.h" | 11 | #include "mt352.h" |
12 | #include "nxt2002.h" | 12 | #include "nxt2002.h" |
13 | #include "bcm3510.h" | ||
13 | #include "stv0297.h" | 14 | #include "stv0297.h" |
14 | #include "mt312.h" | 15 | #include "mt312.h" |
15 | 16 | ||
@@ -285,21 +286,25 @@ static int samsung_tdtc9251dh0_pll_set(struct dvb_frontend* fe, struct dvb_front | |||
285 | } | 286 | } |
286 | 287 | ||
287 | static struct mt352_config samsung_tdtc9251dh0_config = { | 288 | static struct mt352_config samsung_tdtc9251dh0_config = { |
288 | |||
289 | .demod_address = 0x0f, | 289 | .demod_address = 0x0f, |
290 | .demod_init = samsung_tdtc9251dh0_demod_init, | 290 | .demod_init = samsung_tdtc9251dh0_demod_init, |
291 | .pll_set = samsung_tdtc9251dh0_pll_set, | 291 | .pll_set = samsung_tdtc9251dh0_pll_set, |
292 | }; | 292 | }; |
293 | 293 | ||
294 | static int nxt2002_request_firmware(struct dvb_frontend* fe, const struct firmware **fw, char* name) | 294 | static int flexcop_fe_request_firmware(struct dvb_frontend* fe, const struct firmware **fw, char* name) |
295 | { | 295 | { |
296 | struct flexcop_device *fc = fe->dvb->priv; | 296 | struct flexcop_device *fc = fe->dvb->priv; |
297 | return request_firmware(fw, name, fc->dev); | 297 | return request_firmware(fw, name, fc->dev); |
298 | } | 298 | } |
299 | 299 | ||
300 | static struct nxt2002_config samsung_tbmv_config = { | 300 | static struct nxt2002_config samsung_tbmv_config = { |
301 | .demod_address = 0x0a, | 301 | .demod_address = 0x0a, |
302 | .request_firmware = nxt2002_request_firmware, | 302 | .request_firmware = flexcop_fe_request_firmware, |
303 | }; | ||
304 | |||
305 | static struct bcm3510_config air2pc_atsc_first_gen_config = { | ||
306 | .demod_address = 0x0f, | ||
307 | .request_firmware = flexcop_fe_request_firmware, | ||
303 | }; | 308 | }; |
304 | 309 | ||
305 | static int skystar23_samsung_tbdu18132_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 310 | static int skystar23_samsung_tbdu18132_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
@@ -354,11 +359,16 @@ int flexcop_frontend_init(struct flexcop_device *fc) | |||
354 | fc->dev_type = FC_AIR_DVB; | 359 | fc->dev_type = FC_AIR_DVB; |
355 | info("found the mt352 at i2c address: 0x%02x",samsung_tdtc9251dh0_config.demod_address); | 360 | info("found the mt352 at i2c address: 0x%02x",samsung_tdtc9251dh0_config.demod_address); |
356 | } else | 361 | } else |
357 | /* try the air atsc (nxt2002) */ | 362 | /* try the air atsc 2nd generation (nxt2002) */ |
358 | if ((fc->fe = nxt2002_attach(&samsung_tbmv_config, &fc->i2c_adap)) != NULL) { | 363 | if ((fc->fe = nxt2002_attach(&samsung_tbmv_config, &fc->i2c_adap)) != NULL) { |
359 | fc->dev_type = FC_AIR_ATSC; | 364 | fc->dev_type = FC_AIR_ATSC2; |
360 | info("found the nxt2002 at i2c address: 0x%02x",samsung_tbmv_config.demod_address); | 365 | info("found the nxt2002 at i2c address: 0x%02x",samsung_tbmv_config.demod_address); |
361 | } else | 366 | } else |
367 | /* try the air atsc 1nd generation (bcm3510)/panasonic ct10s */ | ||
368 | if ((fc->fe = bcm3510_attach(&air2pc_atsc_first_gen_config, &fc->i2c_adap)) != NULL) { | ||
369 | fc->dev_type = FC_AIR_ATSC1; | ||
370 | info("found the bcm3510 at i2c address: 0x%02x",air2pc_atsc_first_gen_config.demod_address); | ||
371 | } else | ||
362 | /* try the cable dvb (stv0297) */ | 372 | /* try the cable dvb (stv0297) */ |
363 | if ((fc->fe = stv0297_attach(&alps_tdee4_stv0297_config, &fc->i2c_adap, 0xf8)) != NULL) { | 373 | if ((fc->fe = stv0297_attach(&alps_tdee4_stv0297_config, &fc->i2c_adap, 0xf8)) != NULL) { |
364 | fc->dev_type = FC_CABLE; | 374 | fc->dev_type = FC_CABLE; |
diff --git a/drivers/media/dvb/b2c2/flexcop-misc.c b/drivers/media/dvb/b2c2/flexcop-misc.c index 19e06da46774..23082545651f 100644 --- a/drivers/media/dvb/b2c2/flexcop-misc.c +++ b/drivers/media/dvb/b2c2/flexcop-misc.c | |||
@@ -45,11 +45,12 @@ const char *flexcop_revision_names[] = { | |||
45 | 45 | ||
46 | const char *flexcop_device_names[] = { | 46 | const char *flexcop_device_names[] = { |
47 | "Unkown device", | 47 | "Unkown device", |
48 | "AirStar 2 DVB-T", | 48 | "Air2PC/AirStar 2 DVB-T", |
49 | "AirStar 2 ATSC", | 49 | "Air2PC/AirStar 2 ATSC 1st generation", |
50 | "SkyStar 2 DVB-S", | 50 | "Air2PC/AirStar 2 ATSC 2nd generation", |
51 | "SkyStar 2 DVB-S (old version)", | 51 | "Sky2PC/SkyStar 2 DVB-S", |
52 | "CableStar 2 DVB-C", | 52 | "Sky2PC/SkyStar 2 DVB-S (old version)", |
53 | "Cable2PC/CableStar 2 DVB-C", | ||
53 | }; | 54 | }; |
54 | 55 | ||
55 | const char *flexcop_bus_names[] = { | 56 | const char *flexcop_bus_names[] = { |
diff --git a/drivers/media/dvb/b2c2/flexcop-reg.h b/drivers/media/dvb/b2c2/flexcop-reg.h index 5e131be55cb3..75b50f21afe6 100644 --- a/drivers/media/dvb/b2c2/flexcop-reg.h +++ b/drivers/media/dvb/b2c2/flexcop-reg.h | |||
@@ -21,7 +21,8 @@ extern const char *flexcop_revision_names[]; | |||
21 | typedef enum { | 21 | typedef enum { |
22 | FC_UNK = 0, | 22 | FC_UNK = 0, |
23 | FC_AIR_DVB, | 23 | FC_AIR_DVB, |
24 | FC_AIR_ATSC, | 24 | FC_AIR_ATSC1, |
25 | FC_AIR_ATSC2, | ||
25 | FC_SKY, | 26 | FC_SKY, |
26 | FC_SKY_OLD, | 27 | FC_SKY_OLD, |
27 | FC_CABLE, | 28 | FC_CABLE, |
diff --git a/drivers/media/dvb/dibusb/Kconfig b/drivers/media/dvb/dibusb/Kconfig deleted file mode 100644 index 74dfc73ae5b0..000000000000 --- a/drivers/media/dvb/dibusb/Kconfig +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | config DVB_DIBUSB | ||
2 | tristate "DiBcom USB DVB-T devices (see help for a complete device list)" | ||
3 | depends on DVB_CORE && USB | ||
4 | select FW_LOADER | ||
5 | select DVB_DIB3000MB | ||
6 | select DVB_DIB3000MC | ||
7 | select DVB_MT352 | ||
8 | help | ||
9 | Support for USB 1.1 and 2.0 DVB-T devices based on reference designs made by | ||
10 | DiBcom (http://www.dibcom.fr) and C&E. | ||
11 | |||
12 | Devices supported by this driver: | ||
13 | |||
14 | TwinhanDTV USB-Ter (VP7041) | ||
15 | TwinhanDTV Magic Box (VP7041e) | ||
16 | KWorld/JetWay/ADSTech V-Stream XPERT DTV - DVB-T USB1.1 and USB2.0 | ||
17 | Hama DVB-T USB-Box | ||
18 | DiBcom reference devices (non-public) | ||
19 | Ultima Electronic/Artec T1 USB TVBOX | ||
20 | Compro Videomate DVB-U2000 - DVB-T USB | ||
21 | Grandtec DVB-T USB | ||
22 | Avermedia AverTV DVBT USB | ||
23 | Artec T1 USB1.1 and USB2.0 boxes | ||
24 | Yakumo/Typhoon DVB-T USB2.0 | ||
25 | Hanftek UMT-010 USB2.0 | ||
26 | Hauppauge WinTV NOVA-T USB2 | ||
27 | |||
28 | The VP7041 seems to be identical to "CTS Portable" (Chinese | ||
29 | Television System). | ||
30 | |||
31 | These devices can be understood as budget ones, they "only" deliver | ||
32 | (a part of) the MPEG2 transport stream. | ||
33 | |||
34 | A firmware is needed to get the device working. See Documentation/dvb/README.dibusb | ||
35 | details. | ||
36 | |||
37 | Say Y if you own such a device and want to use it. You should build it as | ||
38 | a module. | ||
39 | |||
40 | config DVB_DIBUSB_MISDESIGNED_DEVICES | ||
41 | bool "Enable support for some misdesigned (see help) devices, which identify with wrong IDs" | ||
42 | depends on DVB_DIBUSB | ||
43 | help | ||
44 | Somehow Artec/Ultima Electronic forgot to program the eeprom of some of their | ||
45 | USB1.1/USB2.0 devices. | ||
46 | So comes that they identify with the default Vendor and Product ID of the Cypress | ||
47 | CY7C64613 (AN2235) or Cypress FX2. | ||
48 | |||
49 | Affected device IDs: | ||
50 | 0x0574:0x2235 (Artec T1 USB1.1, cold) | ||
51 | 0x04b4:0x8613 (Artec T1 USB2.0, cold) | ||
52 | 0x0574:0x1002 (Artec T1 USB2.0, warm) | ||
53 | 0x0574:0x2131 (aged DiBcom USB1.1 test device) | ||
54 | |||
55 | Say Y if your device has one of the mentioned IDs. | ||
56 | |||
57 | config DVB_DIBCOM_DEBUG | ||
58 | bool "Enable extended debug support for DiBcom USB device" | ||
59 | depends on DVB_DIBUSB | ||
60 | help | ||
61 | Say Y if you want to enable debuging. See modinfo dvb-dibusb for | ||
62 | debug levels. | ||
diff --git a/drivers/media/dvb/dibusb/Makefile b/drivers/media/dvb/dibusb/Makefile deleted file mode 100644 index e941c508624e..000000000000 --- a/drivers/media/dvb/dibusb/Makefile +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | dvb-dibusb-objs = dvb-dibusb-core.o \ | ||
2 | dvb-dibusb-dvb.o \ | ||
3 | dvb-dibusb-fe-i2c.o \ | ||
4 | dvb-dibusb-firmware.o \ | ||
5 | dvb-dibusb-remote.o \ | ||
6 | dvb-dibusb-usb.o \ | ||
7 | dvb-fe-dtt200u.o | ||
8 | |||
9 | obj-$(CONFIG_DVB_DIBUSB) += dvb-dibusb.o | ||
10 | |||
11 | EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ | ||
diff --git a/drivers/media/dvb/dibusb/dvb-dibusb-core.c b/drivers/media/dvb/dibusb/dvb-dibusb-core.c deleted file mode 100644 index 26235f9247e4..000000000000 --- a/drivers/media/dvb/dibusb/dvb-dibusb-core.c +++ /dev/null | |||
@@ -1,558 +0,0 @@ | |||
1 | /* | ||
2 | * Driver for mobile USB Budget DVB-T devices based on reference | ||
3 | * design made by DiBcom (http://www.dibcom.fr/) | ||
4 | * | ||
5 | * dvb-dibusb-core.c | ||
6 | * | ||
7 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
8 | * | ||
9 | * based on GPL code from DiBcom, which has | ||
10 | * Copyright (C) 2004 Amaury Demol for DiBcom (ademol@dibcom.fr) | ||
11 | * | ||
12 | * Remote control code added by David Matthews (dm@prolingua.co.uk) | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License as | ||
16 | * published by the Free Software Foundation, version 2. | ||
17 | * | ||
18 | * Acknowledgements | ||
19 | * | ||
20 | * Amaury Demol (ademol@dibcom.fr) from DiBcom for providing specs and driver | ||
21 | * sources, on which this driver (and the dib3000mb/mc/p frontends) are based. | ||
22 | * | ||
23 | * see Documentation/dvb/README.dibusb for more information | ||
24 | */ | ||
25 | #include "dvb-dibusb.h" | ||
26 | |||
27 | #include <linux/moduleparam.h> | ||
28 | |||
29 | /* debug */ | ||
30 | int dvb_dibusb_debug; | ||
31 | module_param_named(debug, dvb_dibusb_debug, int, 0644); | ||
32 | |||
33 | #ifdef CONFIG_DVB_DIBCOM_DEBUG | ||
34 | #define DBSTATUS "" | ||
35 | #else | ||
36 | #define DBSTATUS " (debugging is not enabled)" | ||
37 | #endif | ||
38 | MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=alotmore,8=ts,16=err,32=rc (|-able))." DBSTATUS); | ||
39 | #undef DBSTATUS | ||
40 | |||
41 | static int pid_parse; | ||
42 | module_param(pid_parse, int, 0644); | ||
43 | MODULE_PARM_DESC(pid_parse, "enable pid parsing (filtering) when running at USB2.0"); | ||
44 | |||
45 | static int rc_query_interval = 100; | ||
46 | module_param(rc_query_interval, int, 0644); | ||
47 | MODULE_PARM_DESC(rc_query_interval, "interval in msecs for remote control query (default: 100; min: 40)"); | ||
48 | |||
49 | static int rc_key_repeat_count = 2; | ||
50 | module_param(rc_key_repeat_count, int, 0644); | ||
51 | MODULE_PARM_DESC(rc_key_repeat_count, "how many key repeats will be dropped before passing the key event again (default: 2)"); | ||
52 | |||
53 | /* Vendor IDs */ | ||
54 | #define USB_VID_ADSTECH 0x06e1 | ||
55 | #define USB_VID_ANCHOR 0x0547 | ||
56 | #define USB_VID_AVERMEDIA 0x14aa | ||
57 | #define USB_VID_COMPRO 0x185b | ||
58 | #define USB_VID_COMPRO_UNK 0x145f | ||
59 | #define USB_VID_CYPRESS 0x04b4 | ||
60 | #define USB_VID_DIBCOM 0x10b8 | ||
61 | #define USB_VID_EMPIA 0xeb1a | ||
62 | #define USB_VID_GRANDTEC 0x5032 | ||
63 | #define USB_VID_HANFTEK 0x15f4 | ||
64 | #define USB_VID_HAUPPAUGE 0x2040 | ||
65 | #define USB_VID_HYPER_PALTEK 0x1025 | ||
66 | #define USB_VID_IMC_NETWORKS 0x13d3 | ||
67 | #define USB_VID_TWINHAN 0x1822 | ||
68 | #define USB_VID_ULTIMA_ELECTRONIC 0x05d8 | ||
69 | |||
70 | /* Product IDs */ | ||
71 | #define USB_PID_ADSTECH_USB2_COLD 0xa333 | ||
72 | #define USB_PID_ADSTECH_USB2_WARM 0xa334 | ||
73 | #define USB_PID_AVERMEDIA_DVBT_USB_COLD 0x0001 | ||
74 | #define USB_PID_AVERMEDIA_DVBT_USB_WARM 0x0002 | ||
75 | #define USB_PID_COMPRO_DVBU2000_COLD 0xd000 | ||
76 | #define USB_PID_COMPRO_DVBU2000_WARM 0xd001 | ||
77 | #define USB_PID_COMPRO_DVBU2000_UNK_COLD 0x010c | ||
78 | #define USB_PID_COMPRO_DVBU2000_UNK_WARM 0x010d | ||
79 | #define USB_PID_DIBCOM_MOD3000_COLD 0x0bb8 | ||
80 | #define USB_PID_DIBCOM_MOD3000_WARM 0x0bb9 | ||
81 | #define USB_PID_DIBCOM_MOD3001_COLD 0x0bc6 | ||
82 | #define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7 | ||
83 | #define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131 | ||
84 | #define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0 | ||
85 | #define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1 | ||
86 | #define USB_PID_KWORLD_VSTREAM_COLD 0x17de | ||
87 | #define USB_PID_KWORLD_VSTREAM_WARM 0x17df | ||
88 | #define USB_PID_TWINHAN_VP7041_COLD 0x3201 | ||
89 | #define USB_PID_TWINHAN_VP7041_WARM 0x3202 | ||
90 | #define USB_PID_ULTIMA_TVBOX_COLD 0x8105 | ||
91 | #define USB_PID_ULTIMA_TVBOX_WARM 0x8106 | ||
92 | #define USB_PID_ULTIMA_TVBOX_AN2235_COLD 0x8107 | ||
93 | #define USB_PID_ULTIMA_TVBOX_AN2235_WARM 0x8108 | ||
94 | #define USB_PID_ULTIMA_TVBOX_ANCHOR_COLD 0x2235 | ||
95 | #define USB_PID_ULTIMA_TVBOX_USB2_COLD 0x8109 | ||
96 | #define USB_PID_ULTIMA_TVBOX_USB2_FX_COLD 0x8613 | ||
97 | #define USB_PID_ULTIMA_TVBOX_USB2_FX_WARM 0x1002 | ||
98 | #define USB_PID_UNK_HYPER_PALTEK_COLD 0x005e | ||
99 | #define USB_PID_UNK_HYPER_PALTEK_WARM 0x005f | ||
100 | #define USB_PID_HANFTEK_UMT_010_COLD 0x0001 | ||
101 | #define USB_PID_HANFTEK_UMT_010_WARM 0x0015 | ||
102 | #define USB_PID_YAKUMO_DTT200U_COLD 0x0201 | ||
103 | #define USB_PID_YAKUMO_DTT200U_WARM 0x0301 | ||
104 | #define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300 | ||
105 | #define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301 | ||
106 | |||
107 | /* USB Driver stuff | ||
108 | * table of devices that this driver is working with | ||
109 | * | ||
110 | * ATTENTION: Never ever change the order of this table, the particular | ||
111 | * devices depend on this order | ||
112 | * | ||
113 | * Each entry is used as a reference in the device_struct. Currently this is | ||
114 | * the only non-redundant way of assigning USB ids to actual devices I'm aware | ||
115 | * of, because there is only one place in the code where the assignment of | ||
116 | * vendor and product id is done, here. | ||
117 | */ | ||
118 | static struct usb_device_id dib_table [] = { | ||
119 | /* 00 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB_COLD)}, | ||
120 | /* 01 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB_WARM)}, | ||
121 | /* 02 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_YAKUMO_DTT200U_COLD) }, | ||
122 | /* 03 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_YAKUMO_DTT200U_WARM) }, | ||
123 | |||
124 | /* 04 */ { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_COLD) }, | ||
125 | /* 05 */ { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_WARM) }, | ||
126 | /* 06 */ { USB_DEVICE(USB_VID_COMPRO_UNK, USB_PID_COMPRO_DVBU2000_UNK_COLD) }, | ||
127 | /* 07 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_COLD) }, | ||
128 | /* 08 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_WARM) }, | ||
129 | /* 09 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_COLD) }, | ||
130 | /* 10 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_WARM) }, | ||
131 | /* 11 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_COLD) }, | ||
132 | /* 12 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_WARM) }, | ||
133 | /* 13 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_COLD) }, | ||
134 | /* 14 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_WARM) }, | ||
135 | /* 15 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_COLD) }, | ||
136 | /* 16 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_WARM) }, | ||
137 | /* 17 */ { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_COLD) }, | ||
138 | /* 18 */ { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_WARM) }, | ||
139 | /* 19 */ { USB_DEVICE(USB_VID_IMC_NETWORKS, USB_PID_TWINHAN_VP7041_COLD) }, | ||
140 | /* 20 */ { USB_DEVICE(USB_VID_IMC_NETWORKS, USB_PID_TWINHAN_VP7041_WARM) }, | ||
141 | /* 21 */ { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_COLD) }, | ||
142 | /* 22 */ { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_WARM) }, | ||
143 | /* 23 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_COLD) }, | ||
144 | /* 24 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_WARM) }, | ||
145 | /* 25 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_COLD) }, | ||
146 | /* 26 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_WARM) }, | ||
147 | /* 27 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_USB2_COLD) }, | ||
148 | |||
149 | /* 28 */ { USB_DEVICE(USB_VID_HANFTEK, USB_PID_HANFTEK_UMT_010_COLD) }, | ||
150 | /* 29 */ { USB_DEVICE(USB_VID_HANFTEK, USB_PID_HANFTEK_UMT_010_WARM) }, | ||
151 | |||
152 | /* 30 */ { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_WINTV_NOVA_T_USB2_COLD) }, | ||
153 | /* 31 */ { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_WINTV_NOVA_T_USB2_WARM) }, | ||
154 | /* 32 */ { USB_DEVICE(USB_VID_ADSTECH, USB_PID_ADSTECH_USB2_COLD) }, | ||
155 | /* 33 */ { USB_DEVICE(USB_VID_ADSTECH, USB_PID_ADSTECH_USB2_WARM) }, | ||
156 | /* | ||
157 | * activate the following define when you have one of the devices and want to | ||
158 | * build it from build-2.6 in dvb-kernel | ||
159 | */ | ||
160 | // #define CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES | ||
161 | #ifdef CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES | ||
162 | /* 34 */ { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) }, | ||
163 | /* 35 */ { USB_DEVICE(USB_VID_CYPRESS, USB_PID_ULTIMA_TVBOX_USB2_FX_COLD) }, | ||
164 | /* 36 */ { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_USB2_FX_WARM) }, | ||
165 | /* 37 */ { USB_DEVICE(USB_VID_ANCHOR, USB_PID_DIBCOM_ANCHOR_2135_COLD) }, | ||
166 | #endif | ||
167 | { } /* Terminating entry */ | ||
168 | }; | ||
169 | |||
170 | MODULE_DEVICE_TABLE (usb, dib_table); | ||
171 | |||
172 | static struct dibusb_usb_controller dibusb_usb_ctrl[] = { | ||
173 | { .name = "Cypress AN2135", .cpu_cs_register = 0x7f92 }, | ||
174 | { .name = "Cypress AN2235", .cpu_cs_register = 0x7f92 }, | ||
175 | { .name = "Cypress FX2", .cpu_cs_register = 0xe600 }, | ||
176 | }; | ||
177 | |||
178 | struct dibusb_tuner dibusb_tuner[] = { | ||
179 | { DIBUSB_TUNER_CABLE_THOMSON, | ||
180 | 0x61 | ||
181 | }, | ||
182 | { DIBUSB_TUNER_COFDM_PANASONIC_ENV57H1XD5, | ||
183 | 0x60 | ||
184 | }, | ||
185 | { DIBUSB_TUNER_CABLE_LG_TDTP_E102P, | ||
186 | 0x61 | ||
187 | }, | ||
188 | { DIBUSB_TUNER_COFDM_PANASONIC_ENV77H11D5, | ||
189 | 0x60 | ||
190 | }, | ||
191 | }; | ||
192 | |||
193 | static struct dibusb_demod dibusb_demod[] = { | ||
194 | { DIBUSB_DIB3000MB, | ||
195 | 16, | ||
196 | { 0x8, 0 }, | ||
197 | }, | ||
198 | { DIBUSB_DIB3000MC, | ||
199 | 32, | ||
200 | { 0x9, 0xa, 0xb, 0xc }, | ||
201 | }, | ||
202 | { DIBUSB_MT352, | ||
203 | 254, | ||
204 | { 0xf, 0 }, | ||
205 | }, | ||
206 | { DTT200U_FE, | ||
207 | 8, | ||
208 | { 0xff,0 }, /* there is no i2c bus in this device */ | ||
209 | } | ||
210 | }; | ||
211 | |||
212 | static struct dibusb_device_class dibusb_device_classes[] = { | ||
213 | { .id = DIBUSB1_1, .usb_ctrl = &dibusb_usb_ctrl[0], | ||
214 | .firmware = "dvb-dibusb-5.0.0.11.fw", | ||
215 | .pipe_cmd = 0x01, .pipe_data = 0x02, | ||
216 | .urb_count = 7, .urb_buffer_size = 4096, | ||
217 | DIBUSB_RC_NEC_PROTOCOL, | ||
218 | &dibusb_demod[DIBUSB_DIB3000MB], | ||
219 | &dibusb_tuner[DIBUSB_TUNER_CABLE_THOMSON], | ||
220 | }, | ||
221 | { DIBUSB1_1_AN2235, &dibusb_usb_ctrl[1], | ||
222 | "dvb-dibusb-an2235-1.fw", | ||
223 | 0x01, 0x02, | ||
224 | 7, 4096, | ||
225 | DIBUSB_RC_NEC_PROTOCOL, | ||
226 | &dibusb_demod[DIBUSB_DIB3000MB], | ||
227 | &dibusb_tuner[DIBUSB_TUNER_CABLE_THOMSON], | ||
228 | }, | ||
229 | { DIBUSB2_0,&dibusb_usb_ctrl[2], | ||
230 | "dvb-dibusb-6.0.0.5.fw", | ||
231 | 0x01, 0x06, | ||
232 | 7, 4096, | ||
233 | DIBUSB_RC_NEC_PROTOCOL, | ||
234 | &dibusb_demod[DIBUSB_DIB3000MC], | ||
235 | &dibusb_tuner[DIBUSB_TUNER_COFDM_PANASONIC_ENV57H1XD5], | ||
236 | }, | ||
237 | { UMT2_0, &dibusb_usb_ctrl[2], | ||
238 | "dvb-dibusb-umt-2.fw", | ||
239 | 0x01, 0x06, | ||
240 | 20, 512, | ||
241 | DIBUSB_RC_NO, | ||
242 | &dibusb_demod[DIBUSB_MT352], | ||
243 | &dibusb_tuner[DIBUSB_TUNER_CABLE_LG_TDTP_E102P], | ||
244 | }, | ||
245 | { DIBUSB2_0B,&dibusb_usb_ctrl[2], | ||
246 | "dvb-dibusb-adstech-usb2-1.fw", | ||
247 | 0x01, 0x06, | ||
248 | 7, 4096, | ||
249 | DIBUSB_RC_NEC_PROTOCOL, | ||
250 | &dibusb_demod[DIBUSB_DIB3000MB], | ||
251 | &dibusb_tuner[DIBUSB_TUNER_CABLE_THOMSON], | ||
252 | }, | ||
253 | { NOVAT_USB2,&dibusb_usb_ctrl[2], | ||
254 | "dvb-dibusb-nova-t-1.fw", | ||
255 | 0x01, 0x06, | ||
256 | 7, 4096, | ||
257 | DIBUSB_RC_HAUPPAUGE_PROTO, | ||
258 | &dibusb_demod[DIBUSB_DIB3000MC], | ||
259 | &dibusb_tuner[DIBUSB_TUNER_COFDM_PANASONIC_ENV57H1XD5], | ||
260 | }, | ||
261 | { DTT200U,&dibusb_usb_ctrl[2], | ||
262 | "dvb-dtt200u-1.fw", | ||
263 | 0x01, 0x02, | ||
264 | 7, 4096, | ||
265 | DIBUSB_RC_NO, | ||
266 | &dibusb_demod[DTT200U_FE], | ||
267 | NULL, /* no explicit tuner/pll-programming necessary (it has the ENV57H1XD5) */ | ||
268 | }, | ||
269 | }; | ||
270 | |||
271 | static struct dibusb_usb_device dibusb_devices[] = { | ||
272 | { "TwinhanDTV USB1.1 / Magic Box / HAMA USB1.1 DVB-T device", | ||
273 | &dibusb_device_classes[DIBUSB1_1], | ||
274 | { &dib_table[19], &dib_table[21], NULL}, | ||
275 | { &dib_table[20], &dib_table[22], NULL}, | ||
276 | }, | ||
277 | { "KWorld V-Stream XPERT DTV - DVB-T USB1.1", | ||
278 | &dibusb_device_classes[DIBUSB1_1], | ||
279 | { &dib_table[11], NULL }, | ||
280 | { &dib_table[12], NULL }, | ||
281 | }, | ||
282 | { "Grandtec USB1.1 DVB-T", | ||
283 | &dibusb_device_classes[DIBUSB1_1], | ||
284 | { &dib_table[13], &dib_table[15], NULL }, | ||
285 | { &dib_table[14], &dib_table[16], NULL }, | ||
286 | }, | ||
287 | { "DiBcom USB1.1 DVB-T reference design (MOD3000)", | ||
288 | &dibusb_device_classes[DIBUSB1_1], | ||
289 | { &dib_table[7], NULL }, | ||
290 | { &dib_table[8], NULL }, | ||
291 | }, | ||
292 | { "Artec T1 USB1.1 TVBOX with AN2135", | ||
293 | &dibusb_device_classes[DIBUSB1_1], | ||
294 | { &dib_table[23], NULL }, | ||
295 | { &dib_table[24], NULL }, | ||
296 | }, | ||
297 | { "Artec T1 USB1.1 TVBOX with AN2235", | ||
298 | &dibusb_device_classes[DIBUSB1_1_AN2235], | ||
299 | { &dib_table[25], NULL }, | ||
300 | { &dib_table[26], NULL }, | ||
301 | }, | ||
302 | { "Avermedia AverTV DVBT USB1.1", | ||
303 | &dibusb_device_classes[DIBUSB1_1], | ||
304 | { &dib_table[0], NULL }, | ||
305 | { &dib_table[1], NULL }, | ||
306 | }, | ||
307 | { "Compro Videomate DVB-U2000 - DVB-T USB1.1 (please confirm to linux-dvb)", | ||
308 | &dibusb_device_classes[DIBUSB1_1], | ||
309 | { &dib_table[4], &dib_table[6], NULL}, | ||
310 | { &dib_table[5], NULL }, | ||
311 | }, | ||
312 | { "Unkown USB1.1 DVB-T device ???? please report the name to the author", | ||
313 | &dibusb_device_classes[DIBUSB1_1], | ||
314 | { &dib_table[17], NULL }, | ||
315 | { &dib_table[18], NULL }, | ||
316 | }, | ||
317 | { "DiBcom USB2.0 DVB-T reference design (MOD3000P)", | ||
318 | &dibusb_device_classes[DIBUSB2_0], | ||
319 | { &dib_table[9], NULL }, | ||
320 | { &dib_table[10], NULL }, | ||
321 | }, | ||
322 | { "Artec T1 USB2.0 TVBOX (please report the warm ID)", | ||
323 | &dibusb_device_classes[DIBUSB2_0], | ||
324 | { &dib_table[27], NULL }, | ||
325 | { NULL }, | ||
326 | }, | ||
327 | { "Hauppauge WinTV NOVA-T USB2", | ||
328 | &dibusb_device_classes[NOVAT_USB2], | ||
329 | { &dib_table[30], NULL }, | ||
330 | { &dib_table[31], NULL }, | ||
331 | }, | ||
332 | { "DTT200U (Yakumo/Hama/Typhoon) DVB-T USB2.0", | ||
333 | &dibusb_device_classes[DTT200U], | ||
334 | { &dib_table[2], NULL }, | ||
335 | { &dib_table[3], NULL }, | ||
336 | }, | ||
337 | { "Hanftek UMT-010 DVB-T USB2.0", | ||
338 | &dibusb_device_classes[UMT2_0], | ||
339 | { &dib_table[28], NULL }, | ||
340 | { &dib_table[29], NULL }, | ||
341 | }, | ||
342 | { "KWorld/ADSTech Instant DVB-T USB 2.0", | ||
343 | &dibusb_device_classes[DIBUSB2_0B], | ||
344 | { &dib_table[32], NULL }, | ||
345 | { &dib_table[33], NULL }, /* device ID with default DIBUSB2_0-firmware */ | ||
346 | }, | ||
347 | #ifdef CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES | ||
348 | { "Artec T1 USB1.1 TVBOX with AN2235 (misdesigned)", | ||
349 | &dibusb_device_classes[DIBUSB1_1_AN2235], | ||
350 | { &dib_table[34], NULL }, | ||
351 | { NULL }, | ||
352 | }, | ||
353 | { "Artec T1 USB2.0 TVBOX with FX2 IDs (misdesigned, please report the warm ID)", | ||
354 | &dibusb_device_classes[DTT200U], | ||
355 | { &dib_table[35], NULL }, | ||
356 | { &dib_table[36], NULL }, /* undefined, it could be that the device will get another USB ID in warm state */ | ||
357 | }, | ||
358 | { "DiBcom USB1.1 DVB-T reference design (MOD3000) with AN2135 default IDs", | ||
359 | &dibusb_device_classes[DIBUSB1_1], | ||
360 | { &dib_table[37], NULL }, | ||
361 | { NULL }, | ||
362 | }, | ||
363 | #endif | ||
364 | }; | ||
365 | |||
366 | static int dibusb_exit(struct usb_dibusb *dib) | ||
367 | { | ||
368 | deb_info("init_state before exiting everything: %x\n",dib->init_state); | ||
369 | dibusb_remote_exit(dib); | ||
370 | dibusb_fe_exit(dib); | ||
371 | dibusb_i2c_exit(dib); | ||
372 | dibusb_dvb_exit(dib); | ||
373 | dibusb_urb_exit(dib); | ||
374 | deb_info("init_state should be zero now: %x\n",dib->init_state); | ||
375 | dib->init_state = DIBUSB_STATE_INIT; | ||
376 | kfree(dib); | ||
377 | return 0; | ||
378 | } | ||
379 | |||
380 | static int dibusb_init(struct usb_dibusb *dib) | ||
381 | { | ||
382 | int ret = 0; | ||
383 | sema_init(&dib->usb_sem, 1); | ||
384 | sema_init(&dib->i2c_sem, 1); | ||
385 | |||
386 | dib->init_state = DIBUSB_STATE_INIT; | ||
387 | |||
388 | if ((ret = dibusb_urb_init(dib)) || | ||
389 | (ret = dibusb_dvb_init(dib)) || | ||
390 | (ret = dibusb_i2c_init(dib))) { | ||
391 | dibusb_exit(dib); | ||
392 | return ret; | ||
393 | } | ||
394 | |||
395 | if ((ret = dibusb_fe_init(dib))) | ||
396 | err("could not initialize a frontend."); | ||
397 | |||
398 | if ((ret = dibusb_remote_init(dib))) | ||
399 | err("could not initialize remote control."); | ||
400 | |||
401 | return 0; | ||
402 | } | ||
403 | |||
404 | static struct dibusb_usb_device * dibusb_device_class_quirk(struct usb_device *udev, struct dibusb_usb_device *dev) | ||
405 | { | ||
406 | int i; | ||
407 | |||
408 | /* Quirk for the Kworld/ADSTech Instant USB2.0 device. It has the same USB | ||
409 | * IDs like the USB1.1 KWorld after loading the firmware. Which is a bad | ||
410 | * idea and make this quirk necessary. | ||
411 | */ | ||
412 | if (dev->dev_cl->id == DIBUSB1_1 && udev->speed == USB_SPEED_HIGH) { | ||
413 | info("this seems to be the Kworld/ADSTech Instant USB2.0 device or equal."); | ||
414 | for (i = 0; i < sizeof(dibusb_devices)/sizeof(struct dibusb_usb_device); i++) { | ||
415 | if (dibusb_devices[i].dev_cl->id == DIBUSB2_0B) { | ||
416 | dev = &dibusb_devices[i]; | ||
417 | break; | ||
418 | } | ||
419 | } | ||
420 | } | ||
421 | |||
422 | return dev; | ||
423 | } | ||
424 | |||
425 | static struct dibusb_usb_device * dibusb_find_device (struct usb_device *udev,int *cold) | ||
426 | { | ||
427 | int i,j; | ||
428 | struct dibusb_usb_device *dev = NULL; | ||
429 | *cold = -1; | ||
430 | |||
431 | for (i = 0; i < sizeof(dibusb_devices)/sizeof(struct dibusb_usb_device); i++) { | ||
432 | for (j = 0; j < DIBUSB_ID_MAX_NUM && dibusb_devices[i].cold_ids[j] != NULL; j++) { | ||
433 | deb_info("check for cold %x %x\n",dibusb_devices[i].cold_ids[j]->idVendor, dibusb_devices[i].cold_ids[j]->idProduct); | ||
434 | if (dibusb_devices[i].cold_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) && | ||
435 | dibusb_devices[i].cold_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) { | ||
436 | *cold = 1; | ||
437 | dev = &dibusb_devices[i]; | ||
438 | break; | ||
439 | } | ||
440 | } | ||
441 | |||
442 | if (dev != NULL) | ||
443 | break; | ||
444 | |||
445 | for (j = 0; j < DIBUSB_ID_MAX_NUM && dibusb_devices[i].warm_ids[j] != NULL; j++) { | ||
446 | deb_info("check for warm %x %x\n",dibusb_devices[i].warm_ids[j]->idVendor, dibusb_devices[i].warm_ids[j]->idProduct); | ||
447 | if (dibusb_devices[i].warm_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) && | ||
448 | dibusb_devices[i].warm_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) { | ||
449 | *cold = 0; | ||
450 | dev = &dibusb_devices[i]; | ||
451 | break; | ||
452 | } | ||
453 | } | ||
454 | } | ||
455 | |||
456 | if (dev != NULL) | ||
457 | dev = dibusb_device_class_quirk(udev,dev); | ||
458 | |||
459 | return dev; | ||
460 | } | ||
461 | |||
462 | /* | ||
463 | * USB | ||
464 | */ | ||
465 | static int dibusb_probe(struct usb_interface *intf, | ||
466 | const struct usb_device_id *id) | ||
467 | { | ||
468 | struct usb_device *udev = interface_to_usbdev(intf); | ||
469 | struct usb_dibusb *dib = NULL; | ||
470 | struct dibusb_usb_device *dibdev = NULL; | ||
471 | |||
472 | int ret = -ENOMEM,cold=0; | ||
473 | |||
474 | if ((dibdev = dibusb_find_device(udev,&cold)) == NULL) { | ||
475 | err("something went very wrong, " | ||
476 | "unknown product ID: %.4x",le16_to_cpu(udev->descriptor.idProduct)); | ||
477 | return -ENODEV; | ||
478 | } | ||
479 | |||
480 | if (cold == 1) { | ||
481 | info("found a '%s' in cold state, will try to load a firmware",dibdev->name); | ||
482 | ret = dibusb_loadfirmware(udev,dibdev); | ||
483 | } else { | ||
484 | info("found a '%s' in warm state.",dibdev->name); | ||
485 | dib = kmalloc(sizeof(struct usb_dibusb),GFP_KERNEL); | ||
486 | if (dib == NULL) { | ||
487 | err("no memory"); | ||
488 | return ret; | ||
489 | } | ||
490 | memset(dib,0,sizeof(struct usb_dibusb)); | ||
491 | |||
492 | dib->udev = udev; | ||
493 | dib->dibdev = dibdev; | ||
494 | |||
495 | /* store parameters to structures */ | ||
496 | dib->rc_query_interval = rc_query_interval; | ||
497 | dib->pid_parse = pid_parse; | ||
498 | dib->rc_key_repeat_count = rc_key_repeat_count; | ||
499 | |||
500 | usb_set_intfdata(intf, dib); | ||
501 | |||
502 | ret = dibusb_init(dib); | ||
503 | } | ||
504 | |||
505 | if (ret == 0) | ||
506 | info("%s successfully initialized and connected.",dibdev->name); | ||
507 | else | ||
508 | info("%s error while loading driver (%d)",dibdev->name,ret); | ||
509 | return ret; | ||
510 | } | ||
511 | |||
512 | static void dibusb_disconnect(struct usb_interface *intf) | ||
513 | { | ||
514 | struct usb_dibusb *dib = usb_get_intfdata(intf); | ||
515 | const char *name = DRIVER_DESC; | ||
516 | |||
517 | usb_set_intfdata(intf,NULL); | ||
518 | if (dib != NULL && dib->dibdev != NULL) { | ||
519 | name = dib->dibdev->name; | ||
520 | dibusb_exit(dib); | ||
521 | } | ||
522 | info("%s successfully deinitialized and disconnected.",name); | ||
523 | |||
524 | } | ||
525 | |||
526 | /* usb specific object needed to register this driver with the usb subsystem */ | ||
527 | static struct usb_driver dibusb_driver = { | ||
528 | .owner = THIS_MODULE, | ||
529 | .name = DRIVER_DESC, | ||
530 | .probe = dibusb_probe, | ||
531 | .disconnect = dibusb_disconnect, | ||
532 | .id_table = dib_table, | ||
533 | }; | ||
534 | |||
535 | /* module stuff */ | ||
536 | static int __init usb_dibusb_init(void) | ||
537 | { | ||
538 | int result; | ||
539 | if ((result = usb_register(&dibusb_driver))) { | ||
540 | err("usb_register failed. Error number %d",result); | ||
541 | return result; | ||
542 | } | ||
543 | |||
544 | return 0; | ||
545 | } | ||
546 | |||
547 | static void __exit usb_dibusb_exit(void) | ||
548 | { | ||
549 | /* deregister this driver from the USB subsystem */ | ||
550 | usb_deregister(&dibusb_driver); | ||
551 | } | ||
552 | |||
553 | module_init (usb_dibusb_init); | ||
554 | module_exit (usb_dibusb_exit); | ||
555 | |||
556 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
557 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
558 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c b/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c deleted file mode 100644 index 400b439e804e..000000000000 --- a/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c +++ /dev/null | |||
@@ -1,185 +0,0 @@ | |||
1 | /* | ||
2 | * dvb-dibusb-dvb.c is part of the driver for mobile USB Budget DVB-T devices | ||
3 | * based on reference design made by DiBcom (http://www.dibcom.fr/) | ||
4 | * | ||
5 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
6 | * | ||
7 | * see dvb-dibusb-core.c for more copyright details. | ||
8 | * | ||
9 | * This file contains functions for initializing and handling the | ||
10 | * linux-dvb API. | ||
11 | */ | ||
12 | #include "dvb-dibusb.h" | ||
13 | |||
14 | #include <linux/usb.h> | ||
15 | #include <linux/version.h> | ||
16 | |||
17 | static u32 urb_compl_count; | ||
18 | |||
19 | /* | ||
20 | * MPEG2 TS DVB stuff | ||
21 | */ | ||
22 | void dibusb_urb_complete(struct urb *urb, struct pt_regs *ptregs) | ||
23 | { | ||
24 | struct usb_dibusb *dib = urb->context; | ||
25 | |||
26 | deb_ts("urb complete feedcount: %d, status: %d, length: %d\n",dib->feedcount,urb->status, | ||
27 | urb->actual_length); | ||
28 | |||
29 | urb_compl_count++; | ||
30 | if (urb_compl_count % 1000 == 0) | ||
31 | deb_info("%d urbs completed so far.\n",urb_compl_count); | ||
32 | |||
33 | switch (urb->status) { | ||
34 | case 0: /* success */ | ||
35 | case -ETIMEDOUT: /* NAK */ | ||
36 | break; | ||
37 | case -ECONNRESET: /* kill */ | ||
38 | case -ENOENT: | ||
39 | case -ESHUTDOWN: | ||
40 | return; | ||
41 | default: /* error */ | ||
42 | deb_ts("urb completition error %d.", urb->status); | ||
43 | break; | ||
44 | } | ||
45 | |||
46 | if (dib->feedcount > 0 && urb->actual_length > 0) { | ||
47 | if (dib->init_state & DIBUSB_STATE_DVB) | ||
48 | dvb_dmx_swfilter(&dib->demux, (u8*) urb->transfer_buffer,urb->actual_length); | ||
49 | } else | ||
50 | deb_ts("URB dropped because of feedcount.\n"); | ||
51 | |||
52 | usb_submit_urb(urb,GFP_ATOMIC); | ||
53 | } | ||
54 | |||
55 | static int dibusb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) | ||
56 | { | ||
57 | struct usb_dibusb *dib = dvbdmxfeed->demux->priv; | ||
58 | int newfeedcount; | ||
59 | |||
60 | if (dib == NULL) | ||
61 | return -ENODEV; | ||
62 | |||
63 | newfeedcount = dib->feedcount + (onoff ? 1 : -1); | ||
64 | |||
65 | /* | ||
66 | * stop feed before setting a new pid if there will be no pid anymore | ||
67 | */ | ||
68 | if (newfeedcount == 0) { | ||
69 | deb_ts("stop feeding\n"); | ||
70 | if (dib->xfer_ops.fifo_ctrl != NULL) { | ||
71 | if (dib->xfer_ops.fifo_ctrl(dib->fe,0)) { | ||
72 | err("error while inhibiting fifo."); | ||
73 | return -ENODEV; | ||
74 | } | ||
75 | } | ||
76 | dibusb_streaming(dib,0); | ||
77 | } | ||
78 | |||
79 | dib->feedcount = newfeedcount; | ||
80 | |||
81 | /* activate the pid on the device specific pid_filter */ | ||
82 | deb_ts("setting pid: %5d %04x at index %d '%s'\n",dvbdmxfeed->pid,dvbdmxfeed->pid,dvbdmxfeed->index,onoff ? "on" : "off"); | ||
83 | if (dib->pid_parse && dib->xfer_ops.pid_ctrl != NULL) | ||
84 | dib->xfer_ops.pid_ctrl(dib->fe,dvbdmxfeed->index,dvbdmxfeed->pid,onoff); | ||
85 | |||
86 | /* | ||
87 | * start the feed if this was the first pid to set and there is still a pid | ||
88 | * for reception. | ||
89 | */ | ||
90 | if (dib->feedcount == onoff && dib->feedcount > 0) { | ||
91 | |||
92 | deb_ts("controlling pid parser\n"); | ||
93 | if (dib->xfer_ops.pid_parse != NULL) { | ||
94 | if (dib->xfer_ops.pid_parse(dib->fe,dib->pid_parse) < 0) { | ||
95 | err("could not handle pid_parser"); | ||
96 | } | ||
97 | } | ||
98 | |||
99 | deb_ts("start feeding\n"); | ||
100 | if (dib->xfer_ops.fifo_ctrl != NULL) { | ||
101 | if (dib->xfer_ops.fifo_ctrl(dib->fe,1)) { | ||
102 | err("error while enabling fifo."); | ||
103 | return -ENODEV; | ||
104 | } | ||
105 | } | ||
106 | dibusb_streaming(dib,1); | ||
107 | } | ||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | static int dibusb_start_feed(struct dvb_demux_feed *dvbdmxfeed) | ||
112 | { | ||
113 | deb_ts("start pid: 0x%04x, feedtype: %d\n", dvbdmxfeed->pid,dvbdmxfeed->type); | ||
114 | return dibusb_ctrl_feed(dvbdmxfeed,1); | ||
115 | } | ||
116 | |||
117 | static int dibusb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | ||
118 | { | ||
119 | deb_ts("stop pid: 0x%04x, feedtype: %d\n", dvbdmxfeed->pid, dvbdmxfeed->type); | ||
120 | return dibusb_ctrl_feed(dvbdmxfeed,0); | ||
121 | } | ||
122 | |||
123 | int dibusb_dvb_init(struct usb_dibusb *dib) | ||
124 | { | ||
125 | int ret; | ||
126 | |||
127 | urb_compl_count = 0; | ||
128 | |||
129 | if ((ret = dvb_register_adapter(&dib->adapter, DRIVER_DESC, | ||
130 | THIS_MODULE)) < 0) { | ||
131 | deb_info("dvb_register_adapter failed: error %d", ret); | ||
132 | goto err; | ||
133 | } | ||
134 | dib->adapter.priv = dib; | ||
135 | |||
136 | /* i2c is done in dibusb_i2c_init */ | ||
137 | |||
138 | dib->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING; | ||
139 | |||
140 | dib->demux.priv = (void *)dib; | ||
141 | /* get pidcount from demod */ | ||
142 | dib->demux.feednum = dib->demux.filternum = 255; | ||
143 | dib->demux.start_feed = dibusb_start_feed; | ||
144 | dib->demux.stop_feed = dibusb_stop_feed; | ||
145 | dib->demux.write_to_decoder = NULL; | ||
146 | if ((ret = dvb_dmx_init(&dib->demux)) < 0) { | ||
147 | err("dvb_dmx_init failed: error %d",ret); | ||
148 | goto err_dmx; | ||
149 | } | ||
150 | |||
151 | dib->dmxdev.filternum = dib->demux.filternum; | ||
152 | dib->dmxdev.demux = &dib->demux.dmx; | ||
153 | dib->dmxdev.capabilities = 0; | ||
154 | if ((ret = dvb_dmxdev_init(&dib->dmxdev, &dib->adapter)) < 0) { | ||
155 | err("dvb_dmxdev_init failed: error %d",ret); | ||
156 | goto err_dmx_dev; | ||
157 | } | ||
158 | |||
159 | dvb_net_init(&dib->adapter, &dib->dvb_net, &dib->demux.dmx); | ||
160 | |||
161 | goto success; | ||
162 | err_dmx_dev: | ||
163 | dvb_dmx_release(&dib->demux); | ||
164 | err_dmx: | ||
165 | dvb_unregister_adapter(&dib->adapter); | ||
166 | err: | ||
167 | return ret; | ||
168 | success: | ||
169 | dib->init_state |= DIBUSB_STATE_DVB; | ||
170 | return 0; | ||
171 | } | ||
172 | |||
173 | int dibusb_dvb_exit(struct usb_dibusb *dib) | ||
174 | { | ||
175 | if (dib->init_state & DIBUSB_STATE_DVB) { | ||
176 | dib->init_state &= ~DIBUSB_STATE_DVB; | ||
177 | deb_info("unregistering DVB part\n"); | ||
178 | dvb_net_release(&dib->dvb_net); | ||
179 | dib->demux.dmx.close(&dib->demux.dmx); | ||
180 | dvb_dmxdev_release(&dib->dmxdev); | ||
181 | dvb_dmx_release(&dib->demux); | ||
182 | dvb_unregister_adapter(&dib->adapter); | ||
183 | } | ||
184 | return 0; | ||
185 | } | ||
diff --git a/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c b/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c deleted file mode 100644 index 5a71b88797d9..000000000000 --- a/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c +++ /dev/null | |||
@@ -1,582 +0,0 @@ | |||
1 | /* | ||
2 | * dvb-dibusb-fe-i2c.c is part of the driver for mobile USB Budget DVB-T devices | ||
3 | * based on reference design made by DiBcom (http://www.dibcom.fr/) | ||
4 | * | ||
5 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
6 | * | ||
7 | * see dvb-dibusb-core.c for more copyright details. | ||
8 | * | ||
9 | * This file contains functions for attaching, initializing of an appropriate | ||
10 | * demodulator/frontend. I2C-stuff is also located here. | ||
11 | * | ||
12 | */ | ||
13 | #include "dvb-dibusb.h" | ||
14 | |||
15 | #include <linux/usb.h> | ||
16 | |||
17 | static int dibusb_i2c_msg(struct usb_dibusb *dib, u8 addr, | ||
18 | u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) | ||
19 | { | ||
20 | u8 sndbuf[wlen+4]; /* lead(1) devaddr,direction(1) addr(2) data(wlen) (len(2) (when reading)) */ | ||
21 | /* write only ? */ | ||
22 | int wo = (rbuf == NULL || rlen == 0), | ||
23 | len = 2 + wlen + (wo ? 0 : 2); | ||
24 | |||
25 | sndbuf[0] = wo ? DIBUSB_REQ_I2C_WRITE : DIBUSB_REQ_I2C_READ; | ||
26 | sndbuf[1] = (addr << 1) | (wo ? 0 : 1); | ||
27 | |||
28 | memcpy(&sndbuf[2],wbuf,wlen); | ||
29 | |||
30 | if (!wo) { | ||
31 | sndbuf[wlen+2] = (rlen >> 8) & 0xff; | ||
32 | sndbuf[wlen+3] = rlen & 0xff; | ||
33 | } | ||
34 | |||
35 | return dibusb_readwrite_usb(dib,sndbuf,len,rbuf,rlen); | ||
36 | } | ||
37 | |||
38 | /* | ||
39 | * I2C master xfer function | ||
40 | */ | ||
41 | static int dibusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg *msg,int num) | ||
42 | { | ||
43 | struct usb_dibusb *dib = i2c_get_adapdata(adap); | ||
44 | int i; | ||
45 | |||
46 | if (down_interruptible(&dib->i2c_sem) < 0) | ||
47 | return -EAGAIN; | ||
48 | |||
49 | if (num > 2) | ||
50 | warn("more than 2 i2c messages at a time is not handled yet. TODO."); | ||
51 | |||
52 | for (i = 0; i < num; i++) { | ||
53 | /* write/read request */ | ||
54 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { | ||
55 | if (dibusb_i2c_msg(dib, msg[i].addr, msg[i].buf,msg[i].len, | ||
56 | msg[i+1].buf,msg[i+1].len) < 0) | ||
57 | break; | ||
58 | i++; | ||
59 | } else | ||
60 | if (dibusb_i2c_msg(dib, msg[i].addr, msg[i].buf,msg[i].len,NULL,0) < 0) | ||
61 | break; | ||
62 | } | ||
63 | |||
64 | up(&dib->i2c_sem); | ||
65 | return i; | ||
66 | } | ||
67 | |||
68 | static u32 dibusb_i2c_func(struct i2c_adapter *adapter) | ||
69 | { | ||
70 | return I2C_FUNC_I2C; | ||
71 | } | ||
72 | |||
73 | static struct i2c_algorithm dibusb_algo = { | ||
74 | .name = "DiBcom USB i2c algorithm", | ||
75 | .id = I2C_ALGO_BIT, | ||
76 | .master_xfer = dibusb_i2c_xfer, | ||
77 | .functionality = dibusb_i2c_func, | ||
78 | }; | ||
79 | |||
80 | static int dibusb_general_demod_init(struct dvb_frontend *fe); | ||
81 | static u8 dibusb_general_pll_addr(struct dvb_frontend *fe); | ||
82 | static int dibusb_general_pll_init(struct dvb_frontend *fe, u8 pll_buf[5]); | ||
83 | static int dibusb_general_pll_set(struct dvb_frontend *fe, | ||
84 | struct dvb_frontend_parameters* params, u8 pll_buf[5]); | ||
85 | |||
86 | static struct mt352_config mt352_hanftek_umt_010_config = { | ||
87 | .demod_address = 0x1e, | ||
88 | .demod_init = dibusb_general_demod_init, | ||
89 | .pll_set = dibusb_general_pll_set, | ||
90 | }; | ||
91 | |||
92 | static int dibusb_tuner_quirk(struct usb_dibusb *dib) | ||
93 | { | ||
94 | switch (dib->dibdev->dev_cl->id) { | ||
95 | case DIBUSB1_1: /* some these device have the ENV77H11D5 and some the THOMSON CABLE */ | ||
96 | case DIBUSB1_1_AN2235: { /* actually its this device, but in warm state they are indistinguishable */ | ||
97 | struct dibusb_tuner *t; | ||
98 | u8 b[2] = { 0,0 } ,b2[1]; | ||
99 | struct i2c_msg msg[2] = { | ||
100 | { .flags = 0, .buf = b, .len = 2 }, | ||
101 | { .flags = I2C_M_RD, .buf = b2, .len = 1}, | ||
102 | }; | ||
103 | |||
104 | t = &dibusb_tuner[DIBUSB_TUNER_COFDM_PANASONIC_ENV77H11D5]; | ||
105 | |||
106 | msg[0].addr = msg[1].addr = t->pll_addr; | ||
107 | |||
108 | if (dib->xfer_ops.tuner_pass_ctrl != NULL) | ||
109 | dib->xfer_ops.tuner_pass_ctrl(dib->fe,1,t->pll_addr); | ||
110 | dibusb_i2c_xfer(&dib->i2c_adap,msg,2); | ||
111 | if (dib->xfer_ops.tuner_pass_ctrl != NULL) | ||
112 | dib->xfer_ops.tuner_pass_ctrl(dib->fe,0,t->pll_addr); | ||
113 | |||
114 | if (b2[0] == 0xfe) | ||
115 | info("this device has the Thomson Cable onboard. Which is default."); | ||
116 | else { | ||
117 | dib->tuner = t; | ||
118 | info("this device has the Panasonic ENV77H11D5 onboard."); | ||
119 | } | ||
120 | break; | ||
121 | } | ||
122 | default: | ||
123 | break; | ||
124 | } | ||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | int dibusb_fe_init(struct usb_dibusb* dib) | ||
129 | { | ||
130 | struct dib3000_config demod_cfg; | ||
131 | int i; | ||
132 | |||
133 | if (dib->init_state & DIBUSB_STATE_I2C) { | ||
134 | for (i = 0; i < sizeof(dib->dibdev->dev_cl->demod->i2c_addrs) / sizeof(unsigned char) && | ||
135 | dib->dibdev->dev_cl->demod->i2c_addrs[i] != 0; i++) { | ||
136 | |||
137 | demod_cfg.demod_address = dib->dibdev->dev_cl->demod->i2c_addrs[i]; | ||
138 | demod_cfg.pll_addr = dibusb_general_pll_addr; | ||
139 | demod_cfg.pll_set = dibusb_general_pll_set; | ||
140 | demod_cfg.pll_init = dibusb_general_pll_init; | ||
141 | |||
142 | deb_info("demod id: %d %d\n",dib->dibdev->dev_cl->demod->id,DTT200U_FE); | ||
143 | |||
144 | switch (dib->dibdev->dev_cl->demod->id) { | ||
145 | case DIBUSB_DIB3000MB: | ||
146 | dib->fe = dib3000mb_attach(&demod_cfg,&dib->i2c_adap,&dib->xfer_ops); | ||
147 | break; | ||
148 | case DIBUSB_DIB3000MC: | ||
149 | dib->fe = dib3000mc_attach(&demod_cfg,&dib->i2c_adap,&dib->xfer_ops); | ||
150 | break; | ||
151 | case DIBUSB_MT352: | ||
152 | mt352_hanftek_umt_010_config.demod_address = dib->dibdev->dev_cl->demod->i2c_addrs[i]; | ||
153 | dib->fe = mt352_attach(&mt352_hanftek_umt_010_config, &dib->i2c_adap); | ||
154 | break; | ||
155 | case DTT200U_FE: | ||
156 | dib->fe = dtt200u_fe_attach(dib,&dib->xfer_ops); | ||
157 | break; | ||
158 | } | ||
159 | if (dib->fe != NULL) { | ||
160 | info("found demodulator at i2c address 0x%x",dib->dibdev->dev_cl->demod->i2c_addrs[i]); | ||
161 | break; | ||
162 | } | ||
163 | } | ||
164 | /* if a frontend was found */ | ||
165 | if (dib->fe != NULL) { | ||
166 | if (dib->fe->ops->sleep != NULL) | ||
167 | dib->fe_sleep = dib->fe->ops->sleep; | ||
168 | dib->fe->ops->sleep = dibusb_hw_sleep; | ||
169 | |||
170 | if (dib->fe->ops->init != NULL ) | ||
171 | dib->fe_init = dib->fe->ops->init; | ||
172 | dib->fe->ops->init = dibusb_hw_wakeup; | ||
173 | |||
174 | /* setting the default tuner */ | ||
175 | dib->tuner = dib->dibdev->dev_cl->tuner; | ||
176 | |||
177 | /* check which tuner is mounted on this device, in case this is unsure */ | ||
178 | dibusb_tuner_quirk(dib); | ||
179 | } | ||
180 | } | ||
181 | if (dib->fe == NULL) { | ||
182 | err("A frontend driver was not found for device '%s'.", | ||
183 | dib->dibdev->name); | ||
184 | return -ENODEV; | ||
185 | } else { | ||
186 | if (dvb_register_frontend(&dib->adapter, dib->fe)) { | ||
187 | err("Frontend registration failed."); | ||
188 | if (dib->fe->ops->release) | ||
189 | dib->fe->ops->release(dib->fe); | ||
190 | dib->fe = NULL; | ||
191 | return -ENODEV; | ||
192 | } | ||
193 | } | ||
194 | |||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | int dibusb_fe_exit(struct usb_dibusb *dib) | ||
199 | { | ||
200 | if (dib->fe != NULL) | ||
201 | dvb_unregister_frontend(dib->fe); | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | int dibusb_i2c_init(struct usb_dibusb *dib) | ||
206 | { | ||
207 | int ret = 0; | ||
208 | |||
209 | dib->adapter.priv = dib; | ||
210 | |||
211 | strncpy(dib->i2c_adap.name,dib->dibdev->name,I2C_NAME_SIZE); | ||
212 | #ifdef I2C_ADAP_CLASS_TV_DIGITAL | ||
213 | dib->i2c_adap.class = I2C_ADAP_CLASS_TV_DIGITAL, | ||
214 | #else | ||
215 | dib->i2c_adap.class = I2C_CLASS_TV_DIGITAL, | ||
216 | #endif | ||
217 | dib->i2c_adap.algo = &dibusb_algo; | ||
218 | dib->i2c_adap.algo_data = NULL; | ||
219 | dib->i2c_adap.id = I2C_ALGO_BIT; | ||
220 | |||
221 | i2c_set_adapdata(&dib->i2c_adap, dib); | ||
222 | |||
223 | if ((ret = i2c_add_adapter(&dib->i2c_adap)) < 0) | ||
224 | err("could not add i2c adapter"); | ||
225 | |||
226 | dib->init_state |= DIBUSB_STATE_I2C; | ||
227 | |||
228 | return ret; | ||
229 | } | ||
230 | |||
231 | int dibusb_i2c_exit(struct usb_dibusb *dib) | ||
232 | { | ||
233 | if (dib->init_state & DIBUSB_STATE_I2C) | ||
234 | i2c_del_adapter(&dib->i2c_adap); | ||
235 | dib->init_state &= ~DIBUSB_STATE_I2C; | ||
236 | return 0; | ||
237 | } | ||
238 | |||
239 | |||
240 | /* pll stuff, maybe removed soon (thx to Gerd/Andrew in advance) */ | ||
241 | static int thomson_cable_eu_pll_set(struct dvb_frontend_parameters *fep, u8 pllbuf[4]) | ||
242 | { | ||
243 | u32 tfreq = (fep->frequency + 36125000) / 62500; | ||
244 | int vu,p0,p1,p2; | ||
245 | |||
246 | if (fep->frequency > 403250000) | ||
247 | vu = 1, p2 = 1, p1 = 0, p0 = 1; | ||
248 | else if (fep->frequency > 115750000) | ||
249 | vu = 0, p2 = 1, p1 = 1, p0 = 0; | ||
250 | else if (fep->frequency > 44250000) | ||
251 | vu = 0, p2 = 0, p1 = 1, p0 = 1; | ||
252 | else | ||
253 | return -EINVAL; | ||
254 | |||
255 | pllbuf[0] = (tfreq >> 8) & 0x7f; | ||
256 | pllbuf[1] = tfreq & 0xff; | ||
257 | pllbuf[2] = 0x8e; | ||
258 | pllbuf[3] = (vu << 7) | (p2 << 2) | (p1 << 1) | p0; | ||
259 | return 0; | ||
260 | } | ||
261 | |||
262 | static int panasonic_cofdm_env57h1xd5_pll_set(struct dvb_frontend_parameters *fep, u8 pllbuf[4]) | ||
263 | { | ||
264 | u32 freq_khz = fep->frequency / 1000; | ||
265 | u32 tfreq = ((freq_khz + 36125)*6 + 500) / 1000; | ||
266 | u8 TA, T210, R210, ctrl1, cp210, p4321; | ||
267 | if (freq_khz > 858000) { | ||
268 | err("frequency cannot be larger than 858 MHz."); | ||
269 | return -EINVAL; | ||
270 | } | ||
271 | |||
272 | // contol data 1 : 1 | T/A=1 | T2,T1,T0 = 0,0,0 | R2,R1,R0 = 0,1,0 | ||
273 | TA = 1; | ||
274 | T210 = 0; | ||
275 | R210 = 0x2; | ||
276 | ctrl1 = (1 << 7) | (TA << 6) | (T210 << 3) | R210; | ||
277 | |||
278 | // ******** CHARGE PUMP CONFIG vs RF FREQUENCIES ***************** | ||
279 | if (freq_khz < 470000) | ||
280 | cp210 = 2; // VHF Low and High band ch E12 to E4 to E12 | ||
281 | else if (freq_khz < 526000) | ||
282 | cp210 = 4; // UHF band Ch E21 to E27 | ||
283 | else // if (freq < 862000000) | ||
284 | cp210 = 5; // UHF band ch E28 to E69 | ||
285 | |||
286 | //********************* BW select ******************************* | ||
287 | if (freq_khz < 153000) | ||
288 | p4321 = 1; // BW selected for VHF low | ||
289 | else if (freq_khz < 470000) | ||
290 | p4321 = 2; // BW selected for VHF high E5 to E12 | ||
291 | else // if (freq < 862000000) | ||
292 | p4321 = 4; // BW selection for UHF E21 to E69 | ||
293 | |||
294 | pllbuf[0] = (tfreq >> 8) & 0xff; | ||
295 | pllbuf[1] = (tfreq >> 0) & 0xff; | ||
296 | pllbuf[2] = 0xff & ctrl1; | ||
297 | pllbuf[3] = (cp210 << 5) | (p4321); | ||
298 | |||
299 | return 0; | ||
300 | } | ||
301 | |||
302 | /* | ||
303 | * 7 6 5 4 3 2 1 0 | ||
304 | * Address Byte 1 1 0 0 0 MA1 MA0 R/~W=0 | ||
305 | * | ||
306 | * Program divider byte 1 0 n14 n13 n12 n11 n10 n9 n8 | ||
307 | * Program divider byte 2 n7 n6 n5 n4 n3 n2 n1 n0 | ||
308 | * | ||
309 | * Control byte 1 1 T/A=1 T2 T1 T0 R2 R1 R0 | ||
310 | * 1 T/A=0 0 0 ATC AL2 AL1 AL0 | ||
311 | * | ||
312 | * Control byte 2 CP2 CP1 CP0 BS5 BS4 BS3 BS2 BS1 | ||
313 | * | ||
314 | * MA0/1 = programmable address bits | ||
315 | * R/~W = read/write bit (0 for writing) | ||
316 | * N14-0 = programmable LO frequency | ||
317 | * | ||
318 | * T/A = test AGC bit (0 = next 6 bits AGC setting, | ||
319 | * 1 = next 6 bits test and reference divider ratio settings) | ||
320 | * T2-0 = test bits | ||
321 | * R2-0 = reference divider ratio and programmable frequency step | ||
322 | * ATC = AGC current setting and time constant | ||
323 | * ATC = 0: AGC current = 220nA, AGC time constant = 2s | ||
324 | * ATC = 1: AGC current = 9uA, AGC time constant = 50ms | ||
325 | * AL2-0 = AGC take-over point bits | ||
326 | * CP2-0 = charge pump current | ||
327 | * BS5-1 = PMOS ports control bits; | ||
328 | * BSn = 0 corresponding port is off, high-impedance state (at power-on) | ||
329 | * BSn = 1 corresponding port is on | ||
330 | */ | ||
331 | static int panasonic_cofdm_env77h11d5_tda6650_init(struct dvb_frontend *fe, u8 pllbuf[4]) | ||
332 | { | ||
333 | pllbuf[0] = 0x0b; | ||
334 | pllbuf[1] = 0xf5; | ||
335 | pllbuf[2] = 0x85; | ||
336 | pllbuf[3] = 0xab; | ||
337 | return 0; | ||
338 | } | ||
339 | |||
340 | static int panasonic_cofdm_env77h11d5_tda6650_set (struct dvb_frontend_parameters *fep,u8 pllbuf[4]) | ||
341 | { | ||
342 | int tuner_frequency = 0; | ||
343 | u8 band, cp, filter; | ||
344 | |||
345 | // determine charge pump | ||
346 | tuner_frequency = fep->frequency + 36166000; | ||
347 | if (tuner_frequency < 87000000) | ||
348 | return -EINVAL; | ||
349 | else if (tuner_frequency < 130000000) | ||
350 | cp = 3; | ||
351 | else if (tuner_frequency < 160000000) | ||
352 | cp = 5; | ||
353 | else if (tuner_frequency < 200000000) | ||
354 | cp = 6; | ||
355 | else if (tuner_frequency < 290000000) | ||
356 | cp = 3; | ||
357 | else if (tuner_frequency < 420000000) | ||
358 | cp = 5; | ||
359 | else if (tuner_frequency < 480000000) | ||
360 | cp = 6; | ||
361 | else if (tuner_frequency < 620000000) | ||
362 | cp = 3; | ||
363 | else if (tuner_frequency < 830000000) | ||
364 | cp = 5; | ||
365 | else if (tuner_frequency < 895000000) | ||
366 | cp = 7; | ||
367 | else | ||
368 | return -EINVAL; | ||
369 | |||
370 | // determine band | ||
371 | if (fep->frequency < 49000000) | ||
372 | return -EINVAL; | ||
373 | else if (fep->frequency < 161000000) | ||
374 | band = 1; | ||
375 | else if (fep->frequency < 444000000) | ||
376 | band = 2; | ||
377 | else if (fep->frequency < 861000000) | ||
378 | band = 4; | ||
379 | else | ||
380 | return -EINVAL; | ||
381 | |||
382 | // setup PLL filter | ||
383 | switch (fep->u.ofdm.bandwidth) { | ||
384 | case BANDWIDTH_6_MHZ: | ||
385 | case BANDWIDTH_7_MHZ: | ||
386 | filter = 0; | ||
387 | break; | ||
388 | case BANDWIDTH_8_MHZ: | ||
389 | filter = 1; | ||
390 | break; | ||
391 | default: | ||
392 | return -EINVAL; | ||
393 | } | ||
394 | |||
395 | // calculate divisor | ||
396 | // ((36166000+((1000000/6)/2)) + Finput)/(1000000/6) | ||
397 | tuner_frequency = (((fep->frequency / 1000) * 6) + 217496) / 1000; | ||
398 | |||
399 | // setup tuner buffer | ||
400 | pllbuf[0] = (tuner_frequency >> 8) & 0x7f; | ||
401 | pllbuf[1] = tuner_frequency & 0xff; | ||
402 | pllbuf[2] = 0xca; | ||
403 | pllbuf[3] = (cp << 5) | (filter << 3) | band; | ||
404 | return 0; | ||
405 | } | ||
406 | |||
407 | /* | ||
408 | * 7 6 5 4 3 2 1 0 | ||
409 | * Address Byte 1 1 0 0 0 MA1 MA0 R/~W=0 | ||
410 | * | ||
411 | * Program divider byte 1 0 n14 n13 n12 n11 n10 n9 n8 | ||
412 | * Program divider byte 2 n7 n6 n5 n4 n3 n2 n1 n0 | ||
413 | * | ||
414 | * Control byte 1 CP T2 T1 T0 RSA RSB OS | ||
415 | * | ||
416 | * Band Switch byte X X X P4 P3 P2 P1 P0 | ||
417 | * | ||
418 | * Auxiliary byte ATC AL2 AL1 AL0 0 0 0 0 | ||
419 | * | ||
420 | * Address: MA1 MA0 Address | ||
421 | * 0 0 c0 | ||
422 | * 0 1 c2 (always valid) | ||
423 | * 1 0 c4 | ||
424 | * 1 1 c6 | ||
425 | */ | ||
426 | static int lg_tdtp_e102p_tua6034(struct dvb_frontend_parameters* fep, u8 pllbuf[4]) | ||
427 | { | ||
428 | u32 div; | ||
429 | u8 p210, p3; | ||
430 | |||
431 | #define TUNER_MUL 62500 | ||
432 | |||
433 | div = (fep->frequency + 36125000 + TUNER_MUL / 2) / TUNER_MUL; | ||
434 | // div = ((fep->frequency/1000 + 36166) * 6) / 1000; | ||
435 | |||
436 | if (fep->frequency < 174500000) | ||
437 | p210 = 1; // not supported by the tdtp_e102p | ||
438 | else if (fep->frequency < 230000000) // VHF | ||
439 | p210 = 2; | ||
440 | else | ||
441 | p210 = 4; | ||
442 | |||
443 | if (fep->u.ofdm.bandwidth == BANDWIDTH_7_MHZ) | ||
444 | p3 = 0; | ||
445 | else | ||
446 | p3 = 1; | ||
447 | |||
448 | pllbuf[0] = (div >> 8) & 0x7f; | ||
449 | pllbuf[1] = div & 0xff; | ||
450 | pllbuf[2] = 0xce; | ||
451 | // pllbuf[2] = 0xcc; | ||
452 | pllbuf[3] = (p3 << 3) | p210; | ||
453 | |||
454 | return 0; | ||
455 | } | ||
456 | |||
457 | static int lg_tdtp_e102p_mt352_demod_init(struct dvb_frontend *fe) | ||
458 | { | ||
459 | static u8 mt352_clock_config[] = { 0x89, 0xb8, 0x2d }; | ||
460 | static u8 mt352_reset[] = { 0x50, 0x80 }; | ||
461 | static u8 mt352_mclk_ratio[] = { 0x8b, 0x00 }; | ||
462 | static u8 mt352_adc_ctl_1_cfg[] = { 0x8E, 0x40 }; | ||
463 | static u8 mt352_agc_cfg[] = { 0x67, 0x10, 0xa0 }; | ||
464 | |||
465 | static u8 mt352_sec_agc_cfg1[] = { 0x6a, 0xff }; | ||
466 | static u8 mt352_sec_agc_cfg2[] = { 0x6d, 0xff }; | ||
467 | static u8 mt352_sec_agc_cfg3[] = { 0x70, 0x40 }; | ||
468 | static u8 mt352_sec_agc_cfg4[] = { 0x7b, 0x03 }; | ||
469 | static u8 mt352_sec_agc_cfg5[] = { 0x7d, 0x0f }; | ||
470 | |||
471 | static u8 mt352_acq_ctl[] = { 0x53, 0x50 }; | ||
472 | static u8 mt352_input_freq_1[] = { 0x56, 0x31, 0x06 }; | ||
473 | |||
474 | mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config)); | ||
475 | udelay(2000); | ||
476 | mt352_write(fe, mt352_reset, sizeof(mt352_reset)); | ||
477 | mt352_write(fe, mt352_mclk_ratio, sizeof(mt352_mclk_ratio)); | ||
478 | |||
479 | mt352_write(fe, mt352_adc_ctl_1_cfg, sizeof(mt352_adc_ctl_1_cfg)); | ||
480 | mt352_write(fe, mt352_agc_cfg, sizeof(mt352_agc_cfg)); | ||
481 | |||
482 | mt352_write(fe, mt352_sec_agc_cfg1, sizeof(mt352_sec_agc_cfg1)); | ||
483 | mt352_write(fe, mt352_sec_agc_cfg2, sizeof(mt352_sec_agc_cfg2)); | ||
484 | mt352_write(fe, mt352_sec_agc_cfg3, sizeof(mt352_sec_agc_cfg3)); | ||
485 | mt352_write(fe, mt352_sec_agc_cfg4, sizeof(mt352_sec_agc_cfg4)); | ||
486 | mt352_write(fe, mt352_sec_agc_cfg5, sizeof(mt352_sec_agc_cfg5)); | ||
487 | |||
488 | mt352_write(fe, mt352_acq_ctl, sizeof(mt352_acq_ctl)); | ||
489 | mt352_write(fe, mt352_input_freq_1, sizeof(mt352_input_freq_1)); | ||
490 | |||
491 | return 0; | ||
492 | } | ||
493 | |||
494 | static int dibusb_general_demod_init(struct dvb_frontend *fe) | ||
495 | { | ||
496 | struct usb_dibusb* dib = (struct usb_dibusb*) fe->dvb->priv; | ||
497 | switch (dib->dibdev->dev_cl->id) { | ||
498 | case UMT2_0: | ||
499 | return lg_tdtp_e102p_mt352_demod_init(fe); | ||
500 | default: /* other device classes do not have device specific demod inits */ | ||
501 | break; | ||
502 | } | ||
503 | return 0; | ||
504 | } | ||
505 | |||
506 | static u8 dibusb_general_pll_addr(struct dvb_frontend *fe) | ||
507 | { | ||
508 | struct usb_dibusb* dib = (struct usb_dibusb*) fe->dvb->priv; | ||
509 | return dib->tuner->pll_addr; | ||
510 | } | ||
511 | |||
512 | static int dibusb_pll_i2c_helper(struct usb_dibusb *dib, u8 pll_buf[5], u8 buf[4]) | ||
513 | { | ||
514 | if (pll_buf == NULL) { | ||
515 | struct i2c_msg msg = { | ||
516 | .addr = dib->tuner->pll_addr, | ||
517 | .flags = 0, | ||
518 | .buf = buf, | ||
519 | .len = sizeof(buf) | ||
520 | }; | ||
521 | if (i2c_transfer (&dib->i2c_adap, &msg, 1) != 1) | ||
522 | return -EIO; | ||
523 | msleep(1); | ||
524 | } else { | ||
525 | pll_buf[0] = dib->tuner->pll_addr << 1; | ||
526 | memcpy(&pll_buf[1],buf,4); | ||
527 | } | ||
528 | |||
529 | return 0; | ||
530 | } | ||
531 | |||
532 | static int dibusb_general_pll_init(struct dvb_frontend *fe, | ||
533 | u8 pll_buf[5]) | ||
534 | { | ||
535 | struct usb_dibusb* dib = (struct usb_dibusb*) fe->dvb->priv; | ||
536 | u8 buf[4]; | ||
537 | int ret=0; | ||
538 | switch (dib->tuner->id) { | ||
539 | case DIBUSB_TUNER_COFDM_PANASONIC_ENV77H11D5: | ||
540 | ret = panasonic_cofdm_env77h11d5_tda6650_init(fe,buf); | ||
541 | break; | ||
542 | default: | ||
543 | break; | ||
544 | } | ||
545 | |||
546 | if (ret) | ||
547 | return ret; | ||
548 | |||
549 | return dibusb_pll_i2c_helper(dib,pll_buf,buf); | ||
550 | } | ||
551 | |||
552 | static int dibusb_general_pll_set(struct dvb_frontend *fe, | ||
553 | struct dvb_frontend_parameters *fep, u8 pll_buf[5]) | ||
554 | { | ||
555 | struct usb_dibusb* dib = (struct usb_dibusb*) fe->dvb->priv; | ||
556 | u8 buf[4]; | ||
557 | int ret=0; | ||
558 | |||
559 | switch (dib->tuner->id) { | ||
560 | case DIBUSB_TUNER_CABLE_THOMSON: | ||
561 | ret = thomson_cable_eu_pll_set(fep, buf); | ||
562 | break; | ||
563 | case DIBUSB_TUNER_COFDM_PANASONIC_ENV57H1XD5: | ||
564 | ret = panasonic_cofdm_env57h1xd5_pll_set(fep, buf); | ||
565 | break; | ||
566 | case DIBUSB_TUNER_CABLE_LG_TDTP_E102P: | ||
567 | ret = lg_tdtp_e102p_tua6034(fep, buf); | ||
568 | break; | ||
569 | case DIBUSB_TUNER_COFDM_PANASONIC_ENV77H11D5: | ||
570 | ret = panasonic_cofdm_env77h11d5_tda6650_set(fep,buf); | ||
571 | break; | ||
572 | default: | ||
573 | warn("no pll programming routine found for tuner %d.\n",dib->tuner->id); | ||
574 | ret = -ENODEV; | ||
575 | break; | ||
576 | } | ||
577 | |||
578 | if (ret) | ||
579 | return ret; | ||
580 | |||
581 | return dibusb_pll_i2c_helper(dib,pll_buf,buf); | ||
582 | } | ||
diff --git a/drivers/media/dvb/dibusb/dvb-dibusb-firmware.c b/drivers/media/dvb/dibusb/dvb-dibusb-firmware.c deleted file mode 100644 index 504ba47afdf3..000000000000 --- a/drivers/media/dvb/dibusb/dvb-dibusb-firmware.c +++ /dev/null | |||
@@ -1,87 +0,0 @@ | |||
1 | /* | ||
2 | * dvb-dibusb-firmware.c is part of the driver for mobile USB Budget DVB-T devices | ||
3 | * based on reference design made by DiBcom (http://www.dibcom.fr/) | ||
4 | * | ||
5 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
6 | * | ||
7 | * see dvb-dibusb-core.c for more copyright details. | ||
8 | * | ||
9 | * This file contains functions for downloading the firmware to the device. | ||
10 | */ | ||
11 | #include "dvb-dibusb.h" | ||
12 | |||
13 | #include <linux/firmware.h> | ||
14 | #include <linux/usb.h> | ||
15 | |||
16 | /* | ||
17 | * load a firmware packet to the device | ||
18 | */ | ||
19 | static int dibusb_writemem(struct usb_device *udev,u16 addr,u8 *data, u8 len) | ||
20 | { | ||
21 | return usb_control_msg(udev, usb_sndctrlpipe(udev,0), | ||
22 | 0xa0, USB_TYPE_VENDOR, addr, 0x00, data, len, 5000); | ||
23 | } | ||
24 | |||
25 | int dibusb_loadfirmware(struct usb_device *udev, struct dibusb_usb_device *dibdev) | ||
26 | { | ||
27 | const struct firmware *fw = NULL; | ||
28 | u16 addr; | ||
29 | u8 *b,*p; | ||
30 | int ret = 0,i; | ||
31 | |||
32 | if ((ret = request_firmware(&fw, dibdev->dev_cl->firmware, &udev->dev)) != 0) { | ||
33 | err("did not find the firmware file. (%s) " | ||
34 | "Please see linux/Documentation/dvb/ for more details on firmware-problems.", | ||
35 | dibdev->dev_cl->firmware); | ||
36 | return ret; | ||
37 | } | ||
38 | |||
39 | info("downloading firmware from file '%s'.",dibdev->dev_cl->firmware); | ||
40 | |||
41 | p = kmalloc(fw->size,GFP_KERNEL); | ||
42 | if (p != NULL) { | ||
43 | u8 reset; | ||
44 | /* | ||
45 | * you cannot use the fw->data as buffer for | ||
46 | * usb_control_msg, a new buffer has to be | ||
47 | * created | ||
48 | */ | ||
49 | memcpy(p,fw->data,fw->size); | ||
50 | |||
51 | /* stop the CPU */ | ||
52 | reset = 1; | ||
53 | if ((ret = dibusb_writemem(udev,dibdev->dev_cl->usb_ctrl->cpu_cs_register,&reset,1)) != 1) | ||
54 | err("could not stop the USB controller CPU."); | ||
55 | for(i = 0; p[i+3] == 0 && i < fw->size; ) { | ||
56 | b = (u8 *) &p[i]; | ||
57 | addr = *((u16 *) &b[1]); | ||
58 | |||
59 | ret = dibusb_writemem(udev,addr,&b[4],b[0]); | ||
60 | |||
61 | if (ret != b[0]) { | ||
62 | err("error while transferring firmware " | ||
63 | "(transferred size: %d, block size: %d)", | ||
64 | ret,b[0]); | ||
65 | ret = -EINVAL; | ||
66 | break; | ||
67 | } | ||
68 | i += 5 + b[0]; | ||
69 | } | ||
70 | /* length in ret */ | ||
71 | if (ret > 0) | ||
72 | ret = 0; | ||
73 | /* restart the CPU */ | ||
74 | reset = 0; | ||
75 | if (ret || dibusb_writemem(udev,dibdev->dev_cl->usb_ctrl->cpu_cs_register,&reset,1) != 1) { | ||
76 | err("could not restart the USB controller CPU."); | ||
77 | ret = -EINVAL; | ||
78 | } | ||
79 | |||
80 | kfree(p); | ||
81 | } else { | ||
82 | ret = -ENOMEM; | ||
83 | } | ||
84 | release_firmware(fw); | ||
85 | |||
86 | return ret; | ||
87 | } | ||
diff --git a/drivers/media/dvb/dibusb/dvb-dibusb-remote.c b/drivers/media/dvb/dibusb/dvb-dibusb-remote.c deleted file mode 100644 index 9dc8b15517b7..000000000000 --- a/drivers/media/dvb/dibusb/dvb-dibusb-remote.c +++ /dev/null | |||
@@ -1,316 +0,0 @@ | |||
1 | /* | ||
2 | * dvb-dibusb-remote.c is part of the driver for mobile USB Budget DVB-T devices | ||
3 | * based on reference design made by DiBcom (http://www.dibcom.fr/) | ||
4 | * | ||
5 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
6 | * | ||
7 | * see dvb-dibusb-core.c for more copyright details. | ||
8 | * | ||
9 | * This file contains functions for handling the event device on the software | ||
10 | * side and the remote control on the hardware side. | ||
11 | */ | ||
12 | #include "dvb-dibusb.h" | ||
13 | |||
14 | /* Table to map raw key codes to key events. This should not be hard-wired | ||
15 | into the kernel. */ | ||
16 | static const struct { u8 c0, c1, c2; uint32_t key; } nec_rc_keys [] = | ||
17 | { | ||
18 | /* Key codes for the little Artec T1/Twinhan/HAMA/ remote. */ | ||
19 | { 0x00, 0xff, 0x16, KEY_POWER }, | ||
20 | { 0x00, 0xff, 0x10, KEY_MUTE }, | ||
21 | { 0x00, 0xff, 0x03, KEY_1 }, | ||
22 | { 0x00, 0xff, 0x01, KEY_2 }, | ||
23 | { 0x00, 0xff, 0x06, KEY_3 }, | ||
24 | { 0x00, 0xff, 0x09, KEY_4 }, | ||
25 | { 0x00, 0xff, 0x1d, KEY_5 }, | ||
26 | { 0x00, 0xff, 0x1f, KEY_6 }, | ||
27 | { 0x00, 0xff, 0x0d, KEY_7 }, | ||
28 | { 0x00, 0xff, 0x19, KEY_8 }, | ||
29 | { 0x00, 0xff, 0x1b, KEY_9 }, | ||
30 | { 0x00, 0xff, 0x15, KEY_0 }, | ||
31 | { 0x00, 0xff, 0x05, KEY_CHANNELUP }, | ||
32 | { 0x00, 0xff, 0x02, KEY_CHANNELDOWN }, | ||
33 | { 0x00, 0xff, 0x1e, KEY_VOLUMEUP }, | ||
34 | { 0x00, 0xff, 0x0a, KEY_VOLUMEDOWN }, | ||
35 | { 0x00, 0xff, 0x11, KEY_RECORD }, | ||
36 | { 0x00, 0xff, 0x17, KEY_FAVORITES }, /* Heart symbol - Channel list. */ | ||
37 | { 0x00, 0xff, 0x14, KEY_PLAY }, | ||
38 | { 0x00, 0xff, 0x1a, KEY_STOP }, | ||
39 | { 0x00, 0xff, 0x40, KEY_REWIND }, | ||
40 | { 0x00, 0xff, 0x12, KEY_FASTFORWARD }, | ||
41 | { 0x00, 0xff, 0x0e, KEY_PREVIOUS }, /* Recall - Previous channel. */ | ||
42 | { 0x00, 0xff, 0x4c, KEY_PAUSE }, | ||
43 | { 0x00, 0xff, 0x4d, KEY_SCREEN }, /* Full screen mode. */ | ||
44 | { 0x00, 0xff, 0x54, KEY_AUDIO }, /* MTS - Switch to secondary audio. */ | ||
45 | /* additional keys TwinHan VisionPlus, the Artec seemingly not have */ | ||
46 | { 0x00, 0xff, 0x0c, KEY_CANCEL }, /* Cancel */ | ||
47 | { 0x00, 0xff, 0x1c, KEY_EPG }, /* EPG */ | ||
48 | { 0x00, 0xff, 0x00, KEY_TAB }, /* Tab */ | ||
49 | { 0x00, 0xff, 0x48, KEY_INFO }, /* Preview */ | ||
50 | { 0x00, 0xff, 0x04, KEY_LIST }, /* RecordList */ | ||
51 | { 0x00, 0xff, 0x0f, KEY_TEXT }, /* Teletext */ | ||
52 | /* Key codes for the KWorld/ADSTech/JetWay remote. */ | ||
53 | { 0x86, 0x6b, 0x12, KEY_POWER }, | ||
54 | { 0x86, 0x6b, 0x0f, KEY_SELECT }, /* source */ | ||
55 | { 0x86, 0x6b, 0x0c, KEY_UNKNOWN }, /* scan */ | ||
56 | { 0x86, 0x6b, 0x0b, KEY_EPG }, | ||
57 | { 0x86, 0x6b, 0x10, KEY_MUTE }, | ||
58 | { 0x86, 0x6b, 0x01, KEY_1 }, | ||
59 | { 0x86, 0x6b, 0x02, KEY_2 }, | ||
60 | { 0x86, 0x6b, 0x03, KEY_3 }, | ||
61 | { 0x86, 0x6b, 0x04, KEY_4 }, | ||
62 | { 0x86, 0x6b, 0x05, KEY_5 }, | ||
63 | { 0x86, 0x6b, 0x06, KEY_6 }, | ||
64 | { 0x86, 0x6b, 0x07, KEY_7 }, | ||
65 | { 0x86, 0x6b, 0x08, KEY_8 }, | ||
66 | { 0x86, 0x6b, 0x09, KEY_9 }, | ||
67 | { 0x86, 0x6b, 0x0a, KEY_0 }, | ||
68 | { 0x86, 0x6b, 0x18, KEY_ZOOM }, | ||
69 | { 0x86, 0x6b, 0x1c, KEY_UNKNOWN }, /* preview */ | ||
70 | { 0x86, 0x6b, 0x13, KEY_UNKNOWN }, /* snap */ | ||
71 | { 0x86, 0x6b, 0x00, KEY_UNDO }, | ||
72 | { 0x86, 0x6b, 0x1d, KEY_RECORD }, | ||
73 | { 0x86, 0x6b, 0x0d, KEY_STOP }, | ||
74 | { 0x86, 0x6b, 0x0e, KEY_PAUSE }, | ||
75 | { 0x86, 0x6b, 0x16, KEY_PLAY }, | ||
76 | { 0x86, 0x6b, 0x11, KEY_BACK }, | ||
77 | { 0x86, 0x6b, 0x19, KEY_FORWARD }, | ||
78 | { 0x86, 0x6b, 0x14, KEY_UNKNOWN }, /* pip */ | ||
79 | { 0x86, 0x6b, 0x15, KEY_ESC }, | ||
80 | { 0x86, 0x6b, 0x1a, KEY_UP }, | ||
81 | { 0x86, 0x6b, 0x1e, KEY_DOWN }, | ||
82 | { 0x86, 0x6b, 0x1f, KEY_LEFT }, | ||
83 | { 0x86, 0x6b, 0x1b, KEY_RIGHT }, | ||
84 | }; | ||
85 | |||
86 | /* Hauppauge NOVA-T USB2 keys */ | ||
87 | static const struct { u16 raw; uint32_t key; } haupp_rc_keys [] = { | ||
88 | { 0xddf, KEY_GOTO }, | ||
89 | { 0xdef, KEY_POWER }, | ||
90 | { 0xce7, KEY_TV }, | ||
91 | { 0xcc7, KEY_VIDEO }, | ||
92 | { 0xccf, KEY_AUDIO }, | ||
93 | { 0xcd7, KEY_MEDIA }, | ||
94 | { 0xcdf, KEY_EPG }, | ||
95 | { 0xca7, KEY_UP }, | ||
96 | { 0xc67, KEY_RADIO }, | ||
97 | { 0xcb7, KEY_LEFT }, | ||
98 | { 0xd2f, KEY_OK }, | ||
99 | { 0xcbf, KEY_RIGHT }, | ||
100 | { 0xcff, KEY_BACK }, | ||
101 | { 0xcaf, KEY_DOWN }, | ||
102 | { 0xc6f, KEY_MENU }, | ||
103 | { 0xc87, KEY_VOLUMEUP }, | ||
104 | { 0xc8f, KEY_VOLUMEDOWN }, | ||
105 | { 0xc97, KEY_CHANNEL }, | ||
106 | { 0xc7f, KEY_MUTE }, | ||
107 | { 0xd07, KEY_CHANNELUP }, | ||
108 | { 0xd0f, KEY_CHANNELDOWN }, | ||
109 | { 0xdbf, KEY_RECORD }, | ||
110 | { 0xdb7, KEY_STOP }, | ||
111 | { 0xd97, KEY_REWIND }, | ||
112 | { 0xdaf, KEY_PLAY }, | ||
113 | { 0xda7, KEY_FASTFORWARD }, | ||
114 | { 0xd27, KEY_LAST }, /* Skip backwards */ | ||
115 | { 0xd87, KEY_PAUSE }, | ||
116 | { 0xcf7, KEY_NEXT }, | ||
117 | { 0xc07, KEY_0 }, | ||
118 | { 0xc0f, KEY_1 }, | ||
119 | { 0xc17, KEY_2 }, | ||
120 | { 0xc1f, KEY_3 }, | ||
121 | { 0xc27, KEY_4 }, | ||
122 | { 0xc2f, KEY_5 }, | ||
123 | { 0xc37, KEY_6 }, | ||
124 | { 0xc3f, KEY_7 }, | ||
125 | { 0xc47, KEY_8 }, | ||
126 | { 0xc4f, KEY_9 }, | ||
127 | { 0xc57, KEY_KPASTERISK }, | ||
128 | { 0xc77, KEY_GRAVE }, /* # */ | ||
129 | { 0xc5f, KEY_RED }, | ||
130 | { 0xd77, KEY_GREEN }, | ||
131 | { 0xdc7, KEY_YELLOW }, | ||
132 | { 0xd4f, KEY_BLUE}, | ||
133 | }; | ||
134 | |||
135 | static int dibusb_key2event_nec(struct usb_dibusb *dib,u8 rb[5]) | ||
136 | { | ||
137 | int i; | ||
138 | switch (rb[0]) { | ||
139 | case DIBUSB_RC_NEC_KEY_PRESSED: | ||
140 | /* rb[1-3] is the actual key, rb[4] is a checksum */ | ||
141 | deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x, 0x%02x\n", | ||
142 | rb[1], rb[2], rb[3], rb[4]); | ||
143 | |||
144 | if ((0xff - rb[3]) != rb[4]) { | ||
145 | deb_rc("remote control checksum failed.\n"); | ||
146 | break; | ||
147 | } | ||
148 | |||
149 | /* See if we can match the raw key code. */ | ||
150 | for (i = 0; i < sizeof(nec_rc_keys)/sizeof(nec_rc_keys[0]); i++) { | ||
151 | if (nec_rc_keys[i].c0 == rb[1] && | ||
152 | nec_rc_keys[i].c1 == rb[2] && | ||
153 | nec_rc_keys[i].c2 == rb[3]) { | ||
154 | |||
155 | dib->last_event = nec_rc_keys[i].key; | ||
156 | return 1; | ||
157 | } | ||
158 | } | ||
159 | break; | ||
160 | case DIBUSB_RC_NEC_KEY_REPEATED: | ||
161 | /* rb[1]..rb[4] are always zero.*/ | ||
162 | /* Repeats often seem to occur so for the moment just ignore this. */ | ||
163 | return 0; | ||
164 | case DIBUSB_RC_NEC_EMPTY: /* No (more) remote control keys. */ | ||
165 | default: | ||
166 | break; | ||
167 | } | ||
168 | return -1; | ||
169 | } | ||
170 | |||
171 | static int dibusb_key2event_hauppauge(struct usb_dibusb *dib,u8 rb[4]) | ||
172 | { | ||
173 | u16 raw; | ||
174 | int i,state; | ||
175 | switch (rb[0]) { | ||
176 | case DIBUSB_RC_HAUPPAUGE_KEY_PRESSED: | ||
177 | raw = ((rb[1] & 0x0f) << 8) | rb[2]; | ||
178 | |||
179 | state = !!(rb[1] & 0x40); | ||
180 | |||
181 | deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to %04x state: %d\n",rb[1],rb[2],rb[3],raw,state); | ||
182 | for (i = 0; i < sizeof(haupp_rc_keys)/sizeof(haupp_rc_keys[0]); i++) { | ||
183 | if (haupp_rc_keys[i].raw == raw) { | ||
184 | if (dib->last_event == haupp_rc_keys[i].key && | ||
185 | dib->last_state == state) { | ||
186 | deb_rc("key repeat\n"); | ||
187 | return 0; | ||
188 | } else { | ||
189 | dib->last_event = haupp_rc_keys[i].key; | ||
190 | dib->last_state = state; | ||
191 | return 1; | ||
192 | } | ||
193 | } | ||
194 | } | ||
195 | |||
196 | break; | ||
197 | case DIBUSB_RC_HAUPPAUGE_KEY_EMPTY: | ||
198 | default: | ||
199 | break; | ||
200 | } | ||
201 | return -1; | ||
202 | } | ||
203 | |||
204 | /* | ||
205 | * Read the remote control and feed the appropriate event. | ||
206 | * NEC protocol is used for remote controls | ||
207 | */ | ||
208 | static int dibusb_read_remote_control(struct usb_dibusb *dib) | ||
209 | { | ||
210 | u8 b[1] = { DIBUSB_REQ_POLL_REMOTE }, rb[5]; | ||
211 | int ret,event = 0; | ||
212 | |||
213 | if ((ret = dibusb_readwrite_usb(dib,b,1,rb,5))) | ||
214 | return ret; | ||
215 | |||
216 | switch (dib->dibdev->dev_cl->remote_type) { | ||
217 | case DIBUSB_RC_NEC_PROTOCOL: | ||
218 | event = dibusb_key2event_nec(dib,rb); | ||
219 | break; | ||
220 | case DIBUSB_RC_HAUPPAUGE_PROTO: | ||
221 | event = dibusb_key2event_hauppauge(dib,rb); | ||
222 | default: | ||
223 | break; | ||
224 | } | ||
225 | |||
226 | /* key repeat */ | ||
227 | if (event == 0) | ||
228 | if (++dib->repeat_key_count < dib->rc_key_repeat_count) { | ||
229 | deb_rc("key repeat dropped. (%d)\n",dib->repeat_key_count); | ||
230 | event = -1; /* skip this key repeat */ | ||
231 | } | ||
232 | |||
233 | if (event == 1 || event == 0) { | ||
234 | deb_rc("Translated key 0x%04x\n",event); | ||
235 | |||
236 | /* Signal down and up events for this key. */ | ||
237 | input_report_key(&dib->rc_input_dev, dib->last_event, 1); | ||
238 | input_report_key(&dib->rc_input_dev, dib->last_event, 0); | ||
239 | input_sync(&dib->rc_input_dev); | ||
240 | |||
241 | if (event == 1) | ||
242 | dib->repeat_key_count = 0; | ||
243 | } | ||
244 | return 0; | ||
245 | } | ||
246 | |||
247 | /* Remote-control poll function - called every dib->rc_query_interval ms to see | ||
248 | whether the remote control has received anything. */ | ||
249 | static void dibusb_remote_query(void *data) | ||
250 | { | ||
251 | struct usb_dibusb *dib = (struct usb_dibusb *) data; | ||
252 | /* TODO: need a lock here. We can simply skip checking for the remote control | ||
253 | if we're busy. */ | ||
254 | dibusb_read_remote_control(dib); | ||
255 | schedule_delayed_work(&dib->rc_query_work, | ||
256 | msecs_to_jiffies(dib->rc_query_interval)); | ||
257 | } | ||
258 | |||
259 | int dibusb_remote_init(struct usb_dibusb *dib) | ||
260 | { | ||
261 | int i; | ||
262 | |||
263 | if (dib->dibdev->dev_cl->remote_type == DIBUSB_RC_NO) | ||
264 | return 0; | ||
265 | |||
266 | /* Initialise the remote-control structures.*/ | ||
267 | init_input_dev(&dib->rc_input_dev); | ||
268 | |||
269 | dib->rc_input_dev.evbit[0] = BIT(EV_KEY); | ||
270 | dib->rc_input_dev.keycodesize = sizeof(unsigned char); | ||
271 | dib->rc_input_dev.keycodemax = KEY_MAX; | ||
272 | dib->rc_input_dev.name = DRIVER_DESC " remote control"; | ||
273 | |||
274 | switch (dib->dibdev->dev_cl->remote_type) { | ||
275 | case DIBUSB_RC_NEC_PROTOCOL: | ||
276 | for (i=0; i<sizeof(nec_rc_keys)/sizeof(nec_rc_keys[0]); i++) | ||
277 | set_bit(nec_rc_keys[i].key, dib->rc_input_dev.keybit); | ||
278 | break; | ||
279 | case DIBUSB_RC_HAUPPAUGE_PROTO: | ||
280 | for (i=0; i<sizeof(haupp_rc_keys)/sizeof(haupp_rc_keys[0]); i++) | ||
281 | set_bit(haupp_rc_keys[i].key, dib->rc_input_dev.keybit); | ||
282 | break; | ||
283 | default: | ||
284 | break; | ||
285 | } | ||
286 | |||
287 | |||
288 | input_register_device(&dib->rc_input_dev); | ||
289 | |||
290 | INIT_WORK(&dib->rc_query_work, dibusb_remote_query, dib); | ||
291 | |||
292 | /* Start the remote-control polling. */ | ||
293 | if (dib->rc_query_interval < 40) | ||
294 | dib->rc_query_interval = 100; /* default */ | ||
295 | |||
296 | info("schedule remote query interval to %d msecs.",dib->rc_query_interval); | ||
297 | schedule_delayed_work(&dib->rc_query_work,msecs_to_jiffies(dib->rc_query_interval)); | ||
298 | |||
299 | dib->init_state |= DIBUSB_STATE_REMOTE; | ||
300 | |||
301 | return 0; | ||
302 | } | ||
303 | |||
304 | int dibusb_remote_exit(struct usb_dibusb *dib) | ||
305 | { | ||
306 | if (dib->dibdev->dev_cl->remote_type == DIBUSB_RC_NO) | ||
307 | return 0; | ||
308 | |||
309 | if (dib->init_state & DIBUSB_STATE_REMOTE) { | ||
310 | cancel_delayed_work(&dib->rc_query_work); | ||
311 | flush_scheduled_work(); | ||
312 | input_unregister_device(&dib->rc_input_dev); | ||
313 | } | ||
314 | dib->init_state &= ~DIBUSB_STATE_REMOTE; | ||
315 | return 0; | ||
316 | } | ||
diff --git a/drivers/media/dvb/dibusb/dvb-dibusb-usb.c b/drivers/media/dvb/dibusb/dvb-dibusb-usb.c deleted file mode 100644 index 642f0596a5ba..000000000000 --- a/drivers/media/dvb/dibusb/dvb-dibusb-usb.c +++ /dev/null | |||
@@ -1,303 +0,0 @@ | |||
1 | /* | ||
2 | * dvb-dibusb-usb.c is part of the driver for mobile USB Budget DVB-T devices | ||
3 | * based on reference design made by DiBcom (http://www.dibcom.fr/) | ||
4 | * | ||
5 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
6 | * | ||
7 | * see dvb-dibusb-core.c for more copyright details. | ||
8 | * | ||
9 | * This file contains functions for initializing and handling the | ||
10 | * usb specific stuff. | ||
11 | */ | ||
12 | #include "dvb-dibusb.h" | ||
13 | |||
14 | #include <linux/version.h> | ||
15 | #include <linux/pci.h> | ||
16 | |||
17 | int dibusb_readwrite_usb(struct usb_dibusb *dib, u8 *wbuf, u16 wlen, u8 *rbuf, | ||
18 | u16 rlen) | ||
19 | { | ||
20 | int actlen,ret = -ENOMEM; | ||
21 | |||
22 | if (wbuf == NULL || wlen == 0) | ||
23 | return -EINVAL; | ||
24 | |||
25 | if ((ret = down_interruptible(&dib->usb_sem))) | ||
26 | return ret; | ||
27 | |||
28 | debug_dump(wbuf,wlen); | ||
29 | |||
30 | ret = usb_bulk_msg(dib->udev,usb_sndbulkpipe(dib->udev, | ||
31 | dib->dibdev->dev_cl->pipe_cmd), wbuf,wlen,&actlen, | ||
32 | DIBUSB_I2C_TIMEOUT); | ||
33 | |||
34 | if (ret) | ||
35 | err("bulk message failed: %d (%d/%d)",ret,wlen,actlen); | ||
36 | else | ||
37 | ret = actlen != wlen ? -1 : 0; | ||
38 | |||
39 | /* an answer is expected, and no error before */ | ||
40 | if (!ret && rbuf && rlen) { | ||
41 | ret = usb_bulk_msg(dib->udev,usb_rcvbulkpipe(dib->udev, | ||
42 | dib->dibdev->dev_cl->pipe_cmd),rbuf,rlen,&actlen, | ||
43 | DIBUSB_I2C_TIMEOUT); | ||
44 | |||
45 | if (ret) | ||
46 | err("recv bulk message failed: %d",ret); | ||
47 | else { | ||
48 | deb_alot("rlen: %d\n",rlen); | ||
49 | debug_dump(rbuf,actlen); | ||
50 | } | ||
51 | } | ||
52 | |||
53 | up(&dib->usb_sem); | ||
54 | return ret; | ||
55 | } | ||
56 | |||
57 | /* | ||
58 | * Cypress controls | ||
59 | */ | ||
60 | int dibusb_write_usb(struct usb_dibusb *dib, u8 *buf, u16 len) | ||
61 | { | ||
62 | return dibusb_readwrite_usb(dib,buf,len,NULL,0); | ||
63 | } | ||
64 | |||
65 | #if 0 | ||
66 | /* | ||
67 | * #if 0'ing the following functions as they are not in use _now_, | ||
68 | * but probably will be sometime. | ||
69 | */ | ||
70 | /* | ||
71 | * do not use this, just a workaround for a bug, | ||
72 | * which will hopefully never occur :). | ||
73 | */ | ||
74 | int dibusb_interrupt_read_loop(struct usb_dibusb *dib) | ||
75 | { | ||
76 | u8 b[1] = { DIBUSB_REQ_INTR_READ }; | ||
77 | return dibusb_write_usb(dib,b,1); | ||
78 | } | ||
79 | #endif | ||
80 | |||
81 | /* | ||
82 | * ioctl for the firmware | ||
83 | */ | ||
84 | static int dibusb_ioctl_cmd(struct usb_dibusb *dib, u8 cmd, u8 *param, int plen) | ||
85 | { | ||
86 | u8 b[34]; | ||
87 | int size = plen > 32 ? 32 : plen; | ||
88 | memset(b,0,34); | ||
89 | b[0] = DIBUSB_REQ_SET_IOCTL; | ||
90 | b[1] = cmd; | ||
91 | |||
92 | if (size > 0) | ||
93 | memcpy(&b[2],param,size); | ||
94 | |||
95 | return dibusb_write_usb(dib,b,34); //2+size); | ||
96 | } | ||
97 | |||
98 | /* | ||
99 | * ioctl for power control | ||
100 | */ | ||
101 | int dibusb_hw_wakeup(struct dvb_frontend *fe) | ||
102 | { | ||
103 | struct usb_dibusb *dib = (struct usb_dibusb *) fe->dvb->priv; | ||
104 | u8 b[1] = { DIBUSB_IOCTL_POWER_WAKEUP }; | ||
105 | deb_info("dibusb-device is getting up.\n"); | ||
106 | |||
107 | switch (dib->dibdev->dev_cl->id) { | ||
108 | case DTT200U: | ||
109 | break; | ||
110 | default: | ||
111 | dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_POWER_MODE, b,1); | ||
112 | break; | ||
113 | } | ||
114 | |||
115 | if (dib->fe_init) | ||
116 | return dib->fe_init(fe); | ||
117 | |||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | int dibusb_hw_sleep(struct dvb_frontend *fe) | ||
122 | { | ||
123 | struct usb_dibusb *dib = (struct usb_dibusb *) fe->dvb->priv; | ||
124 | u8 b[1] = { DIBUSB_IOCTL_POWER_SLEEP }; | ||
125 | deb_info("dibusb-device is going to bed.\n"); | ||
126 | /* workaround, something is wrong, when dibusb 1.1 device are going to bed too late */ | ||
127 | switch (dib->dibdev->dev_cl->id) { | ||
128 | case DIBUSB1_1: | ||
129 | case NOVAT_USB2: | ||
130 | case DTT200U: | ||
131 | break; | ||
132 | default: | ||
133 | dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_POWER_MODE, b,1); | ||
134 | break; | ||
135 | } | ||
136 | if (dib->fe_sleep) | ||
137 | return dib->fe_sleep(fe); | ||
138 | |||
139 | return 0; | ||
140 | } | ||
141 | |||
142 | int dibusb_set_streaming_mode(struct usb_dibusb *dib,u8 mode) | ||
143 | { | ||
144 | u8 b[2] = { DIBUSB_REQ_SET_STREAMING_MODE, mode }; | ||
145 | return dibusb_readwrite_usb(dib,b,2,NULL,0); | ||
146 | } | ||
147 | |||
148 | static int dibusb_urb_kill(struct usb_dibusb *dib) | ||
149 | { | ||
150 | int i; | ||
151 | deb_info("trying to kill urbs\n"); | ||
152 | if (dib->init_state & DIBUSB_STATE_URB_SUBMIT) { | ||
153 | for (i = 0; i < dib->dibdev->dev_cl->urb_count; i++) { | ||
154 | deb_info("killing URB no. %d.\n",i); | ||
155 | |||
156 | /* stop the URB */ | ||
157 | usb_kill_urb(dib->urb_list[i]); | ||
158 | } | ||
159 | } else | ||
160 | deb_info(" URBs not killed.\n"); | ||
161 | dib->init_state &= ~DIBUSB_STATE_URB_SUBMIT; | ||
162 | return 0; | ||
163 | } | ||
164 | |||
165 | static int dibusb_urb_submit(struct usb_dibusb *dib) | ||
166 | { | ||
167 | int i,ret; | ||
168 | if (dib->init_state & DIBUSB_STATE_URB_INIT) { | ||
169 | for (i = 0; i < dib->dibdev->dev_cl->urb_count; i++) { | ||
170 | deb_info("submitting URB no. %d\n",i); | ||
171 | if ((ret = usb_submit_urb(dib->urb_list[i],GFP_ATOMIC))) { | ||
172 | err("could not submit buffer urb no. %d - get them all back\n",i); | ||
173 | dibusb_urb_kill(dib); | ||
174 | return ret; | ||
175 | } | ||
176 | dib->init_state |= DIBUSB_STATE_URB_SUBMIT; | ||
177 | } | ||
178 | } | ||
179 | return 0; | ||
180 | } | ||
181 | |||
182 | int dibusb_streaming(struct usb_dibusb *dib,int onoff) | ||
183 | { | ||
184 | if (onoff) | ||
185 | dibusb_urb_submit(dib); | ||
186 | else | ||
187 | dibusb_urb_kill(dib); | ||
188 | |||
189 | switch (dib->dibdev->dev_cl->id) { | ||
190 | case DIBUSB2_0: | ||
191 | case DIBUSB2_0B: | ||
192 | case NOVAT_USB2: | ||
193 | case UMT2_0: | ||
194 | if (onoff) | ||
195 | return dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_ENABLE_STREAM,NULL,0); | ||
196 | else | ||
197 | return dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_DISABLE_STREAM,NULL,0); | ||
198 | break; | ||
199 | default: | ||
200 | break; | ||
201 | } | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | int dibusb_urb_init(struct usb_dibusb *dib) | ||
206 | { | ||
207 | int i,bufsize,def_pid_parse = 1; | ||
208 | |||
209 | /* | ||
210 | * when reloading the driver w/o replugging the device | ||
211 | * a timeout occures, this helps | ||
212 | */ | ||
213 | usb_clear_halt(dib->udev,usb_sndbulkpipe(dib->udev,dib->dibdev->dev_cl->pipe_cmd)); | ||
214 | usb_clear_halt(dib->udev,usb_rcvbulkpipe(dib->udev,dib->dibdev->dev_cl->pipe_cmd)); | ||
215 | usb_clear_halt(dib->udev,usb_rcvbulkpipe(dib->udev,dib->dibdev->dev_cl->pipe_data)); | ||
216 | |||
217 | /* allocate the array for the data transfer URBs */ | ||
218 | dib->urb_list = kmalloc(dib->dibdev->dev_cl->urb_count*sizeof(struct urb *),GFP_KERNEL); | ||
219 | if (dib->urb_list == NULL) | ||
220 | return -ENOMEM; | ||
221 | memset(dib->urb_list,0,dib->dibdev->dev_cl->urb_count*sizeof(struct urb *)); | ||
222 | |||
223 | dib->init_state |= DIBUSB_STATE_URB_LIST; | ||
224 | |||
225 | bufsize = dib->dibdev->dev_cl->urb_count*dib->dibdev->dev_cl->urb_buffer_size; | ||
226 | deb_info("allocate %d bytes as buffersize for all URBs\n",bufsize); | ||
227 | /* allocate the actual buffer for the URBs */ | ||
228 | if ((dib->buffer = pci_alloc_consistent(NULL,bufsize,&dib->dma_handle)) == NULL) { | ||
229 | deb_info("not enough memory.\n"); | ||
230 | return -ENOMEM; | ||
231 | } | ||
232 | deb_info("allocation complete\n"); | ||
233 | memset(dib->buffer,0,bufsize); | ||
234 | |||
235 | dib->init_state |= DIBUSB_STATE_URB_BUF; | ||
236 | |||
237 | /* allocate and submit the URBs */ | ||
238 | for (i = 0; i < dib->dibdev->dev_cl->urb_count; i++) { | ||
239 | if (!(dib->urb_list[i] = usb_alloc_urb(0,GFP_ATOMIC))) { | ||
240 | return -ENOMEM; | ||
241 | } | ||
242 | |||
243 | usb_fill_bulk_urb( dib->urb_list[i], dib->udev, | ||
244 | usb_rcvbulkpipe(dib->udev,dib->dibdev->dev_cl->pipe_data), | ||
245 | &dib->buffer[i*dib->dibdev->dev_cl->urb_buffer_size], | ||
246 | dib->dibdev->dev_cl->urb_buffer_size, | ||
247 | dibusb_urb_complete, dib); | ||
248 | |||
249 | dib->urb_list[i]->transfer_flags = 0; | ||
250 | |||
251 | dib->init_state |= DIBUSB_STATE_URB_INIT; | ||
252 | } | ||
253 | |||
254 | /* dib->pid_parse here contains the value of the module parameter */ | ||
255 | /* decide if pid parsing can be deactivated: | ||
256 | * is possible (by device type) and wanted (by user) | ||
257 | */ | ||
258 | switch (dib->dibdev->dev_cl->id) { | ||
259 | case DIBUSB2_0: | ||
260 | case DIBUSB2_0B: | ||
261 | if (dib->udev->speed == USB_SPEED_HIGH && !dib->pid_parse) { | ||
262 | def_pid_parse = 0; | ||
263 | info("running at HIGH speed, will deliver the complete TS."); | ||
264 | } else | ||
265 | info("will use pid_parsing."); | ||
266 | break; | ||
267 | default: | ||
268 | break; | ||
269 | } | ||
270 | /* from here on it contains the device and user decision */ | ||
271 | dib->pid_parse = def_pid_parse; | ||
272 | |||
273 | return 0; | ||
274 | } | ||
275 | |||
276 | int dibusb_urb_exit(struct usb_dibusb *dib) | ||
277 | { | ||
278 | int i; | ||
279 | |||
280 | dibusb_urb_kill(dib); | ||
281 | |||
282 | if (dib->init_state & DIBUSB_STATE_URB_LIST) { | ||
283 | for (i = 0; i < dib->dibdev->dev_cl->urb_count; i++) { | ||
284 | if (dib->urb_list[i] != NULL) { | ||
285 | deb_info("freeing URB no. %d.\n",i); | ||
286 | /* free the URBs */ | ||
287 | usb_free_urb(dib->urb_list[i]); | ||
288 | } | ||
289 | } | ||
290 | /* free the urb array */ | ||
291 | kfree(dib->urb_list); | ||
292 | dib->init_state &= ~DIBUSB_STATE_URB_LIST; | ||
293 | } | ||
294 | |||
295 | if (dib->init_state & DIBUSB_STATE_URB_BUF) | ||
296 | pci_free_consistent(NULL, | ||
297 | dib->dibdev->dev_cl->urb_buffer_size*dib->dibdev->dev_cl->urb_count, | ||
298 | dib->buffer,dib->dma_handle); | ||
299 | |||
300 | dib->init_state &= ~DIBUSB_STATE_URB_BUF; | ||
301 | dib->init_state &= ~DIBUSB_STATE_URB_INIT; | ||
302 | return 0; | ||
303 | } | ||
diff --git a/drivers/media/dvb/dibusb/dvb-dibusb.h b/drivers/media/dvb/dibusb/dvb-dibusb.h deleted file mode 100644 index c965b64fb1ab..000000000000 --- a/drivers/media/dvb/dibusb/dvb-dibusb.h +++ /dev/null | |||
@@ -1,327 +0,0 @@ | |||
1 | /* | ||
2 | * dvb-dibusb.h | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License as | ||
8 | * published by the Free Software Foundation, version 2. | ||
9 | * | ||
10 | * for more information see dvb-dibusb-core.c . | ||
11 | */ | ||
12 | #ifndef __DVB_DIBUSB_H__ | ||
13 | #define __DVB_DIBUSB_H__ | ||
14 | |||
15 | #include <linux/input.h> | ||
16 | #include <linux/config.h> | ||
17 | #include <linux/usb.h> | ||
18 | |||
19 | #include "dvb_frontend.h" | ||
20 | #include "dvb_demux.h" | ||
21 | #include "dvb_net.h" | ||
22 | #include "dmxdev.h" | ||
23 | |||
24 | #include "dib3000.h" | ||
25 | #include "mt352.h" | ||
26 | |||
27 | /* debug */ | ||
28 | #ifdef CONFIG_DVB_DIBCOM_DEBUG | ||
29 | #define dprintk(level,args...) \ | ||
30 | do { if ((dvb_dibusb_debug & level)) { printk(args); } } while (0) | ||
31 | |||
32 | #define debug_dump(b,l) {\ | ||
33 | int i; \ | ||
34 | for (i = 0; i < l; i++) deb_xfer("%02x ", b[i]); \ | ||
35 | deb_xfer("\n");\ | ||
36 | } | ||
37 | |||
38 | #else | ||
39 | #define dprintk(args...) | ||
40 | #define debug_dump(b,l) | ||
41 | #endif | ||
42 | |||
43 | extern int dvb_dibusb_debug; | ||
44 | |||
45 | /* Version information */ | ||
46 | #define DRIVER_VERSION "0.3" | ||
47 | #define DRIVER_DESC "DiBcom based USB Budget DVB-T device" | ||
48 | #define DRIVER_AUTHOR "Patrick Boettcher, patrick.boettcher@desy.de" | ||
49 | |||
50 | #define deb_info(args...) dprintk(0x01,args) | ||
51 | #define deb_xfer(args...) dprintk(0x02,args) | ||
52 | #define deb_alot(args...) dprintk(0x04,args) | ||
53 | #define deb_ts(args...) dprintk(0x08,args) | ||
54 | #define deb_err(args...) dprintk(0x10,args) | ||
55 | #define deb_rc(args...) dprintk(0x20,args) | ||
56 | |||
57 | /* generic log methods - taken from usb.h */ | ||
58 | #undef err | ||
59 | #define err(format, arg...) printk(KERN_ERR "dvb-dibusb: " format "\n" , ## arg) | ||
60 | #undef info | ||
61 | #define info(format, arg...) printk(KERN_INFO "dvb-dibusb: " format "\n" , ## arg) | ||
62 | #undef warn | ||
63 | #define warn(format, arg...) printk(KERN_WARNING "dvb-dibusb: " format "\n" , ## arg) | ||
64 | |||
65 | struct dibusb_usb_controller { | ||
66 | const char *name; /* name of the usb controller */ | ||
67 | u16 cpu_cs_register; /* needs to be restarted, when the firmware has been downloaded. */ | ||
68 | }; | ||
69 | |||
70 | typedef enum { | ||
71 | DIBUSB1_1 = 0, | ||
72 | DIBUSB1_1_AN2235, | ||
73 | DIBUSB2_0, | ||
74 | UMT2_0, | ||
75 | DIBUSB2_0B, | ||
76 | NOVAT_USB2, | ||
77 | DTT200U, | ||
78 | } dibusb_class_t; | ||
79 | |||
80 | typedef enum { | ||
81 | DIBUSB_TUNER_CABLE_THOMSON = 0, | ||
82 | DIBUSB_TUNER_COFDM_PANASONIC_ENV57H1XD5, | ||
83 | DIBUSB_TUNER_CABLE_LG_TDTP_E102P, | ||
84 | DIBUSB_TUNER_COFDM_PANASONIC_ENV77H11D5, | ||
85 | } dibusb_tuner_t; | ||
86 | |||
87 | typedef enum { | ||
88 | DIBUSB_DIB3000MB = 0, | ||
89 | DIBUSB_DIB3000MC, | ||
90 | DIBUSB_MT352, | ||
91 | DTT200U_FE, | ||
92 | } dibusb_demodulator_t; | ||
93 | |||
94 | typedef enum { | ||
95 | DIBUSB_RC_NO = 0, | ||
96 | DIBUSB_RC_NEC_PROTOCOL, | ||
97 | DIBUSB_RC_HAUPPAUGE_PROTO, | ||
98 | } dibusb_remote_t; | ||
99 | |||
100 | struct dibusb_tuner { | ||
101 | dibusb_tuner_t id; | ||
102 | |||
103 | u8 pll_addr; /* tuner i2c address */ | ||
104 | }; | ||
105 | extern struct dibusb_tuner dibusb_tuner[]; | ||
106 | |||
107 | #define DIBUSB_POSSIBLE_I2C_ADDR_NUM 4 | ||
108 | struct dibusb_demod { | ||
109 | dibusb_demodulator_t id; | ||
110 | |||
111 | int pid_filter_count; /* counter of the internal pid_filter */ | ||
112 | u8 i2c_addrs[DIBUSB_POSSIBLE_I2C_ADDR_NUM]; /* list of possible i2c addresses of the demod */ | ||
113 | }; | ||
114 | |||
115 | #define DIBUSB_MAX_TUNER_NUM 2 | ||
116 | struct dibusb_device_class { | ||
117 | dibusb_class_t id; | ||
118 | |||
119 | const struct dibusb_usb_controller *usb_ctrl; /* usb controller */ | ||
120 | const char *firmware; /* valid firmware filenames */ | ||
121 | |||
122 | int pipe_cmd; /* command pipe (read/write) */ | ||
123 | int pipe_data; /* data pipe */ | ||
124 | |||
125 | int urb_count; /* number of data URBs to be submitted */ | ||
126 | int urb_buffer_size; /* the size of the buffer for each URB */ | ||
127 | |||
128 | dibusb_remote_t remote_type; /* does this device have a ir-receiver */ | ||
129 | |||
130 | struct dibusb_demod *demod; /* which demodulator is mount */ | ||
131 | struct dibusb_tuner *tuner; /* which tuner can be found here */ | ||
132 | }; | ||
133 | |||
134 | #define DIBUSB_ID_MAX_NUM 15 | ||
135 | struct dibusb_usb_device { | ||
136 | const char *name; /* real name of the box */ | ||
137 | struct dibusb_device_class *dev_cl; /* which dibusb_device_class is this device part of */ | ||
138 | |||
139 | struct usb_device_id *cold_ids[DIBUSB_ID_MAX_NUM]; /* list of USB ids when this device is at pre firmware state */ | ||
140 | struct usb_device_id *warm_ids[DIBUSB_ID_MAX_NUM]; /* list of USB ids when this device is at post firmware state */ | ||
141 | }; | ||
142 | |||
143 | /* a PID for the pid_filter list, when in use */ | ||
144 | struct dibusb_pid | ||
145 | { | ||
146 | int index; | ||
147 | u16 pid; | ||
148 | int active; | ||
149 | }; | ||
150 | |||
151 | struct usb_dibusb { | ||
152 | /* usb */ | ||
153 | struct usb_device * udev; | ||
154 | |||
155 | struct dibusb_usb_device * dibdev; | ||
156 | |||
157 | #define DIBUSB_STATE_INIT 0x000 | ||
158 | #define DIBUSB_STATE_URB_LIST 0x001 | ||
159 | #define DIBUSB_STATE_URB_BUF 0x002 | ||
160 | #define DIBUSB_STATE_URB_INIT 0x004 | ||
161 | #define DIBUSB_STATE_DVB 0x008 | ||
162 | #define DIBUSB_STATE_I2C 0x010 | ||
163 | #define DIBUSB_STATE_REMOTE 0x020 | ||
164 | #define DIBUSB_STATE_URB_SUBMIT 0x040 | ||
165 | int init_state; | ||
166 | |||
167 | int feedcount; | ||
168 | struct dib_fe_xfer_ops xfer_ops; | ||
169 | |||
170 | struct dibusb_tuner *tuner; | ||
171 | |||
172 | struct urb **urb_list; | ||
173 | u8 *buffer; | ||
174 | dma_addr_t dma_handle; | ||
175 | |||
176 | /* I2C */ | ||
177 | struct i2c_adapter i2c_adap; | ||
178 | |||
179 | /* locking */ | ||
180 | struct semaphore usb_sem; | ||
181 | struct semaphore i2c_sem; | ||
182 | |||
183 | /* dvb */ | ||
184 | struct dvb_adapter adapter; | ||
185 | struct dmxdev dmxdev; | ||
186 | struct dvb_demux demux; | ||
187 | struct dvb_net dvb_net; | ||
188 | struct dvb_frontend* fe; | ||
189 | |||
190 | int (*fe_sleep) (struct dvb_frontend *); | ||
191 | int (*fe_init) (struct dvb_frontend *); | ||
192 | |||
193 | /* remote control */ | ||
194 | struct input_dev rc_input_dev; | ||
195 | struct work_struct rc_query_work; | ||
196 | int last_event; | ||
197 | int last_state; /* for Hauppauge RC protocol */ | ||
198 | int repeat_key_count; | ||
199 | int rc_key_repeat_count; /* module parameter */ | ||
200 | |||
201 | /* module parameters */ | ||
202 | int pid_parse; | ||
203 | int rc_query_interval; | ||
204 | }; | ||
205 | |||
206 | /* commonly used functions in the separated files */ | ||
207 | |||
208 | /* dvb-dibusb-firmware.c */ | ||
209 | int dibusb_loadfirmware(struct usb_device *udev, struct dibusb_usb_device *dibdev); | ||
210 | |||
211 | /* dvb-dibusb-remote.c */ | ||
212 | int dibusb_remote_exit(struct usb_dibusb *dib); | ||
213 | int dibusb_remote_init(struct usb_dibusb *dib); | ||
214 | |||
215 | /* dvb-dibusb-fe-i2c.c */ | ||
216 | int dibusb_fe_init(struct usb_dibusb* dib); | ||
217 | int dibusb_fe_exit(struct usb_dibusb *dib); | ||
218 | int dibusb_i2c_init(struct usb_dibusb *dib); | ||
219 | int dibusb_i2c_exit(struct usb_dibusb *dib); | ||
220 | |||
221 | /* dvb-dibusb-dvb.c */ | ||
222 | void dibusb_urb_complete(struct urb *urb, struct pt_regs *ptregs); | ||
223 | int dibusb_dvb_init(struct usb_dibusb *dib); | ||
224 | int dibusb_dvb_exit(struct usb_dibusb *dib); | ||
225 | |||
226 | /* dvb-dibusb-usb.c */ | ||
227 | int dibusb_readwrite_usb(struct usb_dibusb *dib, u8 *wbuf, u16 wlen, u8 *rbuf, | ||
228 | u16 rlen); | ||
229 | int dibusb_write_usb(struct usb_dibusb *dib, u8 *buf, u16 len); | ||
230 | |||
231 | int dibusb_hw_wakeup(struct dvb_frontend *); | ||
232 | int dibusb_hw_sleep(struct dvb_frontend *); | ||
233 | int dibusb_set_streaming_mode(struct usb_dibusb *,u8); | ||
234 | int dibusb_streaming(struct usb_dibusb *,int); | ||
235 | |||
236 | int dibusb_urb_init(struct usb_dibusb *); | ||
237 | int dibusb_urb_exit(struct usb_dibusb *); | ||
238 | |||
239 | /* dvb-fe-dtt200u.c */ | ||
240 | struct dvb_frontend* dtt200u_fe_attach(struct usb_dibusb *,struct dib_fe_xfer_ops *); | ||
241 | |||
242 | /* i2c and transfer stuff */ | ||
243 | #define DIBUSB_I2C_TIMEOUT 5000 | ||
244 | |||
245 | /* | ||
246 | * protocol of all dibusb related devices | ||
247 | */ | ||
248 | |||
249 | /* | ||
250 | * bulk msg to/from endpoint 0x01 | ||
251 | * | ||
252 | * general structure: | ||
253 | * request_byte parameter_bytes | ||
254 | */ | ||
255 | |||
256 | #define DIBUSB_REQ_START_READ 0x00 | ||
257 | #define DIBUSB_REQ_START_DEMOD 0x01 | ||
258 | |||
259 | /* | ||
260 | * i2c read | ||
261 | * bulk write: 0x02 ((7bit i2c_addr << 1) & 0x01) register_bytes length_word | ||
262 | * bulk read: byte_buffer (length_word bytes) | ||
263 | */ | ||
264 | #define DIBUSB_REQ_I2C_READ 0x02 | ||
265 | |||
266 | /* | ||
267 | * i2c write | ||
268 | * bulk write: 0x03 (7bit i2c_addr << 1) register_bytes value_bytes | ||
269 | */ | ||
270 | #define DIBUSB_REQ_I2C_WRITE 0x03 | ||
271 | |||
272 | /* | ||
273 | * polling the value of the remote control | ||
274 | * bulk write: 0x04 | ||
275 | * bulk read: byte_buffer (5 bytes) | ||
276 | * | ||
277 | * first byte of byte_buffer shows the status (0x00, 0x01, 0x02) | ||
278 | */ | ||
279 | #define DIBUSB_REQ_POLL_REMOTE 0x04 | ||
280 | |||
281 | #define DIBUSB_RC_NEC_EMPTY 0x00 | ||
282 | #define DIBUSB_RC_NEC_KEY_PRESSED 0x01 | ||
283 | #define DIBUSB_RC_NEC_KEY_REPEATED 0x02 | ||
284 | |||
285 | /* additional status values for Hauppauge Remote Control Protocol */ | ||
286 | #define DIBUSB_RC_HAUPPAUGE_KEY_PRESSED 0x01 | ||
287 | #define DIBUSB_RC_HAUPPAUGE_KEY_EMPTY 0x03 | ||
288 | |||
289 | /* streaming mode: | ||
290 | * bulk write: 0x05 mode_byte | ||
291 | * | ||
292 | * mode_byte is mostly 0x00 | ||
293 | */ | ||
294 | #define DIBUSB_REQ_SET_STREAMING_MODE 0x05 | ||
295 | |||
296 | /* interrupt the internal read loop, when blocking */ | ||
297 | #define DIBUSB_REQ_INTR_READ 0x06 | ||
298 | |||
299 | /* io control | ||
300 | * 0x07 cmd_byte param_bytes | ||
301 | * | ||
302 | * param_bytes can be up to 32 bytes | ||
303 | * | ||
304 | * cmd_byte function parameter name | ||
305 | * 0x00 power mode | ||
306 | * 0x00 sleep | ||
307 | * 0x01 wakeup | ||
308 | * | ||
309 | * 0x01 enable streaming | ||
310 | * 0x02 disable streaming | ||
311 | * | ||
312 | * | ||
313 | */ | ||
314 | #define DIBUSB_REQ_SET_IOCTL 0x07 | ||
315 | |||
316 | /* IOCTL commands */ | ||
317 | |||
318 | /* change the power mode in firmware */ | ||
319 | #define DIBUSB_IOCTL_CMD_POWER_MODE 0x00 | ||
320 | #define DIBUSB_IOCTL_POWER_SLEEP 0x00 | ||
321 | #define DIBUSB_IOCTL_POWER_WAKEUP 0x01 | ||
322 | |||
323 | /* modify streaming of the FX2 */ | ||
324 | #define DIBUSB_IOCTL_CMD_ENABLE_STREAM 0x01 | ||
325 | #define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02 | ||
326 | |||
327 | #endif | ||
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index d19301d90a09..d6b7a9de471e 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/moduleparam.h> | 35 | #include <linux/moduleparam.h> |
36 | #include <linux/list.h> | 36 | #include <linux/list.h> |
37 | #include <linux/suspend.h> | 37 | #include <linux/suspend.h> |
38 | #include <linux/jiffies.h> | ||
38 | #include <asm/processor.h> | 39 | #include <asm/processor.h> |
39 | #include <asm/semaphore.h> | 40 | #include <asm/semaphore.h> |
40 | 41 | ||
@@ -327,7 +328,8 @@ static int dvb_frontend_is_exiting(struct dvb_frontend *fe) | |||
327 | return 1; | 328 | return 1; |
328 | 329 | ||
329 | if (fepriv->dvbdev->writers == 1) | 330 | if (fepriv->dvbdev->writers == 1) |
330 | if (jiffies - fepriv->release_jiffies > dvb_shutdown_timeout * HZ) | 331 | if (time_after(jiffies, fepriv->release_jiffies + |
332 | dvb_shutdown_timeout * HZ)) | ||
331 | return 1; | 333 | return 1; |
332 | 334 | ||
333 | return 0; | 335 | return 0; |
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig new file mode 100644 index 000000000000..8aa32f6e447b --- /dev/null +++ b/drivers/media/dvb/dvb-usb/Kconfig | |||
@@ -0,0 +1,99 @@ | |||
1 | config DVB_USB | ||
2 | tristate "Support for various USB DVB devices" | ||
3 | depends on DVB_CORE && USB | ||
4 | select FW_LOADER | ||
5 | help | ||
6 | By enabling this you will be able to choose the various USB 1.1 and | ||
7 | USB2.0 DVB devices. | ||
8 | |||
9 | Almost every USB device needs a firmware, please look into | ||
10 | <file:Documentation/dvb/README.dvb-usb> | ||
11 | |||
12 | Say Y if you own an USB DVB device. | ||
13 | |||
14 | config DVB_USB_DEBUG | ||
15 | bool "Enable extended debug support for all DVB-USB devices" | ||
16 | depends on DVB_USB | ||
17 | help | ||
18 | Say Y if you want to enable debuging. See modinfo dvb-usb (and the | ||
19 | appropriate drivers) for debug levels. | ||
20 | |||
21 | config DVB_USB_A800 | ||
22 | tristate "AVerMedia AverTV DVB-T USB 2.0 (A800)" | ||
23 | depends on DVB_USB | ||
24 | help | ||
25 | Say Y here to support the AVerMedia AverTV DVB-T USB 2.0 (A800) receiver. | ||
26 | |||
27 | config DVB_USB_DIBUSB_MB | ||
28 | tristate "DiBcom USB DVB-T devices (based on the DiB3000M-B) (see help for device list)" | ||
29 | depends on DVB_USB | ||
30 | help | ||
31 | Support for USB 1.1 and 2.0 DVB-T receivers based on reference designs made by | ||
32 | DiBcom (<http://www.dibcom.fr>) equipped with a DiB3000M-B demodulator. | ||
33 | |||
34 | Devices supported by this driver: | ||
35 | TwinhanDTV USB-Ter (VP7041) | ||
36 | TwinhanDTV Magic Box (VP7041e) | ||
37 | KWorld/JetWay/ADSTech V-Stream XPERT DTV - DVB-T USB1.1 and USB2.0 | ||
38 | Hama DVB-T USB1.1-Box | ||
39 | DiBcom USB1.1 reference devices (non-public) | ||
40 | Ultima Electronic/Artec T1 USB TVBOX | ||
41 | Compro Videomate DVB-U2000 - DVB-T USB | ||
42 | Grandtec DVB-T USB | ||
43 | Avermedia AverTV DVBT USB1.1 | ||
44 | Artec T1 USB1.1 boxes | ||
45 | |||
46 | The VP7041 seems to be identical to "CTS Portable" (Chinese | ||
47 | Television System). | ||
48 | |||
49 | Say Y if you own such a device and want to use it. You should build it as | ||
50 | a module. | ||
51 | |||
52 | config DVB_USB_DIBUSB_MC | ||
53 | tristate "DiBcom USB DVB-T devices (based on the DiB3000M-C/P) (see help for device list)" | ||
54 | depends on DVB_USB | ||
55 | help | ||
56 | Support for 2.0 DVB-T receivers based on reference designs made by | ||
57 | DiBcom (<http://www.dibcom.fr>) equipped with a DiB3000M-C/P demodulator. | ||
58 | |||
59 | Devices supported by this driver: | ||
60 | DiBcom USB2.0 reference devices (non-public) | ||
61 | Artec T1 USB2.0 boxes | ||
62 | |||
63 | Say Y if you own such a device and want to use it. You should build it as | ||
64 | a module. | ||
65 | |||
66 | config DVB_USB_UMT_010 | ||
67 | tristate "HanfTek UMT-010 DVB-T USB2.0 support" | ||
68 | depends on DVB_USB | ||
69 | help | ||
70 | Say Y here to support the HanfTek UMT-010 USB2.0 stick-sized DVB-T receiver. | ||
71 | |||
72 | config DVB_USB_DIGITV | ||
73 | tristate "Nebula Electronics uDigiTV DVB-T USB2.0 support" | ||
74 | depends on DVB_USB | ||
75 | help | ||
76 | Say Y here to support the Nebula Electronics uDigitV USB2.0 DVB-T receiver. | ||
77 | |||
78 | config DVB_USB_VP7045 | ||
79 | tristate "TwinhanDTV Alpha/MagicBoxII and DNTV tinyUSB2 DVB-T USB2.0 support" | ||
80 | depends on DVB_USB | ||
81 | help | ||
82 | Say Y here to support the | ||
83 | TwinhanDTV Alpha (stick) (VP-7045), | ||
84 | TwinhanDTV MagicBox II (VP-7046) and | ||
85 | DigitalNow TinyUSB 2 DVB-t DVB-T USB2.0 receivers. | ||
86 | |||
87 | config DVB_USB_NOVA_T_USB2 | ||
88 | tristate "Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 support" | ||
89 | depends on DVB_USB | ||
90 | help | ||
91 | Say Y here to support the Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 receiver. | ||
92 | |||
93 | config DVB_USB_DTT200U | ||
94 | tristate "Yakumo/Hama/Typhoon/Yuan DVB-T USB2.0 support" | ||
95 | depends on DVB_USB | ||
96 | help | ||
97 | Say Y here to support the Yakumo/Hama/Typhoon/Yuan DVB-T USB2.0 receiver. | ||
98 | |||
99 | The receivers are also known as DTT200U (Yakumo) and UB300 (Yuan). | ||
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile new file mode 100644 index 000000000000..d65b50f9abb0 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/Makefile | |||
@@ -0,0 +1,30 @@ | |||
1 | dvb-usb-objs = dvb-usb-firmware.o dvb-usb-init.o dvb-usb-urb.o dvb-usb-i2c.o dvb-usb-dvb.o dvb-usb-remote.o | ||
2 | obj-$(CONFIG_DVB_USB) += dvb-usb.o | ||
3 | |||
4 | dvb-usb-vp7045-objs = vp7045.o vp7045-fe.o | ||
5 | obj-$(CONFIG_DVB_USB_VP7045) += dvb-usb-vp7045.o | ||
6 | |||
7 | dvb-usb-dtt200u-objs = dtt200u.o dtt200u-fe.o | ||
8 | obj-$(CONFIG_DVB_USB_DTT200U) += dvb-usb-dtt200u.o | ||
9 | |||
10 | dvb-usb-dibusb-common-objs = dibusb-common.o | ||
11 | |||
12 | dvb-usb-a800-objs = a800.o | ||
13 | obj-$(CONFIG_DVB_USB_A800) += dvb-usb-dibusb-common.o dvb-usb-a800.o | ||
14 | |||
15 | dvb-usb-dibusb-mb-objs = dibusb-mb.o | ||
16 | obj-$(CONFIG_DVB_USB_DIBUSB_MB) += dvb-usb-dibusb-common.o dvb-usb-dibusb-mb.o | ||
17 | |||
18 | dvb-usb-dibusb-mc-objs = dibusb-mc.o | ||
19 | obj-$(CONFIG_DVB_USB_DIBUSB_MC) += dvb-usb-dibusb-common.o dvb-usb-dibusb-mc.o | ||
20 | |||
21 | dvb-usb-nova-t-usb2-objs = nova-t-usb2.o | ||
22 | obj-$(CONFIG_DVB_USB_NOVA_T_USB2) += dvb-usb-dibusb-common.o dvb-usb-nova-t-usb2.o | ||
23 | |||
24 | dvb-usb-umt-010-objs = umt-010.o | ||
25 | obj-$(CONFIG_DVB_USB_UMT_010) += dvb-usb-dibusb-common.o dvb-usb-umt-010.o | ||
26 | |||
27 | dvb-usb-digitv-objs = digitv.o | ||
28 | obj-$(CONFIG_DVB_USB_DIGITV) += dvb-usb-digitv.o | ||
29 | |||
30 | EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ | ||
diff --git a/drivers/media/dvb/dvb-usb/a800.c b/drivers/media/dvb/dvb-usb/a800.c new file mode 100644 index 000000000000..a3542935604f --- /dev/null +++ b/drivers/media/dvb/dvb-usb/a800.c | |||
@@ -0,0 +1,176 @@ | |||
1 | /* DVB USB framework compliant Linux driver for the AVerMedia AverTV DVB-T | ||
2 | * USB2.0 (A800) DVB-T receiver. | ||
3 | * | ||
4 | * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * Thanks to | ||
7 | * - AVerMedia who kindly provided information and | ||
8 | * - Glen Harris who suffered from my mistakes during development. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the Free | ||
12 | * Software Foundation, version 2. | ||
13 | * | ||
14 | * see Documentation/dvb/README.dvb-usb for more information | ||
15 | */ | ||
16 | #include "dibusb.h" | ||
17 | |||
18 | static int debug; | ||
19 | module_param(debug, int, 0644); | ||
20 | MODULE_PARM_DESC(debug, "set debugging level (rc=1 (or-able))." DVB_USB_DEBUG_STATUS); | ||
21 | #define deb_rc(args...) dprintk(debug,0x01,args) | ||
22 | |||
23 | static int a800_power_ctrl(struct dvb_usb_device *d, int onoff) | ||
24 | { | ||
25 | /* do nothing for the AVerMedia */ | ||
26 | return 0; | ||
27 | } | ||
28 | |||
29 | static struct dvb_usb_rc_key a800_rc_keys[] = { | ||
30 | { 0x02, 0x01, KEY_PROG1 }, /* SOURCE */ | ||
31 | { 0x02, 0x00, KEY_POWER }, /* POWER */ | ||
32 | { 0x02, 0x05, KEY_1 }, /* 1 */ | ||
33 | { 0x02, 0x06, KEY_2 }, /* 2 */ | ||
34 | { 0x02, 0x07, KEY_3 }, /* 3 */ | ||
35 | { 0x02, 0x09, KEY_4 }, /* 4 */ | ||
36 | { 0x02, 0x0a, KEY_5 }, /* 5 */ | ||
37 | { 0x02, 0x0b, KEY_6 }, /* 6 */ | ||
38 | { 0x02, 0x0d, KEY_7 }, /* 7 */ | ||
39 | { 0x02, 0x0e, KEY_8 }, /* 8 */ | ||
40 | { 0x02, 0x0f, KEY_9 }, /* 9 */ | ||
41 | { 0x02, 0x12, KEY_LEFT }, /* L / DISPLAY */ | ||
42 | { 0x02, 0x11, KEY_0 }, /* 0 */ | ||
43 | { 0x02, 0x13, KEY_RIGHT }, /* R / CH RTN */ | ||
44 | { 0x02, 0x17, KEY_PROG2 }, /* SNAP SHOT */ | ||
45 | { 0x02, 0x10, KEY_PROG3 }, /* 16-CH PREV */ | ||
46 | { 0x02, 0x03, KEY_CHANNELUP }, /* CH UP */ | ||
47 | { 0x02, 0x1e, KEY_VOLUMEDOWN }, /* VOL DOWN */ | ||
48 | { 0x02, 0x0c, KEY_ZOOM }, /* FULL SCREEN */ | ||
49 | { 0x02, 0x1f, KEY_VOLUMEUP }, /* VOL UP */ | ||
50 | { 0x02, 0x02, KEY_CHANNELDOWN }, /* CH DOWN */ | ||
51 | { 0x02, 0x14, KEY_MUTE }, /* MUTE */ | ||
52 | { 0x02, 0x08, KEY_AUDIO }, /* AUDIO */ | ||
53 | { 0x02, 0x19, KEY_RECORD }, /* RECORD */ | ||
54 | { 0x02, 0x18, KEY_PLAY }, /* PLAY */ | ||
55 | { 0x02, 0x1b, KEY_STOP }, /* STOP */ | ||
56 | { 0x02, 0x1a, KEY_PLAYPAUSE }, /* TIMESHIFT / PAUSE */ | ||
57 | { 0x02, 0x1d, KEY_BACK }, /* << / RED */ | ||
58 | { 0x02, 0x1c, KEY_FORWARD }, /* >> / YELLOW */ | ||
59 | { 0x02, 0x03, KEY_TEXT }, /* TELETEXT */ | ||
60 | { 0x02, 0x01, KEY_FIRST }, /* |<< / GREEN */ | ||
61 | { 0x02, 0x00, KEY_LAST }, /* >>| / BLUE */ | ||
62 | { 0x02, 0x04, KEY_EPG }, /* EPG */ | ||
63 | { 0x02, 0x15, KEY_MENU }, /* MENU */ | ||
64 | }; | ||
65 | |||
66 | int a800_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | ||
67 | { | ||
68 | u8 key[5]; | ||
69 | if (usb_control_msg(d->udev,usb_rcvctrlpipe(d->udev,0), | ||
70 | 0x04, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, key, 5, | ||
71 | 2*HZ) != 5) | ||
72 | return -ENODEV; | ||
73 | |||
74 | /* call the universal NEC remote processor, to find out the key's state and event */ | ||
75 | dvb_usb_nec_rc_key_to_event(d,key,event,state); | ||
76 | if (key[0] != 0) | ||
77 | deb_rc("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]); | ||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | /* USB Driver stuff */ | ||
82 | static struct dvb_usb_properties a800_properties; | ||
83 | |||
84 | static int a800_probe(struct usb_interface *intf, | ||
85 | const struct usb_device_id *id) | ||
86 | { | ||
87 | return dvb_usb_device_init(intf,&a800_properties,THIS_MODULE); | ||
88 | } | ||
89 | |||
90 | /* do not change the order of the ID table */ | ||
91 | static struct usb_device_id a800_table [] = { | ||
92 | /* 00 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB2_COLD) }, | ||
93 | /* 01 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB2_WARM) }, | ||
94 | { } /* Terminating entry */ | ||
95 | }; | ||
96 | MODULE_DEVICE_TABLE (usb, a800_table); | ||
97 | |||
98 | static struct dvb_usb_properties a800_properties = { | ||
99 | .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, | ||
100 | .pid_filter_count = 32, | ||
101 | |||
102 | .usb_ctrl = CYPRESS_FX2, | ||
103 | |||
104 | .firmware = "dvb-usb-avertv-a800-02.fw", | ||
105 | |||
106 | .size_of_priv = sizeof(struct dibusb_state), | ||
107 | |||
108 | .streaming_ctrl = dibusb2_0_streaming_ctrl, | ||
109 | .pid_filter = dibusb_pid_filter, | ||
110 | .pid_filter_ctrl = dibusb_pid_filter_ctrl, | ||
111 | .power_ctrl = a800_power_ctrl, | ||
112 | .frontend_attach = dibusb_dib3000mc_frontend_attach, | ||
113 | .tuner_attach = dibusb_dib3000mc_tuner_attach, | ||
114 | |||
115 | .rc_interval = DEFAULT_RC_INTERVAL, | ||
116 | .rc_key_map = a800_rc_keys, | ||
117 | .rc_key_map_size = ARRAY_SIZE(a800_rc_keys), | ||
118 | .rc_query = a800_rc_query, | ||
119 | |||
120 | .i2c_algo = &dibusb_i2c_algo, | ||
121 | |||
122 | .generic_bulk_ctrl_endpoint = 0x01, | ||
123 | /* parameter for the MPEG2-data transfer */ | ||
124 | .urb = { | ||
125 | .type = DVB_USB_BULK, | ||
126 | .count = 7, | ||
127 | .endpoint = 0x06, | ||
128 | .u = { | ||
129 | .bulk = { | ||
130 | .buffersize = 4096, | ||
131 | } | ||
132 | } | ||
133 | }, | ||
134 | |||
135 | .num_device_descs = 1, | ||
136 | .devices = { | ||
137 | { "AVerMedia AverTV DVB-T USB 2.0 (A800)", | ||
138 | { &a800_table[0], NULL }, | ||
139 | { &a800_table[1], NULL }, | ||
140 | }, | ||
141 | } | ||
142 | }; | ||
143 | |||
144 | static struct usb_driver a800_driver = { | ||
145 | .owner = THIS_MODULE, | ||
146 | .name = "AVerMedia AverTV DVB-T USB 2.0 (A800)", | ||
147 | .probe = a800_probe, | ||
148 | .disconnect = dvb_usb_device_exit, | ||
149 | .id_table = a800_table, | ||
150 | }; | ||
151 | |||
152 | /* module stuff */ | ||
153 | static int __init a800_module_init(void) | ||
154 | { | ||
155 | int result; | ||
156 | if ((result = usb_register(&a800_driver))) { | ||
157 | err("usb_register failed. Error number %d",result); | ||
158 | return result; | ||
159 | } | ||
160 | |||
161 | return 0; | ||
162 | } | ||
163 | |||
164 | static void __exit a800_module_exit(void) | ||
165 | { | ||
166 | /* deregister this driver from the USB subsystem */ | ||
167 | usb_deregister(&a800_driver); | ||
168 | } | ||
169 | |||
170 | module_init (a800_module_init); | ||
171 | module_exit (a800_module_exit); | ||
172 | |||
173 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
174 | MODULE_DESCRIPTION("AVerMedia AverTV DVB-T USB 2.0 (A800)"); | ||
175 | MODULE_VERSION("1.0"); | ||
176 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c new file mode 100644 index 000000000000..63b626f70c81 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dibusb-common.c | |||
@@ -0,0 +1,272 @@ | |||
1 | /* Common methods for dibusb-based-receivers. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
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 Free | ||
7 | * Software Foundation, version 2. | ||
8 | * | ||
9 | * see Documentation/dvb/README.dvb-usb for more information | ||
10 | */ | ||
11 | #include "dibusb.h" | ||
12 | |||
13 | static int debug; | ||
14 | module_param(debug, int, 0644); | ||
15 | MODULE_PARM_DESC(debug, "set debugging level (1=info (|-able))." DVB_USB_DEBUG_STATUS); | ||
16 | MODULE_LICENSE("GPL"); | ||
17 | |||
18 | #define deb_info(args...) dprintk(debug,0x01,args) | ||
19 | |||
20 | /* common stuff used by the different dibusb modules */ | ||
21 | int dibusb_streaming_ctrl(struct dvb_usb_device *d, int onoff) | ||
22 | { | ||
23 | if (d->priv != NULL) { | ||
24 | struct dib_fe_xfer_ops *ops = d->priv; | ||
25 | if (ops->fifo_ctrl != NULL) | ||
26 | if (ops->fifo_ctrl(d->fe,onoff)) { | ||
27 | err("error while controlling the fifo of the demod."); | ||
28 | return -ENODEV; | ||
29 | } | ||
30 | } | ||
31 | return 0; | ||
32 | } | ||
33 | EXPORT_SYMBOL(dibusb_streaming_ctrl); | ||
34 | |||
35 | int dibusb_pid_filter(struct dvb_usb_device *d, int index, u16 pid, int onoff) | ||
36 | { | ||
37 | if (d->priv != NULL) { | ||
38 | struct dib_fe_xfer_ops *ops = d->priv; | ||
39 | if (d->pid_filtering && ops->pid_ctrl != NULL) | ||
40 | ops->pid_ctrl(d->fe,index,pid,onoff); | ||
41 | } | ||
42 | return 0; | ||
43 | } | ||
44 | EXPORT_SYMBOL(dibusb_pid_filter); | ||
45 | |||
46 | int dibusb_pid_filter_ctrl(struct dvb_usb_device *d, int onoff) | ||
47 | { | ||
48 | if (d->priv != NULL) { | ||
49 | struct dib_fe_xfer_ops *ops = d->priv; | ||
50 | if (ops->pid_parse != NULL) | ||
51 | if (ops->pid_parse(d->fe,onoff) < 0) | ||
52 | err("could not handle pid_parser"); | ||
53 | } | ||
54 | return 0; | ||
55 | } | ||
56 | EXPORT_SYMBOL(dibusb_pid_filter_ctrl); | ||
57 | |||
58 | int dibusb_power_ctrl(struct dvb_usb_device *d, int onoff) | ||
59 | { | ||
60 | u8 b[3]; | ||
61 | int ret; | ||
62 | b[0] = DIBUSB_REQ_SET_IOCTL; | ||
63 | b[1] = DIBUSB_IOCTL_CMD_POWER_MODE; | ||
64 | b[2] = onoff ? DIBUSB_IOCTL_POWER_WAKEUP : DIBUSB_IOCTL_POWER_SLEEP; | ||
65 | ret = dvb_usb_generic_write(d,b,3); | ||
66 | msleep(10); | ||
67 | return ret; | ||
68 | } | ||
69 | EXPORT_SYMBOL(dibusb_power_ctrl); | ||
70 | |||
71 | int dibusb2_0_streaming_ctrl(struct dvb_usb_device *d, int onoff) | ||
72 | { | ||
73 | u8 b[2]; | ||
74 | b[0] = DIBUSB_REQ_SET_IOCTL; | ||
75 | b[1] = onoff ? DIBUSB_IOCTL_CMD_ENABLE_STREAM : DIBUSB_IOCTL_CMD_DISABLE_STREAM; | ||
76 | |||
77 | dvb_usb_generic_write(d,b,3); | ||
78 | |||
79 | return dibusb_streaming_ctrl(d,onoff); | ||
80 | } | ||
81 | EXPORT_SYMBOL(dibusb2_0_streaming_ctrl); | ||
82 | |||
83 | int dibusb2_0_power_ctrl(struct dvb_usb_device *d, int onoff) | ||
84 | { | ||
85 | if (onoff) { | ||
86 | u8 b[3] = { DIBUSB_REQ_SET_IOCTL, DIBUSB_IOCTL_CMD_POWER_MODE, DIBUSB_IOCTL_POWER_WAKEUP }; | ||
87 | return dvb_usb_generic_write(d,b,3); | ||
88 | } else | ||
89 | return 0; | ||
90 | } | ||
91 | EXPORT_SYMBOL(dibusb2_0_power_ctrl); | ||
92 | |||
93 | static int dibusb_i2c_msg(struct dvb_usb_device *d, u8 addr, | ||
94 | u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) | ||
95 | { | ||
96 | u8 sndbuf[wlen+4]; /* lead(1) devaddr,direction(1) addr(2) data(wlen) (len(2) (when reading)) */ | ||
97 | /* write only ? */ | ||
98 | int wo = (rbuf == NULL || rlen == 0), | ||
99 | len = 2 + wlen + (wo ? 0 : 2); | ||
100 | |||
101 | sndbuf[0] = wo ? DIBUSB_REQ_I2C_WRITE : DIBUSB_REQ_I2C_READ; | ||
102 | sndbuf[1] = (addr << 1) | (wo ? 0 : 1); | ||
103 | |||
104 | memcpy(&sndbuf[2],wbuf,wlen); | ||
105 | |||
106 | if (!wo) { | ||
107 | sndbuf[wlen+2] = (rlen >> 8) & 0xff; | ||
108 | sndbuf[wlen+3] = rlen & 0xff; | ||
109 | } | ||
110 | |||
111 | return dvb_usb_generic_rw(d,sndbuf,len,rbuf,rlen,0); | ||
112 | } | ||
113 | |||
114 | /* | ||
115 | * I2C master xfer function | ||
116 | */ | ||
117 | static int dibusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | ||
118 | { | ||
119 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | ||
120 | int i; | ||
121 | |||
122 | if (down_interruptible(&d->i2c_sem) < 0) | ||
123 | return -EAGAIN; | ||
124 | |||
125 | if (num > 2) | ||
126 | warn("more than 2 i2c messages at a time is not handled yet. TODO."); | ||
127 | |||
128 | for (i = 0; i < num; i++) { | ||
129 | /* write/read request */ | ||
130 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { | ||
131 | if (dibusb_i2c_msg(d, msg[i].addr, msg[i].buf,msg[i].len, | ||
132 | msg[i+1].buf,msg[i+1].len) < 0) | ||
133 | break; | ||
134 | i++; | ||
135 | } else | ||
136 | if (dibusb_i2c_msg(d, msg[i].addr, msg[i].buf,msg[i].len,NULL,0) < 0) | ||
137 | break; | ||
138 | } | ||
139 | |||
140 | up(&d->i2c_sem); | ||
141 | return i; | ||
142 | } | ||
143 | |||
144 | static u32 dibusb_i2c_func(struct i2c_adapter *adapter) | ||
145 | { | ||
146 | return I2C_FUNC_I2C; | ||
147 | } | ||
148 | |||
149 | struct i2c_algorithm dibusb_i2c_algo = { | ||
150 | .name = "DiBcom USB I2C algorithm", | ||
151 | .id = I2C_ALGO_BIT, | ||
152 | .master_xfer = dibusb_i2c_xfer, | ||
153 | .functionality = dibusb_i2c_func, | ||
154 | }; | ||
155 | EXPORT_SYMBOL(dibusb_i2c_algo); | ||
156 | |||
157 | int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val) | ||
158 | { | ||
159 | u8 wbuf[1] = { offs }; | ||
160 | return dibusb_i2c_msg(d, 0x50, wbuf, 1, val, 1); | ||
161 | } | ||
162 | EXPORT_SYMBOL(dibusb_read_eeprom_byte); | ||
163 | |||
164 | int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *d) | ||
165 | { | ||
166 | struct dib3000_config demod_cfg; | ||
167 | struct dibusb_state *st = d->priv; | ||
168 | |||
169 | demod_cfg.pll_set = dvb_usb_pll_set_i2c; | ||
170 | demod_cfg.pll_init = dvb_usb_pll_init_i2c; | ||
171 | |||
172 | for (demod_cfg.demod_address = 0x8; demod_cfg.demod_address < 0xd; demod_cfg.demod_address++) | ||
173 | if ((d->fe = dib3000mc_attach(&demod_cfg,&d->i2c_adap,&st->ops)) != NULL) { | ||
174 | d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl; | ||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | return -ENODEV; | ||
179 | } | ||
180 | EXPORT_SYMBOL(dibusb_dib3000mc_frontend_attach); | ||
181 | |||
182 | int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d) | ||
183 | { | ||
184 | d->pll_addr = 0x60; | ||
185 | d->pll_desc = &dvb_pll_env57h1xd5; | ||
186 | return 0; | ||
187 | } | ||
188 | EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); | ||
189 | |||
190 | /* | ||
191 | * common remote control stuff | ||
192 | */ | ||
193 | struct dvb_usb_rc_key dibusb_rc_keys[] = { | ||
194 | /* Key codes for the little Artec T1/Twinhan/HAMA/ remote. */ | ||
195 | { 0x00, 0x16, KEY_POWER }, | ||
196 | { 0x00, 0x10, KEY_MUTE }, | ||
197 | { 0x00, 0x03, KEY_1 }, | ||
198 | { 0x00, 0x01, KEY_2 }, | ||
199 | { 0x00, 0x06, KEY_3 }, | ||
200 | { 0x00, 0x09, KEY_4 }, | ||
201 | { 0x00, 0x1d, KEY_5 }, | ||
202 | { 0x00, 0x1f, KEY_6 }, | ||
203 | { 0x00, 0x0d, KEY_7 }, | ||
204 | { 0x00, 0x19, KEY_8 }, | ||
205 | { 0x00, 0x1b, KEY_9 }, | ||
206 | { 0x00, 0x15, KEY_0 }, | ||
207 | { 0x00, 0x05, KEY_CHANNELUP }, | ||
208 | { 0x00, 0x02, KEY_CHANNELDOWN }, | ||
209 | { 0x00, 0x1e, KEY_VOLUMEUP }, | ||
210 | { 0x00, 0x0a, KEY_VOLUMEDOWN }, | ||
211 | { 0x00, 0x11, KEY_RECORD }, | ||
212 | { 0x00, 0x17, KEY_FAVORITES }, /* Heart symbol - Channel list. */ | ||
213 | { 0x00, 0x14, KEY_PLAY }, | ||
214 | { 0x00, 0x1a, KEY_STOP }, | ||
215 | { 0x00, 0x40, KEY_REWIND }, | ||
216 | { 0x00, 0x12, KEY_FASTFORWARD }, | ||
217 | { 0x00, 0x0e, KEY_PREVIOUS }, /* Recall - Previous channel. */ | ||
218 | { 0x00, 0x4c, KEY_PAUSE }, | ||
219 | { 0x00, 0x4d, KEY_SCREEN }, /* Full screen mode. */ | ||
220 | { 0x00, 0x54, KEY_AUDIO }, /* MTS - Switch to secondary audio. */ | ||
221 | /* additional keys TwinHan VisionPlus, the Artec seemingly not have */ | ||
222 | { 0x00, 0x0c, KEY_CANCEL }, /* Cancel */ | ||
223 | { 0x00, 0x1c, KEY_EPG }, /* EPG */ | ||
224 | { 0x00, 0x00, KEY_TAB }, /* Tab */ | ||
225 | { 0x00, 0x48, KEY_INFO }, /* Preview */ | ||
226 | { 0x00, 0x04, KEY_LIST }, /* RecordList */ | ||
227 | { 0x00, 0x0f, KEY_TEXT }, /* Teletext */ | ||
228 | /* Key codes for the KWorld/ADSTech/JetWay remote. */ | ||
229 | { 0x86, 0x12, KEY_POWER }, | ||
230 | { 0x86, 0x0f, KEY_SELECT }, /* source */ | ||
231 | { 0x86, 0x0c, KEY_UNKNOWN }, /* scan */ | ||
232 | { 0x86, 0x0b, KEY_EPG }, | ||
233 | { 0x86, 0x10, KEY_MUTE }, | ||
234 | { 0x86, 0x01, KEY_1 }, | ||
235 | { 0x86, 0x02, KEY_2 }, | ||
236 | { 0x86, 0x03, KEY_3 }, | ||
237 | { 0x86, 0x04, KEY_4 }, | ||
238 | { 0x86, 0x05, KEY_5 }, | ||
239 | { 0x86, 0x06, KEY_6 }, | ||
240 | { 0x86, 0x07, KEY_7 }, | ||
241 | { 0x86, 0x08, KEY_8 }, | ||
242 | { 0x86, 0x09, KEY_9 }, | ||
243 | { 0x86, 0x0a, KEY_0 }, | ||
244 | { 0x86, 0x18, KEY_ZOOM }, | ||
245 | { 0x86, 0x1c, KEY_UNKNOWN }, /* preview */ | ||
246 | { 0x86, 0x13, KEY_UNKNOWN }, /* snap */ | ||
247 | { 0x86, 0x00, KEY_UNDO }, | ||
248 | { 0x86, 0x1d, KEY_RECORD }, | ||
249 | { 0x86, 0x0d, KEY_STOP }, | ||
250 | { 0x86, 0x0e, KEY_PAUSE }, | ||
251 | { 0x86, 0x16, KEY_PLAY }, | ||
252 | { 0x86, 0x11, KEY_BACK }, | ||
253 | { 0x86, 0x19, KEY_FORWARD }, | ||
254 | { 0x86, 0x14, KEY_UNKNOWN }, /* pip */ | ||
255 | { 0x86, 0x15, KEY_ESC }, | ||
256 | { 0x86, 0x1a, KEY_UP }, | ||
257 | { 0x86, 0x1e, KEY_DOWN }, | ||
258 | { 0x86, 0x1f, KEY_LEFT }, | ||
259 | { 0x86, 0x1b, KEY_RIGHT }, | ||
260 | }; | ||
261 | EXPORT_SYMBOL(dibusb_rc_keys); | ||
262 | |||
263 | int dibusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | ||
264 | { | ||
265 | u8 key[5],cmd = DIBUSB_REQ_POLL_REMOTE; | ||
266 | dvb_usb_generic_rw(d,&cmd,1,key,5,0); | ||
267 | dvb_usb_nec_rc_key_to_event(d,key,event,state); | ||
268 | if (key[0] != 0) | ||
269 | deb_info("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]); | ||
270 | return 0; | ||
271 | } | ||
272 | EXPORT_SYMBOL(dibusb_rc_query); | ||
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c new file mode 100644 index 000000000000..a0ffbb59fa14 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c | |||
@@ -0,0 +1,316 @@ | |||
1 | /* DVB USB compliant linux driver for mobile DVB-T USB devices based on | ||
2 | * reference designs made by DiBcom (http://www.dibcom.fr/) (DiB3000M-B) | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * based on GPL code from DiBcom, which has | ||
7 | * Copyright (C) 2004 Amaury Demol for DiBcom (ademol@dibcom.fr) | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the Free | ||
11 | * Software Foundation, version 2. | ||
12 | * | ||
13 | * see Documentation/dvb/README.dvb-usb for more information | ||
14 | */ | ||
15 | #include "dibusb.h" | ||
16 | |||
17 | static int dibusb_dib3000mb_frontend_attach(struct dvb_usb_device *d) | ||
18 | { | ||
19 | struct dib3000_config demod_cfg; | ||
20 | struct dibusb_state *st = d->priv; | ||
21 | |||
22 | demod_cfg.demod_address = 0x8; | ||
23 | demod_cfg.pll_set = dvb_usb_pll_set_i2c; | ||
24 | demod_cfg.pll_init = dvb_usb_pll_init_i2c; | ||
25 | |||
26 | if ((d->fe = dib3000mb_attach(&demod_cfg,&d->i2c_adap,&st->ops)) == NULL) | ||
27 | return -ENODEV; | ||
28 | |||
29 | d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl; | ||
30 | |||
31 | return 0; | ||
32 | } | ||
33 | |||
34 | /* some of the dibusb 1.1 device aren't equipped with the default tuner | ||
35 | * (Thomson Cable), but with a Panasonic ENV77H11D5. This function figures | ||
36 | * this out. */ | ||
37 | static int dibusb_dib3000mb_tuner_attach (struct dvb_usb_device *d) | ||
38 | { | ||
39 | u8 b[2] = { 0,0 }, b2[1]; | ||
40 | int ret = 0; | ||
41 | struct i2c_msg msg[2] = { | ||
42 | { .flags = 0, .buf = b, .len = 2 }, | ||
43 | { .flags = I2C_M_RD, .buf = b2, .len = 1 }, | ||
44 | }; | ||
45 | |||
46 | /* the Panasonic sits on I2C addrass 0x60, the Thomson on 0x61 */ | ||
47 | msg[0].addr = msg[1].addr = 0x60; | ||
48 | |||
49 | if (d->tuner_pass_ctrl) | ||
50 | d->tuner_pass_ctrl(d->fe,1,msg[0].addr); | ||
51 | |||
52 | if (i2c_transfer (&d->i2c_adap, msg, 2) != 2) { | ||
53 | err("tuner i2c write failed."); | ||
54 | ret = -EREMOTEIO; | ||
55 | } | ||
56 | |||
57 | if (d->tuner_pass_ctrl) | ||
58 | d->tuner_pass_ctrl(d->fe,0,msg[0].addr); | ||
59 | |||
60 | if (b2[0] == 0xfe) { | ||
61 | info("this device has the Thomson Cable onboard. Which is default."); | ||
62 | d->pll_addr = 0x61; | ||
63 | d->pll_desc = &dvb_pll_tua6010xs; | ||
64 | } else { | ||
65 | u8 bpll[4] = { 0x0b, 0xf5, 0x85, 0xab }; | ||
66 | info("this device has the Panasonic ENV77H11D5 onboard."); | ||
67 | d->pll_addr = 0x60; | ||
68 | memcpy(d->pll_init,bpll,4); | ||
69 | d->pll_desc = &dvb_pll_tda665x; | ||
70 | } | ||
71 | |||
72 | return ret; | ||
73 | } | ||
74 | |||
75 | /* USB Driver stuff */ | ||
76 | static struct dvb_usb_properties dibusb1_1_properties; | ||
77 | static struct dvb_usb_properties dibusb1_1_an2235_properties; | ||
78 | static struct dvb_usb_properties dibusb2_0b_properties; | ||
79 | |||
80 | static int dibusb_probe(struct usb_interface *intf, | ||
81 | const struct usb_device_id *id) | ||
82 | { | ||
83 | if (dvb_usb_device_init(intf,&dibusb1_1_properties,THIS_MODULE) == 0 || | ||
84 | dvb_usb_device_init(intf,&dibusb1_1_an2235_properties,THIS_MODULE) == 0 || | ||
85 | dvb_usb_device_init(intf,&dibusb2_0b_properties,THIS_MODULE) == 0) | ||
86 | return 0; | ||
87 | |||
88 | return -EINVAL; | ||
89 | } | ||
90 | |||
91 | /* do not change the order of the ID table */ | ||
92 | static struct usb_device_id dibusb_dib3000mb_table [] = { | ||
93 | /* 00 */ { USB_DEVICE(USB_VID_AVERMEDIA_UNK, USB_PID_AVERMEDIA_DVBT_USB_COLD)}, | ||
94 | /* 01 */ { USB_DEVICE(USB_VID_AVERMEDIA_UNK, USB_PID_AVERMEDIA_DVBT_USB_WARM)}, | ||
95 | /* 02 */ { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_COLD) }, | ||
96 | /* 03 */ { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_WARM) }, | ||
97 | /* 04 */ { USB_DEVICE(USB_VID_COMPRO_UNK, USB_PID_COMPRO_DVBU2000_UNK_COLD) }, | ||
98 | /* 05 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_COLD) }, | ||
99 | /* 06 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_WARM) }, | ||
100 | /* 07 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_COLD) }, | ||
101 | /* 08 */ { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_WARM) }, | ||
102 | /* 09 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_COLD) }, | ||
103 | /* 10 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_WARM) }, | ||
104 | /* 11 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_COLD) }, | ||
105 | /* 12 */ { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_WARM) }, | ||
106 | /* 13 */ { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_COLD) }, | ||
107 | /* 14 */ { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_WARM) }, | ||
108 | /* 15 */ { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7041_COLD) }, | ||
109 | /* 16 */ { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7041_WARM) }, | ||
110 | /* 17 */ { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_COLD) }, | ||
111 | /* 18 */ { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_WARM) }, | ||
112 | /* 19 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_COLD) }, | ||
113 | /* 20 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_WARM) }, | ||
114 | /* 21 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_COLD) }, | ||
115 | /* 22 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_WARM) }, | ||
116 | /* 23 */ { USB_DEVICE(USB_VID_ADSTECH, USB_PID_ADSTECH_USB2_COLD) }, | ||
117 | /* 24 */ { USB_DEVICE(USB_VID_ADSTECH, USB_PID_ADSTECH_USB2_WARM) }, | ||
118 | { } /* Terminating entry */ | ||
119 | }; | ||
120 | MODULE_DEVICE_TABLE (usb, dibusb_dib3000mb_table); | ||
121 | |||
122 | static struct dvb_usb_properties dibusb1_1_properties = { | ||
123 | .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, | ||
124 | .pid_filter_count = 16, | ||
125 | |||
126 | .usb_ctrl = CYPRESS_AN2135, | ||
127 | |||
128 | .firmware = "dvb-usb-dibusb-5.0.0.11.fw", | ||
129 | |||
130 | .size_of_priv = sizeof(struct dibusb_state), | ||
131 | |||
132 | .streaming_ctrl = dibusb_streaming_ctrl, | ||
133 | .pid_filter = dibusb_pid_filter, | ||
134 | .pid_filter_ctrl = dibusb_pid_filter_ctrl, | ||
135 | .power_ctrl = dibusb_power_ctrl, | ||
136 | .frontend_attach = dibusb_dib3000mb_frontend_attach, | ||
137 | .tuner_attach = dibusb_dib3000mb_tuner_attach, | ||
138 | |||
139 | .rc_interval = DEFAULT_RC_INTERVAL, | ||
140 | .rc_key_map = dibusb_rc_keys, | ||
141 | .rc_key_map_size = 63, /* wow, that is ugly ... I want to load it to the driver dynamically */ | ||
142 | .rc_query = dibusb_rc_query, | ||
143 | |||
144 | .i2c_algo = &dibusb_i2c_algo, | ||
145 | |||
146 | .generic_bulk_ctrl_endpoint = 0x01, | ||
147 | /* parameter for the MPEG2-data transfer */ | ||
148 | .urb = { | ||
149 | .type = DVB_USB_BULK, | ||
150 | .count = 7, | ||
151 | .endpoint = 0x02, | ||
152 | .u = { | ||
153 | .bulk = { | ||
154 | .buffersize = 4096, | ||
155 | } | ||
156 | } | ||
157 | }, | ||
158 | |||
159 | .num_device_descs = 8, | ||
160 | .devices = { | ||
161 | { "AVerMedia AverTV DVBT USB1.1", | ||
162 | { &dibusb_dib3000mb_table[0], NULL }, | ||
163 | { &dibusb_dib3000mb_table[1], NULL }, | ||
164 | }, | ||
165 | { "Compro Videomate DVB-U2000 - DVB-T USB1.1 (please confirm to linux-dvb)", | ||
166 | { &dibusb_dib3000mb_table[2], &dibusb_dib3000mb_table[4], NULL}, | ||
167 | { &dibusb_dib3000mb_table[3], NULL }, | ||
168 | }, | ||
169 | { "DiBcom USB1.1 DVB-T reference design (MOD3000)", | ||
170 | { &dibusb_dib3000mb_table[5], NULL }, | ||
171 | { &dibusb_dib3000mb_table[6], NULL }, | ||
172 | }, | ||
173 | { "KWorld V-Stream XPERT DTV - DVB-T USB1.1", | ||
174 | { &dibusb_dib3000mb_table[7], NULL }, | ||
175 | { &dibusb_dib3000mb_table[8], NULL }, | ||
176 | }, | ||
177 | { "Grandtec USB1.1 DVB-T", | ||
178 | { &dibusb_dib3000mb_table[9], &dibusb_dib3000mb_table[11], NULL }, | ||
179 | { &dibusb_dib3000mb_table[10], &dibusb_dib3000mb_table[12], NULL }, | ||
180 | }, | ||
181 | { "Unkown USB1.1 DVB-T device ???? please report the name to the author", | ||
182 | { &dibusb_dib3000mb_table[13], NULL }, | ||
183 | { &dibusb_dib3000mb_table[14], NULL }, | ||
184 | }, | ||
185 | { "TwinhanDTV USB-Ter USB1.1 / Magic Box I / HAMA USB1.1 DVB-T device", | ||
186 | { &dibusb_dib3000mb_table[15], &dibusb_dib3000mb_table[17], NULL}, | ||
187 | { &dibusb_dib3000mb_table[16], &dibusb_dib3000mb_table[18], NULL}, | ||
188 | }, | ||
189 | { "Artec T1 USB1.1 TVBOX with AN2135", | ||
190 | { &dibusb_dib3000mb_table[19], NULL }, | ||
191 | { &dibusb_dib3000mb_table[20], NULL }, | ||
192 | }, | ||
193 | } | ||
194 | }; | ||
195 | |||
196 | static struct dvb_usb_properties dibusb1_1_an2235_properties = { | ||
197 | .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, | ||
198 | .usb_ctrl = CYPRESS_AN2235, | ||
199 | |||
200 | .firmware = "dvb-usb-dibusb-an2235-01.fw", | ||
201 | |||
202 | .size_of_priv = sizeof(struct dibusb_state), | ||
203 | |||
204 | .streaming_ctrl = dibusb_streaming_ctrl, | ||
205 | .pid_filter = dibusb_pid_filter, | ||
206 | .pid_filter_ctrl = dibusb_pid_filter_ctrl, | ||
207 | .power_ctrl = dibusb_power_ctrl, | ||
208 | .frontend_attach = dibusb_dib3000mb_frontend_attach, | ||
209 | .tuner_attach = dibusb_dib3000mb_tuner_attach, | ||
210 | |||
211 | .rc_interval = DEFAULT_RC_INTERVAL, | ||
212 | .rc_key_map = dibusb_rc_keys, | ||
213 | .rc_key_map_size = 63, /* wow, that is ugly ... I want to load it to the driver dynamically */ | ||
214 | .rc_query = dibusb_rc_query, | ||
215 | |||
216 | .i2c_algo = &dibusb_i2c_algo, | ||
217 | |||
218 | .generic_bulk_ctrl_endpoint = 0x01, | ||
219 | /* parameter for the MPEG2-data transfer */ | ||
220 | .urb = { | ||
221 | .type = DVB_USB_BULK, | ||
222 | .count = 7, | ||
223 | .endpoint = 0x02, | ||
224 | .u = { | ||
225 | .bulk = { | ||
226 | .buffersize = 4096, | ||
227 | } | ||
228 | } | ||
229 | }, | ||
230 | |||
231 | .num_device_descs = 1, | ||
232 | .devices = { | ||
233 | { "Artec T1 USB1.1 TVBOX with AN2235", | ||
234 | { &dibusb_dib3000mb_table[20], NULL }, | ||
235 | { &dibusb_dib3000mb_table[21], NULL }, | ||
236 | }, | ||
237 | } | ||
238 | }; | ||
239 | |||
240 | static struct dvb_usb_properties dibusb2_0b_properties = { | ||
241 | .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, | ||
242 | .usb_ctrl = CYPRESS_FX2, | ||
243 | |||
244 | .firmware = "dvb-usb-adstech-usb2-01.fw", | ||
245 | |||
246 | .size_of_priv = sizeof(struct dibusb_state), | ||
247 | |||
248 | .streaming_ctrl = dibusb2_0_streaming_ctrl, | ||
249 | .pid_filter = dibusb_pid_filter, | ||
250 | .pid_filter_ctrl = dibusb_pid_filter_ctrl, | ||
251 | .power_ctrl = dibusb2_0_power_ctrl, | ||
252 | .frontend_attach = dibusb_dib3000mb_frontend_attach, | ||
253 | .tuner_attach = dibusb_dib3000mb_tuner_attach, | ||
254 | |||
255 | .rc_interval = DEFAULT_RC_INTERVAL, | ||
256 | .rc_key_map = dibusb_rc_keys, | ||
257 | .rc_key_map_size = 63, /* wow, that is ugly ... I want to load it to the driver dynamically */ | ||
258 | .rc_query = dibusb_rc_query, | ||
259 | |||
260 | .i2c_algo = &dibusb_i2c_algo, | ||
261 | |||
262 | .generic_bulk_ctrl_endpoint = 0x01, | ||
263 | /* parameter for the MPEG2-data transfer */ | ||
264 | .urb = { | ||
265 | .type = DVB_USB_BULK, | ||
266 | .count = 7, | ||
267 | .endpoint = 0x06, | ||
268 | .u = { | ||
269 | .bulk = { | ||
270 | .buffersize = 4096, | ||
271 | } | ||
272 | } | ||
273 | }, | ||
274 | |||
275 | .num_device_descs = 2, | ||
276 | .devices = { | ||
277 | { "KWorld/ADSTech Instant DVB-T USB 2.0", | ||
278 | { &dibusb_dib3000mb_table[23], NULL }, | ||
279 | { &dibusb_dib3000mb_table[24], NULL }, /* device ID with default DIBUSB2_0-firmware */ | ||
280 | }, | ||
281 | } | ||
282 | }; | ||
283 | |||
284 | static struct usb_driver dibusb_driver = { | ||
285 | .owner = THIS_MODULE, | ||
286 | .name = "DiBcom based USB DVB-T devices (DiB3000M-B based)", | ||
287 | .probe = dibusb_probe, | ||
288 | .disconnect = dvb_usb_device_exit, | ||
289 | .id_table = dibusb_dib3000mb_table, | ||
290 | }; | ||
291 | |||
292 | /* module stuff */ | ||
293 | static int __init dibusb_module_init(void) | ||
294 | { | ||
295 | int result; | ||
296 | if ((result = usb_register(&dibusb_driver))) { | ||
297 | err("usb_register failed. Error number %d",result); | ||
298 | return result; | ||
299 | } | ||
300 | |||
301 | return 0; | ||
302 | } | ||
303 | |||
304 | static void __exit dibusb_module_exit(void) | ||
305 | { | ||
306 | /* deregister this driver from the USB subsystem */ | ||
307 | usb_deregister(&dibusb_driver); | ||
308 | } | ||
309 | |||
310 | module_init (dibusb_module_init); | ||
311 | module_exit (dibusb_module_exit); | ||
312 | |||
313 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
314 | MODULE_DESCRIPTION("Driver for DiBcom USB DVB-T devices (DiB3000M-B based)"); | ||
315 | MODULE_VERSION("1.0"); | ||
316 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mc.c b/drivers/media/dvb/dvb-usb/dibusb-mc.c new file mode 100644 index 000000000000..aad8ed3fe005 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dibusb-mc.c | |||
@@ -0,0 +1,116 @@ | |||
1 | /* DVB USB compliant linux driver for mobile DVB-T USB devices based on | ||
2 | * reference designs made by DiBcom (http://www.dibcom.fr/) (DiB3000M-C/P) | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * based on GPL code from DiBcom, which has | ||
7 | * Copyright (C) 2004 Amaury Demol for DiBcom (ademol@dibcom.fr) | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the Free | ||
11 | * Software Foundation, version 2. | ||
12 | * | ||
13 | * see Documentation/dvb/README.dvb-usb for more information | ||
14 | */ | ||
15 | #include "dibusb.h" | ||
16 | |||
17 | /* USB Driver stuff */ | ||
18 | static struct dvb_usb_properties dibusb_mc_properties; | ||
19 | |||
20 | static int dibusb_mc_probe(struct usb_interface *intf, | ||
21 | const struct usb_device_id *id) | ||
22 | { | ||
23 | return dvb_usb_device_init(intf,&dibusb_mc_properties,THIS_MODULE); | ||
24 | } | ||
25 | |||
26 | /* do not change the order of the ID table */ | ||
27 | static struct usb_device_id dibusb_dib3000mc_table [] = { | ||
28 | /* 00 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_COLD) }, | ||
29 | /* 01 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_WARM) }, | ||
30 | /* 02 */ { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_USB2_COLD) }, | ||
31 | { } /* Terminating entry */ | ||
32 | }; | ||
33 | MODULE_DEVICE_TABLE (usb, dibusb_dib3000mc_table); | ||
34 | |||
35 | static struct dvb_usb_properties dibusb_mc_properties = { | ||
36 | .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, | ||
37 | .pid_filter_count = 32, | ||
38 | |||
39 | .usb_ctrl = CYPRESS_FX2, | ||
40 | .firmware = "dvb-usb-dibusb-6.0.0.8.fw", | ||
41 | |||
42 | .size_of_priv = sizeof(struct dibusb_state), | ||
43 | |||
44 | .streaming_ctrl = dibusb2_0_streaming_ctrl, | ||
45 | .pid_filter = dibusb_pid_filter, | ||
46 | .pid_filter_ctrl = dibusb_pid_filter_ctrl, | ||
47 | .power_ctrl = dibusb2_0_power_ctrl, | ||
48 | .frontend_attach = dibusb_dib3000mc_frontend_attach, | ||
49 | .tuner_attach = dibusb_dib3000mc_tuner_attach, | ||
50 | |||
51 | .rc_interval = DEFAULT_RC_INTERVAL, | ||
52 | .rc_key_map = dibusb_rc_keys, | ||
53 | .rc_key_map_size = 63, /* FIXME */ | ||
54 | .rc_query = dibusb_rc_query, | ||
55 | |||
56 | .i2c_algo = &dibusb_i2c_algo, | ||
57 | |||
58 | .generic_bulk_ctrl_endpoint = 0x01, | ||
59 | /* parameter for the MPEG2-data transfer */ | ||
60 | .urb = { | ||
61 | .type = DVB_USB_BULK, | ||
62 | .count = 7, | ||
63 | .endpoint = 0x06, | ||
64 | .u = { | ||
65 | .bulk = { | ||
66 | .buffersize = 4096, | ||
67 | } | ||
68 | } | ||
69 | }, | ||
70 | |||
71 | .num_device_descs = 2, | ||
72 | .devices = { | ||
73 | { "DiBcom USB2.0 DVB-T reference design (MOD3000P)", | ||
74 | { &dibusb_dib3000mc_table[0], NULL }, | ||
75 | { &dibusb_dib3000mc_table[1], NULL }, | ||
76 | }, | ||
77 | { "Artec T1 USB2.0 TVBOX (please report the warm ID)", | ||
78 | { &dibusb_dib3000mc_table[2], NULL }, | ||
79 | { NULL }, | ||
80 | }, | ||
81 | } | ||
82 | }; | ||
83 | |||
84 | static struct usb_driver dibusb_mc_driver = { | ||
85 | .owner = THIS_MODULE, | ||
86 | .name = "DiBcom based USB2.0 DVB-T (DiB3000M-C/P based) devices", | ||
87 | .probe = dibusb_mc_probe, | ||
88 | .disconnect = dvb_usb_device_exit, | ||
89 | .id_table = dibusb_dib3000mc_table, | ||
90 | }; | ||
91 | |||
92 | /* module stuff */ | ||
93 | static int __init dibusb_mc_module_init(void) | ||
94 | { | ||
95 | int result; | ||
96 | if ((result = usb_register(&dibusb_mc_driver))) { | ||
97 | err("usb_register failed. Error number %d",result); | ||
98 | return result; | ||
99 | } | ||
100 | |||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | static void __exit dibusb_mc_module_exit(void) | ||
105 | { | ||
106 | /* deregister this driver from the USB subsystem */ | ||
107 | usb_deregister(&dibusb_mc_driver); | ||
108 | } | ||
109 | |||
110 | module_init (dibusb_mc_module_init); | ||
111 | module_exit (dibusb_mc_module_exit); | ||
112 | |||
113 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
114 | MODULE_DESCRIPTION("Driver for DiBcom USB2.0 DVB-T (DiB3000M-C/P based) devices"); | ||
115 | MODULE_VERSION("1.0"); | ||
116 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/dibusb.h b/drivers/media/dvb/dvb-usb/dibusb.h new file mode 100644 index 000000000000..6611f62977c0 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dibusb.h | |||
@@ -0,0 +1,122 @@ | |||
1 | /* Header file for all dibusb-based-receivers. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
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 Free | ||
7 | * Software Foundation, version 2. | ||
8 | * | ||
9 | * see Documentation/dvb/README.dvb-usb for more information | ||
10 | */ | ||
11 | #ifndef _DVB_USB_DIBUSB_H_ | ||
12 | #define _DVB_USB_DIBUSB_H_ | ||
13 | |||
14 | #define DVB_USB_LOG_PREFIX "dibusb" | ||
15 | #include "dvb-usb.h" | ||
16 | |||
17 | #include "dib3000.h" | ||
18 | |||
19 | /* | ||
20 | * protocol of all dibusb related devices | ||
21 | */ | ||
22 | |||
23 | /* | ||
24 | * bulk msg to/from endpoint 0x01 | ||
25 | * | ||
26 | * general structure: | ||
27 | * request_byte parameter_bytes | ||
28 | */ | ||
29 | |||
30 | #define DIBUSB_REQ_START_READ 0x00 | ||
31 | #define DIBUSB_REQ_START_DEMOD 0x01 | ||
32 | |||
33 | /* | ||
34 | * i2c read | ||
35 | * bulk write: 0x02 ((7bit i2c_addr << 1) & 0x01) register_bytes length_word | ||
36 | * bulk read: byte_buffer (length_word bytes) | ||
37 | */ | ||
38 | #define DIBUSB_REQ_I2C_READ 0x02 | ||
39 | |||
40 | /* | ||
41 | * i2c write | ||
42 | * bulk write: 0x03 (7bit i2c_addr << 1) register_bytes value_bytes | ||
43 | */ | ||
44 | #define DIBUSB_REQ_I2C_WRITE 0x03 | ||
45 | |||
46 | /* | ||
47 | * polling the value of the remote control | ||
48 | * bulk write: 0x04 | ||
49 | * bulk read: byte_buffer (5 bytes) | ||
50 | */ | ||
51 | #define DIBUSB_REQ_POLL_REMOTE 0x04 | ||
52 | |||
53 | /* additional status values for Hauppauge Remote Control Protocol */ | ||
54 | #define DIBUSB_RC_HAUPPAUGE_KEY_PRESSED 0x01 | ||
55 | #define DIBUSB_RC_HAUPPAUGE_KEY_EMPTY 0x03 | ||
56 | |||
57 | /* streaming mode: | ||
58 | * bulk write: 0x05 mode_byte | ||
59 | * | ||
60 | * mode_byte is mostly 0x00 | ||
61 | */ | ||
62 | #define DIBUSB_REQ_SET_STREAMING_MODE 0x05 | ||
63 | |||
64 | /* interrupt the internal read loop, when blocking */ | ||
65 | #define DIBUSB_REQ_INTR_READ 0x06 | ||
66 | |||
67 | /* io control | ||
68 | * 0x07 cmd_byte param_bytes | ||
69 | * | ||
70 | * param_bytes can be up to 32 bytes | ||
71 | * | ||
72 | * cmd_byte function parameter name | ||
73 | * 0x00 power mode | ||
74 | * 0x00 sleep | ||
75 | * 0x01 wakeup | ||
76 | * | ||
77 | * 0x01 enable streaming | ||
78 | * 0x02 disable streaming | ||
79 | * | ||
80 | * | ||
81 | */ | ||
82 | #define DIBUSB_REQ_SET_IOCTL 0x07 | ||
83 | |||
84 | /* IOCTL commands */ | ||
85 | |||
86 | /* change the power mode in firmware */ | ||
87 | #define DIBUSB_IOCTL_CMD_POWER_MODE 0x00 | ||
88 | #define DIBUSB_IOCTL_POWER_SLEEP 0x00 | ||
89 | #define DIBUSB_IOCTL_POWER_WAKEUP 0x01 | ||
90 | |||
91 | /* modify streaming of the FX2 */ | ||
92 | #define DIBUSB_IOCTL_CMD_ENABLE_STREAM 0x01 | ||
93 | #define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02 | ||
94 | |||
95 | struct dibusb_state { | ||
96 | struct dib_fe_xfer_ops ops; | ||
97 | |||
98 | /* for RC5 remote control */ | ||
99 | int old_toggle; | ||
100 | int last_repeat_count; | ||
101 | }; | ||
102 | |||
103 | extern struct i2c_algorithm dibusb_i2c_algo; | ||
104 | |||
105 | extern int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *); | ||
106 | extern int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *); | ||
107 | |||
108 | extern int dibusb_streaming_ctrl(struct dvb_usb_device *, int); | ||
109 | extern int dibusb_pid_filter(struct dvb_usb_device *, int, u16, int); | ||
110 | extern int dibusb_pid_filter_ctrl(struct dvb_usb_device *, int); | ||
111 | extern int dibusb_power_ctrl(struct dvb_usb_device *, int); | ||
112 | extern int dibusb2_0_streaming_ctrl(struct dvb_usb_device *, int); | ||
113 | extern int dibusb2_0_power_ctrl(struct dvb_usb_device *, int); | ||
114 | |||
115 | #define DEFAULT_RC_INTERVAL 150 | ||
116 | //#define DEFAULT_RC_INTERVAL 100000 | ||
117 | |||
118 | extern struct dvb_usb_rc_key dibusb_rc_keys[]; | ||
119 | extern int dibusb_rc_query(struct dvb_usb_device *, u32 *, int *); | ||
120 | extern int dibusb_read_eeprom_byte(struct dvb_usb_device *, u8, u8 *); | ||
121 | |||
122 | #endif | ||
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c new file mode 100644 index 000000000000..5acf3fde9522 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/digitv.c | |||
@@ -0,0 +1,282 @@ | |||
1 | /* DVB USB compliant linux driver for Nebula Electronics uDigiTV DVB-T USB2.0 | ||
2 | * receiver | ||
3 | * | ||
4 | * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de) and | ||
5 | * Allan Third (allan.third@cs.man.ac.uk) | ||
6 | * | ||
7 | * partly based on the SDK published by Nebula Electronics (TODO do we want this line ?) | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the Free | ||
11 | * Software Foundation, version 2. | ||
12 | * | ||
13 | * see Documentation/dvb/README.dvb-usb for more information | ||
14 | */ | ||
15 | #include "digitv.h" | ||
16 | |||
17 | #include "mt352.h" | ||
18 | #include "nxt6000.h" | ||
19 | |||
20 | /* debug */ | ||
21 | int dvb_usb_digitv_debug; | ||
22 | module_param_named(debug,dvb_usb_digitv_debug, int, 0644); | ||
23 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); | ||
24 | |||
25 | static int digitv_ctrl_msg(struct dvb_usb_device *d, | ||
26 | u8 cmd, u8 vv, u8 *wbuf, int wlen, u8 *rbuf, int rlen) | ||
27 | { | ||
28 | int wo = (rbuf == NULL || rlen == 0); /* write-only */ | ||
29 | u8 sndbuf[7],rcvbuf[7]; | ||
30 | memset(sndbuf,0,7); memset(rcvbuf,0,7); | ||
31 | |||
32 | sndbuf[0] = cmd; | ||
33 | sndbuf[1] = vv; | ||
34 | sndbuf[2] = wo ? wlen : rlen; | ||
35 | |||
36 | if (!wo) { | ||
37 | memcpy(&sndbuf[3],wbuf,wlen); | ||
38 | dvb_usb_generic_write(d,sndbuf,7); | ||
39 | } else { | ||
40 | dvb_usb_generic_rw(d,sndbuf,7,rcvbuf,7,10); | ||
41 | memcpy(&rbuf,&rcvbuf[3],rlen); | ||
42 | } | ||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | /* I2C */ | ||
47 | static int digitv_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | ||
48 | { | ||
49 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | ||
50 | int i; | ||
51 | |||
52 | if (down_interruptible(&d->i2c_sem) < 0) | ||
53 | return -EAGAIN; | ||
54 | |||
55 | if (num > 2) | ||
56 | warn("more than 2 i2c messages at a time is not handled yet. TODO."); | ||
57 | |||
58 | for (i = 0; i < num; i++) { | ||
59 | /* write/read request */ | ||
60 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { | ||
61 | if (digitv_ctrl_msg(d, USB_READ_COFDM, msg[i].buf[0], NULL, 0, | ||
62 | msg[i+1].buf,msg[i+1].len) < 0) | ||
63 | break; | ||
64 | i++; | ||
65 | } else | ||
66 | if (digitv_ctrl_msg(d,USB_WRITE_COFDM, msg[i].buf[0], | ||
67 | &msg[i].buf[1],msg[i].len-1,NULL,0) < 0) | ||
68 | break; | ||
69 | } | ||
70 | |||
71 | up(&d->i2c_sem); | ||
72 | return i; | ||
73 | } | ||
74 | |||
75 | static u32 digitv_i2c_func(struct i2c_adapter *adapter) | ||
76 | { | ||
77 | return I2C_FUNC_I2C; | ||
78 | } | ||
79 | |||
80 | static struct i2c_algorithm digitv_i2c_algo = { | ||
81 | .name = "Nebula DigiTV USB I2C algorithm", | ||
82 | .id = I2C_ALGO_BIT, | ||
83 | .master_xfer = digitv_i2c_xfer, | ||
84 | .functionality = digitv_i2c_func, | ||
85 | }; | ||
86 | |||
87 | /* Callbacks for DVB USB */ | ||
88 | static int digitv_identify_state (struct usb_device *udev, struct | ||
89 | dvb_usb_properties *props, struct dvb_usb_device_description **desc, | ||
90 | int *cold) | ||
91 | { | ||
92 | *cold = udev->descriptor.iManufacturer == 0 && udev->descriptor.iProduct == 0; | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | static int digitv_mt352_demod_init(struct dvb_frontend *fe) | ||
97 | { | ||
98 | static u8 mt352_clock_config[] = { 0x89, 0x38, 0x2d }; | ||
99 | static u8 mt352_reset[] = { 0x50, 0x80 }; | ||
100 | static u8 mt352_mclk_ratio[] = { 0x8b, 0x00 }; | ||
101 | |||
102 | static u8 mt352_agc_cfg[] = { 0x68, 0xa0 }; | ||
103 | static u8 mt352_adc_ctl_1_cfg[] = { 0x8E, 0xa0 }; | ||
104 | static u8 mt352_acq_ctl[] = { 0x53, 0x50 }; | ||
105 | static u8 mt352_agc_target[] = { 0x67, 0x20 }; | ||
106 | |||
107 | static u8 mt352_rs_err_per[] = { 0x7c, 0x00, 0x01 }; | ||
108 | static u8 mt352_snr_select[] = { 0x79, 0x00, 0x20 }; | ||
109 | |||
110 | static u8 mt352_input_freq_1[] = { 0x56, 0x31, 0x05 }; | ||
111 | |||
112 | static u8 mt352_scan_ctl[] = { 0x88, 0x0f }; | ||
113 | static u8 mt352_capt_range[] = { 0x75, 0x32 }; | ||
114 | |||
115 | mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config)); | ||
116 | mt352_write(fe, mt352_reset, sizeof(mt352_reset)); | ||
117 | msleep(1); | ||
118 | mt352_write(fe, mt352_mclk_ratio, sizeof(mt352_mclk_ratio)); | ||
119 | |||
120 | mt352_write(fe, mt352_agc_cfg, sizeof(mt352_agc_cfg)); | ||
121 | mt352_write(fe, mt352_adc_ctl_1_cfg, sizeof(mt352_adc_ctl_1_cfg)); | ||
122 | mt352_write(fe, mt352_acq_ctl, sizeof(mt352_acq_ctl)); | ||
123 | mt352_write(fe, mt352_agc_target, sizeof(mt352_agc_target)); | ||
124 | |||
125 | |||
126 | mt352_write(fe, mt352_rs_err_per, sizeof(mt352_rs_err_per)); | ||
127 | mt352_write(fe, mt352_snr_select, sizeof(mt352_snr_select)); | ||
128 | |||
129 | mt352_write(fe, mt352_input_freq_1, sizeof(mt352_input_freq_1)); | ||
130 | |||
131 | mt352_write(fe, mt352_scan_ctl, sizeof(mt352_scan_ctl)); | ||
132 | mt352_write(fe, mt352_capt_range, sizeof(mt352_capt_range)); | ||
133 | |||
134 | return 0; | ||
135 | } | ||
136 | |||
137 | static struct mt352_config digitv_mt352_config = { | ||
138 | .demod_address = 0x0, /* ignored by the digitv anyway */ | ||
139 | .demod_init = digitv_mt352_demod_init, | ||
140 | .pll_set = NULL, /* TODO */ | ||
141 | }; | ||
142 | |||
143 | static struct nxt6000_config digitv_nxt6000_config = { | ||
144 | .demod_address = 0x0, /* ignored by the digitv anyway */ | ||
145 | .clock_inversion = 0x0, | ||
146 | |||
147 | .pll_init = NULL, | ||
148 | .pll_set = NULL, | ||
149 | }; | ||
150 | |||
151 | static int digitv_frontend_attach(struct dvb_usb_device *d) | ||
152 | { | ||
153 | if ((d->fe = mt352_attach(&digitv_mt352_config, &d->i2c_adap)) == NULL) | ||
154 | return 0; | ||
155 | if ((d->fe = nxt6000_attach(&digitv_nxt6000_config, &d->i2c_adap)) == NULL) { | ||
156 | |||
157 | warn("nxt6000 support is not done yet, in fact you are one of the first " | ||
158 | "person who wants to use this device in Linux. Please report to " | ||
159 | "linux-dvb@linuxtv.org"); | ||
160 | |||
161 | return 0; | ||
162 | } | ||
163 | return -EIO; | ||
164 | } | ||
165 | |||
166 | static struct dvb_usb_rc_key digitv_rc_keys[] = { | ||
167 | { 0x00, 0x16, KEY_POWER }, /* dummy key */ | ||
168 | }; | ||
169 | |||
170 | /* TODO is it really the NEC protocol ? */ | ||
171 | int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | ||
172 | { | ||
173 | u8 key[5]; | ||
174 | |||
175 | digitv_ctrl_msg(d,USB_READ_REMOTE,0,NULL,0,&key[1],4); | ||
176 | /* TODO state, maybe it is VV ? */ | ||
177 | if (key[1] != 0) | ||
178 | key[0] = 0x01; /* if something is inside the buffer, simulate key press */ | ||
179 | |||
180 | /* call the universal NEC remote processor, to find out the key's state and event */ | ||
181 | dvb_usb_nec_rc_key_to_event(d,key,event,state); | ||
182 | if (key[0] != 0) | ||
183 | deb_rc("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]); | ||
184 | return 0; | ||
185 | } | ||
186 | |||
187 | |||
188 | /* DVB USB Driver stuff */ | ||
189 | static struct dvb_usb_properties digitv_properties; | ||
190 | |||
191 | static int digitv_probe(struct usb_interface *intf, | ||
192 | const struct usb_device_id *id) | ||
193 | { | ||
194 | return dvb_usb_device_init(intf,&digitv_properties,THIS_MODULE); | ||
195 | } | ||
196 | |||
197 | static struct usb_device_id digitv_table [] = { | ||
198 | { USB_DEVICE(USB_VID_ANCHOR, USB_PID_NEBULA_DIGITV) }, | ||
199 | { } /* Terminating entry */ | ||
200 | }; | ||
201 | MODULE_DEVICE_TABLE (usb, digitv_table); | ||
202 | |||
203 | static struct dvb_usb_properties digitv_properties = { | ||
204 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
205 | |||
206 | .usb_ctrl = CYPRESS_FX2, | ||
207 | .firmware = "dvb-usb-digitv-01.fw", | ||
208 | |||
209 | .size_of_priv = 0, | ||
210 | |||
211 | .streaming_ctrl = NULL, | ||
212 | .pid_filter = NULL, | ||
213 | .pid_filter_ctrl = NULL, | ||
214 | .power_ctrl = NULL, | ||
215 | .frontend_attach = digitv_frontend_attach, | ||
216 | .tuner_attach = NULL, // digitv_tuner_attach, | ||
217 | .read_mac_address = NULL, | ||
218 | |||
219 | .rc_interval = 1000, | ||
220 | .rc_key_map = digitv_rc_keys, | ||
221 | .rc_key_map_size = ARRAY_SIZE(digitv_rc_keys), | ||
222 | .rc_query = digitv_rc_query, | ||
223 | |||
224 | .identify_state = digitv_identify_state, | ||
225 | |||
226 | .i2c_algo = &digitv_i2c_algo, | ||
227 | |||
228 | .generic_bulk_ctrl_endpoint = 0x01, | ||
229 | /* parameter for the MPEG2-data transfer */ | ||
230 | .urb = { | ||
231 | .type = DVB_USB_BULK, | ||
232 | .count = 7, | ||
233 | .endpoint = 0x02, | ||
234 | .u = { | ||
235 | .bulk = { | ||
236 | .buffersize = 4096, | ||
237 | } | ||
238 | } | ||
239 | }, | ||
240 | |||
241 | .num_device_descs = 2, | ||
242 | .devices = { | ||
243 | { "Nebula Electronics uDigiTV DVB-T USB2.0)", | ||
244 | { &digitv_table[0], NULL }, | ||
245 | { NULL }, | ||
246 | }, | ||
247 | } | ||
248 | }; | ||
249 | |||
250 | static struct usb_driver digitv_driver = { | ||
251 | .owner = THIS_MODULE, | ||
252 | .name = "Nebula Electronics uDigiTV DVB-T USB2.0 device", | ||
253 | .probe = digitv_probe, | ||
254 | .disconnect = dvb_usb_device_exit, | ||
255 | .id_table = digitv_table, | ||
256 | }; | ||
257 | |||
258 | /* module stuff */ | ||
259 | static int __init digitv_module_init(void) | ||
260 | { | ||
261 | int result; | ||
262 | if ((result = usb_register(&digitv_driver))) { | ||
263 | err("usb_register failed. Error number %d",result); | ||
264 | return result; | ||
265 | } | ||
266 | |||
267 | return 0; | ||
268 | } | ||
269 | |||
270 | static void __exit digitv_module_exit(void) | ||
271 | { | ||
272 | /* deregister this driver from the USB subsystem */ | ||
273 | usb_deregister(&digitv_driver); | ||
274 | } | ||
275 | |||
276 | module_init (digitv_module_init); | ||
277 | module_exit (digitv_module_exit); | ||
278 | |||
279 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
280 | MODULE_DESCRIPTION("Driver for Nebula Electronics uDigiTV DVB-T USB2.0"); | ||
281 | MODULE_VERSION("1.0-alpha"); | ||
282 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/digitv.h b/drivers/media/dvb/dvb-usb/digitv.h new file mode 100644 index 000000000000..477ee428a70e --- /dev/null +++ b/drivers/media/dvb/dvb-usb/digitv.h | |||
@@ -0,0 +1,65 @@ | |||
1 | #ifndef _DVB_USB_DIGITV_H_ | ||
2 | #define _DVB_USB_DIGITV_H_ | ||
3 | |||
4 | #define DVB_USB_LOG_PREFIX "digitv" | ||
5 | #include "dvb-usb.h" | ||
6 | |||
7 | extern int dvb_usb_digitv_debug; | ||
8 | #define deb_rc(args...) dprintk(dvb_usb_digitv_debug,0x01,args) | ||
9 | |||
10 | /* protocol (from usblogging and the SDK: | ||
11 | * | ||
12 | * Always 7 bytes bulk message(s) for controlling | ||
13 | * | ||
14 | * First byte describes the command. Reads are 2 consecutive transfer (as always). | ||
15 | * | ||
16 | * General structure: | ||
17 | * | ||
18 | * write or first message of a read: | ||
19 | * <cmdbyte> VV <len> B0 B1 B2 B3 | ||
20 | * | ||
21 | * second message of a read | ||
22 | * <cmdbyte> VV <len> R0 R1 R2 R3 | ||
23 | * | ||
24 | * whereas 0 < len <= 4 | ||
25 | * | ||
26 | * I2C address is stored somewhere inside the device. | ||
27 | * | ||
28 | * 0x01 read from EEPROM | ||
29 | * VV = offset; B* = 0; R* = value(s) | ||
30 | * | ||
31 | * 0x02 read register of the COFDM | ||
32 | * VV = register; B* = 0; R* = value(s) | ||
33 | * | ||
34 | * 0x05 write register of the COFDM | ||
35 | * VV = register; B* = value(s); | ||
36 | * | ||
37 | * 0x06 write to the tuner (only for NXT6000) | ||
38 | * VV = 0; B* = PLL data; len = 4; | ||
39 | * | ||
40 | * 0x03 read remote control | ||
41 | * VV = 0; B* = 0; len = 4; R* = key | ||
42 | * | ||
43 | * 0x07 write to the remote (don't know why one should this, resetting ?) | ||
44 | * VV = 0; B* = key; len = 4; | ||
45 | * | ||
46 | * 0x08 write remote type | ||
47 | * VV = 0; B[0] = 0x01, len = 4 | ||
48 | * | ||
49 | * 0x09 write device init | ||
50 | * TODO | ||
51 | */ | ||
52 | #define USB_READ_EEPROM 1 | ||
53 | |||
54 | #define USB_READ_COFDM 2 | ||
55 | #define USB_WRITE_COFDM 5 | ||
56 | |||
57 | #define USB_WRITE_TUNER 6 | ||
58 | |||
59 | #define USB_READ_REMOTE 3 | ||
60 | #define USB_WRITE_REMOTE 7 | ||
61 | #define USB_WRITE_REMOTE_TYPE 8 | ||
62 | |||
63 | #define USB_DEV_INIT 9 | ||
64 | |||
65 | #endif | ||
diff --git a/drivers/media/dvb/dibusb/dvb-fe-dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u-fe.c index 1872aa6d200a..d17d768038c6 100644 --- a/drivers/media/dvb/dibusb/dvb-fe-dtt200u.c +++ b/drivers/media/dvb/dvb-usb/dtt200u-fe.c | |||
@@ -1,42 +1,18 @@ | |||
1 | /* | 1 | /* Frontend part of the Linux driver for the Yakumo/Hama/Typhoon DVB-T |
2 | * dvb-dtt200u-fe.c is a driver which implements the frontend-part of the | 2 | * USB2.0 receiver. |
3 | * Yakumo/Typhoon/Hama USB2.0 boxes. It is hard-wired to the dibusb-driver as | ||
4 | * it uses the usb-transfer functions directly (maybe creating a | ||
5 | * generic-dvb-usb-lib for all usb-drivers will be reduce some more code.) | ||
6 | * | 3 | * |
7 | * Copyright (C) 2005 Patrick Boettcher <patrick.boettcher@desy.de> | 4 | * Copyright (C) 2005 Patrick Boettcher <patrick.boettcher@desy.de> |
8 | * | 5 | * |
9 | * see dvb-dibusb-core.c for copyright details. | 6 | * This program is free software; you can redistribute it and/or modify it |
10 | */ | 7 | * under the terms of the GNU General Public License as published by the Free |
11 | 8 | * Software Foundation, version 2. | |
12 | /* guessed protocol description (reverse engineered): | ||
13 | * read | ||
14 | * 00 - USB type 0x02 for usb2.0, 0x01 for usb1.1 | ||
15 | * 81 - <TS_LOCK> <current frequency divided by 250000> | ||
16 | * 82 - crash - do not touch | ||
17 | * 83 - crash - do not touch | ||
18 | * 84 - remote control | ||
19 | * 85 - crash - do not touch (OK, stop testing here) | ||
20 | * 88 - locking 2 bytes (0x80 0x40 == no signal, 0x89 0x20 == nice signal) | ||
21 | * 89 - noise-to-signal | ||
22 | * 8a - unkown 1 byte - signal_strength | ||
23 | * 8c - ber ??? | ||
24 | * 8d - ber | ||
25 | * 8e - unc | ||
26 | * | 9 | * |
27 | * write | 10 | * see Documentation/dvb/README.dvb-usb for more information |
28 | * 02 - bandwidth | ||
29 | * 03 - frequency (divided by 250000) | ||
30 | * 04 - pid table (index pid(7:0) pid(12:8)) | ||
31 | * 05 - reset the pid table | ||
32 | * 08 - demod transfer enabled or not (FX2 transfer is enabled by default) | ||
33 | */ | 11 | */ |
34 | 12 | #include "dtt200u.h" | |
35 | #include "dvb-dibusb.h" | ||
36 | #include "dvb_frontend.h" | ||
37 | 13 | ||
38 | struct dtt200u_fe_state { | 14 | struct dtt200u_fe_state { |
39 | struct usb_dibusb *dib; | 15 | struct dvb_usb_device *d; |
40 | 16 | ||
41 | struct dvb_frontend_parameters fep; | 17 | struct dvb_frontend_parameters fep; |
42 | struct dvb_frontend frontend; | 18 | struct dvb_frontend frontend; |
@@ -47,11 +23,11 @@ struct dtt200u_fe_state { | |||
47 | static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat) | 23 | static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat) |
48 | { | 24 | { |
49 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 25 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
50 | u8 bw[1] = { 0x81 }; | 26 | u8 bw = GET_TUNE_STAT; |
51 | u8 br[3] = { 0 }; | 27 | u8 br[3] = { 0 }; |
52 | // u8 bdeb[5] = { 0 }; | 28 | // u8 bdeb[5] = { 0 }; |
53 | 29 | ||
54 | dibusb_readwrite_usb(state->dib,bw,1,br,3); | 30 | dvb_usb_generic_rw(state->d,&bw,1,br,3,0); |
55 | switch (br[0]) { | 31 | switch (br[0]) { |
56 | case 0x01: | 32 | case 0x01: |
57 | *stat = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; | 33 | *stat = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK; |
@@ -60,12 +36,12 @@ static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat) | |||
60 | *stat = 0; | 36 | *stat = 0; |
61 | break; | 37 | break; |
62 | default: | 38 | default: |
63 | moan("br[0]",0x81); | 39 | moan("br[0]",GET_TUNE_STAT); |
64 | break; | 40 | break; |
65 | } | 41 | } |
66 | 42 | ||
67 | // bw[0] = 0x88; | 43 | // bw[0] = 0x88; |
68 | // dibusb_readwrite_usb(state->dib,bw,1,bdeb,5); | 44 | // dvb_usb_generic_rw(state->d,bw,1,bdeb,5,0); |
69 | 45 | ||
70 | // deb_info("%02x: %02x %02x %02x %02x %02x\n",bw[0],bdeb[0],bdeb[1],bdeb[2],bdeb[3],bdeb[4]); | 46 | // deb_info("%02x: %02x %02x %02x %02x %02x\n",bw[0],bdeb[0],bdeb[1],bdeb[2],bdeb[3],bdeb[4]); |
71 | 47 | ||
@@ -74,27 +50,26 @@ static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat) | |||
74 | static int dtt200u_fe_read_ber(struct dvb_frontend* fe, u32 *ber) | 50 | static int dtt200u_fe_read_ber(struct dvb_frontend* fe, u32 *ber) |
75 | { | 51 | { |
76 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 52 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
77 | u8 bw[1] = { 0x8d }; | 53 | u8 bw = GET_BER; |
78 | *ber = 0; | 54 | *ber = 0; |
79 | dibusb_readwrite_usb(state->dib,bw,1,(u8*) ber, 3); | 55 | dvb_usb_generic_rw(state->d,&bw,1,(u8*) ber,3,0); |
80 | return 0; | 56 | return 0; |
81 | } | 57 | } |
82 | 58 | ||
83 | static int dtt200u_fe_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) | 59 | static int dtt200u_fe_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) |
84 | { | 60 | { |
85 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 61 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
86 | u8 bw[1] = { 0x8c }; | 62 | u8 bw = GET_UNK; |
87 | *unc = 0; | 63 | *unc = 0; |
88 | dibusb_readwrite_usb(state->dib,bw,1,(u8*) unc, 3); | 64 | dvb_usb_generic_rw(state->d,&bw,1,(u8*) unc,3,0); |
89 | return 0; | 65 | return 0; |
90 | } | 66 | } |
91 | 67 | ||
92 | static int dtt200u_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strength) | 68 | static int dtt200u_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strength) |
93 | { | 69 | { |
94 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 70 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
95 | u8 bw[1] = { 0x8a }; | 71 | u8 bw = GET_SIG_STRENGTH, b; |
96 | u8 b; | 72 | dvb_usb_generic_rw(state->d,&bw,1,&b,1,0); |
97 | dibusb_readwrite_usb(state->dib,bw,1,&b, 1); | ||
98 | *strength = (b << 8) | b; | 73 | *strength = (b << 8) | b; |
99 | return 0; | 74 | return 0; |
100 | } | 75 | } |
@@ -102,18 +77,17 @@ static int dtt200u_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strengt | |||
102 | static int dtt200u_fe_read_snr(struct dvb_frontend* fe, u16 *snr) | 77 | static int dtt200u_fe_read_snr(struct dvb_frontend* fe, u16 *snr) |
103 | { | 78 | { |
104 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 79 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
105 | u8 bw[1] = { 0x89 }; | 80 | u8 bw = GET_SNR,br; |
106 | u8 br[1] = { 0 }; | 81 | dvb_usb_generic_rw(state->d,&bw,1,&br,1,0); |
107 | dibusb_readwrite_usb(state->dib,bw,1,br,1); | 82 | *snr = ~((br << 8) | br); |
108 | *snr = ((0xff - br[0]) << 8) | (0xff - br[0]); | ||
109 | return 0; | 83 | return 0; |
110 | } | 84 | } |
111 | 85 | ||
112 | static int dtt200u_fe_init(struct dvb_frontend* fe) | 86 | static int dtt200u_fe_init(struct dvb_frontend* fe) |
113 | { | 87 | { |
114 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 88 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
115 | u8 b[] = { 0x01 }; | 89 | u8 b = RESET_DEMOD; |
116 | return dibusb_write_usb(state->dib,b,1); | 90 | return dvb_usb_generic_write(state->d,&b,1); |
117 | } | 91 | } |
118 | 92 | ||
119 | static int dtt200u_fe_sleep(struct dvb_frontend* fe) | 93 | static int dtt200u_fe_sleep(struct dvb_frontend* fe) |
@@ -134,7 +108,7 @@ static int dtt200u_fe_set_frontend(struct dvb_frontend* fe, | |||
134 | { | 108 | { |
135 | struct dtt200u_fe_state *state = fe->demodulator_priv; | 109 | struct dtt200u_fe_state *state = fe->demodulator_priv; |
136 | u16 freq = fep->frequency / 250000; | 110 | u16 freq = fep->frequency / 250000; |
137 | u8 bw,bwbuf[2] = { 0x03, 0 }, freqbuf[3] = { 0x02, 0, 0 }; | 111 | u8 bw,bwbuf[2] = { SET_BANDWIDTH, 0 }, freqbuf[3] = { SET_FREQUENCY, 0, 0 }; |
138 | 112 | ||
139 | switch (fep->u.ofdm.bandwidth) { | 113 | switch (fep->u.ofdm.bandwidth) { |
140 | case BANDWIDTH_8_MHZ: bw = 8; break; | 114 | case BANDWIDTH_8_MHZ: bw = 8; break; |
@@ -147,11 +121,11 @@ static int dtt200u_fe_set_frontend(struct dvb_frontend* fe, | |||
147 | deb_info("set_frontend\n"); | 121 | deb_info("set_frontend\n"); |
148 | 122 | ||
149 | bwbuf[1] = bw; | 123 | bwbuf[1] = bw; |
150 | dibusb_write_usb(state->dib,bwbuf,2); | 124 | dvb_usb_generic_write(state->d,bwbuf,2); |
151 | 125 | ||
152 | freqbuf[1] = freq & 0xff; | 126 | freqbuf[1] = freq & 0xff; |
153 | freqbuf[2] = (freq >> 8) & 0xff; | 127 | freqbuf[2] = (freq >> 8) & 0xff; |
154 | dibusb_write_usb(state->dib,freqbuf,3); | 128 | dvb_usb_generic_write(state->d,freqbuf,3); |
155 | 129 | ||
156 | memcpy(&state->fep,fep,sizeof(struct dvb_frontend_parameters)); | 130 | memcpy(&state->fep,fep,sizeof(struct dvb_frontend_parameters)); |
157 | 131 | ||
@@ -172,37 +146,9 @@ static void dtt200u_fe_release(struct dvb_frontend* fe) | |||
172 | kfree(state); | 146 | kfree(state); |
173 | } | 147 | } |
174 | 148 | ||
175 | static int dtt200u_pid_control(struct dvb_frontend *fe,int index, int pid,int onoff) | ||
176 | { | ||
177 | struct dtt200u_fe_state *state = (struct dtt200u_fe_state*) fe->demodulator_priv; | ||
178 | u8 b_pid[4]; | ||
179 | pid = onoff ? pid : 0; | ||
180 | |||
181 | b_pid[0] = 0x04; | ||
182 | b_pid[1] = index; | ||
183 | b_pid[2] = pid & 0xff; | ||
184 | b_pid[3] = (pid >> 8) & 0xff; | ||
185 | |||
186 | dibusb_write_usb(state->dib,b_pid,4); | ||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | static int dtt200u_fifo_control(struct dvb_frontend *fe, int onoff) | ||
191 | { | ||
192 | struct dtt200u_fe_state *state = (struct dtt200u_fe_state*) fe->demodulator_priv; | ||
193 | u8 b_streaming[2] = { 0x08, onoff }; | ||
194 | u8 b_rst_pid[1] = { 0x05 }; | ||
195 | |||
196 | dibusb_write_usb(state->dib,b_streaming,2); | ||
197 | |||
198 | if (!onoff) | ||
199 | dibusb_write_usb(state->dib,b_rst_pid,1); | ||
200 | return 0; | ||
201 | } | ||
202 | |||
203 | static struct dvb_frontend_ops dtt200u_fe_ops; | 149 | static struct dvb_frontend_ops dtt200u_fe_ops; |
204 | 150 | ||
205 | struct dvb_frontend* dtt200u_fe_attach(struct usb_dibusb *dib, struct dib_fe_xfer_ops *xfer_ops) | 151 | struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d) |
206 | { | 152 | { |
207 | struct dtt200u_fe_state* state = NULL; | 153 | struct dtt200u_fe_state* state = NULL; |
208 | 154 | ||
@@ -214,14 +160,11 @@ struct dvb_frontend* dtt200u_fe_attach(struct usb_dibusb *dib, struct dib_fe_xfe | |||
214 | 160 | ||
215 | deb_info("attaching frontend dtt200u\n"); | 161 | deb_info("attaching frontend dtt200u\n"); |
216 | 162 | ||
217 | state->dib = dib; | 163 | state->d = d; |
218 | 164 | ||
219 | state->frontend.ops = &dtt200u_fe_ops; | 165 | state->frontend.ops = &dtt200u_fe_ops; |
220 | state->frontend.demodulator_priv = state; | 166 | state->frontend.demodulator_priv = state; |
221 | 167 | ||
222 | xfer_ops->fifo_ctrl = dtt200u_fifo_control; | ||
223 | xfer_ops->pid_ctrl = dtt200u_pid_control; | ||
224 | |||
225 | goto success; | 168 | goto success; |
226 | error: | 169 | error: |
227 | return NULL; | 170 | return NULL; |
diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c new file mode 100644 index 000000000000..fb2b5a2da137 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dtt200u.c | |||
@@ -0,0 +1,171 @@ | |||
1 | /* DVB USB library compliant Linux driver for the Yakumo/Hama/Typhoon DVB-T | ||
2 | * USB2.0 receiver. | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the Free | ||
8 | * Software Foundation, version 2. | ||
9 | * | ||
10 | * see Documentation/dvb/README.dvb-usb for more information | ||
11 | */ | ||
12 | #include "dtt200u.h" | ||
13 | |||
14 | /* debug */ | ||
15 | int dvb_usb_dtt200u_debug; | ||
16 | module_param_named(debug,dvb_usb_dtt200u_debug, int, 0644); | ||
17 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2 (or-able))." DVB_USB_DEBUG_STATUS); | ||
18 | |||
19 | static int dtt200u_streaming_ctrl(struct dvb_usb_device *d, int onoff) | ||
20 | { | ||
21 | u8 b_streaming[2] = { SET_TS_CTRL, onoff }; | ||
22 | u8 b_rst_pid = RESET_PID_FILTER; | ||
23 | |||
24 | dvb_usb_generic_write(d,b_streaming,2); | ||
25 | |||
26 | if (!onoff) | ||
27 | dvb_usb_generic_write(d,&b_rst_pid,1); | ||
28 | return 0; | ||
29 | } | ||
30 | |||
31 | static int dtt200u_pid_filter(struct dvb_usb_device *d, int index, u16 pid, int onoff) | ||
32 | { | ||
33 | u8 b_pid[4]; | ||
34 | pid = onoff ? pid : 0; | ||
35 | |||
36 | b_pid[0] = SET_PID_FILTER; | ||
37 | b_pid[1] = index; | ||
38 | b_pid[2] = pid & 0xff; | ||
39 | b_pid[3] = (pid >> 8) & 0xff; | ||
40 | |||
41 | return dvb_usb_generic_write(d,b_pid,4); | ||
42 | } | ||
43 | |||
44 | /* remote control */ | ||
45 | /* key list for the tiny remote control (Yakumo, don't know about the others) */ | ||
46 | static struct dvb_usb_rc_key dtt200u_rc_keys[] = { | ||
47 | { 0x80, 0x01, KEY_MUTE }, | ||
48 | { 0x80, 0x02, KEY_CHANNELDOWN }, | ||
49 | { 0x80, 0x03, KEY_VOLUMEDOWN }, | ||
50 | { 0x80, 0x04, KEY_1 }, | ||
51 | { 0x80, 0x05, KEY_2 }, | ||
52 | { 0x80, 0x06, KEY_3 }, | ||
53 | { 0x80, 0x07, KEY_4 }, | ||
54 | { 0x80, 0x08, KEY_5 }, | ||
55 | { 0x80, 0x09, KEY_6 }, | ||
56 | { 0x80, 0x0a, KEY_7 }, | ||
57 | { 0x00, 0x0c, KEY_ZOOM }, | ||
58 | { 0x80, 0x0d, KEY_0 }, | ||
59 | { 0x00, 0x0e, KEY_SELECT }, | ||
60 | { 0x80, 0x12, KEY_POWER }, | ||
61 | { 0x80, 0x1a, KEY_CHANNELUP }, | ||
62 | { 0x80, 0x1b, KEY_8 }, | ||
63 | { 0x80, 0x1e, KEY_VOLUMEUP }, | ||
64 | { 0x80, 0x1f, KEY_9 }, | ||
65 | }; | ||
66 | |||
67 | static int dtt200u_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | ||
68 | { | ||
69 | u8 key[5],cmd = GET_RC_KEY; | ||
70 | dvb_usb_generic_rw(d,&cmd,1,key,5,0); | ||
71 | dvb_usb_nec_rc_key_to_event(d,key,event,state); | ||
72 | if (key[0] != 0) | ||
73 | deb_info("key: %x %x %x %x %x\n",key[0],key[1],key[2],key[3],key[4]); | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static int dtt200u_frontend_attach(struct dvb_usb_device *d) | ||
78 | { | ||
79 | d->fe = dtt200u_fe_attach(d); | ||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | static struct dvb_usb_properties dtt200u_properties; | ||
84 | |||
85 | static int dtt200u_usb_probe(struct usb_interface *intf, | ||
86 | const struct usb_device_id *id) | ||
87 | { | ||
88 | return dvb_usb_device_init(intf,&dtt200u_properties,THIS_MODULE); | ||
89 | } | ||
90 | |||
91 | static struct usb_device_id dtt200u_usb_table [] = { | ||
92 | { USB_DEVICE(USB_VID_AVERMEDIA_UNK, USB_PID_DTT200U_COLD) }, | ||
93 | { USB_DEVICE(USB_VID_AVERMEDIA_UNK, USB_PID_DTT200U_WARM) }, | ||
94 | { 0 }, | ||
95 | }; | ||
96 | MODULE_DEVICE_TABLE(usb, dtt200u_usb_table); | ||
97 | |||
98 | static struct dvb_usb_properties dtt200u_properties = { | ||
99 | .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING, | ||
100 | .pid_filter_count = 255, /* It is a guess, but there are at least 10 */ | ||
101 | |||
102 | .usb_ctrl = CYPRESS_FX2, | ||
103 | .firmware = "dvb-usb-dtt200u-01.fw", | ||
104 | |||
105 | .streaming_ctrl = dtt200u_streaming_ctrl, | ||
106 | .pid_filter = dtt200u_pid_filter, | ||
107 | .frontend_attach = dtt200u_frontend_attach, | ||
108 | |||
109 | .rc_interval = 200, | ||
110 | .rc_key_map = dtt200u_rc_keys, | ||
111 | .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys), | ||
112 | .rc_query = dtt200u_rc_query, | ||
113 | |||
114 | .generic_bulk_ctrl_endpoint = 0x01, | ||
115 | |||
116 | /* parameter for the MPEG2-data transfer */ | ||
117 | .urb = { | ||
118 | .type = DVB_USB_BULK, | ||
119 | .count = 7, | ||
120 | .endpoint = 0x02, | ||
121 | .u = { | ||
122 | .bulk = { | ||
123 | .buffersize = 4096, | ||
124 | } | ||
125 | } | ||
126 | }, | ||
127 | |||
128 | .num_device_descs = 1, | ||
129 | .devices = { | ||
130 | { .name = "Yakumo/Hama/Typhoon DVB-T USB2.0)", | ||
131 | .cold_ids = { &dtt200u_usb_table[0], &dtt200u_usb_table[2] }, | ||
132 | .warm_ids = { &dtt200u_usb_table[1], NULL }, | ||
133 | }, | ||
134 | { 0 }, | ||
135 | } | ||
136 | }; | ||
137 | |||
138 | /* usb specific object needed to register this driver with the usb subsystem */ | ||
139 | static struct usb_driver dtt200u_usb_driver = { | ||
140 | .owner = THIS_MODULE, | ||
141 | .name = "Yakumo/Hama/Typhoon DVB-T USB2.0", | ||
142 | .probe = dtt200u_usb_probe, | ||
143 | .disconnect = dvb_usb_device_exit, | ||
144 | .id_table = dtt200u_usb_table, | ||
145 | }; | ||
146 | |||
147 | /* module stuff */ | ||
148 | static int __init dtt200u_usb_module_init(void) | ||
149 | { | ||
150 | int result; | ||
151 | if ((result = usb_register(&dtt200u_usb_driver))) { | ||
152 | err("usb_register failed. (%d)",result); | ||
153 | return result; | ||
154 | } | ||
155 | |||
156 | return 0; | ||
157 | } | ||
158 | |||
159 | static void __exit dtt200u_usb_module_exit(void) | ||
160 | { | ||
161 | /* deregister this driver from the USB subsystem */ | ||
162 | usb_deregister(&dtt200u_usb_driver); | ||
163 | } | ||
164 | |||
165 | module_init(dtt200u_usb_module_init); | ||
166 | module_exit(dtt200u_usb_module_exit); | ||
167 | |||
168 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
169 | MODULE_DESCRIPTION("Driver for the Yakumo/Hama/Typhoon DVB-T USB2.0 device"); | ||
170 | MODULE_VERSION("1.0"); | ||
171 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/dtt200u.h b/drivers/media/dvb/dvb-usb/dtt200u.h new file mode 100644 index 000000000000..ed4142071518 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dtt200u.h | |||
@@ -0,0 +1,66 @@ | |||
1 | /* Common header file of Linux driver for the Yakumo/Hama/Typhoon DVB-T | ||
2 | * USB2.0 receiver. | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the Free | ||
8 | * Software Foundation, version 2. | ||
9 | * | ||
10 | * see Documentation/dvb/README.dvb-usb for more information | ||
11 | */ | ||
12 | #ifndef _DVB_USB_DTT200U_H_ | ||
13 | #define _DVB_USB_DTT200U_H_ | ||
14 | |||
15 | #define DVB_USB_LOG_PREFIX "dtt200u" | ||
16 | #include "dvb-usb.h" | ||
17 | |||
18 | extern int dvb_usb_dtt200u_debug; | ||
19 | #define deb_info(args...) dprintk(dvb_usb_dtt200u_debug,0x01,args) | ||
20 | #define deb_xfer(args...) dprintk(dvb_usb_dtt200u_debug,0x02,args) | ||
21 | |||
22 | /* guessed protocol description (reverse engineered): | ||
23 | * read | ||
24 | * 00 - USB type 0x02 for usb2.0, 0x01 for usb1.1 | ||
25 | * 81 - <TS_LOCK> <current frequency divided by 250000> | ||
26 | * 82 - crash - do not touch | ||
27 | * 83 - crash - do not touch | ||
28 | * 84 - remote control | ||
29 | * 85 - crash - do not touch (OK, stop testing here) | ||
30 | * 88 - locking 2 bytes (0x80 0x40 == no signal, 0x89 0x20 == nice signal) | ||
31 | * 89 - noise-to-signal | ||
32 | * 8a - unkown 1 byte - signal_strength | ||
33 | * 8c - ber ??? | ||
34 | * 8d - ber | ||
35 | * 8e - unc | ||
36 | */ | ||
37 | |||
38 | #define GET_SPEED 0x00 | ||
39 | #define GET_TUNE_STAT 0x81 | ||
40 | #define GET_RC_KEY 0x84 | ||
41 | #define GET_STATUS 0x88 | ||
42 | #define GET_SNR 0x89 | ||
43 | #define GET_SIG_STRENGTH 0x8a | ||
44 | #define GET_UNK 0x8c | ||
45 | #define GET_BER 0x8d | ||
46 | #define GET_UNC 0x8e | ||
47 | |||
48 | /* write | ||
49 | * 01 - reset the demod | ||
50 | * 02 - frequency (divided by 250000) | ||
51 | * 03 - bandwidth | ||
52 | * 04 - pid table (index pid(7:0) pid(12:8)) | ||
53 | * 05 - reset the pid table | ||
54 | * 08 - demod transfer enabled or not (FX2 transfer is enabled by default) | ||
55 | */ | ||
56 | |||
57 | #define RESET_DEMOD 0x01 | ||
58 | #define SET_FREQUENCY 0x02 | ||
59 | #define SET_BANDWIDTH 0x03 | ||
60 | #define SET_PID_FILTER 0x04 | ||
61 | #define RESET_PID_FILTER 0x05 | ||
62 | #define SET_TS_CTRL 0x08 | ||
63 | |||
64 | extern struct dvb_frontend * dtt200u_fe_attach(struct dvb_usb_device *d); | ||
65 | |||
66 | #endif | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-common.h b/drivers/media/dvb/dvb-usb/dvb-usb-common.h new file mode 100644 index 000000000000..67e0d73fbceb --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb-common.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* dvb-usb-common.h is part of the DVB USB library. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
4 | * see dvb-usb-init.c for copyright information. | ||
5 | * | ||
6 | * a header file containing prototypes and types for internal use of the dvb-usb-lib | ||
7 | */ | ||
8 | #ifndef _DVB_USB_COMMON_H_ | ||
9 | #define _DVB_USB_COMMON_H_ | ||
10 | |||
11 | #define DVB_USB_LOG_PREFIX "dvb-usb" | ||
12 | #include "dvb-usb.h" | ||
13 | |||
14 | extern int dvb_usb_debug; | ||
15 | |||
16 | #define deb_info(args...) dprintk(dvb_usb_debug,0x01,args) | ||
17 | #define deb_xfer(args...) dprintk(dvb_usb_debug,0x02,args) | ||
18 | #define deb_pll(args...) dprintk(dvb_usb_debug,0x04,args) | ||
19 | #define deb_ts(args...) dprintk(dvb_usb_debug,0x08,args) | ||
20 | #define deb_err(args...) dprintk(dvb_usb_debug,0x10,args) | ||
21 | #define deb_rc(args...) dprintk(dvb_usb_debug,0x20,args) | ||
22 | #define deb_fw(args...) dprintk(dvb_usb_debug,0x40,args) | ||
23 | |||
24 | /* commonly used methods */ | ||
25 | extern int usb_cypress_load_firmware(struct usb_device *, const char *, int); | ||
26 | |||
27 | extern int dvb_usb_urb_submit(struct dvb_usb_device *); | ||
28 | extern int dvb_usb_urb_kill(struct dvb_usb_device *); | ||
29 | extern int dvb_usb_urb_init(struct dvb_usb_device *); | ||
30 | extern int dvb_usb_urb_exit(struct dvb_usb_device *); | ||
31 | |||
32 | extern int dvb_usb_i2c_init(struct dvb_usb_device *); | ||
33 | extern int dvb_usb_i2c_exit(struct dvb_usb_device *); | ||
34 | |||
35 | extern int dvb_usb_dvb_init(struct dvb_usb_device *); | ||
36 | extern int dvb_usb_dvb_exit(struct dvb_usb_device *); | ||
37 | |||
38 | extern int dvb_usb_fe_init(struct dvb_usb_device *); | ||
39 | extern int dvb_usb_fe_exit(struct dvb_usb_device *); | ||
40 | |||
41 | extern int dvb_usb_remote_init(struct dvb_usb_device *); | ||
42 | extern int dvb_usb_remote_exit(struct dvb_usb_device *); | ||
43 | |||
44 | #endif | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c new file mode 100644 index 000000000000..bdd72f779707 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c | |||
@@ -0,0 +1,210 @@ | |||
1 | /* dvb-usb-dvb.c is part of the DVB USB library. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
4 | * see dvb-usb-init.c for copyright information. | ||
5 | * | ||
6 | * This file contains functions for initializing and handling the | ||
7 | * linux-dvb API. | ||
8 | */ | ||
9 | #include "dvb-usb-common.h" | ||
10 | |||
11 | static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) | ||
12 | { | ||
13 | struct dvb_usb_device *d = dvbdmxfeed->demux->priv; | ||
14 | int newfeedcount,ret; | ||
15 | |||
16 | if (d == NULL) | ||
17 | return -ENODEV; | ||
18 | |||
19 | newfeedcount = d->feedcount + (onoff ? 1 : -1); | ||
20 | |||
21 | /* | ||
22 | * stop feed before setting a new pid if there will be no pid anymore | ||
23 | */ | ||
24 | if (newfeedcount == 0) { | ||
25 | deb_ts("stop feeding\n"); | ||
26 | |||
27 | if (d->props.streaming_ctrl != NULL) | ||
28 | if ((ret = d->props.streaming_ctrl(d,0))) | ||
29 | err("error while stopping stream."); | ||
30 | |||
31 | dvb_usb_urb_kill(d); | ||
32 | } | ||
33 | |||
34 | d->feedcount = newfeedcount; | ||
35 | |||
36 | /* activate the pid on the device specific pid_filter */ | ||
37 | deb_ts("setting pid: %5d %04x at index %d '%s'\n",dvbdmxfeed->pid,dvbdmxfeed->pid,dvbdmxfeed->index,onoff ? "on" : "off"); | ||
38 | if (d->props.caps & DVB_USB_HAS_PID_FILTER && | ||
39 | d->pid_filtering && | ||
40 | d->props.pid_filter != NULL) | ||
41 | d->props.pid_filter(d,dvbdmxfeed->index,dvbdmxfeed->pid,onoff); | ||
42 | |||
43 | /* start the feed if this was the first feed and there is still a feed | ||
44 | * for reception. | ||
45 | */ | ||
46 | if (d->feedcount == onoff && d->feedcount > 0) { | ||
47 | |||
48 | deb_ts("controlling pid parser\n"); | ||
49 | if (d->props.caps & DVB_USB_HAS_PID_FILTER && | ||
50 | d->props.caps & DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF && | ||
51 | d->props.pid_filter_ctrl != NULL) | ||
52 | if (d->props.pid_filter_ctrl(d,d->pid_filtering) < 0) | ||
53 | err("could not handle pid_parser"); | ||
54 | |||
55 | deb_ts("start feeding\n"); | ||
56 | if (d->props.streaming_ctrl != NULL) | ||
57 | if (d->props.streaming_ctrl(d,1)) { | ||
58 | err("error while enabling fifo."); | ||
59 | return -ENODEV; | ||
60 | } | ||
61 | |||
62 | dvb_usb_urb_submit(d); | ||
63 | } | ||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | static int dvb_usb_start_feed(struct dvb_demux_feed *dvbdmxfeed) | ||
68 | { | ||
69 | deb_ts("start pid: 0x%04x, feedtype: %d\n", dvbdmxfeed->pid,dvbdmxfeed->type); | ||
70 | return dvb_usb_ctrl_feed(dvbdmxfeed,1); | ||
71 | } | ||
72 | |||
73 | static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) | ||
74 | { | ||
75 | deb_ts("stop pid: 0x%04x, feedtype: %d\n", dvbdmxfeed->pid, dvbdmxfeed->type); | ||
76 | return dvb_usb_ctrl_feed(dvbdmxfeed,0); | ||
77 | } | ||
78 | |||
79 | int dvb_usb_dvb_init(struct dvb_usb_device *d) | ||
80 | { | ||
81 | int ret; | ||
82 | |||
83 | if ((ret = dvb_register_adapter(&d->dvb_adap, d->desc->name, | ||
84 | d->owner)) < 0) { | ||
85 | deb_info("dvb_register_adapter failed: error %d", ret); | ||
86 | goto err; | ||
87 | } | ||
88 | d->dvb_adap.priv = d; | ||
89 | |||
90 | if (d->props.read_mac_address) { | ||
91 | if (d->props.read_mac_address(d,d->dvb_adap.proposed_mac) == 0) | ||
92 | info("MAC address: %02x:%02x:%02x:%02x:%02x:%02x",d->dvb_adap.proposed_mac[0], | ||
93 | d->dvb_adap.proposed_mac[1],d->dvb_adap.proposed_mac[2], | ||
94 | d->dvb_adap.proposed_mac[3],d->dvb_adap.proposed_mac[4], | ||
95 | d->dvb_adap.proposed_mac[5]); | ||
96 | else | ||
97 | err("MAC address reading failed."); | ||
98 | } | ||
99 | |||
100 | |||
101 | d->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING; | ||
102 | d->demux.priv = d; | ||
103 | |||
104 | d->demux.feednum = d->demux.filternum = d->max_feed_count; | ||
105 | d->demux.start_feed = dvb_usb_start_feed; | ||
106 | d->demux.stop_feed = dvb_usb_stop_feed; | ||
107 | d->demux.write_to_decoder = NULL; | ||
108 | if ((ret = dvb_dmx_init(&d->demux)) < 0) { | ||
109 | err("dvb_dmx_init failed: error %d",ret); | ||
110 | goto err_dmx; | ||
111 | } | ||
112 | |||
113 | d->dmxdev.filternum = d->demux.filternum; | ||
114 | d->dmxdev.demux = &d->demux.dmx; | ||
115 | d->dmxdev.capabilities = 0; | ||
116 | if ((ret = dvb_dmxdev_init(&d->dmxdev, &d->dvb_adap)) < 0) { | ||
117 | err("dvb_dmxdev_init failed: error %d",ret); | ||
118 | goto err_dmx_dev; | ||
119 | } | ||
120 | |||
121 | dvb_net_init(&d->dvb_adap, &d->dvb_net, &d->demux.dmx); | ||
122 | |||
123 | goto success; | ||
124 | err_dmx_dev: | ||
125 | dvb_dmx_release(&d->demux); | ||
126 | err_dmx: | ||
127 | dvb_unregister_adapter(&d->dvb_adap); | ||
128 | err: | ||
129 | return ret; | ||
130 | success: | ||
131 | d->state |= DVB_USB_STATE_DVB; | ||
132 | return 0; | ||
133 | } | ||
134 | |||
135 | int dvb_usb_dvb_exit(struct dvb_usb_device *d) | ||
136 | { | ||
137 | if (d->state & DVB_USB_STATE_DVB) { | ||
138 | deb_info("unregistering DVB part\n"); | ||
139 | dvb_net_release(&d->dvb_net); | ||
140 | d->demux.dmx.close(&d->demux.dmx); | ||
141 | dvb_dmxdev_release(&d->dmxdev); | ||
142 | dvb_dmx_release(&d->demux); | ||
143 | dvb_unregister_adapter(&d->dvb_adap); | ||
144 | d->state &= ~DVB_USB_STATE_DVB; | ||
145 | } | ||
146 | return 0; | ||
147 | } | ||
148 | |||
149 | static int dvb_usb_fe_wakeup(struct dvb_frontend *fe) | ||
150 | { | ||
151 | struct dvb_usb_device *d = fe->dvb->priv; | ||
152 | |||
153 | if (d->props.power_ctrl) | ||
154 | d->props.power_ctrl(d,1); | ||
155 | |||
156 | if (d->fe_init) | ||
157 | d->fe_init(fe); | ||
158 | |||
159 | return 0; | ||
160 | } | ||
161 | |||
162 | static int dvb_usb_fe_sleep(struct dvb_frontend *fe) | ||
163 | { | ||
164 | struct dvb_usb_device *d = fe->dvb->priv; | ||
165 | |||
166 | if (d->fe_sleep) | ||
167 | d->fe_sleep(fe); | ||
168 | |||
169 | if (d->props.power_ctrl) | ||
170 | d->props.power_ctrl(d,0); | ||
171 | |||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | int dvb_usb_fe_init(struct dvb_usb_device* d) | ||
176 | { | ||
177 | if (d->props.frontend_attach == NULL) { | ||
178 | err("strange '%s' don't want to attach a frontend.",d->desc->name); | ||
179 | return 0; | ||
180 | } | ||
181 | |||
182 | d->props.frontend_attach(d); | ||
183 | |||
184 | /* re-assign sleep and wakeup functions */ | ||
185 | if (d->fe != NULL) { | ||
186 | d->fe_init = d->fe->ops->init; d->fe->ops->init = dvb_usb_fe_wakeup; | ||
187 | d->fe_sleep = d->fe->ops->sleep; d->fe->ops->sleep = dvb_usb_fe_sleep; | ||
188 | |||
189 | if (dvb_register_frontend(&d->dvb_adap, d->fe)) { | ||
190 | err("Frontend registration failed."); | ||
191 | if (d->fe->ops->release) | ||
192 | d->fe->ops->release(d->fe); | ||
193 | d->fe = NULL; | ||
194 | return -ENODEV; | ||
195 | } | ||
196 | } else | ||
197 | err("no frontend was attached by '%s'",d->desc->name); | ||
198 | |||
199 | if (d->props.tuner_attach != NULL) | ||
200 | d->props.tuner_attach(d); | ||
201 | |||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | int dvb_usb_fe_exit(struct dvb_usb_device *d) | ||
206 | { | ||
207 | if (d->fe != NULL) | ||
208 | dvb_unregister_frontend(d->fe); | ||
209 | return 0; | ||
210 | } | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c new file mode 100644 index 000000000000..5244e39770a0 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c | |||
@@ -0,0 +1,100 @@ | |||
1 | /* dvb-usb-firmware.c is part of the DVB USB library. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
4 | * see dvb-usb-init.c for copyright information. | ||
5 | * | ||
6 | * This file contains functions for downloading the firmware to Cypress FX 1 and 2 based devices. | ||
7 | * | ||
8 | * FIXME: This part does actually not belong to dvb-usb, but to the usb-subsystem. | ||
9 | */ | ||
10 | #include "dvb-usb-common.h" | ||
11 | |||
12 | #include <linux/firmware.h> | ||
13 | #include <linux/usb.h> | ||
14 | |||
15 | struct usb_cypress_controller { | ||
16 | int id; | ||
17 | const char *name; /* name of the usb controller */ | ||
18 | u16 cpu_cs_register; /* needs to be restarted, when the firmware has been downloaded. */ | ||
19 | }; | ||
20 | |||
21 | static struct usb_cypress_controller cypress[] = { | ||
22 | { .id = CYPRESS_AN2135, .name = "Cypress AN2135", .cpu_cs_register = 0x7f92 }, | ||
23 | { .id = CYPRESS_AN2235, .name = "Cypress AN2235", .cpu_cs_register = 0x7f92 }, | ||
24 | { .id = CYPRESS_FX2, .name = "Cypress FX2", .cpu_cs_register = 0xe600 }, | ||
25 | }; | ||
26 | |||
27 | /* | ||
28 | * load a firmware packet to the device | ||
29 | */ | ||
30 | static int usb_cypress_writemem(struct usb_device *udev,u16 addr,u8 *data, u8 len) | ||
31 | { | ||
32 | return usb_control_msg(udev, usb_sndctrlpipe(udev,0), | ||
33 | 0xa0, USB_TYPE_VENDOR, addr, 0x00, data, len, 5*HZ); | ||
34 | } | ||
35 | |||
36 | int usb_cypress_load_firmware(struct usb_device *udev, const char *filename, int type) | ||
37 | { | ||
38 | const struct firmware *fw = NULL; | ||
39 | u16 addr; | ||
40 | u8 *b,*p; | ||
41 | int ret = 0,i; | ||
42 | |||
43 | if ((ret = request_firmware(&fw, filename, &udev->dev)) != 0) { | ||
44 | err("did not find the firmware file. (%s) " | ||
45 | "Please see linux/Documentation/dvb/ for more details on firmware-problems.", | ||
46 | filename); | ||
47 | return ret; | ||
48 | } | ||
49 | |||
50 | info("downloading firmware from file '%s' to the '%s'",filename,cypress[type].name); | ||
51 | |||
52 | p = kmalloc(fw->size,GFP_KERNEL); | ||
53 | if (p != NULL) { | ||
54 | u8 reset; | ||
55 | /* | ||
56 | * you cannot use the fw->data as buffer for | ||
57 | * usb_control_msg, a new buffer has to be | ||
58 | * created | ||
59 | */ | ||
60 | memcpy(p,fw->data,fw->size); | ||
61 | |||
62 | /* stop the CPU */ | ||
63 | reset = 1; | ||
64 | if ((ret = usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1)) != 1) | ||
65 | err("could not stop the USB controller CPU."); | ||
66 | for(i = 0; p[i+3] == 0 && i < fw->size; ) { | ||
67 | b = (u8 *) &p[i]; | ||
68 | addr = cpu_to_le16( *((u16 *) &b[1]) ); | ||
69 | |||
70 | deb_fw("writing to address 0x%04x (buffer: 0x%02x%02x)\n",addr,b[1],b[2]); | ||
71 | |||
72 | ret = usb_cypress_writemem(udev,addr,&b[4],b[0]); | ||
73 | |||
74 | if (ret != b[0]) { | ||
75 | err("error while transferring firmware " | ||
76 | "(transferred size: %d, block size: %d)", | ||
77 | ret,b[0]); | ||
78 | ret = -EINVAL; | ||
79 | break; | ||
80 | } | ||
81 | i += 5 + b[0]; | ||
82 | } | ||
83 | /* length in ret */ | ||
84 | if (ret > 0) | ||
85 | ret = 0; | ||
86 | /* restart the CPU */ | ||
87 | reset = 0; | ||
88 | if (ret || usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1) != 1) { | ||
89 | err("could not restart the USB controller CPU."); | ||
90 | ret = -EINVAL; | ||
91 | } | ||
92 | |||
93 | kfree(p); | ||
94 | } else { | ||
95 | ret = -ENOMEM; | ||
96 | } | ||
97 | release_firmware(fw); | ||
98 | |||
99 | return ret; | ||
100 | } | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c new file mode 100644 index 000000000000..9f0a8d90d146 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c | |||
@@ -0,0 +1,118 @@ | |||
1 | /* dvb-usb-i2c.c is part of the DVB USB library. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
4 | * see dvb-usb-init.c for copyright information. | ||
5 | * | ||
6 | * This file contains functions for (de-)initializing an I2C adapter. | ||
7 | */ | ||
8 | #include "dvb-usb-common.h" | ||
9 | |||
10 | int dvb_usb_i2c_init(struct dvb_usb_device *d) | ||
11 | { | ||
12 | int ret = 0; | ||
13 | |||
14 | if (!(d->props.caps & DVB_USB_IS_AN_I2C_ADAPTER)) | ||
15 | return 0; | ||
16 | |||
17 | if (d->props.i2c_algo == NULL) { | ||
18 | err("no i2c algorithm specified"); | ||
19 | return -EINVAL; | ||
20 | } | ||
21 | |||
22 | strncpy(d->i2c_adap.name,d->desc->name,I2C_NAME_SIZE); | ||
23 | #ifdef I2C_ADAP_CLASS_TV_DIGITAL | ||
24 | d->i2c_adap.class = I2C_ADAP_CLASS_TV_DIGITAL, | ||
25 | #else | ||
26 | d->i2c_adap.class = I2C_CLASS_TV_DIGITAL, | ||
27 | #endif | ||
28 | d->i2c_adap.algo = d->props.i2c_algo; | ||
29 | d->i2c_adap.algo_data = NULL; | ||
30 | d->i2c_adap.id = I2C_ALGO_BIT; | ||
31 | |||
32 | i2c_set_adapdata(&d->i2c_adap, d); | ||
33 | |||
34 | if ((ret = i2c_add_adapter(&d->i2c_adap)) < 0) | ||
35 | err("could not add i2c adapter"); | ||
36 | |||
37 | d->state |= DVB_USB_STATE_I2C; | ||
38 | |||
39 | return ret; | ||
40 | } | ||
41 | |||
42 | int dvb_usb_i2c_exit(struct dvb_usb_device *d) | ||
43 | { | ||
44 | if (d->state & DVB_USB_STATE_I2C) | ||
45 | i2c_del_adapter(&d->i2c_adap); | ||
46 | d->state &= ~DVB_USB_STATE_I2C; | ||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | int dvb_usb_pll_init_i2c(struct dvb_frontend *fe) | ||
51 | { | ||
52 | struct dvb_usb_device *d = fe->dvb->priv; | ||
53 | struct i2c_msg msg = { .addr = d->pll_addr, .flags = 0, .buf = d->pll_init, .len = 4 }; | ||
54 | int ret = 0; | ||
55 | |||
56 | /* if there is nothing to initialize */ | ||
57 | if (d->pll_init[0] == 0x00 && d->pll_init[1] == 0x00 && | ||
58 | d->pll_init[2] == 0x00 && d->pll_init[3] == 0x00) | ||
59 | return 0; | ||
60 | |||
61 | if (d->tuner_pass_ctrl) | ||
62 | d->tuner_pass_ctrl(fe,1,d->pll_addr); | ||
63 | |||
64 | deb_pll("pll init: %x\n",d->pll_addr); | ||
65 | deb_pll("pll-buf: %x %x %x %x\n",d->pll_init[0],d->pll_init[1], | ||
66 | d->pll_init[2],d->pll_init[3]); | ||
67 | |||
68 | if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) { | ||
69 | err("tuner i2c write failed for pll_init."); | ||
70 | ret = -EREMOTEIO; | ||
71 | } | ||
72 | msleep(1); | ||
73 | |||
74 | if (d->tuner_pass_ctrl) | ||
75 | d->tuner_pass_ctrl(fe,0,d->pll_addr); | ||
76 | return ret; | ||
77 | } | ||
78 | EXPORT_SYMBOL(dvb_usb_pll_init_i2c); | ||
79 | |||
80 | int dvb_usb_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep, u8 b[5]) | ||
81 | { | ||
82 | struct dvb_usb_device *d = fe->dvb->priv; | ||
83 | |||
84 | deb_pll("pll addr: %x, freq: %d %p\n",d->pll_addr,fep->frequency,d->pll_desc); | ||
85 | |||
86 | b[0] = d->pll_addr << 1; | ||
87 | dvb_pll_configure(d->pll_desc,&b[1],fep->frequency,fep->u.ofdm.bandwidth); | ||
88 | |||
89 | deb_pll("pll-buf: %x %x %x %x %x\n",b[0],b[1],b[2],b[3],b[4]); | ||
90 | |||
91 | return 0; | ||
92 | } | ||
93 | EXPORT_SYMBOL(dvb_usb_pll_set); | ||
94 | |||
95 | int dvb_usb_pll_set_i2c(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) | ||
96 | { | ||
97 | struct dvb_usb_device *d = fe->dvb->priv; | ||
98 | int ret = 0; | ||
99 | u8 b[5]; | ||
100 | struct i2c_msg msg = { .addr = d->pll_addr, .flags = 0, .buf = &b[1], .len = 4 }; | ||
101 | |||
102 | dvb_usb_pll_set(fe,fep,b); | ||
103 | |||
104 | if (d->tuner_pass_ctrl) | ||
105 | d->tuner_pass_ctrl(fe,1,d->pll_addr); | ||
106 | |||
107 | if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) { | ||
108 | err("tuner i2c write failed for pll_set."); | ||
109 | ret = -EREMOTEIO; | ||
110 | } | ||
111 | msleep(1); | ||
112 | |||
113 | if (d->tuner_pass_ctrl) | ||
114 | d->tuner_pass_ctrl(fe,0,d->pll_addr); | ||
115 | |||
116 | return ret; | ||
117 | } | ||
118 | EXPORT_SYMBOL(dvb_usb_pll_set_i2c); | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h new file mode 100644 index 000000000000..bcb34191868b --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /* dvb-usb-ids.h is part of the DVB USB library. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) see | ||
4 | * dvb-usb-init.c for copyright information. | ||
5 | * | ||
6 | * a header file containing define's for the USB device supported by the | ||
7 | * various drivers. | ||
8 | */ | ||
9 | #ifndef _DVB_USB_IDS_H_ | ||
10 | #define _DVB_USB_IDS_H_ | ||
11 | |||
12 | /* Vendor IDs */ | ||
13 | #define USB_VID_ADSTECH 0x06e1 | ||
14 | #define USB_VID_ANCHOR 0x0547 | ||
15 | #define USB_VID_AVERMEDIA_UNK 0x14aa | ||
16 | #define USB_VID_AVERMEDIA 0x07ca | ||
17 | #define USB_VID_COMPRO 0x185b | ||
18 | #define USB_VID_COMPRO_UNK 0x145f | ||
19 | #define USB_VID_CYPRESS 0x04b4 | ||
20 | #define USB_VID_DIBCOM 0x10b8 | ||
21 | #define USB_VID_DVICO 0x0fe9 | ||
22 | #define USB_VID_EMPIA 0xeb1a | ||
23 | #define USB_VID_GRANDTEC 0x5032 | ||
24 | #define USB_VID_HANFTEK 0x15f4 | ||
25 | #define USB_VID_HAUPPAUGE 0x2040 | ||
26 | #define USB_VID_HYPER_PALTEK 0x1025 | ||
27 | #define USB_VID_VISIONPLUS 0x13d3 | ||
28 | #define USB_VID_TWINHAN 0x1822 | ||
29 | #define USB_VID_ULTIMA_ELECTRONIC 0x05d8 | ||
30 | |||
31 | /* Product IDs */ | ||
32 | #define USB_PID_ADSTECH_USB2_COLD 0xa333 | ||
33 | #define USB_PID_ADSTECH_USB2_WARM 0xa334 | ||
34 | #define USB_PID_AVERMEDIA_DVBT_USB_COLD 0x0001 | ||
35 | #define USB_PID_AVERMEDIA_DVBT_USB_WARM 0x0002 | ||
36 | #define USB_PID_AVERMEDIA_DVBT_USB2_COLD 0xa800 | ||
37 | #define USB_PID_AVERMEDIA_DVBT_USB2_WARM 0xa801 | ||
38 | #define USB_PID_COMPRO_DVBU2000_COLD 0xd000 | ||
39 | #define USB_PID_COMPRO_DVBU2000_WARM 0xd001 | ||
40 | #define USB_PID_COMPRO_DVBU2000_UNK_COLD 0x010c | ||
41 | #define USB_PID_COMPRO_DVBU2000_UNK_WARM 0x010d | ||
42 | #define USB_PID_DIBCOM_MOD3000_COLD 0x0bb8 | ||
43 | #define USB_PID_DIBCOM_MOD3000_WARM 0x0bb9 | ||
44 | #define USB_PID_DIBCOM_MOD3001_COLD 0x0bc6 | ||
45 | #define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7 | ||
46 | #define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131 | ||
47 | #define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0 | ||
48 | #define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1 | ||
49 | #define USB_PID_KWORLD_VSTREAM_COLD 0x17de | ||
50 | #define USB_PID_KWORLD_VSTREAM_WARM 0x17df | ||
51 | #define USB_PID_TWINHAN_VP7041_COLD 0x3201 | ||
52 | #define USB_PID_TWINHAN_VP7041_WARM 0x3202 | ||
53 | #define USB_PID_TWINHAN_VP7045_COLD 0x3205 | ||
54 | #define USB_PID_TWINHAN_VP7045_WARM 0x3206 | ||
55 | #define USB_PID_DNTV_TINYUSB2_COLD 0x3223 | ||
56 | #define USB_PID_DNTV_TINYUSB2_WARM 0x3224 | ||
57 | #define USB_PID_TWINHAN_VP7021_COLD 0x3207 | ||
58 | #define USB_PID_TWINHAN_VP7021_WARM 0x3208 | ||
59 | #define USB_PID_ULTIMA_TVBOX_COLD 0x8105 | ||
60 | #define USB_PID_ULTIMA_TVBOX_WARM 0x8106 | ||
61 | #define USB_PID_ULTIMA_TVBOX_AN2235_COLD 0x8107 | ||
62 | #define USB_PID_ULTIMA_TVBOX_AN2235_WARM 0x8108 | ||
63 | #define USB_PID_ULTIMA_TVBOX_ANCHOR_COLD 0x2235 | ||
64 | #define USB_PID_ULTIMA_TVBOX_USB2_COLD 0x8109 | ||
65 | #define USB_PID_ULTIMA_TVBOX_USB2_FX_COLD 0x8613 | ||
66 | #define USB_PID_ULTIMA_TVBOX_USB2_FX_WARM 0x1002 | ||
67 | #define USB_PID_UNK_HYPER_PALTEK_COLD 0x005e | ||
68 | #define USB_PID_UNK_HYPER_PALTEK_WARM 0x005f | ||
69 | #define USB_PID_HANFTEK_UMT_010_COLD 0x0001 | ||
70 | #define USB_PID_HANFTEK_UMT_010_WARM 0x0015 | ||
71 | #define USB_PID_DTT200U_COLD 0x0201 | ||
72 | #define USB_PID_DTT200U_WARM 0x0301 | ||
73 | #define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300 | ||
74 | #define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301 | ||
75 | #define USB_PID_NEBULA_DIGITV 0x0201 | ||
76 | #define USB_PID_DVICO_BLUEBIRD_LGZ201 0xdb00 | ||
77 | #define USB_PID_DVICO_BLUEBIRD_TH7579 0xdb10 | ||
78 | #define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820 | ||
79 | #define USB_PID_DVICO_BLUEBIRD_LGZ201_1 0xdb01 | ||
80 | #define USB_PID_DVICO_BLUEBIRD_TH7579_2 0xdb11 | ||
81 | |||
82 | |||
83 | #endif | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/drivers/media/dvb/dvb-usb/dvb-usb-init.c new file mode 100644 index 000000000000..3aadec974cf1 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb-init.c | |||
@@ -0,0 +1,211 @@ | |||
1 | /* | ||
2 | * DVB USB library - provides a generic interface for a DVB USB device driver. | ||
3 | * | ||
4 | * dvb-usb-init.c | ||
5 | * | ||
6 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the Free | ||
10 | * Software Foundation, version 2. | ||
11 | * | ||
12 | * see Documentation/dvb/README.dvb-usb for more information | ||
13 | */ | ||
14 | #include "dvb-usb-common.h" | ||
15 | |||
16 | /* debug */ | ||
17 | int dvb_usb_debug; | ||
18 | module_param_named(debug,dvb_usb_debug, int, 0644); | ||
19 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,pll=4,ts=8,err=16,rc=32,fw=64 (or-able))." DVB_USB_DEBUG_STATUS); | ||
20 | |||
21 | /* general initialization functions */ | ||
22 | int dvb_usb_exit(struct dvb_usb_device *d) | ||
23 | { | ||
24 | deb_info("state before exiting everything: %x\n",d->state); | ||
25 | dvb_usb_remote_exit(d); | ||
26 | dvb_usb_fe_exit(d); | ||
27 | dvb_usb_i2c_exit(d); | ||
28 | dvb_usb_dvb_exit(d); | ||
29 | dvb_usb_urb_exit(d); | ||
30 | deb_info("state should be zero now: %x\n",d->state); | ||
31 | d->state = DVB_USB_STATE_INIT; | ||
32 | kfree(d->priv); | ||
33 | kfree(d); | ||
34 | return 0; | ||
35 | } | ||
36 | |||
37 | static int dvb_usb_init(struct dvb_usb_device *d) | ||
38 | { | ||
39 | int ret = 0; | ||
40 | |||
41 | sema_init(&d->usb_sem, 1); | ||
42 | sema_init(&d->i2c_sem, 1); | ||
43 | |||
44 | d->state = DVB_USB_STATE_INIT; | ||
45 | |||
46 | /* check the capabilites and set appropriate variables */ | ||
47 | |||
48 | /* speed - when running at FULL speed we need a HW PID filter */ | ||
49 | if (d->udev->speed == USB_SPEED_FULL && !(d->props.caps & DVB_USB_HAS_PID_FILTER)) { | ||
50 | err("This USB2.0 device cannot be run on a USB1.1 port. (it lacks a HW PID filter)"); | ||
51 | return -ENODEV; | ||
52 | } | ||
53 | |||
54 | if ((d->udev->speed == USB_SPEED_FULL && d->props.caps & DVB_USB_HAS_PID_FILTER) || | ||
55 | (d->props.caps & DVB_USB_NEED_PID_FILTERING)) { | ||
56 | info("will use the device's hw PID filter."); | ||
57 | d->pid_filtering = 1; | ||
58 | d->max_feed_count = d->props.pid_filter_count; | ||
59 | } else { | ||
60 | info("will pass the complete MPEG2 transport stream to the demuxer."); | ||
61 | d->pid_filtering = 0; | ||
62 | d->max_feed_count = 255; | ||
63 | } | ||
64 | |||
65 | if (d->props.power_ctrl) | ||
66 | d->props.power_ctrl(d,1); | ||
67 | |||
68 | if ((ret = dvb_usb_urb_init(d)) || | ||
69 | (ret = dvb_usb_dvb_init(d)) || | ||
70 | (ret = dvb_usb_i2c_init(d)) || | ||
71 | (ret = dvb_usb_fe_init(d))) { | ||
72 | dvb_usb_exit(d); | ||
73 | return ret; | ||
74 | } | ||
75 | |||
76 | if ((ret = dvb_usb_remote_init(d))) | ||
77 | err("could not initialize remote control."); | ||
78 | |||
79 | if (d->props.power_ctrl) | ||
80 | d->props.power_ctrl(d,0); | ||
81 | |||
82 | return 0; | ||
83 | } | ||
84 | |||
85 | /* determine the name and the state of the just found USB device */ | ||
86 | static struct dvb_usb_device_description * dvb_usb_find_device(struct usb_device *udev,struct dvb_usb_properties *props, int *cold) | ||
87 | { | ||
88 | int i,j; | ||
89 | struct dvb_usb_device_description *desc = NULL; | ||
90 | *cold = -1; | ||
91 | |||
92 | for (i = 0; i < props->num_device_descs; i++) { | ||
93 | |||
94 | for (j = 0; j < DVB_USB_ID_MAX_NUM && props->devices[i].cold_ids[j] != NULL; j++) { | ||
95 | deb_info("check for cold %x %x\n",props->devices[i].cold_ids[j]->idVendor, props->devices[i].cold_ids[j]->idProduct); | ||
96 | if (props->devices[i].cold_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) && | ||
97 | props->devices[i].cold_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) { | ||
98 | *cold = 1; | ||
99 | desc = &props->devices[i]; | ||
100 | break; | ||
101 | } | ||
102 | } | ||
103 | |||
104 | if (desc != NULL) | ||
105 | break; | ||
106 | |||
107 | for (j = 0; j < DVB_USB_ID_MAX_NUM && props->devices[i].warm_ids[j] != NULL; j++) { | ||
108 | deb_info("check for warm %x %x\n",props->devices[i].warm_ids[j]->idVendor, props->devices[i].warm_ids[j]->idProduct); | ||
109 | if (props->devices[i].warm_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) && | ||
110 | props->devices[i].warm_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) { | ||
111 | *cold = 0; | ||
112 | desc = &props->devices[i]; | ||
113 | break; | ||
114 | } | ||
115 | } | ||
116 | } | ||
117 | |||
118 | if (desc != NULL && props->identify_state != NULL) | ||
119 | props->identify_state(udev,props,&desc,cold); | ||
120 | |||
121 | return desc; | ||
122 | } | ||
123 | |||
124 | /* | ||
125 | * USB | ||
126 | */ | ||
127 | int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties *props, struct module *owner) | ||
128 | { | ||
129 | struct usb_device *udev = interface_to_usbdev(intf); | ||
130 | struct dvb_usb_device *d = NULL; | ||
131 | struct dvb_usb_device_description *desc = NULL; | ||
132 | |||
133 | int ret = -ENOMEM,cold=0; | ||
134 | |||
135 | if ((desc = dvb_usb_find_device(udev,props,&cold)) == NULL) { | ||
136 | deb_err("something went very wrong, device was not found in current device list - let's see what comes next.\n"); | ||
137 | return -ENODEV; | ||
138 | } | ||
139 | |||
140 | if (cold) { | ||
141 | info("found a '%s' in cold state, will try to load a firmware",desc->name); | ||
142 | ret = usb_cypress_load_firmware(udev,props->firmware,props->usb_ctrl); | ||
143 | } else { | ||
144 | info("found a '%s' in warm state.",desc->name); | ||
145 | d = kmalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); | ||
146 | if (d == NULL) { | ||
147 | err("no memory for 'struct dvb_usb_device'"); | ||
148 | return ret; | ||
149 | } | ||
150 | memset(d,0,sizeof(struct dvb_usb_device)); | ||
151 | |||
152 | d->udev = udev; | ||
153 | memcpy(&d->props,props,sizeof(struct dvb_usb_properties)); | ||
154 | d->desc = desc; | ||
155 | d->owner = owner; | ||
156 | |||
157 | if (d->props.size_of_priv > 0) { | ||
158 | d->priv = kmalloc(d->props.size_of_priv,GFP_KERNEL); | ||
159 | if (d->priv == NULL) { | ||
160 | err("no memory for priv in 'struct dvb_usb_device'"); | ||
161 | kfree(d); | ||
162 | return -ENOMEM; | ||
163 | } | ||
164 | memset(d->priv,0,d->props.size_of_priv); | ||
165 | } | ||
166 | |||
167 | usb_set_intfdata(intf, d); | ||
168 | |||
169 | ret = dvb_usb_init(d); | ||
170 | } | ||
171 | |||
172 | if (ret == 0) | ||
173 | info("%s successfully initialized and connected.",desc->name); | ||
174 | else | ||
175 | info("%s error while loading driver (%d)",desc->name,ret); | ||
176 | return ret; | ||
177 | } | ||
178 | EXPORT_SYMBOL(dvb_usb_device_init); | ||
179 | |||
180 | void dvb_usb_device_exit(struct usb_interface *intf) | ||
181 | { | ||
182 | struct dvb_usb_device *d = usb_get_intfdata(intf); | ||
183 | const char *name = "generic DVB-USB module"; | ||
184 | |||
185 | usb_set_intfdata(intf,NULL); | ||
186 | if (d != NULL && d->desc != NULL) { | ||
187 | name = d->desc->name; | ||
188 | dvb_usb_exit(d); | ||
189 | } | ||
190 | info("%s successfully deinitialized and disconnected.",name); | ||
191 | |||
192 | } | ||
193 | EXPORT_SYMBOL(dvb_usb_device_exit); | ||
194 | |||
195 | /* module stuff */ | ||
196 | static int __init dvb_usb_module_init(void) | ||
197 | { | ||
198 | return 0; | ||
199 | } | ||
200 | |||
201 | static void __exit dvb_usb_module_exit(void) | ||
202 | { | ||
203 | } | ||
204 | |||
205 | module_init (dvb_usb_module_init); | ||
206 | module_exit (dvb_usb_module_exit); | ||
207 | |||
208 | MODULE_VERSION("0.3"); | ||
209 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
210 | MODULE_DESCRIPTION("A library module containing commonly used USB and DVB function USB DVB devices"); | ||
211 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c new file mode 100644 index 000000000000..9f1e23f82bae --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c | |||
@@ -0,0 +1,175 @@ | |||
1 | /* dvb-usb-remote.c is part of the DVB USB library. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
4 | * see dvb-usb-init.c for copyright information. | ||
5 | * | ||
6 | * This file contains functions for initializing the the input-device and for handling remote-control-queries. | ||
7 | */ | ||
8 | #include "dvb-usb-common.h" | ||
9 | |||
10 | /* Remote-control poll function - called every dib->rc_query_interval ms to see | ||
11 | * whether the remote control has received anything. | ||
12 | * | ||
13 | * TODO: Fix the repeat rate of the input device. | ||
14 | */ | ||
15 | static void dvb_usb_read_remote_control(void *data) | ||
16 | { | ||
17 | struct dvb_usb_device *d = data; | ||
18 | u32 event; | ||
19 | int state; | ||
20 | |||
21 | /* TODO: need a lock here. We can simply skip checking for the remote control | ||
22 | if we're busy. */ | ||
23 | |||
24 | if (d->props.rc_query(d,&event,&state)) { | ||
25 | err("error while querying for an remote control event."); | ||
26 | goto schedule; | ||
27 | } | ||
28 | |||
29 | |||
30 | switch (state) { | ||
31 | case REMOTE_NO_KEY_PRESSED: | ||
32 | break; | ||
33 | case REMOTE_KEY_PRESSED: | ||
34 | deb_rc("key pressed\n"); | ||
35 | d->last_event = event; | ||
36 | case REMOTE_KEY_REPEAT: | ||
37 | deb_rc("key repeated\n"); | ||
38 | input_event(&d->rc_input_dev, EV_KEY, event, 1); | ||
39 | input_event(&d->rc_input_dev, EV_KEY, d->last_event, 0); | ||
40 | input_sync(&d->rc_input_dev); | ||
41 | break; | ||
42 | default: | ||
43 | break; | ||
44 | } | ||
45 | |||
46 | /* improved repeat handling ??? | ||
47 | switch (state) { | ||
48 | case REMOTE_NO_KEY_PRESSED: | ||
49 | deb_rc("NO KEY PRESSED\n"); | ||
50 | if (d->last_state != REMOTE_NO_KEY_PRESSED) { | ||
51 | deb_rc("releasing event %d\n",d->last_event); | ||
52 | input_event(&d->rc_input_dev, EV_KEY, d->last_event, 0); | ||
53 | input_sync(&d->rc_input_dev); | ||
54 | } | ||
55 | d->last_state = REMOTE_NO_KEY_PRESSED; | ||
56 | d->last_event = 0; | ||
57 | break; | ||
58 | case REMOTE_KEY_PRESSED: | ||
59 | deb_rc("KEY PRESSED\n"); | ||
60 | deb_rc("pressing event %d\n",event); | ||
61 | |||
62 | input_event(&d->rc_input_dev, EV_KEY, event, 1); | ||
63 | input_sync(&d->rc_input_dev); | ||
64 | |||
65 | d->last_event = event; | ||
66 | d->last_state = REMOTE_KEY_PRESSED; | ||
67 | break; | ||
68 | case REMOTE_KEY_REPEAT: | ||
69 | deb_rc("KEY_REPEAT\n"); | ||
70 | if (d->last_state != REMOTE_NO_KEY_PRESSED) { | ||
71 | deb_rc("repeating event %d\n",d->last_event); | ||
72 | input_event(&d->rc_input_dev, EV_KEY, d->last_event, 2); | ||
73 | input_sync(&d->rc_input_dev); | ||
74 | d->last_state = REMOTE_KEY_REPEAT; | ||
75 | } | ||
76 | default: | ||
77 | break; | ||
78 | } | ||
79 | */ | ||
80 | |||
81 | schedule: | ||
82 | schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc_interval)); | ||
83 | } | ||
84 | |||
85 | int dvb_usb_remote_init(struct dvb_usb_device *d) | ||
86 | { | ||
87 | int i; | ||
88 | if (d->props.rc_key_map == NULL) | ||
89 | return 0; | ||
90 | |||
91 | /* Initialise the remote-control structures.*/ | ||
92 | init_input_dev(&d->rc_input_dev); | ||
93 | |||
94 | d->rc_input_dev.evbit[0] = BIT(EV_KEY); | ||
95 | d->rc_input_dev.keycodesize = sizeof(unsigned char); | ||
96 | d->rc_input_dev.keycodemax = KEY_MAX; | ||
97 | d->rc_input_dev.name = "IR-receiver inside an USB DVB receiver"; | ||
98 | |||
99 | /* set the bits for the keys */ | ||
100 | deb_rc("key map size: %d\n",d->props.rc_key_map_size); | ||
101 | for (i = 0; i < d->props.rc_key_map_size; i++) { | ||
102 | deb_rc("setting bit for event %d item %d\n",d->props.rc_key_map[i].event, i); | ||
103 | set_bit(d->props.rc_key_map[i].event, d->rc_input_dev.keybit); | ||
104 | } | ||
105 | |||
106 | /* Start the remote-control polling. */ | ||
107 | if (d->props.rc_interval < 40) | ||
108 | d->props.rc_interval = 100; /* default */ | ||
109 | |||
110 | /* setting these two values to non-zero, we have to manage key repeats */ | ||
111 | d->rc_input_dev.rep[REP_PERIOD] = d->props.rc_interval; | ||
112 | d->rc_input_dev.rep[REP_DELAY] = d->props.rc_interval + 150; | ||
113 | |||
114 | input_register_device(&d->rc_input_dev); | ||
115 | |||
116 | INIT_WORK(&d->rc_query_work, dvb_usb_read_remote_control, d); | ||
117 | |||
118 | info("schedule remote query interval to %d msecs.",d->props.rc_interval); | ||
119 | schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc_interval)); | ||
120 | |||
121 | d->state |= DVB_USB_STATE_REMOTE; | ||
122 | |||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | int dvb_usb_remote_exit(struct dvb_usb_device *d) | ||
127 | { | ||
128 | if (d->state & DVB_USB_STATE_REMOTE) { | ||
129 | cancel_delayed_work(&d->rc_query_work); | ||
130 | flush_scheduled_work(); | ||
131 | input_unregister_device(&d->rc_input_dev); | ||
132 | } | ||
133 | d->state &= ~DVB_USB_STATE_REMOTE; | ||
134 | return 0; | ||
135 | } | ||
136 | |||
137 | #define DVB_USB_RC_NEC_EMPTY 0x00 | ||
138 | #define DVB_USB_RC_NEC_KEY_PRESSED 0x01 | ||
139 | #define DVB_USB_RC_NEC_KEY_REPEATED 0x02 | ||
140 | int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *d, | ||
141 | u8 keybuf[5], u32 *event, int *state) | ||
142 | { | ||
143 | int i; | ||
144 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; | ||
145 | *event = 0; | ||
146 | *state = REMOTE_NO_KEY_PRESSED; | ||
147 | switch (keybuf[0]) { | ||
148 | case DVB_USB_RC_NEC_EMPTY: | ||
149 | break; | ||
150 | case DVB_USB_RC_NEC_KEY_PRESSED: | ||
151 | if ((u8) ~keybuf[1] != keybuf[2] || | ||
152 | (u8) ~keybuf[3] != keybuf[4]) { | ||
153 | deb_err("remote control checksum failed.\n"); | ||
154 | break; | ||
155 | } | ||
156 | /* See if we can match the raw key code. */ | ||
157 | for (i = 0; i < sizeof(keymap)/sizeof(struct dvb_usb_rc_key); i++) | ||
158 | if (keymap[i].custom == keybuf[1] && | ||
159 | keymap[i].data == keybuf[3]) { | ||
160 | *event = keymap[i].event; | ||
161 | *state = REMOTE_KEY_PRESSED; | ||
162 | break; | ||
163 | } | ||
164 | deb_err("key mapping failed - no appropriate key found in keymapping\n"); | ||
165 | break; | ||
166 | case DVB_USB_RC_NEC_KEY_REPEATED: | ||
167 | *state = REMOTE_KEY_REPEAT; | ||
168 | break; | ||
169 | default: | ||
170 | deb_err("unkown type of remote status: %d\n",keybuf[0]); | ||
171 | break; | ||
172 | } | ||
173 | return 0; | ||
174 | } | ||
175 | EXPORT_SYMBOL(dvb_usb_nec_rc_key_to_event); | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c new file mode 100644 index 000000000000..83d476fb410a --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c | |||
@@ -0,0 +1,211 @@ | |||
1 | /* dvb-usb-urb.c is part of the DVB USB library. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
4 | * see dvb-usb-init.c for copyright information. | ||
5 | * | ||
6 | * This file contains functions for initializing and handling the | ||
7 | * USB and URB stuff. | ||
8 | */ | ||
9 | #include "dvb-usb-common.h" | ||
10 | |||
11 | int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf, | ||
12 | u16 rlen, int delay_ms) | ||
13 | { | ||
14 | int actlen,ret = -ENOMEM; | ||
15 | |||
16 | if (d->props.generic_bulk_ctrl_endpoint == 0) { | ||
17 | err("endpoint for generic control not specified."); | ||
18 | return -EINVAL; | ||
19 | } | ||
20 | |||
21 | if (wbuf == NULL || wlen == 0) | ||
22 | return -EINVAL; | ||
23 | |||
24 | if ((ret = down_interruptible(&d->usb_sem))) | ||
25 | return ret; | ||
26 | |||
27 | debug_dump(wbuf,wlen,deb_xfer); | ||
28 | |||
29 | ret = usb_bulk_msg(d->udev,usb_sndbulkpipe(d->udev, | ||
30 | d->props.generic_bulk_ctrl_endpoint), wbuf,wlen,&actlen, | ||
31 | 2*HZ); | ||
32 | |||
33 | if (ret) | ||
34 | err("bulk message failed: %d (%d/%d)",ret,wlen,actlen); | ||
35 | else | ||
36 | ret = actlen != wlen ? -1 : 0; | ||
37 | |||
38 | /* an answer is expected, and no error before */ | ||
39 | if (!ret && rbuf && rlen) { | ||
40 | if (delay_ms) | ||
41 | msleep(delay_ms); | ||
42 | |||
43 | ret = usb_bulk_msg(d->udev,usb_rcvbulkpipe(d->udev, | ||
44 | d->props.generic_bulk_ctrl_endpoint),rbuf,rlen,&actlen, | ||
45 | 2*HZ); | ||
46 | |||
47 | if (ret) | ||
48 | err("recv bulk message failed: %d",ret); | ||
49 | else | ||
50 | debug_dump(rbuf,actlen,deb_xfer); | ||
51 | } | ||
52 | |||
53 | up(&d->usb_sem); | ||
54 | return ret; | ||
55 | } | ||
56 | EXPORT_SYMBOL(dvb_usb_generic_rw); | ||
57 | |||
58 | int dvb_usb_generic_write(struct dvb_usb_device *d, u8 *buf, u16 len) | ||
59 | { | ||
60 | return dvb_usb_generic_rw(d,buf,len,NULL,0,0); | ||
61 | } | ||
62 | EXPORT_SYMBOL(dvb_usb_generic_write); | ||
63 | |||
64 | static void dvb_usb_bulk_urb_complete(struct urb *urb, struct pt_regs *ptregs) | ||
65 | { | ||
66 | struct dvb_usb_device *d = urb->context; | ||
67 | |||
68 | deb_ts("bulk urb completed. feedcount: %d, status: %d, length: %d\n",d->feedcount,urb->status, | ||
69 | urb->actual_length); | ||
70 | |||
71 | switch (urb->status) { | ||
72 | case 0: /* success */ | ||
73 | case -ETIMEDOUT: /* NAK */ | ||
74 | break; | ||
75 | case -ECONNRESET: /* kill */ | ||
76 | case -ENOENT: | ||
77 | case -ESHUTDOWN: | ||
78 | return; | ||
79 | default: /* error */ | ||
80 | deb_ts("urb completition error %d.", urb->status); | ||
81 | break; | ||
82 | } | ||
83 | |||
84 | if (d->feedcount > 0 && urb->actual_length > 0) { | ||
85 | if (d->state & DVB_USB_STATE_DVB) | ||
86 | dvb_dmx_swfilter(&d->demux, (u8*) urb->transfer_buffer,urb->actual_length); | ||
87 | } else | ||
88 | deb_ts("URB dropped because of feedcount.\n"); | ||
89 | |||
90 | usb_submit_urb(urb,GFP_ATOMIC); | ||
91 | } | ||
92 | |||
93 | int dvb_usb_urb_kill(struct dvb_usb_device *d) | ||
94 | { | ||
95 | int i; | ||
96 | for (i = 0; i < d->urbs_submitted; i++) { | ||
97 | deb_info("killing URB no. %d.\n",i); | ||
98 | |||
99 | /* stop the URB */ | ||
100 | usb_kill_urb(d->urb_list[i]); | ||
101 | } | ||
102 | d->urbs_submitted = 0; | ||
103 | return 0; | ||
104 | } | ||
105 | |||
106 | int dvb_usb_urb_submit(struct dvb_usb_device *d) | ||
107 | { | ||
108 | int i,ret; | ||
109 | for (i = 0; i < d->urbs_initialized; i++) { | ||
110 | deb_info("submitting URB no. %d\n",i); | ||
111 | if ((ret = usb_submit_urb(d->urb_list[i],GFP_ATOMIC))) { | ||
112 | err("could not submit URB no. %d - get them all back\n",i); | ||
113 | dvb_usb_urb_kill(d); | ||
114 | return ret; | ||
115 | } | ||
116 | d->urbs_submitted++; | ||
117 | } | ||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | static int dvb_usb_bulk_urb_init(struct dvb_usb_device *d) | ||
122 | { | ||
123 | int i,bufsize = d->props.urb.count * d->props.urb.u.bulk.buffersize; | ||
124 | |||
125 | deb_info("allocate %d bytes as buffersize for all URBs\n",bufsize); | ||
126 | /* allocate the actual buffer for the URBs */ | ||
127 | if ((d->buffer = usb_buffer_alloc(d->udev, bufsize, SLAB_ATOMIC, &d->dma_handle)) == NULL) { | ||
128 | deb_info("not enough memory for urb-buffer allocation.\n"); | ||
129 | return -ENOMEM; | ||
130 | } | ||
131 | deb_info("allocation successful\n"); | ||
132 | memset(d->buffer,0,bufsize); | ||
133 | |||
134 | d->state |= DVB_USB_STATE_URB_BUF; | ||
135 | |||
136 | /* allocate the URBs */ | ||
137 | for (i = 0; i < d->props.urb.count; i++) { | ||
138 | if (!(d->urb_list[i] = usb_alloc_urb(0,GFP_ATOMIC))) { | ||
139 | return -ENOMEM; | ||
140 | } | ||
141 | |||
142 | usb_fill_bulk_urb( d->urb_list[i], d->udev, | ||
143 | usb_rcvbulkpipe(d->udev,d->props.urb.endpoint), | ||
144 | &d->buffer[i*d->props.urb.u.bulk.buffersize], | ||
145 | d->props.urb.u.bulk.buffersize, | ||
146 | dvb_usb_bulk_urb_complete, d); | ||
147 | |||
148 | d->urb_list[i]->transfer_flags = 0; | ||
149 | d->urbs_initialized++; | ||
150 | } | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | int dvb_usb_urb_init(struct dvb_usb_device *d) | ||
155 | { | ||
156 | /* | ||
157 | * when reloading the driver w/o replugging the device | ||
158 | * sometimes a timeout occures, this helps | ||
159 | */ | ||
160 | if (d->props.generic_bulk_ctrl_endpoint != 0) { | ||
161 | usb_clear_halt(d->udev,usb_sndbulkpipe(d->udev,d->props.generic_bulk_ctrl_endpoint)); | ||
162 | usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.generic_bulk_ctrl_endpoint)); | ||
163 | } | ||
164 | usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.urb.endpoint)); | ||
165 | |||
166 | /* allocate the array for the data transfer URBs */ | ||
167 | d->urb_list = kmalloc(d->props.urb.count * sizeof(struct urb *),GFP_KERNEL); | ||
168 | if (d->urb_list == NULL) | ||
169 | return -ENOMEM; | ||
170 | memset(d->urb_list,0,d->props.urb.count * sizeof(struct urb *)); | ||
171 | d->state |= DVB_USB_STATE_URB_LIST; | ||
172 | |||
173 | switch (d->props.urb.type) { | ||
174 | case DVB_USB_BULK: | ||
175 | return dvb_usb_bulk_urb_init(d); | ||
176 | case DVB_USB_ISOC: | ||
177 | err("isochronous transfer not yet implemented in dvb-usb."); | ||
178 | return -EINVAL; | ||
179 | default: | ||
180 | err("unkown URB-type for data transfer."); | ||
181 | return -EINVAL; | ||
182 | } | ||
183 | } | ||
184 | |||
185 | int dvb_usb_urb_exit(struct dvb_usb_device *d) | ||
186 | { | ||
187 | int i; | ||
188 | |||
189 | dvb_usb_urb_kill(d); | ||
190 | |||
191 | if (d->state & DVB_USB_STATE_URB_LIST) { | ||
192 | for (i = 0; i < d->urbs_initialized; i++) { | ||
193 | if (d->urb_list[i] != NULL) { | ||
194 | deb_info("freeing URB no. %d.\n",i); | ||
195 | /* free the URBs */ | ||
196 | usb_free_urb(d->urb_list[i]); | ||
197 | } | ||
198 | } | ||
199 | d->urbs_initialized = 0; | ||
200 | /* free the urb array */ | ||
201 | kfree(d->urb_list); | ||
202 | d->state &= ~DVB_USB_STATE_URB_LIST; | ||
203 | } | ||
204 | |||
205 | if (d->state & DVB_USB_STATE_URB_BUF) | ||
206 | usb_buffer_free(d->udev, d->props.urb.u.bulk.buffersize * d->props.urb.count, | ||
207 | d->buffer, d->dma_handle); | ||
208 | |||
209 | d->state &= ~DVB_USB_STATE_URB_BUF; | ||
210 | return 0; | ||
211 | } | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h new file mode 100644 index 000000000000..abcee1943f64 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h | |||
@@ -0,0 +1,315 @@ | |||
1 | /* dvb-usb.h is part of the DVB USB library. | ||
2 | * | ||
3 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
4 | * see dvb-usb-init.c for copyright information. | ||
5 | * | ||
6 | * the headerfile, all dvb-usb-drivers have to include. | ||
7 | */ | ||
8 | #ifndef __DVB_USB_H__ | ||
9 | #define __DVB_USB_H__ | ||
10 | |||
11 | #include <linux/config.h> | ||
12 | #include <linux/input.h> | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/usb.h> | ||
15 | |||
16 | #include "dvb_frontend.h" | ||
17 | #include "dvb_demux.h" | ||
18 | #include "dvb_net.h" | ||
19 | #include "dmxdev.h" | ||
20 | |||
21 | #include "dvb-pll.h" | ||
22 | |||
23 | #include "dvb-usb-ids.h" | ||
24 | |||
25 | /* debug */ | ||
26 | #ifdef CONFIG_DVB_USB_DEBUG | ||
27 | #define dprintk(var,level,args...) \ | ||
28 | do { if ((var & level)) { printk(args); } } while (0) | ||
29 | |||
30 | #define debug_dump(b,l,func) {\ | ||
31 | int loop_; \ | ||
32 | for (loop_ = 0; loop_ < l; loop_++) func("%02x ", b[loop_]); \ | ||
33 | func("\n");\ | ||
34 | } | ||
35 | #define DVB_USB_DEBUG_STATUS | ||
36 | #else | ||
37 | #define dprintk(args...) | ||
38 | #define debug_dump(b,l,func) | ||
39 | |||
40 | #define DVB_USB_DEBUG_STATUS " (debugging is not enabled)" | ||
41 | |||
42 | #endif | ||
43 | |||
44 | /* generic log methods - taken from usb.h */ | ||
45 | #ifndef DVB_USB_LOG_PREFIX | ||
46 | #define DVB_USB_LOG_PREFIX "dvb-usb (please define a log prefix)" | ||
47 | #endif | ||
48 | |||
49 | #undef err | ||
50 | #define err(format, arg...) printk(KERN_ERR DVB_USB_LOG_PREFIX ": " format "\n" , ## arg) | ||
51 | #undef info | ||
52 | #define info(format, arg...) printk(KERN_INFO DVB_USB_LOG_PREFIX ": " format "\n" , ## arg) | ||
53 | #undef warn | ||
54 | #define warn(format, arg...) printk(KERN_WARNING DVB_USB_LOG_PREFIX ": " format "\n" , ## arg) | ||
55 | |||
56 | /** | ||
57 | * struct dvb_usb_device_description - name and its according USB IDs | ||
58 | * @name: real name of the box, regardless which DVB USB device class is in use | ||
59 | * @cold_ids: array of struct usb_device_id which describe the device in | ||
60 | * pre-firmware state | ||
61 | * @warm_ids: array of struct usb_device_id which describe the device in | ||
62 | * post-firmware state | ||
63 | * | ||
64 | * Each DVB USB device class can have one or more actual devices, this struct | ||
65 | * assigns a name to it. | ||
66 | */ | ||
67 | struct dvb_usb_device_description { | ||
68 | const char *name; | ||
69 | |||
70 | #define DVB_USB_ID_MAX_NUM 15 | ||
71 | struct usb_device_id *cold_ids[DVB_USB_ID_MAX_NUM]; | ||
72 | struct usb_device_id *warm_ids[DVB_USB_ID_MAX_NUM]; | ||
73 | }; | ||
74 | |||
75 | /** | ||
76 | * struct dvb_usb_rc_key - a remote control key and its input-event | ||
77 | * @custom: the vendor/custom part of the key | ||
78 | * @data: the actual key part | ||
79 | * @event: the input event assigned to key identified by custom and data | ||
80 | */ | ||
81 | struct dvb_usb_rc_key { | ||
82 | u8 custom,data; | ||
83 | u32 event; | ||
84 | }; | ||
85 | |||
86 | struct dvb_usb_device; | ||
87 | |||
88 | /** | ||
89 | * struct dvb_usb_properties - properties of a dvb-usb-device | ||
90 | * @caps: capabilites of the DVB USB device. | ||
91 | * @pid_filter_count: number of PID filter position in the optional hardware | ||
92 | * PID-filter. | ||
93 | * | ||
94 | * @usb_ctrl: which USB device-side controller is in use. Needed for firmware | ||
95 | * download. | ||
96 | * @firmware: name of the firmware file. | ||
97 | * | ||
98 | * @size_of_priv: how many bytes shall be allocated for the private field | ||
99 | * of struct dvb_usb_device. | ||
100 | * | ||
101 | * @power_ctrl: called to enable/disable power of the device. | ||
102 | * @streaming_crtl: called to start and stop the MPEG2-TS streaming of the | ||
103 | * device (not URB submitting/killing). | ||
104 | * @pid_filter_ctrl: called to en/disable the PID filter, if any. | ||
105 | * @pid_filter: called to set/unset a PID for filtering. | ||
106 | * | ||
107 | * @read_mac_address: called to read the MAC address of the device. | ||
108 | * | ||
109 | * @frontend_attach: called to attach the possible frontends (fill fe-field | ||
110 | * of struct dvb_usb_device). | ||
111 | * @tuner_attach: called to attach the correct tuner and to fill pll_addr, | ||
112 | * pll_desc and pll_init_buf of struct dvb_usb_device). | ||
113 | * @identify_state: called to determine the state (cold or warm), when it | ||
114 | * is not distinguishable by the USB IDs. | ||
115 | * | ||
116 | * @rc_key_map: a hard-wired array of struct dvb_usb_rc_key (NULL to disable | ||
117 | * remote control handling). | ||
118 | * @rc_key_map_size: number of items in @rc_key_map. | ||
119 | * @rc_query: called to query an event event. | ||
120 | * @rc_interval: time in ms between two queries. | ||
121 | * | ||
122 | * @i2c_algo: i2c_algorithm if the device has I2CoverUSB. | ||
123 | * | ||
124 | * @generic_bulk_ctrl_endpoint: most of the DVB USB devices have a generic | ||
125 | * endpoint which received control messages with bulk transfers. When this | ||
126 | * is non-zero, one can use dvb_usb_generic_rw and dvb_usb_generic_write- | ||
127 | * helper functions. | ||
128 | * | ||
129 | * @urb: describes the kind of USB transfer used for MPEG2-TS-streaming. | ||
130 | * Currently only BULK is implemented | ||
131 | * | ||
132 | * @num_device_descs: number of struct dvb_usb_device_description in @devices | ||
133 | * @devices: array of struct dvb_usb_device_description compatibles with these | ||
134 | * properties. | ||
135 | */ | ||
136 | struct dvb_usb_properties { | ||
137 | |||
138 | #define DVB_USB_HAS_PID_FILTER 0x01 | ||
139 | #define DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF 0x02 | ||
140 | #define DVB_USB_NEED_PID_FILTERING 0x04 | ||
141 | #define DVB_USB_IS_AN_I2C_ADAPTER 0x08 | ||
142 | int caps; | ||
143 | int pid_filter_count; | ||
144 | |||
145 | #define CYPRESS_AN2135 0 | ||
146 | #define CYPRESS_AN2235 1 | ||
147 | #define CYPRESS_FX2 2 | ||
148 | int usb_ctrl; | ||
149 | const char *firmware; | ||
150 | |||
151 | int size_of_priv; | ||
152 | |||
153 | int (*power_ctrl) (struct dvb_usb_device *, int); | ||
154 | int (*streaming_ctrl) (struct dvb_usb_device *, int); | ||
155 | int (*pid_filter_ctrl) (struct dvb_usb_device *, int); | ||
156 | int (*pid_filter) (struct dvb_usb_device *, int, u16, int); | ||
157 | |||
158 | int (*read_mac_address) (struct dvb_usb_device *, u8 []); | ||
159 | int (*frontend_attach) (struct dvb_usb_device *); | ||
160 | int (*tuner_attach) (struct dvb_usb_device *); | ||
161 | |||
162 | int (*identify_state) (struct usb_device *, struct dvb_usb_properties *, | ||
163 | struct dvb_usb_device_description **, int *); | ||
164 | |||
165 | /* remote control properties */ | ||
166 | #define REMOTE_NO_KEY_PRESSED 0x00 | ||
167 | #define REMOTE_KEY_PRESSED 0x01 | ||
168 | #define REMOTE_KEY_REPEAT 0x02 | ||
169 | struct dvb_usb_rc_key *rc_key_map; | ||
170 | int rc_key_map_size; | ||
171 | int (*rc_query) (struct dvb_usb_device *, u32 *, int *); | ||
172 | int rc_interval; | ||
173 | |||
174 | struct i2c_algorithm *i2c_algo; | ||
175 | |||
176 | int generic_bulk_ctrl_endpoint; | ||
177 | |||
178 | struct { | ||
179 | #define DVB_USB_BULK 1 | ||
180 | #define DVB_USB_ISOC 2 | ||
181 | int type; | ||
182 | int count; | ||
183 | int endpoint; | ||
184 | |||
185 | union { | ||
186 | struct { | ||
187 | int buffersize; /* per URB */ | ||
188 | } bulk; | ||
189 | struct { | ||
190 | int framesperurb; | ||
191 | int framesize; | ||
192 | } isoc; | ||
193 | } u; | ||
194 | } urb; | ||
195 | |||
196 | int num_device_descs; | ||
197 | struct dvb_usb_device_description devices[8]; | ||
198 | }; | ||
199 | |||
200 | |||
201 | /** | ||
202 | * struct dvb_usb_device - object of a DVB USB device | ||
203 | * @props: copy of the struct dvb_usb_properties this device belongs to. | ||
204 | * @desc: pointer to the device's struct dvb_usb_device_description. | ||
205 | * @state: initialization and runtime state of the device. | ||
206 | * | ||
207 | * @udev: pointer to the device's struct usb_device. | ||
208 | * @urb_list: array of dynamically allocated struct urb for the MPEG2-TS- | ||
209 | * streaming. | ||
210 | * @buffer: buffer used to streaming. | ||
211 | * @dma_handle: dma_addr_t for buffer. | ||
212 | * @urbs_initialized: number of URBs initialized. | ||
213 | * @urbs_submitted: number of URBs submitted. | ||
214 | * @feedcount: number of reqested feeds (used for streaming-activation) | ||
215 | * @pid_filtering: is hardware pid_filtering used or not. | ||
216 | * @usb_sem: semaphore of USB control messages (reading needs two messages) | ||
217 | * @i2c_sem: semaphore for i2c-transfers | ||
218 | * @i2c_adap: device's i2c_adapter if it uses I2CoverUSB | ||
219 | * @pll_addr: I2C address of the tuner for programming | ||
220 | * @pll_init: array containing the initialization buffer | ||
221 | * @pll_desc: pointer to the appropriate struct dvb_pll_desc | ||
222 | * @tuner_pass_ctrl: called to (de)activate tuner passthru of the demod | ||
223 | * @dvb_adap: device's dvb_adapter. | ||
224 | * @dmxdev: device's dmxdev. | ||
225 | * @demux: device's software demuxer. | ||
226 | * @dvb_net: device's dvb_net interfaces. | ||
227 | * @dvb_frontend: device's frontend. | ||
228 | * @max_feed_count: how many feeds can be handled simultaneously by this | ||
229 | * device | ||
230 | * @fe_sleep: rerouted frontend-sleep function. | ||
231 | * @fe_init: rerouted frontend-init (wakeup) function. | ||
232 | * @rc_input_dev: input device for the remote control. | ||
233 | * @rc_query_work: struct work_struct frequent rc queries | ||
234 | * @last_event: last triggered event | ||
235 | * @last_state: last state (no, pressed, repeat) | ||
236 | * @owner: owner of the dvb_adapter | ||
237 | * @priv: private data of the actual driver (allocate by dvb-usb, size defined | ||
238 | * in size_of_priv of dvb_usb_properties). | ||
239 | */ | ||
240 | struct dvb_usb_device { | ||
241 | struct dvb_usb_properties props; | ||
242 | struct dvb_usb_device_description *desc; | ||
243 | |||
244 | #define DVB_USB_STATE_INIT 0x000 | ||
245 | #define DVB_USB_STATE_URB_LIST 0x001 | ||
246 | #define DVB_USB_STATE_URB_BUF 0x002 | ||
247 | #define DVB_USB_STATE_DVB 0x004 | ||
248 | #define DVB_USB_STATE_I2C 0x008 | ||
249 | #define DVB_USB_STATE_REMOTE 0x010 | ||
250 | #define DVB_USB_STATE_URB_SUBMIT 0x020 | ||
251 | int state; | ||
252 | |||
253 | /* usb */ | ||
254 | struct usb_device *udev; | ||
255 | struct urb **urb_list; | ||
256 | u8 *buffer; | ||
257 | dma_addr_t dma_handle; | ||
258 | int urbs_initialized; | ||
259 | int urbs_submitted; | ||
260 | |||
261 | int feedcount; | ||
262 | int pid_filtering; | ||
263 | |||
264 | /* locking */ | ||
265 | struct semaphore usb_sem; | ||
266 | |||
267 | /* i2c */ | ||
268 | struct semaphore i2c_sem; | ||
269 | struct i2c_adapter i2c_adap; | ||
270 | |||
271 | /* tuner programming information */ | ||
272 | u8 pll_addr; | ||
273 | u8 pll_init[4]; | ||
274 | struct dvb_pll_desc *pll_desc; | ||
275 | int (*tuner_pass_ctrl)(struct dvb_frontend *, int, u8); | ||
276 | |||
277 | /* dvb */ | ||
278 | struct dvb_adapter dvb_adap; | ||
279 | struct dmxdev dmxdev; | ||
280 | struct dvb_demux demux; | ||
281 | struct dvb_net dvb_net; | ||
282 | struct dvb_frontend* fe; | ||
283 | int max_feed_count; | ||
284 | |||
285 | int (*fe_sleep) (struct dvb_frontend *); | ||
286 | int (*fe_init) (struct dvb_frontend *); | ||
287 | |||
288 | /* remote control */ | ||
289 | struct input_dev rc_input_dev; | ||
290 | struct work_struct rc_query_work; | ||
291 | u32 last_event; | ||
292 | int last_state; | ||
293 | |||
294 | struct module *owner; | ||
295 | |||
296 | void *priv; | ||
297 | }; | ||
298 | |||
299 | extern int dvb_usb_device_init(struct usb_interface *, struct dvb_usb_properties *, struct module *); | ||
300 | extern void dvb_usb_device_exit(struct usb_interface *); | ||
301 | |||
302 | /* the generic read/write method for device control */ | ||
303 | extern int dvb_usb_generic_rw(struct dvb_usb_device *, u8 *, u16, u8 *, u16,int); | ||
304 | extern int dvb_usb_generic_write(struct dvb_usb_device *, u8 *, u16); | ||
305 | |||
306 | /* commonly used remote control parsing */ | ||
307 | extern int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *, u8[], u32 *, int *); | ||
308 | |||
309 | /* commonly used pll init and set functions */ | ||
310 | extern int dvb_usb_pll_init_i2c(struct dvb_frontend *); | ||
311 | extern int dvb_usb_pll_set(struct dvb_frontend *, struct dvb_frontend_parameters *, u8[]); | ||
312 | extern int dvb_usb_pll_set_i2c(struct dvb_frontend *, struct dvb_frontend_parameters *); | ||
313 | |||
314 | |||
315 | #endif | ||
diff --git a/drivers/media/dvb/dvb-usb/nova-t-usb2.c b/drivers/media/dvb/dvb-usb/nova-t-usb2.c new file mode 100644 index 000000000000..9d83781aef95 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/nova-t-usb2.c | |||
@@ -0,0 +1,236 @@ | |||
1 | /* DVB USB framework compliant Linux driver for the Hauppauge WinTV-NOVA-T usb2 | ||
2 | * DVB-T receiver. | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the Free | ||
8 | * Software Foundation, version 2. | ||
9 | * | ||
10 | * see Documentation/dvb/README.dvb-usb for more information | ||
11 | */ | ||
12 | #include "dibusb.h" | ||
13 | |||
14 | static int debug; | ||
15 | module_param(debug, int, 0644); | ||
16 | MODULE_PARM_DESC(debug, "set debugging level (1=rc,2=eeprom (|-able))." DVB_USB_DEBUG_STATUS); | ||
17 | |||
18 | #define deb_rc(args...) dprintk(debug,0x01,args) | ||
19 | #define deb_ee(args...) dprintk(debug,0x02,args) | ||
20 | |||
21 | /* Hauppauge NOVA-T USB2 keys */ | ||
22 | static struct dvb_usb_rc_key haupp_rc_keys [] = { | ||
23 | { 0x1e, 0x00, KEY_0 }, | ||
24 | { 0x1e, 0x01, KEY_1 }, | ||
25 | { 0x1e, 0x02, KEY_2 }, | ||
26 | { 0x1e, 0x03, KEY_3 }, | ||
27 | { 0x1e, 0x04, KEY_4 }, | ||
28 | { 0x1e, 0x05, KEY_5 }, | ||
29 | { 0x1e, 0x06, KEY_6 }, | ||
30 | { 0x1e, 0x07, KEY_7 }, | ||
31 | { 0x1e, 0x08, KEY_8 }, | ||
32 | { 0x1e, 0x09, KEY_9 }, | ||
33 | { 0x1e, 0x0a, KEY_KPASTERISK }, | ||
34 | { 0x1e, 0x0b, KEY_RED }, | ||
35 | { 0x1e, 0x0c, KEY_RADIO }, | ||
36 | { 0x1e, 0x0d, KEY_MENU }, | ||
37 | { 0x1e, 0x0e, KEY_GRAVE }, /* # */ | ||
38 | { 0x1e, 0x0f, KEY_MUTE }, | ||
39 | { 0x1e, 0x10, KEY_VOLUMEUP }, | ||
40 | { 0x1e, 0x11, KEY_VOLUMEDOWN }, | ||
41 | { 0x1e, 0x12, KEY_CHANNEL }, | ||
42 | { 0x1e, 0x14, KEY_UP }, | ||
43 | { 0x1e, 0x15, KEY_DOWN }, | ||
44 | { 0x1e, 0x16, KEY_LEFT }, | ||
45 | { 0x1e, 0x17, KEY_RIGHT }, | ||
46 | { 0x1e, 0x18, KEY_VIDEO }, | ||
47 | { 0x1e, 0x19, KEY_AUDIO }, | ||
48 | { 0x1e, 0x1a, KEY_MEDIA }, | ||
49 | { 0x1e, 0x1b, KEY_EPG }, | ||
50 | { 0x1e, 0x1c, KEY_TV }, | ||
51 | { 0x1e, 0x1e, KEY_NEXT }, | ||
52 | { 0x1e, 0x1f, KEY_BACK }, | ||
53 | { 0x1e, 0x20, KEY_CHANNELUP }, | ||
54 | { 0x1e, 0x21, KEY_CHANNELDOWN }, | ||
55 | { 0x1e, 0x24, KEY_LAST }, /* Skip backwards */ | ||
56 | { 0x1e, 0x25, KEY_OK }, | ||
57 | { 0x1e, 0x29, KEY_BLUE}, | ||
58 | { 0x1e, 0x2e, KEY_GREEN }, | ||
59 | { 0x1e, 0x30, KEY_PAUSE }, | ||
60 | { 0x1e, 0x32, KEY_REWIND }, | ||
61 | { 0x1e, 0x34, KEY_FASTFORWARD }, | ||
62 | { 0x1e, 0x35, KEY_PLAY }, | ||
63 | { 0x1e, 0x36, KEY_STOP }, | ||
64 | { 0x1e, 0x37, KEY_RECORD }, | ||
65 | { 0x1e, 0x38, KEY_YELLOW }, | ||
66 | { 0x1e, 0x3b, KEY_GOTO }, | ||
67 | { 0x1e, 0x3d, KEY_POWER }, | ||
68 | }; | ||
69 | |||
70 | /* Firmware bug? sometimes, when a new key is pressed, the previous pressed key | ||
71 | * is delivered. No workaround yet, maybe a new firmware. | ||
72 | */ | ||
73 | static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | ||
74 | { | ||
75 | u8 key[5],cmd[2] = { DIBUSB_REQ_POLL_REMOTE, 0x35 }, data,toggle,custom; | ||
76 | u16 raw; | ||
77 | int i; | ||
78 | struct dibusb_state *st = d->priv; | ||
79 | |||
80 | dvb_usb_generic_rw(d,cmd,2,key,5,0); | ||
81 | |||
82 | *state = REMOTE_NO_KEY_PRESSED; | ||
83 | switch (key[0]) { | ||
84 | case DIBUSB_RC_HAUPPAUGE_KEY_PRESSED: | ||
85 | raw = ((key[1] << 8) | key[2]) >> 3; | ||
86 | toggle = !!(raw & 0x800); | ||
87 | data = raw & 0x3f; | ||
88 | custom = (raw >> 6) & 0x1f; | ||
89 | |||
90 | deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to c: %02x d: %02x toggle: %d\n",key[1],key[2],key[3],custom,data,toggle); | ||
91 | |||
92 | for (i = 0; i < ARRAY_SIZE(haupp_rc_keys); i++) { | ||
93 | deb_rc("c: %x, d: %x\n",haupp_rc_keys[i].data,haupp_rc_keys[i].custom); | ||
94 | if (haupp_rc_keys[i].data == data && | ||
95 | haupp_rc_keys[i].custom == custom) { | ||
96 | *event = haupp_rc_keys[i].event; | ||
97 | *state = REMOTE_KEY_PRESSED; | ||
98 | if (st->old_toggle == toggle) { | ||
99 | if (st->last_repeat_count++ < 2) | ||
100 | *state = REMOTE_NO_KEY_PRESSED; | ||
101 | } else { | ||
102 | st->last_repeat_count = 0; | ||
103 | st->old_toggle = toggle; | ||
104 | } | ||
105 | break; | ||
106 | } | ||
107 | } | ||
108 | |||
109 | break; | ||
110 | case DIBUSB_RC_HAUPPAUGE_KEY_EMPTY: | ||
111 | default: | ||
112 | break; | ||
113 | } | ||
114 | |||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | static int nova_t_read_mac_address (struct dvb_usb_device *d, u8 mac[6]) | ||
119 | { | ||
120 | int i; | ||
121 | u8 b; | ||
122 | |||
123 | mac[0] = 0x00; | ||
124 | mac[1] = 0x0d; | ||
125 | mac[2] = 0xfe; | ||
126 | |||
127 | /* this is a complete guess, but works for my box */ | ||
128 | for (i = 136; i < 139; i++) { | ||
129 | dibusb_read_eeprom_byte(d,i, &b); | ||
130 | |||
131 | mac[5 - (i - 136)] = b; | ||
132 | |||
133 | /* deb_ee("%02x ",b); | ||
134 | if ((i+1) % 16 == 0) | ||
135 | deb_ee("\n");*/ | ||
136 | } | ||
137 | |||
138 | return 0; | ||
139 | } | ||
140 | |||
141 | /* USB Driver stuff */ | ||
142 | static struct dvb_usb_properties nova_t_properties; | ||
143 | |||
144 | static int nova_t_probe(struct usb_interface *intf, | ||
145 | const struct usb_device_id *id) | ||
146 | { | ||
147 | return dvb_usb_device_init(intf,&nova_t_properties,THIS_MODULE); | ||
148 | } | ||
149 | |||
150 | /* do not change the order of the ID table */ | ||
151 | static struct usb_device_id nova_t_table [] = { | ||
152 | /* 00 */ { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_WINTV_NOVA_T_USB2_COLD) }, | ||
153 | /* 01 */ { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_WINTV_NOVA_T_USB2_WARM) }, | ||
154 | { } /* Terminating entry */ | ||
155 | }; | ||
156 | MODULE_DEVICE_TABLE (usb, nova_t_table); | ||
157 | |||
158 | static struct dvb_usb_properties nova_t_properties = { | ||
159 | .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, | ||
160 | .pid_filter_count = 32, | ||
161 | |||
162 | .usb_ctrl = CYPRESS_FX2, | ||
163 | .firmware = "dvb-usb-nova-t-usb2-01.fw", | ||
164 | |||
165 | .size_of_priv = sizeof(struct dibusb_state), | ||
166 | |||
167 | .streaming_ctrl = dibusb2_0_streaming_ctrl, | ||
168 | .pid_filter = dibusb_pid_filter, | ||
169 | .pid_filter_ctrl = dibusb_pid_filter_ctrl, | ||
170 | .power_ctrl = dibusb2_0_power_ctrl, | ||
171 | .frontend_attach = dibusb_dib3000mc_frontend_attach, | ||
172 | .tuner_attach = dibusb_dib3000mc_tuner_attach, | ||
173 | .read_mac_address = nova_t_read_mac_address, | ||
174 | |||
175 | .rc_interval = 100, | ||
176 | .rc_key_map = haupp_rc_keys, | ||
177 | .rc_key_map_size = ARRAY_SIZE(haupp_rc_keys), | ||
178 | .rc_query = nova_t_rc_query, | ||
179 | |||
180 | .i2c_algo = &dibusb_i2c_algo, | ||
181 | |||
182 | .generic_bulk_ctrl_endpoint = 0x01, | ||
183 | /* parameter for the MPEG2-data transfer */ | ||
184 | .urb = { | ||
185 | .type = DVB_USB_BULK, | ||
186 | .count = 7, | ||
187 | .endpoint = 0x06, | ||
188 | .u = { | ||
189 | .bulk = { | ||
190 | .buffersize = 4096, | ||
191 | } | ||
192 | } | ||
193 | }, | ||
194 | |||
195 | .num_device_descs = 1, | ||
196 | .devices = { | ||
197 | { "Hauppauge WinTV-NOVA-T usb2", | ||
198 | { &nova_t_table[0], NULL }, | ||
199 | { &nova_t_table[1], NULL }, | ||
200 | }, | ||
201 | } | ||
202 | }; | ||
203 | |||
204 | static struct usb_driver nova_t_driver = { | ||
205 | .owner = THIS_MODULE, | ||
206 | .name = "Hauppauge WinTV-NOVA-T usb2", | ||
207 | .probe = nova_t_probe, | ||
208 | .disconnect = dvb_usb_device_exit, | ||
209 | .id_table = nova_t_table, | ||
210 | }; | ||
211 | |||
212 | /* module stuff */ | ||
213 | static int __init nova_t_module_init(void) | ||
214 | { | ||
215 | int result; | ||
216 | if ((result = usb_register(&nova_t_driver))) { | ||
217 | err("usb_register failed. Error number %d",result); | ||
218 | return result; | ||
219 | } | ||
220 | |||
221 | return 0; | ||
222 | } | ||
223 | |||
224 | static void __exit nova_t_module_exit(void) | ||
225 | { | ||
226 | /* deregister this driver from the USB subsystem */ | ||
227 | usb_deregister(&nova_t_driver); | ||
228 | } | ||
229 | |||
230 | module_init (nova_t_module_init); | ||
231 | module_exit (nova_t_module_exit); | ||
232 | |||
233 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
234 | MODULE_DESCRIPTION("Hauppauge WinTV-NOVA-T usb2"); | ||
235 | MODULE_VERSION("1.0"); | ||
236 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/umt-010.c b/drivers/media/dvb/dvb-usb/umt-010.c new file mode 100644 index 000000000000..aa560422ce7c --- /dev/null +++ b/drivers/media/dvb/dvb-usb/umt-010.c | |||
@@ -0,0 +1,162 @@ | |||
1 | /* DVB USB framework compliant Linux driver for the HanfTek UMT-010 USB2.0 | ||
2 | * DVB-T receiver. | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the Free | ||
8 | * Software Foundation, version 2. | ||
9 | * | ||
10 | * see Documentation/dvb/README.dvb-usb for more information | ||
11 | */ | ||
12 | #include "dibusb.h" | ||
13 | |||
14 | #include "mt352.h" | ||
15 | |||
16 | static int umt_mt352_demod_init(struct dvb_frontend *fe) | ||
17 | { | ||
18 | static u8 mt352_clock_config[] = { 0x89, 0xb8, 0x2d }; | ||
19 | static u8 mt352_reset[] = { 0x50, 0x80 }; | ||
20 | static u8 mt352_mclk_ratio[] = { 0x8b, 0x00 }; | ||
21 | static u8 mt352_adc_ctl_1_cfg[] = { 0x8E, 0x40 }; | ||
22 | static u8 mt352_agc_cfg[] = { 0x67, 0x10, 0xa0 }; | ||
23 | |||
24 | static u8 mt352_sec_agc_cfg1[] = { 0x6a, 0xff }; | ||
25 | static u8 mt352_sec_agc_cfg2[] = { 0x6d, 0xff }; | ||
26 | static u8 mt352_sec_agc_cfg3[] = { 0x70, 0x40 }; | ||
27 | static u8 mt352_sec_agc_cfg4[] = { 0x7b, 0x03 }; | ||
28 | static u8 mt352_sec_agc_cfg5[] = { 0x7d, 0x0f }; | ||
29 | |||
30 | static u8 mt352_acq_ctl[] = { 0x53, 0x50 }; | ||
31 | static u8 mt352_input_freq_1[] = { 0x56, 0x31, 0x06 }; | ||
32 | |||
33 | mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config)); | ||
34 | udelay(2000); | ||
35 | mt352_write(fe, mt352_reset, sizeof(mt352_reset)); | ||
36 | mt352_write(fe, mt352_mclk_ratio, sizeof(mt352_mclk_ratio)); | ||
37 | |||
38 | mt352_write(fe, mt352_adc_ctl_1_cfg, sizeof(mt352_adc_ctl_1_cfg)); | ||
39 | mt352_write(fe, mt352_agc_cfg, sizeof(mt352_agc_cfg)); | ||
40 | |||
41 | mt352_write(fe, mt352_sec_agc_cfg1, sizeof(mt352_sec_agc_cfg1)); | ||
42 | mt352_write(fe, mt352_sec_agc_cfg2, sizeof(mt352_sec_agc_cfg2)); | ||
43 | mt352_write(fe, mt352_sec_agc_cfg3, sizeof(mt352_sec_agc_cfg3)); | ||
44 | mt352_write(fe, mt352_sec_agc_cfg4, sizeof(mt352_sec_agc_cfg4)); | ||
45 | mt352_write(fe, mt352_sec_agc_cfg5, sizeof(mt352_sec_agc_cfg5)); | ||
46 | |||
47 | mt352_write(fe, mt352_acq_ctl, sizeof(mt352_acq_ctl)); | ||
48 | mt352_write(fe, mt352_input_freq_1, sizeof(mt352_input_freq_1)); | ||
49 | |||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | static int umt_mt352_frontend_attach(struct dvb_usb_device *d) | ||
54 | { | ||
55 | struct mt352_config umt_config; | ||
56 | |||
57 | memset(&umt_config,0,sizeof(struct mt352_config)); | ||
58 | umt_config.demod_init = umt_mt352_demod_init; | ||
59 | umt_config.demod_address = 0xf; | ||
60 | umt_config.pll_set = dvb_usb_pll_set; | ||
61 | |||
62 | d->fe = mt352_attach(&umt_config, &d->i2c_adap); | ||
63 | |||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | static int umt_tuner_attach (struct dvb_usb_device *d) | ||
68 | { | ||
69 | d->pll_addr = 0x61; | ||
70 | d->pll_desc = &dvb_pll_tua6034; | ||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | /* USB Driver stuff */ | ||
75 | static struct dvb_usb_properties umt_properties; | ||
76 | |||
77 | static int umt_probe(struct usb_interface *intf, | ||
78 | const struct usb_device_id *id) | ||
79 | { | ||
80 | if (dvb_usb_device_init(intf,&umt_properties,THIS_MODULE) == 0) | ||
81 | return 0; | ||
82 | return -EINVAL; | ||
83 | } | ||
84 | |||
85 | /* do not change the order of the ID table */ | ||
86 | static struct usb_device_id umt_table [] = { | ||
87 | /* 00 */ { USB_DEVICE(USB_VID_HANFTEK, USB_PID_HANFTEK_UMT_010_COLD) }, | ||
88 | /* 01 */ { USB_DEVICE(USB_VID_HANFTEK, USB_PID_HANFTEK_UMT_010_WARM) }, | ||
89 | { } /* Terminating entry */ | ||
90 | }; | ||
91 | MODULE_DEVICE_TABLE (usb, umt_table); | ||
92 | |||
93 | static struct dvb_usb_properties umt_properties = { | ||
94 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | ||
95 | |||
96 | .usb_ctrl = CYPRESS_FX2, | ||
97 | .firmware = "dvb-usb-umt-010-02.fw", | ||
98 | |||
99 | .size_of_priv = sizeof(struct dibusb_state), | ||
100 | |||
101 | .streaming_ctrl = dibusb2_0_streaming_ctrl, | ||
102 | .power_ctrl = dibusb_power_ctrl, | ||
103 | .frontend_attach = umt_mt352_frontend_attach, | ||
104 | .tuner_attach = umt_tuner_attach, | ||
105 | |||
106 | .i2c_algo = &dibusb_i2c_algo, | ||
107 | |||
108 | .generic_bulk_ctrl_endpoint = 0x01, | ||
109 | /* parameter for the MPEG2-data transfer */ | ||
110 | .urb = { | ||
111 | .type = DVB_USB_BULK, | ||
112 | .count = 20, | ||
113 | .endpoint = 0x06, | ||
114 | .u = { | ||
115 | .bulk = { | ||
116 | .buffersize = 512, | ||
117 | } | ||
118 | } | ||
119 | }, | ||
120 | |||
121 | .num_device_descs = 1, | ||
122 | .devices = { | ||
123 | { "Hanftek UMT-010 DVB-T USB2.0", | ||
124 | { &umt_table[0], NULL }, | ||
125 | { &umt_table[1], NULL }, | ||
126 | }, | ||
127 | } | ||
128 | }; | ||
129 | |||
130 | static struct usb_driver umt_driver = { | ||
131 | .owner = THIS_MODULE, | ||
132 | .name = "HanfTek UMT-010 USB2.0 DVB-T devices", | ||
133 | .probe = umt_probe, | ||
134 | .disconnect = dvb_usb_device_exit, | ||
135 | .id_table = umt_table, | ||
136 | }; | ||
137 | |||
138 | /* module stuff */ | ||
139 | static int __init umt_module_init(void) | ||
140 | { | ||
141 | int result; | ||
142 | if ((result = usb_register(&umt_driver))) { | ||
143 | err("usb_register failed. Error number %d",result); | ||
144 | return result; | ||
145 | } | ||
146 | |||
147 | return 0; | ||
148 | } | ||
149 | |||
150 | static void __exit umt_module_exit(void) | ||
151 | { | ||
152 | /* deregister this driver from the USB subsystem */ | ||
153 | usb_deregister(&umt_driver); | ||
154 | } | ||
155 | |||
156 | module_init (umt_module_init); | ||
157 | module_exit (umt_module_exit); | ||
158 | |||
159 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
160 | MODULE_DESCRIPTION("Driver for HanfTek UMT 010 USB2.0 DVB-T device"); | ||
161 | MODULE_VERSION("1.0"); | ||
162 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/vp7045-fe.c b/drivers/media/dvb/dvb-usb/vp7045-fe.c new file mode 100644 index 000000000000..2746edfeccba --- /dev/null +++ b/drivers/media/dvb/dvb-usb/vp7045-fe.c | |||
@@ -0,0 +1,196 @@ | |||
1 | /* DVB frontend part of the Linux driver for TwinhanDTV Alpha/MagicBoxII USB2.0 | ||
2 | * DVB-T receiver. | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * Thanks to Twinhan who kindly provided hardware and information. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the Free | ||
10 | * Software Foundation, version 2. | ||
11 | * | ||
12 | * see Documentation/dvb/README.dvb-usb for more information | ||
13 | * | ||
14 | */ | ||
15 | #include "vp7045.h" | ||
16 | |||
17 | /* It is a Zarlink MT352 within a Samsung Tuner (DNOS404ZH102A) - 040929 - AAT | ||
18 | * | ||
19 | * Programming is hidden inside the firmware, so set_frontend is very easy. | ||
20 | * Even though there is a Firmware command that one can use to access the demod | ||
21 | * via its registers. This is used for status information. | ||
22 | */ | ||
23 | |||
24 | struct vp7045_fe_state { | ||
25 | struct dvb_frontend fe; | ||
26 | struct dvb_usb_device *d; | ||
27 | }; | ||
28 | |||
29 | |||
30 | static int vp7045_fe_read_status(struct dvb_frontend* fe, fe_status_t *status) | ||
31 | { | ||
32 | struct vp7045_fe_state *state = fe->demodulator_priv; | ||
33 | u8 s0 = vp7045_read_reg(state->d,0x00), | ||
34 | s1 = vp7045_read_reg(state->d,0x01), | ||
35 | s3 = vp7045_read_reg(state->d,0x03); | ||
36 | |||
37 | *status = 0; | ||
38 | if (s0 & (1 << 4)) | ||
39 | *status |= FE_HAS_CARRIER; | ||
40 | if (s0 & (1 << 1)) | ||
41 | *status |= FE_HAS_VITERBI; | ||
42 | if (s0 & (1 << 5)) | ||
43 | *status |= FE_HAS_LOCK; | ||
44 | if (s1 & (1 << 1)) | ||
45 | *status |= FE_HAS_SYNC; | ||
46 | if (s3 & (1 << 6)) | ||
47 | *status |= FE_HAS_SIGNAL; | ||
48 | |||
49 | if ((*status & (FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC)) != | ||
50 | (FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC)) | ||
51 | *status &= ~FE_HAS_LOCK; | ||
52 | |||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | static int vp7045_fe_read_ber(struct dvb_frontend* fe, u32 *ber) | ||
57 | { | ||
58 | struct vp7045_fe_state *state = fe->demodulator_priv; | ||
59 | *ber = (vp7045_read_reg(state->d, 0x0D) << 16) | | ||
60 | (vp7045_read_reg(state->d, 0x0E) << 8) | | ||
61 | vp7045_read_reg(state->d, 0x0F); | ||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | static int vp7045_fe_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) | ||
66 | { | ||
67 | struct vp7045_fe_state *state = fe->demodulator_priv; | ||
68 | *unc = (vp7045_read_reg(state->d, 0x10) << 8) | | ||
69 | vp7045_read_reg(state->d, 0x11); | ||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | static int vp7045_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strength) | ||
74 | { | ||
75 | struct vp7045_fe_state *state = fe->demodulator_priv; | ||
76 | u16 signal = (vp7045_read_reg(state->d, 0x14) << 8) | | ||
77 | vp7045_read_reg(state->d, 0x15); | ||
78 | |||
79 | *strength = ~signal; | ||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | static int vp7045_fe_read_snr(struct dvb_frontend* fe, u16 *snr) | ||
84 | { | ||
85 | struct vp7045_fe_state *state = fe->demodulator_priv; | ||
86 | u8 _snr = vp7045_read_reg(state->d, 0x09); | ||
87 | *snr = (_snr << 8) | _snr; | ||
88 | return 0; | ||
89 | } | ||
90 | |||
91 | static int vp7045_fe_init(struct dvb_frontend* fe) | ||
92 | { | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | static int vp7045_fe_sleep(struct dvb_frontend* fe) | ||
97 | { | ||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | static int vp7045_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) | ||
102 | { | ||
103 | tune->min_delay_ms = 800; | ||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | static int vp7045_fe_set_frontend(struct dvb_frontend* fe, | ||
108 | struct dvb_frontend_parameters *fep) | ||
109 | { | ||
110 | struct vp7045_fe_state *state = fe->demodulator_priv; | ||
111 | u8 buf[5]; | ||
112 | u32 freq = fep->frequency / 1000; | ||
113 | |||
114 | buf[0] = (freq >> 16) & 0xff; | ||
115 | buf[1] = (freq >> 8) & 0xff; | ||
116 | buf[2] = freq & 0xff; | ||
117 | buf[3] = 0; | ||
118 | |||
119 | switch (fep->u.ofdm.bandwidth) { | ||
120 | case BANDWIDTH_8_MHZ: buf[4] = 8; break; | ||
121 | case BANDWIDTH_7_MHZ: buf[4] = 7; break; | ||
122 | case BANDWIDTH_6_MHZ: buf[4] = 6; break; | ||
123 | case BANDWIDTH_AUTO: return -EOPNOTSUPP; | ||
124 | default: | ||
125 | return -EINVAL; | ||
126 | } | ||
127 | |||
128 | vp7045_usb_op(state->d,LOCK_TUNER_COMMAND,buf,5,NULL,0,200); | ||
129 | return 0; | ||
130 | } | ||
131 | |||
132 | static int vp7045_fe_get_frontend(struct dvb_frontend* fe, | ||
133 | struct dvb_frontend_parameters *fep) | ||
134 | { | ||
135 | return 0; | ||
136 | } | ||
137 | |||
138 | static void vp7045_fe_release(struct dvb_frontend* fe) | ||
139 | { | ||
140 | struct vp7045_fe_state *state = fe->demodulator_priv; | ||
141 | kfree(state); | ||
142 | } | ||
143 | |||
144 | static struct dvb_frontend_ops vp7045_fe_ops; | ||
145 | |||
146 | struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d) | ||
147 | { | ||
148 | struct vp7045_fe_state *s = kmalloc(sizeof(struct vp7045_fe_state), GFP_KERNEL); | ||
149 | if (s == NULL) | ||
150 | goto error; | ||
151 | memset(s,0,sizeof(struct vp7045_fe_state)); | ||
152 | |||
153 | s->d = d; | ||
154 | s->fe.ops = &vp7045_fe_ops; | ||
155 | s->fe.demodulator_priv = s; | ||
156 | |||
157 | goto success; | ||
158 | error: | ||
159 | return NULL; | ||
160 | success: | ||
161 | return &s->fe; | ||
162 | } | ||
163 | |||
164 | |||
165 | static struct dvb_frontend_ops vp7045_fe_ops = { | ||
166 | .info = { | ||
167 | .name = "Twinhan VP7045/46 USB DVB-T", | ||
168 | .type = FE_OFDM, | ||
169 | .frequency_min = 44250000, | ||
170 | .frequency_max = 867250000, | ||
171 | .frequency_stepsize = 1000, | ||
172 | .caps = FE_CAN_INVERSION_AUTO | | ||
173 | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | | ||
174 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | | ||
175 | FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO | | ||
176 | FE_CAN_TRANSMISSION_MODE_AUTO | | ||
177 | FE_CAN_GUARD_INTERVAL_AUTO | | ||
178 | FE_CAN_RECOVER | | ||
179 | FE_CAN_HIERARCHY_AUTO, | ||
180 | }, | ||
181 | |||
182 | .release = vp7045_fe_release, | ||
183 | |||
184 | .init = vp7045_fe_init, | ||
185 | .sleep = vp7045_fe_sleep, | ||
186 | |||
187 | .set_frontend = vp7045_fe_set_frontend, | ||
188 | .get_frontend = vp7045_fe_get_frontend, | ||
189 | .get_tune_settings = vp7045_fe_get_tune_settings, | ||
190 | |||
191 | .read_status = vp7045_fe_read_status, | ||
192 | .read_ber = vp7045_fe_read_ber, | ||
193 | .read_signal_strength = vp7045_fe_read_signal_strength, | ||
194 | .read_snr = vp7045_fe_read_snr, | ||
195 | .read_ucblocks = vp7045_fe_read_unc_blocks, | ||
196 | }; | ||
diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c new file mode 100644 index 000000000000..02ecc9a8e3b6 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/vp7045.c | |||
@@ -0,0 +1,263 @@ | |||
1 | /* DVB USB compliant Linux driver for the | ||
2 | * - TwinhanDTV Alpha/MagicBoxII USB2.0 DVB-T receiver | ||
3 | * - DigitalNow TinyUSB2 DVB-t receiver | ||
4 | * | ||
5 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
6 | * | ||
7 | * Thanks to Twinhan who kindly provided hardware and information. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the Free | ||
11 | * Software Foundation, version 2. | ||
12 | * | ||
13 | * see Documentation/dvb/README.dvb-usb for more information | ||
14 | */ | ||
15 | #include "vp7045.h" | ||
16 | |||
17 | /* debug */ | ||
18 | int dvb_usb_vp7045_debug; | ||
19 | module_param_named(debug,dvb_usb_vp7045_debug, int, 0644); | ||
20 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS); | ||
21 | |||
22 | int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in, int inlen, int msec) | ||
23 | { | ||
24 | int ret = 0; | ||
25 | u8 inbuf[12] = { 0 }, outbuf[20] = { 0 }; | ||
26 | |||
27 | outbuf[0] = cmd; | ||
28 | |||
29 | if (outlen > 19) | ||
30 | outlen = 19; | ||
31 | |||
32 | if (inlen > 11) | ||
33 | inlen = 11; | ||
34 | |||
35 | if (out != NULL && outlen > 0) | ||
36 | memcpy(&outbuf[1], out, outlen); | ||
37 | |||
38 | deb_xfer("out buffer: "); | ||
39 | debug_dump(outbuf,outlen+1,deb_xfer); | ||
40 | |||
41 | if ((ret = down_interruptible(&d->usb_sem))) | ||
42 | return ret; | ||
43 | |||
44 | if (usb_control_msg(d->udev, | ||
45 | usb_sndctrlpipe(d->udev,0), | ||
46 | TH_COMMAND_OUT, USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0, | ||
47 | outbuf, 20, 2*HZ) != 20) { | ||
48 | err("USB control message 'out' went wrong."); | ||
49 | ret = -EIO; | ||
50 | goto unlock; | ||
51 | } | ||
52 | |||
53 | msleep(msec); | ||
54 | |||
55 | if (usb_control_msg(d->udev, | ||
56 | usb_rcvctrlpipe(d->udev,0), | ||
57 | TH_COMMAND_IN, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, | ||
58 | inbuf, 12, 2*HZ) != 12) { | ||
59 | err("USB control message 'in' went wrong."); | ||
60 | ret = -EIO; | ||
61 | goto unlock; | ||
62 | } | ||
63 | |||
64 | deb_xfer("in buffer: "); | ||
65 | debug_dump(inbuf,12,deb_xfer); | ||
66 | |||
67 | if (in != NULL && inlen > 0) | ||
68 | memcpy(in,&inbuf[1],inlen); | ||
69 | |||
70 | unlock: | ||
71 | up(&d->usb_sem); | ||
72 | |||
73 | return ret; | ||
74 | } | ||
75 | |||
76 | u8 vp7045_read_reg(struct dvb_usb_device *d, u8 reg) | ||
77 | { | ||
78 | u8 obuf[2] = { 0 },v; | ||
79 | obuf[1] = reg; | ||
80 | |||
81 | vp7045_usb_op(d,TUNER_REG_READ,obuf,2,&v,1,30); | ||
82 | |||
83 | return v; | ||
84 | } | ||
85 | |||
86 | static int vp7045_power_ctrl(struct dvb_usb_device *d, int onoff) | ||
87 | { | ||
88 | u8 v = onoff; | ||
89 | return vp7045_usb_op(d,SET_TUNER_POWER,&v,1,NULL,0,150); | ||
90 | } | ||
91 | |||
92 | /* remote control stuff */ | ||
93 | |||
94 | /* The keymapping struct. Somehow this should be loaded to the driver, but | ||
95 | * currently it is hardcoded. */ | ||
96 | static struct dvb_usb_rc_key vp7045_rc_keys[] = { | ||
97 | /* insert the keys like this. to make the raw keys visible, enable | ||
98 | * debug=0x04 when loading dvb-usb-vp7045. */ | ||
99 | |||
100 | /* these keys are probably wrong. I don't have a working IR-receiver on my | ||
101 | * vp7045, so I can't test it. Patches are welcome. */ | ||
102 | { 0x00, 0x01, KEY_1 }, | ||
103 | { 0x00, 0x02, KEY_2 }, | ||
104 | }; | ||
105 | |||
106 | static int vp7045_rc_query(struct dvb_usb_device *d, u32 *key_buf, int *state) | ||
107 | { | ||
108 | u8 key; | ||
109 | int i; | ||
110 | vp7045_usb_op(d,RC_VAL_READ,NULL,0,&key,1,20); | ||
111 | |||
112 | deb_rc("remote query key: %x %d\n",key,key); | ||
113 | |||
114 | if (key == 0x44) { | ||
115 | *state = REMOTE_NO_KEY_PRESSED; | ||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | for (i = 0; i < sizeof(vp7045_rc_keys)/sizeof(struct dvb_usb_rc_key); i++) | ||
120 | if (vp7045_rc_keys[i].data == key) { | ||
121 | *state = REMOTE_KEY_PRESSED; | ||
122 | *key_buf = vp7045_rc_keys[i].event; | ||
123 | break; | ||
124 | } | ||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | static int vp7045_read_eeprom(struct dvb_usb_device *d,u8 *buf, int len, int offset) | ||
129 | { | ||
130 | int i = 0; | ||
131 | u8 v,br[2]; | ||
132 | for (i=0; i < len; i++) { | ||
133 | v = offset + i; | ||
134 | vp7045_usb_op(d,GET_EE_VALUE,&v,1,br,2,5); | ||
135 | buf[i] = br[1]; | ||
136 | } | ||
137 | deb_info("VP7045 EEPROM read (offs: %d, len: %d) : ",offset, i); | ||
138 | debug_dump(buf,i,deb_info); | ||
139 | return 0; | ||
140 | } | ||
141 | |||
142 | |||
143 | static int vp7045_read_mac_addr(struct dvb_usb_device *d,u8 mac[6]) | ||
144 | { | ||
145 | return vp7045_read_eeprom(d,mac, 6, MAC_0_ADDR); | ||
146 | } | ||
147 | |||
148 | static int vp7045_frontend_attach(struct dvb_usb_device *d) | ||
149 | { | ||
150 | u8 buf[255] = { 0 }; | ||
151 | |||
152 | vp7045_usb_op(d,VENDOR_STRING_READ,NULL,0,buf,20,0); | ||
153 | buf[10] = '\0'; | ||
154 | deb_info("firmware says: %s ",buf); | ||
155 | |||
156 | vp7045_usb_op(d,PRODUCT_STRING_READ,NULL,0,buf,20,0); | ||
157 | buf[10] = '\0'; | ||
158 | deb_info("%s ",buf); | ||
159 | |||
160 | vp7045_usb_op(d,FW_VERSION_READ,NULL,0,buf,20,0); | ||
161 | buf[10] = '\0'; | ||
162 | deb_info("v%s\n",buf); | ||
163 | |||
164 | /* Dump the EEPROM */ | ||
165 | /* vp7045_read_eeprom(d,buf, 255, FX2_ID_ADDR); */ | ||
166 | |||
167 | d->fe = vp7045_fe_attach(d); | ||
168 | |||
169 | return 0; | ||
170 | } | ||
171 | |||
172 | static struct dvb_usb_properties vp7045_properties; | ||
173 | |||
174 | static int vp7045_usb_probe(struct usb_interface *intf, | ||
175 | const struct usb_device_id *id) | ||
176 | { | ||
177 | return dvb_usb_device_init(intf,&vp7045_properties,THIS_MODULE); | ||
178 | } | ||
179 | |||
180 | static struct usb_device_id vp7045_usb_table [] = { | ||
181 | { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7045_COLD) }, | ||
182 | { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7045_WARM) }, | ||
183 | { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_DNTV_TINYUSB2_COLD) }, | ||
184 | { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_DNTV_TINYUSB2_WARM) }, | ||
185 | { 0 }, | ||
186 | }; | ||
187 | MODULE_DEVICE_TABLE(usb, vp7045_usb_table); | ||
188 | |||
189 | static struct dvb_usb_properties vp7045_properties = { | ||
190 | .caps = 0, | ||
191 | |||
192 | .usb_ctrl = CYPRESS_FX2, | ||
193 | .firmware = "dvb-usb-vp7045-01.fw", | ||
194 | |||
195 | .power_ctrl = vp7045_power_ctrl, | ||
196 | .frontend_attach = vp7045_frontend_attach, | ||
197 | .read_mac_address = vp7045_read_mac_addr, | ||
198 | |||
199 | .rc_interval = 400, | ||
200 | .rc_key_map = vp7045_rc_keys, | ||
201 | .rc_key_map_size = ARRAY_SIZE(vp7045_rc_keys), | ||
202 | .rc_query = vp7045_rc_query, | ||
203 | |||
204 | /* parameter for the MPEG2-data transfer */ | ||
205 | .urb = { | ||
206 | .type = DVB_USB_BULK, | ||
207 | .count = 7, | ||
208 | .endpoint = 0x02, | ||
209 | .u = { | ||
210 | .bulk = { | ||
211 | .buffersize = 4096, | ||
212 | } | ||
213 | } | ||
214 | }, | ||
215 | |||
216 | .num_device_descs = 2, | ||
217 | .devices = { | ||
218 | { .name = "Twinhan USB2.0 DVB-T receiver (TwinhanDTV Alpha/MagicBox II)", | ||
219 | .cold_ids = { &vp7045_usb_table[0], NULL }, | ||
220 | .warm_ids = { &vp7045_usb_table[1], NULL }, | ||
221 | }, | ||
222 | { .name = "DigitalNow TinyUSB 2 DVB-t Receiver", | ||
223 | .cold_ids = { &vp7045_usb_table[2], NULL }, | ||
224 | .warm_ids = { &vp7045_usb_table[3], NULL }, | ||
225 | }, | ||
226 | { 0 }, | ||
227 | } | ||
228 | }; | ||
229 | |||
230 | /* usb specific object needed to register this driver with the usb subsystem */ | ||
231 | static struct usb_driver vp7045_usb_driver = { | ||
232 | .owner = THIS_MODULE, | ||
233 | .name = "dvb-usb-vp7045", | ||
234 | .probe = vp7045_usb_probe, | ||
235 | .disconnect = dvb_usb_device_exit, | ||
236 | .id_table = vp7045_usb_table, | ||
237 | }; | ||
238 | |||
239 | /* module stuff */ | ||
240 | static int __init vp7045_usb_module_init(void) | ||
241 | { | ||
242 | int result; | ||
243 | if ((result = usb_register(&vp7045_usb_driver))) { | ||
244 | err("usb_register failed. (%d)",result); | ||
245 | return result; | ||
246 | } | ||
247 | |||
248 | return 0; | ||
249 | } | ||
250 | |||
251 | static void __exit vp7045_usb_module_exit(void) | ||
252 | { | ||
253 | /* deregister this driver from the USB subsystem */ | ||
254 | usb_deregister(&vp7045_usb_driver); | ||
255 | } | ||
256 | |||
257 | module_init(vp7045_usb_module_init); | ||
258 | module_exit(vp7045_usb_module_exit); | ||
259 | |||
260 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
261 | MODULE_DESCRIPTION("Driver for Twinhan MagicBox/Alpha and DNTV tinyUSB2 DVB-T USB2.0"); | ||
262 | MODULE_VERSION("1.0"); | ||
263 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/dvb-usb/vp7045.h b/drivers/media/dvb/dvb-usb/vp7045.h new file mode 100644 index 000000000000..9ce21a20fa86 --- /dev/null +++ b/drivers/media/dvb/dvb-usb/vp7045.h | |||
@@ -0,0 +1,78 @@ | |||
1 | /* Common header-file of the Linux driver for the TwinhanDTV Alpha/MagicBoxII | ||
2 | * USB2.0 DVB-T receiver. | ||
3 | * | ||
4 | * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) | ||
5 | * | ||
6 | * Thanks to Twinhan who kindly provided hardware and information. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the Free | ||
10 | * Software Foundation, version 2. | ||
11 | * | ||
12 | * see Documentation/dvb/README.dvb-usb for more information | ||
13 | */ | ||
14 | #ifndef _DVB_USB_VP7045_H_ | ||
15 | #define _DVB_USB_VP7045_H_ | ||
16 | |||
17 | #define DVB_USB_LOG_PREFIX "vp7045" | ||
18 | #include "dvb-usb.h" | ||
19 | |||
20 | extern int dvb_usb_vp7045_debug; | ||
21 | #define deb_info(args...) dprintk(dvb_usb_vp7045_debug,0x01,args) | ||
22 | #define deb_xfer(args...) dprintk(dvb_usb_vp7045_debug,0x02,args) | ||
23 | #define deb_rc(args...) dprintk(dvb_usb_vp7045_debug,0x04,args) | ||
24 | |||
25 | /* vp7045 commands */ | ||
26 | |||
27 | /* Twinhan Vendor requests */ | ||
28 | #define TH_COMMAND_IN 0xC0 | ||
29 | #define TH_COMMAND_OUT 0xC1 | ||
30 | |||
31 | /* command bytes */ | ||
32 | #define TUNER_REG_READ 0x03 | ||
33 | #define TUNER_REG_WRITE 0x04 | ||
34 | |||
35 | #define RC_VAL_READ 0x05 | ||
36 | #define RC_NO_KEY 0x44 | ||
37 | |||
38 | #define SET_TUNER_POWER 0x06 | ||
39 | #define CHECK_TUNER_POWER 0x12 | ||
40 | #define Tuner_Power_ON 1 | ||
41 | #define Tuner_Power_OFF 0 | ||
42 | |||
43 | #define GET_USB_SPEED 0x07 | ||
44 | #define USB_SPEED_LOW 0 | ||
45 | #define USB_SPEED_FULL 1 | ||
46 | #define USB_SPEED_HIGH 2 | ||
47 | |||
48 | #define LOCK_TUNER_COMMAND 0x09 | ||
49 | |||
50 | #define TUNER_SIGNAL_READ 0x0A | ||
51 | |||
52 | /* FX2 eeprom */ | ||
53 | #define SET_EE_VALUE 0x10 | ||
54 | #define GET_EE_VALUE 0x11 | ||
55 | #define FX2_ID_ADDR 0x00 | ||
56 | #define VID_MSB_ADDR 0x02 | ||
57 | #define VID_LSB_ADDR 0x01 | ||
58 | #define PID_MSB_ADDR 0x04 | ||
59 | #define PID_LSB_ADDR 0x03 | ||
60 | #define MAC_0_ADDR 0x07 | ||
61 | #define MAC_1_ADDR 0x08 | ||
62 | #define MAC_2_ADDR 0x09 | ||
63 | #define MAC_3_ADDR 0x0a | ||
64 | #define MAC_4_ADDR 0x0b | ||
65 | #define MAC_5_ADDR 0x0c | ||
66 | |||
67 | #define RESET_FX2 0x13 | ||
68 | |||
69 | #define FW_VERSION_READ 0x0B | ||
70 | #define VENDOR_STRING_READ 0x0C | ||
71 | #define PRODUCT_STRING_READ 0x0D | ||
72 | #define FW_BCD_VERSION_READ 0x14 | ||
73 | |||
74 | extern struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d); | ||
75 | extern int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in, int inlen,int msec); | ||
76 | extern u8 vp7045_read_reg(struct dvb_usb_device *d, u8 reg); | ||
77 | |||
78 | #endif | ||
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig index 75fb556ec01f..b4fddf513ebe 100644 --- a/drivers/media/dvb/frontends/Kconfig +++ b/drivers/media/dvb/frontends/Kconfig | |||
@@ -173,4 +173,12 @@ config DVB_OR51132 | |||
173 | An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want | 173 | An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want |
174 | to support this frontend. | 174 | to support this frontend. |
175 | 175 | ||
176 | config DVB_BCM3510 | ||
177 | tristate "Broadcom BCM3510" | ||
178 | depends on DVB_CORE | ||
179 | select FW_LOADER | ||
180 | help | ||
181 | An ATSC 8VSB/16VSB and QAM64/256 tuner module. Say Y when you want to | ||
182 | support this frontend. | ||
183 | |||
176 | endmenu | 184 | endmenu |
diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile index 7f8784870eab..91d6d3576d3d 100644 --- a/drivers/media/dvb/frontends/Makefile +++ b/drivers/media/dvb/frontends/Makefile | |||
@@ -28,3 +28,4 @@ obj-$(CONFIG_DVB_STV0297) += stv0297.o | |||
28 | obj-$(CONFIG_DVB_NXT2002) += nxt2002.o | 28 | obj-$(CONFIG_DVB_NXT2002) += nxt2002.o |
29 | obj-$(CONFIG_DVB_OR51211) += or51211.o | 29 | obj-$(CONFIG_DVB_OR51211) += or51211.o |
30 | obj-$(CONFIG_DVB_OR51132) += or51132.o | 30 | obj-$(CONFIG_DVB_OR51132) += or51132.o |
31 | obj-$(CONFIG_DVB_BCM3510) += bcm3510.o | ||
diff --git a/drivers/media/dvb/frontends/bcm3510.c b/drivers/media/dvb/frontends/bcm3510.c new file mode 100644 index 000000000000..f5fdc5c3e605 --- /dev/null +++ b/drivers/media/dvb/frontends/bcm3510.c | |||
@@ -0,0 +1,853 @@ | |||
1 | /* | ||
2 | * Support for the Broadcom BCM3510 ATSC demodulator (1st generation Air2PC) | ||
3 | * | ||
4 | * Copyright (C) 2001-5, B2C2 inc. | ||
5 | * | ||
6 | * GPL/Linux driver written by Patrick Boettcher <patrick.boettcher@desy.de> | ||
7 | * | ||
8 | * This driver is "hard-coded" to be used with the 1st generation of | ||
9 | * Technisat/B2C2's Air2PC ATSC PCI/USB cards/boxes. The pll-programming | ||
10 | * (Panasonic CT10S) is located here, which is actually wrong. Unless there is | ||
11 | * another device with a BCM3510, this is no problem. | ||
12 | * | ||
13 | * The driver works also with QAM64 DVB-C, but had an unreasonable high | ||
14 | * UNC. (Tested with the Air2PC ATSC 1st generation) | ||
15 | * | ||
16 | * You'll need a firmware for this driver in order to get it running. It is | ||
17 | * called "dvb-fe-bcm3510-01.fw". | ||
18 | * | ||
19 | * This program is free software; you can redistribute it and/or modify it | ||
20 | * under the terms of the GNU General Public License as published by the Free | ||
21 | * Software Foundation; either version 2 of the License, or (at your option) | ||
22 | * any later version. | ||
23 | * | ||
24 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
25 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
26 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
27 | * more details. | ||
28 | * | ||
29 | * You should have received a copy of the GNU General Public License along with | ||
30 | * this program; if not, write to the Free Software Foundation, Inc., 675 Mass | ||
31 | * Ave, Cambridge, MA 02139, USA. | ||
32 | */ | ||
33 | |||
34 | #include <linux/init.h> | ||
35 | #include <linux/module.h> | ||
36 | #include <linux/moduleparam.h> | ||
37 | #include <linux/device.h> | ||
38 | #include <linux/firmware.h> | ||
39 | |||
40 | #include "dvb_frontend.h" | ||
41 | #include "bcm3510.h" | ||
42 | #include "bcm3510_priv.h" | ||
43 | |||
44 | struct bcm3510_state { | ||
45 | |||
46 | struct i2c_adapter* i2c; | ||
47 | struct dvb_frontend_ops ops; | ||
48 | const struct bcm3510_config* config; | ||
49 | struct dvb_frontend frontend; | ||
50 | |||
51 | /* demodulator private data */ | ||
52 | struct semaphore hab_sem; | ||
53 | u8 firmware_loaded:1; | ||
54 | |||
55 | unsigned long next_status_check; | ||
56 | unsigned long status_check_interval; | ||
57 | struct bcm3510_hab_cmd_status1 status1; | ||
58 | struct bcm3510_hab_cmd_status2 status2; | ||
59 | }; | ||
60 | |||
61 | static int debug; | ||
62 | module_param(debug, int, 0644); | ||
63 | MODULE_PARM_DESC(debug, "set debugging level (1=info,2=i2c (|-able))."); | ||
64 | |||
65 | #define dprintk(level,x...) if (level & debug) printk(x) | ||
66 | #define dbufout(b,l,m) {\ | ||
67 | int i; \ | ||
68 | for (i = 0; i < l; i++) \ | ||
69 | m("%02x ",b[i]); \ | ||
70 | } | ||
71 | #define deb_info(args...) dprintk(0x01,args) | ||
72 | #define deb_i2c(args...) dprintk(0x02,args) | ||
73 | #define deb_hab(args...) dprintk(0x04,args) | ||
74 | |||
75 | /* transfer functions */ | ||
76 | static int bcm3510_writebytes (struct bcm3510_state *state, u8 reg, u8 *buf, u8 len) | ||
77 | { | ||
78 | u8 b[256]; | ||
79 | int err; | ||
80 | struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = b, .len = len + 1 }; | ||
81 | |||
82 | b[0] = reg; | ||
83 | memcpy(&b[1],buf,len); | ||
84 | |||
85 | deb_i2c("i2c wr %02x: ",reg); | ||
86 | dbufout(buf,len,deb_i2c); | ||
87 | deb_i2c("\n"); | ||
88 | |||
89 | if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { | ||
90 | |||
91 | deb_info("%s: i2c write error (addr %02x, reg %02x, err == %i)\n", | ||
92 | __FUNCTION__, state->config->demod_address, reg, err); | ||
93 | return -EREMOTEIO; | ||
94 | } | ||
95 | |||
96 | return 0; | ||
97 | } | ||
98 | |||
99 | static int bcm3510_readbytes (struct bcm3510_state *state, u8 reg, u8 *buf, u8 len) | ||
100 | { | ||
101 | struct i2c_msg msg[] = { | ||
102 | { .addr = state->config->demod_address, .flags = 0, .buf = ®, .len = 1 }, | ||
103 | { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = buf, .len = len } | ||
104 | }; | ||
105 | int err; | ||
106 | |||
107 | memset(buf,0,len); | ||
108 | |||
109 | if ((err = i2c_transfer (state->i2c, msg, 2)) != 2) { | ||
110 | deb_info("%s: i2c read error (addr %02x, reg %02x, err == %i)\n", | ||
111 | __FUNCTION__, state->config->demod_address, reg, err); | ||
112 | return -EREMOTEIO; | ||
113 | } | ||
114 | deb_i2c("i2c rd %02x: ",reg); | ||
115 | dbufout(buf,len,deb_i2c); | ||
116 | deb_i2c("\n"); | ||
117 | |||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | static int bcm3510_writeB(struct bcm3510_state *state, u8 reg, bcm3510_register_value v) | ||
122 | { | ||
123 | return bcm3510_writebytes(state,reg,&v.raw,1); | ||
124 | } | ||
125 | |||
126 | static int bcm3510_readB(struct bcm3510_state *state, u8 reg, bcm3510_register_value *v) | ||
127 | { | ||
128 | return bcm3510_readbytes(state,reg,&v->raw,1); | ||
129 | } | ||
130 | |||
131 | /* Host Access Buffer transfers */ | ||
132 | static int bcm3510_hab_get_response(struct bcm3510_state *st, u8 *buf, int len) | ||
133 | { | ||
134 | bcm3510_register_value v; | ||
135 | int ret,i; | ||
136 | |||
137 | v.HABADR_a6.HABADR = 0; | ||
138 | if ((ret = bcm3510_writeB(st,0xa6,v)) < 0) | ||
139 | return ret; | ||
140 | |||
141 | for (i = 0; i < len; i++) { | ||
142 | if ((ret = bcm3510_readB(st,0xa7,&v)) < 0) | ||
143 | return ret; | ||
144 | buf[i] = v.HABDATA_a7; | ||
145 | } | ||
146 | return 0; | ||
147 | } | ||
148 | |||
149 | static int bcm3510_hab_send_request(struct bcm3510_state *st, u8 *buf, int len) | ||
150 | { | ||
151 | bcm3510_register_value v,hab; | ||
152 | int ret,i; | ||
153 | unsigned long t; | ||
154 | |||
155 | /* Check if any previous HAB request still needs to be serviced by the | ||
156 | * Aquisition Processor before sending new request */ | ||
157 | if ((ret = bcm3510_readB(st,0xa8,&v)) < 0) | ||
158 | return ret; | ||
159 | if (v.HABSTAT_a8.HABR) { | ||
160 | deb_info("HAB is running already - clearing it.\n"); | ||
161 | v.HABSTAT_a8.HABR = 0; | ||
162 | bcm3510_writeB(st,0xa8,v); | ||
163 | // return -EBUSY; | ||
164 | } | ||
165 | |||
166 | /* Send the start HAB Address (automatically incremented after write of | ||
167 | * HABDATA) and write the HAB Data */ | ||
168 | hab.HABADR_a6.HABADR = 0; | ||
169 | if ((ret = bcm3510_writeB(st,0xa6,hab)) < 0) | ||
170 | return ret; | ||
171 | |||
172 | for (i = 0; i < len; i++) { | ||
173 | hab.HABDATA_a7 = buf[i]; | ||
174 | if ((ret = bcm3510_writeB(st,0xa7,hab)) < 0) | ||
175 | return ret; | ||
176 | } | ||
177 | |||
178 | /* Set the HABR bit to indicate AP request in progress (LBHABR allows HABR to | ||
179 | * be written) */ | ||
180 | v.raw = 0; v.HABSTAT_a8.HABR = 1; v.HABSTAT_a8.LDHABR = 1; | ||
181 | if ((ret = bcm3510_writeB(st,0xa8,v)) < 0) | ||
182 | return ret; | ||
183 | |||
184 | /* Polling method: Wait until the AP finishes processing the HAB request */ | ||
185 | t = jiffies + 1*HZ; | ||
186 | while (time_before(jiffies, t)) { | ||
187 | deb_info("waiting for HAB to complete\n"); | ||
188 | msleep(10); | ||
189 | if ((ret = bcm3510_readB(st,0xa8,&v)) < 0) | ||
190 | return ret; | ||
191 | |||
192 | if (!v.HABSTAT_a8.HABR) | ||
193 | return 0; | ||
194 | } | ||
195 | |||
196 | deb_info("send_request execution timed out.\n"); | ||
197 | return -ETIMEDOUT; | ||
198 | } | ||
199 | |||
200 | static int bcm3510_do_hab_cmd(struct bcm3510_state *st, u8 cmd, u8 msgid, u8 *obuf, u8 olen, u8 *ibuf, u8 ilen) | ||
201 | { | ||
202 | u8 ob[olen+2],ib[ilen+2]; | ||
203 | int ret = 0; | ||
204 | |||
205 | ob[0] = cmd; | ||
206 | ob[1] = msgid; | ||
207 | memcpy(&ob[2],obuf,olen); | ||
208 | |||
209 | deb_hab("hab snd: "); | ||
210 | dbufout(ob,olen+2,deb_hab); | ||
211 | deb_hab("\n"); | ||
212 | |||
213 | if (down_interruptible(&st->hab_sem) < 0) | ||
214 | return -EAGAIN; | ||
215 | |||
216 | if ((ret = bcm3510_hab_send_request(st, ob, olen+2)) < 0 || | ||
217 | (ret = bcm3510_hab_get_response(st, ib, ilen+2)) < 0) | ||
218 | goto error; | ||
219 | |||
220 | deb_hab("hab get: "); | ||
221 | dbufout(ib,ilen+2,deb_hab); | ||
222 | deb_hab("\n"); | ||
223 | |||
224 | memcpy(ibuf,&ib[2],ilen); | ||
225 | error: | ||
226 | up(&st->hab_sem); | ||
227 | return ret; | ||
228 | } | ||
229 | |||
230 | #if 0 | ||
231 | /* not needed, we use a semaphore to prevent HAB races */ | ||
232 | static int bcm3510_is_ap_ready(struct bcm3510_state *st) | ||
233 | { | ||
234 | bcm3510_register_value ap,hab; | ||
235 | int ret; | ||
236 | |||
237 | if ((ret = bcm3510_readB(st,0xa8,&hab)) < 0 || | ||
238 | (ret = bcm3510_readB(st,0xa2,&ap) < 0)) | ||
239 | return ret; | ||
240 | |||
241 | if (ap.APSTAT1_a2.RESET || ap.APSTAT1_a2.IDLE || ap.APSTAT1_a2.STOP || hab.HABSTAT_a8.HABR) { | ||
242 | deb_info("AP is busy\n"); | ||
243 | return -EBUSY; | ||
244 | } | ||
245 | |||
246 | return 0; | ||
247 | } | ||
248 | #endif | ||
249 | |||
250 | static int bcm3510_bert_reset(struct bcm3510_state *st) | ||
251 | { | ||
252 | bcm3510_register_value b; | ||
253 | int ret; | ||
254 | |||
255 | if ((ret < bcm3510_readB(st,0xfa,&b)) < 0) | ||
256 | return ret; | ||
257 | |||
258 | b.BERCTL_fa.RESYNC = 0; bcm3510_writeB(st,0xfa,b); | ||
259 | b.BERCTL_fa.RESYNC = 1; bcm3510_writeB(st,0xfa,b); | ||
260 | b.BERCTL_fa.RESYNC = 0; bcm3510_writeB(st,0xfa,b); | ||
261 | b.BERCTL_fa.CNTCTL = 1; b.BERCTL_fa.BITCNT = 1; bcm3510_writeB(st,0xfa,b); | ||
262 | |||
263 | /* clear residual bit counter TODO */ | ||
264 | return 0; | ||
265 | } | ||
266 | |||
267 | static int bcm3510_refresh_state(struct bcm3510_state *st) | ||
268 | { | ||
269 | if (time_after(jiffies,st->next_status_check)) { | ||
270 | bcm3510_do_hab_cmd(st, CMD_STATUS, MSGID_STATUS1, NULL,0, (u8 *)&st->status1, sizeof(st->status1)); | ||
271 | bcm3510_do_hab_cmd(st, CMD_STATUS, MSGID_STATUS2, NULL,0, (u8 *)&st->status2, sizeof(st->status2)); | ||
272 | st->next_status_check = jiffies + (st->status_check_interval*HZ)/1000; | ||
273 | } | ||
274 | return 0; | ||
275 | } | ||
276 | |||
277 | static int bcm3510_read_status(struct dvb_frontend *fe, fe_status_t *status) | ||
278 | { | ||
279 | struct bcm3510_state* st = fe->demodulator_priv; | ||
280 | bcm3510_refresh_state(st); | ||
281 | |||
282 | *status = 0; | ||
283 | if (st->status1.STATUS1.RECEIVER_LOCK) | ||
284 | *status |= FE_HAS_LOCK | FE_HAS_SYNC; | ||
285 | |||
286 | if (st->status1.STATUS1.FEC_LOCK) | ||
287 | *status |= FE_HAS_VITERBI; | ||
288 | |||
289 | if (st->status1.STATUS1.OUT_PLL_LOCK) | ||
290 | *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER; | ||
291 | |||
292 | if (*status & FE_HAS_LOCK) | ||
293 | st->status_check_interval = 1500; | ||
294 | else /* more frequently checks if no lock has been achieved yet */ | ||
295 | st->status_check_interval = 500; | ||
296 | |||
297 | deb_info("real_status: %02x\n",*status); | ||
298 | return 0; | ||
299 | } | ||
300 | |||
301 | static int bcm3510_read_ber(struct dvb_frontend* fe, u32* ber) | ||
302 | { | ||
303 | struct bcm3510_state* st = fe->demodulator_priv; | ||
304 | bcm3510_refresh_state(st); | ||
305 | |||
306 | *ber = (st->status2.LDBER0 << 16) | (st->status2.LDBER1 << 8) | st->status2.LDBER2; | ||
307 | return 0; | ||
308 | } | ||
309 | |||
310 | static int bcm3510_read_unc(struct dvb_frontend* fe, u32* unc) | ||
311 | { | ||
312 | struct bcm3510_state* st = fe->demodulator_priv; | ||
313 | bcm3510_refresh_state(st); | ||
314 | *unc = (st->status2.LDUERC0 << 8) | st->status2.LDUERC1; | ||
315 | return 0; | ||
316 | } | ||
317 | |||
318 | static int bcm3510_read_signal_strength(struct dvb_frontend* fe, u16* strength) | ||
319 | { | ||
320 | struct bcm3510_state* st = fe->demodulator_priv; | ||
321 | s32 t; | ||
322 | |||
323 | bcm3510_refresh_state(st); | ||
324 | t = st->status2.SIGNAL; | ||
325 | |||
326 | if (t > 190) | ||
327 | t = 190; | ||
328 | if (t < 90) | ||
329 | t = 90; | ||
330 | |||
331 | t -= 90; | ||
332 | t = t * 0xff / 100; | ||
333 | /* normalize if necessary */ | ||
334 | *strength = (t << 8) | t; | ||
335 | return 0; | ||
336 | } | ||
337 | |||
338 | static int bcm3510_read_snr(struct dvb_frontend* fe, u16* snr) | ||
339 | { | ||
340 | struct bcm3510_state* st = fe->demodulator_priv; | ||
341 | bcm3510_refresh_state(st); | ||
342 | |||
343 | *snr = st->status1.SNR_EST0*1000 + ((st->status1.SNR_EST1*1000) >> 8); | ||
344 | return 0; | ||
345 | } | ||
346 | |||
347 | /* tuner frontend programming */ | ||
348 | static int bcm3510_tuner_cmd(struct bcm3510_state* st,u8 bc, u16 n, u8 a) | ||
349 | { | ||
350 | struct bcm3510_hab_cmd_tune c; | ||
351 | memset(&c,0,sizeof(struct bcm3510_hab_cmd_tune)); | ||
352 | |||
353 | /* I2C Mode disabled, set 16 control / Data pairs */ | ||
354 | c.length = 0x10; | ||
355 | c.clock_width = 0; | ||
356 | /* CS1, CS0, DATA, CLK bits control the tuner RF_AGC_SEL pin is set to | ||
357 | * logic high (as Configuration) */ | ||
358 | c.misc = 0x10; | ||
359 | /* Set duration of the initial state of TUNCTL = 3.34 micro Sec */ | ||
360 | c.TUNCTL_state = 0x40; | ||
361 | |||
362 | /* PRESCALER DEVIDE RATIO | BC1_2_3_4; (band switch), 1stosc REFERENCE COUNTER REF_S12 and REF_S11 */ | ||
363 | c.ctl_dat[0].ctrl.size = BITS_8; | ||
364 | c.ctl_dat[0].data = 0x80 | bc; | ||
365 | |||
366 | /* Control DATA pin, 1stosc REFERENCE COUNTER REF_S10 to REF_S3 */ | ||
367 | c.ctl_dat[1].ctrl.size = BITS_8; | ||
368 | c.ctl_dat[1].data = 4; | ||
369 | |||
370 | /* set CONTROL BIT 1 to 1, 1stosc REFERENCE COUNTER REF_S2 to REF_S1 */ | ||
371 | c.ctl_dat[2].ctrl.size = BITS_3; | ||
372 | c.ctl_dat[2].data = 0x20; | ||
373 | |||
374 | /* control CS0 pin, pulse byte ? */ | ||
375 | c.ctl_dat[3].ctrl.size = BITS_3; | ||
376 | c.ctl_dat[3].ctrl.clk_off = 1; | ||
377 | c.ctl_dat[3].ctrl.cs0 = 1; | ||
378 | c.ctl_dat[3].data = 0x40; | ||
379 | |||
380 | /* PGM_S18 to PGM_S11 */ | ||
381 | c.ctl_dat[4].ctrl.size = BITS_8; | ||
382 | c.ctl_dat[4].data = n >> 3; | ||
383 | |||
384 | /* PGM_S10 to PGM_S8, SWL_S7 to SWL_S3 */ | ||
385 | c.ctl_dat[5].ctrl.size = BITS_8; | ||
386 | c.ctl_dat[5].data = ((n & 0x7) << 5) | (a >> 2); | ||
387 | |||
388 | /* SWL_S2 and SWL_S1, set CONTROL BIT 2 to 0 */ | ||
389 | c.ctl_dat[6].ctrl.size = BITS_3; | ||
390 | c.ctl_dat[6].data = (a << 6) & 0xdf; | ||
391 | |||
392 | /* control CS0 pin, pulse byte ? */ | ||
393 | c.ctl_dat[7].ctrl.size = BITS_3; | ||
394 | c.ctl_dat[7].ctrl.clk_off = 1; | ||
395 | c.ctl_dat[7].ctrl.cs0 = 1; | ||
396 | c.ctl_dat[7].data = 0x40; | ||
397 | |||
398 | /* PRESCALER DEVIDE RATIO, 2ndosc REFERENCE COUNTER REF_S12 and REF_S11 */ | ||
399 | c.ctl_dat[8].ctrl.size = BITS_8; | ||
400 | c.ctl_dat[8].data = 0x80; | ||
401 | |||
402 | /* 2ndosc REFERENCE COUNTER REF_S10 to REF_S3 */ | ||
403 | c.ctl_dat[9].ctrl.size = BITS_8; | ||
404 | c.ctl_dat[9].data = 0x10; | ||
405 | |||
406 | /* set CONTROL BIT 1 to 1, 2ndosc REFERENCE COUNTER REF_S2 to REF_S1 */ | ||
407 | c.ctl_dat[10].ctrl.size = BITS_3; | ||
408 | c.ctl_dat[10].data = 0x20; | ||
409 | |||
410 | /* pulse byte */ | ||
411 | c.ctl_dat[11].ctrl.size = BITS_3; | ||
412 | c.ctl_dat[11].ctrl.clk_off = 1; | ||
413 | c.ctl_dat[11].ctrl.cs1 = 1; | ||
414 | c.ctl_dat[11].data = 0x40; | ||
415 | |||
416 | /* PGM_S18 to PGM_S11 */ | ||
417 | c.ctl_dat[12].ctrl.size = BITS_8; | ||
418 | c.ctl_dat[12].data = 0x2a; | ||
419 | |||
420 | /* PGM_S10 to PGM_S8 and SWL_S7 to SWL_S3 */ | ||
421 | c.ctl_dat[13].ctrl.size = BITS_8; | ||
422 | c.ctl_dat[13].data = 0x8e; | ||
423 | |||
424 | /* SWL_S2 and SWL_S1 and set CONTROL BIT 2 to 0 */ | ||
425 | c.ctl_dat[14].ctrl.size = BITS_3; | ||
426 | c.ctl_dat[14].data = 0; | ||
427 | |||
428 | /* Pulse Byte */ | ||
429 | c.ctl_dat[15].ctrl.size = BITS_3; | ||
430 | c.ctl_dat[15].ctrl.clk_off = 1; | ||
431 | c.ctl_dat[15].ctrl.cs1 = 1; | ||
432 | c.ctl_dat[15].data = 0x40; | ||
433 | |||
434 | return bcm3510_do_hab_cmd(st,CMD_TUNE, MSGID_TUNE,(u8 *) &c,sizeof(c), NULL, 0); | ||
435 | } | ||
436 | |||
437 | static int bcm3510_set_freq(struct bcm3510_state* st,u32 freq) | ||
438 | { | ||
439 | u8 bc,a; | ||
440 | u16 n; | ||
441 | s32 YIntercept,Tfvco1; | ||
442 | |||
443 | freq /= 1000; | ||
444 | |||
445 | deb_info("%dkHz:",freq); | ||
446 | /* set Band Switch */ | ||
447 | if (freq <= 168000) | ||
448 | bc = 0x1c; | ||
449 | else if (freq <= 378000) | ||
450 | bc = 0x2c; | ||
451 | else | ||
452 | bc = 0x30; | ||
453 | |||
454 | if (freq >= 470000) { | ||
455 | freq -= 470001; | ||
456 | YIntercept = 18805; | ||
457 | } else if (freq >= 90000) { | ||
458 | freq -= 90001; | ||
459 | YIntercept = 15005; | ||
460 | } else if (freq >= 76000){ | ||
461 | freq -= 76001; | ||
462 | YIntercept = 14865; | ||
463 | } else { | ||
464 | freq -= 54001; | ||
465 | YIntercept = 14645; | ||
466 | } | ||
467 | |||
468 | Tfvco1 = (((freq/6000)*60 + YIntercept)*4)/10; | ||
469 | |||
470 | n = Tfvco1 >> 6; | ||
471 | a = Tfvco1 & 0x3f; | ||
472 | |||
473 | deb_info(" BC1_2_3_4: %x, N: %x A: %x\n", bc, n, a); | ||
474 | if (n >= 16 && n <= 2047) | ||
475 | return bcm3510_tuner_cmd(st,bc,n,a); | ||
476 | |||
477 | return -EINVAL; | ||
478 | } | ||
479 | |||
480 | static int bcm3510_set_frontend(struct dvb_frontend* fe, | ||
481 | struct dvb_frontend_parameters *p) | ||
482 | { | ||
483 | struct bcm3510_state* st = fe->demodulator_priv; | ||
484 | struct bcm3510_hab_cmd_ext_acquire cmd; | ||
485 | struct bcm3510_hab_cmd_bert_control bert; | ||
486 | int ret; | ||
487 | |||
488 | memset(&cmd,0,sizeof(cmd)); | ||
489 | switch (p->u.vsb.modulation) { | ||
490 | case QAM_256: | ||
491 | cmd.ACQUIRE0.MODE = 0x1; | ||
492 | cmd.ACQUIRE1.SYM_RATE = 0x1; | ||
493 | cmd.ACQUIRE1.IF_FREQ = 0x1; | ||
494 | break; | ||
495 | case QAM_64: | ||
496 | cmd.ACQUIRE0.MODE = 0x2; | ||
497 | cmd.ACQUIRE1.SYM_RATE = 0x2; | ||
498 | cmd.ACQUIRE1.IF_FREQ = 0x1; | ||
499 | break; | ||
500 | /* case QAM_256: | ||
501 | cmd.ACQUIRE0.MODE = 0x3; | ||
502 | break; | ||
503 | case QAM_128: | ||
504 | cmd.ACQUIRE0.MODE = 0x4; | ||
505 | break; | ||
506 | case QAM_64: | ||
507 | cmd.ACQUIRE0.MODE = 0x5; | ||
508 | break; | ||
509 | case QAM_32: | ||
510 | cmd.ACQUIRE0.MODE = 0x6; | ||
511 | break; | ||
512 | case QAM_16: | ||
513 | cmd.ACQUIRE0.MODE = 0x7; | ||
514 | break;*/ | ||
515 | case VSB_8: | ||
516 | cmd.ACQUIRE0.MODE = 0x8; | ||
517 | cmd.ACQUIRE1.SYM_RATE = 0x0; | ||
518 | cmd.ACQUIRE1.IF_FREQ = 0x0; | ||
519 | break; | ||
520 | case VSB_16: | ||
521 | cmd.ACQUIRE0.MODE = 0x9; | ||
522 | cmd.ACQUIRE1.SYM_RATE = 0x0; | ||
523 | cmd.ACQUIRE1.IF_FREQ = 0x0; | ||
524 | default: | ||
525 | return -EINVAL; | ||
526 | }; | ||
527 | cmd.ACQUIRE0.OFFSET = 0; | ||
528 | cmd.ACQUIRE0.NTSCSWEEP = 1; | ||
529 | cmd.ACQUIRE0.FA = 1; | ||
530 | cmd.ACQUIRE0.BW = 0; | ||
531 | |||
532 | /* if (enableOffset) { | ||
533 | cmd.IF_OFFSET0 = xx; | ||
534 | cmd.IF_OFFSET1 = xx; | ||
535 | |||
536 | cmd.SYM_OFFSET0 = xx; | ||
537 | cmd.SYM_OFFSET1 = xx; | ||
538 | if (enableNtscSweep) { | ||
539 | cmd.NTSC_OFFSET0; | ||
540 | cmd.NTSC_OFFSET1; | ||
541 | } | ||
542 | } */ | ||
543 | bcm3510_do_hab_cmd(st, CMD_ACQUIRE, MSGID_EXT_TUNER_ACQUIRE, (u8 *) &cmd, sizeof(cmd), NULL, 0); | ||
544 | |||
545 | /* doing it with different MSGIDs, data book and source differs */ | ||
546 | bert.BE = 0; | ||
547 | bert.unused = 0; | ||
548 | bcm3510_do_hab_cmd(st, CMD_STATE_CONTROL, MSGID_BERT_CONTROL, (u8 *) &bert, sizeof(bert), NULL, 0); | ||
549 | bcm3510_do_hab_cmd(st, CMD_STATE_CONTROL, MSGID_BERT_SET, (u8 *) &bert, sizeof(bert), NULL, 0); | ||
550 | |||
551 | bcm3510_bert_reset(st); | ||
552 | |||
553 | if ((ret = bcm3510_set_freq(st,p->frequency)) < 0) | ||
554 | return ret; | ||
555 | |||
556 | memset(&st->status1,0,sizeof(st->status1)); | ||
557 | memset(&st->status2,0,sizeof(st->status2)); | ||
558 | st->status_check_interval = 500; | ||
559 | |||
560 | /* Give the AP some time */ | ||
561 | msleep(200); | ||
562 | |||
563 | return 0; | ||
564 | } | ||
565 | |||
566 | static int bcm3510_sleep(struct dvb_frontend* fe) | ||
567 | { | ||
568 | return 0; | ||
569 | } | ||
570 | |||
571 | static int bcm3510_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend_tune_settings *s) | ||
572 | { | ||
573 | s->min_delay_ms = 1000; | ||
574 | s->step_size = 0; | ||
575 | s->max_drift = 0; | ||
576 | return 0; | ||
577 | } | ||
578 | |||
579 | static void bcm3510_release(struct dvb_frontend* fe) | ||
580 | { | ||
581 | struct bcm3510_state* state = fe->demodulator_priv; | ||
582 | kfree(state); | ||
583 | } | ||
584 | |||
585 | /* firmware download: | ||
586 | * firmware file is build up like this: | ||
587 | * 16bit addr, 16bit length, 8byte of length | ||
588 | */ | ||
589 | #define BCM3510_DEFAULT_FIRMWARE "dvb-fe-bcm3510-01.fw" | ||
590 | |||
591 | static int bcm3510_write_ram(struct bcm3510_state *st, u16 addr, u8 *b, u16 len) | ||
592 | { | ||
593 | int ret = 0,i; | ||
594 | bcm3510_register_value vH, vL,vD; | ||
595 | |||
596 | vH.MADRH_a9 = addr >> 8; | ||
597 | vL.MADRL_aa = addr; | ||
598 | if ((ret = bcm3510_writeB(st,0xa9,vH)) < 0) return ret; | ||
599 | if ((ret = bcm3510_writeB(st,0xaa,vL)) < 0) return ret; | ||
600 | |||
601 | for (i = 0; i < len; i++) { | ||
602 | vD.MDATA_ab = b[i]; | ||
603 | if ((ret = bcm3510_writeB(st,0xab,vD)) < 0) | ||
604 | return ret; | ||
605 | } | ||
606 | |||
607 | return 0; | ||
608 | } | ||
609 | |||
610 | static int bcm3510_download_firmware(struct dvb_frontend* fe) | ||
611 | { | ||
612 | struct bcm3510_state* st = fe->demodulator_priv; | ||
613 | const struct firmware *fw; | ||
614 | u16 addr,len; | ||
615 | u8 *b; | ||
616 | int ret,i; | ||
617 | |||
618 | deb_info("requesting firmware\n"); | ||
619 | if ((ret = st->config->request_firmware(fe, &fw, BCM3510_DEFAULT_FIRMWARE)) < 0) { | ||
620 | err("could not load firmware (%s): %d",BCM3510_DEFAULT_FIRMWARE,ret); | ||
621 | return ret; | ||
622 | } | ||
623 | deb_info("got firmware: %d\n",fw->size); | ||
624 | |||
625 | b = fw->data; | ||
626 | for (i = 0; i < fw->size;) { | ||
627 | addr = le16_to_cpu( *( (u16 *)&b[i] ) ); | ||
628 | len = le16_to_cpu( *( (u16 *)&b[i+2] ) ); | ||
629 | deb_info("firmware chunk, addr: 0x%04x, len: 0x%04x, total length: 0x%04x\n",addr,len,fw->size); | ||
630 | if ((ret = bcm3510_write_ram(st,addr,&b[i+4],len)) < 0) { | ||
631 | err("firmware download failed: %d\n",ret); | ||
632 | return ret; | ||
633 | } | ||
634 | i += 4 + len; | ||
635 | } | ||
636 | release_firmware(fw); | ||
637 | deb_info("firmware download successfully completed\n"); | ||
638 | return 0; | ||
639 | } | ||
640 | |||
641 | static int bcm3510_check_firmware_version(struct bcm3510_state *st) | ||
642 | { | ||
643 | struct bcm3510_hab_cmd_get_version_info ver; | ||
644 | bcm3510_do_hab_cmd(st,CMD_GET_VERSION_INFO,MSGID_GET_VERSION_INFO,NULL,0,(u8*)&ver,sizeof(ver)); | ||
645 | |||
646 | deb_info("Version information: 0x%02x 0x%02x 0x%02x 0x%02x\n", | ||
647 | ver.microcode_version, ver.script_version, ver.config_version, ver.demod_version); | ||
648 | |||
649 | if (ver.script_version == BCM3510_DEF_SCRIPT_VERSION && | ||
650 | ver.config_version == BCM3510_DEF_CONFIG_VERSION && | ||
651 | ver.demod_version == BCM3510_DEF_DEMOD_VERSION) | ||
652 | return 0; | ||
653 | |||
654 | deb_info("version check failed\n"); | ||
655 | return -ENODEV; | ||
656 | } | ||
657 | |||
658 | /* (un)resetting the AP */ | ||
659 | static int bcm3510_reset(struct bcm3510_state *st) | ||
660 | { | ||
661 | int ret; | ||
662 | unsigned long t; | ||
663 | bcm3510_register_value v; | ||
664 | |||
665 | bcm3510_readB(st,0xa0,&v); v.HCTL1_a0.RESET = 1; | ||
666 | if ((ret = bcm3510_writeB(st,0xa0,v)) < 0) | ||
667 | return ret; | ||
668 | |||
669 | t = jiffies + 3*HZ; | ||
670 | while (time_before(jiffies, t)) { | ||
671 | msleep(10); | ||
672 | if ((ret = bcm3510_readB(st,0xa2,&v)) < 0) | ||
673 | return ret; | ||
674 | |||
675 | if (v.APSTAT1_a2.RESET) | ||
676 | return 0; | ||
677 | } | ||
678 | deb_info("reset timed out\n"); | ||
679 | return -ETIMEDOUT; | ||
680 | } | ||
681 | |||
682 | static int bcm3510_clear_reset(struct bcm3510_state *st) | ||
683 | { | ||
684 | bcm3510_register_value v; | ||
685 | int ret; | ||
686 | unsigned long t; | ||
687 | |||
688 | v.raw = 0; | ||
689 | if ((ret = bcm3510_writeB(st,0xa0,v)) < 0) | ||
690 | return ret; | ||
691 | |||
692 | t = jiffies + 3*HZ; | ||
693 | while (time_before(jiffies, t)) { | ||
694 | msleep(10); | ||
695 | if ((ret = bcm3510_readB(st,0xa2,&v)) < 0) | ||
696 | return ret; | ||
697 | |||
698 | /* verify that reset is cleared */ | ||
699 | if (!v.APSTAT1_a2.RESET) | ||
700 | return 0; | ||
701 | } | ||
702 | deb_info("reset clear timed out\n"); | ||
703 | return -ETIMEDOUT; | ||
704 | } | ||
705 | |||
706 | static int bcm3510_init_cold(struct bcm3510_state *st) | ||
707 | { | ||
708 | int ret; | ||
709 | bcm3510_register_value v; | ||
710 | |||
711 | /* read Acquisation Processor status register and check it is not in RUN mode */ | ||
712 | if ((ret = bcm3510_readB(st,0xa2,&v)) < 0) | ||
713 | return ret; | ||
714 | if (v.APSTAT1_a2.RUN) { | ||
715 | deb_info("AP is already running - firmware already loaded.\n"); | ||
716 | return 0; | ||
717 | } | ||
718 | |||
719 | deb_info("reset?\n"); | ||
720 | if ((ret = bcm3510_reset(st)) < 0) | ||
721 | return ret; | ||
722 | |||
723 | deb_info("tristate?\n"); | ||
724 | /* tri-state */ | ||
725 | v.TSTCTL_2e.CTL = 0; | ||
726 | if ((ret = bcm3510_writeB(st,0x2e,v)) < 0) | ||
727 | return ret; | ||
728 | |||
729 | deb_info("firmware?\n"); | ||
730 | if ((ret = bcm3510_download_firmware(&st->frontend)) < 0 || | ||
731 | (ret = bcm3510_clear_reset(st)) < 0) | ||
732 | return ret; | ||
733 | |||
734 | /* anything left here to Let the acquisition processor begin execution at program counter 0000 ??? */ | ||
735 | |||
736 | return 0; | ||
737 | } | ||
738 | |||
739 | static int bcm3510_init(struct dvb_frontend* fe) | ||
740 | { | ||
741 | struct bcm3510_state* st = fe->demodulator_priv; | ||
742 | bcm3510_register_value j; | ||
743 | struct bcm3510_hab_cmd_set_agc c; | ||
744 | int ret; | ||
745 | |||
746 | if ((ret = bcm3510_readB(st,0xca,&j)) < 0) | ||
747 | return ret; | ||
748 | |||
749 | deb_info("JDEC: %02x\n",j.raw); | ||
750 | |||
751 | switch (j.JDEC_ca.JDEC) { | ||
752 | case JDEC_WAIT_AT_RAM: | ||
753 | deb_info("attempting to download firmware\n"); | ||
754 | if ((ret = bcm3510_init_cold(st)) < 0) | ||
755 | return ret; | ||
756 | case JDEC_EEPROM_LOAD_WAIT: /* fall-through is wanted */ | ||
757 | deb_info("firmware is loaded\n"); | ||
758 | bcm3510_check_firmware_version(st); | ||
759 | break; | ||
760 | default: | ||
761 | return -ENODEV; | ||
762 | } | ||
763 | |||
764 | memset(&c,0,1); | ||
765 | c.SEL = 1; | ||
766 | bcm3510_do_hab_cmd(st,CMD_AUTO_PARAM,MSGID_SET_RF_AGC_SEL,(u8 *)&c,sizeof(c),NULL,0); | ||
767 | |||
768 | return 0; | ||
769 | } | ||
770 | |||
771 | |||
772 | static struct dvb_frontend_ops bcm3510_ops; | ||
773 | |||
774 | struct dvb_frontend* bcm3510_attach(const struct bcm3510_config *config, | ||
775 | struct i2c_adapter *i2c) | ||
776 | { | ||
777 | struct bcm3510_state* state = NULL; | ||
778 | int ret; | ||
779 | bcm3510_register_value v; | ||
780 | |||
781 | /* allocate memory for the internal state */ | ||
782 | state = kmalloc(sizeof(struct bcm3510_state), GFP_KERNEL); | ||
783 | if (state == NULL) | ||
784 | goto error; | ||
785 | memset(state,0,sizeof(struct bcm3510_state)); | ||
786 | |||
787 | /* setup the state */ | ||
788 | |||
789 | state->config = config; | ||
790 | state->i2c = i2c; | ||
791 | memcpy(&state->ops, &bcm3510_ops, sizeof(struct dvb_frontend_ops)); | ||
792 | |||
793 | /* create dvb_frontend */ | ||
794 | state->frontend.ops = &state->ops; | ||
795 | state->frontend.demodulator_priv = state; | ||
796 | |||
797 | sema_init(&state->hab_sem, 1); | ||
798 | |||
799 | if ((ret = bcm3510_readB(state,0xe0,&v)) < 0) | ||
800 | goto error; | ||
801 | |||
802 | deb_info("Revision: 0x%1x, Layer: 0x%1x.\n",v.REVID_e0.REV,v.REVID_e0.LAYER); | ||
803 | |||
804 | if ((v.REVID_e0.REV != 0x1 && v.REVID_e0.LAYER != 0xb) && /* cold */ | ||
805 | (v.REVID_e0.REV != 0x8 && v.REVID_e0.LAYER != 0x0)) /* warm */ | ||
806 | goto error; | ||
807 | |||
808 | info("Revision: 0x%1x, Layer: 0x%1x.",v.REVID_e0.REV,v.REVID_e0.LAYER); | ||
809 | |||
810 | bcm3510_reset(state); | ||
811 | |||
812 | return &state->frontend; | ||
813 | |||
814 | error: | ||
815 | kfree(state); | ||
816 | return NULL; | ||
817 | } | ||
818 | EXPORT_SYMBOL(bcm3510_attach); | ||
819 | |||
820 | static struct dvb_frontend_ops bcm3510_ops = { | ||
821 | |||
822 | .info = { | ||
823 | .name = "Broadcom BCM3510 VSB/QAM frontend", | ||
824 | .type = FE_ATSC, | ||
825 | .frequency_min = 54000000, | ||
826 | .frequency_max = 803000000, | ||
827 | /* stepsize is just a guess */ | ||
828 | .frequency_stepsize = 0, | ||
829 | .caps = | ||
830 | FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | | ||
831 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | | ||
832 | FE_CAN_8VSB | FE_CAN_16VSB | | ||
833 | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_128 | FE_CAN_QAM_256 | ||
834 | }, | ||
835 | |||
836 | .release = bcm3510_release, | ||
837 | |||
838 | .init = bcm3510_init, | ||
839 | .sleep = bcm3510_sleep, | ||
840 | |||
841 | .set_frontend = bcm3510_set_frontend, | ||
842 | .get_tune_settings = bcm3510_get_tune_settings, | ||
843 | |||
844 | .read_status = bcm3510_read_status, | ||
845 | .read_ber = bcm3510_read_ber, | ||
846 | .read_signal_strength = bcm3510_read_signal_strength, | ||
847 | .read_snr = bcm3510_read_snr, | ||
848 | .read_ucblocks = bcm3510_read_unc, | ||
849 | }; | ||
850 | |||
851 | MODULE_DESCRIPTION("Broadcom BCM3510 ATSC (8VSB/16VSB & ITU J83 AnnexB FEC QAM64/256) demodulator driver"); | ||
852 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); | ||
853 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/dvb/frontends/bcm3510.h b/drivers/media/dvb/frontends/bcm3510.h new file mode 100644 index 000000000000..80f5d0953d02 --- /dev/null +++ b/drivers/media/dvb/frontends/bcm3510.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * Support for the Broadcom BCM3510 ATSC demodulator (1st generation Air2PC) | ||
3 | * | ||
4 | * Copyright (C) 2001-5, B2C2 inc. | ||
5 | * | ||
6 | * GPL/Linux driver written by Patrick Boettcher <patrick.boettcher@desy.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 | #ifndef BCM3510_H | ||
23 | #define BCM3510_H | ||
24 | |||
25 | #include <linux/dvb/frontend.h> | ||
26 | #include <linux/firmware.h> | ||
27 | |||
28 | struct bcm3510_config | ||
29 | { | ||
30 | /* the demodulator's i2c address */ | ||
31 | u8 demod_address; | ||
32 | |||
33 | /* request firmware for device */ | ||
34 | int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name); | ||
35 | }; | ||
36 | |||
37 | extern struct dvb_frontend* bcm3510_attach(const struct bcm3510_config* config, | ||
38 | struct i2c_adapter* i2c); | ||
39 | |||
40 | #endif | ||
diff --git a/drivers/media/dvb/frontends/bcm3510_priv.h b/drivers/media/dvb/frontends/bcm3510_priv.h new file mode 100644 index 000000000000..3bb1bc2a04f0 --- /dev/null +++ b/drivers/media/dvb/frontends/bcm3510_priv.h | |||
@@ -0,0 +1,460 @@ | |||
1 | /* | ||
2 | * Support for the Broadcom BCM3510 ATSC demodulator (1st generation Air2PC) | ||
3 | * | ||
4 | * Copyright (C) 2001-5, B2C2 inc. | ||
5 | * | ||
6 | * GPL/Linux driver written by Patrick Boettcher <patrick.boettcher@desy.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 | #ifndef __BCM3510_PRIV_H__ | ||
23 | #define __BCM3510_PRIV_H__ | ||
24 | |||
25 | #define PACKED __attribute__((packed)) | ||
26 | |||
27 | #undef err | ||
28 | #define err(format, arg...) printk(KERN_ERR "bcm3510: " format "\n" , ## arg) | ||
29 | #undef info | ||
30 | #define info(format, arg...) printk(KERN_INFO "bcm3510: " format "\n" , ## arg) | ||
31 | #undef warn | ||
32 | #define warn(format, arg...) printk(KERN_WARNING "bcm3510: " format "\n" , ## arg) | ||
33 | |||
34 | |||
35 | #define PANASONIC_FIRST_IF_BASE_IN_KHz 1407500 | ||
36 | #define BCM3510_SYMBOL_RATE 5381000 | ||
37 | |||
38 | typedef union { | ||
39 | u8 raw; | ||
40 | |||
41 | struct { | ||
42 | u8 CTL :8; | ||
43 | } TSTCTL_2e; | ||
44 | |||
45 | u8 LDCERC_4e; | ||
46 | u8 LDUERC_4f; | ||
47 | u8 LD_BER0_65; | ||
48 | u8 LD_BER1_66; | ||
49 | u8 LD_BER2_67; | ||
50 | u8 LD_BER3_68; | ||
51 | |||
52 | struct { | ||
53 | u8 RESET :1; | ||
54 | u8 IDLE :1; | ||
55 | u8 STOP :1; | ||
56 | u8 HIRQ0 :1; | ||
57 | u8 HIRQ1 :1; | ||
58 | u8 na0 :1; | ||
59 | u8 HABAV :1; | ||
60 | u8 na1 :1; | ||
61 | } HCTL1_a0; | ||
62 | |||
63 | struct { | ||
64 | u8 na0 :1; | ||
65 | u8 IDLMSK :1; | ||
66 | u8 STMSK :1; | ||
67 | u8 I0MSK :1; | ||
68 | u8 I1MSK :1; | ||
69 | u8 na1 :1; | ||
70 | u8 HABMSK :1; | ||
71 | u8 na2 :1; | ||
72 | } HCTLMSK_a1; | ||
73 | |||
74 | struct { | ||
75 | u8 RESET :1; | ||
76 | u8 IDLE :1; | ||
77 | u8 STOP :1; | ||
78 | u8 RUN :1; | ||
79 | u8 HABAV :1; | ||
80 | u8 MEMAV :1; | ||
81 | u8 ALDONE :1; | ||
82 | u8 REIRQ :1; | ||
83 | } APSTAT1_a2; | ||
84 | |||
85 | struct { | ||
86 | u8 RSTMSK :1; | ||
87 | u8 IMSK :1; | ||
88 | u8 SMSK :1; | ||
89 | u8 RMSK :1; | ||
90 | u8 HABMSK :1; | ||
91 | u8 MAVMSK :1; | ||
92 | u8 ALDMSK :1; | ||
93 | u8 REMSK :1; | ||
94 | } APMSK1_a3; | ||
95 | |||
96 | u8 APSTAT2_a4; | ||
97 | u8 APMSK2_a5; | ||
98 | |||
99 | struct { | ||
100 | u8 HABADR :7; | ||
101 | u8 na :1; | ||
102 | } HABADR_a6; | ||
103 | |||
104 | u8 HABDATA_a7; | ||
105 | |||
106 | struct { | ||
107 | u8 HABR :1; | ||
108 | u8 LDHABR :1; | ||
109 | u8 APMSK :1; | ||
110 | u8 HMSK :1; | ||
111 | u8 LDMSK :1; | ||
112 | u8 na :3; | ||
113 | } HABSTAT_a8; | ||
114 | |||
115 | u8 MADRH_a9; | ||
116 | u8 MADRL_aa; | ||
117 | u8 MDATA_ab; | ||
118 | |||
119 | struct { | ||
120 | #define JDEC_WAIT_AT_RAM 0x7 | ||
121 | #define JDEC_EEPROM_LOAD_WAIT 0x4 | ||
122 | u8 JDEC :3; | ||
123 | u8 na :5; | ||
124 | } JDEC_ca; | ||
125 | |||
126 | struct { | ||
127 | u8 REV :4; | ||
128 | u8 LAYER :4; | ||
129 | } REVID_e0; | ||
130 | |||
131 | struct { | ||
132 | u8 unk0 :1; | ||
133 | u8 CNTCTL :1; | ||
134 | u8 BITCNT :1; | ||
135 | u8 unk1 :1; | ||
136 | u8 RESYNC :1; | ||
137 | u8 unk2 :3; | ||
138 | } BERCTL_fa; | ||
139 | |||
140 | struct { | ||
141 | u8 CSEL0 :1; | ||
142 | u8 CLKED0 :1; | ||
143 | u8 CSEL1 :1; | ||
144 | u8 CLKED1 :1; | ||
145 | u8 CLKLEV :1; | ||
146 | u8 SPIVAR :1; | ||
147 | u8 na :2; | ||
148 | } TUNSET_fc; | ||
149 | |||
150 | struct { | ||
151 | u8 CLK :1; | ||
152 | u8 DATA :1; | ||
153 | u8 CS0 :1; | ||
154 | u8 CS1 :1; | ||
155 | u8 AGCSEL :1; | ||
156 | u8 na0 :1; | ||
157 | u8 TUNSEL :1; | ||
158 | u8 na1 :1; | ||
159 | } TUNCTL_fd; | ||
160 | |||
161 | u8 TUNSEL0_fe; | ||
162 | u8 TUNSEL1_ff; | ||
163 | |||
164 | } bcm3510_register_value; | ||
165 | |||
166 | /* HAB commands */ | ||
167 | |||
168 | /* version */ | ||
169 | #define CMD_GET_VERSION_INFO 0x3D | ||
170 | #define MSGID_GET_VERSION_INFO 0x15 | ||
171 | struct bcm3510_hab_cmd_get_version_info { | ||
172 | u8 microcode_version; | ||
173 | u8 script_version; | ||
174 | u8 config_version; | ||
175 | u8 demod_version; | ||
176 | } PACKED; | ||
177 | |||
178 | #define BCM3510_DEF_MICROCODE_VERSION 0x0E | ||
179 | #define BCM3510_DEF_SCRIPT_VERSION 0x06 | ||
180 | #define BCM3510_DEF_CONFIG_VERSION 0x01 | ||
181 | #define BCM3510_DEF_DEMOD_VERSION 0xB1 | ||
182 | |||
183 | /* acquire */ | ||
184 | #define CMD_ACQUIRE 0x38 | ||
185 | |||
186 | #define MSGID_EXT_TUNER_ACQUIRE 0x0A | ||
187 | struct bcm3510_hab_cmd_ext_acquire { | ||
188 | struct { | ||
189 | u8 MODE :4; | ||
190 | u8 BW :1; | ||
191 | u8 FA :1; | ||
192 | u8 NTSCSWEEP :1; | ||
193 | u8 OFFSET :1; | ||
194 | } PACKED ACQUIRE0; /* control_byte */ | ||
195 | |||
196 | struct { | ||
197 | u8 IF_FREQ :3; | ||
198 | u8 zero0 :1; | ||
199 | u8 SYM_RATE :3; | ||
200 | u8 zero1 :1; | ||
201 | } PACKED ACQUIRE1; /* sym_if */ | ||
202 | |||
203 | u8 IF_OFFSET0; /* IF_Offset_10hz */ | ||
204 | u8 IF_OFFSET1; | ||
205 | u8 SYM_OFFSET0; /* SymbolRateOffset */ | ||
206 | u8 SYM_OFFSET1; | ||
207 | u8 NTSC_OFFSET0; /* NTSC_Offset_10hz */ | ||
208 | u8 NTSC_OFFSET1; | ||
209 | } PACKED; | ||
210 | |||
211 | #define MSGID_INT_TUNER_ACQUIRE 0x0B | ||
212 | struct bcm3510_hab_cmd_int_acquire { | ||
213 | struct { | ||
214 | u8 MODE :4; | ||
215 | u8 BW :1; | ||
216 | u8 FA :1; | ||
217 | u8 NTSCSWEEP :1; | ||
218 | u8 OFFSET :1; | ||
219 | } PACKED ACQUIRE0; /* control_byte */ | ||
220 | |||
221 | struct { | ||
222 | u8 IF_FREQ :3; | ||
223 | u8 zero0 :1; | ||
224 | u8 SYM_RATE :3; | ||
225 | u8 zero1 :1; | ||
226 | } PACKED ACQUIRE1; /* sym_if */ | ||
227 | |||
228 | u8 TUNER_FREQ0; | ||
229 | u8 TUNER_FREQ1; | ||
230 | u8 TUNER_FREQ2; | ||
231 | u8 TUNER_FREQ3; | ||
232 | u8 IF_OFFSET0; /* IF_Offset_10hz */ | ||
233 | u8 IF_OFFSET1; | ||
234 | u8 SYM_OFFSET0; /* SymbolRateOffset */ | ||
235 | u8 SYM_OFFSET1; | ||
236 | u8 NTSC_OFFSET0; /* NTSC_Offset_10hz */ | ||
237 | u8 NTSC_OFFSET1; | ||
238 | } PACKED; | ||
239 | |||
240 | /* modes */ | ||
241 | #define BCM3510_QAM16 = 0x01 | ||
242 | #define BCM3510_QAM32 = 0x02 | ||
243 | #define BCM3510_QAM64 = 0x03 | ||
244 | #define BCM3510_QAM128 = 0x04 | ||
245 | #define BCM3510_QAM256 = 0x05 | ||
246 | #define BCM3510_8VSB = 0x0B | ||
247 | #define BCM3510_16VSB = 0x0D | ||
248 | |||
249 | /* IF_FREQS */ | ||
250 | #define BCM3510_IF_TERRESTRIAL 0x0 | ||
251 | #define BCM3510_IF_CABLE 0x1 | ||
252 | #define BCM3510_IF_USE_CMD 0x7 | ||
253 | |||
254 | /* SYM_RATE */ | ||
255 | #define BCM3510_SR_8VSB 0x0 /* 5381119 s/sec */ | ||
256 | #define BCM3510_SR_256QAM 0x1 /* 5360537 s/sec */ | ||
257 | #define BCM3510_SR_16QAM 0x2 /* 5056971 s/sec */ | ||
258 | #define BCM3510_SR_MISC 0x3 /* 5000000 s/sec */ | ||
259 | #define BCM3510_SR_USE_CMD 0x7 | ||
260 | |||
261 | /* special symbol rate */ | ||
262 | #define CMD_SET_VALUE_NOT_LISTED 0x2d | ||
263 | #define MSGID_SET_SYMBOL_RATE_NOT_LISTED 0x0c | ||
264 | struct bcm3510_hab_cmd_set_sr_not_listed { | ||
265 | u8 HOST_SYM_RATE0; | ||
266 | u8 HOST_SYM_RATE1; | ||
267 | u8 HOST_SYM_RATE2; | ||
268 | u8 HOST_SYM_RATE3; | ||
269 | } PACKED; | ||
270 | |||
271 | /* special IF */ | ||
272 | #define MSGID_SET_IF_FREQ_NOT_LISTED 0x0d | ||
273 | struct bcm3510_hab_cmd_set_if_freq_not_listed { | ||
274 | u8 HOST_IF_FREQ0; | ||
275 | u8 HOST_IF_FREQ1; | ||
276 | u8 HOST_IF_FREQ2; | ||
277 | u8 HOST_IF_FREQ3; | ||
278 | } PACKED; | ||
279 | |||
280 | /* auto reacquire */ | ||
281 | #define CMD_AUTO_PARAM 0x2a | ||
282 | #define MSGID_AUTO_REACQUIRE 0x0e | ||
283 | struct bcm3510_hab_cmd_auto_reacquire { | ||
284 | u8 ACQ :1; /* on/off*/ | ||
285 | u8 unused :7; | ||
286 | } PACKED; | ||
287 | |||
288 | #define MSGID_SET_RF_AGC_SEL 0x12 | ||
289 | struct bcm3510_hab_cmd_set_agc { | ||
290 | u8 LVL :1; | ||
291 | u8 unused :6; | ||
292 | u8 SEL :1; | ||
293 | } PACKED; | ||
294 | |||
295 | #define MSGID_SET_AUTO_INVERSION 0x14 | ||
296 | struct bcm3510_hab_cmd_auto_inversion { | ||
297 | u8 AI :1; | ||
298 | u8 unused :7; | ||
299 | } PACKED; | ||
300 | |||
301 | |||
302 | /* bert control */ | ||
303 | #define CMD_STATE_CONTROL 0x12 | ||
304 | #define MSGID_BERT_CONTROL 0x0e | ||
305 | #define MSGID_BERT_SET 0xfa | ||
306 | struct bcm3510_hab_cmd_bert_control { | ||
307 | u8 BE :1; | ||
308 | u8 unused :7; | ||
309 | } PACKED; | ||
310 | |||
311 | #define MSGID_TRI_STATE 0x2e | ||
312 | struct bcm3510_hab_cmd_tri_state { | ||
313 | u8 RE :1; /* a/d ram port pins */ | ||
314 | u8 PE :1; /* baud clock pin */ | ||
315 | u8 AC :1; /* a/d clock pin */ | ||
316 | u8 BE :1; /* baud clock pin */ | ||
317 | u8 unused :4; | ||
318 | } PACKED; | ||
319 | |||
320 | |||
321 | /* tune */ | ||
322 | #define CMD_TUNE 0x38 | ||
323 | #define MSGID_TUNE 0x16 | ||
324 | struct bcm3510_hab_cmd_tune_ctrl_data_pair { | ||
325 | struct { | ||
326 | #define BITS_8 0x07 | ||
327 | #define BITS_7 0x06 | ||
328 | #define BITS_6 0x05 | ||
329 | #define BITS_5 0x04 | ||
330 | #define BITS_4 0x03 | ||
331 | #define BITS_3 0x02 | ||
332 | #define BITS_2 0x01 | ||
333 | #define BITS_1 0x00 | ||
334 | u8 size :3; | ||
335 | u8 unk :2; | ||
336 | u8 clk_off :1; | ||
337 | u8 cs0 :1; | ||
338 | u8 cs1 :1; | ||
339 | |||
340 | } PACKED ctrl; | ||
341 | |||
342 | u8 data; | ||
343 | } PACKED; | ||
344 | |||
345 | struct bcm3510_hab_cmd_tune { | ||
346 | u8 length; | ||
347 | u8 clock_width; | ||
348 | u8 misc; | ||
349 | u8 TUNCTL_state; | ||
350 | |||
351 | struct bcm3510_hab_cmd_tune_ctrl_data_pair ctl_dat[16]; | ||
352 | } PACKED; | ||
353 | |||
354 | #define CMD_STATUS 0x38 | ||
355 | #define MSGID_STATUS1 0x08 | ||
356 | struct bcm3510_hab_cmd_status1 { | ||
357 | struct { | ||
358 | u8 EQ_MODE :4; | ||
359 | u8 reserved :2; | ||
360 | u8 QRE :1; /* if QSE and the spectrum is inversed */ | ||
361 | u8 QSE :1; /* automatic spectral inversion */ | ||
362 | } PACKED STATUS0; | ||
363 | |||
364 | struct { | ||
365 | u8 RECEIVER_LOCK :1; | ||
366 | u8 FEC_LOCK :1; | ||
367 | u8 OUT_PLL_LOCK :1; | ||
368 | u8 reserved :5; | ||
369 | } PACKED STATUS1; | ||
370 | |||
371 | struct { | ||
372 | u8 reserved :2; | ||
373 | u8 BW :1; | ||
374 | u8 NTE :1; /* NTSC filter sweep enabled */ | ||
375 | u8 AQI :1; /* currently acquiring */ | ||
376 | u8 FA :1; /* fast acquisition */ | ||
377 | u8 ARI :1; /* auto reacquire */ | ||
378 | u8 TI :1; /* programming the tuner */ | ||
379 | } PACKED STATUS2; | ||
380 | u8 STATUS3; | ||
381 | u8 SNR_EST0; | ||
382 | u8 SNR_EST1; | ||
383 | u8 TUNER_FREQ0; | ||
384 | u8 TUNER_FREQ1; | ||
385 | u8 TUNER_FREQ2; | ||
386 | u8 TUNER_FREQ3; | ||
387 | u8 SYM_RATE0; | ||
388 | u8 SYM_RATE1; | ||
389 | u8 SYM_RATE2; | ||
390 | u8 SYM_RATE3; | ||
391 | u8 SYM_OFFSET0; | ||
392 | u8 SYM_OFFSET1; | ||
393 | u8 SYM_ERROR0; | ||
394 | u8 SYM_ERROR1; | ||
395 | u8 IF_FREQ0; | ||
396 | u8 IF_FREQ1; | ||
397 | u8 IF_FREQ2; | ||
398 | u8 IF_FREQ3; | ||
399 | u8 IF_OFFSET0; | ||
400 | u8 IF_OFFSET1; | ||
401 | u8 IF_ERROR0; | ||
402 | u8 IF_ERROR1; | ||
403 | u8 NTSC_FILTER0; | ||
404 | u8 NTSC_FILTER1; | ||
405 | u8 NTSC_FILTER2; | ||
406 | u8 NTSC_FILTER3; | ||
407 | u8 NTSC_OFFSET0; | ||
408 | u8 NTSC_OFFSET1; | ||
409 | u8 NTSC_ERROR0; | ||
410 | u8 NTSC_ERROR1; | ||
411 | u8 INT_AGC_LEVEL0; | ||
412 | u8 INT_AGC_LEVEL1; | ||
413 | u8 EXT_AGC_LEVEL0; | ||
414 | u8 EXT_AGC_LEVEL1; | ||
415 | } PACKED; | ||
416 | |||
417 | #define MSGID_STATUS2 0x14 | ||
418 | struct bcm3510_hab_cmd_status2 { | ||
419 | struct { | ||
420 | u8 EQ_MODE :4; | ||
421 | u8 reserved :2; | ||
422 | u8 QRE :1; | ||
423 | u8 QSR :1; | ||
424 | } PACKED STATUS0; | ||
425 | struct { | ||
426 | u8 RL :1; | ||
427 | u8 FL :1; | ||
428 | u8 OL :1; | ||
429 | u8 reserved :5; | ||
430 | } PACKED STATUS1; | ||
431 | u8 SYMBOL_RATE0; | ||
432 | u8 SYMBOL_RATE1; | ||
433 | u8 SYMBOL_RATE2; | ||
434 | u8 SYMBOL_RATE3; | ||
435 | u8 LDCERC0; | ||
436 | u8 LDCERC1; | ||
437 | u8 LDCERC2; | ||
438 | u8 LDCERC3; | ||
439 | u8 LDUERC0; | ||
440 | u8 LDUERC1; | ||
441 | u8 LDUERC2; | ||
442 | u8 LDUERC3; | ||
443 | u8 LDBER0; | ||
444 | u8 LDBER1; | ||
445 | u8 LDBER2; | ||
446 | u8 LDBER3; | ||
447 | struct { | ||
448 | u8 MODE_TYPE :4; /* acquire mode 0 */ | ||
449 | u8 reservd :4; | ||
450 | } MODE_TYPE; | ||
451 | u8 SNR_EST0; | ||
452 | u8 SNR_EST1; | ||
453 | u8 SIGNAL; | ||
454 | } PACKED; | ||
455 | |||
456 | #define CMD_SET_RF_BW_NOT_LISTED 0x3f | ||
457 | #define MSGID_SET_RF_BW_NOT_LISTED 0x11 | ||
458 | /* TODO */ | ||
459 | |||
460 | #endif | ||
diff --git a/drivers/media/dvb/frontends/dib3000-common.c b/drivers/media/dvb/frontends/dib3000-common.c index 47ab02e133d1..1a4f1f7c228a 100644 --- a/drivers/media/dvb/frontends/dib3000-common.c +++ b/drivers/media/dvb/frontends/dib3000-common.c | |||
@@ -73,7 +73,7 @@ u16 dib3000_seq[2][2][2] = /* fft,gua, inv */ | |||
73 | }; | 73 | }; |
74 | 74 | ||
75 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de"); | 75 | MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de"); |
76 | MODULE_DESCRIPTION("Common functions for the dib3000mb/dib3000mc dvb-frontend drivers"); | 76 | MODULE_DESCRIPTION("Common functions for the dib3000mb/dib3000mc dvb frontend drivers"); |
77 | MODULE_LICENSE("GPL"); | 77 | MODULE_LICENSE("GPL"); |
78 | 78 | ||
79 | EXPORT_SYMBOL(dib3000_seq); | 79 | EXPORT_SYMBOL(dib3000_seq); |
diff --git a/drivers/media/dvb/frontends/dib3000.h b/drivers/media/dvb/frontends/dib3000.h index 80687c130836..2d5475b5c063 100644 --- a/drivers/media/dvb/frontends/dib3000.h +++ b/drivers/media/dvb/frontends/dib3000.h | |||
@@ -32,9 +32,8 @@ struct dib3000_config | |||
32 | u8 demod_address; | 32 | u8 demod_address; |
33 | 33 | ||
34 | /* PLL maintenance and the i2c address of the PLL */ | 34 | /* PLL maintenance and the i2c address of the PLL */ |
35 | u8 (*pll_addr)(struct dvb_frontend *fe); | 35 | int (*pll_init)(struct dvb_frontend *fe); |
36 | int (*pll_init)(struct dvb_frontend *fe, u8 pll_buf[5]); | 36 | int (*pll_set)(struct dvb_frontend *fe, struct dvb_frontend_parameters* params); |
37 | int (*pll_set)(struct dvb_frontend *fe, struct dvb_frontend_parameters* params, u8 pll_buf[5]); | ||
38 | }; | 37 | }; |
39 | 38 | ||
40 | struct dib_fe_xfer_ops | 39 | struct dib_fe_xfer_ops |
diff --git a/drivers/media/dvb/frontends/dib3000mb.c b/drivers/media/dvb/frontends/dib3000mb.c index 6f52d649e97e..cd434b7cf9db 100644 --- a/drivers/media/dvb/frontends/dib3000mb.c +++ b/drivers/media/dvb/frontends/dib3000mb.c | |||
@@ -48,8 +48,6 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=setfe,8=getfe (|-a | |||
48 | #define deb_setf(args...) dprintk(0x04,args) | 48 | #define deb_setf(args...) dprintk(0x04,args) |
49 | #define deb_getf(args...) dprintk(0x08,args) | 49 | #define deb_getf(args...) dprintk(0x08,args) |
50 | 50 | ||
51 | static int dib3000mb_tuner_pass_ctrl(struct dvb_frontend *fe, int onoff, u8 pll_addr); | ||
52 | |||
53 | static int dib3000mb_get_frontend(struct dvb_frontend* fe, | 51 | static int dib3000mb_get_frontend(struct dvb_frontend* fe, |
54 | struct dvb_frontend_parameters *fep); | 52 | struct dvb_frontend_parameters *fep); |
55 | 53 | ||
@@ -61,10 +59,8 @@ static int dib3000mb_set_frontend(struct dvb_frontend* fe, | |||
61 | fe_code_rate_t fe_cr = FEC_NONE; | 59 | fe_code_rate_t fe_cr = FEC_NONE; |
62 | int search_state, seq; | 60 | int search_state, seq; |
63 | 61 | ||
64 | if (tuner && state->config.pll_addr && state->config.pll_set) { | 62 | if (tuner && state->config.pll_set) { |
65 | dib3000mb_tuner_pass_ctrl(fe,1,state->config.pll_addr(fe)); | 63 | state->config.pll_set(fe, fep); |
66 | state->config.pll_set(fe, fep, NULL); | ||
67 | dib3000mb_tuner_pass_ctrl(fe,0,state->config.pll_addr(fe)); | ||
68 | 64 | ||
69 | deb_setf("bandwidth: "); | 65 | deb_setf("bandwidth: "); |
70 | switch (ofdm->bandwidth) { | 66 | switch (ofdm->bandwidth) { |
@@ -389,11 +385,8 @@ static int dib3000mb_fe_init(struct dvb_frontend* fe, int mobile_mode) | |||
389 | 385 | ||
390 | wr(DIB3000MB_REG_DATA_IN_DIVERSITY, DIB3000MB_DATA_DIVERSITY_IN_OFF); | 386 | wr(DIB3000MB_REG_DATA_IN_DIVERSITY, DIB3000MB_DATA_DIVERSITY_IN_OFF); |
391 | 387 | ||
392 | if (state->config.pll_init) { | 388 | if (state->config.pll_init) |
393 | dib3000mb_tuner_pass_ctrl(fe,1,state->config.pll_addr(fe)); | 389 | state->config.pll_init(fe); |
394 | state->config.pll_init(fe,NULL); | ||
395 | dib3000mb_tuner_pass_ctrl(fe,0,state->config.pll_addr(fe)); | ||
396 | } | ||
397 | 390 | ||
398 | return 0; | 391 | return 0; |
399 | } | 392 | } |
@@ -623,7 +616,7 @@ static int dib3000mb_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) | |||
623 | { | 616 | { |
624 | struct dib3000_state* state = fe->demodulator_priv; | 617 | struct dib3000_state* state = fe->demodulator_priv; |
625 | 618 | ||
626 | *unc = rd(DIB3000MB_REG_UNC); | 619 | *unc = rd(DIB3000MB_REG_PACKET_ERROR_RATE); |
627 | return 0; | 620 | return 0; |
628 | } | 621 | } |
629 | 622 | ||
@@ -638,9 +631,6 @@ static int dib3000mb_sleep(struct dvb_frontend* fe) | |||
638 | static int dib3000mb_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) | 631 | static int dib3000mb_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) |
639 | { | 632 | { |
640 | tune->min_delay_ms = 800; | 633 | tune->min_delay_ms = 800; |
641 | tune->step_size = 166667; | ||
642 | tune->max_drift = 166667 * 2; | ||
643 | |||
644 | return 0; | 634 | return 0; |
645 | } | 635 | } |
646 | 636 | ||
diff --git a/drivers/media/dvb/frontends/dib3000mb_priv.h b/drivers/media/dvb/frontends/dib3000mb_priv.h index 57e61aa5b07b..999b19047816 100644 --- a/drivers/media/dvb/frontends/dib3000mb_priv.h +++ b/drivers/media/dvb/frontends/dib3000mb_priv.h | |||
@@ -294,7 +294,7 @@ static u16 dib3000mb_reg_filter_coeffs[] = { | |||
294 | 294 | ||
295 | static u16 dib3000mb_filter_coeffs[] = { | 295 | static u16 dib3000mb_filter_coeffs[] = { |
296 | 226, 160, 29, | 296 | 226, 160, 29, |
297 | 979, 998, 19, | 297 | 979, 998, 19, |
298 | 22, 1019, 1006, | 298 | 22, 1019, 1006, |
299 | 1022, 12, 6, | 299 | 1022, 12, 6, |
300 | 1017, 1017, 3, | 300 | 1017, 1017, 3, |
diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index 888f10a5e96b..cd33705a4320 100644 --- a/drivers/media/dvb/frontends/dib3000mc.c +++ b/drivers/media/dvb/frontends/dib3000mc.c | |||
@@ -48,8 +48,6 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=setfe,8=getfe,16=s | |||
48 | #define deb_getf(args...) dprintk(0x08,args) | 48 | #define deb_getf(args...) dprintk(0x08,args) |
49 | #define deb_stat(args...) dprintk(0x10,args) | 49 | #define deb_stat(args...) dprintk(0x10,args) |
50 | 50 | ||
51 | static int dib3000mc_tuner_pass_ctrl(struct dvb_frontend *fe, int onoff, u8 pll_addr); | ||
52 | |||
53 | static int dib3000mc_set_impulse_noise(struct dib3000_state * state, int mode, | 51 | static int dib3000mc_set_impulse_noise(struct dib3000_state * state, int mode, |
54 | fe_transmit_mode_t transmission_mode, fe_bandwidth_t bandwidth) | 52 | fe_transmit_mode_t transmission_mode, fe_bandwidth_t bandwidth) |
55 | { | 53 | { |
@@ -463,10 +461,8 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe, | |||
463 | int search_state,auto_val; | 461 | int search_state,auto_val; |
464 | u16 val; | 462 | u16 val; |
465 | 463 | ||
466 | if (tuner && state->config.pll_addr && state->config.pll_set) { /* initial call from dvb */ | 464 | if (tuner && state->config.pll_set) { /* initial call from dvb */ |
467 | dib3000mc_tuner_pass_ctrl(fe,1,state->config.pll_addr(fe)); | 465 | state->config.pll_set(fe,fep); |
468 | state->config.pll_set(fe,fep,NULL); | ||
469 | dib3000mc_tuner_pass_ctrl(fe,0,state->config.pll_addr(fe)); | ||
470 | 466 | ||
471 | state->last_tuned_freq = fep->frequency; | 467 | state->last_tuned_freq = fep->frequency; |
472 | // if (!scanboost) { | 468 | // if (!scanboost) { |
@@ -554,19 +550,15 @@ static int dib3000mc_set_frontend(struct dvb_frontend* fe, | |||
554 | dib3000mc_set_adp_cfg(state,ofdm->constellation); | 550 | dib3000mc_set_adp_cfg(state,ofdm->constellation); |
555 | wr_foreach(dib3000mc_reg_offset, | 551 | wr_foreach(dib3000mc_reg_offset, |
556 | dib3000mc_offset[(ofdm->transmission_mode == TRANSMISSION_MODE_8K)+1]); | 552 | dib3000mc_offset[(ofdm->transmission_mode == TRANSMISSION_MODE_8K)+1]); |
557 | |||
558 | |||
559 | } | 553 | } |
560 | return 0; | 554 | return 0; |
561 | } | 555 | } |
562 | 556 | ||
563 | static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode) | 557 | static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode) |
564 | { | 558 | { |
565 | struct dib3000_state *state; | 559 | struct dib3000_state *state = fe->demodulator_priv; |
566 | |||
567 | deb_info("init start\n"); | 560 | deb_info("init start\n"); |
568 | 561 | ||
569 | state = fe->demodulator_priv; | ||
570 | state->timing_offset = 0; | 562 | state->timing_offset = 0; |
571 | state->timing_offset_comp_done = 0; | 563 | state->timing_offset_comp_done = 0; |
572 | 564 | ||
@@ -649,11 +641,9 @@ static int dib3000mc_fe_init(struct dvb_frontend* fe, int mobile_mode) | |||
649 | 641 | ||
650 | set_or(DIB3000MC_REG_CLK_CFG_7,DIB3000MC_CLK_CFG_7_DIV_IN_OFF); | 642 | set_or(DIB3000MC_REG_CLK_CFG_7,DIB3000MC_CLK_CFG_7_DIV_IN_OFF); |
651 | 643 | ||
652 | /* if (state->config->pll_init) { | 644 | if (state->config.pll_init) |
653 | dib3000mc_tuner_pass_ctrl(fe,1,state->config.pll_addr(fe)); | 645 | state->config.pll_init(fe); |
654 | state->config->pll_init(fe,NULL); | 646 | |
655 | dib3000mc_tuner_pass_ctrl(fe,0,state->config.pll_addr(fe)); | ||
656 | }*/ | ||
657 | deb_info("init end\n"); | 647 | deb_info("init end\n"); |
658 | return 0; | 648 | return 0; |
659 | } | 649 | } |
@@ -688,7 +678,7 @@ static int dib3000mc_read_unc_blocks(struct dvb_frontend* fe, u32 *unc) | |||
688 | { | 678 | { |
689 | struct dib3000_state* state = fe->demodulator_priv; | 679 | struct dib3000_state* state = fe->demodulator_priv; |
690 | 680 | ||
691 | *unc = rd(DIB3000MC_REG_PACKET_ERROR_COUNT); | 681 | *unc = rd(DIB3000MC_REG_PACKET_ERRORS); |
692 | return 0; | 682 | return 0; |
693 | } | 683 | } |
694 | 684 | ||
@@ -737,10 +727,7 @@ static int dib3000mc_sleep(struct dvb_frontend* fe) | |||
737 | 727 | ||
738 | static int dib3000mc_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) | 728 | static int dib3000mc_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune) |
739 | { | 729 | { |
740 | tune->min_delay_ms = 2000; | 730 | tune->min_delay_ms = 1000; |
741 | tune->step_size = 166667; | ||
742 | tune->max_drift = 166667 * 2; | ||
743 | |||
744 | return 0; | 731 | return 0; |
745 | } | 732 | } |
746 | 733 | ||
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c index 2a3c2ce7b2aa..f73b5f48e235 100644 --- a/drivers/media/dvb/frontends/dvb-pll.c +++ b/drivers/media/dvb/frontends/dvb-pll.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: dvb-pll.c,v 1.7 2005/02/10 11:52:02 kraxel Exp $ | ||
3 | * | ||
4 | * descriptions + helper functions for simple dvb plls. | 2 | * descriptions + helper functions for simple dvb plls. |
5 | * | 3 | * |
6 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] | 4 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] |
@@ -114,6 +112,92 @@ struct dvb_pll_desc dvb_pll_unknown_1 = { | |||
114 | }; | 112 | }; |
115 | EXPORT_SYMBOL(dvb_pll_unknown_1); | 113 | EXPORT_SYMBOL(dvb_pll_unknown_1); |
116 | 114 | ||
115 | /* Infineon TUA6010XS | ||
116 | * used in Thomson Cable Tuner | ||
117 | */ | ||
118 | struct dvb_pll_desc dvb_pll_tua6010xs = { | ||
119 | .name = "Infineon TUA6010XS", | ||
120 | .min = 44250000, | ||
121 | .max = 858000000, | ||
122 | .count = 3, | ||
123 | .entries = { | ||
124 | { 115750000, 36125000, 62500, 0x8e, 0x03 }, | ||
125 | { 403250000, 36125000, 62500, 0x8e, 0x06 }, | ||
126 | { 999999999, 36125000, 62500, 0x8e, 0x85 }, | ||
127 | }, | ||
128 | }; | ||
129 | EXPORT_SYMBOL(dvb_pll_tua6010xs); | ||
130 | |||
131 | /* Panasonic env57h1xd5 (some Philips PLL ?) */ | ||
132 | struct dvb_pll_desc dvb_pll_env57h1xd5 = { | ||
133 | .name = "Panasonic ENV57H1XD5", | ||
134 | .min = 44250000, | ||
135 | .max = 858000000, | ||
136 | .count = 4, | ||
137 | .entries = { | ||
138 | { 153000000, 36291666, 166666, 0xc2, 0x41 }, | ||
139 | { 470000000, 36291666, 166666, 0xc2, 0x42 }, | ||
140 | { 526000000, 36291666, 166666, 0xc2, 0x84 }, | ||
141 | { 999999999, 36291666, 166666, 0xc2, 0xa4 }, | ||
142 | }, | ||
143 | }; | ||
144 | EXPORT_SYMBOL(dvb_pll_env57h1xd5); | ||
145 | |||
146 | /* Philips TDA6650/TDA6651 | ||
147 | * used in Panasonic ENV77H11D5 | ||
148 | */ | ||
149 | static void tda665x_bw(u8 *buf, int bandwidth) | ||
150 | { | ||
151 | if (bandwidth == BANDWIDTH_8_MHZ) | ||
152 | buf[3] |= 0x08; | ||
153 | } | ||
154 | |||
155 | struct dvb_pll_desc dvb_pll_tda665x = { | ||
156 | .name = "Philips TDA6650/TDA6651", | ||
157 | .min = 44250000, | ||
158 | .max = 858000000, | ||
159 | .setbw = tda665x_bw, | ||
160 | .count = 12, | ||
161 | .entries = { | ||
162 | { 93834000, 36249333, 166667, 0xca, 0x61 /* 011 0 0 0 01 */ }, | ||
163 | { 123834000, 36249333, 166667, 0xca, 0xa1 /* 101 0 0 0 01 */ }, | ||
164 | { 161000000, 36249333, 166667, 0xca, 0xa1 /* 101 0 0 0 01 */ }, | ||
165 | { 163834000, 36249333, 166667, 0xca, 0xc2 /* 110 0 0 0 10 */ }, | ||
166 | { 253834000, 36249333, 166667, 0xca, 0x62 /* 011 0 0 0 10 */ }, | ||
167 | { 383834000, 36249333, 166667, 0xca, 0xa2 /* 101 0 0 0 10 */ }, | ||
168 | { 443834000, 36249333, 166667, 0xca, 0xc2 /* 110 0 0 0 10 */ }, | ||
169 | { 444000000, 36249333, 166667, 0xca, 0xc3 /* 110 0 0 0 11 */ }, | ||
170 | { 583834000, 36249333, 166667, 0xca, 0x63 /* 011 0 0 0 11 */ }, | ||
171 | { 793834000, 36249333, 166667, 0xca, 0xa3 /* 101 0 0 0 11 */ }, | ||
172 | { 444834000, 36249333, 166667, 0xca, 0xc3 /* 110 0 0 0 11 */ }, | ||
173 | { 861000000, 36249333, 166667, 0xca, 0xe3 /* 111 0 0 0 11 */ }, | ||
174 | } | ||
175 | }; | ||
176 | EXPORT_SYMBOL(dvb_pll_tda665x); | ||
177 | |||
178 | /* Infineon TUA6034 | ||
179 | * used in LG TDTP E102P | ||
180 | */ | ||
181 | static void tua6034_bw(u8 *buf, int bandwidth) | ||
182 | { | ||
183 | if (BANDWIDTH_7_MHZ != bandwidth) | ||
184 | buf[3] |= 0x08; | ||
185 | } | ||
186 | |||
187 | struct dvb_pll_desc dvb_pll_tua6034 = { | ||
188 | .name = "Infineon TUA6034", | ||
189 | .min = 44250000, | ||
190 | .max = 858000000, | ||
191 | .count = 3, | ||
192 | .setbw = tua6034_bw, | ||
193 | .entries = { | ||
194 | { 174500000, 36166667, 62500, 0xce, 0x01 }, | ||
195 | { 230000000, 36166667, 62500, 0xce, 0x02 }, | ||
196 | { 999999999, 36166667, 62500, 0xce, 0x04 }, | ||
197 | }, | ||
198 | }; | ||
199 | EXPORT_SYMBOL(dvb_pll_tua6034); | ||
200 | |||
117 | /* ----------------------------------------------------------- */ | 201 | /* ----------------------------------------------------------- */ |
118 | /* code */ | 202 | /* code */ |
119 | 203 | ||
@@ -160,9 +244,3 @@ EXPORT_SYMBOL(dvb_pll_configure); | |||
160 | MODULE_DESCRIPTION("dvb pll library"); | 244 | MODULE_DESCRIPTION("dvb pll library"); |
161 | MODULE_AUTHOR("Gerd Knorr"); | 245 | MODULE_AUTHOR("Gerd Knorr"); |
162 | MODULE_LICENSE("GPL"); | 246 | MODULE_LICENSE("GPL"); |
163 | |||
164 | /* | ||
165 | * Local variables: | ||
166 | * c-basic-offset: 8 | ||
167 | * End: | ||
168 | */ | ||
diff --git a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h index c4c3c56c4a81..b796778624b6 100644 --- a/drivers/media/dvb/frontends/dvb-pll.h +++ b/drivers/media/dvb/frontends/dvb-pll.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: dvb-pll.h,v 1.2 2005/02/10 11:43:41 kraxel Exp $ | 2 | * descriptions + helper functions for simple dvb plls. |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #ifndef __DVB_PLL_H__ | 5 | #ifndef __DVB_PLL_H__ |
@@ -17,7 +17,7 @@ struct dvb_pll_desc { | |||
17 | u32 stepsize; | 17 | u32 stepsize; |
18 | u8 cb1; | 18 | u8 cb1; |
19 | u8 cb2; | 19 | u8 cb2; |
20 | } entries[9]; | 20 | } entries[12]; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | extern struct dvb_pll_desc dvb_pll_thomson_dtt7579; | 23 | extern struct dvb_pll_desc dvb_pll_thomson_dtt7579; |
@@ -26,6 +26,11 @@ extern struct dvb_pll_desc dvb_pll_thomson_dtt7610; | |||
26 | extern struct dvb_pll_desc dvb_pll_lg_z201; | 26 | extern struct dvb_pll_desc dvb_pll_lg_z201; |
27 | extern struct dvb_pll_desc dvb_pll_unknown_1; | 27 | extern struct dvb_pll_desc dvb_pll_unknown_1; |
28 | 28 | ||
29 | extern struct dvb_pll_desc dvb_pll_tua6010xs; | ||
30 | extern struct dvb_pll_desc dvb_pll_env57h1xd5; | ||
31 | extern struct dvb_pll_desc dvb_pll_tua6034; | ||
32 | extern struct dvb_pll_desc dvb_pll_tda665x; | ||
33 | |||
29 | int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, | 34 | int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, |
30 | u32 freq, int bandwidth); | 35 | u32 freq, int bandwidth); |
31 | 36 | ||
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 6c05fddb69ab..f9383e7f34ff 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -7,6 +7,19 @@ menu "Video For Linux" | |||
7 | 7 | ||
8 | comment "Video Adapters" | 8 | comment "Video Adapters" |
9 | 9 | ||
10 | config CONFIG_TUNER_MULTI_I2C | ||
11 | bool "Enable support for multiple I2C devices on Video Adapters (EXPERIMENTAL)" | ||
12 | depends on VIDEO_DEV && EXPERIMENTAL | ||
13 | ---help--- | ||
14 | Some video adapters have more than one tuner inside. This patch | ||
15 | enables support for using more than one tuner. This is required | ||
16 | for some cards to allow tunning both video and radio. | ||
17 | It also improves I2C autodetection for these cards. | ||
18 | |||
19 | Only few tuners currently is supporting this. More to come. | ||
20 | |||
21 | It is safe to say 'Y' here even if your card has only one I2C tuner. | ||
22 | |||
10 | config VIDEO_BT848 | 23 | config VIDEO_BT848 |
11 | tristate "BT848 Video For Linux" | 24 | tristate "BT848 Video For Linux" |
12 | depends on VIDEO_DEV && PCI && I2C | 25 | depends on VIDEO_DEV && PCI && I2C |
@@ -330,6 +343,7 @@ config VIDEO_CX88_DVB | |||
330 | select VIDEO_BUF_DVB | 343 | select VIDEO_BUF_DVB |
331 | select DVB_MT352 | 344 | select DVB_MT352 |
332 | select DVB_OR51132 | 345 | select DVB_OR51132 |
346 | select DVB_CX22702 | ||
333 | ---help--- | 347 | ---help--- |
334 | This adds support for DVB/ATSC cards based on the | 348 | This adds support for DVB/ATSC cards based on the |
335 | Connexant 2388x chip. | 349 | Connexant 2388x chip. |
diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c index 07f72f64c5f7..9a642c7de545 100644 --- a/drivers/media/video/bt832.c +++ b/drivers/media/video/bt832.c | |||
@@ -6,7 +6,7 @@ | |||
6 | It outputs an 8-bit 4:2:2 YUV or YCrCb video signal which can be directly | 6 | It outputs an 8-bit 4:2:2 YUV or YCrCb video signal which can be directly |
7 | connected to bt848/bt878 GPIO pins on this purpose. | 7 | connected to bt848/bt878 GPIO pins on this purpose. |
8 | (see: VLSI Vision Ltd. www.vvl.co.uk for camera datasheets) | 8 | (see: VLSI Vision Ltd. www.vvl.co.uk for camera datasheets) |
9 | 9 | ||
10 | Supported Cards: | 10 | Supported Cards: |
11 | - Pixelview Rev.4E: 0x8a | 11 | - Pixelview Rev.4E: 0x8a |
12 | GPIO 0x400000 toggles Bt832 RESET, and the chip changes to i2c 0x88 ! | 12 | GPIO 0x400000 toggles Bt832 RESET, and the chip changes to i2c 0x88 ! |
@@ -31,8 +31,8 @@ | |||
31 | #include <linux/errno.h> | 31 | #include <linux/errno.h> |
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | 33 | ||
34 | #include "id.h" | 34 | #include <media/audiochip.h> |
35 | #include "audiochip.h" | 35 | #include <media/id.h> |
36 | #include "bttv.h" | 36 | #include "bttv.h" |
37 | #include "bt832.h" | 37 | #include "bt832.h" |
38 | 38 | ||
@@ -95,7 +95,7 @@ int bt832_init(struct i2c_client *i2c_client_s) | |||
95 | 95 | ||
96 | buf=kmalloc(65,GFP_KERNEL); | 96 | buf=kmalloc(65,GFP_KERNEL); |
97 | bt832_hexdump(i2c_client_s,buf); | 97 | bt832_hexdump(i2c_client_s,buf); |
98 | 98 | ||
99 | if(buf[0x40] != 0x31) { | 99 | if(buf[0x40] != 0x31) { |
100 | printk("bt832: this i2c chip is no bt832 (id=%02x). Detaching.\n",buf[0x40]); | 100 | printk("bt832: this i2c chip is no bt832 (id=%02x). Detaching.\n",buf[0x40]); |
101 | kfree(buf); | 101 | kfree(buf); |
@@ -135,7 +135,7 @@ int bt832_init(struct i2c_client *i2c_client_s) | |||
135 | buf[1]= 0x27 & (~0x01); // Default | !skip | 135 | buf[1]= 0x27 & (~0x01); // Default | !skip |
136 | if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) | 136 | if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) |
137 | printk("bt832: i2c i/o error EO: rc == %d (should be 2)\n",rc); | 137 | printk("bt832: i2c i/o error EO: rc == %d (should be 2)\n",rc); |
138 | 138 | ||
139 | bt832_hexdump(i2c_client_s,buf); | 139 | bt832_hexdump(i2c_client_s,buf); |
140 | 140 | ||
141 | #if 0 | 141 | #if 0 |
@@ -168,8 +168,7 @@ int bt832_init(struct i2c_client *i2c_client_s) | |||
168 | 168 | ||
169 | 169 | ||
170 | 170 | ||
171 | static int bt832_attach(struct i2c_adapter *adap, int addr, | 171 | static int bt832_attach(struct i2c_adapter *adap, int addr, int kind) |
172 | unsigned short flags, int kind) | ||
173 | { | 172 | { |
174 | struct bt832 *t; | 173 | struct bt832 *t; |
175 | 174 | ||
@@ -184,27 +183,32 @@ static int bt832_attach(struct i2c_adapter *adap, int addr, | |||
184 | return -ENOMEM; | 183 | return -ENOMEM; |
185 | memset(t,0,sizeof(*t)); | 184 | memset(t,0,sizeof(*t)); |
186 | t->client = client_template; | 185 | t->client = client_template; |
187 | t->client.data = t; | 186 | i2c_set_clientdata(&t->client, t); |
188 | i2c_attach_client(&t->client); | 187 | i2c_attach_client(&t->client); |
189 | 188 | ||
190 | if(! bt832_init(&t->client)) { | 189 | if(! bt832_init(&t->client)) { |
191 | bt832_detach(&t->client); | 190 | bt832_detach(&t->client); |
192 | return -1; | 191 | return -1; |
193 | } | 192 | } |
194 | 193 | ||
195 | return 0; | 194 | return 0; |
196 | } | 195 | } |
197 | 196 | ||
198 | static int bt832_probe(struct i2c_adapter *adap) | 197 | static int bt832_probe(struct i2c_adapter *adap) |
199 | { | 198 | { |
199 | #ifdef I2C_CLASS_TV_ANALOG | ||
200 | if (adap->class & I2C_CLASS_TV_ANALOG) | 200 | if (adap->class & I2C_CLASS_TV_ANALOG) |
201 | return i2c_probe(adap, &addr_data, bt832_attach); | 201 | return i2c_probe(adap, &addr_data, bt832_attach); |
202 | #else | ||
203 | if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_BT848)) | ||
204 | return i2c_probe(adap, &addr_data, bt832_attach); | ||
205 | #endif | ||
202 | return 0; | 206 | return 0; |
203 | } | 207 | } |
204 | 208 | ||
205 | static int bt832_detach(struct i2c_client *client) | 209 | static int bt832_detach(struct i2c_client *client) |
206 | { | 210 | { |
207 | struct bt832 *t = (struct bt832*)client->data; | 211 | struct bt832 *t = i2c_get_clientdata(client); |
208 | 212 | ||
209 | printk("bt832: detach.\n"); | 213 | printk("bt832: detach.\n"); |
210 | i2c_detach_client(client); | 214 | i2c_detach_client(client); |
@@ -215,7 +219,7 @@ static int bt832_detach(struct i2c_client *client) | |||
215 | static int | 219 | static int |
216 | bt832_command(struct i2c_client *client, unsigned int cmd, void *arg) | 220 | bt832_command(struct i2c_client *client, unsigned int cmd, void *arg) |
217 | { | 221 | { |
218 | struct bt832 *t = (struct bt832*)client->data; | 222 | struct bt832 *t = i2c_get_clientdata(client); |
219 | 223 | ||
220 | printk("bt832: command %x\n",cmd); | 224 | printk("bt832: command %x\n",cmd); |
221 | 225 | ||
@@ -249,19 +253,18 @@ static struct i2c_driver driver = { | |||
249 | }; | 253 | }; |
250 | static struct i2c_client client_template = | 254 | static struct i2c_client client_template = |
251 | { | 255 | { |
252 | .name = "bt832", | 256 | I2C_DEVNAME("bt832"), |
253 | .flags = I2C_CLIENT_ALLOW_USE, | 257 | .flags = I2C_CLIENT_ALLOW_USE, |
254 | .driver = &driver, | 258 | .driver = &driver, |
255 | }; | 259 | }; |
256 | 260 | ||
257 | 261 | ||
258 | int bt832_init_module(void) | 262 | static int __init bt832_init_module(void) |
259 | { | 263 | { |
260 | i2c_add_driver(&driver); | 264 | return i2c_add_driver(&driver); |
261 | return 0; | ||
262 | } | 265 | } |
263 | 266 | ||
264 | static void bt832_cleanup_module(void) | 267 | static void __exit bt832_cleanup_module(void) |
265 | { | 268 | { |
266 | i2c_del_driver(&driver); | 269 | i2c_del_driver(&driver); |
267 | } | 270 | } |
@@ -269,3 +272,10 @@ static void bt832_cleanup_module(void) | |||
269 | module_init(bt832_init_module); | 272 | module_init(bt832_init_module); |
270 | module_exit(bt832_cleanup_module); | 273 | module_exit(bt832_cleanup_module); |
271 | 274 | ||
275 | /* | ||
276 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
277 | * --------------------------------------------------------------------------- | ||
278 | * Local variables: | ||
279 | * c-basic-offset: 8 | ||
280 | * End: | ||
281 | */ | ||
diff --git a/drivers/media/video/bt832.h b/drivers/media/video/bt832.h index 7a98c06e0e34..9b6a8d2c96b5 100644 --- a/drivers/media/video/bt832.h +++ b/drivers/media/video/bt832.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Bt832 CMOS Camera Video Processor (VP) | 1 | /* Bt832 CMOS Camera Video Processor (VP) |
2 | 2 | ||
3 | The Bt832 CMOS Camera Video Processor chip connects a Quartsight CMOS | 3 | The Bt832 CMOS Camera Video Processor chip connects a Quartsight CMOS |
4 | color digital camera directly to video capture devices via an 8-bit, | 4 | color digital camera directly to video capture devices via an 8-bit, |
5 | 4:2:2 YUV or YCrCb video interface. | 5 | 4:2:2 YUV or YCrCb video interface. |
6 | 6 | ||
@@ -85,7 +85,7 @@ | |||
85 | #define BT832_DEVICE_ID 63 | 85 | #define BT832_DEVICE_ID 63 |
86 | # define BT832_DEVICE_ID__31 0x31 // Bt832 has ID 0x31 | 86 | # define BT832_DEVICE_ID__31 0x31 // Bt832 has ID 0x31 |
87 | 87 | ||
88 | /* STMicroelectronivcs VV5404 camera module | 88 | /* STMicroelectronivcs VV5404 camera module |
89 | i2c: 0x20: sensor address | 89 | i2c: 0x20: sensor address |
90 | i2c: 0xa0: eeprom for ccd defect map | 90 | i2c: 0xa0: eeprom for ccd defect map |
91 | */ | 91 | */ |
@@ -256,26 +256,26 @@ For the CCIR-601 standards, the sampling is based on a static orthogonal samplin | |||
256 | //=========================================================================== | 256 | //=========================================================================== |
257 | // Timing generator SRAM table values for CCIR601 720x480 NTSC | 257 | // Timing generator SRAM table values for CCIR601 720x480 NTSC |
258 | //=========================================================================== | 258 | //=========================================================================== |
259 | // For NTSC CCIR656 | 259 | // For NTSC CCIR656 |
260 | BYTE BtCard::SRAMTable_NTSC[] = | 260 | BYTE BtCard::SRAMTable_NTSC[] = |
261 | { | 261 | { |
262 | // SRAM Timing Table for NTSC | 262 | // SRAM Timing Table for NTSC |
263 | 0x0c, 0xc0, 0x00, | 263 | 0x0c, 0xc0, 0x00, |
264 | 0x00, 0x90, 0xc2, | 264 | 0x00, 0x90, 0xc2, |
265 | 0x03, 0x10, 0x03, | 265 | 0x03, 0x10, 0x03, |
266 | 0x06, 0x10, 0x34, | 266 | 0x06, 0x10, 0x34, |
267 | 0x12, 0x12, 0x65, | 267 | 0x12, 0x12, 0x65, |
268 | 0x02, 0x13, 0x24, | 268 | 0x02, 0x13, 0x24, |
269 | 0x19, 0x00, 0x24, | 269 | 0x19, 0x00, 0x24, |
270 | 0x39, 0x00, 0x96, | 270 | 0x39, 0x00, 0x96, |
271 | 0x59, 0x08, 0x93, | 271 | 0x59, 0x08, 0x93, |
272 | 0x83, 0x08, 0x97, | 272 | 0x83, 0x08, 0x97, |
273 | 0x03, 0x50, 0x30, | 273 | 0x03, 0x50, 0x30, |
274 | 0xc0, 0x40, 0x30, | 274 | 0xc0, 0x40, 0x30, |
275 | 0x86, 0x01, 0x01, | 275 | 0x86, 0x01, 0x01, |
276 | 0xa6, 0x0d, 0x62, | 276 | 0xa6, 0x0d, 0x62, |
277 | 0x03, 0x11, 0x61, | 277 | 0x03, 0x11, 0x61, |
278 | 0x05, 0x37, 0x30, | 278 | 0x05, 0x37, 0x30, |
279 | 0xac, 0x21, 0x50 | 279 | 0xac, 0x21, 0x50 |
280 | }; | 280 | }; |
281 | 281 | ||
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 6334122704ae..251092e7f19f 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-cards.c,v 1.47 2005/02/22 14:06:32 kraxel Exp $ | 2 | $Id: bttv-cards.c,v 1.49 2005/06/10 17:20:24 mchehab Exp $ |
3 | 3 | ||
4 | bttv-cards.c | 4 | bttv-cards.c |
5 | 5 | ||
@@ -51,6 +51,7 @@ static void avermedia_eeprom(struct bttv *btv); | |||
51 | static void osprey_eeprom(struct bttv *btv); | 51 | static void osprey_eeprom(struct bttv *btv); |
52 | static void modtec_eeprom(struct bttv *btv); | 52 | static void modtec_eeprom(struct bttv *btv); |
53 | static void init_PXC200(struct bttv *btv); | 53 | static void init_PXC200(struct bttv *btv); |
54 | static void init_RTV24(struct bttv *btv); | ||
54 | 55 | ||
55 | static void winview_audio(struct bttv *btv, struct video_audio *v, int set); | 56 | static void winview_audio(struct bttv *btv, struct video_audio *v, int set); |
56 | static void lt9415_audio(struct bttv *btv, struct video_audio *v, int set); | 57 | static void lt9415_audio(struct bttv *btv, struct video_audio *v, int set); |
@@ -2251,6 +2252,20 @@ struct tvcard bttv_tvcards[] = { | |||
2251 | .no_tda7432 = 1, | 2252 | .no_tda7432 = 1, |
2252 | .no_tda9875 = 1, | 2253 | .no_tda9875 = 1, |
2253 | .muxsel_hook = kodicom4400r_muxsel, | 2254 | .muxsel_hook = kodicom4400r_muxsel, |
2255 | }, | ||
2256 | { | ||
2257 | /* ---- card 0x85---------------------------------- */ | ||
2258 | /* Michael Henson <mhenson@clarityvi.com> */ | ||
2259 | /* Adlink RTV24 with special unlock codes */ | ||
2260 | .name = "Adlink RTV24", | ||
2261 | .video_inputs = 4, | ||
2262 | .audio_inputs = 1, | ||
2263 | .tuner = 0, | ||
2264 | .svhs = 2, | ||
2265 | .muxsel = { 2, 3, 1, 0}, | ||
2266 | .tuner_type = -1, | ||
2267 | .pll = PLL_28, | ||
2268 | |||
2254 | }}; | 2269 | }}; |
2255 | 2270 | ||
2256 | static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); | 2271 | static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); |
@@ -2636,6 +2651,10 @@ void __devinit bttv_init_card1(struct bttv *btv) | |||
2636 | case BTTV_AVDVBT_771: | 2651 | case BTTV_AVDVBT_771: |
2637 | btv->use_i2c_hw = 1; | 2652 | btv->use_i2c_hw = 1; |
2638 | break; | 2653 | break; |
2654 | case BTTV_ADLINK_RTV24: | ||
2655 | init_RTV24( btv ); | ||
2656 | break; | ||
2657 | |||
2639 | } | 2658 | } |
2640 | if (!bttv_tvcards[btv->c.type].has_dvb) | 2659 | if (!bttv_tvcards[btv->c.type].has_dvb) |
2641 | bttv_reset_audio(btv); | 2660 | bttv_reset_audio(btv); |
@@ -2784,6 +2803,8 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
2784 | } | 2803 | } |
2785 | btv->pll.pll_current = -1; | 2804 | btv->pll.pll_current = -1; |
2786 | 2805 | ||
2806 | bttv_reset_audio(btv); | ||
2807 | |||
2787 | /* tuner configuration (from card list / autodetect / insmod option) */ | 2808 | /* tuner configuration (from card list / autodetect / insmod option) */ |
2788 | if (UNSET != bttv_tvcards[btv->c.type].tuner_type) | 2809 | if (UNSET != bttv_tvcards[btv->c.type].tuner_type) |
2789 | if(UNSET == btv->tuner_type) | 2810 | if(UNSET == btv->tuner_type) |
@@ -3304,6 +3325,83 @@ static void __devinit init_PXC200(struct bttv *btv) | |||
3304 | } | 3325 | } |
3305 | 3326 | ||
3306 | 3327 | ||
3328 | |||
3329 | /* ----------------------------------------------------------------------- */ | ||
3330 | /* | ||
3331 | * The Adlink RTV-24 (aka Angelo) has some special initialisation to unlock | ||
3332 | * it. This apparently involves the following procedure for each 878 chip: | ||
3333 | * | ||
3334 | * 1) write 0x00C3FEFF to the GPIO_OUT_EN register | ||
3335 | * | ||
3336 | * 2) write to GPIO_DATA | ||
3337 | * - 0x0E | ||
3338 | * - sleep 1ms | ||
3339 | * - 0x10 + 0x0E | ||
3340 | * - sleep 10ms | ||
3341 | * - 0x0E | ||
3342 | * read from GPIO_DATA into buf (uint_32) | ||
3343 | * - if ( data>>18 & 0x01 != 0) || ( buf>>19 & 0x01 != 1 ) | ||
3344 | * error. ERROR_CPLD_Check_Failed stop. | ||
3345 | * | ||
3346 | * 3) write to GPIO_DATA | ||
3347 | * - write 0x4400 + 0x0E | ||
3348 | * - sleep 10ms | ||
3349 | * - write 0x4410 + 0x0E | ||
3350 | * - sleep 1ms | ||
3351 | * - write 0x0E | ||
3352 | * read from GPIO_DATA into buf (uint_32) | ||
3353 | * - if ( buf>>18 & 0x01 ) || ( buf>>19 && 0x01 != 0 ) | ||
3354 | * error. ERROR_CPLD_Check_Failed. | ||
3355 | */ | ||
3356 | /* ----------------------------------------------------------------------- */ | ||
3357 | void | ||
3358 | init_RTV24 (struct bttv *btv) | ||
3359 | { | ||
3360 | uint32_t dataRead = 0; | ||
3361 | long watchdog_value = 0x0E; | ||
3362 | |||
3363 | printk (KERN_INFO | ||
3364 | "bttv%d: Adlink RTV-24 initialisation in progress ...\n", | ||
3365 | btv->c.nr); | ||
3366 | |||
3367 | btwrite (0x00c3feff, BT848_GPIO_OUT_EN); | ||
3368 | |||
3369 | btwrite (0 + watchdog_value, BT848_GPIO_DATA); | ||
3370 | msleep (1); | ||
3371 | btwrite (0x10 + watchdog_value, BT848_GPIO_DATA); | ||
3372 | msleep (10); | ||
3373 | btwrite (0 + watchdog_value, BT848_GPIO_DATA); | ||
3374 | |||
3375 | dataRead = btread (BT848_GPIO_DATA); | ||
3376 | |||
3377 | if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 1)) { | ||
3378 | printk (KERN_INFO | ||
3379 | "bttv%d: Adlink RTV-24 initialisation(1) ERROR_CPLD_Check_Failed (read %d)\n", | ||
3380 | btv->c.nr, dataRead); | ||
3381 | } | ||
3382 | |||
3383 | btwrite (0x4400 + watchdog_value, BT848_GPIO_DATA); | ||
3384 | msleep (10); | ||
3385 | btwrite (0x4410 + watchdog_value, BT848_GPIO_DATA); | ||
3386 | msleep (1); | ||
3387 | btwrite (watchdog_value, BT848_GPIO_DATA); | ||
3388 | msleep (1); | ||
3389 | dataRead = btread (BT848_GPIO_DATA); | ||
3390 | |||
3391 | if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 0)) { | ||
3392 | printk (KERN_INFO | ||
3393 | "bttv%d: Adlink RTV-24 initialisation(2) ERROR_CPLD_Check_Failed (read %d)\n", | ||
3394 | btv->c.nr, dataRead); | ||
3395 | |||
3396 | return; | ||
3397 | } | ||
3398 | |||
3399 | printk (KERN_INFO | ||
3400 | "bttv%d: Adlink RTV-24 initialisation complete.\n", btv->c.nr); | ||
3401 | } | ||
3402 | |||
3403 | |||
3404 | |||
3307 | /* ----------------------------------------------------------------------- */ | 3405 | /* ----------------------------------------------------------------------- */ |
3308 | /* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */ | 3406 | /* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */ |
3309 | /* | 3407 | /* |
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index 033cc5498f23..290289a99757 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-driver.c,v 1.37 2005/02/21 13:57:59 kraxel Exp $ | 2 | $Id: bttv-driver.c,v 1.38 2005/06/10 17:20:24 mchehab Exp $ |
3 | 3 | ||
4 | bttv - Bt848 frame grabber driver | 4 | bttv - Bt848 frame grabber driver |
5 | 5 | ||
diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c index c2368bc832ed..da448a5f9e9c 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bttv-i2c.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-i2c.c,v 1.18 2005/02/16 12:14:10 kraxel Exp $ | 2 | $Id: bttv-i2c.c,v 1.21 2005/06/10 17:20:24 mchehab Exp $ |
3 | 3 | ||
4 | bttv-i2c.c -- all the i2c code is here | 4 | bttv-i2c.c -- all the i2c code is here |
5 | 5 | ||
diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h index 8322b66e0905..191eaf1714ba 100644 --- a/drivers/media/video/bttv.h +++ b/drivers/media/video/bttv.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: bttv.h,v 1.17 2005/02/22 14:06:32 kraxel Exp $ | 2 | * $Id: bttv.h,v 1.18 2005/05/24 23:41:42 nsh Exp $ |
3 | * | 3 | * |
4 | * bttv - Bt848 frame grabber driver | 4 | * bttv - Bt848 frame grabber driver |
5 | * | 5 | * |
@@ -135,6 +135,7 @@ | |||
135 | #define BTTV_DVICO_DVBT_LITE 0x80 | 135 | #define BTTV_DVICO_DVBT_LITE 0x80 |
136 | #define BTTV_TIBET_CS16 0x83 | 136 | #define BTTV_TIBET_CS16 0x83 |
137 | #define BTTV_KODICOM_4400R 0x84 | 137 | #define BTTV_KODICOM_4400R 0x84 |
138 | #define BTTV_ADLINK_RTV24 0x85 | ||
138 | 139 | ||
139 | /* i2c address list */ | 140 | /* i2c address list */ |
140 | #define I2C_TSA5522 0xc2 | 141 | #define I2C_TSA5522 0xc2 |
diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bttvp.h index 1a9ba7e1cf51..7b6f1e856028 100644 --- a/drivers/media/video/bttvp.h +++ b/drivers/media/video/bttvp.h | |||
@@ -226,10 +226,6 @@ extern int fini_bttv_i2c(struct bttv *btv); | |||
226 | #define dprintk if (bttv_debug >= 1) printk | 226 | #define dprintk if (bttv_debug >= 1) printk |
227 | #define d2printk if (bttv_debug >= 2) printk | 227 | #define d2printk if (bttv_debug >= 2) printk |
228 | 228 | ||
229 | /* our devices */ | ||
230 | #define BTTV_MAX 16 | ||
231 | extern unsigned int bttv_num; | ||
232 | |||
233 | #define BTTV_MAX_FBUF 0x208000 | 229 | #define BTTV_MAX_FBUF 0x208000 |
234 | #define VBIBUF_SIZE (2048*VBI_MAXLINES*2) | 230 | #define VBIBUF_SIZE (2048*VBI_MAXLINES*2) |
235 | #define BTTV_TIMEOUT (HZ/2) /* 0.5 seconds */ | 231 | #define BTTV_TIMEOUT (HZ/2) /* 0.5 seconds */ |
@@ -375,6 +371,10 @@ struct bttv { | |||
375 | unsigned int users; | 371 | unsigned int users; |
376 | struct bttv_fh init; | 372 | struct bttv_fh init; |
377 | }; | 373 | }; |
374 | |||
375 | /* our devices */ | ||
376 | #define BTTV_MAX 16 | ||
377 | extern unsigned int bttv_num; | ||
378 | extern struct bttv bttvs[BTTV_MAX]; | 378 | extern struct bttv bttvs[BTTV_MAX]; |
379 | 379 | ||
380 | /* private ioctls */ | 380 | /* private ioctls */ |
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 46d6778b863b..91f8afeded88 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-blackbird.c,v 1.26 2005/03/07 15:58:05 kraxel Exp $ | 2 | * $Id: cx88-blackbird.c,v 1.27 2005/06/03 13:31:50 mchehab Exp $ |
3 | * | 3 | * |
4 | * Support for a cx23416 mpeg encoder via cx2388x host port. | 4 | * Support for a cx23416 mpeg encoder via cx2388x host port. |
5 | * "blackbird" reference design. | 5 | * "blackbird" reference design. |
@@ -61,37 +61,304 @@ static LIST_HEAD(cx8802_devlist); | |||
61 | 61 | ||
62 | #define IVTV_CMD_HW_BLOCKS_RST 0xFFFFFFFF | 62 | #define IVTV_CMD_HW_BLOCKS_RST 0xFFFFFFFF |
63 | 63 | ||
64 | /*Firmware API commands*/ | 64 | /* Firmware API commands */ |
65 | #define IVTV_API_ENC_PING_FW 0x00000080 | 65 | /* #define IVTV_API_STD_TIMEOUT 0x00010000 // 65536, units?? */ |
66 | #define IVTV_API_ENC_GETVER 0x000000C4 | 66 | #define IVTV_API_STD_TIMEOUT 500 |
67 | #define IVTV_API_ENC_HALT_FW 0x000000C3 | 67 | |
68 | #define IVTV_API_STD_TIMEOUT 0x00010000 /*units??*/ | 68 | #define BLACKBIRD_API_PING 0x80 |
69 | //#define IVTV_API_ASSIGN_PGM_INDEX_INFO 0x000000c7 | 69 | #define BLACKBIRD_API_BEGIN_CAPTURE 0x81 |
70 | #define IVTV_API_ASSIGN_STREAM_TYPE 0x000000b9 | 70 | enum blackbird_capture_type { |
71 | #define IVTV_API_ASSIGN_OUTPUT_PORT 0x000000bb | 71 | BLACKBIRD_MPEG_CAPTURE, |
72 | #define IVTV_API_ASSIGN_FRAMERATE 0x0000008f | 72 | BLACKBIRD_RAW_CAPTURE, |
73 | #define IVTV_API_ASSIGN_FRAME_SIZE 0x00000091 | 73 | BLACKBIRD_RAW_PASSTHRU_CAPTURE |
74 | #define IVTV_API_ASSIGN_ASPECT_RATIO 0x00000099 | 74 | }; |
75 | #define IVTV_API_ASSIGN_BITRATES 0x00000095 | 75 | enum blackbird_capture_bits { |
76 | #define IVTV_API_ASSIGN_GOP_PROPERTIES 0x00000097 | 76 | BLACKBIRD_RAW_BITS_NONE = 0x00, |
77 | #define IVTV_API_ASSIGN_3_2_PULLDOWN 0x000000b1 | 77 | BLACKBIRD_RAW_BITS_YUV_CAPTURE = 0x01, |
78 | #define IVTV_API_ASSIGN_GOP_CLOSURE 0x000000c5 | 78 | BLACKBIRD_RAW_BITS_PCM_CAPTURE = 0x02, |
79 | #define IVTV_API_ASSIGN_AUDIO_PROPERTIES 0x000000bd | 79 | BLACKBIRD_RAW_BITS_VBI_CAPTURE = 0x04, |
80 | #define IVTV_API_ASSIGN_DNR_FILTER_MODE 0x0000009b | 80 | BLACKBIRD_RAW_BITS_PASSTHRU_CAPTURE = 0x08, |
81 | #define IVTV_API_ASSIGN_DNR_FILTER_PROPS 0x0000009d | 81 | BLACKBIRD_RAW_BITS_TO_HOST_CAPTURE = 0x10 |
82 | #define IVTV_API_ASSIGN_CORING_LEVELS 0x0000009f | 82 | }; |
83 | #define IVTV_API_ASSIGN_SPATIAL_FILTER_TYPE 0x000000a1 | 83 | #define BLACKBIRD_API_END_CAPTURE 0x82 |
84 | #define IVTV_API_ASSIGN_FRAME_DROP_RATE 0x000000d0 | 84 | enum blackbird_capture_end { |
85 | #define IVTV_API_ASSIGN_PLACEHOLDER 0x000000d8 | 85 | BLACKBIRD_END_AT_GOP, /* stop at the end of gop, generate irq */ |
86 | #define IVTV_API_MUTE_VIDEO 0x000000d9 | 86 | BLACKBIRD_END_NOW, /* stop immediately, no irq */ |
87 | #define IVTV_API_MUTE_AUDIO 0x000000da | 87 | }; |
88 | #define IVTV_API_INITIALIZE_INPUT 0x000000cd | 88 | #define BLACKBIRD_API_SET_AUDIO_ID 0x89 |
89 | #define IVTV_API_REFRESH_INPUT 0x000000d3 | 89 | #define BLACKBIRD_API_SET_VIDEO_ID 0x8B |
90 | #define IVTV_API_ASSIGN_NUM_VSYNC_LINES 0x000000d6 | 90 | #define BLACKBIRD_API_SET_PCR_ID 0x8D |
91 | #define IVTV_API_BEGIN_CAPTURE 0x00000081 | 91 | #define BLACKBIRD_API_SET_FRAMERATE 0x8F |
92 | //#define IVTV_API_PAUSE_ENCODER 0x000000d2 | 92 | enum blackbird_framerate { |
93 | //#define IVTV_API_EVENT_NOTIFICATION 0x000000d5 | 93 | BLACKBIRD_FRAMERATE_NTSC_30, /* NTSC: 30fps */ |
94 | #define IVTV_API_END_CAPTURE 0x00000082 | 94 | BLACKBIRD_FRAMERATE_PAL_25 /* PAL: 25fps */ |
95 | }; | ||
96 | #define BLACKBIRD_API_SET_RESOLUTION 0x91 | ||
97 | #define BLACKBIRD_API_SET_VIDEO_BITRATE 0x95 | ||
98 | enum blackbird_video_bitrate_type { | ||
99 | BLACKBIRD_VIDEO_VBR, | ||
100 | BLACKBIRD_VIDEO_CBR | ||
101 | }; | ||
102 | #define BLACKBIRD_PEAK_RATE_DIVISOR 400 | ||
103 | enum blackbird_mux_rate { | ||
104 | BLACKBIRD_MUX_RATE_DEFAULT, | ||
105 | /* dvd mux rate: multiply by 400 to get the actual rate */ | ||
106 | BLACKBIRD_MUX_RATE_DVD = 25200 | ||
107 | }; | ||
108 | #define BLACKBIRD_API_SET_GOP_STRUCTURE 0x97 | ||
109 | #define BLACKBIRD_API_SET_ASPECT_RATIO 0x99 | ||
110 | enum blackbird_aspect_ratio { | ||
111 | BLACKBIRD_ASPECT_RATIO_FORBIDDEN, | ||
112 | BLACKBIRD_ASPECT_RATIO_1_1_SQUARE, | ||
113 | BLACKBIRD_ASPECT_RATIO_4_3, | ||
114 | BLACKBIRD_ASPECT_RATIO_16_9, | ||
115 | BLACKBIRD_ASPECT_RATIO_221_100, | ||
116 | BLACKBIRD_ASPECT_RATIO_RESERVED | ||
117 | }; | ||
118 | #define BLACKBIRD_API_SET_DNR_MODE 0x9B | ||
119 | enum blackbird_dnr_bits { | ||
120 | BLACKBIRD_DNR_BITS_MANUAL, | ||
121 | BLACKBIRD_DNR_BITS_AUTO_SPATIAL, | ||
122 | BLACKBIRD_DNR_BITS_AUTO_TEMPORAL, | ||
123 | BLACKBIRD_DNR_BITS_AUTO | ||
124 | }; | ||
125 | enum blackbird_median_filter { | ||
126 | BLACKBIRD_MEDIAN_FILTER_DISABLED, | ||
127 | BLACKBIRD_MEDIAN_FILTER_HORIZONTAL, | ||
128 | BLACKBIRD_MEDIAN_FILTER_VERTICAL, | ||
129 | BLACKBIRD_MEDIAN_FILTER_HV, | ||
130 | BLACKBIRD_MEDIAN_FILTER_DIAGONAL | ||
131 | }; | ||
132 | #define BLACKBIRD_API_SET_MANUAL_DNR 0x9D | ||
133 | #define BLACKBIRD_API_SET_DNR_MEDIAN 0x9F | ||
134 | #define BLACKBIRD_API_SET_SPATIAL_FILTER 0xA1 | ||
135 | enum blackbird_spatial_filter_luma { | ||
136 | BLACKBIRD_SPATIAL_FILTER_LUMA_DISABLED, | ||
137 | BLACKBIRD_SPATIAL_FILTER_LUMA_1D_HORIZ, | ||
138 | BLACKBIRD_SPATIAL_FILTER_LUMA_1D_VERT, | ||
139 | BLACKBIRD_SPATIAL_FILTER_LUMA_2D_HV, /* separable, default */ | ||
140 | BLACKBIRD_SPATIAL_FILTER_LUMA_2D_SYMM /* symmetric non-separable */ | ||
141 | }; | ||
142 | enum blackbird_spatial_filter_chroma { | ||
143 | BLACKBIRD_SPATIAL_FILTER_CHROMA_DISABLED, | ||
144 | BLACKBIRD_SPATIAL_FILTER_CHROMA_1D_HORIZ /* default */ | ||
145 | }; | ||
146 | #define BLACKBIRD_API_SET_3_2_PULLDOWN 0xB1 | ||
147 | enum blackbird_pulldown { | ||
148 | BLACKBIRD_3_2_PULLDOWN_DISABLED, | ||
149 | BLACKBIRD_3_2_PULLDOWN_ENABLED | ||
150 | }; | ||
151 | #define BLACKBIRD_API_SET_VBI_LINE_NO 0xB7 | ||
152 | enum blackbird_vbi_line_bits { | ||
153 | BLACKBIRD_VBI_LINE_BITS_TOP_FIELD, | ||
154 | BLACKBIRD_VBI_LINE_BITS_BOT_FIELD = (1 << 31), | ||
155 | BLACKBIRD_VBI_LINE_BITS_ALL_LINES = 0xFFFFFFFF | ||
156 | }; | ||
157 | enum blackbird_vbi_line { | ||
158 | BLACKBIRD_VBI_LINE_DISABLED, | ||
159 | BLACKBIRD_VBI_LINE_ENABLED | ||
160 | }; | ||
161 | enum blackbird_vbi_slicing { | ||
162 | BLACKBIRD_VBI_SLICING_NONE, | ||
163 | BLACKBIRD_VBI_SLICING_CLOSED_CAPTION | ||
164 | }; | ||
165 | #define BLACKBIRD_API_SET_STREAM_TYPE 0xB9 | ||
166 | enum blackbird_stream_type { | ||
167 | BLACKBIRD_STREAM_PROGRAM, | ||
168 | BLACKBIRD_STREAM_TRANSPORT, | ||
169 | BLACKBIRD_STREAM_MPEG1, | ||
170 | BLACKBIRD_STREAM_PES_AV, | ||
171 | BLACKBIRD_STREAM_UNKNOWN4, | ||
172 | BLACKBIRD_STREAM_PES_VIDEO, | ||
173 | BLACKBIRD_STREAM_UNKNOWN6, | ||
174 | BLACKBIRD_STREAM_PES_AUDIO, | ||
175 | BLACKBIRD_STREAM_UNKNOWN8, | ||
176 | BLACKBIRD_STREAM_UNKNOWN9, /* audio/pcm ? */ | ||
177 | BLACKBIRD_STREAM_DVD, | ||
178 | BLACKBIRD_STREAM_VCD, | ||
179 | BLACKBIRD_STREAM_UNKNOWN12 /* svcd/xvcd ? */ | ||
180 | }; | ||
181 | #define BLACKBIRD_API_SET_OUTPUT_PORT 0xBB | ||
182 | enum blackbird_stream_port { | ||
183 | BLACKBIRD_OUTPUT_PORT_MEMORY, | ||
184 | BLACKBIRD_OUTPUT_PORT_STREAMING, | ||
185 | BLACKBIRD_OUTPUT_PORT_SERIAL | ||
186 | }; | ||
187 | #define BLACKBIRD_API_SET_AUDIO_PARAMS 0xBD | ||
188 | enum blackbird_audio_bits_sample_rate { | ||
189 | BLACKBIRD_AUDIO_BITS_44100HZ, | ||
190 | BLACKBIRD_AUDIO_BITS_48000HZ, | ||
191 | BLACKBIRD_AUDIO_BITS_32000HZ, | ||
192 | BLACKBIRD_AUDIO_BITS_RESERVED_HZ, | ||
193 | }; | ||
194 | enum blackbird_audio_bits_encoding { | ||
195 | BLACKBIRD_AUDIO_BITS_LAYER_1 = 0x1 << 2, | ||
196 | BLACKBIRD_AUDIO_BITS_LAYER_2 = 0x2 << 2, | ||
197 | }; | ||
198 | enum blackbird_audio_bits_bitrate_layer_1 { | ||
199 | BLACKBIRD_AUDIO_BITS_LAYER_1_FREE_FORMAT, | ||
200 | BLACKBIRD_AUDIO_BITS_LAYER_1_32 = 0x01 << 4, | ||
201 | BLACKBIRD_AUDIO_BITS_LAYER_1_64 = 0x02 << 4, | ||
202 | BLACKBIRD_AUDIO_BITS_LAYER_1_96 = 0x03 << 4, | ||
203 | BLACKBIRD_AUDIO_BITS_LAYER_1_128 = 0x04 << 4, | ||
204 | BLACKBIRD_AUDIO_BITS_LAYER_1_160 = 0x05 << 4, | ||
205 | BLACKBIRD_AUDIO_BITS_LAYER_1_192 = 0x06 << 4, | ||
206 | BLACKBIRD_AUDIO_BITS_LAYER_1_224 = 0x07 << 4, | ||
207 | BLACKBIRD_AUDIO_BITS_LAYER_1_256 = 0x08 << 4, | ||
208 | BLACKBIRD_AUDIO_BITS_LAYER_1_288 = 0x09 << 4, | ||
209 | BLACKBIRD_AUDIO_BITS_LAYER_1_320 = 0x0A << 4, | ||
210 | BLACKBIRD_AUDIO_BITS_LAYER_1_352 = 0x0B << 4, | ||
211 | BLACKBIRD_AUDIO_BITS_LAYER_1_384 = 0x0C << 4, | ||
212 | BLACKBIRD_AUDIO_BITS_LAYER_1_416 = 0x0D << 4, | ||
213 | BLACKBIRD_AUDIO_BITS_LAYER_1_448 = 0x0E << 4, | ||
214 | }; | ||
215 | enum blackbird_audio_bits_bitrate_layer_2 { | ||
216 | BLACKBIRD_AUDIO_BITS_LAYER_2_FREE_FORMAT, | ||
217 | BLACKBIRD_AUDIO_BITS_LAYER_2_32 = 0x01 << 4, | ||
218 | BLACKBIRD_AUDIO_BITS_LAYER_2_48 = 0x02 << 4, | ||
219 | BLACKBIRD_AUDIO_BITS_LAYER_2_56 = 0x03 << 4, | ||
220 | BLACKBIRD_AUDIO_BITS_LAYER_2_64 = 0x04 << 4, | ||
221 | BLACKBIRD_AUDIO_BITS_LAYER_2_80 = 0x05 << 4, | ||
222 | BLACKBIRD_AUDIO_BITS_LAYER_2_96 = 0x06 << 4, | ||
223 | BLACKBIRD_AUDIO_BITS_LAYER_2_112 = 0x07 << 4, | ||
224 | BLACKBIRD_AUDIO_BITS_LAYER_2_128 = 0x08 << 4, | ||
225 | BLACKBIRD_AUDIO_BITS_LAYER_2_160 = 0x09 << 4, | ||
226 | BLACKBIRD_AUDIO_BITS_LAYER_2_192 = 0x0A << 4, | ||
227 | BLACKBIRD_AUDIO_BITS_LAYER_2_224 = 0x0B << 4, | ||
228 | BLACKBIRD_AUDIO_BITS_LAYER_2_256 = 0x0C << 4, | ||
229 | BLACKBIRD_AUDIO_BITS_LAYER_2_320 = 0x0D << 4, | ||
230 | BLACKBIRD_AUDIO_BITS_LAYER_2_384 = 0x0E << 4, | ||
231 | }; | ||
232 | enum blackbird_audio_bits_mode { | ||
233 | BLACKBIRD_AUDIO_BITS_STEREO, | ||
234 | BLACKBIRD_AUDIO_BITS_JOINT_STEREO = 0x1 << 8, | ||
235 | BLACKBIRD_AUDIO_BITS_DUAL = 0x2 << 8, | ||
236 | BLACKBIRD_AUDIO_BITS_MONO = 0x3 << 8, | ||
237 | }; | ||
238 | enum blackbird_audio_bits_mode_extension { | ||
239 | BLACKBIRD_AUDIO_BITS_BOUND_4, | ||
240 | BLACKBIRD_AUDIO_BITS_BOUND_8 = 0x1 << 10, | ||
241 | BLACKBIRD_AUDIO_BITS_BOUND_12 = 0x2 << 10, | ||
242 | BLACKBIRD_AUDIO_BITS_BOUND_16 = 0x3 << 10, | ||
243 | }; | ||
244 | enum blackbird_audio_bits_emphasis { | ||
245 | BLACKBIRD_AUDIO_BITS_EMPHASIS_NONE, | ||
246 | BLACKBIRD_AUDIO_BITS_EMPHASIS_50_15 = 0x1 << 12, | ||
247 | BLACKBIRD_AUDIO_BITS_EMPHASIS_RESERVED = 0x2 << 12, | ||
248 | BLACKBIRD_AUDIO_BITS_EMPHASIS_CCITT_J17 = 0x3 << 12, | ||
249 | }; | ||
250 | enum blackbird_audio_bits_crc { | ||
251 | BLACKBIRD_AUDIO_BITS_CRC_OFF, | ||
252 | BLACKBIRD_AUDIO_BITS_CRC_ON = 0x1 << 14, | ||
253 | }; | ||
254 | enum blackbird_audio_bits_copyright { | ||
255 | BLACKBIRD_AUDIO_BITS_COPYRIGHT_OFF, | ||
256 | BLACKBIRD_AUDIO_BITS_COPYRIGHT_ON = 0x1 << 15, | ||
257 | }; | ||
258 | enum blackbird_audio_bits_original { | ||
259 | BLACKBIRD_AUDIO_BITS_COPY, | ||
260 | BLACKBIRD_AUDIO_BITS_ORIGINAL = 0x1 << 16, | ||
261 | }; | ||
262 | #define BLACKBIRD_API_HALT 0xC3 | ||
263 | #define BLACKBIRD_API_GET_VERSION 0xC4 | ||
264 | #define BLACKBIRD_API_SET_GOP_CLOSURE 0xC5 | ||
265 | enum blackbird_gop_closure { | ||
266 | BLACKBIRD_GOP_CLOSURE_OFF, | ||
267 | BLACKBIRD_GOP_CLOSURE_ON, | ||
268 | }; | ||
269 | #define BLACKBIRD_API_DATA_XFER_STATUS 0xC6 | ||
270 | enum blackbird_data_xfer_status { | ||
271 | BLACKBIRD_MORE_BUFFERS_FOLLOW, | ||
272 | BLACKBIRD_LAST_BUFFER, | ||
273 | }; | ||
274 | #define BLACKBIRD_API_PROGRAM_INDEX_INFO 0xC7 | ||
275 | enum blackbird_picture_mask { | ||
276 | BLACKBIRD_PICTURE_MASK_NONE, | ||
277 | BLACKBIRD_PICTURE_MASK_I_FRAMES, | ||
278 | BLACKBIRD_PICTURE_MASK_I_P_FRAMES = 0x3, | ||
279 | BLACKBIRD_PICTURE_MASK_ALL_FRAMES = 0x7, | ||
280 | }; | ||
281 | #define BLACKBIRD_API_SET_VBI_PARAMS 0xC8 | ||
282 | enum blackbird_vbi_mode_bits { | ||
283 | BLACKBIRD_VBI_BITS_SLICED, | ||
284 | BLACKBIRD_VBI_BITS_RAW, | ||
285 | }; | ||
286 | enum blackbird_vbi_insertion_bits { | ||
287 | BLACKBIRD_VBI_BITS_INSERT_IN_XTENSION_USR_DATA, | ||
288 | BLACKBIRD_VBI_BITS_INSERT_IN_PRIVATE_PACKETS = 0x1 << 1, | ||
289 | BLACKBIRD_VBI_BITS_SEPARATE_STREAM = 0x2 << 1, | ||
290 | BLACKBIRD_VBI_BITS_SEPARATE_STREAM_USR_DATA = 0x4 << 1, | ||
291 | BLACKBIRD_VBI_BITS_SEPARATE_STREAM_PRV_DATA = 0x5 << 1, | ||
292 | }; | ||
293 | #define BLACKBIRD_API_SET_DMA_BLOCK_SIZE 0xC9 | ||
294 | enum blackbird_dma_unit { | ||
295 | BLACKBIRD_DMA_BYTES, | ||
296 | BLACKBIRD_DMA_FRAMES, | ||
297 | }; | ||
298 | #define BLACKBIRD_API_DMA_TRANSFER_INFO 0xCA | ||
299 | #define BLACKBIRD_API_DMA_TRANSFER_STAT 0xCB | ||
300 | enum blackbird_dma_transfer_status_bits { | ||
301 | BLACKBIRD_DMA_TRANSFER_BITS_DONE = 0x01, | ||
302 | BLACKBIRD_DMA_TRANSFER_BITS_ERROR = 0x04, | ||
303 | BLACKBIRD_DMA_TRANSFER_BITS_LL_ERROR = 0x10, | ||
304 | }; | ||
305 | #define BLACKBIRD_API_SET_DMA2HOST_ADDR 0xCC | ||
306 | #define BLACKBIRD_API_INIT_VIDEO_INPUT 0xCD | ||
307 | #define BLACKBIRD_API_SET_FRAMESKIP 0xD0 | ||
308 | #define BLACKBIRD_API_PAUSE 0xD2 | ||
309 | enum blackbird_pause { | ||
310 | BLACKBIRD_PAUSE_ENCODING, | ||
311 | BLACKBIRD_RESUME_ENCODING, | ||
312 | }; | ||
313 | #define BLACKBIRD_API_REFRESH_INPUT 0xD3 | ||
314 | #define BLACKBIRD_API_SET_COPYRIGHT 0xD4 | ||
315 | enum blackbird_copyright { | ||
316 | BLACKBIRD_COPYRIGHT_OFF, | ||
317 | BLACKBIRD_COPYRIGHT_ON, | ||
318 | }; | ||
319 | #define BLACKBIRD_API_SET_NOTIFICATION 0xD5 | ||
320 | enum blackbird_notification_type { | ||
321 | BLACKBIRD_NOTIFICATION_REFRESH, | ||
322 | }; | ||
323 | enum blackbird_notification_status { | ||
324 | BLACKBIRD_NOTIFICATION_OFF, | ||
325 | BLACKBIRD_NOTIFICATION_ON, | ||
326 | }; | ||
327 | enum blackbird_notification_mailbox { | ||
328 | BLACKBIRD_NOTIFICATION_NO_MAILBOX = -1, | ||
329 | }; | ||
330 | #define BLACKBIRD_API_SET_CAPTURE_LINES 0xD6 | ||
331 | enum blackbird_field1_lines { | ||
332 | BLACKBIRD_FIELD1_SAA7114 = 0x00EF, /* 239 */ | ||
333 | BLACKBIRD_FIELD1_SAA7115 = 0x00F0, /* 240 */ | ||
334 | BLACKBIRD_FIELD1_MICRONAS = 0x0105, /* 261 */ | ||
335 | }; | ||
336 | enum blackbird_field2_lines { | ||
337 | BLACKBIRD_FIELD2_SAA7114 = 0x00EF, /* 239 */ | ||
338 | BLACKBIRD_FIELD2_SAA7115 = 0x00F0, /* 240 */ | ||
339 | BLACKBIRD_FIELD2_MICRONAS = 0x0106, /* 262 */ | ||
340 | }; | ||
341 | #define BLACKBIRD_API_SET_CUSTOM_DATA 0xD7 | ||
342 | enum blackbird_custom_data_type { | ||
343 | BLACKBIRD_CUSTOM_EXTENSION_USR_DATA, | ||
344 | BLACKBIRD_CUSTOM_PRIVATE_PACKET, | ||
345 | }; | ||
346 | #define BLACKBIRD_API_MUTE_VIDEO 0xD9 | ||
347 | enum blackbird_mute { | ||
348 | BLACKBIRD_UNMUTE, | ||
349 | BLACKBIRD_MUTE, | ||
350 | }; | ||
351 | enum blackbird_mute_video_mask { | ||
352 | BLACKBIRD_MUTE_VIDEO_V_MASK = 0x0000FF00, | ||
353 | BLACKBIRD_MUTE_VIDEO_U_MASK = 0x00FF0000, | ||
354 | BLACKBIRD_MUTE_VIDEO_Y_MASK = 0xFF000000, | ||
355 | }; | ||
356 | enum blackbird_mute_video_shift { | ||
357 | BLACKBIRD_MUTE_VIDEO_V_SHIFT = 8, | ||
358 | BLACKBIRD_MUTE_VIDEO_U_SHIFT = 16, | ||
359 | BLACKBIRD_MUTE_VIDEO_Y_SHIFT = 24, | ||
360 | }; | ||
361 | #define BLACKBIRD_API_MUTE_AUDIO 0xDA | ||
95 | 362 | ||
96 | /* Registers */ | 363 | /* Registers */ |
97 | #define IVTV_REG_ENC_SDRAM_REFRESH (0x07F8 /*| IVTV_REG_OFFSET*/) | 364 | #define IVTV_REG_ENC_SDRAM_REFRESH (0x07F8 /*| IVTV_REG_OFFSET*/) |
@@ -405,68 +672,100 @@ static int blackbird_load_firmware(struct cx8802_dev *dev) | |||
405 | return 0; | 672 | return 0; |
406 | } | 673 | } |
407 | 674 | ||
675 | /** | ||
676 | Settings used by the windows tv app for PVR2000: | ||
677 | ================================================================================================================= | ||
678 | Profile | Codec | Resolution | CBR/VBR | Video Qlty | V. Bitrate | Frmrate | Audio Codec | A. Bitrate | A. Mode | ||
679 | ----------------------------------------------------------------------------------------------------------------- | ||
680 | MPEG-1 | MPEG1 | 352x288PAL | (CBR) | 1000:Optimal | 2000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo | ||
681 | MPEG-2 | MPEG2 | 720x576PAL | VBR | 600 :Good | 4000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo | ||
682 | VCD | MPEG1 | 352x288PAL | (CBR) | 1000:Optimal | 1150 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo | ||
683 | DVD | MPEG2 | 720x576PAL | VBR | 600 :Good | 6000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo | ||
684 | DB* DVD | MPEG2 | 720x576PAL | CBR | 600 :Good | 6000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo | ||
685 | ================================================================================================================= | ||
686 | *DB: "DirectBurn" | ||
687 | */ | ||
408 | static void blackbird_codec_settings(struct cx8802_dev *dev) | 688 | static void blackbird_codec_settings(struct cx8802_dev *dev) |
409 | { | 689 | { |
410 | int bitrate_mode = 1; | 690 | int bitrate_mode = 1; |
411 | int bitrate = 7500000; | 691 | int bitrate = 7500000; |
412 | int bitrate_peak = 7500000; | 692 | int bitrate_peak = 7500000; |
693 | #if 1 | ||
694 | bitrate_mode = BLACKBIRD_VIDEO_CBR; | ||
695 | bitrate = 4000*1024; | ||
696 | bitrate_peak = 4000*1024; | ||
697 | #endif | ||
413 | 698 | ||
414 | /* assign stream type */ | 699 | /* assign stream type */ |
415 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_STREAM_TYPE, 1, 0, 0); /* program stream */ | 700 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_PROGRAM); |
416 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_STREAM_TYPE, 1, 0, 2); /* MPEG1 stream */ | 701 | /* blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_TRANSPORT); */ |
417 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_STREAM_TYPE, 1, 0, 3); /* PES A/V */ | ||
418 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_STREAM_TYPE, 1, 0, 10); /* DVD stream */ | ||
419 | 702 | ||
420 | /* assign output port */ | 703 | /* assign output port */ |
421 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_OUTPUT_PORT, 1, 0, 1); /* 1 = Host */ | 704 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_OUTPUT_PORT, 1, 0, BLACKBIRD_OUTPUT_PORT_STREAMING); /* Host */ |
422 | 705 | ||
423 | /* assign framerate */ | 706 | /* assign framerate */ |
424 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAMERATE, 1, 0, 0); | 707 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_FRAMERATE, 1, 0, BLACKBIRD_FRAMERATE_PAL_25); |
425 | 708 | ||
426 | /* assign frame size */ | 709 | /* assign frame size */ |
427 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAME_SIZE, 2, 0, | 710 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_RESOLUTION, 2, 0, |
428 | dev->height, dev->width); | 711 | dev->height, dev->width); |
429 | 712 | ||
430 | /* assign aspect ratio */ | 713 | /* assign aspect ratio */ |
431 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_ASPECT_RATIO, 1, 0, 2); | 714 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_ASPECT_RATIO, 1, 0, BLACKBIRD_ASPECT_RATIO_4_3); |
432 | 715 | ||
433 | /* assign bitrates */ | 716 | /* assign bitrates */ |
434 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_BITRATES, 5, 0, | 717 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_VIDEO_BITRATE, 5, 0, |
435 | bitrate_mode, /* mode */ | 718 | bitrate_mode, /* mode */ |
436 | bitrate, /* bps */ | 719 | bitrate, /* bps */ |
437 | bitrate_peak / 400, /* peak/400 */ | 720 | bitrate_peak / BLACKBIRD_PEAK_RATE_DIVISOR, /* peak/400 */ |
438 | 0, 0x70); /* encoding buffer, ckennedy */ | 721 | BLACKBIRD_MUX_RATE_DEFAULT /*, 0x70*/); /* encoding buffer, ckennedy */ |
439 | 722 | ||
440 | /* assign gop properties */ | 723 | /* assign gop properties */ |
441 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_GOP_PROPERTIES, 2, 0, 15, 3); | 724 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_STRUCTURE, 2, 0, 15, 3); |
442 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_GOP_PROPERTIES, 2, 0, 2, 1); | 725 | |
443 | 726 | /* assign 3 2 pulldown */ | |
444 | /* assign 3 2 pulldown */ | 727 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_3_2_PULLDOWN, 1, 0, BLACKBIRD_3_2_PULLDOWN_DISABLED); |
445 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_3_2_PULLDOWN, 1, 0, 0); | 728 | |
446 | 729 | /* assign audio properties */ | |
447 | /* note: it's not necessary to set the samplerate, the mpeg encoder seems to autodetect/adjust */ | 730 | /* note: it's not necessary to set the samplerate, the mpeg encoder seems to autodetect/adjust */ |
448 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, (2<<2) | (8<<4)); | 731 | /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, (2<<2) | (8<<4)); |
732 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, 0 | (2 << 2) | (14 << 4)); */ | ||
733 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_AUDIO_PARAMS, 1, 0, | ||
734 | BLACKBIRD_AUDIO_BITS_44100HZ | | ||
735 | BLACKBIRD_AUDIO_BITS_LAYER_2 | | ||
736 | BLACKBIRD_AUDIO_BITS_LAYER_2_224 | | ||
737 | BLACKBIRD_AUDIO_BITS_STEREO | | ||
738 | /* BLACKBIRD_AUDIO_BITS_BOUND_4 | */ | ||
739 | BLACKBIRD_AUDIO_BITS_EMPHASIS_NONE | | ||
740 | BLACKBIRD_AUDIO_BITS_CRC_OFF | | ||
741 | BLACKBIRD_AUDIO_BITS_COPYRIGHT_OFF | | ||
742 | BLACKBIRD_AUDIO_BITS_COPY | ||
743 | ); | ||
449 | 744 | ||
450 | /* assign gop closure */ | 745 | /* assign gop closure */ |
451 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_GOP_CLOSURE, 1, 0, 0); | 746 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_CLOSURE, 1, 0, BLACKBIRD_GOP_CLOSURE_OFF); |
452 | 747 | ||
453 | /* assign audio properties */ | ||
454 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, 0 | (2 << 2) | (14 << 4)); | ||
455 | 748 | ||
456 | /* assign dnr filter mode */ | 749 | /* assign dnr filter mode */ |
457 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_DNR_FILTER_MODE, 2, 0, 0, 0); | 750 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_DNR_MODE, 2, 0, |
751 | BLACKBIRD_DNR_BITS_MANUAL, | ||
752 | BLACKBIRD_MEDIAN_FILTER_DISABLED | ||
753 | ); | ||
458 | 754 | ||
459 | /* assign dnr filter props*/ | 755 | /* assign dnr filter props*/ |
460 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_DNR_FILTER_PROPS, 2, 0, 0, 0); | 756 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_MANUAL_DNR, 2, 0, 0, 0); |
461 | 757 | ||
462 | /* assign coring levels (luma_h, luma_l, chroma_h, chroma_l) */ | 758 | /* assign coring levels (luma_h, luma_l, chroma_h, chroma_l) */ |
463 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_CORING_LEVELS, 4, 0, 0, 255, 0, 255); | 759 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_DNR_MEDIAN, 4, 0, 0, 255, 0, 255); |
464 | 760 | ||
465 | /* assign spatial filter type: luma_t: 1 = horiz_only, chroma_t: 1 = horiz_only */ | 761 | /* assign spatial filter type: luma_t: horiz_only, chroma_t: horiz_only */ |
466 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_SPATIAL_FILTER_TYPE, 2, 0, 1, 1); | 762 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_SPATIAL_FILTER, 2, 0, |
763 | BLACKBIRD_SPATIAL_FILTER_LUMA_1D_HORIZ, | ||
764 | BLACKBIRD_SPATIAL_FILTER_CHROMA_1D_HORIZ | ||
765 | ); | ||
467 | 766 | ||
468 | /* assign frame drop rate */ | 767 | /* assign frame drop rate */ |
469 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAME_DROP_RATE, 1, 0, 0); | 768 | /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAME_DROP_RATE, 1, 0, 0); */ |
470 | } | 769 | } |
471 | 770 | ||
472 | static int blackbird_initialize_codec(struct cx8802_dev *dev) | 771 | static int blackbird_initialize_codec(struct cx8802_dev *dev) |
@@ -476,7 +775,7 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) | |||
476 | int retval; | 775 | int retval; |
477 | 776 | ||
478 | dprintk(1,"Initialize codec\n"); | 777 | dprintk(1,"Initialize codec\n"); |
479 | retval = blackbird_api_cmd(dev, IVTV_API_ENC_PING_FW, 0, 0); /* ping */ | 778 | retval = blackbird_api_cmd(dev, BLACKBIRD_API_PING, 0, 0); /* ping */ |
480 | if (retval < 0) { | 779 | if (retval < 0) { |
481 | /* ping was not successful, reset and upload firmware */ | 780 | /* ping was not successful, reset and upload firmware */ |
482 | cx_write(MO_SRST_IO, 0); /* SYS_RSTO=0 */ | 781 | cx_write(MO_SRST_IO, 0); /* SYS_RSTO=0 */ |
@@ -491,13 +790,13 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) | |||
491 | if (dev->mailbox < 0) | 790 | if (dev->mailbox < 0) |
492 | return -1; | 791 | return -1; |
493 | 792 | ||
494 | retval = blackbird_api_cmd(dev, IVTV_API_ENC_PING_FW, 0, 0); /* ping */ | 793 | retval = blackbird_api_cmd(dev, BLACKBIRD_API_PING, 0, 0); /* ping */ |
495 | if (retval < 0) { | 794 | if (retval < 0) { |
496 | dprintk(0, "ERROR: Firmware ping failed!\n"); | 795 | dprintk(0, "ERROR: Firmware ping failed!\n"); |
497 | return -1; | 796 | return -1; |
498 | } | 797 | } |
499 | 798 | ||
500 | retval = blackbird_api_cmd(dev, IVTV_API_ENC_GETVER, 0, 1, &version); | 799 | retval = blackbird_api_cmd(dev, BLACKBIRD_API_GET_VERSION, 0, 1, &version); |
501 | if (retval < 0) { | 800 | if (retval < 0) { |
502 | dprintk(0, "ERROR: Firmware get encoder version failed!\n"); | 801 | dprintk(0, "ERROR: Firmware get encoder version failed!\n"); |
503 | return -1; | 802 | return -1; |
@@ -517,25 +816,36 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) | |||
517 | blackbird_codec_settings(dev); | 816 | blackbird_codec_settings(dev); |
518 | msleep(1); | 817 | msleep(1); |
519 | 818 | ||
520 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xef, 0xef); | 819 | /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xef, 0xef); |
521 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xf0, 0xf0); | 820 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xf0, 0xf0); |
522 | //blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0x180, 0x180); | 821 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0x180, 0x180); */ |
523 | blackbird_api_cmd(dev, IVTV_API_ASSIGN_PLACEHOLDER, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); | 822 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_CAPTURE_LINES, 2, 0, |
823 | BLACKBIRD_FIELD1_SAA7115, | ||
824 | BLACKBIRD_FIELD1_SAA7115 | ||
825 | ); | ||
826 | |||
827 | /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_PLACEHOLDER, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); */ | ||
828 | blackbird_api_cmd(dev, BLACKBIRD_API_SET_CUSTOM_DATA, 12, 0, | ||
829 | BLACKBIRD_CUSTOM_EXTENSION_USR_DATA, | ||
830 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); | ||
524 | 831 | ||
525 | blackbird_api_cmd(dev, IVTV_API_INITIALIZE_INPUT, 0, 0); /* initialize the video input */ | 832 | blackbird_api_cmd(dev, BLACKBIRD_API_INIT_VIDEO_INPUT, 0, 0); /* initialize the video input */ |
526 | 833 | ||
527 | msleep(1); | 834 | msleep(1); |
528 | 835 | ||
529 | blackbird_api_cmd(dev, IVTV_API_MUTE_VIDEO, 1, 0, 0); | 836 | blackbird_api_cmd(dev, BLACKBIRD_API_MUTE_VIDEO, 1, 0, BLACKBIRD_UNMUTE); |
530 | msleep(1); | 837 | msleep(1); |
531 | blackbird_api_cmd(dev, IVTV_API_MUTE_AUDIO, 1, 0, 0); | 838 | blackbird_api_cmd(dev, BLACKBIRD_API_MUTE_AUDIO, 1, 0, BLACKBIRD_UNMUTE); |
532 | msleep(1); | 839 | msleep(1); |
533 | 840 | ||
534 | blackbird_api_cmd(dev, IVTV_API_BEGIN_CAPTURE, 2, 0, 0, 0x13); /* start capturing to the host interface */ | 841 | /* blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, 0, 0x13); // start capturing to the host interface */ |
535 | //blackbird_api_cmd(dev, IVTV_API_BEGIN_CAPTURE, 2, 0, 0, 0); /* start capturing to the host interface */ | 842 | blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, |
536 | msleep(1); | 843 | BLACKBIRD_MPEG_CAPTURE, |
844 | BLACKBIRD_RAW_BITS_NONE | ||
845 | ); /* start capturing to the host interface */ | ||
846 | msleep(10); | ||
537 | 847 | ||
538 | blackbird_api_cmd(dev, IVTV_API_REFRESH_INPUT, 0,0); | 848 | blackbird_api_cmd(dev, BLACKBIRD_API_REFRESH_INPUT, 0,0); |
539 | return 0; | 849 | return 0; |
540 | } | 850 | } |
541 | 851 | ||
@@ -709,7 +1019,12 @@ static int mpeg_release(struct inode *inode, struct file *file) | |||
709 | { | 1019 | { |
710 | struct cx8802_fh *fh = file->private_data; | 1020 | struct cx8802_fh *fh = file->private_data; |
711 | 1021 | ||
712 | blackbird_api_cmd(fh->dev, IVTV_API_END_CAPTURE, 3, 0, 1, 0, 0x13); | 1022 | /* blackbird_api_cmd(fh->dev, BLACKBIRD_API_END_CAPTURE, 3, 0, BLACKBIRD_END_NOW, 0, 0x13); */ |
1023 | blackbird_api_cmd(fh->dev, BLACKBIRD_API_END_CAPTURE, 3, 0, | ||
1024 | BLACKBIRD_END_NOW, | ||
1025 | BLACKBIRD_MPEG_CAPTURE, | ||
1026 | BLACKBIRD_RAW_BITS_NONE | ||
1027 | ); | ||
713 | 1028 | ||
714 | /* stop mpeg capture */ | 1029 | /* stop mpeg capture */ |
715 | if (fh->mpegq.streaming) | 1030 | if (fh->mpegq.streaming) |
@@ -908,4 +1223,5 @@ module_exit(blackbird_fini); | |||
908 | * Local variables: | 1223 | * Local variables: |
909 | * c-basic-offset: 8 | 1224 | * c-basic-offset: 8 |
910 | * End: | 1225 | * End: |
1226 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
911 | */ | 1227 | */ |
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 367624822d77..b3fb04356b71 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-cards.c,v 1.66 2005/03/04 09:12:23 kraxel Exp $ | 2 | * $Id: cx88-cards.c,v 1.76 2005/06/08 01:28:09 mchehab Exp $ |
3 | * | 3 | * |
4 | * device driver for Conexant 2388x based TV cards | 4 | * device driver for Conexant 2388x based TV cards |
5 | * card-specific stuff. | 5 | * card-specific stuff. |
@@ -35,6 +35,9 @@ struct cx88_board cx88_boards[] = { | |||
35 | [CX88_BOARD_UNKNOWN] = { | 35 | [CX88_BOARD_UNKNOWN] = { |
36 | .name = "UNKNOWN/GENERIC", | 36 | .name = "UNKNOWN/GENERIC", |
37 | .tuner_type = UNSET, | 37 | .tuner_type = UNSET, |
38 | .radio_type = UNSET, | ||
39 | .tuner_addr = ADDR_UNSET, | ||
40 | .radio_addr = ADDR_UNSET, | ||
38 | .input = {{ | 41 | .input = {{ |
39 | .type = CX88_VMUX_COMPOSITE1, | 42 | .type = CX88_VMUX_COMPOSITE1, |
40 | .vmux = 0, | 43 | .vmux = 0, |
@@ -52,6 +55,9 @@ struct cx88_board cx88_boards[] = { | |||
52 | [CX88_BOARD_HAUPPAUGE] = { | 55 | [CX88_BOARD_HAUPPAUGE] = { |
53 | .name = "Hauppauge WinTV 34xxx models", | 56 | .name = "Hauppauge WinTV 34xxx models", |
54 | .tuner_type = UNSET, | 57 | .tuner_type = UNSET, |
58 | .radio_type = UNSET, | ||
59 | .tuner_addr = ADDR_UNSET, | ||
60 | .radio_addr = ADDR_UNSET, | ||
55 | .tda9887_conf = TDA9887_PRESENT, | 61 | .tda9887_conf = TDA9887_PRESENT, |
56 | .input = {{ | 62 | .input = {{ |
57 | .type = CX88_VMUX_TELEVISION, | 63 | .type = CX88_VMUX_TELEVISION, |
@@ -78,6 +84,9 @@ struct cx88_board cx88_boards[] = { | |||
78 | [CX88_BOARD_GDI] = { | 84 | [CX88_BOARD_GDI] = { |
79 | .name = "GDI Black Gold", | 85 | .name = "GDI Black Gold", |
80 | .tuner_type = UNSET, | 86 | .tuner_type = UNSET, |
87 | .radio_type = UNSET, | ||
88 | .tuner_addr = ADDR_UNSET, | ||
89 | .radio_addr = ADDR_UNSET, | ||
81 | .input = {{ | 90 | .input = {{ |
82 | .type = CX88_VMUX_TELEVISION, | 91 | .type = CX88_VMUX_TELEVISION, |
83 | .vmux = 0, | 92 | .vmux = 0, |
@@ -85,7 +94,10 @@ struct cx88_board cx88_boards[] = { | |||
85 | }, | 94 | }, |
86 | [CX88_BOARD_PIXELVIEW] = { | 95 | [CX88_BOARD_PIXELVIEW] = { |
87 | .name = "PixelView", | 96 | .name = "PixelView", |
88 | .tuner_type = 5, | 97 | .tuner_type = TUNER_PHILIPS_PAL, |
98 | .radio_type = UNSET, | ||
99 | .tuner_addr = ADDR_UNSET, | ||
100 | .radio_addr = ADDR_UNSET, | ||
89 | .input = {{ | 101 | .input = {{ |
90 | .type = CX88_VMUX_TELEVISION, | 102 | .type = CX88_VMUX_TELEVISION, |
91 | .vmux = 0, | 103 | .vmux = 0, |
@@ -104,7 +116,10 @@ struct cx88_board cx88_boards[] = { | |||
104 | }, | 116 | }, |
105 | [CX88_BOARD_ATI_WONDER_PRO] = { | 117 | [CX88_BOARD_ATI_WONDER_PRO] = { |
106 | .name = "ATI TV Wonder Pro", | 118 | .name = "ATI TV Wonder Pro", |
107 | .tuner_type = 44, | 119 | .tuner_type = TUNER_PHILIPS_4IN1, |
120 | .radio_type = UNSET, | ||
121 | .tuner_addr = ADDR_UNSET, | ||
122 | .radio_addr = ADDR_UNSET, | ||
108 | .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER, | 123 | .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER, |
109 | .input = {{ | 124 | .input = {{ |
110 | .type = CX88_VMUX_TELEVISION, | 125 | .type = CX88_VMUX_TELEVISION, |
@@ -122,7 +137,10 @@ struct cx88_board cx88_boards[] = { | |||
122 | }, | 137 | }, |
123 | [CX88_BOARD_WINFAST2000XP_EXPERT] = { | 138 | [CX88_BOARD_WINFAST2000XP_EXPERT] = { |
124 | .name = "Leadtek Winfast 2000XP Expert", | 139 | .name = "Leadtek Winfast 2000XP Expert", |
125 | .tuner_type = 44, | 140 | .tuner_type = TUNER_PHILIPS_4IN1, |
141 | .radio_type = UNSET, | ||
142 | .tuner_addr = ADDR_UNSET, | ||
143 | .radio_addr = ADDR_UNSET, | ||
126 | .tda9887_conf = TDA9887_PRESENT, | 144 | .tda9887_conf = TDA9887_PRESENT, |
127 | .input = {{ | 145 | .input = {{ |
128 | .type = CX88_VMUX_TELEVISION, | 146 | .type = CX88_VMUX_TELEVISION, |
@@ -156,7 +174,10 @@ struct cx88_board cx88_boards[] = { | |||
156 | }, | 174 | }, |
157 | [CX88_BOARD_AVERTV_303] = { | 175 | [CX88_BOARD_AVERTV_303] = { |
158 | .name = "AverTV Studio 303 (M126)", | 176 | .name = "AverTV Studio 303 (M126)", |
159 | .tuner_type = 38, | 177 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
178 | .radio_type = UNSET, | ||
179 | .tuner_addr = ADDR_UNSET, | ||
180 | .radio_addr = ADDR_UNSET, | ||
160 | .tda9887_conf = TDA9887_PRESENT, | 181 | .tda9887_conf = TDA9887_PRESENT, |
161 | .input = {{ | 182 | .input = {{ |
162 | .type = CX88_VMUX_TELEVISION, | 183 | .type = CX88_VMUX_TELEVISION, |
@@ -179,7 +200,10 @@ struct cx88_board cx88_boards[] = { | |||
179 | // added gpio values thanks to Michal | 200 | // added gpio values thanks to Michal |
180 | // values for PAL from DScaler | 201 | // values for PAL from DScaler |
181 | .name = "MSI TV-@nywhere Master", | 202 | .name = "MSI TV-@nywhere Master", |
182 | .tuner_type = 33, | 203 | .tuner_type = TUNER_MT2032, |
204 | .radio_type = UNSET, | ||
205 | .tuner_addr = ADDR_UNSET, | ||
206 | .radio_addr = ADDR_UNSET, | ||
183 | .tda9887_conf = TDA9887_PRESENT, | 207 | .tda9887_conf = TDA9887_PRESENT, |
184 | .input = {{ | 208 | .input = {{ |
185 | .type = CX88_VMUX_TELEVISION, | 209 | .type = CX88_VMUX_TELEVISION, |
@@ -206,7 +230,10 @@ struct cx88_board cx88_boards[] = { | |||
206 | }, | 230 | }, |
207 | [CX88_BOARD_WINFAST_DV2000] = { | 231 | [CX88_BOARD_WINFAST_DV2000] = { |
208 | .name = "Leadtek Winfast DV2000", | 232 | .name = "Leadtek Winfast DV2000", |
209 | .tuner_type = 38, | 233 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
234 | .radio_type = UNSET, | ||
235 | .tuner_addr = ADDR_UNSET, | ||
236 | .radio_addr = ADDR_UNSET, | ||
210 | .tda9887_conf = TDA9887_PRESENT, | 237 | .tda9887_conf = TDA9887_PRESENT, |
211 | .input = {{ | 238 | .input = {{ |
212 | .type = CX88_VMUX_TELEVISION, | 239 | .type = CX88_VMUX_TELEVISION, |
@@ -239,34 +266,40 @@ struct cx88_board cx88_boards[] = { | |||
239 | .gpio3 = 0x02000000, | 266 | .gpio3 = 0x02000000, |
240 | }, | 267 | }, |
241 | }, | 268 | }, |
242 | [CX88_BOARD_LEADTEK_PVR2000] = { | 269 | [CX88_BOARD_LEADTEK_PVR2000] = { |
243 | // gpio values for PAL version from regspy by DScaler | 270 | // gpio values for PAL version from regspy by DScaler |
244 | .name = "Leadtek PVR 2000", | 271 | .name = "Leadtek PVR 2000", |
245 | .tuner_type = 38, | 272 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
273 | .radio_type = UNSET, | ||
274 | .tuner_addr = ADDR_UNSET, | ||
275 | .radio_addr = ADDR_UNSET, | ||
246 | .tda9887_conf = TDA9887_PRESENT, | 276 | .tda9887_conf = TDA9887_PRESENT, |
247 | .input = {{ | 277 | .input = {{ |
248 | .type = CX88_VMUX_TELEVISION, | 278 | .type = CX88_VMUX_TELEVISION, |
249 | .vmux = 0, | 279 | .vmux = 0, |
250 | .gpio0 = 0x0000bde6, | 280 | .gpio0 = 0x0000bde2, |
251 | },{ | 281 | },{ |
252 | .type = CX88_VMUX_COMPOSITE1, | 282 | .type = CX88_VMUX_COMPOSITE1, |
253 | .vmux = 1, | 283 | .vmux = 1, |
254 | .gpio0 = 0x0000bde6, | 284 | .gpio0 = 0x0000bde6, |
255 | },{ | 285 | },{ |
256 | .type = CX88_VMUX_SVIDEO, | 286 | .type = CX88_VMUX_SVIDEO, |
257 | .vmux = 2, | 287 | .vmux = 2, |
258 | .gpio0 = 0x0000bde6, | 288 | .gpio0 = 0x0000bde6, |
259 | }}, | 289 | }}, |
260 | .radio = { | 290 | .radio = { |
261 | .type = CX88_RADIO, | 291 | .type = CX88_RADIO, |
262 | .gpio0 = 0x0000bd62, | 292 | .gpio0 = 0x0000bd62, |
263 | }, | 293 | }, |
264 | .blackbird = 1, | 294 | .blackbird = 1, |
265 | }, | 295 | }, |
266 | [CX88_BOARD_IODATA_GVVCP3PCI] = { | 296 | [CX88_BOARD_IODATA_GVVCP3PCI] = { |
267 | .name = "IODATA GV-VCP3/PCI", | 297 | .name = "IODATA GV-VCP3/PCI", |
268 | .tuner_type = TUNER_ABSENT, | 298 | .tuner_type = TUNER_ABSENT, |
269 | .input = {{ | 299 | .radio_type = UNSET, |
300 | .tuner_addr = ADDR_UNSET, | ||
301 | .radio_addr = ADDR_UNSET, | ||
302 | .input = {{ | ||
270 | .type = CX88_VMUX_COMPOSITE1, | 303 | .type = CX88_VMUX_COMPOSITE1, |
271 | .vmux = 0, | 304 | .vmux = 0, |
272 | },{ | 305 | },{ |
@@ -279,7 +312,10 @@ struct cx88_board cx88_boards[] = { | |||
279 | }, | 312 | }, |
280 | [CX88_BOARD_PROLINK_PLAYTVPVR] = { | 313 | [CX88_BOARD_PROLINK_PLAYTVPVR] = { |
281 | .name = "Prolink PlayTV PVR", | 314 | .name = "Prolink PlayTV PVR", |
282 | .tuner_type = 43, | 315 | .tuner_type = TUNER_PHILIPS_FM1236_MK3, |
316 | .radio_type = UNSET, | ||
317 | .tuner_addr = ADDR_UNSET, | ||
318 | .radio_addr = ADDR_UNSET, | ||
283 | .tda9887_conf = TDA9887_PRESENT, | 319 | .tda9887_conf = TDA9887_PRESENT, |
284 | .input = {{ | 320 | .input = {{ |
285 | .type = CX88_VMUX_TELEVISION, | 321 | .type = CX88_VMUX_TELEVISION, |
@@ -301,8 +337,11 @@ struct cx88_board cx88_boards[] = { | |||
301 | }, | 337 | }, |
302 | [CX88_BOARD_ASUS_PVR_416] = { | 338 | [CX88_BOARD_ASUS_PVR_416] = { |
303 | .name = "ASUS PVR-416", | 339 | .name = "ASUS PVR-416", |
304 | .tuner_type = 43, | 340 | .tuner_type = TUNER_PHILIPS_FM1236_MK3, |
305 | .tda9887_conf = TDA9887_PRESENT, | 341 | .radio_type = UNSET, |
342 | .tuner_addr = ADDR_UNSET, | ||
343 | .radio_addr = ADDR_UNSET, | ||
344 | .tda9887_conf = TDA9887_PRESENT, | ||
306 | .input = {{ | 345 | .input = {{ |
307 | .type = CX88_VMUX_TELEVISION, | 346 | .type = CX88_VMUX_TELEVISION, |
308 | .vmux = 0, | 347 | .vmux = 0, |
@@ -320,7 +359,10 @@ struct cx88_board cx88_boards[] = { | |||
320 | }, | 359 | }, |
321 | [CX88_BOARD_MSI_TVANYWHERE] = { | 360 | [CX88_BOARD_MSI_TVANYWHERE] = { |
322 | .name = "MSI TV-@nywhere", | 361 | .name = "MSI TV-@nywhere", |
323 | .tuner_type = 33, | 362 | .tuner_type = TUNER_MT2032, |
363 | .radio_type = UNSET, | ||
364 | .tuner_addr = ADDR_UNSET, | ||
365 | .radio_addr = ADDR_UNSET, | ||
324 | .tda9887_conf = TDA9887_PRESENT, | 366 | .tda9887_conf = TDA9887_PRESENT, |
325 | .input = {{ | 367 | .input = {{ |
326 | .type = CX88_VMUX_TELEVISION, | 368 | .type = CX88_VMUX_TELEVISION, |
@@ -342,6 +384,9 @@ struct cx88_board cx88_boards[] = { | |||
342 | [CX88_BOARD_KWORLD_DVB_T] = { | 384 | [CX88_BOARD_KWORLD_DVB_T] = { |
343 | .name = "KWorld/VStream XPert DVB-T", | 385 | .name = "KWorld/VStream XPert DVB-T", |
344 | .tuner_type = TUNER_ABSENT, | 386 | .tuner_type = TUNER_ABSENT, |
387 | .radio_type = UNSET, | ||
388 | .tuner_addr = ADDR_UNSET, | ||
389 | .radio_addr = ADDR_UNSET, | ||
345 | .input = {{ | 390 | .input = {{ |
346 | .type = CX88_VMUX_COMPOSITE1, | 391 | .type = CX88_VMUX_COMPOSITE1, |
347 | .vmux = 1, | 392 | .vmux = 1, |
@@ -358,6 +403,9 @@ struct cx88_board cx88_boards[] = { | |||
358 | [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1] = { | 403 | [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1] = { |
359 | .name = "DVICO FusionHDTV DVB-T1", | 404 | .name = "DVICO FusionHDTV DVB-T1", |
360 | .tuner_type = TUNER_ABSENT, /* No analog tuner */ | 405 | .tuner_type = TUNER_ABSENT, /* No analog tuner */ |
406 | .radio_type = UNSET, | ||
407 | .tuner_addr = ADDR_UNSET, | ||
408 | .radio_addr = ADDR_UNSET, | ||
361 | .input = {{ | 409 | .input = {{ |
362 | .type = CX88_VMUX_COMPOSITE1, | 410 | .type = CX88_VMUX_COMPOSITE1, |
363 | .vmux = 1, | 411 | .vmux = 1, |
@@ -371,7 +419,10 @@ struct cx88_board cx88_boards[] = { | |||
371 | }, | 419 | }, |
372 | [CX88_BOARD_KWORLD_LTV883] = { | 420 | [CX88_BOARD_KWORLD_LTV883] = { |
373 | .name = "KWorld LTV883RF", | 421 | .name = "KWorld LTV883RF", |
374 | .tuner_type = 48, | 422 | .tuner_type = TUNER_TNF_8831BGFF, |
423 | .radio_type = UNSET, | ||
424 | .tuner_addr = ADDR_UNSET, | ||
425 | .radio_addr = ADDR_UNSET, | ||
375 | .input = {{ | 426 | .input = {{ |
376 | .type = CX88_VMUX_TELEVISION, | 427 | .type = CX88_VMUX_TELEVISION, |
377 | .vmux = 0, | 428 | .vmux = 0, |
@@ -397,6 +448,9 @@ struct cx88_board cx88_boards[] = { | |||
397 | [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD] = { | 448 | [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD] = { |
398 | .name = "DViCO - FusionHDTV 3 Gold", | 449 | .name = "DViCO - FusionHDTV 3 Gold", |
399 | .tuner_type = TUNER_MICROTUNE_4042FI5, | 450 | .tuner_type = TUNER_MICROTUNE_4042FI5, |
451 | .radio_type = UNSET, | ||
452 | .tuner_addr = ADDR_UNSET, | ||
453 | .radio_addr = ADDR_UNSET, | ||
400 | /* | 454 | /* |
401 | GPIO[0] resets DT3302 DTV receiver | 455 | GPIO[0] resets DT3302 DTV receiver |
402 | 0 - reset asserted | 456 | 0 - reset asserted |
@@ -428,17 +482,14 @@ struct cx88_board cx88_boards[] = { | |||
428 | .vmux = 2, | 482 | .vmux = 2, |
429 | .gpio0 = 0x0f00, | 483 | .gpio0 = 0x0f00, |
430 | }}, | 484 | }}, |
431 | #if 0 | ||
432 | .ts = { | ||
433 | .type = CX88_TS, | ||
434 | .gpio0 = 0x00000f01, /* Hooked to tuner reset bit */ | ||
435 | } | ||
436 | #endif | ||
437 | }, | 485 | }, |
438 | [CX88_BOARD_HAUPPAUGE_DVB_T1] = { | 486 | [CX88_BOARD_HAUPPAUGE_DVB_T1] = { |
439 | .name = "Hauppauge Nova-T DVB-T", | 487 | .name = "Hauppauge Nova-T DVB-T", |
440 | .tuner_type = TUNER_ABSENT, | 488 | .tuner_type = TUNER_ABSENT, |
441 | .input = {{ | 489 | .radio_type = UNSET, |
490 | .tuner_addr = ADDR_UNSET, | ||
491 | .radio_addr = ADDR_UNSET, | ||
492 | .input = {{ | ||
442 | .type = CX88_VMUX_DVB, | 493 | .type = CX88_VMUX_DVB, |
443 | .vmux = 0, | 494 | .vmux = 0, |
444 | }}, | 495 | }}, |
@@ -447,6 +498,9 @@ struct cx88_board cx88_boards[] = { | |||
447 | [CX88_BOARD_CONEXANT_DVB_T1] = { | 498 | [CX88_BOARD_CONEXANT_DVB_T1] = { |
448 | .name = "Conexant DVB-T reference design", | 499 | .name = "Conexant DVB-T reference design", |
449 | .tuner_type = TUNER_ABSENT, | 500 | .tuner_type = TUNER_ABSENT, |
501 | .radio_type = UNSET, | ||
502 | .tuner_addr = ADDR_UNSET, | ||
503 | .radio_addr = ADDR_UNSET, | ||
450 | .input = {{ | 504 | .input = {{ |
451 | .type = CX88_VMUX_DVB, | 505 | .type = CX88_VMUX_DVB, |
452 | .vmux = 0, | 506 | .vmux = 0, |
@@ -456,6 +510,9 @@ struct cx88_board cx88_boards[] = { | |||
456 | [CX88_BOARD_PROVIDEO_PV259] = { | 510 | [CX88_BOARD_PROVIDEO_PV259] = { |
457 | .name = "Provideo PV259", | 511 | .name = "Provideo PV259", |
458 | .tuner_type = TUNER_PHILIPS_FQ1216ME, | 512 | .tuner_type = TUNER_PHILIPS_FQ1216ME, |
513 | .radio_type = UNSET, | ||
514 | .tuner_addr = ADDR_UNSET, | ||
515 | .radio_addr = ADDR_UNSET, | ||
459 | .input = {{ | 516 | .input = {{ |
460 | .type = CX88_VMUX_TELEVISION, | 517 | .type = CX88_VMUX_TELEVISION, |
461 | .vmux = 0, | 518 | .vmux = 0, |
@@ -465,6 +522,9 @@ struct cx88_board cx88_boards[] = { | |||
465 | [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS] = { | 522 | [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS] = { |
466 | .name = "DVICO FusionHDTV DVB-T Plus", | 523 | .name = "DVICO FusionHDTV DVB-T Plus", |
467 | .tuner_type = TUNER_ABSENT, /* No analog tuner */ | 524 | .tuner_type = TUNER_ABSENT, /* No analog tuner */ |
525 | .radio_type = UNSET, | ||
526 | .tuner_addr = ADDR_UNSET, | ||
527 | .radio_addr = ADDR_UNSET, | ||
468 | .input = {{ | 528 | .input = {{ |
469 | .type = CX88_VMUX_COMPOSITE1, | 529 | .type = CX88_VMUX_COMPOSITE1, |
470 | .vmux = 1, | 530 | .vmux = 1, |
@@ -479,6 +539,9 @@ struct cx88_board cx88_boards[] = { | |||
479 | [CX88_BOARD_DNTV_LIVE_DVB_T] = { | 539 | [CX88_BOARD_DNTV_LIVE_DVB_T] = { |
480 | .name = "digitalnow DNTV Live! DVB-T", | 540 | .name = "digitalnow DNTV Live! DVB-T", |
481 | .tuner_type = TUNER_ABSENT, | 541 | .tuner_type = TUNER_ABSENT, |
542 | .radio_type = UNSET, | ||
543 | .tuner_addr = ADDR_UNSET, | ||
544 | .radio_addr = ADDR_UNSET, | ||
482 | .input = {{ | 545 | .input = {{ |
483 | .type = CX88_VMUX_COMPOSITE1, | 546 | .type = CX88_VMUX_COMPOSITE1, |
484 | .vmux = 1, | 547 | .vmux = 1, |
@@ -495,6 +558,9 @@ struct cx88_board cx88_boards[] = { | |||
495 | [CX88_BOARD_PCHDTV_HD3000] = { | 558 | [CX88_BOARD_PCHDTV_HD3000] = { |
496 | .name = "pcHDTV HD3000 HDTV", | 559 | .name = "pcHDTV HD3000 HDTV", |
497 | .tuner_type = TUNER_THOMSON_DTT7610, | 560 | .tuner_type = TUNER_THOMSON_DTT7610, |
561 | .radio_type = UNSET, | ||
562 | .tuner_addr = ADDR_UNSET, | ||
563 | .radio_addr = ADDR_UNSET, | ||
498 | .input = {{ | 564 | .input = {{ |
499 | .type = CX88_VMUX_TELEVISION, | 565 | .type = CX88_VMUX_TELEVISION, |
500 | .vmux = 0, | 566 | .vmux = 0, |
@@ -530,8 +596,11 @@ struct cx88_board cx88_boards[] = { | |||
530 | [CX88_BOARD_HAUPPAUGE_ROSLYN] = { | 596 | [CX88_BOARD_HAUPPAUGE_ROSLYN] = { |
531 | // entry added by Kaustubh D. Bhalerao <bhalerao.1@osu.edu> | 597 | // entry added by Kaustubh D. Bhalerao <bhalerao.1@osu.edu> |
532 | // GPIO values obtained from regspy, courtesy Sean Covel | 598 | // GPIO values obtained from regspy, courtesy Sean Covel |
533 | .name = "Hauppauge WinTV 28xxx (Roslyn) models", | 599 | .name = "Hauppauge WinTV 28xxx (Roslyn) models", |
534 | .tuner_type = UNSET, | 600 | .tuner_type = UNSET, |
601 | .radio_type = UNSET, | ||
602 | .tuner_addr = ADDR_UNSET, | ||
603 | .radio_addr = ADDR_UNSET, | ||
535 | .input = {{ | 604 | .input = {{ |
536 | .type = CX88_VMUX_TELEVISION, | 605 | .type = CX88_VMUX_TELEVISION, |
537 | .vmux = 0, | 606 | .vmux = 0, |
@@ -559,33 +628,37 @@ struct cx88_board cx88_boards[] = { | |||
559 | .blackbird = 1, | 628 | .blackbird = 1, |
560 | }, | 629 | }, |
561 | [CX88_BOARD_DIGITALLOGIC_MEC] = { | 630 | [CX88_BOARD_DIGITALLOGIC_MEC] = { |
562 | /* params copied over from Leadtek PVR 2000 */ | ||
563 | .name = "Digital-Logic MICROSPACE Entertainment Center (MEC)", | 631 | .name = "Digital-Logic MICROSPACE Entertainment Center (MEC)", |
564 | /* not sure yet about the tuner type */ | 632 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, |
565 | .tuner_type = 38, | 633 | .radio_type = UNSET, |
634 | .tuner_addr = ADDR_UNSET, | ||
635 | .radio_addr = ADDR_UNSET, | ||
566 | .tda9887_conf = TDA9887_PRESENT, | 636 | .tda9887_conf = TDA9887_PRESENT, |
567 | .input = {{ | 637 | .input = {{ |
568 | .type = CX88_VMUX_TELEVISION, | 638 | .type = CX88_VMUX_TELEVISION, |
569 | .vmux = 0, | 639 | .vmux = 0, |
570 | .gpio0 = 0x0000bde6, | 640 | .gpio0 = 0x00009d80, |
571 | },{ | 641 | },{ |
572 | .type = CX88_VMUX_COMPOSITE1, | 642 | .type = CX88_VMUX_COMPOSITE1, |
573 | .vmux = 1, | 643 | .vmux = 1, |
574 | .gpio0 = 0x0000bde6, | 644 | .gpio0 = 0x00009d76, |
575 | },{ | 645 | },{ |
576 | .type = CX88_VMUX_SVIDEO, | 646 | .type = CX88_VMUX_SVIDEO, |
577 | .vmux = 2, | 647 | .vmux = 2, |
578 | .gpio0 = 0x0000bde6, | 648 | .gpio0 = 0x00009d76, |
579 | }}, | 649 | }}, |
580 | .radio = { | 650 | .radio = { |
581 | .type = CX88_RADIO, | 651 | .type = CX88_RADIO, |
582 | .gpio0 = 0x0000bd62, | 652 | .gpio0 = 0x00009d00, |
583 | }, | 653 | }, |
584 | .blackbird = 1, | 654 | .blackbird = 1, |
585 | }, | 655 | }, |
586 | [CX88_BOARD_IODATA_GVBCTV7E] = { | 656 | [CX88_BOARD_IODATA_GVBCTV7E] = { |
587 | .name = "IODATA GV/BCTV7E", | 657 | .name = "IODATA GV/BCTV7E", |
588 | .tuner_type = TUNER_PHILIPS_FQ1286, | 658 | .tuner_type = TUNER_PHILIPS_FQ1286, |
659 | .radio_type = UNSET, | ||
660 | .tuner_addr = ADDR_UNSET, | ||
661 | .radio_addr = ADDR_UNSET, | ||
589 | .tda9887_conf = TDA9887_PRESENT, | 662 | .tda9887_conf = TDA9887_PRESENT, |
590 | .input = {{ | 663 | .input = {{ |
591 | .type = CX88_VMUX_TELEVISION, | 664 | .type = CX88_VMUX_TELEVISION, |
@@ -601,6 +674,56 @@ struct cx88_board cx88_boards[] = { | |||
601 | .gpio1 = 0x0000e07f, | 674 | .gpio1 = 0x0000e07f, |
602 | }} | 675 | }} |
603 | }, | 676 | }, |
677 | [CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO] = { | ||
678 | .name = "PixelView PlayTV Ultra Pro (Stereo)", | ||
679 | /* May be also TUNER_YMEC_TVF_5533MF for NTSC/M or PAL/M */ | ||
680 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, | ||
681 | .radio_type = TUNER_TEA5767, | ||
682 | .tuner_addr = 0xc2>>1, | ||
683 | .radio_addr = 0xc0>>1, | ||
684 | .input = {{ | ||
685 | .type = CX88_VMUX_TELEVISION, | ||
686 | .vmux = 0, | ||
687 | .gpio0 = 0xbf61, /* internal decoder */ | ||
688 | },{ | ||
689 | .type = CX88_VMUX_COMPOSITE1, | ||
690 | .vmux = 1, | ||
691 | .gpio0 = 0xbf63, | ||
692 | },{ | ||
693 | .type = CX88_VMUX_SVIDEO, | ||
694 | .vmux = 2, | ||
695 | .gpio0 = 0xbf63, | ||
696 | }}, | ||
697 | .radio = { | ||
698 | .type = CX88_RADIO, | ||
699 | .gpio0 = 0xbf60, | ||
700 | }, | ||
701 | }, | ||
702 | [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T] = { | ||
703 | .name = "DViCO - FusionHDTV 3 Gold-T", | ||
704 | .tuner_type = TUNER_THOMSON_DTT7611, | ||
705 | .radio_type = UNSET, | ||
706 | .tuner_addr = ADDR_UNSET, | ||
707 | .radio_addr = ADDR_UNSET, | ||
708 | /* See DViCO FusionHDTV 3 Gold for GPIO documentation. */ | ||
709 | .input = {{ | ||
710 | .type = CX88_VMUX_TELEVISION, | ||
711 | .vmux = 0, | ||
712 | .gpio0 = 0x0f0d, | ||
713 | },{ | ||
714 | .type = CX88_VMUX_CABLE, | ||
715 | .vmux = 0, | ||
716 | .gpio0 = 0x0f05, | ||
717 | },{ | ||
718 | .type = CX88_VMUX_COMPOSITE1, | ||
719 | .vmux = 1, | ||
720 | .gpio0 = 0x0f00, | ||
721 | },{ | ||
722 | .type = CX88_VMUX_SVIDEO, | ||
723 | .vmux = 2, | ||
724 | .gpio0 = 0x0f00, | ||
725 | }}, | ||
726 | }, | ||
604 | }; | 727 | }; |
605 | const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); | 728 | const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); |
606 | 729 | ||
@@ -673,6 +796,10 @@ struct cx88_subid cx88_subids[] = { | |||
673 | .subdevice = 0xd810, | 796 | .subdevice = 0xd810, |
674 | .card = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD, | 797 | .card = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD, |
675 | },{ | 798 | },{ |
799 | .subvendor = 0x18ac, | ||
800 | .subdevice = 0xd820, | ||
801 | .card = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T, | ||
802 | },{ | ||
676 | .subvendor = 0x18AC, | 803 | .subvendor = 0x18AC, |
677 | .subdevice = 0xDB00, | 804 | .subdevice = 0xDB00, |
678 | .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1, | 805 | .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1, |
@@ -935,4 +1062,5 @@ EXPORT_SYMBOL(cx88_card_setup); | |||
935 | * Local variables: | 1062 | * Local variables: |
936 | * c-basic-offset: 8 | 1063 | * c-basic-offset: 8 |
937 | * End: | 1064 | * End: |
1065 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
938 | */ | 1066 | */ |
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 1ff79b5a8835..c046a23537d3 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-core.c,v 1.24 2005/01/19 12:01:55 kraxel Exp $ | 2 | * $Id: cx88-core.c,v 1.28 2005/06/12 04:19:19 mchehab Exp $ |
3 | * | 3 | * |
4 | * device driver for Conexant 2388x based TV cards | 4 | * device driver for Conexant 2388x based TV cards |
5 | * driver core | 5 | * driver core |
@@ -51,12 +51,15 @@ module_param(latency,int,0444); | |||
51 | MODULE_PARM_DESC(latency,"pci latency timer"); | 51 | MODULE_PARM_DESC(latency,"pci latency timer"); |
52 | 52 | ||
53 | static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; | 53 | static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; |
54 | static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; | ||
54 | static unsigned int card[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; | 55 | static unsigned int card[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; |
55 | 56 | ||
56 | module_param_array(tuner, int, NULL, 0444); | 57 | module_param_array(tuner, int, NULL, 0444); |
58 | module_param_array(radio, int, NULL, 0444); | ||
57 | module_param_array(card, int, NULL, 0444); | 59 | module_param_array(card, int, NULL, 0444); |
58 | 60 | ||
59 | MODULE_PARM_DESC(tuner,"tuner type"); | 61 | MODULE_PARM_DESC(tuner,"tuner type"); |
62 | MODULE_PARM_DESC(radio,"radio tuner type"); | ||
60 | MODULE_PARM_DESC(card,"card type"); | 63 | MODULE_PARM_DESC(card,"card type"); |
61 | 64 | ||
62 | static unsigned int nicam = 0; | 65 | static unsigned int nicam = 0; |
@@ -429,7 +432,7 @@ int cx88_sram_channel_setup(struct cx88_core *core, | |||
429 | /* ------------------------------------------------------------------ */ | 432 | /* ------------------------------------------------------------------ */ |
430 | /* debug helper code */ | 433 | /* debug helper code */ |
431 | 434 | ||
432 | static int cx88_risc_decode(u32 risc) | 435 | int cx88_risc_decode(u32 risc) |
433 | { | 436 | { |
434 | static char *instr[16] = { | 437 | static char *instr[16] = { |
435 | [ RISC_SYNC >> 28 ] = "sync", | 438 | [ RISC_SYNC >> 28 ] = "sync", |
@@ -736,6 +739,10 @@ static unsigned int inline norm_fsc8(struct cx88_tvnorm *norm) | |||
736 | { | 739 | { |
737 | static const unsigned int ntsc = 28636360; | 740 | static const unsigned int ntsc = 28636360; |
738 | static const unsigned int pal = 35468950; | 741 | static const unsigned int pal = 35468950; |
742 | static const unsigned int palm = 28604892; | ||
743 | |||
744 | if (norm->id & V4L2_STD_PAL_M) | ||
745 | return palm; | ||
739 | 746 | ||
740 | return (norm->id & V4L2_STD_625_50) ? pal : ntsc; | 747 | return (norm->id & V4L2_STD_625_50) ? pal : ntsc; |
741 | } | 748 | } |
@@ -749,6 +756,11 @@ static unsigned int inline norm_notchfilter(struct cx88_tvnorm *norm) | |||
749 | 756 | ||
750 | static unsigned int inline norm_htotal(struct cx88_tvnorm *norm) | 757 | static unsigned int inline norm_htotal(struct cx88_tvnorm *norm) |
751 | { | 758 | { |
759 | /* Should always be Line Draw Time / (4*FSC) */ | ||
760 | |||
761 | if (norm->id & V4L2_STD_PAL_M) | ||
762 | return 909; | ||
763 | |||
752 | return (norm->id & V4L2_STD_625_50) ? 1135 : 910; | 764 | return (norm->id & V4L2_STD_625_50) ? 1135 : 910; |
753 | } | 765 | } |
754 | 766 | ||
@@ -1164,8 +1176,20 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) | |||
1164 | "insmod option" : "autodetected"); | 1176 | "insmod option" : "autodetected"); |
1165 | 1177 | ||
1166 | core->tuner_type = tuner[core->nr]; | 1178 | core->tuner_type = tuner[core->nr]; |
1179 | core->radio_type = radio[core->nr]; | ||
1167 | if (UNSET == core->tuner_type) | 1180 | if (UNSET == core->tuner_type) |
1168 | core->tuner_type = cx88_boards[core->board].tuner_type; | 1181 | core->tuner_type = cx88_boards[core->board].tuner_type; |
1182 | if (UNSET == core->radio_type) | ||
1183 | core->radio_type = cx88_boards[core->board].radio_type; | ||
1184 | if (!core->tuner_addr) | ||
1185 | core->tuner_addr = cx88_boards[core->board].tuner_addr; | ||
1186 | if (!core->radio_addr) | ||
1187 | core->radio_addr = cx88_boards[core->board].radio_addr; | ||
1188 | |||
1189 | printk(KERN_INFO "TV tuner %d at 0x%02x, Radio tuner %d at 0x%02x\n", | ||
1190 | core->tuner_type, core->tuner_addr<<1, | ||
1191 | core->radio_type, core->radio_addr<<1); | ||
1192 | |||
1169 | core->tda9887_conf = cx88_boards[core->board].tda9887_conf; | 1193 | core->tda9887_conf = cx88_boards[core->board].tda9887_conf; |
1170 | 1194 | ||
1171 | /* init hardware */ | 1195 | /* init hardware */ |
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 9d15d3d5a2b7..1a259c3966cd 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-dvb.c,v 1.31 2005/03/07 15:58:05 kraxel Exp $ | 2 | * $Id: cx88-dvb.c,v 1.33 2005/06/12 04:19:19 mchehab Exp $ |
3 | * | 3 | * |
4 | * device driver for Conexant 2388x based TV cards | 4 | * device driver for Conexant 2388x based TV cards |
5 | * MPEG Transport Stream (DVB) routines | 5 | * MPEG Transport Stream (DVB) routines |
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c index 0725b1288f4f..e20adefcfc6c 100644 --- a/drivers/media/video/cx88/cx88-i2c.c +++ b/drivers/media/video/cx88/cx88-i2c.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: cx88-i2c.c,v 1.20 2005/02/15 15:59:35 kraxel Exp $ | 2 | $Id: cx88-i2c.c,v 1.23 2005/06/12 04:19:19 mchehab Exp $ |
3 | 3 | ||
4 | cx88-i2c.c -- all the i2c code is here | 4 | cx88-i2c.c -- all the i2c code is here |
5 | 5 | ||
@@ -91,6 +91,7 @@ static int cx8800_bit_getsda(void *data) | |||
91 | 91 | ||
92 | static int attach_inform(struct i2c_client *client) | 92 | static int attach_inform(struct i2c_client *client) |
93 | { | 93 | { |
94 | struct tuner_addr tun_addr; | ||
94 | struct cx88_core *core = i2c_get_adapdata(client->adapter); | 95 | struct cx88_core *core = i2c_get_adapdata(client->adapter); |
95 | 96 | ||
96 | dprintk(1, "i2c attach [addr=0x%x,client=%s]\n", | 97 | dprintk(1, "i2c attach [addr=0x%x,client=%s]\n", |
@@ -98,8 +99,19 @@ static int attach_inform(struct i2c_client *client) | |||
98 | if (!client->driver->command) | 99 | if (!client->driver->command) |
99 | return 0; | 100 | return 0; |
100 | 101 | ||
101 | if (core->tuner_type != UNSET) | 102 | if (core->radio_type != UNSET) { |
102 | client->driver->command(client, TUNER_SET_TYPE, &core->tuner_type); | 103 | tun_addr.v4l2_tuner = V4L2_TUNER_RADIO; |
104 | tun_addr.type = core->radio_type; | ||
105 | tun_addr.addr = core->radio_addr; | ||
106 | client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr); | ||
107 | } | ||
108 | if (core->tuner_type != UNSET) { | ||
109 | tun_addr.v4l2_tuner = V4L2_TUNER_ANALOG_TV; | ||
110 | tun_addr.type = core->tuner_type; | ||
111 | tun_addr.addr = core->tuner_addr; | ||
112 | client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr); | ||
113 | } | ||
114 | |||
103 | if (core->tda9887_conf) | 115 | if (core->tda9887_conf) |
104 | client->driver->command(client, TDA9887_SET_CONFIG, &core->tda9887_conf); | 116 | client->driver->command(client, TDA9887_SET_CONFIG, &core->tda9887_conf); |
105 | return 0; | 117 | return 0; |
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index af6ad8cdbdb7..dc0dcf249aac 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-input.c,v 1.9 2005/03/04 09:12:23 kraxel Exp $ | 2 | * $Id: cx88-input.c,v 1.11 2005/05/22 20:57:56 nsh Exp $ |
3 | * | 3 | * |
4 | * Device driver for GPIO attached remote control interfaces | 4 | * Device driver for GPIO attached remote control interfaces |
5 | * on Conexant 2388x based TV/DVB cards. | 5 | * on Conexant 2388x based TV/DVB cards. |
@@ -235,6 +235,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
235 | /* detect & configure */ | 235 | /* detect & configure */ |
236 | switch (core->board) { | 236 | switch (core->board) { |
237 | case CX88_BOARD_DNTV_LIVE_DVB_T: | 237 | case CX88_BOARD_DNTV_LIVE_DVB_T: |
238 | case CX88_BOARD_KWORLD_DVB_T: | ||
238 | ir_codes = ir_codes_dntv_live_dvb_t; | 239 | ir_codes = ir_codes_dntv_live_dvb_t; |
239 | ir->gpio_addr = MO_GP1_IO; | 240 | ir->gpio_addr = MO_GP1_IO; |
240 | ir->mask_keycode = 0x1f; | 241 | ir->mask_keycode = 0x1f; |
@@ -261,7 +262,15 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) | |||
261 | ir->mask_keydown = 0x02; | 262 | ir->mask_keydown = 0x02; |
262 | ir->polling = 5; // ms | 263 | ir->polling = 5; // ms |
263 | break; | 264 | break; |
265 | case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO: | ||
266 | ir_codes = ir_codes_pixelview; | ||
267 | ir->gpio_addr = MO_GP1_IO; | ||
268 | ir->mask_keycode = 0x1f; | ||
269 | ir->mask_keyup = 0x80; | ||
270 | ir->polling = 1; // ms | ||
271 | break; | ||
264 | } | 272 | } |
273 | |||
265 | if (NULL == ir_codes) { | 274 | if (NULL == ir_codes) { |
266 | kfree(ir); | 275 | kfree(ir); |
267 | return -ENODEV; | 276 | return -ENODEV; |
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index 07aae1899e17..9ade2ae91e9b 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-mpeg.c,v 1.25 2005/03/07 14:18:00 kraxel Exp $ | 2 | * $Id: cx88-mpeg.c,v 1.26 2005/06/03 13:31:51 mchehab Exp $ |
3 | * | 3 | * |
4 | * Support for the mpeg transport stream transfers | 4 | * Support for the mpeg transport stream transfers |
5 | * PCI function #2 of the cx2388x. | 5 | * PCI function #2 of the cx2388x. |
@@ -55,7 +55,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev, | |||
55 | { | 55 | { |
56 | struct cx88_core *core = dev->core; | 56 | struct cx88_core *core = dev->core; |
57 | 57 | ||
58 | dprintk(1, "cx8802_start_mpegport_dma %d\n", buf->vb.width); | 58 | dprintk(0, "cx8802_start_dma %d\n", buf->vb.width); |
59 | 59 | ||
60 | /* setup fifo + format */ | 60 | /* setup fifo + format */ |
61 | cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH28], | 61 | cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH28], |
@@ -100,18 +100,21 @@ static int cx8802_start_dma(struct cx8802_dev *dev, | |||
100 | q->count = 1; | 100 | q->count = 1; |
101 | 101 | ||
102 | /* enable irqs */ | 102 | /* enable irqs */ |
103 | dprintk( 0, "setting the interrupt mask\n" ); | ||
103 | cx_set(MO_PCI_INTMSK, core->pci_irqmask | 0x04); | 104 | cx_set(MO_PCI_INTMSK, core->pci_irqmask | 0x04); |
104 | cx_write(MO_TS_INTMSK, 0x1f0011); | 105 | cx_set(MO_TS_INTMSK, 0x1f0011); |
106 | //cx_write(MO_TS_INTMSK, 0x0f0011); | ||
105 | 107 | ||
106 | /* start dma */ | 108 | /* start dma */ |
107 | cx_write(MO_DEV_CNTRL2, (1<<5)); /* FIXME: s/write/set/ ??? */ | 109 | cx_set(MO_DEV_CNTRL2, (1<<5)); |
108 | cx_write(MO_TS_DMACNTRL, 0x11); | 110 | cx_set(MO_TS_DMACNTRL, 0x11); |
109 | return 0; | 111 | return 0; |
110 | } | 112 | } |
111 | 113 | ||
112 | static int cx8802_stop_dma(struct cx8802_dev *dev) | 114 | static int cx8802_stop_dma(struct cx8802_dev *dev) |
113 | { | 115 | { |
114 | struct cx88_core *core = dev->core; | 116 | struct cx88_core *core = dev->core; |
117 | dprintk( 0, "cx8802_stop_dma\n" ); | ||
115 | 118 | ||
116 | /* stop dma */ | 119 | /* stop dma */ |
117 | cx_clear(MO_TS_DMACNTRL, 0x11); | 120 | cx_clear(MO_TS_DMACNTRL, 0x11); |
@@ -131,8 +134,12 @@ static int cx8802_restart_queue(struct cx8802_dev *dev, | |||
131 | struct cx88_buffer *buf; | 134 | struct cx88_buffer *buf; |
132 | struct list_head *item; | 135 | struct list_head *item; |
133 | 136 | ||
137 | dprintk( 0, "cx8802_restart_queue\n" ); | ||
134 | if (list_empty(&q->active)) | 138 | if (list_empty(&q->active)) |
139 | { | ||
140 | dprintk( 0, "cx8802_restart_queue: queue is empty\n" ); | ||
135 | return 0; | 141 | return 0; |
142 | } | ||
136 | 143 | ||
137 | buf = list_entry(q->active.next, struct cx88_buffer, vb.queue); | 144 | buf = list_entry(q->active.next, struct cx88_buffer, vb.queue); |
138 | dprintk(2,"restart_queue [%p/%d]: restart dma\n", | 145 | dprintk(2,"restart_queue [%p/%d]: restart dma\n", |
@@ -182,27 +189,32 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf) | |||
182 | struct cx88_buffer *prev; | 189 | struct cx88_buffer *prev; |
183 | struct cx88_dmaqueue *q = &dev->mpegq; | 190 | struct cx88_dmaqueue *q = &dev->mpegq; |
184 | 191 | ||
192 | dprintk( 1, "cx8802_buf_queue\n" ); | ||
185 | /* add jump to stopper */ | 193 | /* add jump to stopper */ |
186 | buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC); | 194 | buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC); |
187 | buf->risc.jmp[1] = cpu_to_le32(q->stopper.dma); | 195 | buf->risc.jmp[1] = cpu_to_le32(q->stopper.dma); |
188 | 196 | ||
189 | if (list_empty(&q->active)) { | 197 | if (list_empty(&q->active)) { |
198 | dprintk( 0, "queue is empty - first active\n" ); | ||
190 | list_add_tail(&buf->vb.queue,&q->active); | 199 | list_add_tail(&buf->vb.queue,&q->active); |
191 | cx8802_start_dma(dev, q, buf); | 200 | cx8802_start_dma(dev, q, buf); |
192 | buf->vb.state = STATE_ACTIVE; | 201 | buf->vb.state = STATE_ACTIVE; |
193 | buf->count = q->count++; | 202 | buf->count = q->count++; |
194 | mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); | 203 | mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); |
195 | dprintk(2,"[%p/%d] %s - first active\n", | 204 | dprintk(0,"[%p/%d] %s - first active\n", |
196 | buf, buf->vb.i, __FUNCTION__); | 205 | buf, buf->vb.i, __FUNCTION__); |
206 | //udelay(100); | ||
197 | 207 | ||
198 | } else { | 208 | } else { |
209 | dprintk( 1, "queue is not empty - append to active\n" ); | ||
199 | prev = list_entry(q->active.prev, struct cx88_buffer, vb.queue); | 210 | prev = list_entry(q->active.prev, struct cx88_buffer, vb.queue); |
200 | list_add_tail(&buf->vb.queue,&q->active); | 211 | list_add_tail(&buf->vb.queue,&q->active); |
201 | buf->vb.state = STATE_ACTIVE; | 212 | buf->vb.state = STATE_ACTIVE; |
202 | buf->count = q->count++; | 213 | buf->count = q->count++; |
203 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); | 214 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); |
204 | dprintk(2,"[%p/%d] %s - append to active\n", | 215 | dprintk( 1, "[%p/%d] %s - append to active\n", |
205 | buf, buf->vb.i, __FUNCTION__); | 216 | buf, buf->vb.i, __FUNCTION__); |
217 | //udelay(100); | ||
206 | } | 218 | } |
207 | } | 219 | } |
208 | 220 | ||
@@ -224,7 +236,10 @@ static void do_cancel_buffers(struct cx8802_dev *dev, char *reason, int restart) | |||
224 | buf, buf->vb.i, reason, (unsigned long)buf->risc.dma); | 236 | buf, buf->vb.i, reason, (unsigned long)buf->risc.dma); |
225 | } | 237 | } |
226 | if (restart) | 238 | if (restart) |
239 | { | ||
240 | dprintk(0, "restarting queue\n" ); | ||
227 | cx8802_restart_queue(dev,q); | 241 | cx8802_restart_queue(dev,q); |
242 | } | ||
228 | spin_unlock_irqrestore(&dev->slock,flags); | 243 | spin_unlock_irqrestore(&dev->slock,flags); |
229 | } | 244 | } |
230 | 245 | ||
@@ -232,6 +247,7 @@ void cx8802_cancel_buffers(struct cx8802_dev *dev) | |||
232 | { | 247 | { |
233 | struct cx88_dmaqueue *q = &dev->mpegq; | 248 | struct cx88_dmaqueue *q = &dev->mpegq; |
234 | 249 | ||
250 | dprintk( 1, "cx8802_cancel_buffers" ); | ||
235 | del_timer_sync(&q->timeout); | 251 | del_timer_sync(&q->timeout); |
236 | cx8802_stop_dma(dev); | 252 | cx8802_stop_dma(dev); |
237 | do_cancel_buffers(dev,"cancel",0); | 253 | do_cancel_buffers(dev,"cancel",0); |
@@ -241,7 +257,7 @@ static void cx8802_timeout(unsigned long data) | |||
241 | { | 257 | { |
242 | struct cx8802_dev *dev = (struct cx8802_dev*)data; | 258 | struct cx8802_dev *dev = (struct cx8802_dev*)data; |
243 | 259 | ||
244 | dprintk(1, "%s\n",__FUNCTION__); | 260 | dprintk(0, "%s\n",__FUNCTION__); |
245 | 261 | ||
246 | if (debug) | 262 | if (debug) |
247 | cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH28]); | 263 | cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH28]); |
@@ -254,12 +270,17 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev) | |||
254 | struct cx88_core *core = dev->core; | 270 | struct cx88_core *core = dev->core; |
255 | u32 status, mask, count; | 271 | u32 status, mask, count; |
256 | 272 | ||
273 | dprintk( 1, "cx8802_mpeg_irq\n" ); | ||
257 | status = cx_read(MO_TS_INTSTAT); | 274 | status = cx_read(MO_TS_INTSTAT); |
258 | mask = cx_read(MO_TS_INTMSK); | 275 | mask = cx_read(MO_TS_INTMSK); |
259 | if (0 == (status & mask)) | 276 | if (0 == (status & mask)) |
260 | return; | 277 | return; |
261 | 278 | ||
262 | cx_write(MO_TS_INTSTAT, status); | 279 | cx_write(MO_TS_INTSTAT, status); |
280 | #if 0 | ||
281 | cx88_print_irqbits(core->name, "irq mpeg ", | ||
282 | cx88_mpeg_irqs, status, mask); | ||
283 | #endif | ||
263 | if (debug || (status & mask & ~0xff)) | 284 | if (debug || (status & mask & ~0xff)) |
264 | cx88_print_irqbits(core->name, "irq mpeg ", | 285 | cx88_print_irqbits(core->name, "irq mpeg ", |
265 | cx88_mpeg_irqs, status, mask); | 286 | cx88_mpeg_irqs, status, mask); |
@@ -273,6 +294,7 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev) | |||
273 | 294 | ||
274 | /* risc1 y */ | 295 | /* risc1 y */ |
275 | if (status & 0x01) { | 296 | if (status & 0x01) { |
297 | dprintk( 1, "wake up\n" ); | ||
276 | spin_lock(&dev->slock); | 298 | spin_lock(&dev->slock); |
277 | count = cx_read(MO_TS_GPCNT); | 299 | count = cx_read(MO_TS_GPCNT); |
278 | cx88_wakeup(dev->core, &dev->mpegq, count); | 300 | cx88_wakeup(dev->core, &dev->mpegq, count); |
@@ -288,6 +310,7 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev) | |||
288 | 310 | ||
289 | /* other general errors */ | 311 | /* other general errors */ |
290 | if (status & 0x1f0100) { | 312 | if (status & 0x1f0100) { |
313 | dprintk( 0, "general errors: 0x%08x\n", status & 0x1f0100 ); | ||
291 | spin_lock(&dev->slock); | 314 | spin_lock(&dev->slock); |
292 | cx8802_stop_dma(dev); | 315 | cx8802_stop_dma(dev); |
293 | cx8802_restart_queue(dev,&dev->mpegq); | 316 | cx8802_restart_queue(dev,&dev->mpegq); |
@@ -295,6 +318,8 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev) | |||
295 | } | 318 | } |
296 | } | 319 | } |
297 | 320 | ||
321 | #define MAX_IRQ_LOOP 10 | ||
322 | |||
298 | static irqreturn_t cx8802_irq(int irq, void *dev_id, struct pt_regs *regs) | 323 | static irqreturn_t cx8802_irq(int irq, void *dev_id, struct pt_regs *regs) |
299 | { | 324 | { |
300 | struct cx8802_dev *dev = dev_id; | 325 | struct cx8802_dev *dev = dev_id; |
@@ -302,10 +327,13 @@ static irqreturn_t cx8802_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
302 | u32 status; | 327 | u32 status; |
303 | int loop, handled = 0; | 328 | int loop, handled = 0; |
304 | 329 | ||
305 | for (loop = 0; loop < 10; loop++) { | 330 | for (loop = 0; loop < MAX_IRQ_LOOP; loop++) { |
306 | status = cx_read(MO_PCI_INTSTAT) & (core->pci_irqmask | 0x04); | 331 | status = cx_read(MO_PCI_INTSTAT) & (core->pci_irqmask | 0x04); |
307 | if (0 == status) | 332 | if (0 == status) |
308 | goto out; | 333 | goto out; |
334 | dprintk( 1, "cx8802_irq\n" ); | ||
335 | dprintk( 1, " loop: %d/%d\n", loop, MAX_IRQ_LOOP ); | ||
336 | dprintk( 1, " status: %d\n", status ); | ||
309 | handled = 1; | 337 | handled = 1; |
310 | cx_write(MO_PCI_INTSTAT, status); | 338 | cx_write(MO_PCI_INTSTAT, status); |
311 | 339 | ||
@@ -314,7 +342,8 @@ static irqreturn_t cx8802_irq(int irq, void *dev_id, struct pt_regs *regs) | |||
314 | if (status & 0x04) | 342 | if (status & 0x04) |
315 | cx8802_mpeg_irq(dev); | 343 | cx8802_mpeg_irq(dev); |
316 | }; | 344 | }; |
317 | if (10 == loop) { | 345 | if (MAX_IRQ_LOOP == loop) { |
346 | dprintk( 0, "clearing mask\n" ); | ||
318 | printk(KERN_WARNING "%s/0: irq loop -- clearing mask\n", | 347 | printk(KERN_WARNING "%s/0: irq loop -- clearing mask\n", |
319 | core->name); | 348 | core->name); |
320 | cx_write(MO_PCI_INTMSK,0); | 349 | cx_write(MO_PCI_INTMSK,0); |
@@ -378,6 +407,7 @@ int cx8802_init_common(struct cx8802_dev *dev) | |||
378 | 407 | ||
379 | void cx8802_fini_common(struct cx8802_dev *dev) | 408 | void cx8802_fini_common(struct cx8802_dev *dev) |
380 | { | 409 | { |
410 | dprintk( 2, "cx8802_fini_common\n" ); | ||
381 | cx8802_stop_dma(dev); | 411 | cx8802_stop_dma(dev); |
382 | pci_disable_device(dev->pci); | 412 | pci_disable_device(dev->pci); |
383 | 413 | ||
@@ -399,6 +429,7 @@ int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state) | |||
399 | /* stop mpeg dma */ | 429 | /* stop mpeg dma */ |
400 | spin_lock(&dev->slock); | 430 | spin_lock(&dev->slock); |
401 | if (!list_empty(&dev->mpegq.active)) { | 431 | if (!list_empty(&dev->mpegq.active)) { |
432 | dprintk( 2, "suspend\n" ); | ||
402 | printk("%s: suspend mpeg\n", core->name); | 433 | printk("%s: suspend mpeg\n", core->name); |
403 | cx8802_stop_dma(dev); | 434 | cx8802_stop_dma(dev); |
404 | del_timer(&dev->mpegq.timeout); | 435 | del_timer(&dev->mpegq.timeout); |
@@ -463,4 +494,5 @@ EXPORT_SYMBOL(cx8802_resume_common); | |||
463 | * Local variables: | 494 | * Local variables: |
464 | * c-basic-offset: 8 | 495 | * c-basic-offset: 8 |
465 | * End: | 496 | * End: |
497 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
466 | */ | 498 | */ |
diff --git a/drivers/media/video/cx88/cx88-reg.h b/drivers/media/video/cx88/cx88-reg.h index 8638ce57d84c..63ad33f5818b 100644 --- a/drivers/media/video/cx88/cx88-reg.h +++ b/drivers/media/video/cx88/cx88-reg.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: cx88-reg.h,v 1.6 2004/10/13 10:39:00 kraxel Exp $ | 2 | $Id: cx88-reg.h,v 1.7 2005/06/03 13:31:51 mchehab Exp $ |
3 | 3 | ||
4 | cx88x-hw.h - CX2388x register offsets | 4 | cx88x-hw.h - CX2388x register offsets |
5 | 5 | ||
@@ -397,6 +397,7 @@ | |||
397 | #define AUD_RATE_ADJ4 0x3205e4 | 397 | #define AUD_RATE_ADJ4 0x3205e4 |
398 | #define AUD_RATE_ADJ5 0x3205e8 | 398 | #define AUD_RATE_ADJ5 0x3205e8 |
399 | #define AUD_APB_IN_RATE_ADJ 0x3205ec | 399 | #define AUD_APB_IN_RATE_ADJ 0x3205ec |
400 | #define AUD_I2SCNTL 0x3205ec | ||
400 | #define AUD_PHASE_FIX_CTL 0x3205f0 | 401 | #define AUD_PHASE_FIX_CTL 0x3205f0 |
401 | #define AUD_PLL_PRESCALE 0x320600 | 402 | #define AUD_PLL_PRESCALE 0x320600 |
402 | #define AUD_PLL_DDS 0x320604 | 403 | #define AUD_PLL_DDS 0x320604 |
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c index f2a9475a2fee..46d78b1dc9b2 100644 --- a/drivers/media/video/cx88/cx88-tvaudio.c +++ b/drivers/media/video/cx88/cx88-tvaudio.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: cx88-tvaudio.c,v 1.34 2005/03/07 16:10:51 kraxel Exp $ | 2 | $Id: cx88-tvaudio.c,v 1.36 2005/06/05 05:53:45 mchehab Exp $ |
3 | 3 | ||
4 | cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver | 4 | cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver |
5 | 5 | ||
@@ -127,7 +127,8 @@ static void set_audio_start(struct cx88_core *core, | |||
127 | cx_write(AUD_VOL_CTL, (1 << 6)); | 127 | cx_write(AUD_VOL_CTL, (1 << 6)); |
128 | 128 | ||
129 | // increase level of input by 12dB | 129 | // increase level of input by 12dB |
130 | cx_write(AUD_AFE_12DB_EN, 0x0001); | 130 | // cx_write(AUD_AFE_12DB_EN, 0x0001); |
131 | cx_write(AUD_AFE_12DB_EN, 0x0000); | ||
131 | 132 | ||
132 | // start programming | 133 | // start programming |
133 | cx_write(AUD_CTL, 0x0000); | 134 | cx_write(AUD_CTL, 0x0000); |
@@ -143,9 +144,15 @@ static void set_audio_finish(struct cx88_core *core) | |||
143 | u32 volume; | 144 | u32 volume; |
144 | 145 | ||
145 | if (cx88_boards[core->board].blackbird) { | 146 | if (cx88_boards[core->board].blackbird) { |
147 | // sets sound input from external adc | ||
148 | cx_set(AUD_CTL, EN_I2SIN_ENABLE); | ||
149 | //cx_write(AUD_I2SINPUTCNTL, 0); | ||
150 | cx_write(AUD_I2SINPUTCNTL, 4); | ||
151 | cx_write(AUD_BAUDRATE, 1); | ||
146 | // 'pass-thru mode': this enables the i2s output to the mpeg encoder | 152 | // 'pass-thru mode': this enables the i2s output to the mpeg encoder |
147 | cx_set(AUD_CTL, 0x2000); | 153 | cx_set(AUD_CTL, EN_I2SOUT_ENABLE); |
148 | cx_write(AUD_I2SOUTPUTCNTL, 1); | 154 | cx_write(AUD_I2SOUTPUTCNTL, 1); |
155 | cx_write(AUD_I2SCNTL, 0); | ||
149 | //cx_write(AUD_APB_IN_RATE_ADJ, 0); | 156 | //cx_write(AUD_APB_IN_RATE_ADJ, 0); |
150 | } | 157 | } |
151 | 158 | ||
@@ -707,50 +714,65 @@ static void set_audio_standard_EIAJ(struct cx88_core *core) | |||
707 | set_audio_finish(core); | 714 | set_audio_finish(core); |
708 | } | 715 | } |
709 | 716 | ||
710 | static void set_audio_standard_FM(struct cx88_core *core) | 717 | static void set_audio_standard_FM(struct cx88_core *core, enum cx88_deemph_type deemph) |
711 | { | 718 | { |
712 | #if 0 /* FIXME */ | 719 | static const struct rlist fm_deemph_50[] = { |
713 | switch (dev->audio_properties.FM_deemphasis) | 720 | { AUD_DEEMPH0_G0, 0x0C45 }, |
714 | { | 721 | { AUD_DEEMPH0_A0, 0x6262 }, |
715 | case WW_FM_DEEMPH_50: | 722 | { AUD_DEEMPH0_B0, 0x1C29 }, |
716 | //Set De-emphasis filter coefficients for 50 usec | 723 | { AUD_DEEMPH0_A1, 0x3FC66}, |
717 | cx_write(AUD_DEEMPH0_G0, 0x0C45); | 724 | { AUD_DEEMPH0_B1, 0x399A }, |
718 | cx_write(AUD_DEEMPH0_A0, 0x6262); | 725 | |
719 | cx_write(AUD_DEEMPH0_B0, 0x1C29); | 726 | { AUD_DEEMPH1_G0, 0x0D80 }, |
720 | cx_write(AUD_DEEMPH0_A1, 0x3FC66); | 727 | { AUD_DEEMPH1_A0, 0x6262 }, |
721 | cx_write(AUD_DEEMPH0_B1, 0x399A); | 728 | { AUD_DEEMPH1_B0, 0x1C29 }, |
722 | 729 | { AUD_DEEMPH1_A1, 0x3FC66}, | |
723 | cx_write(AUD_DEEMPH1_G0, 0x0D80); | 730 | { AUD_DEEMPH1_B1, 0x399A}, |
724 | cx_write(AUD_DEEMPH1_A0, 0x6262); | 731 | |
725 | cx_write(AUD_DEEMPH1_B0, 0x1C29); | 732 | { AUD_POLYPH80SCALEFAC, 0x0003}, |
726 | cx_write(AUD_DEEMPH1_A1, 0x3FC66); | 733 | { /* end of list */ }, |
727 | cx_write(AUD_DEEMPH1_B1, 0x399A); | 734 | }; |
735 | static const struct rlist fm_deemph_75[] = { | ||
736 | { AUD_DEEMPH0_G0, 0x091B }, | ||
737 | { AUD_DEEMPH0_A0, 0x6B68 }, | ||
738 | { AUD_DEEMPH0_B0, 0x11EC }, | ||
739 | { AUD_DEEMPH0_A1, 0x3FC66}, | ||
740 | { AUD_DEEMPH0_B1, 0x399A }, | ||
741 | |||
742 | { AUD_DEEMPH1_G0, 0x0AA0 }, | ||
743 | { AUD_DEEMPH1_A0, 0x6B68 }, | ||
744 | { AUD_DEEMPH1_B0, 0x11EC }, | ||
745 | { AUD_DEEMPH1_A1, 0x3FC66}, | ||
746 | { AUD_DEEMPH1_B1, 0x399A}, | ||
747 | |||
748 | { AUD_POLYPH80SCALEFAC, 0x0003}, | ||
749 | { /* end of list */ }, | ||
750 | }; | ||
728 | 751 | ||
729 | break; | 752 | /* It is enough to leave default values? */ |
753 | static const struct rlist fm_no_deemph[] = { | ||
730 | 754 | ||
731 | case WW_FM_DEEMPH_75: | 755 | { AUD_POLYPH80SCALEFAC, 0x0003}, |
732 | //Set De-emphasis filter coefficients for 75 usec | 756 | { /* end of list */ }, |
733 | cx_write(AUD_DEEMPH0_G0, 0x91B ); | 757 | }; |
734 | cx_write(AUD_DEEMPH0_A0, 0x6B68); | ||
735 | cx_write(AUD_DEEMPH0_B0, 0x11EC); | ||
736 | cx_write(AUD_DEEMPH0_A1, 0x3FC66); | ||
737 | cx_write(AUD_DEEMPH0_B1, 0x399A); | ||
738 | 758 | ||
739 | cx_write(AUD_DEEMPH1_G0, 0xAA0 ); | 759 | dprintk("%s (status: unknown)\n",__FUNCTION__); |
740 | cx_write(AUD_DEEMPH1_A0, 0x6B68); | 760 | set_audio_start(core, 0x0020, EN_FMRADIO_AUTO_STEREO); |
741 | cx_write(AUD_DEEMPH1_B0, 0x11EC); | ||
742 | cx_write(AUD_DEEMPH1_A1, 0x3FC66); | ||
743 | cx_write(AUD_DEEMPH1_B1, 0x399A); | ||
744 | 761 | ||
762 | switch (deemph) | ||
763 | { | ||
764 | case FM_NO_DEEMPH: | ||
765 | set_audio_registers(core, fm_no_deemph); | ||
745 | break; | 766 | break; |
746 | } | ||
747 | #endif | ||
748 | 767 | ||
749 | dprintk("%s (status: unknown)\n",__FUNCTION__); | 768 | case FM_DEEMPH_50: |
750 | set_audio_start(core, 0x0020, EN_FMRADIO_AUTO_STEREO); | 769 | set_audio_registers(core, fm_deemph_50); |
770 | break; | ||
751 | 771 | ||
752 | // AB: 10/2/01: this register is not being reset appropriately on occasion. | 772 | case FM_DEEMPH_75: |
753 | cx_write(AUD_POLYPH80SCALEFAC,3); | 773 | set_audio_registers(core, fm_deemph_75); |
774 | break; | ||
775 | } | ||
754 | 776 | ||
755 | set_audio_finish(core); | 777 | set_audio_finish(core); |
756 | } | 778 | } |
@@ -778,7 +800,7 @@ void cx88_set_tvaudio(struct cx88_core *core) | |||
778 | set_audio_standard_EIAJ(core); | 800 | set_audio_standard_EIAJ(core); |
779 | break; | 801 | break; |
780 | case WW_FM: | 802 | case WW_FM: |
781 | set_audio_standard_FM(core); | 803 | set_audio_standard_FM(core,FM_NO_DEEMPH); |
782 | break; | 804 | break; |
783 | case WW_SYSTEM_L_AM: | 805 | case WW_SYSTEM_L_AM: |
784 | set_audio_standard_NICAM_L(core, 1); | 806 | set_audio_standard_NICAM_L(core, 1); |
@@ -1029,4 +1051,5 @@ EXPORT_SYMBOL(cx88_audio_thread); | |||
1029 | * Local variables: | 1051 | * Local variables: |
1030 | * c-basic-offset: 8 | 1052 | * c-basic-offset: 8 |
1031 | * End: | 1053 | * End: |
1054 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
1032 | */ | 1055 | */ |
diff --git a/drivers/media/video/cx88/cx88-vbi.c b/drivers/media/video/cx88/cx88-vbi.c index 0584ff476387..320d57888bbd 100644 --- a/drivers/media/video/cx88/cx88-vbi.c +++ b/drivers/media/video/cx88/cx88-vbi.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-vbi.c,v 1.16 2004/12/10 12:33:39 kraxel Exp $ | 2 | * $Id: cx88-vbi.c,v 1.17 2005/06/12 04:19:19 mchehab Exp $ |
3 | */ | 3 | */ |
4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
5 | #include <linux/module.h> | 5 | #include <linux/module.h> |
@@ -47,8 +47,8 @@ void cx8800_vbi_fmt(struct cx8800_dev *dev, struct v4l2_format *f) | |||
47 | } | 47 | } |
48 | 48 | ||
49 | static int cx8800_start_vbi_dma(struct cx8800_dev *dev, | 49 | static int cx8800_start_vbi_dma(struct cx8800_dev *dev, |
50 | struct cx88_dmaqueue *q, | 50 | struct cx88_dmaqueue *q, |
51 | struct cx88_buffer *buf) | 51 | struct cx88_buffer *buf) |
52 | { | 52 | { |
53 | struct cx88_core *core = dev->core; | 53 | struct cx88_core *core = dev->core; |
54 | 54 | ||
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index d1f5c92f0ce5..e4ca7350df15 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-video.c,v 1.58 2005/03/07 15:58:05 kraxel Exp $ | 2 | * $Id: cx88-video.c,v 1.63 2005/06/12 04:19:19 mchehab Exp $ |
3 | * | 3 | * |
4 | * device driver for Conexant 2388x based TV cards | 4 | * device driver for Conexant 2388x based TV cards |
5 | * video4linux video interface | 5 | * video4linux video interface |
@@ -1187,9 +1187,24 @@ static void init_controls(struct cx8800_dev *dev) | |||
1187 | .id = V4L2_CID_AUDIO_VOLUME, | 1187 | .id = V4L2_CID_AUDIO_VOLUME, |
1188 | .value = 0x3f, | 1188 | .value = 0x3f, |
1189 | }; | 1189 | }; |
1190 | static struct v4l2_control hue = { | ||
1191 | .id = V4L2_CID_HUE, | ||
1192 | .value = 0x80, | ||
1193 | }; | ||
1194 | static struct v4l2_control contrast = { | ||
1195 | .id = V4L2_CID_CONTRAST, | ||
1196 | .value = 0x80, | ||
1197 | }; | ||
1198 | static struct v4l2_control brightness = { | ||
1199 | .id = V4L2_CID_BRIGHTNESS, | ||
1200 | .value = 0x80, | ||
1201 | }; | ||
1190 | 1202 | ||
1191 | set_control(dev,&mute); | 1203 | set_control(dev,&mute); |
1192 | set_control(dev,&volume); | 1204 | set_control(dev,&volume); |
1205 | set_control(dev,&hue); | ||
1206 | set_control(dev,&contrast); | ||
1207 | set_control(dev,&brightness); | ||
1193 | } | 1208 | } |
1194 | 1209 | ||
1195 | /* ------------------------------------------------------------------ */ | 1210 | /* ------------------------------------------------------------------ */ |
@@ -1336,6 +1351,9 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1336 | V4L2_CAP_STREAMING | | 1351 | V4L2_CAP_STREAMING | |
1337 | V4L2_CAP_VBI_CAPTURE | | 1352 | V4L2_CAP_VBI_CAPTURE | |
1338 | #if 0 | 1353 | #if 0 |
1354 | V4L2_TUNER_CAP_LOW | | ||
1355 | #endif | ||
1356 | #if 0 | ||
1339 | V4L2_CAP_VIDEO_OVERLAY | | 1357 | V4L2_CAP_VIDEO_OVERLAY | |
1340 | #endif | 1358 | #endif |
1341 | 0; | 1359 | 0; |
@@ -1696,7 +1714,11 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
1696 | sizeof(cap->card)); | 1714 | sizeof(cap->card)); |
1697 | sprintf(cap->bus_info,"PCI:%s", pci_name(dev->pci)); | 1715 | sprintf(cap->bus_info,"PCI:%s", pci_name(dev->pci)); |
1698 | cap->version = CX88_VERSION_CODE; | 1716 | cap->version = CX88_VERSION_CODE; |
1699 | cap->capabilities = V4L2_CAP_TUNER; | 1717 | cap->capabilities = V4L2_CAP_TUNER |
1718 | #if 0 | ||
1719 | | V4L2_TUNER_CAP_LOW | ||
1720 | #endif | ||
1721 | ; | ||
1700 | return 0; | 1722 | return 0; |
1701 | } | 1723 | } |
1702 | case VIDIOC_G_TUNER: | 1724 | case VIDIOC_G_TUNER: |
@@ -1992,6 +2014,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
1992 | { | 2014 | { |
1993 | struct cx8800_dev *dev; | 2015 | struct cx8800_dev *dev; |
1994 | struct cx88_core *core; | 2016 | struct cx88_core *core; |
2017 | struct tuner_addr tun_addr; | ||
1995 | int err; | 2018 | int err; |
1996 | 2019 | ||
1997 | dev = kmalloc(sizeof(*dev),GFP_KERNEL); | 2020 | dev = kmalloc(sizeof(*dev),GFP_KERNEL); |
@@ -2065,8 +2088,19 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
2065 | request_module("tuner"); | 2088 | request_module("tuner"); |
2066 | if (core->tda9887_conf) | 2089 | if (core->tda9887_conf) |
2067 | request_module("tda9887"); | 2090 | request_module("tda9887"); |
2068 | if (core->tuner_type != UNSET) | 2091 | if (core->radio_type != UNSET) { |
2069 | cx88_call_i2c_clients(dev->core,TUNER_SET_TYPE,&core->tuner_type); | 2092 | tun_addr.v4l2_tuner = V4L2_TUNER_RADIO; |
2093 | tun_addr.type = core->radio_type; | ||
2094 | tun_addr.addr = core->radio_addr; | ||
2095 | cx88_call_i2c_clients(dev->core,TUNER_SET_TYPE_ADDR, &tun_addr); | ||
2096 | } | ||
2097 | if (core->tuner_type != UNSET) { | ||
2098 | tun_addr.v4l2_tuner = V4L2_TUNER_ANALOG_TV; | ||
2099 | tun_addr.type = core->tuner_type; | ||
2100 | tun_addr.addr = core->tuner_addr; | ||
2101 | cx88_call_i2c_clients(dev->core,TUNER_SET_TYPE_ADDR, &tun_addr); | ||
2102 | } | ||
2103 | |||
2070 | if (core->tda9887_conf) | 2104 | if (core->tda9887_conf) |
2071 | cx88_call_i2c_clients(dev->core,TDA9887_SET_CONFIG,&core->tda9887_conf); | 2105 | cx88_call_i2c_clients(dev->core,TDA9887_SET_CONFIG,&core->tda9887_conf); |
2072 | 2106 | ||
@@ -2162,7 +2196,7 @@ static void __devexit cx8800_finidev(struct pci_dev *pci_dev) | |||
2162 | 2196 | ||
2163 | static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state) | 2197 | static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state) |
2164 | { | 2198 | { |
2165 | struct cx8800_dev *dev = pci_get_drvdata(pci_dev); | 2199 | struct cx8800_dev *dev = pci_get_drvdata(pci_dev); |
2166 | struct cx88_core *core = dev->core; | 2200 | struct cx88_core *core = dev->core; |
2167 | 2201 | ||
2168 | /* stop video+vbi capture */ | 2202 | /* stop video+vbi capture */ |
@@ -2194,7 +2228,7 @@ static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state) | |||
2194 | 2228 | ||
2195 | static int cx8800_resume(struct pci_dev *pci_dev) | 2229 | static int cx8800_resume(struct pci_dev *pci_dev) |
2196 | { | 2230 | { |
2197 | struct cx8800_dev *dev = pci_get_drvdata(pci_dev); | 2231 | struct cx8800_dev *dev = pci_get_drvdata(pci_dev); |
2198 | struct cx88_core *core = dev->core; | 2232 | struct cx88_core *core = dev->core; |
2199 | 2233 | ||
2200 | if (dev->state.disabled) { | 2234 | if (dev->state.disabled) { |
@@ -2230,8 +2264,8 @@ static struct pci_device_id cx8800_pci_tbl[] = { | |||
2230 | { | 2264 | { |
2231 | .vendor = 0x14f1, | 2265 | .vendor = 0x14f1, |
2232 | .device = 0x8800, | 2266 | .device = 0x8800, |
2233 | .subvendor = PCI_ANY_ID, | 2267 | .subvendor = PCI_ANY_ID, |
2234 | .subdevice = PCI_ANY_ID, | 2268 | .subdevice = PCI_ANY_ID, |
2235 | },{ | 2269 | },{ |
2236 | /* --- end of list --- */ | 2270 | /* --- end of list --- */ |
2237 | } | 2271 | } |
@@ -2239,10 +2273,10 @@ static struct pci_device_id cx8800_pci_tbl[] = { | |||
2239 | MODULE_DEVICE_TABLE(pci, cx8800_pci_tbl); | 2273 | MODULE_DEVICE_TABLE(pci, cx8800_pci_tbl); |
2240 | 2274 | ||
2241 | static struct pci_driver cx8800_pci_driver = { | 2275 | static struct pci_driver cx8800_pci_driver = { |
2242 | .name = "cx8800", | 2276 | .name = "cx8800", |
2243 | .id_table = cx8800_pci_tbl, | 2277 | .id_table = cx8800_pci_tbl, |
2244 | .probe = cx8800_initdev, | 2278 | .probe = cx8800_initdev, |
2245 | .remove = __devexit_p(cx8800_finidev), | 2279 | .remove = __devexit_p(cx8800_finidev), |
2246 | 2280 | ||
2247 | .suspend = cx8800_suspend, | 2281 | .suspend = cx8800_suspend, |
2248 | .resume = cx8800_resume, | 2282 | .resume = cx8800_resume, |
@@ -2274,4 +2308,5 @@ module_exit(cx8800_fini); | |||
2274 | * Local variables: | 2308 | * Local variables: |
2275 | * c-basic-offset: 8 | 2309 | * c-basic-offset: 8 |
2276 | * End: | 2310 | * End: |
2311 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
2277 | */ | 2312 | */ |
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 88eaaaba5ad8..ac0dc27bb38f 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88.h,v 1.56 2005/03/04 09:12:23 kraxel Exp $ | 2 | * $Id: cx88.h,v 1.62 2005/06/12 04:19:19 mchehab Exp $ |
3 | * | 3 | * |
4 | * v4l2 device driver for cx2388x based TV cards | 4 | * v4l2 device driver for cx2388x based TV cards |
5 | * | 5 | * |
@@ -64,6 +64,13 @@ | |||
64 | #define SHADOW_AUD_BAL_CTL 2 | 64 | #define SHADOW_AUD_BAL_CTL 2 |
65 | #define SHADOW_MAX 2 | 65 | #define SHADOW_MAX 2 |
66 | 66 | ||
67 | /* FM Radio deemphasis type */ | ||
68 | enum cx88_deemph_type { | ||
69 | FM_NO_DEEMPH = 0, | ||
70 | FM_DEEMPH_50, | ||
71 | FM_DEEMPH_75 | ||
72 | }; | ||
73 | |||
67 | /* ----------------------------------------------------------- */ | 74 | /* ----------------------------------------------------------- */ |
68 | /* tv norms */ | 75 | /* tv norms */ |
69 | 76 | ||
@@ -162,6 +169,8 @@ extern struct sram_channel cx88_sram_channels[]; | |||
162 | #define CX88_BOARD_HAUPPAUGE_ROSLYN 24 | 169 | #define CX88_BOARD_HAUPPAUGE_ROSLYN 24 |
163 | #define CX88_BOARD_DIGITALLOGIC_MEC 25 | 170 | #define CX88_BOARD_DIGITALLOGIC_MEC 25 |
164 | #define CX88_BOARD_IODATA_GVBCTV7E 26 | 171 | #define CX88_BOARD_IODATA_GVBCTV7E 26 |
172 | #define CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO 27 | ||
173 | #define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T 28 | ||
165 | 174 | ||
166 | enum cx88_itype { | 175 | enum cx88_itype { |
167 | CX88_VMUX_COMPOSITE1 = 1, | 176 | CX88_VMUX_COMPOSITE1 = 1, |
@@ -185,6 +194,9 @@ struct cx88_input { | |||
185 | struct cx88_board { | 194 | struct cx88_board { |
186 | char *name; | 195 | char *name; |
187 | unsigned int tuner_type; | 196 | unsigned int tuner_type; |
197 | unsigned int radio_type; | ||
198 | unsigned char tuner_addr; | ||
199 | unsigned char radio_addr; | ||
188 | int tda9887_conf; | 200 | int tda9887_conf; |
189 | struct cx88_input input[8]; | 201 | struct cx88_input input[8]; |
190 | struct cx88_input radio; | 202 | struct cx88_input radio; |
@@ -255,6 +267,9 @@ struct cx88_core { | |||
255 | /* config info -- analog */ | 267 | /* config info -- analog */ |
256 | unsigned int board; | 268 | unsigned int board; |
257 | unsigned int tuner_type; | 269 | unsigned int tuner_type; |
270 | unsigned int radio_type; | ||
271 | unsigned char tuner_addr; | ||
272 | unsigned char radio_addr; | ||
258 | unsigned int tda9887_conf; | 273 | unsigned int tda9887_conf; |
259 | unsigned int has_radio; | 274 | unsigned int has_radio; |
260 | 275 | ||
@@ -420,6 +435,7 @@ struct cx8802_dev { | |||
420 | /* ----------------------------------------------------------- */ | 435 | /* ----------------------------------------------------------- */ |
421 | /* cx88-core.c */ | 436 | /* cx88-core.c */ |
422 | 437 | ||
438 | extern char *cx88_pci_irqs[32]; | ||
423 | extern char *cx88_vid_irqs[32]; | 439 | extern char *cx88_vid_irqs[32]; |
424 | extern char *cx88_mpeg_irqs[32]; | 440 | extern char *cx88_mpeg_irqs[32]; |
425 | extern void cx88_print_irqbits(char *name, char *tag, char **strings, | 441 | extern void cx88_print_irqbits(char *name, char *tag, char **strings, |
@@ -471,6 +487,11 @@ extern void cx88_core_put(struct cx88_core *core, | |||
471 | /* cx88-vbi.c */ | 487 | /* cx88-vbi.c */ |
472 | 488 | ||
473 | void cx8800_vbi_fmt(struct cx8800_dev *dev, struct v4l2_format *f); | 489 | void cx8800_vbi_fmt(struct cx8800_dev *dev, struct v4l2_format *f); |
490 | /* | ||
491 | int cx8800_start_vbi_dma(struct cx8800_dev *dev, | ||
492 | struct cx88_dmaqueue *q, | ||
493 | struct cx88_buffer *buf); | ||
494 | */ | ||
474 | int cx8800_stop_vbi_dma(struct cx8800_dev *dev); | 495 | int cx8800_stop_vbi_dma(struct cx8800_dev *dev); |
475 | int cx8800_restart_vbi_queue(struct cx8800_dev *dev, | 496 | int cx8800_restart_vbi_queue(struct cx8800_dev *dev, |
476 | struct cx88_dmaqueue *q); | 497 | struct cx88_dmaqueue *q); |
diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c index ab6620de4b3b..a565823330aa 100644 --- a/drivers/media/video/ir-kbd-gpio.c +++ b/drivers/media/video/ir-kbd-gpio.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: ir-kbd-gpio.c,v 1.12 2005/02/22 12:28:40 kraxel Exp $ | 2 | * $Id: ir-kbd-gpio.c,v 1.13 2005/05/15 19:01:26 mchehab Exp $ |
3 | * | 3 | * |
4 | * Copyright (c) 2003 Gerd Knorr | 4 | * Copyright (c) 2003 Gerd Knorr |
5 | * Copyright (c) 2003 Pavel Machek | 5 | * Copyright (c) 2003 Pavel Machek |
@@ -114,38 +114,6 @@ static IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE] = { | |||
114 | [ 0x3e ] = KEY_VOLUMEUP, // 'volume +' | 114 | [ 0x3e ] = KEY_VOLUMEUP, // 'volume +' |
115 | }; | 115 | }; |
116 | 116 | ||
117 | static IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE] = { | ||
118 | [ 2 ] = KEY_KP0, | ||
119 | [ 1 ] = KEY_KP1, | ||
120 | [ 11 ] = KEY_KP2, | ||
121 | [ 27 ] = KEY_KP3, | ||
122 | [ 5 ] = KEY_KP4, | ||
123 | [ 9 ] = KEY_KP5, | ||
124 | [ 21 ] = KEY_KP6, | ||
125 | [ 6 ] = KEY_KP7, | ||
126 | [ 10 ] = KEY_KP8, | ||
127 | [ 18 ] = KEY_KP9, | ||
128 | |||
129 | [ 3 ] = KEY_TUNER, // TV/FM | ||
130 | [ 7 ] = KEY_SEARCH, // scan | ||
131 | [ 28 ] = KEY_ZOOM, // full screen | ||
132 | [ 30 ] = KEY_POWER, | ||
133 | [ 23 ] = KEY_VOLUMEDOWN, | ||
134 | [ 31 ] = KEY_VOLUMEUP, | ||
135 | [ 20 ] = KEY_CHANNELDOWN, | ||
136 | [ 22 ] = KEY_CHANNELUP, | ||
137 | [ 24 ] = KEY_MUTE, | ||
138 | |||
139 | [ 0 ] = KEY_LIST, // source | ||
140 | [ 19 ] = KEY_INFO, // loop | ||
141 | [ 16 ] = KEY_LAST, // +100 | ||
142 | [ 13 ] = KEY_CLEAR, // reset | ||
143 | [ 12 ] = BTN_RIGHT, // fun++ | ||
144 | [ 4 ] = BTN_LEFT, // fun-- | ||
145 | [ 14 ] = KEY_GOTO, // function | ||
146 | [ 15 ] = KEY_STOP, // freeze | ||
147 | }; | ||
148 | |||
149 | /* Attila Kondoros <attila.kondoros@chello.hu> */ | 117 | /* Attila Kondoros <attila.kondoros@chello.hu> */ |
150 | static IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE] = { | 118 | static IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE] = { |
151 | 119 | ||
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index 09464d624a6b..1b7d38e96f14 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c | |||
@@ -735,7 +735,6 @@ static int msp34xx_sleep(struct msp3400c *msp, int timeout) | |||
735 | { | 735 | { |
736 | DECLARE_WAITQUEUE(wait, current); | 736 | DECLARE_WAITQUEUE(wait, current); |
737 | 737 | ||
738 | again: | ||
739 | add_wait_queue(&msp->wq, &wait); | 738 | add_wait_queue(&msp->wq, &wait); |
740 | if (!kthread_should_stop()) { | 739 | if (!kthread_should_stop()) { |
741 | if (timeout < 0) { | 740 | if (timeout < 0) { |
@@ -751,12 +750,9 @@ again: | |||
751 | #endif | 750 | #endif |
752 | } | 751 | } |
753 | } | 752 | } |
754 | 753 | if (current->flags & PF_FREEZE) | |
754 | refrigerator(PF_FREEZE); | ||
755 | remove_wait_queue(&msp->wq, &wait); | 755 | remove_wait_queue(&msp->wq, &wait); |
756 | |||
757 | if (try_to_freeze(PF_FREEZE)) | ||
758 | goto again; | ||
759 | |||
760 | return msp->restart; | 756 | return msp->restart; |
761 | } | 757 | } |
762 | 758 | ||
@@ -1436,7 +1432,7 @@ static int msp_detach(struct i2c_client *client); | |||
1436 | static int msp_probe(struct i2c_adapter *adap); | 1432 | static int msp_probe(struct i2c_adapter *adap); |
1437 | static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg); | 1433 | static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg); |
1438 | 1434 | ||
1439 | static int msp_suspend(struct device * dev, pm_message_t state, u32 level); | 1435 | static int msp_suspend(struct device * dev, u32 state, u32 level); |
1440 | static int msp_resume(struct device * dev, u32 level); | 1436 | static int msp_resume(struct device * dev, u32 level); |
1441 | 1437 | ||
1442 | static void msp_wake_thread(struct i2c_client *client); | 1438 | static void msp_wake_thread(struct i2c_client *client); |
@@ -1841,7 +1837,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
1841 | return 0; | 1837 | return 0; |
1842 | } | 1838 | } |
1843 | 1839 | ||
1844 | static int msp_suspend(struct device * dev, pm_message_t state, u32 level) | 1840 | static int msp_suspend(struct device * dev, u32 state, u32 level) |
1845 | { | 1841 | { |
1846 | struct i2c_client *c = container_of(dev, struct i2c_client, dev); | 1842 | struct i2c_client *c = container_of(dev, struct i2c_client, dev); |
1847 | 1843 | ||
diff --git a/drivers/media/video/msp3400.h b/drivers/media/video/msp3400.h index d70a954e13aa..023f33056a4f 100644 --- a/drivers/media/video/msp3400.h +++ b/drivers/media/video/msp3400.h | |||
@@ -1,3 +1,7 @@ | |||
1 | /* | ||
2 | * $Id: msp3400.h,v 1.3 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | */ | ||
4 | |||
1 | #ifndef MSP3400_H | 5 | #ifndef MSP3400_H |
2 | #define MSP3400_H | 6 | #define MSP3400_H |
3 | 7 | ||
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index 42c2b565c9fe..e6d0a18833d6 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c | |||
@@ -41,16 +41,16 @@ enum saa6752hs_videoformat { | |||
41 | 41 | ||
42 | static const struct v4l2_format v4l2_format_table[] = | 42 | static const struct v4l2_format v4l2_format_table[] = |
43 | { | 43 | { |
44 | [SAA6752HS_VF_D1] = { | 44 | [SAA6752HS_VF_D1] = |
45 | .fmt = { .pix = { .width = 720, .height = 576 }, }, }, | 45 | { .fmt = { .pix = { .width = 720, .height = 576 }}}, |
46 | [SAA6752HS_VF_2_3_D1] = { | 46 | [SAA6752HS_VF_2_3_D1] = |
47 | .fmt = { .pix = { .width = 480, .height = 576 }, }, }, | 47 | { .fmt = { .pix = { .width = 480, .height = 576 }}}, |
48 | [SAA6752HS_VF_1_2_D1] = { | 48 | [SAA6752HS_VF_1_2_D1] = |
49 | .fmt = { .pix = { .width = 352, .height = 576 }, }, }, | 49 | { .fmt = { .pix = { .width = 352, .height = 576 }}}, |
50 | [SAA6752HS_VF_SIF] = { | 50 | [SAA6752HS_VF_SIF] = |
51 | .fmt = { .pix = { .width = 352, .height = 288 }, }, }, | 51 | { .fmt = { .pix = { .width = 352, .height = 288 }}}, |
52 | [SAA6752HS_VF_UNKNOWN] = { | 52 | [SAA6752HS_VF_UNKNOWN] = |
53 | .fmt = { .pix = { .width = 0, .height = 0 }, }, }, | 53 | { .fmt = { .pix = { .width = 0, .height = 0}}}, |
54 | }; | 54 | }; |
55 | 55 | ||
56 | struct saa6752hs_state { | 56 | struct saa6752hs_state { |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index c51eb7f078d3..0c781e24c446 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -1,6 +1,6 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | * $Id: saa7134-cards.c,v 1.54 2005/03/07 12:01:51 kraxel Exp $ | 3 | * $Id: saa7134-cards.c,v 1.58 2005/06/07 18:05:00 nsh Exp $ |
4 | * | 4 | * |
5 | * device driver for philips saa7134 based TV cards | 5 | * device driver for philips saa7134 based TV cards |
6 | * card-specific stuff. | 6 | * card-specific stuff. |
@@ -165,7 +165,7 @@ struct saa7134_board saa7134_boards[] = { | |||
165 | .inputs = {{ | 165 | .inputs = {{ |
166 | .name = name_tv, | 166 | .name = name_tv, |
167 | .vmux = 1, | 167 | .vmux = 1, |
168 | .amux = LINE2, | 168 | .amux = TV, |
169 | .tv = 1, | 169 | .tv = 1, |
170 | },{ | 170 | },{ |
171 | .name = name_comp1, | 171 | .name = name_comp1, |
@@ -878,7 +878,7 @@ struct saa7134_board saa7134_boards[] = { | |||
878 | }, | 878 | }, |
879 | [SAA7134_BOARD_MANLI_MTV002] = { | 879 | [SAA7134_BOARD_MANLI_MTV002] = { |
880 | /* Ognjen Nastic <ognjen@logosoft.ba> */ | 880 | /* Ognjen Nastic <ognjen@logosoft.ba> */ |
881 | .name = "Manli MuchTV M-TV002", | 881 | .name = "Manli MuchTV M-TV002/Behold TV 403 FM", |
882 | .audio_clock = 0x00200000, | 882 | .audio_clock = 0x00200000, |
883 | .tuner_type = TUNER_PHILIPS_PAL, | 883 | .tuner_type = TUNER_PHILIPS_PAL, |
884 | .inputs = {{ | 884 | .inputs = {{ |
@@ -899,14 +899,10 @@ struct saa7134_board saa7134_boards[] = { | |||
899 | .name = name_radio, | 899 | .name = name_radio, |
900 | .amux = LINE2, | 900 | .amux = LINE2, |
901 | }, | 901 | }, |
902 | .mute = { | ||
903 | .name = name_mute, | ||
904 | .amux = LINE1, | ||
905 | }, | ||
906 | }, | 902 | }, |
907 | [SAA7134_BOARD_MANLI_MTV001] = { | 903 | [SAA7134_BOARD_MANLI_MTV001] = { |
908 | /* Ognjen Nastic <ognjen@logosoft.ba> UNTESTED */ | 904 | /* Ognjen Nastic <ognjen@logosoft.ba> UNTESTED */ |
909 | .name = "Manli MuchTV M-TV001", | 905 | .name = "Manli MuchTV M-TV001/Behold TV 401", |
910 | .audio_clock = 0x00200000, | 906 | .audio_clock = 0x00200000, |
911 | .tuner_type = TUNER_PHILIPS_PAL, | 907 | .tuner_type = TUNER_PHILIPS_PAL, |
912 | .inputs = {{ | 908 | .inputs = {{ |
@@ -923,6 +919,10 @@ struct saa7134_board saa7134_boards[] = { | |||
923 | .amux = LINE2, | 919 | .amux = LINE2, |
924 | .tv = 1, | 920 | .tv = 1, |
925 | }}, | 921 | }}, |
922 | .mute = { | ||
923 | .name = name_mute, | ||
924 | .amux = LINE1, | ||
925 | }, | ||
926 | }, | 926 | }, |
927 | [SAA7134_BOARD_TG3000TV] = { | 927 | [SAA7134_BOARD_TG3000TV] = { |
928 | /* TransGear 3000TV */ | 928 | /* TransGear 3000TV */ |
@@ -1078,7 +1078,6 @@ struct saa7134_board saa7134_boards[] = { | |||
1078 | .audio_clock = 0x00187de7, | 1078 | .audio_clock = 0x00187de7, |
1079 | .tuner_type = TUNER_PHILIPS_FM1256_IH3, | 1079 | .tuner_type = TUNER_PHILIPS_FM1256_IH3, |
1080 | .tda9887_conf = TDA9887_PRESENT, | 1080 | .tda9887_conf = TDA9887_PRESENT, |
1081 | .gpiomask = 0x3, | ||
1082 | .inputs = {{ | 1081 | .inputs = {{ |
1083 | .name = name_tv, | 1082 | .name = name_tv, |
1084 | .vmux = 1, | 1083 | .vmux = 1, |
@@ -1285,7 +1284,7 @@ struct saa7134_board saa7134_boards[] = { | |||
1285 | .gpio =0x8000, | 1284 | .gpio =0x8000, |
1286 | } | 1285 | } |
1287 | }, | 1286 | }, |
1288 | [SAA7134_BOARD_AVERMEDIA_307] = { | 1287 | [SAA7134_BOARD_AVERMEDIA_STUDIO_307] = { |
1289 | /* | 1288 | /* |
1290 | Nickolay V. Shmyrev <nshmyrev@yandex.ru> | 1289 | Nickolay V. Shmyrev <nshmyrev@yandex.ru> |
1291 | Lots of thanks to Andrey Zolotarev <zolotarev_andrey@mail.ru> | 1290 | Lots of thanks to Andrey Zolotarev <zolotarev_andrey@mail.ru> |
@@ -1323,6 +1322,35 @@ struct saa7134_board saa7134_boards[] = { | |||
1323 | .gpio = 0x01, | 1322 | .gpio = 0x01, |
1324 | }, | 1323 | }, |
1325 | }, | 1324 | }, |
1325 | [SAA7134_BOARD_AVERMEDIA_GO_007_FM] = { | ||
1326 | .name = "Avermedia AVerTV GO 007 FM", | ||
1327 | .audio_clock = 0x00187de7, | ||
1328 | .tuner_type = TUNER_PHILIPS_TDA8290, | ||
1329 | .gpiomask = 0x00300003, | ||
1330 | // .gpiomask = 0x8c240003, | ||
1331 | .inputs = {{ | ||
1332 | .name = name_tv, | ||
1333 | .vmux = 1, | ||
1334 | .amux = TV, | ||
1335 | .tv = 1, | ||
1336 | .gpio = 0x01, | ||
1337 | },{ | ||
1338 | .name = name_comp1, | ||
1339 | .vmux = 0, | ||
1340 | .amux = LINE2, | ||
1341 | .gpio = 0x02, | ||
1342 | },{ | ||
1343 | .name = name_svideo, | ||
1344 | .vmux = 6, | ||
1345 | .amux = LINE2, | ||
1346 | .gpio = 0x02, | ||
1347 | }}, | ||
1348 | .radio = { | ||
1349 | .name = name_radio, | ||
1350 | .amux = LINE1, | ||
1351 | .gpio = 0x00300001, | ||
1352 | }, | ||
1353 | }, | ||
1326 | [SAA7134_BOARD_AVERMEDIA_CARDBUS] = { | 1354 | [SAA7134_BOARD_AVERMEDIA_CARDBUS] = { |
1327 | /* Jon Westgate <oryn@oryn.fsck.tv> */ | 1355 | /* Jon Westgate <oryn@oryn.fsck.tv> */ |
1328 | .name = "AVerMedia Cardbus TV/Radio", | 1356 | .name = "AVerMedia Cardbus TV/Radio", |
@@ -1492,7 +1520,6 @@ struct saa7134_board saa7134_boards[] = { | |||
1492 | .audio_clock = 0x00187de7, | 1520 | .audio_clock = 0x00187de7, |
1493 | .tuner_type = TUNER_PHILIPS_FQ1216ME, | 1521 | .tuner_type = TUNER_PHILIPS_FQ1216ME, |
1494 | .tda9887_conf = TDA9887_PRESENT, | 1522 | .tda9887_conf = TDA9887_PRESENT, |
1495 | .gpiomask = 0x3, | ||
1496 | .inputs = {{ | 1523 | .inputs = {{ |
1497 | .name = name_tv, | 1524 | .name = name_tv, |
1498 | .vmux = 1, | 1525 | .vmux = 1, |
@@ -1546,7 +1573,82 @@ struct saa7134_board saa7134_boards[] = { | |||
1546 | // .gpio = 0x4000, | 1573 | // .gpio = 0x4000, |
1547 | }}, | 1574 | }}, |
1548 | }, | 1575 | }, |
1549 | }; | 1576 | [SAA7134_BOARD_AVERMEDIA_307] = { |
1577 | /* | ||
1578 | Davydov Vladimir <vladimir@iqmedia.com> | ||
1579 | */ | ||
1580 | .name = "Avermedia AVerTV 307", | ||
1581 | .audio_clock = 0x00187de7, | ||
1582 | .tuner_type = TUNER_PHILIPS_FQ1216ME, | ||
1583 | .tda9887_conf = TDA9887_PRESENT, | ||
1584 | .inputs = {{ | ||
1585 | .name = name_tv, | ||
1586 | .vmux = 1, | ||
1587 | .amux = TV, | ||
1588 | .tv = 1, | ||
1589 | },{ | ||
1590 | .name = name_comp1, | ||
1591 | .vmux = 0, | ||
1592 | .amux = LINE1, | ||
1593 | },{ | ||
1594 | .name = name_comp2, | ||
1595 | .vmux = 3, | ||
1596 | .amux = LINE1, | ||
1597 | },{ | ||
1598 | .name = name_svideo, | ||
1599 | .vmux = 8, | ||
1600 | .amux = LINE1, | ||
1601 | }}, | ||
1602 | }, | ||
1603 | [SAA7134_BOARD_ADS_INSTANT_TV] = { | ||
1604 | .name = "ADS Tech Instant TV (saa7135)", | ||
1605 | .audio_clock = 0x00187de7, | ||
1606 | .tuner_type = TUNER_PHILIPS_TDA8290, | ||
1607 | .inputs = {{ | ||
1608 | .name = name_tv, | ||
1609 | .vmux = 1, | ||
1610 | .amux = TV, | ||
1611 | .tv = 1, | ||
1612 | },{ | ||
1613 | .name = name_comp1, | ||
1614 | .vmux = 3, | ||
1615 | .amux = LINE2, | ||
1616 | },{ | ||
1617 | .name = name_svideo, | ||
1618 | .vmux = 8, | ||
1619 | .amux = LINE2, | ||
1620 | }}, | ||
1621 | }, | ||
1622 | [SAA7134_BOARD_KWORLD_VSTREAM_XPERT] = { | ||
1623 | .name = "Kworld/Tevion V-Stream Xpert TV PVR7134", | ||
1624 | .audio_clock = 0x00187de7, | ||
1625 | .tuner_type = TUNER_PHILIPS_PAL_I, | ||
1626 | .gpiomask = 0x0700, | ||
1627 | .inputs = {{ | ||
1628 | .name = name_tv, | ||
1629 | .vmux = 1, | ||
1630 | .amux = TV, | ||
1631 | .tv = 1, | ||
1632 | .gpio = 0x000, | ||
1633 | },{ | ||
1634 | .name = name_comp1, | ||
1635 | .vmux = 3, | ||
1636 | .amux = LINE1, | ||
1637 | .gpio = 0x200, //gpio by DScaler | ||
1638 | },{ | ||
1639 | .name = name_svideo, | ||
1640 | .vmux = 0, | ||
1641 | .amux = LINE1, | ||
1642 | .gpio = 0x200, | ||
1643 | }}, | ||
1644 | .radio = { | ||
1645 | .name = name_radio, | ||
1646 | .amux = LINE1, | ||
1647 | .gpio = 0x100, | ||
1648 | }, | ||
1649 | }, | ||
1650 | }; | ||
1651 | |||
1550 | const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); | 1652 | const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); |
1551 | 1653 | ||
1552 | /* ------------------------------------------------------------------ */ | 1654 | /* ------------------------------------------------------------------ */ |
@@ -1663,7 +1765,7 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
1663 | .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134, | 1765 | .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134, |
1664 | },{ | 1766 | },{ |
1665 | .vendor = PCI_VENDOR_ID_PHILIPS, | 1767 | .vendor = PCI_VENDOR_ID_PHILIPS, |
1666 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | 1768 | .device = PCI_DEVICE_ID_PHILIPS_SAA7135, |
1667 | .subvendor = PCI_VENDOR_ID_ASUSTEK, | 1769 | .subvendor = PCI_VENDOR_ID_ASUSTEK, |
1668 | .subdevice = 0x4845, | 1770 | .subdevice = 0x4845, |
1669 | .driver_data = SAA7135_BOARD_ASUSTeK_TVFM7135, | 1771 | .driver_data = SAA7135_BOARD_ASUSTeK_TVFM7135, |
@@ -1824,6 +1926,12 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
1824 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 1926 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
1825 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | 1927 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ |
1826 | .subdevice = 0x9715, | 1928 | .subdevice = 0x9715, |
1929 | .driver_data = SAA7134_BOARD_AVERMEDIA_STUDIO_307, | ||
1930 | },{ | ||
1931 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
1932 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
1933 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | ||
1934 | .subdevice = 0xa70a, | ||
1827 | .driver_data = SAA7134_BOARD_AVERMEDIA_307, | 1935 | .driver_data = SAA7134_BOARD_AVERMEDIA_307, |
1828 | },{ | 1936 | },{ |
1829 | .vendor = PCI_VENDOR_ID_PHILIPS, | 1937 | .vendor = PCI_VENDOR_ID_PHILIPS, |
@@ -1844,6 +1952,26 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
1844 | .subvendor = 0x5168, | 1952 | .subvendor = 0x5168, |
1845 | .subdevice = 0x0306, | 1953 | .subdevice = 0x0306, |
1846 | .driver_data = SAA7134_BOARD_FLYDVBTDUO, | 1954 | .driver_data = SAA7134_BOARD_FLYDVBTDUO, |
1955 | },{ | ||
1956 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
1957 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
1958 | .subvendor = 0x1461, /* Avermedia Technologies Inc */ | ||
1959 | .subdevice = 0xf31f, | ||
1960 | .driver_data = SAA7134_BOARD_AVERMEDIA_GO_007_FM, | ||
1961 | |||
1962 | },{ | ||
1963 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
1964 | .device = PCI_DEVICE_ID_PHILIPS_SAA7135, | ||
1965 | .subvendor = 0x1421, | ||
1966 | .subdevice = 0x0350, /* PCI version */ | ||
1967 | .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, | ||
1968 | |||
1969 | },{ | ||
1970 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
1971 | .device = PCI_DEVICE_ID_PHILIPS_SAA7135, | ||
1972 | .subvendor = 0x1421, | ||
1973 | .subdevice = 0x0370, /* cardbus version */ | ||
1974 | .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, | ||
1847 | 1975 | ||
1848 | },{ | 1976 | },{ |
1849 | /* --- boards without eeprom + subsystem ID --- */ | 1977 | /* --- boards without eeprom + subsystem ID --- */ |
@@ -1954,20 +2082,23 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
1954 | dev->has_remote = 1; | 2082 | dev->has_remote = 1; |
1955 | board_flyvideo(dev); | 2083 | board_flyvideo(dev); |
1956 | break; | 2084 | break; |
1957 | case SAA7134_BOARD_FLYTVPLATINUM_FM: | 2085 | case SAA7134_BOARD_FLYTVPLATINUM_FM: |
1958 | case SAA7134_BOARD_CINERGY400: | 2086 | case SAA7134_BOARD_CINERGY400: |
1959 | case SAA7134_BOARD_CINERGY600: | 2087 | case SAA7134_BOARD_CINERGY600: |
1960 | case SAA7134_BOARD_CINERGY600_MK3: | 2088 | case SAA7134_BOARD_CINERGY600_MK3: |
1961 | case SAA7134_BOARD_ECS_TVP3XP: | 2089 | case SAA7134_BOARD_ECS_TVP3XP: |
1962 | case SAA7134_BOARD_ECS_TVP3XP_4CB5: | 2090 | case SAA7134_BOARD_ECS_TVP3XP_4CB5: |
1963 | case SAA7134_BOARD_MD2819: | 2091 | case SAA7134_BOARD_MD2819: |
2092 | case SAA7134_BOARD_KWORLD_VSTREAM_XPERT: | ||
1964 | case SAA7134_BOARD_AVERMEDIA_STUDIO_305: | 2093 | case SAA7134_BOARD_AVERMEDIA_STUDIO_305: |
1965 | case SAA7134_BOARD_AVERMEDIA_305: | 2094 | case SAA7134_BOARD_AVERMEDIA_305: |
2095 | case SAA7134_BOARD_AVERMEDIA_STUDIO_307: | ||
1966 | case SAA7134_BOARD_AVERMEDIA_307: | 2096 | case SAA7134_BOARD_AVERMEDIA_307: |
2097 | case SAA7134_BOARD_AVERMEDIA_GO_007_FM: | ||
1967 | // case SAA7134_BOARD_SABRENT_SBTTVFM: /* not finished yet */ | 2098 | // case SAA7134_BOARD_SABRENT_SBTTVFM: /* not finished yet */ |
1968 | case SAA7134_BOARD_VIDEOMATE_TV_PVR: | 2099 | case SAA7134_BOARD_VIDEOMATE_TV_PVR: |
1969 | dev->has_remote = 1; | 2100 | case SAA7134_BOARD_MANLI_MTV001: |
1970 | break; | 2101 | case SAA7134_BOARD_MANLI_MTV002: |
1971 | case SAA7134_BOARD_AVACSSMARTTV: | 2102 | case SAA7134_BOARD_AVACSSMARTTV: |
1972 | dev->has_remote = 1; | 2103 | dev->has_remote = 1; |
1973 | break; | 2104 | break; |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index d506cafba8ff..f61ed1849a2a 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-core.c,v 1.28 2005/02/22 09:56:29 kraxel Exp $ | 2 | * $Id: saa7134-core.c,v 1.30 2005/05/22 19:23:39 nsh Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * driver core | 5 | * driver core |
@@ -316,7 +316,7 @@ unsigned long saa7134_buffer_base(struct saa7134_buf *buf) | |||
316 | 316 | ||
317 | int saa7134_pgtable_alloc(struct pci_dev *pci, struct saa7134_pgtable *pt) | 317 | int saa7134_pgtable_alloc(struct pci_dev *pci, struct saa7134_pgtable *pt) |
318 | { | 318 | { |
319 | u32 *cpu; | 319 | __le32 *cpu; |
320 | dma_addr_t dma_addr; | 320 | dma_addr_t dma_addr; |
321 | 321 | ||
322 | cpu = pci_alloc_consistent(pci, SAA7134_PGTABLE_SIZE, &dma_addr); | 322 | cpu = pci_alloc_consistent(pci, SAA7134_PGTABLE_SIZE, &dma_addr); |
@@ -332,7 +332,7 @@ int saa7134_pgtable_build(struct pci_dev *pci, struct saa7134_pgtable *pt, | |||
332 | struct scatterlist *list, unsigned int length, | 332 | struct scatterlist *list, unsigned int length, |
333 | unsigned int startpage) | 333 | unsigned int startpage) |
334 | { | 334 | { |
335 | u32 *ptr; | 335 | __le32 *ptr; |
336 | unsigned int i,p; | 336 | unsigned int i,p; |
337 | 337 | ||
338 | BUG_ON(NULL == pt || NULL == pt->cpu); | 338 | BUG_ON(NULL == pt || NULL == pt->cpu); |
@@ -340,7 +340,7 @@ int saa7134_pgtable_build(struct pci_dev *pci, struct saa7134_pgtable *pt, | |||
340 | ptr = pt->cpu + startpage; | 340 | ptr = pt->cpu + startpage; |
341 | for (i = 0; i < length; i++, list++) | 341 | for (i = 0; i < length; i++, list++) |
342 | for (p = 0; p * 4096 < list->length; p++, ptr++) | 342 | for (p = 0; p * 4096 < list->length; p++, ptr++) |
343 | *ptr = sg_dma_address(list) - list->offset; | 343 | *ptr = cpu_to_le32(sg_dma_address(list) - list->offset); |
344 | return 0; | 344 | return 0; |
345 | } | 345 | } |
346 | 346 | ||
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index c2873ae029f9..aa8e2cf62d55 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-dvb.c,v 1.12 2005/02/18 12:28:29 kraxel Exp $ | 2 | * $Id: saa7134-dvb.c,v 1.13 2005/06/12 04:19:19 mchehab Exp $ |
3 | * | 3 | * |
4 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] | 4 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] |
5 | * | 5 | * |
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index fa1357336907..c85348d0239f 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-empress.c,v 1.10 2005/02/03 10:24:33 kraxel Exp $ | 2 | * $Id: saa7134-empress.c,v 1.11 2005/05/22 19:23:39 nsh Exp $ |
3 | * | 3 | * |
4 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] | 4 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] |
5 | * | 5 | * |
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c index 702bb63d9813..b6f002e8421d 100644 --- a/drivers/media/video/saa7134/saa7134-i2c.c +++ b/drivers/media/video/saa7134/saa7134-i2c.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-i2c.c,v 1.10 2005/01/24 17:37:23 kraxel Exp $ | 2 | * $Id: saa7134-i2c.c,v 1.11 2005/06/12 01:36:14 mchehab Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * i2c interface support | 5 | * i2c interface support |
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index ca50cf531f20..aba2b9de60de 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-input.c,v 1.16 2004/12/10 12:33:39 kraxel Exp $ | 2 | * $Id: saa7134-input.c,v 1.19 2005/06/07 18:02:26 nsh Exp $ |
3 | * | 3 | * |
4 | * handle saa7134 IR remotes via linux kernel input layer. | 4 | * handle saa7134 IR remotes via linux kernel input layer. |
5 | * | 5 | * |
@@ -308,6 +308,102 @@ static IR_KEYTAB_TYPE videomate_tv_pvr_codes[IR_KEYTAB_SIZE] = { | |||
308 | [ 32 ] = KEY_LANGUAGE, | 308 | [ 32 ] = KEY_LANGUAGE, |
309 | [ 33 ] = KEY_SLEEP, | 309 | [ 33 ] = KEY_SLEEP, |
310 | }; | 310 | }; |
311 | |||
312 | /* Michael Tokarev <mjt@tls.msk.ru> | ||
313 | http://www.corpit.ru/mjt/beholdTV/remote_control.jpg | ||
314 | keytable is used by MANLI MTV00[12] and BeholdTV 40[13] at | ||
315 | least, and probably other cards too. | ||
316 | The "ascii-art picture" below (in comments, first row | ||
317 | is the keycode in hex, and subsequent row(s) shows | ||
318 | the button labels (several variants when appropriate) | ||
319 | helps to descide which keycodes to assign to the buttons. | ||
320 | */ | ||
321 | static IR_KEYTAB_TYPE manli_codes[IR_KEYTAB_SIZE] = { | ||
322 | |||
323 | /* 0x1c 0x12 * | ||
324 | * FUNCTION POWER * | ||
325 | * FM (|) * | ||
326 | * */ | ||
327 | [ 0x1c ] = KEY_RADIO, /*XXX*/ | ||
328 | [ 0x12 ] = KEY_POWER, | ||
329 | |||
330 | /* 0x01 0x02 0x03 * | ||
331 | * 1 2 3 * | ||
332 | * * | ||
333 | * 0x04 0x05 0x06 * | ||
334 | * 4 5 6 * | ||
335 | * * | ||
336 | * 0x07 0x08 0x09 * | ||
337 | * 7 8 9 * | ||
338 | * */ | ||
339 | [ 0x01 ] = KEY_KP1, | ||
340 | [ 0x02 ] = KEY_KP2, | ||
341 | [ 0x03 ] = KEY_KP3, | ||
342 | [ 0x04 ] = KEY_KP4, | ||
343 | [ 0x05 ] = KEY_KP5, | ||
344 | [ 0x06 ] = KEY_KP6, | ||
345 | [ 0x07 ] = KEY_KP7, | ||
346 | [ 0x08 ] = KEY_KP8, | ||
347 | [ 0x09 ] = KEY_KP9, | ||
348 | |||
349 | /* 0x0a 0x00 0x17 * | ||
350 | * RECALL 0 +100 * | ||
351 | * PLUS * | ||
352 | * */ | ||
353 | [ 0x0a ] = KEY_AGAIN, /*XXX KEY_REWIND? */ | ||
354 | [ 0x00 ] = KEY_KP0, | ||
355 | [ 0x17 ] = KEY_DIGITS, /*XXX*/ | ||
356 | |||
357 | /* 0x14 0x10 * | ||
358 | * MENU INFO * | ||
359 | * OSD */ | ||
360 | [ 0x14 ] = KEY_MENU, | ||
361 | [ 0x10 ] = KEY_INFO, | ||
362 | |||
363 | /* 0x0b * | ||
364 | * Up * | ||
365 | * * | ||
366 | * 0x18 0x16 0x0c * | ||
367 | * Left Ok Right * | ||
368 | * * | ||
369 | * 0x015 * | ||
370 | * Down * | ||
371 | * */ | ||
372 | [ 0x0b ] = KEY_UP, /*XXX KEY_SCROLLUP? */ | ||
373 | [ 0x18 ] = KEY_LEFT, /*XXX KEY_BACK? */ | ||
374 | [ 0x16 ] = KEY_OK, /*XXX KEY_SELECT? KEY_ENTER? */ | ||
375 | [ 0x0c ] = KEY_RIGHT, /*XXX KEY_FORWARD? */ | ||
376 | [ 0x15 ] = KEY_DOWN, /*XXX KEY_SCROLLDOWN? */ | ||
377 | |||
378 | /* 0x11 0x0d * | ||
379 | * TV/AV MODE * | ||
380 | * SOURCE STEREO * | ||
381 | * */ | ||
382 | [ 0x11 ] = KEY_TV, /*XXX*/ | ||
383 | [ 0x0d ] = KEY_MODE, /*XXX there's no KEY_STEREO */ | ||
384 | |||
385 | /* 0x0f 0x1b 0x1a * | ||
386 | * AUDIO Vol+ Chan+ * | ||
387 | * TIMESHIFT??? * | ||
388 | * * | ||
389 | * 0x0e 0x1f 0x1e * | ||
390 | * SLEEP Vol- Chan- * | ||
391 | * */ | ||
392 | [ 0x0f ] = KEY_AUDIO, | ||
393 | [ 0x1b ] = KEY_VOLUMEUP, | ||
394 | [ 0x1a ] = KEY_CHANNELUP, | ||
395 | [ 0x0e ] = KEY_SLEEP, /*XXX maybe KEY_PAUSE */ | ||
396 | [ 0x1f ] = KEY_VOLUMEDOWN, | ||
397 | [ 0x1e ] = KEY_CHANNELDOWN, | ||
398 | |||
399 | /* 0x13 0x19 * | ||
400 | * MUTE SNAPSHOT* | ||
401 | * */ | ||
402 | [ 0x13 ] = KEY_MUTE, | ||
403 | [ 0x19 ] = KEY_RECORD, /*XXX*/ | ||
404 | |||
405 | // 0x1d unused ? | ||
406 | }; | ||
311 | /* ---------------------------------------------------------------------- */ | 407 | /* ---------------------------------------------------------------------- */ |
312 | 408 | ||
313 | static int build_key(struct saa7134_dev *dev) | 409 | static int build_key(struct saa7134_dev *dev) |
@@ -379,7 +475,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
379 | switch (dev->board) { | 475 | switch (dev->board) { |
380 | case SAA7134_BOARD_FLYVIDEO2000: | 476 | case SAA7134_BOARD_FLYVIDEO2000: |
381 | case SAA7134_BOARD_FLYVIDEO3000: | 477 | case SAA7134_BOARD_FLYVIDEO3000: |
382 | case SAA7134_BOARD_FLYTVPLATINUM_FM: | 478 | case SAA7134_BOARD_FLYTVPLATINUM_FM: |
383 | ir_codes = flyvideo_codes; | 479 | ir_codes = flyvideo_codes; |
384 | mask_keycode = 0xEC00000; | 480 | mask_keycode = 0xEC00000; |
385 | mask_keydown = 0x0040000; | 481 | mask_keydown = 0x0040000; |
@@ -405,8 +501,12 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
405 | polling = 50; // ms | 501 | polling = 50; // ms |
406 | break; | 502 | break; |
407 | case SAA7134_BOARD_MD2819: | 503 | case SAA7134_BOARD_MD2819: |
504 | case SAA7134_BOARD_KWORLD_VSTREAM_XPERT: | ||
408 | case SAA7134_BOARD_AVERMEDIA_305: | 505 | case SAA7134_BOARD_AVERMEDIA_305: |
409 | case SAA7134_BOARD_AVERMEDIA_307: | 506 | case SAA7134_BOARD_AVERMEDIA_307: |
507 | case SAA7134_BOARD_AVERMEDIA_STUDIO_305: | ||
508 | case SAA7134_BOARD_AVERMEDIA_STUDIO_307: | ||
509 | case SAA7134_BOARD_AVERMEDIA_GO_007_FM: | ||
410 | ir_codes = md2819_codes; | 510 | ir_codes = md2819_codes; |
411 | mask_keycode = 0x0007C8; | 511 | mask_keycode = 0x0007C8; |
412 | mask_keydown = 0x000010; | 512 | mask_keydown = 0x000010; |
@@ -415,6 +515,14 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
415 | saa_setb(SAA7134_GPIO_GPMODE0, 0x4); | 515 | saa_setb(SAA7134_GPIO_GPMODE0, 0x4); |
416 | saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4); | 516 | saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4); |
417 | break; | 517 | break; |
518 | case SAA7134_BOARD_MANLI_MTV001: | ||
519 | case SAA7134_BOARD_MANLI_MTV002: | ||
520 | ir_codes = manli_codes; | ||
521 | mask_keycode = 0x001f00; | ||
522 | mask_keyup = 0x004000; | ||
523 | mask_keydown = 0x002000; | ||
524 | polling = 50; // ms | ||
525 | break; | ||
418 | case SAA7134_BOARD_VIDEOMATE_TV_PVR: | 526 | case SAA7134_BOARD_VIDEOMATE_TV_PVR: |
419 | ir_codes = videomate_tv_pvr_codes; | 527 | ir_codes = videomate_tv_pvr_codes; |
420 | mask_keycode = 0x00003F; | 528 | mask_keycode = 0x00003F; |
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c index 6b6a643bf1cd..81732904623f 100644 --- a/drivers/media/video/saa7134/saa7134-oss.c +++ b/drivers/media/video/saa7134/saa7134-oss.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-oss.c,v 1.13 2004/12/10 12:33:39 kraxel Exp $ | 2 | * $Id: saa7134-oss.c,v 1.14 2005/05/18 22:45:16 hhackmann Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * oss dsp interface | 5 | * oss dsp interface |
@@ -49,7 +49,6 @@ MODULE_PARM_DESC(oss_rate,"sample rate (valid are: 32000,48000)"); | |||
49 | 49 | ||
50 | static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) | 50 | static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) |
51 | { | 51 | { |
52 | blksize &= ~0xff; | ||
53 | if (blksize < 0x100) | 52 | if (blksize < 0x100) |
54 | blksize = 0x100; | 53 | blksize = 0x100; |
55 | if (blksize > 0x10000) | 54 | if (blksize > 0x10000) |
@@ -57,8 +56,6 @@ static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) | |||
57 | 56 | ||
58 | if (blocks < 2) | 57 | if (blocks < 2) |
59 | blocks = 2; | 58 | blocks = 2; |
60 | while ((blksize * blocks) & ~PAGE_MASK) | ||
61 | blocks++; | ||
62 | if ((blksize * blocks) > 1024*1024) | 59 | if ((blksize * blocks) > 1024*1024) |
63 | blocks = 1024*1024 / blksize; | 60 | blocks = 1024*1024 / blksize; |
64 | 61 | ||
@@ -79,7 +76,7 @@ static int dsp_buffer_init(struct saa7134_dev *dev) | |||
79 | BUG(); | 76 | BUG(); |
80 | videobuf_dma_init(&dev->oss.dma); | 77 | videobuf_dma_init(&dev->oss.dma); |
81 | err = videobuf_dma_init_kernel(&dev->oss.dma, PCI_DMA_FROMDEVICE, | 78 | err = videobuf_dma_init_kernel(&dev->oss.dma, PCI_DMA_FROMDEVICE, |
82 | dev->oss.bufsize >> PAGE_SHIFT); | 79 | (dev->oss.bufsize + PAGE_SIZE) >> PAGE_SHIFT); |
83 | if (0 != err) | 80 | if (0 != err) |
84 | return err; | 81 | return err; |
85 | return 0; | 82 | return 0; |
@@ -163,10 +160,11 @@ static int dsp_rec_start(struct saa7134_dev *dev) | |||
163 | fmt |= 0x04; | 160 | fmt |= 0x04; |
164 | fmt |= (TV == dev->oss.input) ? 0xc0 : 0x80; | 161 | fmt |= (TV == dev->oss.input) ? 0xc0 : 0x80; |
165 | 162 | ||
166 | saa_writeb(SAA7134_NUM_SAMPLES0, (dev->oss.blksize & 0x0000ff)); | 163 | saa_writeb(SAA7134_NUM_SAMPLES0, ((dev->oss.blksize - 1) & 0x0000ff)); |
167 | saa_writeb(SAA7134_NUM_SAMPLES1, (dev->oss.blksize & 0x00ff00) >> 8); | 164 | saa_writeb(SAA7134_NUM_SAMPLES1, ((dev->oss.blksize - 1) & 0x00ff00) >> 8); |
168 | saa_writeb(SAA7134_NUM_SAMPLES2, (dev->oss.blksize & 0xff0000) >> 16); | 165 | saa_writeb(SAA7134_NUM_SAMPLES2, ((dev->oss.blksize - 1) & 0xff0000) >> 16); |
169 | saa_writeb(SAA7134_AUDIO_FORMAT_CTRL, fmt); | 166 | saa_writeb(SAA7134_AUDIO_FORMAT_CTRL, fmt); |
167 | |||
170 | break; | 168 | break; |
171 | case PCI_DEVICE_ID_PHILIPS_SAA7133: | 169 | case PCI_DEVICE_ID_PHILIPS_SAA7133: |
172 | case PCI_DEVICE_ID_PHILIPS_SAA7135: | 170 | case PCI_DEVICE_ID_PHILIPS_SAA7135: |
@@ -817,7 +815,7 @@ void saa7134_irq_oss_done(struct saa7134_dev *dev, unsigned long status) | |||
817 | reg = SAA7134_RS_BA1(6); | 815 | reg = SAA7134_RS_BA1(6); |
818 | } else { | 816 | } else { |
819 | /* even */ | 817 | /* even */ |
820 | if (0 == (dev->oss.dma_blk & 0x00)) | 818 | if (1 == (dev->oss.dma_blk & 0x01)) |
821 | reg = SAA7134_RS_BA2(6); | 819 | reg = SAA7134_RS_BA2(6); |
822 | } | 820 | } |
823 | if (0 == reg) { | 821 | if (0 == reg) { |
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index ecac13c006d5..3617e7f7a410 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-tvaudio.c,v 1.22 2005/01/07 13:11:19 kraxel Exp $ | 2 | * $Id: saa7134-tvaudio.c,v 1.25 2005/06/07 19:00:38 nsh Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * tv audio decoder (fm stereo, nicam, ...) | 5 | * tv audio decoder (fm stereo, nicam, ...) |
@@ -181,7 +181,8 @@ static void tvaudio_init(struct saa7134_dev *dev) | |||
181 | saa_writeb(SAA7134_AUDIO_CLOCK0, clock & 0xff); | 181 | saa_writeb(SAA7134_AUDIO_CLOCK0, clock & 0xff); |
182 | saa_writeb(SAA7134_AUDIO_CLOCK1, (clock >> 8) & 0xff); | 182 | saa_writeb(SAA7134_AUDIO_CLOCK1, (clock >> 8) & 0xff); |
183 | saa_writeb(SAA7134_AUDIO_CLOCK2, (clock >> 16) & 0xff); | 183 | saa_writeb(SAA7134_AUDIO_CLOCK2, (clock >> 16) & 0xff); |
184 | saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x01); | 184 | // frame locked audio was reported not to be reliable |
185 | saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x02); | ||
185 | 186 | ||
186 | saa_writeb(SAA7134_NICAM_ERROR_LOW, 0x14); | 187 | saa_writeb(SAA7134_NICAM_ERROR_LOW, 0x14); |
187 | saa_writeb(SAA7134_NICAM_ERROR_HIGH, 0x50); | 188 | saa_writeb(SAA7134_NICAM_ERROR_HIGH, 0x50); |
@@ -250,6 +251,11 @@ static void mute_input_7134(struct saa7134_dev *dev) | |||
250 | saa_andorb(SAA7134_AUDIO_FORMAT_CTRL, 0xc0, ausel); | 251 | saa_andorb(SAA7134_AUDIO_FORMAT_CTRL, 0xc0, ausel); |
251 | saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x08, ics); | 252 | saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x08, ics); |
252 | saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x07, ocs); | 253 | saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x07, ocs); |
254 | // for oss, we need to change the clock configuration | ||
255 | if (in->amux == TV) | ||
256 | saa_andorb(SAA7134_SIF_SAMPLE_FREQ, 0x03, 0x00); | ||
257 | else | ||
258 | saa_andorb(SAA7134_SIF_SAMPLE_FREQ, 0x03, 0x01); | ||
253 | 259 | ||
254 | /* switch gpio-connected external audio mux */ | 260 | /* switch gpio-connected external audio mux */ |
255 | if (0 == card(dev).gpiomask) | 261 | if (0 == card(dev).gpiomask) |
@@ -439,16 +445,15 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au | |||
439 | nicam = saa_readb(SAA7134_NICAM_STATUS); | 445 | nicam = saa_readb(SAA7134_NICAM_STATUS); |
440 | dprintk("getstereo: nicam=0x%x\n",nicam); | 446 | dprintk("getstereo: nicam=0x%x\n",nicam); |
441 | switch (nicam & 0x0b) { | 447 | switch (nicam & 0x0b) { |
448 | case 0x08: | ||
449 | retval = V4L2_TUNER_SUB_MONO; | ||
450 | break; | ||
442 | case 0x09: | 451 | case 0x09: |
443 | retval = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; | 452 | retval = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; |
444 | break; | 453 | break; |
445 | case 0x0a: | 454 | case 0x0a: |
446 | retval = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; | 455 | retval = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; |
447 | break; | 456 | break; |
448 | case 0x08: | ||
449 | default: | ||
450 | retval = V4L2_TUNER_SUB_MONO; | ||
451 | break; | ||
452 | } | 457 | } |
453 | break; | 458 | break; |
454 | } | 459 | } |
@@ -572,14 +577,14 @@ static int tvaudio_thread(void *data) | |||
572 | } else if (0 != dev->last_carrier) { | 577 | } else if (0 != dev->last_carrier) { |
573 | /* no carrier -- try last detected one as fallback */ | 578 | /* no carrier -- try last detected one as fallback */ |
574 | carrier = dev->last_carrier; | 579 | carrier = dev->last_carrier; |
575 | printk(KERN_WARNING "%s/audio: audio carrier scan failed, " | 580 | dprintk(KERN_WARNING "%s/audio: audio carrier scan failed, " |
576 | "using %d.%03d MHz [last detected]\n", | 581 | "using %d.%03d MHz [last detected]\n", |
577 | dev->name, carrier/1000, carrier%1000); | 582 | dev->name, carrier/1000, carrier%1000); |
578 | 583 | ||
579 | } else { | 584 | } else { |
580 | /* no carrier + no fallback -- use default */ | 585 | /* no carrier + no fallback -- use default */ |
581 | carrier = default_carrier; | 586 | carrier = default_carrier; |
582 | printk(KERN_WARNING "%s/audio: audio carrier scan failed, " | 587 | dprintk(KERN_WARNING "%s/audio: audio carrier scan failed, " |
583 | "using %d.%03d MHz [default]\n", | 588 | "using %d.%03d MHz [default]\n", |
584 | dev->name, carrier/1000, carrier%1000); | 589 | dev->name, carrier/1000, carrier%1000); |
585 | } | 590 | } |
diff --git a/drivers/media/video/saa7134/saa7134-vbi.c b/drivers/media/video/saa7134/saa7134-vbi.c index 86954cc7c377..3c33c591cc85 100644 --- a/drivers/media/video/saa7134/saa7134-vbi.c +++ b/drivers/media/video/saa7134/saa7134-vbi.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-vbi.c,v 1.6 2004/12/10 12:33:39 kraxel Exp $ | 2 | * $Id: saa7134-vbi.c,v 1.7 2005/05/24 23:13:06 nsh Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * video4linux video interface | 5 | * video4linux video interface |
@@ -60,10 +60,10 @@ static void task_init(struct saa7134_dev *dev, struct saa7134_buf *buf, | |||
60 | saa_writeb(SAA7134_VBI_H_START2(task), norm->h_start >> 8); | 60 | saa_writeb(SAA7134_VBI_H_START2(task), norm->h_start >> 8); |
61 | saa_writeb(SAA7134_VBI_H_STOP1(task), norm->h_stop & 0xff); | 61 | saa_writeb(SAA7134_VBI_H_STOP1(task), norm->h_stop & 0xff); |
62 | saa_writeb(SAA7134_VBI_H_STOP2(task), norm->h_stop >> 8); | 62 | saa_writeb(SAA7134_VBI_H_STOP2(task), norm->h_stop >> 8); |
63 | saa_writeb(SAA7134_VBI_V_START1(task), norm->vbi_v_start & 0xff); | 63 | saa_writeb(SAA7134_VBI_V_START1(task), norm->vbi_v_start_0 & 0xff); |
64 | saa_writeb(SAA7134_VBI_V_START2(task), norm->vbi_v_start >> 8); | 64 | saa_writeb(SAA7134_VBI_V_START2(task), norm->vbi_v_start_0 >> 8); |
65 | saa_writeb(SAA7134_VBI_V_STOP1(task), norm->vbi_v_stop & 0xff); | 65 | saa_writeb(SAA7134_VBI_V_STOP1(task), norm->vbi_v_stop_0 & 0xff); |
66 | saa_writeb(SAA7134_VBI_V_STOP2(task), norm->vbi_v_stop >> 8); | 66 | saa_writeb(SAA7134_VBI_V_STOP2(task), norm->vbi_v_stop_0 >> 8); |
67 | 67 | ||
68 | saa_writeb(SAA7134_VBI_H_SCALE_INC1(task), VBI_SCALE & 0xff); | 68 | saa_writeb(SAA7134_VBI_H_SCALE_INC1(task), VBI_SCALE & 0xff); |
69 | saa_writeb(SAA7134_VBI_H_SCALE_INC2(task), VBI_SCALE >> 8); | 69 | saa_writeb(SAA7134_VBI_H_SCALE_INC2(task), VBI_SCALE >> 8); |
@@ -127,7 +127,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
127 | unsigned int lines, llength, size; | 127 | unsigned int lines, llength, size; |
128 | int err; | 128 | int err; |
129 | 129 | ||
130 | lines = norm->vbi_v_stop - norm->vbi_v_start +1; | 130 | lines = norm->vbi_v_stop_0 - norm->vbi_v_start_0 +1; |
131 | if (lines > VBI_LINE_COUNT) | 131 | if (lines > VBI_LINE_COUNT) |
132 | lines = VBI_LINE_COUNT; | 132 | lines = VBI_LINE_COUNT; |
133 | #if 1 | 133 | #if 1 |
@@ -177,7 +177,7 @@ buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size) | |||
177 | struct saa7134_dev *dev = fh->dev; | 177 | struct saa7134_dev *dev = fh->dev; |
178 | int llength,lines; | 178 | int llength,lines; |
179 | 179 | ||
180 | lines = dev->tvnorm->vbi_v_stop - dev->tvnorm->vbi_v_start +1; | 180 | lines = dev->tvnorm->vbi_v_stop_0 - dev->tvnorm->vbi_v_start_0 +1; |
181 | #if 1 | 181 | #if 1 |
182 | llength = VBI_LINE_LENGTH; | 182 | llength = VBI_LINE_LENGTH; |
183 | #else | 183 | #else |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 5d66060026ff..c0a2ee520531 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-video.c,v 1.28 2005/02/15 15:59:35 kraxel Exp $ | 2 | * $Id: saa7134-video.c,v 1.30 2005/06/07 19:00:38 nsh Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * video4linux video interface | 5 | * video4linux video interface |
@@ -31,8 +31,6 @@ | |||
31 | #include "saa7134-reg.h" | 31 | #include "saa7134-reg.h" |
32 | #include "saa7134.h" | 32 | #include "saa7134.h" |
33 | 33 | ||
34 | #define V4L2_I2C_CLIENTS 1 | ||
35 | |||
36 | /* ------------------------------------------------------------------ */ | 34 | /* ------------------------------------------------------------------ */ |
37 | 35 | ||
38 | static unsigned int video_debug = 0; | 36 | static unsigned int video_debug = 0; |
@@ -158,18 +156,20 @@ static struct saa7134_format formats[] = { | |||
158 | .h_stop = 719, \ | 156 | .h_stop = 719, \ |
159 | .video_v_start = 24, \ | 157 | .video_v_start = 24, \ |
160 | .video_v_stop = 311, \ | 158 | .video_v_stop = 311, \ |
161 | .vbi_v_start = 7, \ | 159 | .vbi_v_start_0 = 7, \ |
162 | .vbi_v_stop = 22, \ | 160 | .vbi_v_stop_0 = 22, \ |
161 | .vbi_v_start_1 = 319, \ | ||
163 | .src_timing = 4 | 162 | .src_timing = 4 |
164 | 163 | ||
165 | #define NORM_525_60 \ | 164 | #define NORM_525_60 \ |
166 | .h_start = 0, \ | 165 | .h_start = 0, \ |
167 | .h_stop = 703, \ | 166 | .h_stop = 703, \ |
168 | .video_v_start = 22, \ | 167 | .video_v_start = 23, \ |
169 | .video_v_stop = 22+239, \ | 168 | .video_v_stop = 262, \ |
170 | .vbi_v_start = 10, /* FIXME */ \ | 169 | .vbi_v_start_0 = 10, \ |
171 | .vbi_v_stop = 21, /* FIXME */ \ | 170 | .vbi_v_stop_0 = 21, \ |
172 | .src_timing = 1 | 171 | .vbi_v_start_1 = 273, \ |
172 | .src_timing = 7 | ||
173 | 173 | ||
174 | static struct saa7134_tvnorm tvnorms[] = { | 174 | static struct saa7134_tvnorm tvnorms[] = { |
175 | { | 175 | { |
@@ -274,11 +274,12 @@ static struct saa7134_tvnorm tvnorms[] = { | |||
274 | 274 | ||
275 | .h_start = 0, | 275 | .h_start = 0, |
276 | .h_stop = 719, | 276 | .h_stop = 719, |
277 | .video_v_start = 22, | 277 | .video_v_start = 23, |
278 | .video_v_stop = 22+239, | 278 | .video_v_stop = 262, |
279 | .vbi_v_start = 10, /* FIXME */ | 279 | .vbi_v_start_0 = 10, |
280 | .vbi_v_stop = 21, /* FIXME */ | 280 | .vbi_v_stop_0 = 21, |
281 | .src_timing = 1, | 281 | .vbi_v_start_1 = 273, |
282 | .src_timing = 7, | ||
282 | 283 | ||
283 | .sync_control = 0x18, | 284 | .sync_control = 0x18, |
284 | .luma_control = 0x40, | 285 | .luma_control = 0x40, |
@@ -335,8 +336,8 @@ static const struct v4l2_queryctrl video_ctrls[] = { | |||
335 | .default_value = 0, | 336 | .default_value = 0, |
336 | .type = V4L2_CTRL_TYPE_INTEGER, | 337 | .type = V4L2_CTRL_TYPE_INTEGER, |
337 | },{ | 338 | },{ |
338 | .id = V4L2_CID_VFLIP, | 339 | .id = V4L2_CID_HFLIP, |
339 | .name = "vertical flip", | 340 | .name = "Mirror", |
340 | .minimum = 0, | 341 | .minimum = 0, |
341 | .maximum = 1, | 342 | .maximum = 1, |
342 | .type = V4L2_CTRL_TYPE_BOOLEAN, | 343 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
@@ -482,7 +483,7 @@ static void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm) | |||
482 | dev->crop_bounds.width = norm->h_stop - norm->h_start +1; | 483 | dev->crop_bounds.width = norm->h_stop - norm->h_start +1; |
483 | dev->crop_defrect.width = norm->h_stop - norm->h_start +1; | 484 | dev->crop_defrect.width = norm->h_stop - norm->h_start +1; |
484 | 485 | ||
485 | dev->crop_bounds.top = (norm->vbi_v_stop+1)*2; | 486 | dev->crop_bounds.top = (norm->vbi_v_stop_0+1)*2; |
486 | dev->crop_defrect.top = norm->video_v_start*2; | 487 | dev->crop_defrect.top = norm->video_v_start*2; |
487 | dev->crop_bounds.height = ((norm->id & V4L2_STD_525_60) ? 524 : 624) | 488 | dev->crop_bounds.height = ((norm->id & V4L2_STD_525_60) ? 524 : 624) |
488 | - dev->crop_bounds.top; | 489 | - dev->crop_bounds.top; |
@@ -521,22 +522,7 @@ static void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm) | |||
521 | saa_writeb(SAA7134_RAW_DATA_GAIN, 0x40); | 522 | saa_writeb(SAA7134_RAW_DATA_GAIN, 0x40); |
522 | saa_writeb(SAA7134_RAW_DATA_OFFSET, 0x80); | 523 | saa_writeb(SAA7134_RAW_DATA_OFFSET, 0x80); |
523 | 524 | ||
524 | #ifdef V4L2_I2C_CLIENTS | ||
525 | saa7134_i2c_call_clients(dev,VIDIOC_S_STD,&norm->id); | 525 | saa7134_i2c_call_clients(dev,VIDIOC_S_STD,&norm->id); |
526 | #else | ||
527 | { | ||
528 | /* pass down info to the i2c chips (v4l1) */ | ||
529 | struct video_channel c; | ||
530 | memset(&c,0,sizeof(c)); | ||
531 | c.channel = dev->ctl_input; | ||
532 | c.norm = VIDEO_MODE_PAL; | ||
533 | if (norm->id & V4L2_STD_NTSC) | ||
534 | c.norm = VIDEO_MODE_NTSC; | ||
535 | if (norm->id & V4L2_STD_SECAM) | ||
536 | c.norm = VIDEO_MODE_SECAM; | ||
537 | saa7134_i2c_call_clients(dev,VIDIOCSCHAN,&c); | ||
538 | } | ||
539 | #endif | ||
540 | } | 526 | } |
541 | 527 | ||
542 | static void video_mux(struct saa7134_dev *dev, int input) | 528 | static void video_mux(struct saa7134_dev *dev, int input) |
@@ -1064,7 +1050,7 @@ static int get_control(struct saa7134_dev *dev, struct v4l2_control *c) | |||
1064 | case V4L2_CID_PRIVATE_INVERT: | 1050 | case V4L2_CID_PRIVATE_INVERT: |
1065 | c->value = dev->ctl_invert; | 1051 | c->value = dev->ctl_invert; |
1066 | break; | 1052 | break; |
1067 | case V4L2_CID_VFLIP: | 1053 | case V4L2_CID_HFLIP: |
1068 | c->value = dev->ctl_mirror; | 1054 | c->value = dev->ctl_mirror; |
1069 | break; | 1055 | break; |
1070 | case V4L2_CID_PRIVATE_Y_EVEN: | 1056 | case V4L2_CID_PRIVATE_Y_EVEN: |
@@ -1139,7 +1125,7 @@ static int set_control(struct saa7134_dev *dev, struct saa7134_fh *fh, | |||
1139 | saa_writeb(SAA7134_DEC_CHROMA_SATURATION, | 1125 | saa_writeb(SAA7134_DEC_CHROMA_SATURATION, |
1140 | dev->ctl_invert ? -dev->ctl_saturation : dev->ctl_saturation); | 1126 | dev->ctl_invert ? -dev->ctl_saturation : dev->ctl_saturation); |
1141 | break; | 1127 | break; |
1142 | case V4L2_CID_VFLIP: | 1128 | case V4L2_CID_HFLIP: |
1143 | dev->ctl_mirror = c->value; | 1129 | dev->ctl_mirror = c->value; |
1144 | restart_overlay = 1; | 1130 | restart_overlay = 1; |
1145 | break; | 1131 | break; |
@@ -1407,9 +1393,9 @@ static void saa7134_vbi_fmt(struct saa7134_dev *dev, struct v4l2_format *f) | |||
1407 | f->fmt.vbi.samples_per_line = 2048 /* VBI_LINE_LENGTH */; | 1393 | f->fmt.vbi.samples_per_line = 2048 /* VBI_LINE_LENGTH */; |
1408 | f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY; | 1394 | f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY; |
1409 | f->fmt.vbi.offset = 64 * 4; | 1395 | f->fmt.vbi.offset = 64 * 4; |
1410 | f->fmt.vbi.start[0] = norm->vbi_v_start; | 1396 | f->fmt.vbi.start[0] = norm->vbi_v_start_0; |
1411 | f->fmt.vbi.count[0] = norm->vbi_v_stop - norm->vbi_v_start +1; | 1397 | f->fmt.vbi.count[0] = norm->vbi_v_stop_0 - norm->vbi_v_start_0 +1; |
1412 | f->fmt.vbi.start[1] = norm->video_v_stop + norm->vbi_v_start +1; | 1398 | f->fmt.vbi.start[1] = norm->vbi_v_start_1; |
1413 | f->fmt.vbi.count[1] = f->fmt.vbi.count[0]; | 1399 | f->fmt.vbi.count[1] = f->fmt.vbi.count[0]; |
1414 | f->fmt.vbi.flags = 0; /* VBI_UNSYNC VBI_INTERLACED */ | 1400 | f->fmt.vbi.flags = 0; /* VBI_UNSYNC VBI_INTERLACED */ |
1415 | 1401 | ||
@@ -1880,11 +1866,9 @@ static int video_do_ioctl(struct inode *inode, struct file *file, | |||
1880 | return -EINVAL; | 1866 | return -EINVAL; |
1881 | down(&dev->lock); | 1867 | down(&dev->lock); |
1882 | dev->ctl_freq = f->frequency; | 1868 | dev->ctl_freq = f->frequency; |
1883 | #ifdef V4L2_I2C_CLIENTS | 1869 | |
1884 | saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,f); | 1870 | saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,f); |
1885 | #else | 1871 | |
1886 | saa7134_i2c_call_clients(dev,VIDIOCSFREQ,&dev->ctl_freq); | ||
1887 | #endif | ||
1888 | saa7134_tvaudio_do_scan(dev); | 1872 | saa7134_tvaudio_do_scan(dev); |
1889 | up(&dev->lock); | 1873 | up(&dev->lock); |
1890 | return 0; | 1874 | return 0; |
@@ -2139,16 +2123,19 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
2139 | t->rangelow = (int)(65*16); | 2123 | t->rangelow = (int)(65*16); |
2140 | t->rangehigh = (int)(108*16); | 2124 | t->rangehigh = (int)(108*16); |
2141 | 2125 | ||
2142 | #ifdef V4L2_I2C_CLIENTS | 2126 | saa7134_i2c_call_clients(dev, VIDIOC_G_TUNER, t); |
2143 | saa7134_i2c_call_clients(dev,VIDIOC_G_TUNER,t); | 2127 | |
2144 | #else | 2128 | return 0; |
2145 | { | 2129 | } |
2146 | struct video_tuner vt; | 2130 | case VIDIOC_S_TUNER: |
2147 | memset(&vt,0,sizeof(vt)); | 2131 | { |
2148 | saa7134_i2c_call_clients(dev,VIDIOCGTUNER,&vt); | 2132 | struct v4l2_tuner *t = arg; |
2149 | t->signal = vt.signal; | 2133 | |
2150 | } | 2134 | if (0 != t->index) |
2151 | #endif | 2135 | return -EINVAL; |
2136 | |||
2137 | saa7134_i2c_call_clients(dev,VIDIOC_S_TUNER,t); | ||
2138 | |||
2152 | return 0; | 2139 | return 0; |
2153 | } | 2140 | } |
2154 | case VIDIOC_ENUMINPUT: | 2141 | case VIDIOC_ENUMINPUT: |
@@ -2182,7 +2169,6 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, | |||
2182 | return 0; | 2169 | return 0; |
2183 | } | 2170 | } |
2184 | case VIDIOC_S_AUDIO: | 2171 | case VIDIOC_S_AUDIO: |
2185 | case VIDIOC_S_TUNER: | ||
2186 | case VIDIOC_S_INPUT: | 2172 | case VIDIOC_S_INPUT: |
2187 | case VIDIOC_S_STD: | 2173 | case VIDIOC_S_STD: |
2188 | return 0; | 2174 | return 0; |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index ac90a9853236..d6b1c0d4d0f9 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134.h,v 1.38 2005/03/07 12:01:51 kraxel Exp $ | 2 | * $Id: saa7134.h,v 1.41 2005/06/07 18:02:26 nsh Exp $ |
3 | * | 3 | * |
4 | * v4l2 device driver for philips saa7134 based TV cards | 4 | * v4l2 device driver for philips saa7134 based TV cards |
5 | * | 5 | * |
@@ -21,7 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/version.h> | 23 | #include <linux/version.h> |
24 | #define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,12) | 24 | #define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,13) |
25 | 25 | ||
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
@@ -91,9 +91,10 @@ struct saa7134_tvnorm { | |||
91 | unsigned int h_stop; | 91 | unsigned int h_stop; |
92 | unsigned int video_v_start; | 92 | unsigned int video_v_start; |
93 | unsigned int video_v_stop; | 93 | unsigned int video_v_stop; |
94 | unsigned int vbi_v_start; | 94 | unsigned int vbi_v_start_0; |
95 | unsigned int vbi_v_stop; | 95 | unsigned int vbi_v_stop_0; |
96 | unsigned int src_timing; | 96 | unsigned int src_timing; |
97 | unsigned int vbi_v_start_1; | ||
97 | }; | 98 | }; |
98 | 99 | ||
99 | struct saa7134_tvaudio { | 100 | struct saa7134_tvaudio { |
@@ -167,7 +168,7 @@ struct saa7134_format { | |||
167 | #define SAA7134_BOARD_SABRENT_SBTTVFM 42 | 168 | #define SAA7134_BOARD_SABRENT_SBTTVFM 42 |
168 | #define SAA7134_BOARD_ZOLID_XPERT_TV7134 43 | 169 | #define SAA7134_BOARD_ZOLID_XPERT_TV7134 43 |
169 | #define SAA7134_BOARD_EMPIRE_PCI_TV_RADIO_LE 44 | 170 | #define SAA7134_BOARD_EMPIRE_PCI_TV_RADIO_LE 44 |
170 | #define SAA7134_BOARD_AVERMEDIA_307 45 | 171 | #define SAA7134_BOARD_AVERMEDIA_STUDIO_307 45 |
171 | #define SAA7134_BOARD_AVERMEDIA_CARDBUS 46 | 172 | #define SAA7134_BOARD_AVERMEDIA_CARDBUS 46 |
172 | #define SAA7134_BOARD_CINERGY400_CARDBUS 47 | 173 | #define SAA7134_BOARD_CINERGY400_CARDBUS 47 |
173 | #define SAA7134_BOARD_CINERGY600_MK3 48 | 174 | #define SAA7134_BOARD_CINERGY600_MK3 48 |
@@ -178,6 +179,10 @@ struct saa7134_format { | |||
178 | #define SAA7135_BOARD_ASUSTeK_TVFM7135 53 | 179 | #define SAA7135_BOARD_ASUSTeK_TVFM7135 53 |
179 | #define SAA7134_BOARD_FLYTVPLATINUM_FM 54 | 180 | #define SAA7134_BOARD_FLYTVPLATINUM_FM 54 |
180 | #define SAA7134_BOARD_FLYDVBTDUO 55 | 181 | #define SAA7134_BOARD_FLYDVBTDUO 55 |
182 | #define SAA7134_BOARD_AVERMEDIA_307 56 | ||
183 | #define SAA7134_BOARD_AVERMEDIA_GO_007_FM 57 | ||
184 | #define SAA7134_BOARD_ADS_INSTANT_TV 58 | ||
185 | #define SAA7134_BOARD_KWORLD_VSTREAM_XPERT 59 | ||
181 | 186 | ||
182 | #define SAA7134_MAXBOARDS 8 | 187 | #define SAA7134_MAXBOARDS 8 |
183 | #define SAA7134_INPUT_MAX 8 | 188 | #define SAA7134_INPUT_MAX 8 |
@@ -241,7 +246,7 @@ struct saa7134_dma; | |||
241 | /* saa7134 page table */ | 246 | /* saa7134 page table */ |
242 | struct saa7134_pgtable { | 247 | struct saa7134_pgtable { |
243 | unsigned int size; | 248 | unsigned int size; |
244 | u32 *cpu; | 249 | __le32 *cpu; |
245 | dma_addr_t dma; | 250 | dma_addr_t dma; |
246 | }; | 251 | }; |
247 | 252 | ||
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 7e6e6dd966a2..39773633cc3c 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c | |||
@@ -53,6 +53,7 @@ struct tda9887 { | |||
53 | unsigned int config; | 53 | unsigned int config; |
54 | unsigned int pinnacle_id; | 54 | unsigned int pinnacle_id; |
55 | unsigned int using_v4l2; | 55 | unsigned int using_v4l2; |
56 | unsigned int radio_mode; | ||
56 | }; | 57 | }; |
57 | 58 | ||
58 | struct tvnorm { | 59 | struct tvnorm { |
@@ -212,12 +213,22 @@ static struct tvnorm tvnorms[] = { | |||
212 | } | 213 | } |
213 | }; | 214 | }; |
214 | 215 | ||
215 | static struct tvnorm radio = { | 216 | static struct tvnorm radio_stereo = { |
216 | .name = "radio", | 217 | .name = "Radio Stereo", |
218 | .b = ( cFmRadio | | ||
219 | cQSS ), | ||
220 | .c = ( cDeemphasisOFF | | ||
221 | cAudioGain6 ), | ||
222 | .e = ( cAudioIF_5_5 | | ||
223 | cRadioIF_38_90 ), | ||
224 | }; | ||
225 | |||
226 | static struct tvnorm radio_mono = { | ||
227 | .name = "Radio Mono", | ||
217 | .b = ( cFmRadio | | 228 | .b = ( cFmRadio | |
218 | cQSS ), | 229 | cQSS ), |
219 | .c = ( cDeemphasisON | | 230 | .c = ( cDeemphasisON | |
220 | cDeemphasis50 ), | 231 | cDeemphasis50), |
221 | .e = ( cAudioIF_5_5 | | 232 | .e = ( cAudioIF_5_5 | |
222 | cRadioIF_38_90 ), | 233 | cRadioIF_38_90 ), |
223 | }; | 234 | }; |
@@ -354,7 +365,10 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf) | |||
354 | int i; | 365 | int i; |
355 | 366 | ||
356 | if (t->radio) { | 367 | if (t->radio) { |
357 | norm = &radio; | 368 | if (t->radio_mode == V4L2_TUNER_MODE_MONO) |
369 | norm = &radio_mono; | ||
370 | else | ||
371 | norm = &radio_stereo; | ||
358 | } else { | 372 | } else { |
359 | for (i = 0; i < ARRAY_SIZE(tvnorms); i++) { | 373 | for (i = 0; i < ARRAY_SIZE(tvnorms); i++) { |
360 | if (tvnorms[i].std & t->std) { | 374 | if (tvnorms[i].std & t->std) { |
@@ -545,11 +559,14 @@ static int tda9887_configure(struct tda9887 *t) | |||
545 | 559 | ||
546 | memset(buf,0,sizeof(buf)); | 560 | memset(buf,0,sizeof(buf)); |
547 | tda9887_set_tvnorm(t,buf); | 561 | tda9887_set_tvnorm(t,buf); |
562 | |||
548 | buf[1] |= cOutputPort1Inactive; | 563 | buf[1] |= cOutputPort1Inactive; |
549 | buf[1] |= cOutputPort2Inactive; | 564 | buf[1] |= cOutputPort2Inactive; |
565 | |||
550 | if (UNSET != t->pinnacle_id) { | 566 | if (UNSET != t->pinnacle_id) { |
551 | tda9887_set_pinnacle(t,buf); | 567 | tda9887_set_pinnacle(t,buf); |
552 | } | 568 | } |
569 | |||
553 | tda9887_set_config(t,buf); | 570 | tda9887_set_config(t,buf); |
554 | tda9887_set_insmod(t,buf); | 571 | tda9887_set_insmod(t,buf); |
555 | 572 | ||
@@ -592,9 +609,12 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind) | |||
592 | if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) | 609 | if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) |
593 | return -ENOMEM; | 610 | return -ENOMEM; |
594 | memset(t,0,sizeof(*t)); | 611 | memset(t,0,sizeof(*t)); |
612 | |||
595 | t->client = client_template; | 613 | t->client = client_template; |
596 | t->std = 0; | 614 | t->std = 0; |
597 | t->pinnacle_id = UNSET; | 615 | t->pinnacle_id = UNSET; |
616 | t->radio_mode = V4L2_TUNER_MODE_STEREO; | ||
617 | |||
598 | i2c_set_clientdata(&t->client, t); | 618 | i2c_set_clientdata(&t->client, t); |
599 | i2c_attach_client(&t->client); | 619 | i2c_attach_client(&t->client); |
600 | 620 | ||
@@ -733,6 +753,16 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
733 | } | 753 | } |
734 | break; | 754 | break; |
735 | } | 755 | } |
756 | case VIDIOC_S_TUNER: | ||
757 | { | ||
758 | struct v4l2_tuner* tuner = arg; | ||
759 | |||
760 | if (t->radio) { | ||
761 | t->radio_mode = tuner->audmode; | ||
762 | tda9887_configure (t); | ||
763 | } | ||
764 | break; | ||
765 | } | ||
736 | default: | 766 | default: |
737 | /* nothing */ | 767 | /* nothing */ |
738 | break; | 768 | break; |
@@ -740,7 +770,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
740 | return 0; | 770 | return 0; |
741 | } | 771 | } |
742 | 772 | ||
743 | static int tda9887_suspend(struct device * dev, pm_message_t state, u32 level) | 773 | static int tda9887_suspend(struct device * dev, u32 state, u32 level) |
744 | { | 774 | { |
745 | dprintk("tda9887: suspend\n"); | 775 | dprintk("tda9887: suspend\n"); |
746 | return 0; | 776 | return 0; |
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 81882ddab859..eaabfc858703 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tuner-core.c,v 1.5 2005/02/15 15:59:35 kraxel Exp $ | 2 | * $Id: tuner-core.c,v 1.15 2005/06/12 01:36:14 mchehab Exp $ |
3 | * | 3 | * |
4 | * i2c tv tuner chip device driver | 4 | * i2c tv tuner chip device driver |
5 | * core core, i.e. kernel interfaces, registering and so on | 5 | * core core, i.e. kernel interfaces, registering and so on |
@@ -23,6 +23,11 @@ | |||
23 | #include <media/tuner.h> | 23 | #include <media/tuner.h> |
24 | #include <media/audiochip.h> | 24 | #include <media/audiochip.h> |
25 | 25 | ||
26 | /* | ||
27 | * comment line bellow to return to old behavor, where only one I2C device is supported | ||
28 | */ | ||
29 | #define CONFIG_TUNER_MULTI_I2C /**/ | ||
30 | |||
26 | #define UNSET (-1U) | 31 | #define UNSET (-1U) |
27 | 32 | ||
28 | /* standard i2c insmod options */ | 33 | /* standard i2c insmod options */ |
@@ -53,13 +58,16 @@ MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer"); | |||
53 | MODULE_LICENSE("GPL"); | 58 | MODULE_LICENSE("GPL"); |
54 | 59 | ||
55 | static int this_adap; | 60 | static int this_adap; |
61 | #ifdef CONFIG_TUNER_MULTI_I2C | ||
62 | static unsigned short first_tuner, tv_tuner, radio_tuner; | ||
63 | #endif | ||
56 | 64 | ||
57 | static struct i2c_driver driver; | 65 | static struct i2c_driver driver; |
58 | static struct i2c_client client_template; | 66 | static struct i2c_client client_template; |
59 | 67 | ||
60 | /* ---------------------------------------------------------------------- */ | 68 | /* ---------------------------------------------------------------------- */ |
61 | 69 | ||
62 | // Set tuner frequency, freq in Units of 62.5kHz = 1/16MHz | 70 | /* Set tuner frequency, freq in Units of 62.5kHz = 1/16MHz */ |
63 | static void set_tv_freq(struct i2c_client *c, unsigned int freq) | 71 | static void set_tv_freq(struct i2c_client *c, unsigned int freq) |
64 | { | 72 | { |
65 | struct tuner *t = i2c_get_clientdata(c); | 73 | struct tuner *t = i2c_get_clientdata(c); |
@@ -73,14 +81,26 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) | |||
73 | return; | 81 | return; |
74 | } | 82 | } |
75 | if (freq < tv_range[0]*16 || freq > tv_range[1]*16) { | 83 | if (freq < tv_range[0]*16 || freq > tv_range[1]*16) { |
76 | /* FIXME: better do that chip-specific, but | 84 | |
77 | right now we don't have that in the config | 85 | if (freq >= tv_range[0]*16364 && freq <= tv_range[1]*16384) { |
78 | struct and this way is still better than no | 86 | /* V4L2_TUNER_CAP_LOW frequency */ |
79 | check at all */ | 87 | |
80 | tuner_info("TV freq (%d.%02d) out of range (%d-%d)\n", | 88 | tuner_dbg("V4L2_TUNER_CAP_LOW freq selected for TV. Tuners yet doesn't support converting it to valid freq.\n"); |
81 | freq/16,freq%16*100/16,tv_range[0],tv_range[1]); | 89 | |
82 | return; | 90 | t->tv_freq(c,freq>>10); |
91 | |||
92 | return; | ||
93 | } else { | ||
94 | /* FIXME: better do that chip-specific, but | ||
95 | right now we don't have that in the config | ||
96 | struct and this way is still better than no | ||
97 | check at all */ | ||
98 | tuner_info("TV freq (%d.%02d) out of range (%d-%d)\n", | ||
99 | freq/16,freq%16*100/16,tv_range[0],tv_range[1]); | ||
100 | return; | ||
101 | } | ||
83 | } | 102 | } |
103 | tuner_dbg("62.5 Khz freq step selected for TV.\n"); | ||
84 | t->tv_freq(c,freq); | 104 | t->tv_freq(c,freq); |
85 | } | 105 | } |
86 | 106 | ||
@@ -97,11 +117,29 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
97 | return; | 117 | return; |
98 | } | 118 | } |
99 | if (freq < radio_range[0]*16 || freq > radio_range[1]*16) { | 119 | if (freq < radio_range[0]*16 || freq > radio_range[1]*16) { |
100 | tuner_info("radio freq (%d.%02d) out of range (%d-%d)\n", | 120 | if (freq >= tv_range[0]*16364 && freq <= tv_range[1]*16384) { |
121 | /* V4L2_TUNER_CAP_LOW frequency */ | ||
122 | if (t->type == TUNER_TEA5767) { | ||
123 | tuner_info("radio freq step 62.5Hz (%d.%06d)\n",(freq>>14),freq%(1<<14)*10000); | ||
124 | t->radio_freq(c,freq>>10); | ||
125 | return; | ||
126 | } | ||
127 | |||
128 | tuner_dbg("V4L2_TUNER_CAP_LOW freq selected for Radio. Tuners yet doesn't support converting it to valid freq.\n"); | ||
129 | |||
130 | tuner_info("radio freq (%d.%06d)\n",(freq>>14),freq%(1<<14)*10000); | ||
131 | |||
132 | t->radio_freq(c,freq>>10); | ||
133 | return; | ||
134 | |||
135 | } else { | ||
136 | tuner_info("radio freq (%d.%02d) out of range (%d-%d)\n", | ||
101 | freq/16,freq%16*100/16, | 137 | freq/16,freq%16*100/16, |
102 | radio_range[0],radio_range[1]); | 138 | radio_range[0],radio_range[1]); |
103 | return; | 139 | return; |
140 | } | ||
104 | } | 141 | } |
142 | tuner_dbg("62.5 Khz freq step selected for Radio.\n"); | ||
105 | t->radio_freq(c,freq); | 143 | t->radio_freq(c,freq); |
106 | } | 144 | } |
107 | 145 | ||
@@ -129,8 +167,9 @@ static void set_type(struct i2c_client *c, unsigned int type) | |||
129 | { | 167 | { |
130 | struct tuner *t = i2c_get_clientdata(c); | 168 | struct tuner *t = i2c_get_clientdata(c); |
131 | 169 | ||
170 | tuner_dbg ("I2C addr 0x%02x with type %d\n",c->addr<<1,type); | ||
132 | /* sanity check */ | 171 | /* sanity check */ |
133 | if (type == UNSET || type == TUNER_ABSENT) | 172 | if (type == UNSET || type == TUNER_ABSENT) |
134 | return; | 173 | return; |
135 | if (type >= tuner_count) | 174 | if (type >= tuner_count) |
136 | return; | 175 | return; |
@@ -145,6 +184,7 @@ static void set_type(struct i2c_client *c, unsigned int type) | |||
145 | return; | 184 | return; |
146 | 185 | ||
147 | t->initialized = 1; | 186 | t->initialized = 1; |
187 | |||
148 | t->type = type; | 188 | t->type = type; |
149 | switch (t->type) { | 189 | switch (t->type) { |
150 | case TUNER_MT2032: | 190 | case TUNER_MT2032: |
@@ -159,6 +199,53 @@ static void set_type(struct i2c_client *c, unsigned int type) | |||
159 | } | 199 | } |
160 | } | 200 | } |
161 | 201 | ||
202 | #ifdef CONFIG_TUNER_MULTI_I2C | ||
203 | #define CHECK_ADDR(tp,cmd,tun) if (client->addr!=tp) { \ | ||
204 | return 0; } else \ | ||
205 | tuner_info ("Cmd %s accepted to "tun"\n",cmd); | ||
206 | #define CHECK_MODE(cmd) if (t->mode == V4L2_TUNER_RADIO) { \ | ||
207 | CHECK_ADDR(radio_tuner,cmd,"radio") } else \ | ||
208 | { CHECK_ADDR(tv_tuner,cmd,"TV"); } | ||
209 | #else | ||
210 | #define CHECK_ADDR(tp,cmd,tun) tuner_info ("Cmd %s accepted to "tun"\n",cmd); | ||
211 | #define CHECK_MODE(cmd) tuner_info ("Cmd %s accepted\n",cmd); | ||
212 | #endif | ||
213 | |||
214 | #ifdef CONFIG_TUNER_MULTI_I2C | ||
215 | |||
216 | static void set_addr(struct i2c_client *c, struct tuner_addr *tun_addr) | ||
217 | { | ||
218 | /* ADDR_UNSET defaults to first available tuner */ | ||
219 | if ( tun_addr->addr == ADDR_UNSET ) { | ||
220 | if (first_tuner != c->addr) | ||
221 | return; | ||
222 | switch (tun_addr->v4l2_tuner) { | ||
223 | case V4L2_TUNER_RADIO: | ||
224 | radio_tuner=c->addr; | ||
225 | break; | ||
226 | default: | ||
227 | tv_tuner=c->addr; | ||
228 | break; | ||
229 | } | ||
230 | } else { | ||
231 | /* Sets tuner to its configured value */ | ||
232 | switch (tun_addr->v4l2_tuner) { | ||
233 | case V4L2_TUNER_RADIO: | ||
234 | radio_tuner=tun_addr->addr; | ||
235 | if ( tun_addr->addr == c->addr ) set_type(c,tun_addr->type); | ||
236 | return; | ||
237 | default: | ||
238 | tv_tuner=tun_addr->addr; | ||
239 | if ( tun_addr->addr == c->addr ) set_type(c,tun_addr->type); | ||
240 | return; | ||
241 | } | ||
242 | } | ||
243 | set_type(c,tun_addr->type); | ||
244 | } | ||
245 | #else | ||
246 | #define set_addr(c,tun_addr) set_type(c,(tun_addr)->type) | ||
247 | #endif | ||
248 | |||
162 | static char pal[] = "-"; | 249 | static char pal[] = "-"; |
163 | module_param_string(pal, pal, sizeof(pal), 0644); | 250 | module_param_string(pal, pal, sizeof(pal), 0644); |
164 | 251 | ||
@@ -197,8 +284,17 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) | |||
197 | { | 284 | { |
198 | struct tuner *t; | 285 | struct tuner *t; |
199 | 286 | ||
287 | #ifndef CONFIG_TUNER_MULTI_I2C | ||
200 | if (this_adap > 0) | 288 | if (this_adap > 0) |
201 | return -1; | 289 | return -1; |
290 | #else | ||
291 | /* by default, first I2C card is both tv and radio tuner */ | ||
292 | if (this_adap == 0) { | ||
293 | first_tuner = addr; | ||
294 | tv_tuner = addr; | ||
295 | radio_tuner = addr; | ||
296 | } | ||
297 | #endif | ||
202 | this_adap++; | 298 | this_adap++; |
203 | 299 | ||
204 | client_template.adapter = adap; | 300 | client_template.adapter = adap; |
@@ -211,11 +307,12 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) | |||
211 | memcpy(&t->i2c,&client_template,sizeof(struct i2c_client)); | 307 | memcpy(&t->i2c,&client_template,sizeof(struct i2c_client)); |
212 | i2c_set_clientdata(&t->i2c, t); | 308 | i2c_set_clientdata(&t->i2c, t); |
213 | t->type = UNSET; | 309 | t->type = UNSET; |
214 | t->radio_if2 = 10700*1000; // 10.7MHz - FM radio | 310 | t->radio_if2 = 10700*1000; /* 10.7MHz - FM radio */ |
215 | 311 | ||
216 | i2c_attach_client(&t->i2c); | 312 | i2c_attach_client(&t->i2c); |
217 | tuner_info("chip found @ 0x%x (%s)\n", | 313 | tuner_info("chip found @ 0x%x (%s)\n", |
218 | addr << 1, adap->name); | 314 | addr << 1, adap->name); |
315 | |||
219 | set_type(&t->i2c, t->type); | 316 | set_type(&t->i2c, t->type); |
220 | return 0; | 317 | return 0; |
221 | } | 318 | } |
@@ -228,6 +325,12 @@ static int tuner_probe(struct i2c_adapter *adap) | |||
228 | } | 325 | } |
229 | this_adap = 0; | 326 | this_adap = 0; |
230 | 327 | ||
328 | #ifdef CONFIG_TUNER_MULTI_I2C | ||
329 | first_tuner = 0; | ||
330 | tv_tuner = 0; | ||
331 | radio_tuner = 0; | ||
332 | #endif | ||
333 | |||
231 | if (adap->class & I2C_CLASS_TV_ANALOG) | 334 | if (adap->class & I2C_CLASS_TV_ANALOG) |
232 | return i2c_probe(adap, &addr_data, tuner_attach); | 335 | return i2c_probe(adap, &addr_data, tuner_attach); |
233 | return 0; | 336 | return 0; |
@@ -236,8 +339,14 @@ static int tuner_probe(struct i2c_adapter *adap) | |||
236 | static int tuner_detach(struct i2c_client *client) | 339 | static int tuner_detach(struct i2c_client *client) |
237 | { | 340 | { |
238 | struct tuner *t = i2c_get_clientdata(client); | 341 | struct tuner *t = i2c_get_clientdata(client); |
342 | int err; | ||
343 | |||
344 | err=i2c_detach_client(&t->i2c); | ||
345 | if (err) { | ||
346 | tuner_warn ("Client deregistration failed, client not detached.\n"); | ||
347 | return err; | ||
348 | } | ||
239 | 349 | ||
240 | i2c_detach_client(&t->i2c); | ||
241 | kfree(t); | 350 | kfree(t); |
242 | return 0; | 351 | return 0; |
243 | } | 352 | } |
@@ -256,18 +365,23 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
256 | unsigned int *iarg = (int*)arg; | 365 | unsigned int *iarg = (int*)arg; |
257 | 366 | ||
258 | switch (cmd) { | 367 | switch (cmd) { |
259 | |||
260 | /* --- configuration --- */ | 368 | /* --- configuration --- */ |
261 | case TUNER_SET_TYPE: | 369 | case TUNER_SET_TYPE: |
262 | set_type(client,*iarg); | 370 | set_type(client,*iarg); |
263 | break; | 371 | break; |
372 | case TUNER_SET_TYPE_ADDR: | ||
373 | set_addr(client,(struct tuner_addr *)arg); | ||
374 | break; | ||
264 | case AUDC_SET_RADIO: | 375 | case AUDC_SET_RADIO: |
376 | t->mode = V4L2_TUNER_RADIO; | ||
377 | CHECK_ADDR(tv_tuner,"AUDC_SET_RADIO","TV"); | ||
378 | |||
265 | if (V4L2_TUNER_RADIO != t->mode) { | 379 | if (V4L2_TUNER_RADIO != t->mode) { |
266 | set_tv_freq(client,400 * 16); | 380 | set_tv_freq(client,400 * 16); |
267 | t->mode = V4L2_TUNER_RADIO; | ||
268 | } | 381 | } |
269 | break; | 382 | break; |
270 | case AUDC_CONFIG_PINNACLE: | 383 | case AUDC_CONFIG_PINNACLE: |
384 | CHECK_ADDR(tv_tuner,"AUDC_CONFIG_PINNACLE","TV"); | ||
271 | switch (*iarg) { | 385 | switch (*iarg) { |
272 | case 2: | 386 | case 2: |
273 | tuner_dbg("pinnacle pal\n"); | 387 | tuner_dbg("pinnacle pal\n"); |
@@ -297,6 +411,8 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
297 | 411 | ||
298 | CHECK_V4L2; | 412 | CHECK_V4L2; |
299 | t->mode = V4L2_TUNER_ANALOG_TV; | 413 | t->mode = V4L2_TUNER_ANALOG_TV; |
414 | CHECK_ADDR(tv_tuner,"VIDIOCSCHAN","TV"); | ||
415 | |||
300 | if (vc->norm < ARRAY_SIZE(map)) | 416 | if (vc->norm < ARRAY_SIZE(map)) |
301 | t->std = map[vc->norm]; | 417 | t->std = map[vc->norm]; |
302 | tuner_fixup_std(t); | 418 | tuner_fixup_std(t); |
@@ -308,6 +424,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
308 | { | 424 | { |
309 | unsigned long *v = arg; | 425 | unsigned long *v = arg; |
310 | 426 | ||
427 | CHECK_MODE("VIDIOCSFREQ"); | ||
311 | CHECK_V4L2; | 428 | CHECK_V4L2; |
312 | set_freq(client,*v); | 429 | set_freq(client,*v); |
313 | return 0; | 430 | return 0; |
@@ -316,15 +433,27 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
316 | { | 433 | { |
317 | struct video_tuner *vt = arg; | 434 | struct video_tuner *vt = arg; |
318 | 435 | ||
436 | CHECK_ADDR(radio_tuner,"VIDIOCGTUNER","radio"); | ||
319 | CHECK_V4L2; | 437 | CHECK_V4L2; |
320 | if (V4L2_TUNER_RADIO == t->mode && t->has_signal) | 438 | if (V4L2_TUNER_RADIO == t->mode) { |
321 | vt->signal = t->has_signal(client); | 439 | if (t->has_signal) |
440 | vt->signal = t->has_signal(client); | ||
441 | if (t->is_stereo) { | ||
442 | if (t->is_stereo(client)) | ||
443 | vt-> flags |= VIDEO_TUNER_STEREO_ON; | ||
444 | else | ||
445 | vt-> flags &= 0xffff ^ VIDEO_TUNER_STEREO_ON; | ||
446 | } | ||
447 | vt->flags |= V4L2_TUNER_CAP_LOW; /* Allow freqs at 62.5 Hz */ | ||
448 | } | ||
449 | |||
322 | return 0; | 450 | return 0; |
323 | } | 451 | } |
324 | case VIDIOCGAUDIO: | 452 | case VIDIOCGAUDIO: |
325 | { | 453 | { |
326 | struct video_audio *va = arg; | 454 | struct video_audio *va = arg; |
327 | 455 | ||
456 | CHECK_ADDR(radio_tuner,"VIDIOCGAUDIO","radio"); | ||
328 | CHECK_V4L2; | 457 | CHECK_V4L2; |
329 | if (V4L2_TUNER_RADIO == t->mode && t->is_stereo) | 458 | if (V4L2_TUNER_RADIO == t->mode && t->is_stereo) |
330 | va->mode = t->is_stereo(client) | 459 | va->mode = t->is_stereo(client) |
@@ -339,6 +468,8 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
339 | 468 | ||
340 | SWITCH_V4L2; | 469 | SWITCH_V4L2; |
341 | t->mode = V4L2_TUNER_ANALOG_TV; | 470 | t->mode = V4L2_TUNER_ANALOG_TV; |
471 | CHECK_ADDR(tv_tuner,"VIDIOC_S_STD","TV"); | ||
472 | |||
342 | t->std = *id; | 473 | t->std = *id; |
343 | tuner_fixup_std(t); | 474 | tuner_fixup_std(t); |
344 | if (t->freq) | 475 | if (t->freq) |
@@ -349,6 +480,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
349 | { | 480 | { |
350 | struct v4l2_frequency *f = arg; | 481 | struct v4l2_frequency *f = arg; |
351 | 482 | ||
483 | CHECK_MODE("VIDIOC_S_FREQUENCY"); | ||
352 | SWITCH_V4L2; | 484 | SWITCH_V4L2; |
353 | if (V4L2_TUNER_RADIO == f->type && | 485 | if (V4L2_TUNER_RADIO == f->type && |
354 | V4L2_TUNER_RADIO != t->mode) | 486 | V4L2_TUNER_RADIO != t->mode) |
@@ -361,6 +493,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
361 | { | 493 | { |
362 | struct v4l2_frequency *f = arg; | 494 | struct v4l2_frequency *f = arg; |
363 | 495 | ||
496 | CHECK_MODE("VIDIOC_G_FREQUENCY"); | ||
364 | SWITCH_V4L2; | 497 | SWITCH_V4L2; |
365 | f->type = t->mode; | 498 | f->type = t->mode; |
366 | f->frequency = t->freq; | 499 | f->frequency = t->freq; |
@@ -370,14 +503,29 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
370 | { | 503 | { |
371 | struct v4l2_tuner *tuner = arg; | 504 | struct v4l2_tuner *tuner = arg; |
372 | 505 | ||
506 | CHECK_MODE("VIDIOC_G_TUNER"); | ||
373 | SWITCH_V4L2; | 507 | SWITCH_V4L2; |
374 | if (V4L2_TUNER_RADIO == t->mode && t->has_signal) | 508 | if (V4L2_TUNER_RADIO == t->mode) { |
375 | tuner->signal = t->has_signal(client); | 509 | if (t->has_signal) |
510 | tuner -> signal = t->has_signal(client); | ||
511 | if (t->is_stereo) { | ||
512 | if (t->is_stereo(client)) { | ||
513 | tuner -> capability |= V4L2_TUNER_CAP_STEREO; | ||
514 | tuner -> rxsubchans |= V4L2_TUNER_SUB_STEREO; | ||
515 | } else { | ||
516 | tuner -> rxsubchans &= 0xffff ^ V4L2_TUNER_SUB_STEREO; | ||
517 | } | ||
518 | } | ||
519 | } | ||
520 | /* Wow to deal with V4L2_TUNER_CAP_LOW ? For now, it accepts from low at 62.5KHz step to high at 62.5 Hz */ | ||
376 | tuner->rangelow = tv_range[0] * 16; | 521 | tuner->rangelow = tv_range[0] * 16; |
377 | tuner->rangehigh = tv_range[1] * 16; | 522 | // tuner->rangehigh = tv_range[1] * 16; |
523 | // tuner->rangelow = tv_range[0] * 16384; | ||
524 | tuner->rangehigh = tv_range[1] * 16384; | ||
378 | break; | 525 | break; |
379 | } | 526 | } |
380 | default: | 527 | default: |
528 | tuner_dbg ("Unimplemented IOCTL 0x%08x called to tuner.\n", cmd); | ||
381 | /* nothing */ | 529 | /* nothing */ |
382 | break; | 530 | break; |
383 | } | 531 | } |
@@ -385,7 +533,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
385 | return 0; | 533 | return 0; |
386 | } | 534 | } |
387 | 535 | ||
388 | static int tuner_suspend(struct device * dev, pm_message_t state, u32 level) | 536 | static int tuner_suspend(struct device * dev, u32 state, u32 level) |
389 | { | 537 | { |
390 | struct i2c_client *c = container_of(dev, struct i2c_client, dev); | 538 | struct i2c_client *c = container_of(dev, struct i2c_client, dev); |
391 | struct tuner *t = i2c_get_clientdata(c); | 539 | struct tuner *t = i2c_get_clientdata(c); |
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index 48c6ceff1dc2..539f30557317 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tuner-simple.c,v 1.10 2005/03/08 08:38:00 kraxel Exp $ | 2 | * $Id: tuner-simple.c,v 1.21 2005/06/10 19:53:26 nsh Exp $ |
3 | * | 3 | * |
4 | * i2c tv tuner chip device driver | 4 | * i2c tv tuner chip device driver |
5 | * controls all those simple 4-control-bytes style tuners. | 5 | * controls all those simple 4-control-bytes style tuners. |
@@ -212,7 +212,25 @@ static struct tunertype tuners[] = { | |||
212 | { "Philips FQ1236A MK4", Philips, NTSC, | 212 | { "Philips FQ1236A MK4", Philips, NTSC, |
213 | 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 }, | 213 | 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 }, |
214 | 214 | ||
215 | /* Should work for TVF8531MF, TVF8831MF, TVF8731MF */ | ||
216 | { "Ymec TVision TVF-8531MF", Philips, NTSC, | ||
217 | 16*160.00,16*454.00,0xa0,0x90,0x30,0x8e,732}, | ||
218 | { "Ymec TVision TVF-5533MF", Philips, NTSC, | ||
219 | 16*160.00,16*454.00,0x01,0x02,0x04,0x8e,732}, | ||
220 | |||
221 | { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC, | ||
222 | 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, | ||
223 | { "Tena TNF9533-D/IF", LGINNOTEK, PAL, | ||
224 | 16*160.25, 16*464.25, 0x01,0x02,0x08,0x8e,623}, | ||
225 | |||
226 | /* | ||
227 | * This entry is for TEA5767 FM radio only chip used on several boards | ||
228 | * w/TV tuner | ||
229 | */ | ||
230 | { TEA5767_TUNER_NAME, Philips, RADIO, | ||
231 | -1, -1, 0, 0, 0, TEA5767_LOW_LO_32768,0}, | ||
215 | }; | 232 | }; |
233 | |||
216 | unsigned const int tuner_count = ARRAY_SIZE(tuners); | 234 | unsigned const int tuner_count = ARRAY_SIZE(tuners); |
217 | 235 | ||
218 | /* ---------------------------------------------------------------------- */ | 236 | /* ---------------------------------------------------------------------- */ |
@@ -223,6 +241,7 @@ static int tuner_getstatus(struct i2c_client *c) | |||
223 | 241 | ||
224 | if (1 != i2c_master_recv(c,&byte,1)) | 242 | if (1 != i2c_master_recv(c,&byte,1)) |
225 | return 0; | 243 | return 0; |
244 | |||
226 | return byte; | 245 | return byte; |
227 | } | 246 | } |
228 | 247 | ||
@@ -231,17 +250,33 @@ static int tuner_getstatus(struct i2c_client *c) | |||
231 | #define TUNER_MODE 0x38 | 250 | #define TUNER_MODE 0x38 |
232 | #define TUNER_AFC 0x07 | 251 | #define TUNER_AFC 0x07 |
233 | 252 | ||
234 | #define TUNER_STEREO 0x10 /* radio mode */ | 253 | #define TUNER_STEREO 0x10 /* radio mode */ |
235 | #define TUNER_SIGNAL 0x07 /* radio mode */ | 254 | #define TUNER_STEREO_MK3 0x04 /* radio mode */ |
255 | #define TUNER_SIGNAL 0x07 /* radio mode */ | ||
236 | 256 | ||
237 | static int tuner_signal(struct i2c_client *c) | 257 | static int tuner_signal(struct i2c_client *c) |
238 | { | 258 | { |
239 | return (tuner_getstatus(c) & TUNER_SIGNAL)<<13; | 259 | return (tuner_getstatus(c) & TUNER_SIGNAL) << 13; |
240 | } | 260 | } |
241 | 261 | ||
242 | static int tuner_stereo(struct i2c_client *c) | 262 | static int tuner_stereo(struct i2c_client *c) |
243 | { | 263 | { |
244 | return (tuner_getstatus (c) & TUNER_STEREO); | 264 | int stereo, status; |
265 | struct tuner *t = i2c_get_clientdata(c); | ||
266 | |||
267 | status = tuner_getstatus (c); | ||
268 | |||
269 | switch (t->type) { | ||
270 | case TUNER_PHILIPS_FM1216ME_MK3: | ||
271 | case TUNER_PHILIPS_FM1236_MK3: | ||
272 | case TUNER_PHILIPS_FM1256_IH3: | ||
273 | stereo = ((status & TUNER_SIGNAL) == TUNER_STEREO_MK3); | ||
274 | break; | ||
275 | default: | ||
276 | stereo = status & TUNER_STEREO; | ||
277 | } | ||
278 | |||
279 | return stereo; | ||
245 | } | 280 | } |
246 | 281 | ||
247 | #if 0 /* unused */ | 282 | #if 0 /* unused */ |
@@ -424,6 +459,14 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) | |||
424 | buffer[2] = tun->config; | 459 | buffer[2] = tun->config; |
425 | 460 | ||
426 | switch (t->type) { | 461 | switch (t->type) { |
462 | case TUNER_TENA_9533_DI: | ||
463 | case TUNER_YMEC_TVF_5533MF: | ||
464 | |||
465 | /*These values are empirically determinated */ | ||
466 | div = (freq*122)/16 - 20; | ||
467 | buffer[2] = 0x88; /* could be also 0x80 */ | ||
468 | buffer[3] = 0x19; /* could be also 0x10, 0x18, 0x99 */ | ||
469 | break; | ||
427 | case TUNER_PHILIPS_FM1216ME_MK3: | 470 | case TUNER_PHILIPS_FM1216ME_MK3: |
428 | case TUNER_PHILIPS_FM1236_MK3: | 471 | case TUNER_PHILIPS_FM1236_MK3: |
429 | buffer[3] = 0x19; | 472 | buffer[3] = 0x19; |
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 41b635e0d3c6..9a493bea76d8 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c | |||
@@ -285,7 +285,6 @@ static int chip_thread(void *data) | |||
285 | schedule(); | 285 | schedule(); |
286 | } | 286 | } |
287 | remove_wait_queue(&chip->wq, &wait); | 287 | remove_wait_queue(&chip->wq, &wait); |
288 | try_to_freeze(PF_FREEZE); | ||
289 | if (chip->done || signal_pending(current)) | 288 | if (chip->done || signal_pending(current)) |
290 | break; | 289 | break; |
291 | dprintk("%s: thread wakeup\n", i2c_clientname(&chip->c)); | 290 | dprintk("%s: thread wakeup\n", i2c_clientname(&chip->c)); |
@@ -1237,17 +1236,17 @@ static int ta8874z_checkit(struct CHIPSTATE *chip) | |||
1237 | /* audio chip descriptions - struct CHIPDESC */ | 1236 | /* audio chip descriptions - struct CHIPDESC */ |
1238 | 1237 | ||
1239 | /* insmod options to enable/disable individual audio chips */ | 1238 | /* insmod options to enable/disable individual audio chips */ |
1240 | int tda8425 = 1; | 1239 | static int tda8425 = 1; |
1241 | int tda9840 = 1; | 1240 | static int tda9840 = 1; |
1242 | int tda9850 = 1; | 1241 | static int tda9850 = 1; |
1243 | int tda9855 = 1; | 1242 | static int tda9855 = 1; |
1244 | int tda9873 = 1; | 1243 | static int tda9873 = 1; |
1245 | int tda9874a = 1; | 1244 | static int tda9874a = 1; |
1246 | int tea6300 = 0; // address clash with msp34xx | 1245 | static int tea6300 = 0; // address clash with msp34xx |
1247 | int tea6320 = 0; // address clash with msp34xx | 1246 | static int tea6320 = 0; // address clash with msp34xx |
1248 | int tea6420 = 1; | 1247 | static int tea6420 = 1; |
1249 | int pic16c54 = 1; | 1248 | static int pic16c54 = 1; |
1250 | int ta8874z = 0; // address clash with tda9840 | 1249 | static int ta8874z = 0; // address clash with tda9840 |
1251 | 1250 | ||
1252 | module_param(tda8425, int, 0444); | 1251 | module_param(tda8425, int, 0444); |
1253 | module_param(tda9840, int, 0444); | 1252 | module_param(tda9840, int, 0444); |
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 3d216973798c..0f03c25489f1 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c | |||
@@ -75,7 +75,7 @@ hauppauge_tuner_fmt[] = | |||
75 | { 0x00000007, "PAL(B/G)" }, | 75 | { 0x00000007, "PAL(B/G)" }, |
76 | { 0x00001000, "NTSC(M)" }, | 76 | { 0x00001000, "NTSC(M)" }, |
77 | { 0x00000010, "PAL(I)" }, | 77 | { 0x00000010, "PAL(I)" }, |
78 | { 0x00400000, "SECAM(L/L�)" }, | 78 | { 0x00400000, "SECAM(L/L´)" }, |
79 | { 0x00000e00, "PAL(D/K)" }, | 79 | { 0x00000e00, "PAL(D/K)" }, |
80 | { 0x03000000, "ATSC Digital" }, | 80 | { 0x03000000, "ATSC Digital" }, |
81 | }; | 81 | }; |
diff --git a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c index eafd7061b310..51b99cdbf29e 100644 --- a/drivers/media/video/tvmixer.c +++ b/drivers/media/video/tvmixer.c | |||
@@ -1,3 +1,7 @@ | |||
1 | /* | ||
2 | * $Id: tvmixer.c,v 1.8 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | */ | ||
4 | |||
1 | #include <linux/module.h> | 5 | #include <linux/module.h> |
2 | #include <linux/moduleparam.h> | 6 | #include <linux/moduleparam.h> |
3 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c index b0d4bcb027d0..70ecbdb80277 100644 --- a/drivers/media/video/v4l1-compat.c +++ b/drivers/media/video/v4l1-compat.c | |||
@@ -1,4 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: v4l1-compat.c,v 1.9 2005/06/12 04:19:19 mchehab Exp $ | ||
3 | * | ||
2 | * Video for Linux Two | 4 | * Video for Linux Two |
3 | * Backward Compatibility Layer | 5 | * Backward Compatibility Layer |
4 | * | 6 | * |
@@ -15,14 +17,11 @@ | |||
15 | * | 17 | * |
16 | */ | 18 | */ |
17 | 19 | ||
18 | #ifndef __KERNEL__ | ||
19 | #define __KERNEL__ | ||
20 | #endif | ||
21 | |||
22 | #include <linux/config.h> | 20 | #include <linux/config.h> |
23 | 21 | ||
24 | #include <linux/init.h> | 22 | #include <linux/init.h> |
25 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/moduleparam.h> | ||
26 | #include <linux/types.h> | 25 | #include <linux/types.h> |
27 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
28 | #include <linux/sched.h> | 27 | #include <linux/sched.h> |
@@ -787,12 +786,15 @@ v4l_compat_translate_ioctl(struct inode *inode, | |||
787 | !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED)) | 786 | !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED)) |
788 | aud->step = qctrl2.step; | 787 | aud->step = qctrl2.step; |
789 | aud->mode = 0; | 788 | aud->mode = 0; |
789 | |||
790 | memset(&tun2,0,sizeof(tun2)); | ||
790 | err = drv(inode, file, VIDIOC_G_TUNER, &tun2); | 791 | err = drv(inode, file, VIDIOC_G_TUNER, &tun2); |
791 | if (err < 0) { | 792 | if (err < 0) { |
792 | dprintk("VIDIOCGAUDIO / VIDIOC_G_TUNER: %d\n",err); | 793 | dprintk("VIDIOCGAUDIO / VIDIOC_G_TUNER: %d\n",err); |
793 | err = 0; | 794 | err = 0; |
794 | break; | 795 | break; |
795 | } | 796 | } |
797 | |||
796 | if (tun2.rxsubchans & V4L2_TUNER_SUB_LANG2) | 798 | if (tun2.rxsubchans & V4L2_TUNER_SUB_LANG2) |
797 | aud->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | 799 | aud->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; |
798 | else if (tun2.rxsubchans & V4L2_TUNER_SUB_STEREO) | 800 | else if (tun2.rxsubchans & V4L2_TUNER_SUB_STEREO) |