aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2012-06-12 21:49:54 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-08-04 06:56:31 -0400
commitcb4f77a385c3a6037c2c14d4aede7257e8dd2a6c (patch)
treed7135436d315abda9b102e9f9390ae842151f27b
parent77e28ec27927dbb130d84a9fe7cbe85bf6bf47ea (diff)
[media] au6610: convert to new DVB USB
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/dvb/dvb-usb/Kconfig2
-rw-r--r--drivers/media/dvb/dvb-usb/au6610.c97
-rw-r--r--drivers/media/dvb/dvb-usb/au6610.h13
3 files changed, 35 insertions, 77 deletions
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index abbfd528a8db..fbca7a076236 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -173,7 +173,7 @@ config DVB_USB_GL861
173 173
174config DVB_USB_AU6610 174config DVB_USB_AU6610
175 tristate "Alcor Micro AU6610 USB2.0 support" 175 tristate "Alcor Micro AU6610 USB2.0 support"
176 depends on DVB_USB 176 depends on DVB_USB_V2
177 select DVB_ZL10353 if !DVB_FE_CUSTOMISE 177 select DVB_ZL10353 if !DVB_FE_CUSTOMISE
178 select MEDIA_TUNER_QT1010 if !MEDIA_TUNER_CUSTOMISE 178 select MEDIA_TUNER_QT1010 if !MEDIA_TUNER_CUSTOMISE
179 help 179 help
diff --git a/drivers/media/dvb/dvb-usb/au6610.c b/drivers/media/dvb/dvb-usb/au6610.c
index 16210c060302..aaa0fec7d6a8 100644
--- a/drivers/media/dvb/dvb-usb/au6610.c
+++ b/drivers/media/dvb/dvb-usb/au6610.c
@@ -22,10 +22,6 @@
22#include "zl10353.h" 22#include "zl10353.h"
23#include "qt1010.h" 23#include "qt1010.h"
24 24
25/* debug */
26static int dvb_usb_au6610_debug;
27module_param_named(debug, dvb_usb_au6610_debug, int, 0644);
28MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS);
29DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 25DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
30 26
31static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr, 27static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr,
@@ -52,7 +48,7 @@ static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr,
52 index += wbuf[1]; 48 index += wbuf[1];
53 break; 49 break;
54 default: 50 default:
55 warn("wlen = %x, aborting.", wlen); 51 pr_err("%s: wlen = %d, aborting\n", KBUILD_MODNAME, wlen);
56 ret = -EINVAL; 52 ret = -EINVAL;
57 goto error; 53 goto error;
58 } 54 }
@@ -140,9 +136,9 @@ static struct zl10353_config au6610_zl10353_config = {
140 136
141static int au6610_zl10353_frontend_attach(struct dvb_usb_adapter *adap) 137static int au6610_zl10353_frontend_attach(struct dvb_usb_adapter *adap)
142{ 138{
143 adap->fe_adap[0].fe = dvb_attach(zl10353_attach, &au6610_zl10353_config, 139 adap->fe[0] = dvb_attach(zl10353_attach, &au6610_zl10353_config,
144 &adap->dev->i2c_adap); 140 &adap->dev->i2c_adap);
145 if (adap->fe_adap[0].fe == NULL) 141 if (adap->fe[0] == NULL)
146 return -ENODEV; 142 return -ENODEV;
147 143
148 return 0; 144 return 0;
@@ -155,60 +151,30 @@ static struct qt1010_config au6610_qt1010_config = {
155static int au6610_qt1010_tuner_attach(struct dvb_usb_adapter *adap) 151static int au6610_qt1010_tuner_attach(struct dvb_usb_adapter *adap)
156{ 152{
157 return dvb_attach(qt1010_attach, 153 return dvb_attach(qt1010_attach,
158 adap->fe_adap[0].fe, &adap->dev->i2c_adap, 154 adap->fe[0], &adap->dev->i2c_adap,
159 &au6610_qt1010_config) == NULL ? -ENODEV : 0; 155 &au6610_qt1010_config) == NULL ? -ENODEV : 0;
160} 156}
161 157
162/* DVB USB Driver stuff */ 158static int au6610_init(struct dvb_usb_device *d)
163static struct dvb_usb_device_properties au6610_properties;
164
165static int au6610_probe(struct usb_interface *intf,
166 const struct usb_device_id *id)
167{ 159{
168 struct dvb_usb_device *d; 160 /* TODO: this functionality belongs likely to the streaming control */
169 struct usb_host_interface *alt; 161 /* bInterfaceNumber 0, bAlternateSetting 5 */
170 int ret; 162 return usb_set_interface(d->udev, 0, 5);
171
172 if (intf->num_altsetting < AU6610_ALTSETTING_COUNT)
173 return -ENODEV;
174
175 ret = dvb_usb_device_init(intf, &au6610_properties, THIS_MODULE, &d,
176 adapter_nr);
177 if (ret == 0) {
178 alt = usb_altnum_to_altsetting(intf, AU6610_ALTSETTING);
179
180 if (alt == NULL) {
181 deb_info("%s: no alt found!\n", __func__);
182 return -ENODEV;
183 }
184 ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber,
185 alt->desc.bAlternateSetting);
186 }
187
188 return ret;
189} 163}
190 164
191static struct usb_device_id au6610_table [] = { 165static struct dvb_usb_device_properties au6610_props = {
192 { USB_DEVICE(USB_VID_ALCOR_MICRO, USB_PID_SIGMATEK_DVB_110) }, 166 .driver_name = KBUILD_MODNAME,
193 { } /* Terminating entry */ 167 .owner = THIS_MODULE,
194}; 168 .adapter_nr = adapter_nr,
195MODULE_DEVICE_TABLE(usb, au6610_table);
196
197static struct dvb_usb_device_properties au6610_properties = {
198 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
199 169
200 .usb_ctrl = DEVICE_SPECIFIC, 170 .i2c_algo = &au6610_i2c_algo,
201 171 .frontend_attach = au6610_zl10353_frontend_attach,
202 .size_of_priv = 0, 172 .tuner_attach = au6610_qt1010_tuner_attach,
173 .init = au6610_init,
203 174
204 .num_adapters = 1, 175 .num_adapters = 1,
205 .adapter = { 176 .adapter = {
206 { 177 {
207 .num_frontends = 1,
208 .fe = {{
209 .frontend_attach = au6610_zl10353_frontend_attach,
210 .tuner_attach = au6610_qt1010_tuner_attach,
211
212 .stream = { 178 .stream = {
213 .type = USB_ISOC, 179 .type = USB_ISOC,
214 .count = 5, 180 .count = 5,
@@ -221,27 +187,26 @@ static struct dvb_usb_device_properties au6610_properties = {
221 } 187 }
222 } 188 }
223 }, 189 },
224 }}, 190 },
225 }
226 }, 191 },
192};
227 193
228 .i2c_algo = &au6610_i2c_algo, 194static const struct usb_device_id au6610_id_table[] = {
229 195 { DVB_USB_DEVICE(USB_VID_ALCOR_MICRO, USB_PID_SIGMATEK_DVB_110,
230 .num_device_descs = 1, 196 &au6610_props, "Sigmatek DVB-110", NULL) },
231 .devices = { 197 { }
232 {
233 .name = "Sigmatek DVB-110 DVB-T USB2.0",
234 .cold_ids = {NULL},
235 .warm_ids = {&au6610_table[0], NULL},
236 },
237 }
238}; 198};
199MODULE_DEVICE_TABLE(usb, au6610_id_table);
239 200
240static struct usb_driver au6610_driver = { 201static struct usb_driver au6610_driver = {
241 .name = "dvb_usb_au6610", 202 .name = KBUILD_MODNAME,
242 .probe = au6610_probe, 203 .id_table = au6610_id_table,
243 .disconnect = dvb_usb_device_exit, 204 .probe = dvb_usbv2_probe,
244 .id_table = au6610_table, 205 .disconnect = dvb_usbv2_disconnect,
206 .suspend = dvb_usbv2_suspend,
207 .resume = dvb_usbv2_resume,
208 .no_dynamic_id = 1,
209 .soft_unbind = 1,
245}; 210};
246 211
247module_usb_driver(au6610_driver); 212module_usb_driver(au6610_driver);
diff --git a/drivers/media/dvb/dvb-usb/au6610.h b/drivers/media/dvb/dvb-usb/au6610.h
index 7849abe2c614..ea337bfc00b1 100644
--- a/drivers/media/dvb/dvb-usb/au6610.h
+++ b/drivers/media/dvb/dvb-usb/au6610.h
@@ -18,13 +18,9 @@
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */ 19 */
20 20
21#ifndef _DVB_USB_AU6610_H_ 21#ifndef AU6610_H
22#define _DVB_USB_AU6610_H_ 22#define AU6610_H
23 23#include "dvb_usb.h"
24#define DVB_USB_LOG_PREFIX "au6610"
25#include "dvb-usb.h"
26
27#define deb_info(args...) dprintk(dvb_usb_au6610_debug, 0x01, args)
28 24
29#define AU6610_REQ_I2C_WRITE 0x14 25#define AU6610_REQ_I2C_WRITE 0x14
30#define AU6610_REQ_I2C_READ 0x13 26#define AU6610_REQ_I2C_READ 0x13
@@ -33,7 +29,4 @@
33 29
34#define AU6610_USB_TIMEOUT 1000 30#define AU6610_USB_TIMEOUT 1000
35 31
36#define AU6610_ALTSETTING_COUNT 6
37#define AU6610_ALTSETTING 5
38
39#endif 32#endif