[PATCH] [UPDATE_for_2.6.37] DM04/QQBOX USB DVB-S BOXES to version 1.70

2010-10-27 Thread tvbox
Updated driver for DM04/QQBOX USB DVB-S BOXES to version 1.70

Improved frontend handling.

Frontend now remains open at all times, with signal lock, snr  signal level
polled from Interupt.


Signed-off-by: Malcolm Priestley tvbox...@gmail.com

diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c 
b/drivers/media/dvb/dvb-usb/lmedm04.c
index d939fbb..3a32c65 100644
--- a/drivers/media/dvb/dvb-usb/lmedm04.c
+++ b/drivers/media/dvb/dvb-usb/lmedm04.c
@@ -112,7 +112,6 @@ struct lme2510_state {
u8 i2c_tuner_gate_r;
u8 i2c_tuner_addr;
u8 stream_on;
-   u8 one_tune;
void *buffer;
struct urb *lme_urb;
void *usb_buffer;
@@ -182,15 +181,13 @@ static int lme2510_usb_talk(struct dvb_usb_device *d,
return (ret  0) ? -ENODEV : 0;
 }
 
-static int lme2510_usb_talk_restart(struct dvb_usb_device *d,
-   u8 *wbuf, int wlen, u8 *rbuf, int rlen) {
+static int lme2510_stream_restart(struct dvb_usb_device *d)
+{
static u8 stream_on[] = LME_ST_ON_W;
int ret;
u8 rbuff[10];
-   /*Send Normal Command*/
-   ret = lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen);
/*Restart Stream Command*/
-   ret |= lme2510_usb_talk(d, stream_on, sizeof(stream_on),
+   ret = lme2510_usb_talk(d, stream_on, sizeof(stream_on),
rbuff, sizeof(rbuff));
return ret;
 }
@@ -254,11 +251,16 @@ static void lme2510_int_response(struct urb *lme_urb)
case TUNER_S7395:
/* Tweak for earlier firmware*/
if (ibuf[1] == 0x03) {
+   if (ibuf[2]  1)
+   st-signal_lock = ibuf[2];
st-signal_level = ibuf[3];
st-signal_sn = ibuf[4];
} else {
st-signal_level = ibuf[4];
st-signal_sn = ibuf[5];
+   st-signal_lock =
+   (st-signal_lock  0xf7) +
+   ((ibuf[2]  0x01)  0x03);
}
break;
default:
@@ -341,11 +343,10 @@ static int lme2510_msg(struct dvb_usb_device *d,
st-signal_lock = rbuf[1];
if ((st-stream_on  1) 
(st-signal_lock  0x10)) {
-   lme2510_usb_talk_restart(d,
-   wbuf, wlen, rbuf, rlen);
+   lme2510_stream_restart(d);
st-i2c_talk_onoff = 0;
}
-   msleep(80);
+   msleep(80);
}
}
break;
@@ -355,15 +356,12 @@ static int lme2510_msg(struct dvb_usb_device *d,
st-signal_lock = rbuf[1];
if ((st-stream_on  1) 
(st-signal_lock  0x8)) {
-   lme2510_usb_talk_restart(d,
-   wbuf, wlen, rbuf, rlen);
+   lme2510_stream_restart(d);
st-i2c_talk_onoff = 0;
}
}
if ((wbuf[3] != 0x6)  (wbuf[3] != 0x5))
msleep(5);
-
-
}
break;
default:
@@ -385,18 +383,16 @@ static int lme2510_msg(struct dvb_usb_device *d,
rbuf[0] = 0x55;
rbuf[1] = st-signal_sn;
break;
-   /*DiSEqC functions as per TDA10086*/
-   case 0x36:
-   case 0x48:
-   case 0x49:
-   case 0x4a:
-   case 0x4b:
-   case 0x4c:
-   case 0x4d:
-   if (wbuf[2] == 0x1c)
-   lme2510_usb_talk_restart(d,
-   wbuf, wlen, rbuf, rlen);
+   case 0x15:
+   case 0x16:
+   case 0x17:
+   case 0x18:
+   rbuf[0] = 0x55;
+   rbuf[1] = 0x00

Re: [PATCH][UPDATE for 2.6.37] LME2510(C) DM04/QQBOX USB DVB-S BOXES

2010-10-23 Thread tvbox
On Fri, 2010-10-22 at 22:24 -0200, Mauro Carvalho Chehab wrote:
 Em 16-10-2010 16:44, tvbox escreveu:
  Updated driver for DM04/QQBOX USB DVB-S BOXES to version 1.60
  
  These include
  -later kill of usb_buffer to avoid kernel crash on hot unplugging.
  -DiSEqC functions.
  -LNB Power switch
  -Faster channel change.
  -support for LG tuner on LME2510C.
  -firmware switching for LG tuner.
 
 Please, don't do updates like that, adding several different things into just
 one patch. Instead, send one patch per change.
 
The patches as released is a working driver.

This device is particularly temperamental and covers several
adaptations. The driver returned to beta testing through several of
those changes.

I didn't want release patches that would have produced an unworkable
driver for the user.

Regards

Malcolm

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH][UPDATE for 2.6.37] LME2510(C) DM04/QQBOX USB DVB-S BOXES

2010-10-16 Thread tvbox
Updated driver for DM04/QQBOX USB DVB-S BOXES to version 1.60

These include
-later kill of usb_buffer to avoid kernel crash on hot unplugging.
-DiSEqC functions.
-LNB Power switch
-Faster channel change.
-support for LG tuner on LME2510C.
-firmware switching for LG tuner.

Signed-off-by: Malcolm Priestley tvbox...@gmail.com



diff --git a/Documentation/dvb/lmedm04.txt b/Documentation/dvb/lmedm04.txt
index 4bde457..e175784 100644
--- a/Documentation/dvb/lmedm04.txt
+++ b/Documentation/dvb/lmedm04.txt
@@ -45,10 +45,13 @@ and run
 
 Other LG firmware can be extracted manually from US280D.sys
 only found in windows/system32/driver.
-However, this firmware does not run very well under Windows
-or with the Linux driver.
 
-dd if=US280D.sys ibs=1 skip=36856 count=3976 of=dvb-usb-lme2510-lg.fw
+dd if=US280D.sys ibs=1 skip=42616 count=3668 of=dvb-usb-lme2510-lg.fw
+
+for DM04 LME2510C (LG Tuner)
+---
+
+dd if=US280D.sys ibs=1 skip=35200 count=3850 of=dvb-usb-lme2510c-lg.fw
 
 -
 
diff --git a/drivers/media/dvb/dvb-usb/Kconfig 
b/drivers/media/dvb/dvb-usb/Kconfig
index ce60c1e..2525d3b 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -356,6 +356,5 @@ config DVB_USB_LME2510
select DVB_TDA826X if !DVB_FE_CUSTOMISE
select DVB_STV0288 if !DVB_FE_CUSTOMISE
select DVB_IX2505V if !DVB_FE_CUSTOMISE
-   depends on IR_CORE
help
  Say Y here to support the LME DM04/QQBOX DVB-S USB2.0 .
diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c 
b/drivers/media/dvb/dvb-usb/lmedm04.c
index d5374ac..d939fbb 100644
--- a/drivers/media/dvb/dvb-usb/lmedm04.c
+++ b/drivers/media/dvb/dvb-usb/lmedm04.c
@@ -1,14 +1,17 @@
 /* DVB USB compliant linux driver for
  *
  * DM04/QQBOX DVB-S USB BOXLME2510C + SHARP:BS2F7HZ7395
- * LME2510 + LGTDQT-P001F
+ * LME2510C + LG TDQY-P001F
+ * LME2510 + LG TDQY-P001F
  *
  * MVB7395 (LME2510C+SHARP:BS2F7HZ7395)
  * SHARP:BS2F7HZ7395 = (STV0288+Sharp IX2505V)
  *
- * MV001F (LME2510 +LGTDQY-P001F)
+ * MV001F (LME2510+LGTDQY-P001F)
  * LG TDQY - P001F =(TDA8263 + TDA10086H)
  *
+ * MVB0001F (LME2510C+LGTDQT-P001F)
+ *
  * For firmware see Documentation/dvb/lmedm04.txt
  *
  * I2C addresses:
@@ -21,7 +24,6 @@
  * ***Please Note***
  * There are other variants of the DM04
  * ***NOT SUPPORTED***
- * MVB0001F (LME2510C+LGTDQT-P001F)
  * MV0194 (LME2510+SHARP0194)
  * MVB0194 (LME2510C+SHARP0194)
  *
@@ -51,10 +53,7 @@
  * LME2510: Non Intel USB chipsets fail to maintain High Speed on
  * Boot or Hot Plug.
  *
- * DiSEqC functions are not fully supported in this driver. The main
- * reason is the frontend is cut off during streaming. Allowing frontend
- * access will stall the driver. Applications that attempt to this, the
- * commands are ignored.
+ * QQbox suffers from noise on LNB voltage.
  *
  * PID functions have been removed from this driver version due to
  * problems with different firmware and application versions.
@@ -91,9 +90,14 @@ 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);
 
+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);
+
+
 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
-#define TUNER_LG 0x1
-#define TUNER_S7395 0x2
+#define TUNER_LG   0x1
+#define TUNER_S73950x2
 
 struct lme2510_state {
u8 id;
@@ -107,6 +111,8 @@ struct lme2510_state {
u8 i2c_tuner_gate_w;
u8 i2c_tuner_gate_r;
u8 i2c_tuner_addr;
+   u8 stream_on;
+   u8 one_tune;
void *buffer;
struct urb *lme_urb;
void *usb_buffer;
@@ -117,6 +123,7 @@ static int lme2510_bulk_write(struct usb_device *dev,
u8 *snd, int len, u8 pipe)
 {
int ret, actual_l;
+
ret = usb_bulk_msg(dev, usb_sndbulkpipe(dev, pipe),
snd, len , actual_l, 500);
return ret;
@@ -151,22 +158,21 @@ static int lme2510_usb_talk(struct dvb_usb_device *d,
/* the read/write capped at 512 */
memcpy(buff, wbuf, (wlen  512) ? 512 : wlen);
 
-
ret = mutex_lock_interruptible(d-usb_mutex);
 
if (ret  0)
return -EAGAIN;
 
ret |= usb_clear_halt(d-udev, usb_sndbulkpipe(d-udev, 0x01));
-   msleep(5);
-   ret |= lme2510_bulk_write(d-udev, buff, wlen , 0x1);
 
-   msleep(5);
-   ret |= usb_clear_halt(d-udev, usb_rcvbulkpipe(d-udev, 0x1));
+   ret |= lme2510_bulk_write(d-udev, buff, wlen , 0x01);
+
+   msleep(12);
+
+   ret |= usb_clear_halt(d-udev, usb_rcvbulkpipe(d-udev, 0x01

Re: [PATCH] Support or LME2510(C) DM04/QQBOX USB DVB-S BOXES.

2010-10-14 Thread tvbox
On Thu, 2010-10-14 at 13:17 -0300, Mauro Carvalho Chehab wrote:
 Em 13-10-2010 16:10, Antti Palosaari escreveu:
  On 09/02/2010 11:29 PM, tvbox wrote:
  DM04/QQBOX DVB-S USB BOX with LME2510C+SHARP:BS2F7HZ7395 or 
  LME2510+LGTDQT-P001F tuner.
  
  +config DVB_USB_LME2510
  +tristate LME DM04/QQBOX DVB-S USB2.0 support
  +depends on DVB_USB
  +select DVB_TDA10086 if !DVB_FE_CUSTOMISE
  +select DVB_TDA826X if !DVB_FE_CUSTOMISE
  +select DVB_STV0288 if !DVB_FE_CUSTOMISE
  +select DVB_IX2505V if !DVB_FE_CUSTOMISE
  +select IR_CORE
  +help
  +  Say Y here to support the LME DM04/QQBOX DVB-S USB2.0 .
  
  Just for curious, is IR_CORE and DVB_USB both needed? DVB_USB also depends 
  on IR_CORE ? This was only DVB-USB driver which does that.
 
 The IR_CORE dependency is already there, so, DVB_USB_LME2510 shouldn't need 
 do use dependency
 related to IR.
I have an update patch pending final test for this driver. I will remove
it in the patch.

Malcolm


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH]UPDATE for LME2510(C) DM04/QQBOX USB DVB-S BOXES.

2010-10-06 Thread tvbox
Updated driver for DM04/QQBOX USB DVB-S BOXES to version 1.50

These include
-later kill of usb_buffer to avoid kernel crash on hot unplugging.
-DiSEqC functions.
-LNB Power switch
-Faster channel change.

Signed-off-by: Malcolm Priestley tvbox...@gmail.com

http://mercurial.intuxication.org/hg/tvboxspy/summary

---

diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c 
b/drivers/media/dvb/dvb-usb/lmedm04.c
index 794b16d..3569e34 100644
--- a/drivers/media/dvb/dvb-usb/lmedm04.c
+++ b/drivers/media/dvb/dvb-usb/lmedm04.c
@@ -51,10 +51,7 @@
  * LME2510: Non Intel USB chipsets fail to maintain High Speed on
  * Boot or Hot Plug.
  *
- * DiSEqC functions are not fully supported in this driver. The main
- * reason is the frontend is cut off during streaming. Allowing frontend
- * access will stall the driver. Applications that attempt to this, the
- * commands are ignored.
+ * QQbox suffers from noise on LNB voltage.
  *
  * PID functions mave been removed from this driver version due to
  * problems with different firmware and application versions.
@@ -154,15 +151,15 @@ static int lme2510_usb_talk(struct dvb_usb_device *d,
return -EAGAIN;
 
ret |= usb_clear_halt(d-udev, usb_sndbulkpipe(d-udev, 0x01));
-   msleep(5);
-   ret |= lme2510_bulk_write(d-udev, buff, wlen , 0x1);
 
-   msleep(5);
-   ret |= usb_clear_halt(d-udev, usb_rcvbulkpipe(d-udev, 0x1));
+   ret |= lme2510_bulk_write(d-udev, buff, wlen , 0x01);
+
+   msleep(12);
+
+   ret |= usb_clear_halt(d-udev, usb_rcvbulkpipe(d-udev, 0x01));
 
-   msleep(5);
ret |= lme2510_bulk_read(d-udev, buff, (rlen  512) ?
-   512 : rlen , 0x1);
+   512 : rlen , 0x01);
 
if (rlen  0)
memcpy(rbuf, buff, rlen);
@@ -172,6 +169,19 @@ static int lme2510_usb_talk(struct dvb_usb_device *d,
return (ret  0) ? -ENODEV : 0;
 }
 
+static int lme2510_usb_talk_restart(struct dvb_usb_device *d,
+   u8 *wbuf, int wlen, u8 *rbuf, int rlen) {
+   static u8 stream_on[] = LME_ST_ON_W;
+   int ret;
+   u8 rbuff[1];
+   /*Send Normal Command*/
+   ret = lme2510_usb_talk(d, wbuf, wlen, rbuf, rlen);
+   /*Restart Stream Command*/
+   ret |= lme2510_usb_talk(d, stream_on, sizeof(stream_on),
+   rbuff, sizeof(rbuff));
+   return ret;
+}
+
 static int lme2510_remote_keypress(struct dvb_usb_adapter *adap, u16 keypress)
 {
struct dvb_usb_device *d = adap-dev;
@@ -233,7 +243,7 @@ static void lme2510_int_response(struct urb *lme_urb)
/* Tweak for earlier firmware*/
if (ibuf[1] == 0x03) {
st-signal_level = ibuf[3];
-   st-signal_sn = ibuf[2];
+   st-signal_sn = ibuf[4];
} else {
st-signal_level = ibuf[4];
st-signal_sn = ibuf[5];
@@ -318,6 +328,7 @@ static int lme2510_msg(struct dvb_usb_device *d,
case TUNER_S7395:
if (wbuf[3] == 0x24)
st-signal_lock = rbuf[1];
+   msleep(5);
break;
default:
break;
@@ -358,6 +369,18 @@ static int lme2510_msg(struct dvb_usb_device *d,
rbuf[0] = 0x55;
rbuf[1] = (st-signal_level  0x80)
? 0 : st-signal_lock;
+   break;
+   /*DiSEqC functions as per STV0288*/
+   case 0x5:
+   case 0x6:
+   case 0x7:
+   case 0x8:
+   case 0x9:
+   case 0xa:
+   case 0xb:
+   if (wbuf[2] == 0xd0)
+   lme2510_usb_talk_restart(d,
+   wbuf, wlen, rbuf, rlen);
default:
break;
}
@@ -472,7 +495,6 @@ static int lme2510_identify_state(struct usb_device *udev,
 static int lme2510_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
 {
struct lme2510_state *st = adap-dev-priv;
-   static u8 reset[] =  LME_RESET;
static u8 stream_on[] = LME_ST_ON_W;
static u8 clear_reg_3[] =  LME_CLEAR_PID;
static u8 rbuf[1];
@@ -481,19 +503,14 @@ static int lme2510_streaming_ctrl(struct dvb_usb_adapter 
*adap, int onoff)
 
if (onoff == 1) {
st-i2c_talk_onoff = 0;
-   msleep(400); /* give enough time for i2c to stop */
+   msleep(40); /* give enough time for i2c to stop */
ret

Re: [PATCH] DiSEqC bug fixed for stv0288 based interfaces

2010-09-26 Thread tvbox
Hi Josef

This patch does work and has been tested in my driver.

However, your patch was still corrupt, here is a cleaned up version.

I have had to shorten some quotes in some lines to within 80 characters

Tested-by: Malcolm Priestley tvbox...@gmail.com

It is also in my own hg tree at
http://mercurial.intuxication.org/hg/tvboxspy/rev/666fe763c5f6


diff --git a/drivers/media/dvb/frontends/stv0288.c 
b/drivers/media/dvb/frontends/stv0288.c
index 2930a5d..6cd442e 100644
--- a/drivers/media/dvb/frontends/stv0288.c
+++ b/drivers/media/dvb/frontends/stv0288.c
@@ -6,6 +6,8 @@
Copyright (C) 2008 Igor M. Liplianin liplia...@me.by
Removed stb6000 specific tuner code and revised some
procedures.
+   2010-09-01 Josef Pavlik jo...@pavlik.it
+   Fixed diseqc_msg, diseqc_burst and set_tone problems

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
@@ -156,14 +158,13 @@ static int stv0288_send_diseqc_msg(struct dvb_frontend 
*fe,
 
stv0288_writeregI(state, 0x09, 0);
msleep(30);
-   stv0288_writeregI(state, 0x05, 0x16);
+   stv0288_writeregI(state, 0x05, 0x12);/* modulated mode, single shot */

for (i = 0; i  m-msg_len; i++) {
if (stv0288_writeregI(state, 0x06, m-msg[i]))
return -EREMOTEIO;
-   msleep(12);
}
-
+   msleep(m-msg_len*12);
return 0;
 }

@@ -174,13 +175,14 @@ static int stv0288_send_diseqc_burst(struct dvb_frontend 
*fe,

dprintk(%s\n, __func__);
 
-   if (stv0288_writeregI(state, 0x05, 0x16))/* burst mode */
-   return -EREMOTEIO;
-
-   if (stv0288_writeregI(state, 0x06, burst == SEC_MINI_A ? 0x00 : 0xff))
+   if (stv0288_writeregI(state, 0x05, 0x03))/* burst mode, single shot */
+   return -EREMOTEIO;
+
+   if (stv0288_writeregI(state, 0x06, burst == SEC_MINI_A ? 0x00 : 0xff))
return -EREMOTEIO;

-   if (stv0288_writeregI(state, 0x06, 0x12))
+   msleep(15);
+   if (stv0288_writeregI(state, 0x05, 0x12))
return -EREMOTEIO;
 
return 0;
@@ -192,18 +194,19 @@ static int stv0288_set_tone(struct dvb_frontend *fe, 
fe_sec_tone_mode_t tone)

switch (tone) {
case SEC_TONE_ON:
-   if (stv0288_writeregI(state, 0x05, 0x10))/* burst mode */
+   if (stv0288_writeregI(state, 0x05, 0x10))/* cont carrier */
return -EREMOTEIO;
-   return stv0288_writeregI(state, 0x06, 0xff);
+   break;
 
case SEC_TONE_OFF:
-   if (stv0288_writeregI(state, 0x05, 0x13))/* burst mode */
+   if (stv0288_writeregI(state, 0x05, 0x12))/* burst mode off*/
return -EREMOTEIO;
-   return stv0288_writeregI(state, 0x06, 0x00);
+   break;
 
default:
return -EINVAL;
}
+   return 0;
 }
 
 static u8 stv0288_inittab[] = {


 sorry, but something eats the leading spaces (but no the tabs) in the inlined 
 patch making it unusable, so please use the attached one.
 
 
 -
 on  Sep 12, 2010, at 13:30, I wrote:
 seems that the patch was corrupted by the kmail used for the post (missing 
 space before the last close bracket resulting corrupted patch)
 the corrected patch follows (and I'm sending it with another mail program)
 
 Signed-off-by: Josef Pavlik jo...@pavlik.it
 
 -
 diff --git a/drivers/media/dvb/frontends/stv0288.c 
 b/drivers/media/dvb/frontends/stv0288.c
 index 2930a5d..6cd442e 100644
 --- a/drivers/media/dvb/frontends/stv0288.c
 +++ b/drivers/media/dvb/frontends/stv0288.c
 @@ -6,6 +6,8 @@
 Copyright (C) 2008 Igor M. Liplianin liplia...@me.by
 Removed stb6000 specific tuner code and revised some
 procedures.
 +2010-09-01 Josef Pavlik jo...@pavlik.it
 +Fixed diseqc_msg, diseqc_burst and set_tone problems
 
 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
 @@ -156,14 +158,13 @@ static int stv0288_send_diseqc_msg(struct dvb_frontend 
 *fe,
 
 stv0288_writeregI(state, 0x09, 0);
 msleep(30);
 -   stv0288_writeregI(state, 0x05, 0x16);
 +   stv0288_writeregI(state, 0x05, 0x12); /* modulated mode, single shot 
 */
 
 for (i = 0; i  m-msg_len; i++) {
 if (stv0288_writeregI(state, 0x06, m-msg[i]))
 return -EREMOTEIO;
 -   msleep(12);
 }
 -
 +msleep(m-msg_len*12); 
 return 0;
 }
 
 @@ -174,13 +175,14 @@ static int stv0288_send_diseqc_burst(struct 
 dvb_frontend 
 *fe,
 
 dprintk(%s\n, __func__);
 
 -   if (stv0288_writeregI(state, 0x05, 0x16))/* burst mode */
 -   return

[PATCH] Support or LME2510(C) DM04/QQBOX USB DVB-S BOXES.

2010-09-02 Thread tvbox
DM04/QQBOX DVB-S USB BOX with LME2510C+SHARP:BS2F7HZ7395 or 
LME2510+LGTDQT-P001F tuner.

patch also requires patches.

140351 Support for Sharp IX2505V (marked B0017) DVB-S silicon tuner

140361 STV0288 Incorrect bit sample for Vitterbi status.

These patches should be applied to v4l-dvb-a4c762698bcb.

Patch 116279 also needs to be applied.

Signed-off-by: Malcolm Priestley tvbox...@gmail.com


diff --git a/Documentation/dvb/get_dvb_firmware 
b/Documentation/dvb/get_dvb_firmware
index 239cbdb..f9f8b50 100755
--- a/Documentation/dvb/get_dvb_firmware
+++ b/Documentation/dvb/get_dvb_firmware
@@ -26,7 +26,8 @@ use IO::Handle;
dec3000s, vp7041, dibusb, nxt2002, nxt2004,
or51211, or51132_qam, or51132_vsb, bluebird,
opera1, cx231xx, cx18, cx23885, pvrusb2, mpc718,
-   af9015, ngene);
+   af9015, ngene, lme2510_lg, lme2510c_s7395,
+   lme2510c_s7395_old);
 
 # Check args
 syntax() if (scalar(@ARGV) != 1);
@@ -567,6 +568,48 @@ sub ngene {
 $file1, $file2;
 }
 
+sub lme2510_lg {
+my $sourcefile = LMEBDA_DVBS.sys;
+my $hash = fc6017ad01e79890a97ec53bea157ed2;
+my $outfile = dvb-usb-lme2510-lg.fw;
+my $hasho = caa065d5fdbd2c09ad57b399bbf55cad;
+
+checkstandard();
+
+verify($sourcefile, $hash);
+extract($sourcefile, 4168, 3841, $outfile);
+verify($outfile, $hasho);
+$outfile;
+}
+
+sub lme2510c_s7395 {
+my $sourcefile = US2A0D.sys;
+my $hash = b0155a8083fb822a3bd47bc360e74601;
+my $outfile = dvb-usb-lme2510c-s7395.fw;
+my $hasho = 3a3cf1aeebd17b6ddc04cebe131e94cf;
+
+checkstandard();
+
+verify($sourcefile, $hash);
+extract($sourcefile, 37248, 3720, $outfile);
+verify($outfile, $hasho);
+$outfile;
+}
+
+sub lme2510c_s7395_old {
+my $sourcefile = LMEBDA_DVBS7395C.sys;
+my $hash = 7572ae0eb9cdf91baabd7c0ba9e09b31;
+my $outfile = dvb-usb-lme2510c-s7395.fw;
+my $hasho = 90430c5b435eb5c6f88fd44a9d950674;
+
+checkstandard();
+
+verify($sourcefile, $hash);
+extract($sourcefile, 4208, 3881, $outfile);
+verify($outfile, $hasho);
+$outfile;
+}
+
 # ---
 # Utilities
 
diff --git a/Documentation/dvb/lmedm04.txt b/Documentation/dvb/lmedm04.txt
new file mode 100644
index 000..4bde457
--- /dev/null
+++ b/Documentation/dvb/lmedm04.txt
@@ -0,0 +1,55 @@
+To extract firmware for the DM04/QQBOX you need to copy the
+following file(s) to this directory.
+
+for DM04+/QQBOX LME2510C (Sharp 7395 Tuner)
+---
+
+The Sharp 7395 driver can be found in windows/system32/driver
+
+US2A0D.sys (dated 17 Mar 2009)
+
+
+and run
+./get_dvb_firmware lme2510c_s7395
+
+   will produce
+   dvb-usb-lme2510c-s7395.fw
+
+An alternative but older firmware can be found on the driver
+disk DVB-S_EN_3.5A in BDADriver/driver
+
+LMEBDA_DVBS7395C.sys (dated 18 Jan 2008)
+
+and run
+./get_dvb_firmware lme2510c_s7395_old
+
+   will produce
+   dvb-usb-lme2510c-s7395.fw
+
+
+
+The LG firmware can be found on the driver
+disk DM04+_5.1A[LG] in BDADriver/driver
+
+for DM04 LME2510 (LG Tuner)
+---
+
+LMEBDA_DVBS.sys (dated 13 Nov 2007)
+
+and run
+./get_dvb_firmware lme2510_lg
+
+   will produce
+   dvb-usb-lme2510-lg.fw
+
+
+Other LG firmware can be extracted manually from US280D.sys
+only found in windows/system32/driver.
+However, this firmware does not run very well under Windows
+or with the Linux driver.
+
+dd if=US280D.sys ibs=1 skip=36856 count=3976 of=dvb-usb-lme2510-lg.fw
+
+-
+
+Copy the firmware file(s) to /lib/firmware
diff --git a/drivers/media/IR/keymaps/Makefile 
b/drivers/media/IR/keymaps/Makefile
index 86d3d1f..14f20de 100644
--- a/drivers/media/IR/keymaps/Makefile
+++ b/drivers/media/IR/keymaps/Makefile
@@ -38,6 +38,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-kworld-315u.o \
rc-kworld-plus-tv-analog.o \
rc-lirc.o \
+   rc-lme2510.o \
rc-manli.o \
rc-msi-tvanywhere.o \
rc-msi-tvanywhere-plus.o \
diff --git a/drivers/media/IR/keymaps/rc-lme2510.c 
b/drivers/media/IR/keymaps/rc-lme2510.c
new file mode 100644
index 000..40dcf0b
--- /dev/null
+++ b/drivers/media/IR/keymaps/rc-lme2510.c
@@ -0,0 +1,68 @@
+/* LME2510 remote control
+ *
+ *
+ * Copyright (C) 2010 Malcolm Priestley (tvbox...@gmail.com)
+ *
+ * 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 Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include media/rc-map.h
+
+
+static struct

[PATCH]STV0288 Incorrect bit sample for Vitterbi status.

2010-08-28 Thread tvbox
bit 3(LK) indicates that the Vstatus is locked.
Currently using bit 7(CF) which is usually present, results in early
aborted search in FEC_AUTO and missing channels.

Signed-off-by: Malcolm Priestley tvbox...@gmail.com



diff --git a/linux/drivers/media/dvb/frontends/stv0288.c 
b/linux/drivers/media/dvb/frontends/stv0288.c
index 2930a5d..bc9b47e 100644
--- a/linux/drivers/media/dvb/frontends/stv0288.c
+++ b/linux/drivers/media/dvb/frontends/stv0288.c
@@ -486,7 +486,7 @@ static int stv0288_set_frontend(struct dvb_frontend *fe,
tda[2] = 0x0; /* CFRL */
for (tm = -6; tm  7;) {
/* Viterbi status */
-   if (stv0288_readreg(state, 0x24)  0x80)
+   if (stv0288_readreg(state, 0x24)  0x8)
break;
 
tda[2] += 40;

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Support for Sharp IX2505V (marked B0017) DVB-S silicon tuner

2010-08-28 Thread tvbox
Tuner used in Sharp BS2F7VZ7395 dvbs module.
When ix2505v tuner is attached to stv0288 form this module.


Signed-off-by: Malcolm Priestley tvbox...@gmail.com



diff --git a/drivers/media/dvb/frontends/Kconfig 
b/drivers/media/dvb/frontends/Kconfig
index cd7f9b7..3a7b8d5 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -606,6 +606,13 @@ config DVB_TDA665x
  Currently supported tuners:
  * Panasonic ENV57H12D5 (ET-50DT)
 
+config DVB_IX2505V
+   tristate Sharp IX2505V silicon tuner
+   depends on DVB_CORE  I2C
+   default m if DVB_FE_CUSTOMISE
+   help
+ A DVB-S tuner module. Say Y when you want to support this frontend.
+
 comment Tools to develop new frontends
 
 config DVB_DUMMY_FE
diff --git a/drivers/media/dvb/frontends/Makefile 
b/drivers/media/dvb/frontends/Makefile
index 874e8ad..9b59e41 100644
--- a/drivers/media/dvb/frontends/Makefile
+++ b/drivers/media/dvb/frontends/Makefile
@@ -82,3 +82,4 @@ obj-$(CONFIG_DVB_ISL6423) += isl6423.o
 obj-$(CONFIG_DVB_EC100) += ec100.o
 obj-$(CONFIG_DVB_DS3000) += ds3000.o
 obj-$(CONFIG_DVB_MB86A16) += mb86a16.o
+obj-$(CONFIG_DVB_IX2505V) += ix2505v.o
diff --git a/drivers/media/dvb/frontends/ix2505v.c 
b/drivers/media/dvb/frontends/ix2505v.c
new file mode 100644
index 000..770cf2a
--- /dev/null
+++ b/drivers/media/dvb/frontends/ix2505v.c
@@ -0,0 +1,326 @@
+/**
+ * Driver for Sharp IX2505V (marked B0017) DVB-S silicon tuner
+ *
+ * Copyright (C) 2010 Malcolm Priestley
+ *
+ * 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.
+ *
+ */
+
+#include linux/module.h
+#include linux/dvb/frontend.h
+#include linux/slab.h
+#include linux/types.h
+
+#include compat.h
+
+#include ix2505v.h
+
+static int ix2505v_debug;
+#define dprintk(level, args...) \
+   do { if (ix2505v_debug  level) printk(KERN_DEBUG ix2505v:  args); \
+   } while (0)
+
+#define deb_info(args...)  dprintk(0x01, args)
+#define deb_i2c(args...)  dprintk(0x02, args)
+
+struct ix2505v_state {
+   struct i2c_adapter *i2c;
+   const struct ix2505v_config *config;
+   u32 frequency;
+};
+
+/**
+ *  Data read format of the Sharp IX2505V B0017
+ *
+ *  byte1:   1   |   1   |   0   |   0   |   0   |  MA1  |  MA0  |  1
+ *  byte2:  POR  |   FL  |  RD2  |  RD1  |  RD0  |   X   |   X   |  X
+ *
+ *  byte1 = address
+ *  byte2;
+ * POR = Power on Reset (VCC H=2.2v L=2.2v)
+ * FL  = Phase Lock (H=lock L=unlock)
+ * RD0-2 = Reserved internal operations
+ *
+ * Only POR can be used to check the tuner is present
+ *
+ * Caution: after byte2 the I2C reverts to write mode continuing to read
+ *  may corrupt tuning data.
+ *
+ */
+
+static int ix2505v_read_status_reg(struct ix2505v_state *state)
+{
+   u8 addr = state-config-tuner_address;
+   u8 b2[] = {0};
+   int ret;
+
+   struct i2c_msg msg[1] = {
+   { .addr = addr, .flags = I2C_M_RD, .buf = b2, .len = 1 }
+   };
+
+   ret = i2c_transfer(state-i2c, msg, 1);
+   deb_i2c(Read %s , __func__);
+
+   return (ret = 1) ? (int) b2[0] : -1;
+}
+
+static int ix2505v_write(struct ix2505v_state *state, u8 buf[], u8 count)
+{
+   struct i2c_msg msg[1] = {
+   { .addr = state-config-tuner_address, .flags = 0,
+ .buf = buf, .len = count },
+   };
+
+   int ret;
+
+   ret = i2c_transfer(state-i2c, msg, 1);
+
+   if (ret != 1) {
+   deb_i2c(%s: i2c error, ret=%d\n, __func__, ret);
+   return -EIO;
+   }
+
+   return 0;
+}
+
+static int ix2505v_release(struct dvb_frontend *fe)
+{
+   struct ix2505v_state *state = fe-tuner_priv;
+
+   fe-tuner_priv = NULL;
+   kfree(state);
+
+   return 0;
+}
+
+/**
+ *  Data write format of the Sharp IX2505V B0017
+ *
+ *  byte1:   1   |   1   |   0   |   0   |   0   | 0(MA1)| 0(MA0)|  0
+ *  byte2:   0   |  BG1  |  BG2  |   N8  |   N7  |   N6  |  N5   |  N4
+ *  byte3:   N3  |   N2  |   N1  |   A5  |   A4  |   A3  |   A2  |  A1
+ *  byte4:   1   | 1(C1) | 1(C0) |  PD5  |  PD4  |   TM  | 0(RTS)| 1(REF)
+ *  byte5:   BA2 |   BA1 |  BA0  |  PSC  |  PD3  |PD2/TS2|DIV/TS1|PD0/TS0
+ *
+ *  byte1 = address
+ *
+ *  Write order
+ *  1) byte1 - byte2 - byte3 - byte4 - byte5
+ *  2) byte1 - byte4 - byte5 - byte2 - byte3
+ *  3) byte1 - byte2 - byte3 - byte4
+ *  4) byte1 - byte4 - byte5 - byte2
+ *  5) byte1 - byte2

[PATCH]STV0288 Incorrect bit sample for Vitterbi status.

2010-08-28 Thread tvbox
bit 3(LK) indicates that the Vstatus is locked.
Currently using bit 7(CF) which is usually present, results in early
aborted search in FEC_AUTO and missing channels.

Signed-off-by: Malcolm Priestley tvbox...@gmail.com



diff --git a/drivers/media/dvb/frontends/stv0288.c 
b/drivers/media/dvb/frontends/stv0288.c
index 2930a5d..bc9b47e 100644
--- a/drivers/media/dvb/frontends/stv0288.c
+++ b/drivers/media/dvb/frontends/stv0288.c
@@ -486,7 +486,7 @@ static int stv0288_set_frontend(struct dvb_frontend *fe,
tda[2] = 0x0; /* CFRL */
for (tm = -6; tm  7;) {
/* Viterbi status */
-   if (stv0288_readreg(state, 0x24)  0x80)
+   if (stv0288_readreg(state, 0x24)  0x8)
break;
 
tda[2] += 40;

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH]STV0288 Incorrect bit sample for Vitterbi status.

2010-08-23 Thread tvbox
bit 3(LK) indicates that the Vstatus is locked.
Currently using bit 7(CF) which is usually present, results in early
aborted search in FEC_AUTO and missing channels.

Signed-off-by: Malcolm Priestley tvbox...@gmail.com

diff --git a/drivers/media/dvb/frontends/stv0288.c
b/drivers/media/dvb/frontends
index 2930a5d..bc9b47e 100644
--- a/drivers/media/dvb/frontends/stv0288.c
+++ b/drivers/media/dvb/frontends/stv0288.c
@@ -486,7 +486,7 @@ static int stv0288_set_frontend(struct dvb_frontend
*fe,
tda[2] = 0x0; /* CFRL */
for (tm = -6; tm  7;) {
/* Viterbi status */
-   if (stv0288_readreg(state, 0x24)  0x80)
+   if (stv0288_readreg(state, 0x24)  0x8)
break;
 
tda[2] += 40;


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html