aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb
diff options
context:
space:
mode:
authorCarl Lundqvist <comabug@gmail.com>2006-10-03 16:09:30 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-02-21 10:35:25 -0500
commitf0c3a2ca56c5c56ecfaf46c1b47851319e9655ac (patch)
treee9290181ea691fb37a996ee308e8af2f3a502dcc /drivers/media/dvb/dvb-usb
parent6345f0f6428cc7a3f73b83624c6f97629a9fddd1 (diff)
V4L/DVB (5221): Dvb-usb: initial support for MSI Mega Sky 580 DVB-T based on GL861
This patch adds support for MSI Mega Sky 580 / GL861 DVB-T USB2.0 Except for the 2 lines added to zl10353.c, zl10353_reset_attach needs to be changed. If I read the code correctly setting parallel_ts will take care of the 3rd byte, but the 2nd byte needs to be 0x0b instead of 0x03 too. I guess these changes needs to be done only for this device, not sure how to do that. The zl10353 changes have been split apart from this patch, into the next patch, soon to follow. Signed-off-by: Carl Lundqvist <comabug@gmail.com> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/dvb-usb')
-rw-r--r--drivers/media/dvb/dvb-usb/Kconfig8
-rw-r--r--drivers/media/dvb/dvb-usb/Makefile3
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-ids.h1
-rw-r--r--drivers/media/dvb/dvb-usb/gl861.c235
-rw-r--r--drivers/media/dvb/dvb-usb/gl861.h16
5 files changed, 263 insertions, 0 deletions
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index 861a02939a9c..c0a899a040d5 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -120,6 +120,14 @@ config DVB_USB_M920X
120 "DTV USB MINI" (in cold state) are supported. 120 "DTV USB MINI" (in cold state) are supported.
121 Firmware required. 121 Firmware required.
122 122
123config DVB_USB_GL861
124 tristate "Genesys Logic GL861 USB2.0 support"
125 depends on DVB_USB
126 select DVB_ZL10353
127 help
128 Say Y here to support the MSI Megasky 580 (55801) DVB-T USB2.0
129 receiver with USB ID 0db0:5581.
130
123config DVB_USB_DIGITV 131config DVB_USB_DIGITV
124 tristate "Nebula Electronics uDigiTV DVB-T USB2.0 support" 132 tristate "Nebula Electronics uDigiTV DVB-T USB2.0 support"
125 depends on DVB_USB 133 depends on DVB_USB
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile
index 815e2789840d..53b63c584746 100644
--- a/drivers/media/dvb/dvb-usb/Makefile
+++ b/drivers/media/dvb/dvb-usb/Makefile
@@ -33,6 +33,9 @@ obj-$(CONFIG_DVB_USB_UMT_010) += dvb-usb-dibusb-common.o dvb-usb-umt-010.o
33dvb-usb-m920x-objs = m920x.o 33dvb-usb-m920x-objs = m920x.o
34obj-$(CONFIG_DVB_USB_M920X) += dvb-usb-m920x.o 34obj-$(CONFIG_DVB_USB_M920X) += dvb-usb-m920x.o
35 35
36dvb-usb-gl861-objs = gl861.o
37obj-$(CONFIG_DVB_USB_GL861) += dvb-usb-gl861.o
38
36dvb-usb-digitv-objs = digitv.o 39dvb-usb-digitv-objs = digitv.o
37obj-$(CONFIG_DVB_USB_DIGITV) += dvb-usb-digitv.o 40obj-$(CONFIG_DVB_USB_DIGITV) += dvb-usb-digitv.o
38 41
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
index 713ec5a82d66..0414ee354b58 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
@@ -121,6 +121,7 @@
121#define USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM 0xdb55 121#define USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM 0xdb55
122#define USB_PID_MEDION_MD95700 0x0932 122#define USB_PID_MEDION_MD95700 0x0932
123#define USB_PID_MSI_MEGASKY580 0x5580 123#define USB_PID_MSI_MEGASKY580 0x5580
124#define USB_PID_MSI_MEGASKY55801 0x5581
124#define USB_PID_KYE_DVB_T_COLD 0x701e 125#define USB_PID_KYE_DVB_T_COLD 0x701e
125#define USB_PID_KYE_DVB_T_WARM 0x701f 126#define USB_PID_KYE_DVB_T_WARM 0x701f
126#define USB_PID_PCTV_200E 0x020e 127#define USB_PID_PCTV_200E 0x020e
diff --git a/drivers/media/dvb/dvb-usb/gl861.c b/drivers/media/dvb/dvb-usb/gl861.c
new file mode 100644
index 000000000000..c16daf11a874
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/gl861.c
@@ -0,0 +1,235 @@
1/* DVB USB compliant linux driver for GL861 USB2.0 devices.
2 *
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the Free
5 * Software Foundation, version 2.
6 *
7 * see Documentation/dvb/README.dvb-usb for more information
8 */
9#include "gl861.h"
10
11#include "zl10353.h"
12#include "qt1010.h"
13
14/* debug */
15int dvb_usb_gl861_debug;
16module_param_named(debug,dvb_usb_gl861_debug, int, 0644);
17MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
18
19static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr,
20 u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
21{
22 u16 index;
23 u16 value = addr << 8;
24 int wo = (rbuf == NULL || rlen == 0); /* write-only */
25 u8 req, type;
26
27 if (wo) {
28 req = GL861_REQ_I2C_WRITE;
29 type = GL861_WRITE;
30 } else { /* rw */
31 req = GL861_REQ_I2C_READ;
32 type = GL861_READ;
33 }
34
35 switch (wlen) {
36 case 1:
37 index = wbuf[0];
38 break;
39 case 2:
40 index = wbuf[0];
41 value = value + wbuf[1];
42 break;
43 default:
44 warn("wlen = %x, aborting.", wlen);
45 return -EINVAL;
46 }
47
48 return usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), req, type,
49 value, index, rbuf, rlen, 2000);
50}
51
52/* I2C */
53static int gl861_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
54 int num)
55{
56 struct dvb_usb_device *d = i2c_get_adapdata(adap);
57 int i;
58
59 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
60 return -EAGAIN;
61
62 if (num > 2)
63 return -EINVAL;
64
65 for (i = 0; i < num; i++) {
66 /* write/read request */
67 if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) {
68 if (gl861_i2c_msg(d, msg[i].addr, msg[i].buf,
69 msg[i].len, msg[i+1].buf, msg[i+1].len) < 0)
70 break;
71 i++;
72 } else
73 if (gl861_i2c_msg(d, msg[i].addr, msg[i].buf,
74 msg[i].len, NULL, 0) < 0)
75 break;
76 }
77
78 mutex_unlock(&d->i2c_mutex);
79 return i;
80}
81
82static u32 gl861_i2c_func(struct i2c_adapter *adapter)
83{
84 return I2C_FUNC_I2C;
85}
86
87static struct i2c_algorithm gl861_i2c_algo = {
88 .master_xfer = gl861_i2c_xfer,
89 .functionality = gl861_i2c_func,
90};
91
92/* Callbacks for DVB USB */
93static int gl861_identify_state(struct usb_device *udev,
94 struct dvb_usb_device_properties *props,
95 struct dvb_usb_device_description **desc,
96 int *cold)
97{
98 *cold = 0;
99
100 return 0;
101}
102
103static struct zl10353_config gl861_zl10353_config = {
104 .demod_address = 0x1e,
105 .no_tuner = 1,
106/*
107 .parallel_ts = 1,
108*/
109};
110
111static int gl861_frontend_attach(struct dvb_usb_adapter *adap)
112{
113 if ((adap->fe = dvb_attach(zl10353_attach, &gl861_zl10353_config,
114 &adap->dev->i2c_adap)) != NULL) {
115 return 0;
116 }
117
118 return -EIO;
119}
120
121static int gl861_tuner_attach(struct dvb_usb_adapter *adap)
122{
123 adap->pll_addr = 0xc4;
124 adap->pll_desc = NULL;
125 adap->fe->ops.tuner_ops.set_params = qt1010_set_params;
126
127 return 0;
128}
129
130/* DVB USB Driver stuff */
131static struct dvb_usb_device_properties gl861_properties;
132
133static int gl861_probe(struct usb_interface *intf,
134 const struct usb_device_id *id)
135{
136 struct dvb_usb_device *d;
137 struct usb_host_interface *alt;
138 int ret;
139
140 if (intf->num_altsetting < 2)
141 return -ENODEV;
142
143 if ((ret = dvb_usb_device_init(intf, &gl861_properties, THIS_MODULE,
144 &d)) == 0) {
145 alt = usb_altnum_to_altsetting(intf, 0);
146
147 if (alt == NULL) {
148 deb_rc("not alt found!\n");
149 return -ENODEV;
150 }
151
152 ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber,
153 alt->desc.bAlternateSetting);
154 }
155
156 return ret;
157}
158
159static struct usb_device_id gl861_table [] = {
160 { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY55801) },
161 {} /* Terminating entry */
162};
163MODULE_DEVICE_TABLE (usb, gl861_table);
164
165static struct dvb_usb_device_properties gl861_properties = {
166 .usb_ctrl = DEVICE_SPECIFIC,
167
168 .size_of_priv = 0,
169
170 .identify_state = gl861_identify_state,
171 .num_adapters = 1,
172 .adapter = {{
173 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
174
175 .frontend_attach = gl861_frontend_attach,
176 .tuner_attach = gl861_tuner_attach,
177
178 .stream = {
179 .type = USB_BULK,
180 .count = 7,
181 .endpoint = 0x81,
182 .u = {
183 .bulk = {
184 .buffersize = 512,
185 }
186 }
187 },
188 }},
189 .i2c_algo = &gl861_i2c_algo,
190
191 .generic_bulk_ctrl_endpoint = 0x01,
192
193 .num_device_descs = 1,
194 .devices = {
195 { "MSI Mega Sky 55801 DVB-T USB2.0",
196 { &gl861_table[0], NULL },
197 { NULL },
198 },
199 { NULL },
200 }
201};
202
203static struct usb_driver gl861_driver = {
204 .name = "gl861",
205 .probe = gl861_probe,
206 .disconnect = dvb_usb_device_exit,
207 .id_table = gl861_table,
208};
209
210/* module stuff */
211static int __init gl861_module_init(void)
212{
213 int ret;
214
215 if ((ret = usb_register(&gl861_driver))) {
216 err("usb_register failed. Error number %d", ret);
217 return ret;
218 }
219
220 return 0;
221}
222
223static void __exit gl861_module_exit(void)
224{
225 /* deregister this driver from the USB subsystem */
226 usb_deregister(&gl861_driver);
227}
228
229module_init (gl861_module_init);
230module_exit (gl861_module_exit);
231
232MODULE_AUTHOR("comabug@gmail.com");
233MODULE_DESCRIPTION("Driver MSI Mega Sky 580 DVB-T USB2.0 / GL861");
234MODULE_VERSION("1.0");
235MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/dvb-usb/gl861.h b/drivers/media/dvb/dvb-usb/gl861.h
new file mode 100644
index 000000000000..df97fcf504a7
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/gl861.h
@@ -0,0 +1,16 @@
1#ifndef _DVB_USB_GL861_H_
2#define _DVB_USB_GL861_H_
3
4#define DVB_USB_LOG_PREFIX "gl861"
5#include "dvb-usb.h"
6
7extern int dvb_usb_gl861_debug;
8#define deb_rc(args...) dprintk(dvb_usb_gl861_debug,0x01,args)
9
10#define GL861_WRITE 0x40
11#define GL861_READ 0xc0
12
13#define GL861_REQ_I2C_WRITE 0x01
14#define GL861_REQ_I2C_READ 0x02
15
16#endif