aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/dvb-usb/Kconfig16
-rw-r--r--drivers/media/dvb/dvb-usb/Makefile3
-rw-r--r--drivers/media/dvb/dvb-usb/cxusb.c287
-rw-r--r--drivers/media/dvb/dvb-usb/cxusb.h30
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-ids.h2
5 files changed, 338 insertions, 0 deletions
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index 8aa32f6e447b..1a69130a8462 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -21,12 +21,14 @@ config DVB_USB_DEBUG
21config DVB_USB_A800 21config DVB_USB_A800
22 tristate "AVerMedia AverTV DVB-T USB 2.0 (A800)" 22 tristate "AVerMedia AverTV DVB-T USB 2.0 (A800)"
23 depends on DVB_USB 23 depends on DVB_USB
24 select DVB_DIB3000MC
24 help 25 help
25 Say Y here to support the AVerMedia AverTV DVB-T USB 2.0 (A800) receiver. 26 Say Y here to support the AVerMedia AverTV DVB-T USB 2.0 (A800) receiver.
26 27
27config DVB_USB_DIBUSB_MB 28config DVB_USB_DIBUSB_MB
28 tristate "DiBcom USB DVB-T devices (based on the DiB3000M-B) (see help for device list)" 29 tristate "DiBcom USB DVB-T devices (based on the DiB3000M-B) (see help for device list)"
29 depends on DVB_USB 30 depends on DVB_USB
31 select DVB_DIB3000MB
30 help 32 help
31 Support for USB 1.1 and 2.0 DVB-T receivers based on reference designs made by 33 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. 34 DiBcom (<http://www.dibcom.fr>) equipped with a DiB3000M-B demodulator.
@@ -52,6 +54,7 @@ config DVB_USB_DIBUSB_MB
52config DVB_USB_DIBUSB_MC 54config DVB_USB_DIBUSB_MC
53 tristate "DiBcom USB DVB-T devices (based on the DiB3000M-C/P) (see help for device list)" 55 tristate "DiBcom USB DVB-T devices (based on the DiB3000M-C/P) (see help for device list)"
54 depends on DVB_USB 56 depends on DVB_USB
57 select DVB_DIB3000MC
55 help 58 help
56 Support for 2.0 DVB-T receivers based on reference designs made by 59 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. 60 DiBcom (<http://www.dibcom.fr>) equipped with a DiB3000M-C/P demodulator.
@@ -66,12 +69,24 @@ config DVB_USB_DIBUSB_MC
66config DVB_USB_UMT_010 69config DVB_USB_UMT_010
67 tristate "HanfTek UMT-010 DVB-T USB2.0 support" 70 tristate "HanfTek UMT-010 DVB-T USB2.0 support"
68 depends on DVB_USB 71 depends on DVB_USB
72 select DVB_DIB3000MC
69 help 73 help
70 Say Y here to support the HanfTek UMT-010 USB2.0 stick-sized DVB-T receiver. 74 Say Y here to support the HanfTek UMT-010 USB2.0 stick-sized DVB-T receiver.
71 75
76config DVB_USB_CXUSB
77 tristate "Medion MD95700 hybrid USB2.0 (Conexant) support"
78 depends on DVB_USB
79 select DVB_CX22702
80 help
81 Say Y here to support the Medion MD95700 hybrid USB2.0 device. Currently
82 only the DVB-T part is supported and MPEG2 data transfer are not working
83 :(.
84
72config DVB_USB_DIGITV 85config DVB_USB_DIGITV
73 tristate "Nebula Electronics uDigiTV DVB-T USB2.0 support" 86 tristate "Nebula Electronics uDigiTV DVB-T USB2.0 support"
74 depends on DVB_USB 87 depends on DVB_USB
88 select DVB_NXT6000
89 select DVB_MT352
75 help 90 help
76 Say Y here to support the Nebula Electronics uDigitV USB2.0 DVB-T receiver. 91 Say Y here to support the Nebula Electronics uDigitV USB2.0 DVB-T receiver.
77 92
@@ -87,6 +102,7 @@ config DVB_USB_VP7045
87config DVB_USB_NOVA_T_USB2 102config DVB_USB_NOVA_T_USB2
88 tristate "Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 support" 103 tristate "Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 support"
89 depends on DVB_USB 104 depends on DVB_USB
105 select DVB_DIB3000MC
90 help 106 help
91 Say Y here to support the Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 receiver. 107 Say Y here to support the Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 receiver.
92 108
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile
index d65b50f9abb0..746d87ed6f32 100644
--- a/drivers/media/dvb/dvb-usb/Makefile
+++ b/drivers/media/dvb/dvb-usb/Makefile
@@ -27,4 +27,7 @@ obj-$(CONFIG_DVB_USB_UMT_010) += dvb-usb-dibusb-common.o dvb-usb-umt-010.o
27dvb-usb-digitv-objs = digitv.o 27dvb-usb-digitv-objs = digitv.o
28obj-$(CONFIG_DVB_USB_DIGITV) += dvb-usb-digitv.o 28obj-$(CONFIG_DVB_USB_DIGITV) += dvb-usb-digitv.o
29 29
30dvb-usb-cxusb-objs = cxusb.o
31obj-$(CONFIG_DVB_USB_CXUSB) += dvb-usb-cxusb.o
32
30EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ 33EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
new file mode 100644
index 000000000000..0324807376cf
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/cxusb.c
@@ -0,0 +1,287 @@
1/* DVB USB compliant linux driver for Conexant USB reference design.
2 *
3 * The Conexant reference design I saw on their website was only for analogue
4 * capturing (using the cx25842). The box I took to write this driver (reverse
5 * engineered) is the one labeled Medion MD95700. In addition to the cx25842
6 * for analogue capturing it also has a cx22702 DVB-T demodulator on the main
7 * board. Besides it has a atiremote (X10) and a USB2.0 hub onboard.
8 *
9 * Maybe it is a little bit premature to call this driver cxusb, but I assume
10 * the USB protocol is identical or at least inherited from the reference
11 * design, so it can be reused for the "analogue-only" device (if it will
12 * appear at all).
13 *
14 * TODO: check if the cx25840-driver (from ivtv) can be used for the analogue
15 * part
16 *
17 * FIXME: We're getting a lock and signal, but the isochronous transfer is empty
18 * for DVB-T.
19 *
20 * Copyright (C) 2005 Patrick Boettcher (patrick.boettcher@desy.de)
21 *
22 * This program is free software; you can redistribute it and/or modify it
23 * under the terms of the GNU General Public License as published by the Free
24 * Software Foundation, version 2.
25 *
26 * see Documentation/dvb/README.dvb-usb for more information
27 */
28#include "cxusb.h"
29
30#include "cx22702.h"
31
32/* debug */
33int dvb_usb_cxusb_debug;
34module_param_named(debug,dvb_usb_cxusb_debug, int, 0644);
35MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
36
37static int cxusb_ctrl_msg(struct dvb_usb_device *d,
38 u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen)
39{
40 int wo = (rbuf == NULL || rlen == 0); /* write-only */
41 u8 sndbuf[1+wlen];
42 memset(sndbuf,0,1+wlen);
43
44 sndbuf[0] = cmd;
45 memcpy(&sndbuf[1],wbuf,wlen);
46 if (wo)
47 dvb_usb_generic_write(d,sndbuf,1+wlen);
48 else
49 dvb_usb_generic_rw(d,sndbuf,1+wlen,rbuf,rlen,0);
50
51 return 0;
52}
53
54/* I2C */
55static void cxusb_set_i2c_path(struct dvb_usb_device *d, enum cxusb_i2c_pathes path)
56{
57 struct cxusb_state *st = d->priv;
58 u8 o[2],i;
59
60 if (path == st->cur_i2c_path)
61 return;
62
63 o[0] = IOCTL_SET_I2C_PATH;
64 switch (path) {
65 case PATH_CX22702:
66 o[1] = 0;
67 break;
68 case PATH_TUNER_OTHER:
69 o[1] = 1;
70 break;
71 default:
72 err("unkown i2c path");
73 return;
74 }
75 cxusb_ctrl_msg(d,CMD_IOCTL,o,2,&i,1);
76
77 if (i != 0x01)
78 deb_info("i2c_path setting failed.\n");
79
80 st->cur_i2c_path = path;
81}
82
83static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num)
84{
85 struct dvb_usb_device *d = i2c_get_adapdata(adap);
86 int i;
87
88 if (down_interruptible(&d->i2c_sem) < 0)
89 return -EAGAIN;
90
91 if (num > 2)
92 warn("more than 2 i2c messages at a time is not handled yet. TODO.");
93
94 for (i = 0; i < num; i++) {
95
96 switch (msg[i].addr) {
97 case 0x63:
98 cxusb_set_i2c_path(d,PATH_CX22702);
99 break;
100 default:
101 cxusb_set_i2c_path(d,PATH_TUNER_OTHER);
102 break;
103 }
104
105 /* read request */
106 if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) {
107 u8 obuf[3+msg[i].len], ibuf[1+msg[i+1].len];
108 obuf[0] = msg[i].len;
109 obuf[1] = msg[i+1].len;
110 obuf[2] = msg[i].addr;
111 memcpy(&obuf[3],msg[i].buf,msg[i].len);
112
113 if (cxusb_ctrl_msg(d, CMD_I2C_READ,
114 obuf, 3+msg[i].len,
115 ibuf, 1+msg[i+1].len) < 0)
116 break;
117
118 if (ibuf[0] != 0x08)
119 deb_info("i2c read could have been failed\n");
120
121 memcpy(msg[i+1].buf,&ibuf[1],msg[i+1].len);
122
123 i++;
124 } else { /* write */
125 u8 obuf[2+msg[i].len], ibuf;
126 obuf[0] = msg[i].addr;
127 obuf[1] = msg[i].len;
128 memcpy(&obuf[2],msg[i].buf,msg[i].len);
129
130 if (cxusb_ctrl_msg(d,CMD_I2C_WRITE, obuf, 2+msg[i].len, &ibuf,1) < 0)
131 break;
132 if (ibuf != 0x08)
133 deb_info("i2c write could have been failed\n");
134 }
135 }
136
137 up(&d->i2c_sem);
138 return i;
139}
140
141static u32 cxusb_i2c_func(struct i2c_adapter *adapter)
142{
143 return I2C_FUNC_I2C;
144}
145
146static struct i2c_algorithm cxusb_i2c_algo = {
147 .name = "Conexant USB I2C algorithm",
148 .id = I2C_ALGO_BIT,
149 .master_xfer = cxusb_i2c_xfer,
150 .functionality = cxusb_i2c_func,
151};
152
153static int cxusb_power_ctrl(struct dvb_usb_device *d, int onoff)
154{
155 return 0;
156}
157
158static int cxusb_streaming_ctrl(struct dvb_usb_device *d, int onoff)
159{
160 return 0;
161}
162
163struct cx22702_config cxusb_cx22702_config = {
164 .demod_address = 0x63,
165
166 .pll_init = dvb_usb_pll_init_i2c,
167 .pll_set = dvb_usb_pll_set_i2c,
168};
169
170/* Callbacks for DVB USB */
171static int cxusb_tuner_attach(struct dvb_usb_device *d)
172{
173 u8 bpll[4] = { 0x0b, 0xdc, 0x9c, 0xa0 };
174 d->pll_addr = 0x61;
175 memcpy(d->pll_init,bpll,4);
176 d->pll_desc = &dvb_pll_fmd1216me;
177 return 0;
178}
179
180static int cxusb_frontend_attach(struct dvb_usb_device *d)
181{
182 u8 buf[2] = { 0x03, 0x00 };
183 u8 b = 0;
184
185 cxusb_ctrl_msg(d,0xde,&b,0,NULL,0);
186 cxusb_set_i2c_path(d,PATH_TUNER_OTHER);
187 cxusb_ctrl_msg(d,CMD_POWER_OFF, NULL, 0, &b, 1);
188
189 if (usb_set_interface(d->udev,0,6) < 0)
190 err("set interface failed\n");
191
192 cxusb_ctrl_msg(d,0x36, buf, 2, NULL, 0);
193 cxusb_set_i2c_path(d,PATH_CX22702);
194 cxusb_ctrl_msg(d,CMD_POWER_ON, NULL, 0, &b, 1);
195
196 if ((d->fe = cx22702_attach(&cxusb_cx22702_config, &d->i2c_adap)) != NULL)
197 return 0;
198
199 return -EIO;
200}
201
202/* DVB USB Driver stuff */
203static struct dvb_usb_properties cxusb_properties;
204
205static int cxusb_probe(struct usb_interface *intf,
206 const struct usb_device_id *id)
207{
208 return dvb_usb_device_init(intf,&cxusb_properties,THIS_MODULE);
209}
210
211static struct usb_device_id cxusb_table [] = {
212 { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) },
213 {} /* Terminating entry */
214};
215MODULE_DEVICE_TABLE (usb, cxusb_table);
216
217static struct dvb_usb_properties cxusb_properties = {
218 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
219
220 .usb_ctrl = CYPRESS_FX2,
221
222 .size_of_priv = sizeof(struct cxusb_state),
223
224 .streaming_ctrl = cxusb_streaming_ctrl,
225 .power_ctrl = cxusb_power_ctrl,
226 .frontend_attach = cxusb_frontend_attach,
227 .tuner_attach = cxusb_tuner_attach,
228
229 .i2c_algo = &cxusb_i2c_algo,
230
231 .generic_bulk_ctrl_endpoint = 0x01,
232 /* parameter for the MPEG2-data transfer */
233 .urb = {
234 .type = DVB_USB_ISOC,
235 .count = 5,
236 .endpoint = 0x02,
237 .u = {
238 .isoc = {
239 .framesperurb = 64,
240 .framesize = 940*3,
241 .interval = 1,
242 }
243 }
244 },
245
246 .num_device_descs = 1,
247 .devices = {
248 { "Medion MD95700 (MDUSBTV-HYBRID)",
249 { NULL },
250 { &cxusb_table[0], NULL },
251 },
252 }
253};
254
255static struct usb_driver cxusb_driver = {
256 .owner = THIS_MODULE,
257 .name = "cxusb",
258 .probe = cxusb_probe,
259 .disconnect = dvb_usb_device_exit,
260 .id_table = cxusb_table,
261};
262
263/* module stuff */
264static int __init cxusb_module_init(void)
265{
266 int result;
267 if ((result = usb_register(&cxusb_driver))) {
268 err("usb_register failed. Error number %d",result);
269 return result;
270 }
271
272 return 0;
273}
274
275static void __exit cxusb_module_exit(void)
276{
277 /* deregister this driver from the USB subsystem */
278 usb_deregister(&cxusb_driver);
279}
280
281module_init (cxusb_module_init);
282module_exit (cxusb_module_exit);
283
284MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
285MODULE_DESCRIPTION("Driver for Conexant USB2.0 hybrid reference design");
286MODULE_VERSION("1.0-alpha");
287MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/dvb-usb/cxusb.h b/drivers/media/dvb/dvb-usb/cxusb.h
new file mode 100644
index 000000000000..1d79016e3195
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/cxusb.h
@@ -0,0 +1,30 @@
1#ifndef _DVB_USB_CXUSB_H_
2#define _DVB_USB_CXUSB_H_
3
4#define DVB_USB_LOG_PREFIX "digitv"
5#include "dvb-usb.h"
6
7extern int dvb_usb_cxusb_debug;
8#define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args)
9
10/* usb commands - some of it are guesses, don't have a reference yet */
11#define CMD_I2C_WRITE 0x08
12#define CMD_I2C_READ 0x09
13
14#define CMD_IOCTL 0x0e
15#define IOCTL_SET_I2C_PATH 0x02
16
17#define CMD_POWER_OFF 0x50
18#define CMD_POWER_ON 0x51
19
20enum cxusb_i2c_pathes {
21 PATH_UNDEF = 0x00,
22 PATH_CX22702 = 0x01,
23 PATH_TUNER_OTHER = 0x02,
24};
25
26struct cxusb_state {
27 enum cxusb_i2c_pathes cur_i2c_path;
28};
29
30#endif
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
index bcb34191868b..de2463bae225 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
@@ -24,6 +24,7 @@
24#define USB_VID_HANFTEK 0x15f4 24#define USB_VID_HANFTEK 0x15f4
25#define USB_VID_HAUPPAUGE 0x2040 25#define USB_VID_HAUPPAUGE 0x2040
26#define USB_VID_HYPER_PALTEK 0x1025 26#define USB_VID_HYPER_PALTEK 0x1025
27#define USB_VID_MEDION 0x1660
27#define USB_VID_VISIONPLUS 0x13d3 28#define USB_VID_VISIONPLUS 0x13d3
28#define USB_VID_TWINHAN 0x1822 29#define USB_VID_TWINHAN 0x1822
29#define USB_VID_ULTIMA_ELECTRONIC 0x05d8 30#define USB_VID_ULTIMA_ELECTRONIC 0x05d8
@@ -78,6 +79,7 @@
78#define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820 79#define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820
79#define USB_PID_DVICO_BLUEBIRD_LGZ201_1 0xdb01 80#define USB_PID_DVICO_BLUEBIRD_LGZ201_1 0xdb01
80#define USB_PID_DVICO_BLUEBIRD_TH7579_2 0xdb11 81#define USB_PID_DVICO_BLUEBIRD_TH7579_2 0xdb11
82#define USB_PID_MEDION_MD95700 0x0932
81 83
82 84
83#endif 85#endif