/* DVB USB compliant linux driver for Sigmatek DVB-110 DVB-T USB2.0 receiver
*
- * Copyright (C) 2006 Antti Palosaari (crope@iki.fi)
+ * Copyright (C) 2006 Antti Palosaari <crope@iki.fi>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
module_param_named(debug, dvb_usb_au6610_debug, int, 0644);
MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
static int au6610_usb_msg(struct dvb_usb_device *d, u8 operation, u8 addr,
u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
{
int ret;
u16 index;
- u8 usb_buf[6]; /* enough for all known requests, read returns 5 and write 6 bytes */
-
+ u8 usb_buf[6]; /* enough for all known requests,
+ read returns 5 and write 6 bytes */
switch (wlen) {
case 1:
index = wbuf[0] << 8;
}
ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), operation,
- USB_TYPE_VENDOR | USB_DIR_IN, addr, index, usb_buf,
+ USB_TYPE_VENDOR|USB_DIR_IN, addr << 1, index, usb_buf,
sizeof(usb_buf), AU6610_USB_TIMEOUT);
if (ret < 0)
return ret;
}
-static int au6610_i2c_msg(struct dvb_usb_device *d, u8 addr, u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
+static int au6610_i2c_msg(struct dvb_usb_device *d, u8 addr,
+ u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
{
u8 request;
u8 wo = (rbuf == NULL || rlen == 0); /* write-only */
/* I2C */
-static int au6610_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num)
+static int au6610_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
+ int num)
{
struct dvb_usb_device *d = i2c_get_adapdata(adap);
int i;
- if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
- return -EAGAIN;
-
if (num > 2)
return -EINVAL;
+ if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
+ return -EAGAIN;
+
for (i = 0; i < num; i++) {
/* write/read request */
if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) {
if (au6610_i2c_msg(d, msg[i].addr, msg[i].buf,
- msg[i].len, msg[i+1].buf, msg[i+1].len) < 0)
+ msg[i].len, msg[i+1].buf,
+ msg[i+1].len) < 0)
break;
i++;
} else if (au6610_i2c_msg(d, msg[i].addr, msg[i].buf,
}
static struct zl10353_config au6610_zl10353_config = {
- .demod_address = 0x1e,
+ .demod_address = 0x0f,
.no_tuner = 1,
.parallel_ts = 1,
};
-
static int au6610_zl10353_frontend_attach(struct dvb_usb_adapter *adap)
{
if ((adap->fe = dvb_attach(zl10353_attach, &au6610_zl10353_config,
return -EIO;
}
+static struct qt1010_config au6610_qt1010_config = {
+ .i2c_address = 0x62
+};
+
+static int au6610_qt1010_tuner_attach(struct dvb_usb_adapter *adap)
+{
+ return dvb_attach(qt1010_attach,
+ adap->fe, &adap->dev->i2c_adap,
+ &au6610_qt1010_config) == NULL ? -ENODEV : 0;
+}
+
/* DVB USB Driver stuff */
static struct dvb_usb_device_properties au6610_properties;
-static int au6610_probe(struct usb_interface *intf, const struct usb_device_id *id)
+static int au6610_probe(struct usb_interface *intf,
+ const struct usb_device_id *id)
{
struct dvb_usb_device *d;
struct usb_host_interface *alt;
if (intf->num_altsetting < AU6610_ALTSETTING_COUNT)
return -ENODEV;
- if ((ret = dvb_usb_device_init(intf, &au6610_properties, THIS_MODULE, &d)) == 0) {
+ ret = dvb_usb_device_init(intf, &au6610_properties, THIS_MODULE, &d,
+ adapter_nr);
+ if (ret == 0) {
alt = usb_altnum_to_altsetting(intf, AU6610_ALTSETTING);
if (alt == NULL) {
.adapter = {
{
.frontend_attach = au6610_zl10353_frontend_attach,
- .tuner_attach = qt1010_tuner_attach,
+ .tuner_attach = au6610_qt1010_tuner_attach,
.stream = {
.type = USB_ISOC,