aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/dvb/dvb-usb/Kconfig2
-rw-r--r--drivers/media/dvb/dvb-usb/gl861.c130
-rw-r--r--drivers/media/dvb/dvb-usb/gl861.h5
3 files changed, 46 insertions, 91 deletions
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index a663c75505e5..09fded4eb0b4 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -164,7 +164,7 @@ config DVB_USB_M920X
164 164
165config DVB_USB_GL861 165config DVB_USB_GL861
166 tristate "Genesys Logic GL861 USB2.0 support" 166 tristate "Genesys Logic GL861 USB2.0 support"
167 depends on DVB_USB 167 depends on DVB_USB_V2
168 select DVB_ZL10353 if !DVB_FE_CUSTOMISE 168 select DVB_ZL10353 if !DVB_FE_CUSTOMISE
169 select MEDIA_TUNER_QT1010 if !MEDIA_TUNER_CUSTOMISE 169 select MEDIA_TUNER_QT1010 if !MEDIA_TUNER_CUSTOMISE
170 help 170 help
diff --git a/drivers/media/dvb/dvb-usb/gl861.c b/drivers/media/dvb/dvb-usb/gl861.c
index c1f5582e1cdf..cf29f43e3598 100644
--- a/drivers/media/dvb/dvb-usb/gl861.c
+++ b/drivers/media/dvb/dvb-usb/gl861.c
@@ -11,11 +11,6 @@
11#include "zl10353.h" 11#include "zl10353.h"
12#include "qt1010.h" 12#include "qt1010.h"
13 13
14/* debug */
15static int 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))."
18 DVB_USB_DEBUG_STATUS);
19DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 14DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
20 15
21static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr, 16static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr,
@@ -43,7 +38,7 @@ static int gl861_i2c_msg(struct dvb_usb_device *d, u8 addr,
43 value = value + wbuf[1]; 38 value = value + wbuf[1];
44 break; 39 break;
45 default: 40 default:
46 warn("wlen = %x, aborting.", wlen); 41 pr_err("%s: wlen=%d, aborting\n", KBUILD_MODNAME, wlen);
47 return -EINVAL; 42 return -EINVAL;
48 } 43 }
49 44
@@ -103,9 +98,9 @@ static struct zl10353_config gl861_zl10353_config = {
103static int gl861_frontend_attach(struct dvb_usb_adapter *adap) 98static int gl861_frontend_attach(struct dvb_usb_adapter *adap)
104{ 99{
105 100
106 adap->fe_adap[0].fe = dvb_attach(zl10353_attach, &gl861_zl10353_config, 101 adap->fe[0] = dvb_attach(zl10353_attach, &gl861_zl10353_config,
107 &adap->dev->i2c_adap); 102 &adap_to_d(adap)->i2c_adap);
108 if (adap->fe_adap[0].fe == NULL) 103 if (adap->fe[0] == NULL)
109 return -EIO; 104 return -EIO;
110 105
111 return 0; 106 return 0;
@@ -118,98 +113,61 @@ static struct qt1010_config gl861_qt1010_config = {
118static int gl861_tuner_attach(struct dvb_usb_adapter *adap) 113static int gl861_tuner_attach(struct dvb_usb_adapter *adap)
119{ 114{
120 return dvb_attach(qt1010_attach, 115 return dvb_attach(qt1010_attach,
121 adap->fe_adap[0].fe, &adap->dev->i2c_adap, 116 adap->fe[0], &adap_to_d(adap)->i2c_adap,
122 &gl861_qt1010_config) == NULL ? -ENODEV : 0; 117 &gl861_qt1010_config) == NULL ? -ENODEV : 0;
123} 118}
124 119
125/* DVB USB Driver stuff */ 120static int gl861_init(struct dvb_usb_device *d)
126static struct dvb_usb_device_properties gl861_properties;
127
128static int gl861_probe(struct usb_interface *intf,
129 const struct usb_device_id *id)
130{ 121{
131 struct dvb_usb_device *d; 122 /*
132 struct usb_host_interface *alt; 123 * There is 2 interfaces. Interface 0 is for TV and interface 1 is
133 int ret; 124 * for HID remote controller. Interface 0 has 2 alternate settings.
134 125 * For some reason we need to set interface explicitly, defaulted
135 if (intf->num_altsetting < 2) 126 * as alternate setting 1?
136 return -ENODEV; 127 */
137 128 return usb_set_interface(d->udev, 0, 0);
138 ret = dvb_usb_device_init(intf, &gl861_properties, THIS_MODULE, &d,
139 adapter_nr);
140 if (ret == 0) {
141 alt = usb_altnum_to_altsetting(intf, 0);
142
143 if (alt == NULL) {
144 deb_rc("not alt found!\n");
145 return -ENODEV;
146 }
147
148 ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber,
149 alt->desc.bAlternateSetting);
150 }
151
152 return ret;
153} 129}
154 130
155static struct usb_device_id gl861_table [] = { 131/* DVB USB Driver stuff */
156 { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580_55801) }, 132static struct dvb_usb_device_properties gl861_props = {
157 { USB_DEVICE(USB_VID_ALINK, USB_VID_ALINK_DTU) }, 133 .driver_name = KBUILD_MODNAME,
158 { } /* Terminating entry */ 134 .owner = THIS_MODULE,
159}; 135 .adapter_nr = adapter_nr,
160MODULE_DEVICE_TABLE(usb, gl861_table);
161
162static struct dvb_usb_device_properties gl861_properties = {
163 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
164 .usb_ctrl = DEVICE_SPECIFIC,
165 136
166 .size_of_priv = 0, 137 .i2c_algo = &gl861_i2c_algo,
138 .frontend_attach = gl861_frontend_attach,
139 .tuner_attach = gl861_tuner_attach,
140 .init = gl861_init,
167 141
168 .num_adapters = 1, 142 .num_adapters = 1,
169 .adapter = {{ 143 .adapter = {
170 .num_frontends = 1,
171 .fe = {{
172
173 .frontend_attach = gl861_frontend_attach,
174 .tuner_attach = gl861_tuner_attach,
175
176 .stream = {
177 .type = USB_BULK,
178 .count = 7,
179 .endpoint = 0x81,
180 .u = {
181 .bulk = {
182 .buffersize = 512,
183 }
184 }
185 },
186 }},
187 } },
188 .i2c_algo = &gl861_i2c_algo,
189
190 .num_device_descs = 2,
191 .devices = {
192 { 144 {
193 .name = "MSI Mega Sky 55801 DVB-T USB2.0", 145 .stream = DVB_USB_STREAM_BULK(0x81, 7, 512),
194 .cold_ids = { NULL }, 146 }
195 .warm_ids = { &gl861_table[0], NULL },
196 },
197 {
198 .name = "A-LINK DTU DVB-T USB2.0",
199 .cold_ids = { NULL },
200 .warm_ids = { &gl861_table[1], NULL },
201 },
202 } 147 }
203}; 148};
204 149
205static struct usb_driver gl861_driver = { 150static const struct usb_device_id gl861_id_table[] = {
206 .name = "dvb_usb_gl861", 151 { DVB_USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580_55801,
207 .probe = gl861_probe, 152 &gl861_props, "MSI Mega Sky 55801 DVB-T USB2.0", NULL) },
208 .disconnect = dvb_usb_device_exit, 153 { DVB_USB_DEVICE(USB_VID_ALINK, USB_VID_ALINK_DTU,
209 .id_table = gl861_table, 154 &gl861_props, "A-LINK DTU DVB-T USB2.0", NULL) },
155 { }
156};
157MODULE_DEVICE_TABLE(usb, gl861_id_table);
158
159static struct usb_driver gl861_usb_driver = {
160 .name = KBUILD_MODNAME,
161 .id_table = gl861_id_table,
162 .probe = dvb_usbv2_probe,
163 .disconnect = dvb_usbv2_disconnect,
164 .suspend = dvb_usbv2_suspend,
165 .resume = dvb_usbv2_resume,
166 .no_dynamic_id = 1,
167 .soft_unbind = 1,
210}; 168};
211 169
212module_usb_driver(gl861_driver); 170module_usb_driver(gl861_usb_driver);
213 171
214MODULE_AUTHOR("Carl Lundqvist <comabug@gmail.com>"); 172MODULE_AUTHOR("Carl Lundqvist <comabug@gmail.com>");
215MODULE_DESCRIPTION("Driver MSI Mega Sky 580 DVB-T USB2.0 / GL861"); 173MODULE_DESCRIPTION("Driver MSI Mega Sky 580 DVB-T USB2.0 / GL861");
diff --git a/drivers/media/dvb/dvb-usb/gl861.h b/drivers/media/dvb/dvb-usb/gl861.h
index c54855e2c233..b0b80d87bb7e 100644
--- a/drivers/media/dvb/dvb-usb/gl861.h
+++ b/drivers/media/dvb/dvb-usb/gl861.h
@@ -1,10 +1,7 @@
1#ifndef _DVB_USB_GL861_H_ 1#ifndef _DVB_USB_GL861_H_
2#define _DVB_USB_GL861_H_ 2#define _DVB_USB_GL861_H_
3 3
4#define DVB_USB_LOG_PREFIX "gl861" 4#include "dvb_usb.h"
5#include "dvb-usb.h"
6
7#define deb_rc(args...) dprintk(dvb_usb_gl861_debug, 0x01, args)
8 5
9#define GL861_WRITE 0x40 6#define GL861_WRITE 0x40
10#define GL861_READ 0xc0 7#define GL861_READ 0xc0