2010-09-02 20:29:30 +00:00
|
|
|
/* DVB USB compliant linux driver for
|
|
|
|
*
|
|
|
|
* DM04/QQBOX DVB-S USB BOX LME2510C + SHARP:BS2F7HZ7395
|
2010-10-16 19:44:43 +00:00
|
|
|
* LME2510C + LG TDQY-P001F
|
2011-02-13 01:35:08 +00:00
|
|
|
* LME2510C + BS2F7HZ0194
|
2010-10-16 19:44:43 +00:00
|
|
|
* LME2510 + LG TDQY-P001F
|
2011-02-13 01:35:08 +00:00
|
|
|
* LME2510 + BS2F7HZ0194
|
2010-09-02 20:29:30 +00:00
|
|
|
*
|
|
|
|
* MVB7395 (LME2510C+SHARP:BS2F7HZ7395)
|
|
|
|
* SHARP:BS2F7HZ7395 = (STV0288+Sharp IX2505V)
|
|
|
|
*
|
2010-10-16 19:44:43 +00:00
|
|
|
* MV001F (LME2510+LGTDQY-P001F)
|
2010-09-02 20:29:30 +00:00
|
|
|
* LG TDQY - P001F =(TDA8263 + TDA10086H)
|
|
|
|
*
|
2010-10-16 19:44:43 +00:00
|
|
|
* MVB0001F (LME2510C+LGTDQT-P001F)
|
|
|
|
*
|
2011-02-13 01:35:08 +00:00
|
|
|
* MV0194 (LME2510+SHARP:BS2F7HZ0194)
|
|
|
|
* SHARP:BS2F7HZ0194 = (STV0299+IX2410)
|
|
|
|
*
|
|
|
|
* MVB0194 (LME2510C+SHARP0194)
|
|
|
|
*
|
2010-09-02 20:29:30 +00:00
|
|
|
* For firmware see Documentation/dvb/lmedm04.txt
|
|
|
|
*
|
|
|
|
* I2C addresses:
|
|
|
|
* 0xd0 - STV0288 - Demodulator
|
|
|
|
* 0xc0 - Sharp IX2505V - Tuner
|
2011-02-13 01:35:08 +00:00
|
|
|
* --
|
2010-09-02 20:29:30 +00:00
|
|
|
* 0x1c - TDA10086 - Demodulator
|
|
|
|
* 0xc0 - TDA8263 - Tuner
|
2011-02-13 01:35:08 +00:00
|
|
|
* --
|
|
|
|
* 0xd0 - STV0299 - Demodulator
|
|
|
|
* 0xc0 - IX2410 - Tuner
|
2010-09-02 20:29:30 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* VID = 3344 PID LME2510=1122 LME2510C=1120
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Malcolm Priestley (tvboxspy@gmail.com)
|
|
|
|
* LME2510(C)(C) Leaguerme (Shenzhen) MicroElectronics Co., Ltd.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License Version 2, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* see Documentation/dvb/README.dvb-usb for more information
|
|
|
|
*
|
|
|
|
* Known Issues :
|
|
|
|
* LME2510: Non Intel USB chipsets fail to maintain High Speed on
|
|
|
|
* Boot or Hot Plug.
|
|
|
|
*
|
2010-10-16 19:44:43 +00:00
|
|
|
* QQbox suffers from noise on LNB voltage.
|
2010-09-02 20:29:30 +00:00
|
|
|
*
|
2011-02-13 01:35:08 +00:00
|
|
|
* LME2510: SHARP:BS2F7HZ0194(MV0194) cannot cold reset and share system
|
|
|
|
* with other tuners. After a cold reset streaming will not start.
|
|
|
|
*
|
2010-09-02 20:29:30 +00:00
|
|
|
*/
|
|
|
|
#define DVB_USB_LOG_PREFIX "LME2510(C)"
|
|
|
|
#include <linux/usb.h>
|
|
|
|
#include <linux/usb/input.h>
|
2010-11-17 16:28:38 +00:00
|
|
|
#include <media/rc-core.h>
|
2010-09-02 20:29:30 +00:00
|
|
|
|
|
|
|
#include "dvb-usb.h"
|
|
|
|
#include "lmedm04.h"
|
|
|
|
#include "tda826x.h"
|
|
|
|
#include "tda10086.h"
|
|
|
|
#include "stv0288.h"
|
|
|
|
#include "ix2505v.h"
|
2011-02-13 01:35:08 +00:00
|
|
|
#include "stv0299.h"
|
|
|
|
#include "dvb-pll.h"
|
|
|
|
#include "z0194a.h"
|
2010-09-02 20:29:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* debug */
|
|
|
|
static int dvb_usb_lme2510_debug;
|
|
|
|
#define l_dprintk(var, level, args...) do { \
|
|
|
|
if ((var >= level)) \
|
|
|
|
printk(KERN_DEBUG DVB_USB_LOG_PREFIX ": " args); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define deb_info(level, args...) l_dprintk(dvb_usb_lme2510_debug, level, args)
|
|
|
|
#define debug_data_snipet(level, name, p) \
|
|
|
|
deb_info(level, name" (%02x%02x%02x%02x%02x%02x%02x%02x)", \
|
|
|
|
*p, *(p+1), *(p+2), *(p+3), *(p+4), \
|
|
|
|
*(p+5), *(p+6), *(p+7));
|
|
|
|
|
|
|
|
|
|
|
|
module_param_named(debug, dvb_usb_lme2510_debug, int, 0644);
|
|
|
|
MODULE_PARM_DESC(debug, "set debugging level (1=info (or-able))."
|
|
|
|
DVB_USB_DEBUG_STATUS);
|
|
|
|
|
2010-10-16 19:44:43 +00:00
|
|
|
static int dvb_usb_lme2510_firmware;
|
|
|
|
module_param_named(firmware, dvb_usb_lme2510_firmware, int, 0644);
|
|
|
|
MODULE_PARM_DESC(firmware, "set default firmware 0=Sharp7395 1=LG");
|
|
|
|
|
2011-04-02 21:59:29 +00:00
|
|
|
static int pid_filter;
|
|
|
|
module_param_named(pid, pid_filter, int, 0644);
|
|
|
|
MODULE_PARM_DESC(pid, "set default 0=on 1=off");
|
|
|
|
|
2010-10-16 19:44:43 +00:00
|
|
|
|
2010-09-02 20:29:30 +00:00
|
|
|
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
|
2011-02-13 01:35:08 +00:00
|
|
|
|
|
|
|
#define TUNER_DEFAULT 0x0
|
2010-10-16 19:44:43 +00:00
|
|
|
#define TUNER_LG 0x1
|
|
|
|
#define TUNER_S7395 0x2
|
2011-02-13 01:35:08 +00:00
|
|
|
#define TUNER_S0194 0x3
|
2010-09-02 20:29:30 +00:00
|
|
|
|
|
|
|
struct lme2510_state {
|
|
|
|
u8 id;
|
|
|
|
u8 tuner_config;
|
|
|
|
u8 signal_lock;
|
|
|
|
u8 signal_level;
|
|
|
|
u8 signal_sn;
|
|
|
|
u8 time_key;
|
|
|
|
u8 i2c_talk_onoff;
|
|
|
|
u8 i2c_gate;
|
|
|
|
u8 i2c_tuner_gate_w;
|
|
|
|
u8 i2c_tuner_gate_r;
|
|
|
|
u8 i2c_tuner_addr;
|
2010-10-16 19:44:43 +00:00
|
|
|
u8 stream_on;
|
2011-04-22 09:20:57 +00:00
|
|
|
u8 pid_size;
|
2010-09-02 20:29:30 +00:00
|
|
|
void *buffer;
|
|
|
|
struct urb *lme_urb;
|
|
|
|
void *usb_buffer;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
static int lme2510_bulk_write(struct usb_device *dev,
|
|
|
|
u8 *snd, int len, u8 pipe)
|
|
|
|
{
|
|
|
|
int ret, actual_l;
|
2010-10-16 19:44:43 +00:00
|
|
|
|
2010-09-02 20:29:30 +00:00
|
|
|
ret = usb_bulk_msg(dev, usb_sndbulkpipe(dev, pipe),
|
2010-11-04 20:17:51 +00:00
|
|
|
snd, len , &actual_l, 100);
|
2010-09-02 20:29:30 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int lme2510_bulk_read(struct usb_device *dev,
|
|
|
|
u8 *rev, int len, u8 pipe)
|
|
|
|
{
|
|
|
|
int ret, actual_l;
|
|
|
|
|
|
|
|
ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, pipe),
|
2010-11-04 20:17:51 +00:00
|
|
|
rev, len , &actual_l, 200);
|
2010-09-02 20:29:30 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int lme2510_usb_talk(struct dvb_usb_device *d,
|
|
|
|
u8 *wbuf, int wlen, u8 *rbuf, int rlen)
|
|
|
|
{
|
|
|
|
struct lme2510_state *st = d->priv;
|
|
|
|
u8 *buff;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (st->usb_buffer == NULL) {
|
2011-09-11 22:30:10 +00:00
|
|
|
st->usb_buffer = kmalloc(64, GFP_KERNEL);
|
2010-09-02 20:29:30 +00:00
|
|
|
if (st->usb_buffer == NULL) {
|
|
|
|
info("MEM Error no memory");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
buff = st->usb_buffer;
|
|
|
|
|
|
|
|
ret = mutex_lock_interruptible(&d->usb_mutex);
|
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
return -EAGAIN;
|
|
|
|
|
2011-09-11 22:30:10 +00:00
|
|
|
/* the read/write capped at 64 */
|
|
|
|
memcpy(buff, wbuf, (wlen < 64) ? wlen : 64);
|
2011-04-22 09:07:40 +00:00
|
|
|
|
2010-09-02 20:29:30 +00:00
|
|
|
ret |= usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, 0x01));
|
|
|
|
|
2010-10-16 19:44:43 +00:00
|
|
|
ret |= lme2510_bulk_write(d->udev, buff, wlen , 0x01);
|
|
|
|
|
2010-11-04 20:17:51 +00:00
|
|
|
msleep(10);
|
2010-10-16 19:44:43 +00:00
|
|
|
|
|
|
|
ret |= usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, 0x01));
|
2010-09-02 20:29:30 +00:00
|
|
|
|
2011-09-11 22:30:10 +00:00
|
|
|
ret |= lme2510_bulk_read(d->udev, buff, (rlen < 64) ?
|
|
|
|
rlen : 64 , 0x01);
|
2010-09-02 20:29:30 +00:00
|
|
|
|
|
|
|
if (rlen > 0)
|
|
|
|
memcpy(rbuf, buff, rlen);
|
|
|
|
|
|
|
|
mutex_unlock(&d->usb_mutex);
|
|
|
|
|
|
|
|
return (ret < 0) ? -ENODEV : 0;
|
|
|
|
}
|
|
|
|
|
2010-10-27 22:50:36 +00:00
|
|
|
static int lme2510_stream_restart(struct dvb_usb_device *d)
|
|
|
|
{
|
2010-10-16 19:44:43 +00:00
|
|
|
static u8 stream_on[] = LME_ST_ON_W;
|
|
|
|
int ret;
|
|
|
|
u8 rbuff[10];
|
|
|
|
/*Restart Stream Command*/
|
2010-10-27 22:50:36 +00:00
|
|
|
ret = lme2510_usb_talk(d, stream_on, sizeof(stream_on),
|
2010-10-16 19:44:43 +00:00
|
|
|
rbuff, sizeof(rbuff));
|
|
|
|
return ret;
|
|
|
|
}
|
2010-09-02 20:29:30 +00:00
|
|
|
|
2011-04-02 21:59:29 +00:00
|
|
|
static int lme2510_enable_pid(struct dvb_usb_device *d, u8 index, u16 pid_out)
|
|
|
|
{
|
|
|
|
struct lme2510_state *st = d->priv;
|
|
|
|
static u8 pid_buff[] = LME_ZERO_PID;
|
|
|
|
static u8 rbuf[1];
|
|
|
|
u8 pid_no = index * 2;
|
2011-04-22 09:20:57 +00:00
|
|
|
u8 pid_len = pid_no + 2;
|
2011-04-02 21:59:29 +00:00
|
|
|
int ret = 0;
|
|
|
|
deb_info(1, "PID Setting Pid %04x", pid_out);
|
|
|
|
|
2011-04-22 09:20:57 +00:00
|
|
|
if (st->pid_size == 0)
|
|
|
|
ret |= lme2510_stream_restart(d);
|
|
|
|
|
2011-04-02 21:59:29 +00:00
|
|
|
pid_buff[2] = pid_no;
|
|
|
|
pid_buff[3] = (u8)pid_out & 0xff;
|
|
|
|
pid_buff[4] = pid_no + 1;
|
|
|
|
pid_buff[5] = (u8)(pid_out >> 8);
|
|
|
|
|
2011-04-22 09:20:57 +00:00
|
|
|
if (pid_len > st->pid_size)
|
|
|
|
st->pid_size = pid_len;
|
|
|
|
pid_buff[7] = 0x80 + st->pid_size;
|
2011-04-02 21:59:29 +00:00
|
|
|
|
|
|
|
ret |= lme2510_usb_talk(d, pid_buff ,
|
|
|
|
sizeof(pid_buff) , rbuf, sizeof(rbuf));
|
|
|
|
|
2011-04-22 09:20:57 +00:00
|
|
|
if (st->stream_on)
|
2011-04-02 21:59:29 +00:00
|
|
|
ret |= lme2510_stream_restart(d);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-09-02 20:29:30 +00:00
|
|
|
static void lme2510_int_response(struct urb *lme_urb)
|
|
|
|
{
|
|
|
|
struct dvb_usb_adapter *adap = lme_urb->context;
|
|
|
|
struct lme2510_state *st = adap->dev->priv;
|
|
|
|
static u8 *ibuf, *rbuf;
|
|
|
|
int i = 0, offset;
|
2011-05-25 21:28:29 +00:00
|
|
|
u32 key;
|
2010-09-02 20:29:30 +00:00
|
|
|
|
|
|
|
switch (lme_urb->status) {
|
|
|
|
case 0:
|
|
|
|
case -ETIMEDOUT:
|
|
|
|
break;
|
|
|
|
case -ECONNRESET:
|
|
|
|
case -ENOENT:
|
|
|
|
case -ESHUTDOWN:
|
|
|
|
return;
|
|
|
|
default:
|
|
|
|
info("Error %x", lme_urb->status);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
rbuf = (u8 *) lme_urb->transfer_buffer;
|
|
|
|
|
|
|
|
offset = ((lme_urb->actual_length/8) > 4)
|
|
|
|
? 4 : (lme_urb->actual_length/8) ;
|
|
|
|
|
|
|
|
for (i = 0; i < offset; ++i) {
|
|
|
|
ibuf = (u8 *)&rbuf[i*8];
|
|
|
|
deb_info(5, "INT O/S C =%02x C/O=%02x Type =%02x%02x",
|
|
|
|
offset, i, ibuf[0], ibuf[1]);
|
|
|
|
|
|
|
|
switch (ibuf[0]) {
|
|
|
|
case 0xaa:
|
2011-05-25 21:28:29 +00:00
|
|
|
debug_data_snipet(1, "INT Remote data snipet", ibuf);
|
|
|
|
if ((ibuf[4] + ibuf[5]) == 0xff) {
|
|
|
|
key = ibuf[5];
|
|
|
|
key += (ibuf[3] > 0)
|
|
|
|
? (ibuf[3] ^ 0xff) << 8 : 0;
|
|
|
|
key += (ibuf[2] ^ 0xff) << 16;
|
|
|
|
deb_info(1, "INT Key =%08x", key);
|
|
|
|
if (adap->dev->rc_dev != NULL)
|
|
|
|
rc_keydown(adap->dev->rc_dev, key, 0);
|
|
|
|
}
|
2010-09-02 20:29:30 +00:00
|
|
|
break;
|
|
|
|
case 0xbb:
|
|
|
|
switch (st->tuner_config) {
|
|
|
|
case TUNER_LG:
|
2010-10-16 19:44:43 +00:00
|
|
|
if (ibuf[2] > 0)
|
|
|
|
st->signal_lock = ibuf[2];
|
2010-09-02 20:29:30 +00:00
|
|
|
st->signal_level = ibuf[4];
|
|
|
|
st->signal_sn = ibuf[3];
|
|
|
|
st->time_key = ibuf[7];
|
|
|
|
break;
|
|
|
|
case TUNER_S7395:
|
2011-02-13 01:35:08 +00:00
|
|
|
case TUNER_S0194:
|
2010-09-02 20:29:30 +00:00
|
|
|
/* Tweak for earlier firmware*/
|
|
|
|
if (ibuf[1] == 0x03) {
|
2010-10-27 22:50:36 +00:00
|
|
|
if (ibuf[2] > 1)
|
|
|
|
st->signal_lock = ibuf[2];
|
2010-09-02 20:29:30 +00:00
|
|
|
st->signal_level = ibuf[3];
|
2010-10-16 19:44:43 +00:00
|
|
|
st->signal_sn = ibuf[4];
|
2010-09-02 20:29:30 +00:00
|
|
|
} else {
|
|
|
|
st->signal_level = ibuf[4];
|
|
|
|
st->signal_sn = ibuf[5];
|
2010-10-27 22:50:36 +00:00
|
|
|
st->signal_lock =
|
|
|
|
(st->signal_lock & 0xf7) +
|
|
|
|
((ibuf[2] & 0x01) << 0x03);
|
2010-09-02 20:29:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
debug_data_snipet(5, "INT Remote data snipet in", ibuf);
|
|
|
|
break;
|
|
|
|
case 0xcc:
|
|
|
|
debug_data_snipet(1, "INT Control data snipet", ibuf);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
debug_data_snipet(1, "INT Unknown data snipet", ibuf);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
usb_submit_urb(lme_urb, GFP_ATOMIC);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int lme2510_int_read(struct dvb_usb_adapter *adap)
|
|
|
|
{
|
|
|
|
struct lme2510_state *lme_int = adap->dev->priv;
|
|
|
|
|
|
|
|
lme_int->lme_urb = usb_alloc_urb(0, GFP_ATOMIC);
|
|
|
|
|
|
|
|
if (lme_int->lme_urb == NULL)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
2011-09-11 22:26:50 +00:00
|
|
|
lme_int->buffer = usb_alloc_coherent(adap->dev->udev, 128, GFP_ATOMIC,
|
2010-09-02 20:29:30 +00:00
|
|
|
&lme_int->lme_urb->transfer_dma);
|
|
|
|
|
|
|
|
if (lme_int->buffer == NULL)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
usb_fill_int_urb(lme_int->lme_urb,
|
|
|
|
adap->dev->udev,
|
|
|
|
usb_rcvintpipe(adap->dev->udev, 0xa),
|
|
|
|
lme_int->buffer,
|
2011-09-11 22:26:50 +00:00
|
|
|
128,
|
2010-09-02 20:29:30 +00:00
|
|
|
lme2510_int_response,
|
|
|
|
adap,
|
2011-09-11 22:26:50 +00:00
|
|
|
8);
|
2010-09-02 20:29:30 +00:00
|
|
|
|
|
|
|
lme_int->lme_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
|
|
|
|
|
|
|
|
usb_submit_urb(lme_int->lme_urb, GFP_ATOMIC);
|
2011-03-31 01:57:33 +00:00
|
|
|
info("INT Interrupt Service Started");
|
2010-09-02 20:29:30 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-04-02 21:59:29 +00:00
|
|
|
static int lme2510_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
|
|
|
|
{
|
2011-04-22 09:20:57 +00:00
|
|
|
struct lme2510_state *st = adap->dev->priv;
|
2011-04-02 21:59:29 +00:00
|
|
|
static u8 clear_pid_reg[] = LME_CLEAR_PID;
|
|
|
|
static u8 rbuf[1];
|
2011-04-22 09:20:57 +00:00
|
|
|
int ret;
|
2011-04-02 21:59:29 +00:00
|
|
|
|
|
|
|
deb_info(1, "PID Clearing Filter");
|
|
|
|
|
|
|
|
ret = mutex_lock_interruptible(&adap->dev->i2c_mutex);
|
2011-04-22 09:20:57 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return -EAGAIN;
|
2011-04-02 21:59:29 +00:00
|
|
|
|
|
|
|
if (!onoff)
|
|
|
|
ret |= lme2510_usb_talk(adap->dev, clear_pid_reg,
|
|
|
|
sizeof(clear_pid_reg), rbuf, sizeof(rbuf));
|
|
|
|
|
2011-04-22 09:20:57 +00:00
|
|
|
st->pid_size = 0;
|
|
|
|
|
2011-04-02 21:59:29 +00:00
|
|
|
mutex_unlock(&adap->dev->i2c_mutex);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int lme2510_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid,
|
|
|
|
int onoff)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
deb_info(3, "%s PID=%04x Index=%04x onoff=%02x", __func__,
|
|
|
|
pid, index, onoff);
|
|
|
|
|
|
|
|
if (onoff)
|
2011-04-22 09:20:57 +00:00
|
|
|
if (!pid_filter) {
|
|
|
|
ret = mutex_lock_interruptible(&adap->dev->i2c_mutex);
|
|
|
|
if (ret < 0)
|
|
|
|
return -EAGAIN;
|
|
|
|
ret |= lme2510_enable_pid(adap->dev, index, pid);
|
|
|
|
mutex_unlock(&adap->dev->i2c_mutex);
|
|
|
|
}
|
|
|
|
|
2011-04-02 21:59:29 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-02 20:29:30 +00:00
|
|
|
static int lme2510_return_status(struct usb_device *dev)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
2011-03-20 21:50:52 +00:00
|
|
|
u8 *data;
|
|
|
|
|
|
|
|
data = kzalloc(10, GFP_KERNEL);
|
|
|
|
if (!data)
|
|
|
|
return -ENOMEM;
|
2010-10-16 19:44:43 +00:00
|
|
|
|
2010-09-02 20:29:30 +00:00
|
|
|
ret |= usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
|
|
|
|
0x06, 0x80, 0x0302, 0x00, data, 0x0006, 200);
|
|
|
|
info("Firmware Status: %x (%x)", ret , data[2]);
|
|
|
|
|
2011-03-20 21:50:52 +00:00
|
|
|
ret = (ret < 0) ? -ENODEV : data[2];
|
|
|
|
kfree(data);
|
|
|
|
return ret;
|
2010-09-02 20:29:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int lme2510_msg(struct dvb_usb_device *d,
|
|
|
|
u8 *wbuf, int wlen, u8 *rbuf, int rlen)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
struct lme2510_state *st = d->priv;
|
|
|
|
|
2010-10-16 19:44:43 +00:00
|
|
|
if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
|
2010-09-02 20:29:30 +00:00
|
|
|
return -EAGAIN;
|
|
|
|
|
2010-10-16 19:44:43 +00:00
|
|
|
if (st->i2c_talk_onoff == 1) {
|
|
|
|
|
2010-09-02 20:29:30 +00:00
|
|
|
ret = lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen);
|
|
|
|
|
|
|
|
switch (st->tuner_config) {
|
2010-10-16 19:44:43 +00:00
|
|
|
case TUNER_LG:
|
|
|
|
if (wbuf[2] == 0x1c) {
|
|
|
|
if (wbuf[3] == 0x0e) {
|
|
|
|
st->signal_lock = rbuf[1];
|
|
|
|
if ((st->stream_on & 1) &&
|
|
|
|
(st->signal_lock & 0x10)) {
|
2010-10-27 22:50:36 +00:00
|
|
|
lme2510_stream_restart(d);
|
2010-10-16 19:44:43 +00:00
|
|
|
st->i2c_talk_onoff = 0;
|
|
|
|
}
|
2010-10-27 22:50:36 +00:00
|
|
|
msleep(80);
|
2010-10-16 19:44:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2010-09-02 20:29:30 +00:00
|
|
|
case TUNER_S7395:
|
2010-10-16 19:44:43 +00:00
|
|
|
if (wbuf[2] == 0xd0) {
|
|
|
|
if (wbuf[3] == 0x24) {
|
|
|
|
st->signal_lock = rbuf[1];
|
|
|
|
if ((st->stream_on & 1) &&
|
|
|
|
(st->signal_lock & 0x8)) {
|
2010-10-27 22:50:36 +00:00
|
|
|
lme2510_stream_restart(d);
|
2010-10-16 19:44:43 +00:00
|
|
|
st->i2c_talk_onoff = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((wbuf[3] != 0x6) & (wbuf[3] != 0x5))
|
|
|
|
msleep(5);
|
|
|
|
}
|
2010-09-02 20:29:30 +00:00
|
|
|
break;
|
2011-02-13 01:35:08 +00:00
|
|
|
case TUNER_S0194:
|
|
|
|
if (wbuf[2] == 0xd0) {
|
|
|
|
if (wbuf[3] == 0x1b) {
|
|
|
|
st->signal_lock = rbuf[1];
|
|
|
|
if ((st->stream_on & 1) &&
|
|
|
|
(st->signal_lock & 0x8)) {
|
|
|
|
lme2510_stream_restart(d);
|
|
|
|
st->i2c_talk_onoff = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2010-09-02 20:29:30 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (st->tuner_config) {
|
|
|
|
case TUNER_LG:
|
|
|
|
switch (wbuf[3]) {
|
|
|
|
case 0x0e:
|
|
|
|
rbuf[0] = 0x55;
|
|
|
|
rbuf[1] = st->signal_lock;
|
|
|
|
break;
|
|
|
|
case 0x43:
|
|
|
|
rbuf[0] = 0x55;
|
|
|
|
rbuf[1] = st->signal_level;
|
|
|
|
break;
|
|
|
|
case 0x1c:
|
|
|
|
rbuf[0] = 0x55;
|
|
|
|
rbuf[1] = st->signal_sn;
|
|
|
|
break;
|
2010-10-27 22:50:36 +00:00
|
|
|
case 0x15:
|
|
|
|
case 0x16:
|
|
|
|
case 0x17:
|
|
|
|
case 0x18:
|
|
|
|
rbuf[0] = 0x55;
|
|
|
|
rbuf[1] = 0x00;
|
|
|
|
break;
|
2010-09-02 20:29:30 +00:00
|
|
|
default:
|
2010-10-27 22:50:36 +00:00
|
|
|
lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen);
|
|
|
|
st->i2c_talk_onoff = 1;
|
2010-09-02 20:29:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TUNER_S7395:
|
|
|
|
switch (wbuf[3]) {
|
|
|
|
case 0x10:
|
|
|
|
rbuf[0] = 0x55;
|
|
|
|
rbuf[1] = (st->signal_level & 0x80)
|
|
|
|
? 0 : (st->signal_level * 2);
|
|
|
|
break;
|
|
|
|
case 0x2d:
|
|
|
|
rbuf[0] = 0x55;
|
|
|
|
rbuf[1] = st->signal_sn;
|
|
|
|
break;
|
|
|
|
case 0x24:
|
|
|
|
rbuf[0] = 0x55;
|
2010-10-27 22:50:36 +00:00
|
|
|
rbuf[1] = st->signal_lock;
|
2010-10-16 19:44:43 +00:00
|
|
|
break;
|
2010-10-27 22:50:36 +00:00
|
|
|
case 0x2e:
|
|
|
|
case 0x26:
|
|
|
|
case 0x27:
|
2010-10-16 19:44:43 +00:00
|
|
|
rbuf[0] = 0x55;
|
|
|
|
rbuf[1] = 0x00;
|
2010-09-02 20:29:30 +00:00
|
|
|
break;
|
2010-10-27 22:50:36 +00:00
|
|
|
default:
|
|
|
|
lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen);
|
|
|
|
st->i2c_talk_onoff = 1;
|
|
|
|
break;
|
2010-09-02 20:29:30 +00:00
|
|
|
}
|
|
|
|
break;
|
2011-02-13 01:35:08 +00:00
|
|
|
case TUNER_S0194:
|
|
|
|
switch (wbuf[3]) {
|
|
|
|
case 0x18:
|
|
|
|
rbuf[0] = 0x55;
|
|
|
|
rbuf[1] = (st->signal_level & 0x80)
|
|
|
|
? 0 : (st->signal_level * 2);
|
|
|
|
break;
|
|
|
|
case 0x24:
|
|
|
|
rbuf[0] = 0x55;
|
|
|
|
rbuf[1] = st->signal_sn;
|
|
|
|
break;
|
|
|
|
case 0x1b:
|
|
|
|
rbuf[0] = 0x55;
|
|
|
|
rbuf[1] = st->signal_lock;
|
|
|
|
break;
|
|
|
|
case 0x19:
|
|
|
|
case 0x25:
|
|
|
|
case 0x1e:
|
|
|
|
case 0x1d:
|
|
|
|
rbuf[0] = 0x55;
|
|
|
|
rbuf[1] = 0x00;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen);
|
|
|
|
st->i2c_talk_onoff = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2010-09-02 20:29:30 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-03-31 01:57:33 +00:00
|
|
|
deb_info(4, "I2C From Interrupt Message out(%02x) in(%02x)",
|
2010-09-02 20:29:30 +00:00
|
|
|
wbuf[3], rbuf[1]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-10-16 19:44:43 +00:00
|
|
|
mutex_unlock(&d->i2c_mutex);
|
|
|
|
|
2010-09-02 20:29:30 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int lme2510_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
|
|
|
|
int num)
|
|
|
|
{
|
|
|
|
struct dvb_usb_device *d = i2c_get_adapdata(adap);
|
|
|
|
struct lme2510_state *st = d->priv;
|
2011-09-11 22:30:10 +00:00
|
|
|
static u8 obuf[64], ibuf[64];
|
2010-09-02 20:29:30 +00:00
|
|
|
int i, read, read_o;
|
|
|
|
u16 len;
|
|
|
|
u8 gate = st->i2c_gate;
|
|
|
|
|
|
|
|
if (gate == 0)
|
|
|
|
gate = 5;
|
|
|
|
|
|
|
|
if (num > 2)
|
|
|
|
warn("more than 2 i2c messages"
|
|
|
|
"at a time is not handled yet. TODO.");
|
|
|
|
|
|
|
|
for (i = 0; i < num; i++) {
|
|
|
|
read_o = 1 & (msg[i].flags & I2C_M_RD);
|
|
|
|
read = i+1 < num && (msg[i+1].flags & I2C_M_RD);
|
|
|
|
read |= read_o;
|
|
|
|
gate = (msg[i].addr == st->i2c_tuner_addr)
|
|
|
|
? (read) ? st->i2c_tuner_gate_r
|
|
|
|
: st->i2c_tuner_gate_w
|
|
|
|
: st->i2c_gate;
|
|
|
|
obuf[0] = gate | (read << 7);
|
|
|
|
|
|
|
|
if (gate == 5)
|
|
|
|
obuf[1] = (read) ? 2 : msg[i].len + 1;
|
|
|
|
else
|
|
|
|
obuf[1] = msg[i].len + read + 1;
|
|
|
|
|
|
|
|
obuf[2] = msg[i].addr;
|
|
|
|
if (read) {
|
|
|
|
if (read_o)
|
|
|
|
len = 3;
|
|
|
|
else {
|
|
|
|
memcpy(&obuf[3], msg[i].buf, msg[i].len);
|
|
|
|
obuf[msg[i].len+3] = msg[i+1].len;
|
|
|
|
len = msg[i].len+4;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
memcpy(&obuf[3], msg[i].buf, msg[i].len);
|
|
|
|
len = msg[i].len+3;
|
|
|
|
}
|
|
|
|
|
2011-09-11 22:30:10 +00:00
|
|
|
if (lme2510_msg(d, obuf, len, ibuf, 64) < 0) {
|
2010-09-02 20:29:30 +00:00
|
|
|
deb_info(1, "i2c transfer failed.");
|
|
|
|
return -EAGAIN;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (read) {
|
|
|
|
if (read_o)
|
|
|
|
memcpy(msg[i].buf, &ibuf[1], msg[i].len);
|
|
|
|
else {
|
|
|
|
memcpy(msg[i+1].buf, &ibuf[1], msg[i+1].len);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
static u32 lme2510_i2c_func(struct i2c_adapter *adapter)
|
|
|
|
{
|
|
|
|
return I2C_FUNC_I2C;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct i2c_algorithm lme2510_i2c_algo = {
|
|
|
|
.master_xfer = lme2510_i2c_xfer,
|
|
|
|
.functionality = lme2510_i2c_func,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Callbacks for DVB USB */
|
|
|
|
static int lme2510_identify_state(struct usb_device *udev,
|
|
|
|
struct dvb_usb_device_properties *props,
|
|
|
|
struct dvb_usb_device_description **desc,
|
|
|
|
int *cold)
|
|
|
|
{
|
2011-02-13 01:35:08 +00:00
|
|
|
*cold = 0;
|
2010-09-02 20:29:30 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int lme2510_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
|
|
|
|
{
|
|
|
|
struct lme2510_state *st = adap->dev->priv;
|
2011-02-13 01:35:08 +00:00
|
|
|
static u8 clear_reg_3[] = LME_CLEAR_PID;
|
2010-09-02 20:29:30 +00:00
|
|
|
static u8 rbuf[1];
|
2010-10-27 22:50:36 +00:00
|
|
|
int ret = 0, rlen = sizeof(rbuf);
|
2010-09-02 20:29:30 +00:00
|
|
|
|
|
|
|
deb_info(1, "STM (%02x)", onoff);
|
|
|
|
|
2010-10-27 22:50:36 +00:00
|
|
|
/* Streaming is started by FE_HAS_LOCK */
|
|
|
|
if (onoff == 1)
|
2010-10-16 19:44:43 +00:00
|
|
|
st->stream_on = 1;
|
2010-10-27 22:50:36 +00:00
|
|
|
else {
|
2010-09-02 20:29:30 +00:00
|
|
|
deb_info(1, "STM Steam Off");
|
2010-10-27 22:50:36 +00:00
|
|
|
/* mutex is here only to avoid collision with I2C */
|
2011-04-15 20:40:17 +00:00
|
|
|
if (mutex_lock_interruptible(&adap->dev->i2c_mutex) < 0)
|
|
|
|
return -EAGAIN;
|
2010-10-27 22:50:36 +00:00
|
|
|
|
2011-04-15 20:40:17 +00:00
|
|
|
ret = lme2510_usb_talk(adap->dev, clear_reg_3,
|
2010-09-02 20:29:30 +00:00
|
|
|
sizeof(clear_reg_3), rbuf, rlen);
|
2010-10-16 19:44:43 +00:00
|
|
|
st->stream_on = 0;
|
2010-09-02 20:29:30 +00:00
|
|
|
st->i2c_talk_onoff = 1;
|
2010-10-27 22:50:36 +00:00
|
|
|
|
|
|
|
mutex_unlock(&adap->dev->i2c_mutex);
|
2010-09-02 20:29:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (ret < 0) ? -ENODEV : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static u8 check_sum(u8 *p, u8 len)
|
|
|
|
{
|
|
|
|
u8 sum = 0;
|
|
|
|
while (len--)
|
|
|
|
sum += *p++;
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int lme2510_download_firmware(struct usb_device *dev,
|
|
|
|
const struct firmware *fw)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
2011-03-20 21:50:52 +00:00
|
|
|
u8 *data;
|
2010-09-02 20:29:30 +00:00
|
|
|
u16 j, wlen, len_in, start, end;
|
|
|
|
u8 packet_size, dlen, i;
|
|
|
|
u8 *fw_data;
|
|
|
|
|
|
|
|
packet_size = 0x31;
|
|
|
|
len_in = 1;
|
|
|
|
|
2011-03-20 21:50:52 +00:00
|
|
|
data = kzalloc(512, GFP_KERNEL);
|
|
|
|
if (!data) {
|
|
|
|
info("FRM Could not start Firmware Download (Buffer allocation failed)");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2010-09-02 20:29:30 +00:00
|
|
|
|
|
|
|
info("FRM Starting Firmware Download");
|
|
|
|
|
|
|
|
for (i = 1; i < 3; i++) {
|
|
|
|
start = (i == 1) ? 0 : 512;
|
|
|
|
end = (i == 1) ? 512 : fw->size;
|
|
|
|
for (j = start; j < end; j += (packet_size+1)) {
|
|
|
|
fw_data = (u8 *)(fw->data + j);
|
|
|
|
if ((end - j) > packet_size) {
|
|
|
|
data[0] = i;
|
|
|
|
dlen = packet_size;
|
|
|
|
} else {
|
|
|
|
data[0] = i | 0x80;
|
|
|
|
dlen = (u8)(end - j)-1;
|
|
|
|
}
|
2011-03-20 21:50:51 +00:00
|
|
|
data[1] = dlen;
|
|
|
|
memcpy(&data[2], fw_data, dlen+1);
|
|
|
|
wlen = (u8) dlen + 4;
|
|
|
|
data[wlen-1] = check_sum(fw_data, dlen+1);
|
|
|
|
deb_info(1, "Data S=%02x:E=%02x CS= %02x", data[3],
|
2010-09-02 20:29:30 +00:00
|
|
|
data[dlen+2], data[dlen+3]);
|
2011-03-20 21:50:51 +00:00
|
|
|
ret |= lme2510_bulk_write(dev, data, wlen, 1);
|
|
|
|
ret |= lme2510_bulk_read(dev, data, len_in , 1);
|
|
|
|
ret |= (data[0] == 0x88) ? 0 : -1;
|
2010-09-02 20:29:30 +00:00
|
|
|
}
|
|
|
|
}
|
2010-10-27 22:50:36 +00:00
|
|
|
|
2010-09-02 20:29:30 +00:00
|
|
|
usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
|
|
|
|
0x06, 0x80, 0x0200, 0x00, data, 0x0109, 1000);
|
|
|
|
|
|
|
|
|
|
|
|
data[0] = 0x8a;
|
|
|
|
len_in = 1;
|
|
|
|
msleep(2000);
|
|
|
|
ret |= lme2510_bulk_write(dev, data , len_in, 1); /*Resetting*/
|
|
|
|
ret |= lme2510_bulk_read(dev, data, len_in, 1);
|
|
|
|
msleep(400);
|
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
info("FRM Firmware Download Failed (%04x)" , ret);
|
|
|
|
else
|
|
|
|
info("FRM Firmware Download Completed - Resetting Device");
|
|
|
|
|
2011-03-20 21:50:52 +00:00
|
|
|
kfree(data);
|
2010-09-02 20:29:30 +00:00
|
|
|
return (ret < 0) ? -ENODEV : 0;
|
|
|
|
}
|
|
|
|
|
2010-10-16 19:44:43 +00:00
|
|
|
static void lme_coldreset(struct usb_device *dev)
|
|
|
|
{
|
|
|
|
int ret = 0, len_in;
|
|
|
|
u8 data[512] = {0};
|
|
|
|
|
|
|
|
data[0] = 0x0a;
|
|
|
|
len_in = 1;
|
|
|
|
info("FRM Firmware Cold Reset");
|
|
|
|
ret |= lme2510_bulk_write(dev, data , len_in, 1); /*Cold Resetting*/
|
|
|
|
ret |= lme2510_bulk_read(dev, data, len_in, 1);
|
2010-10-27 22:50:36 +00:00
|
|
|
|
2010-10-16 19:44:43 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
static int lme_firmware_switch(struct usb_device *udev, int cold)
|
2010-10-16 19:44:43 +00:00
|
|
|
{
|
|
|
|
const struct firmware *fw = NULL;
|
2011-02-13 01:35:08 +00:00
|
|
|
const char fw_c_s7395[] = "dvb-usb-lme2510c-s7395.fw";
|
|
|
|
const char fw_c_lg[] = "dvb-usb-lme2510c-lg.fw";
|
|
|
|
const char fw_c_s0194[] = "dvb-usb-lme2510c-s0194.fw";
|
|
|
|
const char fw_lg[] = "dvb-usb-lme2510-lg.fw";
|
|
|
|
const char fw_s0194[] = "dvb-usb-lme2510-s0194.fw";
|
|
|
|
const char *fw_lme;
|
|
|
|
int ret, cold_fw;
|
2010-10-16 19:44:43 +00:00
|
|
|
|
2010-10-27 22:50:36 +00:00
|
|
|
cold = (cold > 0) ? (cold & 1) : 0;
|
|
|
|
|
2011-02-13 01:35:08 +00:00
|
|
|
cold_fw = !cold;
|
2010-10-16 19:44:43 +00:00
|
|
|
|
2011-05-25 21:28:29 +00:00
|
|
|
if (le16_to_cpu(udev->descriptor.idProduct) == 0x1122) {
|
2011-02-13 01:35:08 +00:00
|
|
|
switch (dvb_usb_lme2510_firmware) {
|
|
|
|
default:
|
|
|
|
dvb_usb_lme2510_firmware = TUNER_S0194;
|
|
|
|
case TUNER_S0194:
|
|
|
|
fw_lme = fw_s0194;
|
|
|
|
ret = request_firmware(&fw, fw_lme, &udev->dev);
|
|
|
|
if (ret == 0) {
|
2011-02-13 23:12:15 +00:00
|
|
|
cold = 0;
|
2011-02-13 01:35:08 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
dvb_usb_lme2510_firmware = TUNER_LG;
|
|
|
|
case TUNER_LG:
|
|
|
|
fw_lme = fw_lg;
|
|
|
|
ret = request_firmware(&fw, fw_lme, &udev->dev);
|
|
|
|
if (ret == 0)
|
|
|
|
break;
|
|
|
|
info("FRM No Firmware Found - please install");
|
|
|
|
dvb_usb_lme2510_firmware = TUNER_DEFAULT;
|
|
|
|
cold = 0;
|
|
|
|
cold_fw = 0;
|
2010-10-16 19:44:43 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-02-13 01:35:08 +00:00
|
|
|
} else {
|
|
|
|
switch (dvb_usb_lme2510_firmware) {
|
|
|
|
default:
|
|
|
|
dvb_usb_lme2510_firmware = TUNER_S7395;
|
|
|
|
case TUNER_S7395:
|
|
|
|
fw_lme = fw_c_s7395;
|
|
|
|
ret = request_firmware(&fw, fw_lme, &udev->dev);
|
2011-02-13 23:12:15 +00:00
|
|
|
if (ret == 0) {
|
|
|
|
cold = 0;
|
2011-02-13 01:35:08 +00:00
|
|
|
break;
|
2011-02-13 23:12:15 +00:00
|
|
|
}
|
2011-02-13 01:35:08 +00:00
|
|
|
dvb_usb_lme2510_firmware = TUNER_LG;
|
|
|
|
case TUNER_LG:
|
|
|
|
fw_lme = fw_c_lg;
|
|
|
|
ret = request_firmware(&fw, fw_lme, &udev->dev);
|
|
|
|
if (ret == 0)
|
|
|
|
break;
|
|
|
|
dvb_usb_lme2510_firmware = TUNER_S0194;
|
|
|
|
case TUNER_S0194:
|
|
|
|
fw_lme = fw_c_s0194;
|
|
|
|
ret = request_firmware(&fw, fw_lme, &udev->dev);
|
|
|
|
if (ret == 0)
|
|
|
|
break;
|
|
|
|
info("FRM No Firmware Found - please install");
|
|
|
|
dvb_usb_lme2510_firmware = TUNER_DEFAULT;
|
2010-10-16 19:44:43 +00:00
|
|
|
cold = 0;
|
2011-02-13 01:35:08 +00:00
|
|
|
cold_fw = 0;
|
2010-10-16 19:44:43 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-10-27 22:50:36 +00:00
|
|
|
|
2011-02-13 01:35:08 +00:00
|
|
|
if (cold_fw) {
|
|
|
|
info("FRM Loading %s file", fw_lme);
|
|
|
|
ret = lme2510_download_firmware(udev, fw);
|
|
|
|
}
|
2010-10-27 22:50:36 +00:00
|
|
|
|
2011-02-13 23:12:15 +00:00
|
|
|
release_firmware(fw);
|
|
|
|
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
if (cold) {
|
2011-02-13 01:35:08 +00:00
|
|
|
info("FRM Changing to %s firmware", fw_lme);
|
2010-10-16 19:44:43 +00:00
|
|
|
lme_coldreset(udev);
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
return -ENODEV;
|
|
|
|
}
|
2010-10-27 22:50:36 +00:00
|
|
|
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
return ret;
|
2010-10-16 19:44:43 +00:00
|
|
|
}
|
2010-09-02 20:29:30 +00:00
|
|
|
|
|
|
|
static int lme2510_kill_urb(struct usb_data_stream *stream)
|
|
|
|
{
|
|
|
|
int i;
|
2010-10-27 22:50:36 +00:00
|
|
|
|
2010-09-02 20:29:30 +00:00
|
|
|
for (i = 0; i < stream->urbs_submitted; i++) {
|
|
|
|
deb_info(3, "killing URB no. %d.", i);
|
|
|
|
/* stop the URB */
|
|
|
|
usb_kill_urb(stream->urb_list[i]);
|
|
|
|
}
|
|
|
|
stream->urbs_submitted = 0;
|
2010-10-27 22:50:36 +00:00
|
|
|
|
2010-09-02 20:29:30 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct tda10086_config tda10086_config = {
|
|
|
|
.demod_address = 0x1c,
|
|
|
|
.invert = 0,
|
|
|
|
.diseqc_tone = 1,
|
|
|
|
.xtal_freq = TDA10086_XTAL_16M,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct stv0288_config lme_config = {
|
|
|
|
.demod_address = 0xd0,
|
|
|
|
.min_delay_ms = 15,
|
|
|
|
.inittab = s7395_inittab,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct ix2505v_config lme_tuner = {
|
|
|
|
.tuner_address = 0xc0,
|
|
|
|
.min_delay_ms = 100,
|
|
|
|
.tuner_gain = 0x0,
|
|
|
|
.tuner_chargepump = 0x3,
|
|
|
|
};
|
|
|
|
|
2011-02-13 01:35:08 +00:00
|
|
|
static struct stv0299_config sharp_z0194_config = {
|
|
|
|
.demod_address = 0xd0,
|
|
|
|
.inittab = sharp_z0194a_inittab,
|
|
|
|
.mclk = 88000000UL,
|
|
|
|
.invert = 0,
|
|
|
|
.skip_reinit = 0,
|
|
|
|
.lock_output = STV0299_LOCKOUTPUT_1,
|
|
|
|
.volt13_op0_op1 = STV0299_VOLT13_OP1,
|
|
|
|
.min_delay_ms = 100,
|
|
|
|
.set_symbol_rate = sharp_z0194a_set_symbol_rate,
|
|
|
|
};
|
|
|
|
|
2010-09-02 20:29:30 +00:00
|
|
|
static int dm04_lme2510_set_voltage(struct dvb_frontend *fe,
|
|
|
|
fe_sec_voltage_t voltage)
|
|
|
|
{
|
|
|
|
struct dvb_usb_adapter *adap = fe->dvb->priv;
|
|
|
|
static u8 voltage_low[] = LME_VOLTAGE_L;
|
|
|
|
static u8 voltage_high[] = LME_VOLTAGE_H;
|
|
|
|
static u8 rbuf[1];
|
|
|
|
int ret = 0, len = 3, rlen = 1;
|
|
|
|
|
2010-10-27 22:50:36 +00:00
|
|
|
if (mutex_lock_interruptible(&adap->dev->i2c_mutex) < 0)
|
|
|
|
return -EAGAIN;
|
2010-09-02 20:29:30 +00:00
|
|
|
|
2010-10-16 19:44:43 +00:00
|
|
|
switch (voltage) {
|
|
|
|
case SEC_VOLTAGE_18:
|
|
|
|
ret |= lme2510_usb_talk(adap->dev,
|
|
|
|
voltage_high, len, rbuf, rlen);
|
2010-09-02 20:29:30 +00:00
|
|
|
break;
|
|
|
|
|
2010-10-16 19:44:43 +00:00
|
|
|
case SEC_VOLTAGE_OFF:
|
|
|
|
case SEC_VOLTAGE_13:
|
|
|
|
default:
|
|
|
|
ret |= lme2510_usb_talk(adap->dev,
|
2010-09-02 20:29:30 +00:00
|
|
|
voltage_low, len, rbuf, rlen);
|
|
|
|
break;
|
2010-10-27 22:50:36 +00:00
|
|
|
}
|
2010-09-02 20:29:30 +00:00
|
|
|
|
2010-10-27 22:50:36 +00:00
|
|
|
mutex_unlock(&adap->dev->i2c_mutex);
|
2010-09-02 20:29:30 +00:00
|
|
|
|
|
|
|
return (ret < 0) ? -ENODEV : 0;
|
|
|
|
}
|
|
|
|
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
static int lme_name(struct dvb_usb_adapter *adap)
|
|
|
|
{
|
|
|
|
struct lme2510_state *st = adap->dev->priv;
|
|
|
|
const char *desc = adap->dev->desc->name;
|
2011-02-13 01:35:08 +00:00
|
|
|
char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395",
|
|
|
|
" SHARP:BS2F7HZ0194"};
|
2011-09-06 12:31:57 +00:00
|
|
|
char *name = adap->fe_adap[0].fe->ops.info.name;
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
|
|
|
|
strlcpy(name, desc, 128);
|
|
|
|
strlcat(name, fe_name[st->tuner_config], 128);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-09-02 20:29:30 +00:00
|
|
|
static int dm04_lme2510_frontend_attach(struct dvb_usb_adapter *adap)
|
|
|
|
{
|
|
|
|
struct lme2510_state *st = adap->dev->priv;
|
|
|
|
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
int ret = 0;
|
2010-09-02 20:29:30 +00:00
|
|
|
|
|
|
|
st->i2c_talk_onoff = 1;
|
|
|
|
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
st->i2c_gate = 4;
|
2011-09-06 12:31:57 +00:00
|
|
|
adap->fe_adap[0].fe = dvb_attach(tda10086_attach, &tda10086_config,
|
2010-09-02 20:29:30 +00:00
|
|
|
&adap->dev->i2c_adap);
|
|
|
|
|
2011-09-06 12:31:57 +00:00
|
|
|
if (adap->fe_adap[0].fe) {
|
2010-09-02 20:29:30 +00:00
|
|
|
info("TUN Found Frontend TDA10086");
|
|
|
|
st->i2c_tuner_gate_w = 4;
|
|
|
|
st->i2c_tuner_gate_r = 4;
|
|
|
|
st->i2c_tuner_addr = 0xc0;
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
st->tuner_config = TUNER_LG;
|
2011-02-13 01:35:08 +00:00
|
|
|
if (dvb_usb_lme2510_firmware != TUNER_LG) {
|
|
|
|
dvb_usb_lme2510_firmware = TUNER_LG;
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
ret = lme_firmware_switch(adap->dev->udev, 1);
|
2011-02-13 01:35:08 +00:00
|
|
|
}
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
|
|
|
st->i2c_gate = 4;
|
2011-09-06 12:31:57 +00:00
|
|
|
adap->fe_adap[0].fe = dvb_attach(stv0299_attach, &sharp_z0194_config,
|
2011-02-13 01:35:08 +00:00
|
|
|
&adap->dev->i2c_adap);
|
2011-09-06 12:31:57 +00:00
|
|
|
if (adap->fe_adap[0].fe) {
|
2011-02-13 01:35:08 +00:00
|
|
|
info("FE Found Stv0299");
|
|
|
|
st->i2c_tuner_gate_w = 4;
|
|
|
|
st->i2c_tuner_gate_r = 5;
|
|
|
|
st->i2c_tuner_addr = 0xc0;
|
|
|
|
st->tuner_config = TUNER_S0194;
|
|
|
|
if (dvb_usb_lme2510_firmware != TUNER_S0194) {
|
|
|
|
dvb_usb_lme2510_firmware = TUNER_S0194;
|
|
|
|
ret = lme_firmware_switch(adap->dev->udev, 1);
|
|
|
|
}
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
goto end;
|
2010-09-02 20:29:30 +00:00
|
|
|
}
|
2010-10-27 22:50:36 +00:00
|
|
|
|
2010-09-02 20:29:30 +00:00
|
|
|
st->i2c_gate = 5;
|
2011-09-06 12:31:57 +00:00
|
|
|
adap->fe_adap[0].fe = dvb_attach(stv0288_attach, &lme_config,
|
2010-09-02 20:29:30 +00:00
|
|
|
&adap->dev->i2c_adap);
|
2011-09-06 12:31:57 +00:00
|
|
|
if (adap->fe_adap[0].fe) {
|
2010-09-02 20:29:30 +00:00
|
|
|
info("FE Found Stv0288");
|
|
|
|
st->i2c_tuner_gate_w = 4;
|
|
|
|
st->i2c_tuner_gate_r = 5;
|
|
|
|
st->i2c_tuner_addr = 0xc0;
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
st->tuner_config = TUNER_S7395;
|
2011-02-13 01:35:08 +00:00
|
|
|
if (dvb_usb_lme2510_firmware != TUNER_S7395) {
|
|
|
|
dvb_usb_lme2510_firmware = TUNER_S7395;
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
ret = lme_firmware_switch(adap->dev->udev, 1);
|
2010-09-02 20:29:30 +00:00
|
|
|
}
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
} else {
|
|
|
|
info("DM04 Not Supported");
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
2011-02-13 01:35:08 +00:00
|
|
|
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
end: if (ret) {
|
2011-09-06 12:31:57 +00:00
|
|
|
if (adap->fe_adap[0].fe) {
|
|
|
|
dvb_frontend_detach(adap->fe_adap[0].fe);
|
|
|
|
adap->fe_adap[0].fe = NULL;
|
2011-05-25 21:28:29 +00:00
|
|
|
}
|
|
|
|
adap->dev->props.rc.core.rc_codes = NULL;
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
return -ENODEV;
|
2010-09-02 20:29:30 +00:00
|
|
|
}
|
|
|
|
|
2011-09-06 12:31:57 +00:00
|
|
|
adap->fe_adap[0].fe->ops.set_voltage = dm04_lme2510_set_voltage;
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
ret = lme_name(adap);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int dm04_lme2510_tuner(struct dvb_usb_adapter *adap)
|
|
|
|
{
|
|
|
|
struct lme2510_state *st = adap->dev->priv;
|
2011-02-13 01:35:08 +00:00
|
|
|
char *tun_msg[] = {"", "TDA8263", "IX2505V", "DVB_PLL_OPERA"};
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
switch (st->tuner_config) {
|
|
|
|
case TUNER_LG:
|
2011-09-06 12:31:57 +00:00
|
|
|
if (dvb_attach(tda826x_attach, adap->fe_adap[0].fe, 0xc0,
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
&adap->dev->i2c_adap, 1))
|
|
|
|
ret = st->tuner_config;
|
|
|
|
break;
|
|
|
|
case TUNER_S7395:
|
2011-09-06 12:31:57 +00:00
|
|
|
if (dvb_attach(ix2505v_attach , adap->fe_adap[0].fe, &lme_tuner,
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
&adap->dev->i2c_adap))
|
|
|
|
ret = st->tuner_config;
|
|
|
|
break;
|
2011-02-13 01:35:08 +00:00
|
|
|
case TUNER_S0194:
|
2011-09-06 12:31:57 +00:00
|
|
|
if (dvb_attach(dvb_pll_attach , adap->fe_adap[0].fe, 0xc0,
|
2011-02-13 01:35:08 +00:00
|
|
|
&adap->dev->i2c_adap, DVB_PLL_OPERA1))
|
|
|
|
ret = st->tuner_config;
|
|
|
|
break;
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
info("TUN Found %s tuner", tun_msg[ret]);
|
|
|
|
else {
|
|
|
|
info("TUN No tuner found --- reseting device");
|
|
|
|
lme_coldreset(adap->dev->udev);
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
2011-05-25 21:28:29 +00:00
|
|
|
/* Start the Interrupt*/
|
|
|
|
ret = lme2510_int_read(adap);
|
|
|
|
if (ret < 0) {
|
|
|
|
info("INT Unable to start Interrupt Service");
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
|
|
|
|
return ret;
|
2010-09-02 20:29:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int lme2510_powerup(struct dvb_usb_device *d, int onoff)
|
|
|
|
{
|
|
|
|
struct lme2510_state *st = d->priv;
|
2010-10-27 22:50:36 +00:00
|
|
|
static u8 lnb_on[] = LNB_ON;
|
|
|
|
static u8 lnb_off[] = LNB_OFF;
|
|
|
|
static u8 rbuf[1];
|
|
|
|
int ret, len = 3, rlen = 1;
|
|
|
|
|
2011-04-15 20:40:17 +00:00
|
|
|
if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
|
|
|
|
return -EAGAIN;
|
2010-10-27 22:50:36 +00:00
|
|
|
|
|
|
|
if (onoff)
|
2011-04-15 20:40:17 +00:00
|
|
|
ret = lme2510_usb_talk(d, lnb_on, len, rbuf, rlen);
|
2010-10-27 22:50:36 +00:00
|
|
|
else
|
2011-04-15 20:40:17 +00:00
|
|
|
ret = lme2510_usb_talk(d, lnb_off, len, rbuf, rlen);
|
2010-10-27 22:50:36 +00:00
|
|
|
|
2010-09-02 20:29:30 +00:00
|
|
|
st->i2c_talk_onoff = 1;
|
2010-10-27 22:50:36 +00:00
|
|
|
|
|
|
|
mutex_unlock(&d->i2c_mutex);
|
|
|
|
|
|
|
|
return ret;
|
2010-09-02 20:29:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* DVB USB Driver stuff */
|
|
|
|
static struct dvb_usb_device_properties lme2510_properties;
|
|
|
|
static struct dvb_usb_device_properties lme2510c_properties;
|
|
|
|
|
|
|
|
static int lme2510_probe(struct usb_interface *intf,
|
|
|
|
const struct usb_device_id *id)
|
|
|
|
{
|
|
|
|
struct usb_device *udev = interface_to_usbdev(intf);
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
usb_reset_configuration(udev);
|
|
|
|
|
|
|
|
usb_set_interface(udev, intf->cur_altsetting->desc.bInterfaceNumber, 1);
|
|
|
|
|
|
|
|
if (udev->speed != USB_SPEED_HIGH) {
|
|
|
|
ret = usb_reset_device(udev);
|
|
|
|
info("DEV Failed to connect in HIGH SPEED mode");
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
2011-02-13 01:35:08 +00:00
|
|
|
if (lme2510_return_status(udev) == 0x44) {
|
|
|
|
lme_firmware_switch(udev, 0);
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
2010-10-16 19:44:43 +00:00
|
|
|
|
2010-09-02 20:29:30 +00:00
|
|
|
if (0 == dvb_usb_device_init(intf, &lme2510_properties,
|
|
|
|
THIS_MODULE, NULL, adapter_nr)) {
|
|
|
|
info("DEV registering device driver");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (0 == dvb_usb_device_init(intf, &lme2510c_properties,
|
|
|
|
THIS_MODULE, NULL, adapter_nr)) {
|
|
|
|
info("DEV registering device driver");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
info("DEV lme2510 Error");
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct usb_device_id lme2510_table[] = {
|
|
|
|
{ USB_DEVICE(0x3344, 0x1122) }, /* LME2510 */
|
|
|
|
{ USB_DEVICE(0x3344, 0x1120) }, /* LME2510C */
|
|
|
|
{} /* Terminating entry */
|
|
|
|
};
|
|
|
|
|
|
|
|
MODULE_DEVICE_TABLE(usb, lme2510_table);
|
|
|
|
|
|
|
|
static struct dvb_usb_device_properties lme2510_properties = {
|
|
|
|
.caps = DVB_USB_IS_AN_I2C_ADAPTER,
|
|
|
|
.size_of_priv = sizeof(struct lme2510_state),
|
|
|
|
.num_adapters = 1,
|
|
|
|
.adapter = {
|
|
|
|
{
|
2011-09-06 12:31:57 +00:00
|
|
|
.num_frontends = 1,
|
|
|
|
.fe = {{
|
2011-04-02 21:59:29 +00:00
|
|
|
.caps = DVB_USB_ADAP_HAS_PID_FILTER|
|
|
|
|
DVB_USB_ADAP_NEED_PID_FILTERING|
|
|
|
|
DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
|
2010-09-02 20:29:30 +00:00
|
|
|
.streaming_ctrl = lme2510_streaming_ctrl,
|
2011-04-02 21:59:29 +00:00
|
|
|
.pid_filter_count = 15,
|
|
|
|
.pid_filter = lme2510_pid_filter,
|
|
|
|
.pid_filter_ctrl = lme2510_pid_filter_ctrl,
|
2010-09-02 20:29:30 +00:00
|
|
|
.frontend_attach = dm04_lme2510_frontend_attach,
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
.tuner_attach = dm04_lme2510_tuner,
|
2010-09-02 20:29:30 +00:00
|
|
|
/* parameter for the MPEG2-data transfer */
|
|
|
|
.stream = {
|
|
|
|
.type = USB_BULK,
|
|
|
|
.count = 10,
|
|
|
|
.endpoint = 0x06,
|
|
|
|
.u = {
|
|
|
|
.bulk = {
|
|
|
|
.buffersize = 4096,
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-09-06 12:31:57 +00:00
|
|
|
}},
|
2010-09-02 20:29:30 +00:00
|
|
|
}
|
|
|
|
},
|
2011-05-25 21:28:29 +00:00
|
|
|
.rc.core = {
|
|
|
|
.protocol = RC_TYPE_NEC,
|
|
|
|
.module_name = "LME2510 Remote Control",
|
|
|
|
.allowed_protos = RC_TYPE_NEC,
|
|
|
|
.rc_codes = RC_MAP_LME2510,
|
|
|
|
},
|
2010-09-02 20:29:30 +00:00
|
|
|
.power_ctrl = lme2510_powerup,
|
|
|
|
.identify_state = lme2510_identify_state,
|
|
|
|
.i2c_algo = &lme2510_i2c_algo,
|
|
|
|
.generic_bulk_ctrl_endpoint = 0,
|
|
|
|
.num_device_descs = 1,
|
|
|
|
.devices = {
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
{ "DM04_LME2510_DVB-S",
|
2010-09-02 20:29:30 +00:00
|
|
|
{ &lme2510_table[0], NULL },
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct dvb_usb_device_properties lme2510c_properties = {
|
|
|
|
.caps = DVB_USB_IS_AN_I2C_ADAPTER,
|
|
|
|
.size_of_priv = sizeof(struct lme2510_state),
|
|
|
|
.num_adapters = 1,
|
|
|
|
.adapter = {
|
|
|
|
{
|
2011-09-06 12:31:57 +00:00
|
|
|
.num_frontends = 1,
|
|
|
|
.fe = {{
|
2011-04-02 21:59:29 +00:00
|
|
|
.caps = DVB_USB_ADAP_HAS_PID_FILTER|
|
|
|
|
DVB_USB_ADAP_NEED_PID_FILTERING|
|
|
|
|
DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
|
2010-09-02 20:29:30 +00:00
|
|
|
.streaming_ctrl = lme2510_streaming_ctrl,
|
2011-04-02 21:59:29 +00:00
|
|
|
.pid_filter_count = 15,
|
|
|
|
.pid_filter = lme2510_pid_filter,
|
|
|
|
.pid_filter_ctrl = lme2510_pid_filter_ctrl,
|
2010-09-02 20:29:30 +00:00
|
|
|
.frontend_attach = dm04_lme2510_frontend_attach,
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
.tuner_attach = dm04_lme2510_tuner,
|
2010-09-02 20:29:30 +00:00
|
|
|
/* parameter for the MPEG2-data transfer */
|
|
|
|
.stream = {
|
|
|
|
.type = USB_BULK,
|
2010-10-16 19:44:43 +00:00
|
|
|
.count = 10,
|
2010-09-02 20:29:30 +00:00
|
|
|
.endpoint = 0x8,
|
|
|
|
.u = {
|
|
|
|
.bulk = {
|
|
|
|
.buffersize = 4096,
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-09-06 12:31:57 +00:00
|
|
|
}},
|
2010-09-02 20:29:30 +00:00
|
|
|
}
|
|
|
|
},
|
2011-05-25 21:28:29 +00:00
|
|
|
.rc.core = {
|
|
|
|
.protocol = RC_TYPE_NEC,
|
|
|
|
.module_name = "LME2510 Remote Control",
|
|
|
|
.allowed_protos = RC_TYPE_NEC,
|
|
|
|
.rc_codes = RC_MAP_LME2510,
|
|
|
|
},
|
2010-09-02 20:29:30 +00:00
|
|
|
.power_ctrl = lme2510_powerup,
|
|
|
|
.identify_state = lme2510_identify_state,
|
|
|
|
.i2c_algo = &lme2510_i2c_algo,
|
|
|
|
.generic_bulk_ctrl_endpoint = 0,
|
|
|
|
.num_device_descs = 1,
|
|
|
|
.devices = {
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
{ "DM04_LME2510C_DVB-S",
|
2010-09-02 20:29:30 +00:00
|
|
|
{ &lme2510_table[1], NULL },
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-04-22 09:07:40 +00:00
|
|
|
static void *lme2510_exit_int(struct dvb_usb_device *d)
|
2010-09-02 20:29:30 +00:00
|
|
|
{
|
|
|
|
struct lme2510_state *st = d->priv;
|
2010-10-16 19:44:43 +00:00
|
|
|
struct dvb_usb_adapter *adap = &d->adapter[0];
|
|
|
|
void *buffer = NULL;
|
|
|
|
|
|
|
|
if (adap != NULL) {
|
2011-09-06 12:31:57 +00:00
|
|
|
lme2510_kill_urb(&adap->fe_adap[0].stream);
|
2010-10-16 19:44:43 +00:00
|
|
|
adap->feedcount = 0;
|
|
|
|
}
|
|
|
|
|
2011-05-25 21:28:29 +00:00
|
|
|
if (st->usb_buffer != NULL) {
|
2010-10-16 19:44:43 +00:00
|
|
|
st->i2c_talk_onoff = 1;
|
2010-09-02 20:29:30 +00:00
|
|
|
st->signal_lock = 0;
|
|
|
|
st->signal_level = 0;
|
|
|
|
st->signal_sn = 0;
|
2010-10-16 19:44:43 +00:00
|
|
|
buffer = st->usb_buffer;
|
2011-05-25 21:28:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (st->lme_urb != NULL) {
|
2010-09-02 20:29:30 +00:00
|
|
|
usb_kill_urb(st->lme_urb);
|
2011-09-11 22:26:50 +00:00
|
|
|
usb_free_coherent(d->udev, 128, st->buffer,
|
2010-09-02 20:29:30 +00:00
|
|
|
st->lme_urb->transfer_dma);
|
2011-03-31 01:57:33 +00:00
|
|
|
info("Interrupt Service Stopped");
|
2010-09-02 20:29:30 +00:00
|
|
|
}
|
2011-05-25 21:28:29 +00:00
|
|
|
|
2010-10-16 19:44:43 +00:00
|
|
|
return buffer;
|
2010-09-02 20:29:30 +00:00
|
|
|
}
|
|
|
|
|
2011-04-22 09:07:40 +00:00
|
|
|
static void lme2510_exit(struct usb_interface *intf)
|
2010-09-02 20:29:30 +00:00
|
|
|
{
|
|
|
|
struct dvb_usb_device *d = usb_get_intfdata(intf);
|
2010-10-16 19:44:43 +00:00
|
|
|
void *usb_buffer;
|
|
|
|
|
2010-09-02 20:29:30 +00:00
|
|
|
if (d != NULL) {
|
2010-10-16 19:44:43 +00:00
|
|
|
usb_buffer = lme2510_exit_int(d);
|
2010-09-02 20:29:30 +00:00
|
|
|
dvb_usb_device_exit(intf);
|
2011-05-25 21:28:29 +00:00
|
|
|
if (usb_buffer != NULL)
|
|
|
|
kfree(usb_buffer);
|
2010-09-02 20:29:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct usb_driver lme2510_driver = {
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
.name = "LME2510C_DVB-S",
|
2010-09-02 20:29:30 +00:00
|
|
|
.probe = lme2510_probe,
|
|
|
|
.disconnect = lme2510_exit,
|
|
|
|
.id_table = lme2510_table,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* module stuff */
|
|
|
|
static int __init lme2510_module_init(void)
|
|
|
|
{
|
|
|
|
int result = usb_register(&lme2510_driver);
|
|
|
|
if (result) {
|
|
|
|
err("usb_register failed. Error number %d", result);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit lme2510_module_exit(void)
|
|
|
|
{
|
|
|
|
/* deregister this driver from the USB subsystem */
|
|
|
|
usb_deregister(&lme2510_driver);
|
|
|
|
}
|
|
|
|
|
|
|
|
module_init(lme2510_module_init);
|
|
|
|
module_exit(lme2510_module_exit);
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>");
|
[media] DM04/QQBOX Frontend attach change
On Fri, 2010-12-03 at 09:32 -0200, Mauro Carvalho Chehab wrote:
> Em 27-11-2010 11:13, Malcolm Priestley escreveu:
> > Driver Version v1.73 - Frontend attach change.
> > To stop double rc registration in multi tuner environment or firmware change.
> >
> > Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
> >
> >
> > +static int lme_name(struct dvb_usb_adapter *adap)
> > +{
> > + struct lme2510_state *st = adap->dev->priv;
> > + const char *desc = adap->dev->desc->name;
> > + char *fe_name[] = {"", " LG TDQY-P001F", " SHARP:BS2F7HZ7395"};
> > + char *name = adap->fe->ops.info.name;
> > +
> > + strcpy(name, desc);
> > + strcat(name, fe_name[st->tuner_config]);
>
> Please use, instead, strlcpy/strlcat, to avoid writing outside the buffer size.
>
Driver Version v1.74
Amended patch with change to strlcpy/strlcat.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-07 22:49:24 +00:00
|
|
|
MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0");
|
2011-09-11 22:30:10 +00:00
|
|
|
MODULE_VERSION("1.90");
|
2010-09-02 20:29:30 +00:00
|
|
|
MODULE_LICENSE("GPL");
|