diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h --- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h Wed Jun 13 18:11:15 2007 +++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h Wed Jun 27 20:18:55 2007 @@ -156,6 +156,7 @@ #define USB_PID_OPERA1_WARM 0x3829 #define USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD 0x0514 #define USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM 0x0513 +#define USB_PID_LIFEVIEW_TV_WALKER_TWIN_LR506_COLD 0x0506 #endif diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/m920x.c --- a/linux/drivers/media/dvb/dvb-usb/m920x.c Wed Jun 13 18:11:15 2007 +++ b/linux/drivers/media/dvb/dvb-usb/m920x.c Wed Jun 27 20:18:55 2007 @@ -57,6 +57,18 @@ return ret; } +static inline int m920x_write_bulk(struct usb_device *udev, u8 request, u16 value, + u16 index, void *data, int size) +{ + int ret; + + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), + request, USB_TYPE_VENDOR | USB_DIR_OUT, + value, index, data, size, 2000); + + return ret; +} + static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq) { int ret = 0, i, epi, flags = 0; @@ -250,8 +262,48 @@ return I2C_FUNC_I2C; } +static int m920x_twalk_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num) +{ + struct dvb_usb_device *d = i2c_get_adapdata(adap); + int i, j; + int ret = 0; + + if (!num) + return -EINVAL; + + if (mutex_lock_interruptible(&d->i2c_mutex) < 0) + return -EAGAIN; + + for (i = 0; i < num; i++) { + if (msg[i].flags & (I2C_M_NO_RD_ACK | I2C_M_IGNORE_NAK | I2C_M_TEN | I2C_M_NOSTART) || msg[i].len == 0) { + ret = -ENOTSUPP; + goto unlock; + } + if (msg[i].flags & I2C_M_RD) { + if ((ret = m920x_read(d->udev, M9206_TWALK_I2C_R, + msg[i].addr, 0, msg[i].buf, msg[i].len)) != 0) + goto unlock; + } else { + if ((ret = m920x_write_bulk(d->udev, M9206_TWALK_I2C_W, + msg[i].addr, 0, msg[i].buf, msg[i].len)) != 0) + goto unlock; + } + } + ret = num; + + unlock: + mutex_unlock(&d->i2c_mutex); + + return ret; +} + static struct i2c_algorithm m920x_i2c_algo = { .master_xfer = m920x_i2c_xfer, + .functionality = m920x_i2c_func, +}; + +static struct i2c_algorithm m920x_twalk_i2c_algo = { + .master_xfer = m920x_twalk_i2c_xfer, .functionality = m920x_i2c_func, }; @@ -673,6 +725,8 @@ USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM) }, { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_COLD) }, { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_WARM) }, + { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC, + USB_PID_LIFEVIEW_TV_WALKER_TWIN_LR506_COLD) }, { } /* Terminating entry */ }; MODULE_DEVICE_TABLE (usb, m920x_table); @@ -886,6 +940,52 @@ } }; +static struct dvb_usb_device_properties tvwalker_lr506_properties = { + .caps = DVB_USB_IS_AN_I2C_ADAPTER, + + .usb_ctrl = DEVICE_SPECIFIC, + .firmware = "dvb-usb-tvwalker-lr506.fw", + .download_firmware = m920x_firmware_download, + +#if 0 + .rc_interval = 100, + .rc_key_map = tvwalkertwin_rc_keys, + .rc_key_map_size = ARRAY_SIZE(tvwalkertwin_rc_keys), + .rc_query = m920x_rc_query, +#endif + + .size_of_priv = sizeof(struct m920x_state), + + .identify_state = m920x_identify_state, + .num_adapters = 1, + .adapter = {{ + /* Hardware pid filters don't work with this device/firmware */ + + .frontend_attach = m920x_tda10046_08_frontend_attach, + .tuner_attach = m920x_tda8275_60_tuner_attach, + + .stream = { + .type = USB_BULK, + .count = 8, + .endpoint = 0x81, + .u = { + .bulk = { + .buffersize = 512, + } + } + }, + }}, + .i2c_algo = &m920x_twalk_i2c_algo, + + .num_device_descs = 1, + .devices = { + { .name = "LifeView TV Walker LR506 DVB-T USB2.0", + .cold_ids = { &m920x_table[6], NULL }, +// .warm_ids = { &m920x_table[6], NULL }, + }, + } +}; + static struct usb_driver m920x_driver = { #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) .owner = THIS_MODULE, diff -r 76b92a337aec linux/drivers/media/dvb/dvb-usb/m920x.h --- a/linux/drivers/media/dvb/dvb-usb/m920x.h Wed Jun 13 18:11:15 2007 +++ b/linux/drivers/media/dvb/dvb-usb/m920x.h Wed Jun 27 20:18:55 2007 @@ -5,6 +5,9 @@ #include "dvb-usb.h" #define deb(args...) dprintk(dvb_usb_m920x_debug,0x01,args) + +#define M9206_TWALK_I2C_W 0x20 +#define M9206_TWALK_I2C_R 0x21 #define M9206_CORE 0x22 #define M9206_RC_STATE 0xff51