* [DVB patch 0/8] DVB update
@ 2005-07-02 1:55 Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 1/8] usb: A800 rc and timeout fixes Johannes Stezenbach
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Johannes Stezenbach @ 2005-07-02 1:55 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
Hi Andrew,
Here are a few more DVB bug fixes, plus a new
frontend driver. Apparently the video4linux folks
have patches queued which depend on this so they
bugged me to push this out.
Thanks,
Johannes
^ permalink raw reply [flat|nested] 9+ messages in thread
* [DVB patch 1/8] usb: A800 rc and timeout fixes
2005-07-02 1:55 [DVB patch 0/8] DVB update Johannes Stezenbach
@ 2005-07-02 1:55 ` Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 2/8] usb: dont use HZ for timeouts Johannes Stezenbach
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Johannes Stezenbach @ 2005-07-02 1:55 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Andrew Hodgson, Patrick Boettcher
[-- Attachment #1: dvb-usb-a800-ir-and-timeout-fix.patch --]
[-- Type: text/plain, Size: 1512 bytes --]
From: Andrew Hodgson <a.s.hodgson@gmail.com>
o add some remote control codes
o not using HZ for control_msg-timeout
Signed-off-by: Andrew Hodgson <a.s.hodgson@gmail.com>
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
drivers/media/dvb/dvb-usb/a800.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletion(-)
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/a800.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/dvb-usb/a800.c 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/a800.c 2005-07-02 03:22:25.000000000 +0200
@@ -61,6 +61,12 @@ static struct dvb_usb_rc_key a800_rc_key
{ 0x02, 0x00, KEY_LAST }, /* >>| / BLUE */
{ 0x02, 0x04, KEY_EPG }, /* EPG */
{ 0x02, 0x15, KEY_MENU }, /* MENU */
+
+ { 0x03, 0x03, KEY_CHANNELUP }, /* CH UP */
+ { 0x03, 0x02, KEY_CHANNELDOWN }, /* CH DOWN */
+ { 0x03, 0x01, KEY_FIRST }, /* |<< / GREEN */
+ { 0x03, 0x00, KEY_LAST }, /* >>| / BLUE */
+
};
int a800_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
@@ -68,7 +74,7 @@ int a800_rc_query(struct dvb_usb_device
u8 key[5];
if (usb_control_msg(d->udev,usb_rcvctrlpipe(d->udev,0),
0x04, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, key, 5,
- 2*HZ) != 5)
+ 2000) != 5)
return -ENODEV;
/* call the universal NEC remote processor, to find out the key's state and event */
--
^ permalink raw reply [flat|nested] 9+ messages in thread
* [DVB patch 2/8] usb: dont use HZ for timeouts
2005-07-02 1:55 [DVB patch 0/8] DVB update Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 1/8] usb: A800 rc and timeout fixes Johannes Stezenbach
@ 2005-07-02 1:55 ` Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 3/8] ttpci: fix timeout handling to be save with PREEMPT Johannes Stezenbach
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Johannes Stezenbach @ 2005-07-02 1:55 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Patrick Boettcher
[-- Attachment #1: dvb-usb-timeout-fix.patch --]
[-- Type: text/plain, Size: 1168 bytes --]
From: Patrick Boettcher <pb@linuxtv.org>
Don't use HZ for usb-transfer-timeouts.
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
drivers/media/dvb/dvb-usb/dvb-usb-urb.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/dvb-usb-urb.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/dvb-usb/dvb-usb-urb.c 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/dvb-usb-urb.c 2005-07-02 03:22:26.000000000 +0200
@@ -29,7 +29,7 @@ int dvb_usb_generic_rw(struct dvb_usb_de
ret = usb_bulk_msg(d->udev,usb_sndbulkpipe(d->udev,
d->props.generic_bulk_ctrl_endpoint), wbuf,wlen,&actlen,
- 2*HZ);
+ 2000);
if (ret)
err("bulk message failed: %d (%d/%d)",ret,wlen,actlen);
@@ -43,7 +43,7 @@ int dvb_usb_generic_rw(struct dvb_usb_de
ret = usb_bulk_msg(d->udev,usb_rcvbulkpipe(d->udev,
d->props.generic_bulk_ctrl_endpoint),rbuf,rlen,&actlen,
- 2*HZ);
+ 2000);
if (ret)
err("recv bulk message failed: %d",ret);
--
^ permalink raw reply [flat|nested] 9+ messages in thread
* [DVB patch 3/8] ttpci: fix timeout handling to be save with PREEMPT
2005-07-02 1:55 [DVB patch 0/8] DVB update Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 1/8] usb: A800 rc and timeout fixes Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 2/8] usb: dont use HZ for timeouts Johannes Stezenbach
@ 2005-07-02 1:55 ` Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 4/8] frontend: add driver for LGDT3302 Johannes Stezenbach
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Johannes Stezenbach @ 2005-07-02 1:55 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Oliver Endriss
[-- Attachment #1: dvb-ttpci-preempt-timeout-fix.patch --]
[-- Type: text/plain, Size: 7759 bytes --]
From: Oliver Endriss <o.endriss@gmx.de>
Timeout handling fixed, especially for preemtible kernels and/or high system load.
Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
drivers/media/common/saa7146_core.c | 11 +++--
drivers/media/dvb/ttpci/av7110_hw.c | 72 ++++++++++++++++++++++++------------
2 files changed, 56 insertions(+), 27 deletions(-)
Index: linux-2.6.13-rc1-mm1/drivers/media/common/saa7146_core.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/common/saa7146_core.c 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/common/saa7146_core.c 2005-07-02 03:22:28.000000000 +0200
@@ -62,13 +62,15 @@ void saa7146_setgpio(struct saa7146_dev
int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop)
{
unsigned long start;
+ int err;
/* wait for registers to be programmed */
start = jiffies;
while (1) {
- if (saa7146_read(dev, MC2) & 2)
- break;
- if (time_after(jiffies, start + HZ/20)) {
+ err = time_after(jiffies, start + HZ/20);
+ if (saa7146_read(dev, MC2) & 2)
+ break;
+ if (err) {
DEB_S(("timed out while waiting for registers getting programmed\n"));
return -ETIMEDOUT;
}
@@ -79,10 +81,11 @@ int saa7146_wait_for_debi_done(struct sa
/* wait for transfer to complete */
start = jiffies;
while (1) {
+ err = time_after(jiffies, start + HZ/4);
if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S))
break;
saa7146_read(dev, MC2);
- if (time_after(jiffies, start + HZ/4)) {
+ if (err) {
DEB_S(("timed out while waiting for transfer completion\n"));
return -ETIMEDOUT;
}
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/ttpci/av7110_hw.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/ttpci/av7110_hw.c 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/ttpci/av7110_hw.c 2005-07-02 03:22:28.000000000 +0200
@@ -308,6 +308,7 @@ int av7110_wait_msgstate(struct av7110 *
{
unsigned long start;
u32 stat;
+ int err;
if (FW_VERSION(av7110->arm_app) <= 0x261c) {
/* not supported by old firmware */
@@ -318,14 +319,14 @@ int av7110_wait_msgstate(struct av7110 *
/* new firmware */
start = jiffies;
for (;;) {
+ err = time_after(jiffies, start + ARM_WAIT_FREE);
if (down_interruptible(&av7110->dcomlock))
return -ERESTARTSYS;
stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2);
up(&av7110->dcomlock);
- if ((stat & flags) == 0) {
+ if ((stat & flags) == 0)
break;
- }
- if (time_after(jiffies, start + ARM_WAIT_FREE)) {
+ if (err) {
printk(KERN_ERR "%s: timeout waiting for MSGSTATE %04x\n",
__FUNCTION__, stat & flags);
return -ETIMEDOUT;
@@ -342,6 +343,7 @@ static int __av7110_send_fw_cmd(struct a
char *type = NULL;
u16 flags[2] = {0, 0};
u32 stat;
+ int err;
// dprintk(4, "%p\n", av7110);
@@ -351,8 +353,11 @@ static int __av7110_send_fw_cmd(struct a
}
start = jiffies;
- while (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2 )) {
- if (time_after(jiffies, start + ARM_WAIT_FREE)) {
+ while (1) {
+ err = time_after(jiffies, start + ARM_WAIT_FREE);
+ if (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2) == 0)
+ break;
+ if (err) {
printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for COMMAND idle\n", __FUNCTION__);
return -ETIMEDOUT;
}
@@ -363,8 +368,11 @@ static int __av7110_send_fw_cmd(struct a
#ifndef _NOHANDSHAKE
start = jiffies;
- while (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2 )) {
- if (time_after(jiffies, start + ARM_WAIT_SHAKE)) {
+ while (1) {
+ err = time_after(jiffies, start + ARM_WAIT_SHAKE);
+ if (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2) == 0)
+ break;
+ if (err) {
printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for HANDSHAKE_REG\n", __FUNCTION__);
return -ETIMEDOUT;
}
@@ -401,6 +409,7 @@ static int __av7110_send_fw_cmd(struct a
/* non-immediate COMMAND type */
start = jiffies;
for (;;) {
+ err = time_after(jiffies, start + ARM_WAIT_FREE);
stat = rdebi(av7110, DEBINOSWAP, MSGSTATE, 0, 2);
if (stat & flags[0]) {
printk(KERN_ERR "%s: %s QUEUE overflow\n",
@@ -409,7 +418,7 @@ static int __av7110_send_fw_cmd(struct a
}
if ((stat & flags[1]) == 0)
break;
- if (time_after(jiffies, start + ARM_WAIT_FREE)) {
+ if (err) {
printk(KERN_ERR "%s: timeout waiting on busy %s QUEUE\n",
__FUNCTION__, type);
return -ETIMEDOUT;
@@ -432,12 +441,13 @@ static int __av7110_send_fw_cmd(struct a
#ifdef COM_DEBUG
start = jiffies;
- while (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2 )) {
- if (time_after(jiffies, start + ARM_WAIT_FREE)) {
+ while (1) {
+ err = time_after(jiffies, start + ARM_WAIT_FREE);
+ if (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2) == 0)
+ break;
+ if (err) {
printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for COMMAND %d to complete\n",
- __FUNCTION__,
- (buf[0] >> 8) & 0xff
- );
+ __FUNCTION__, (buf[0] >> 8) & 0xff);
return -ETIMEDOUT;
}
msleep(1);
@@ -553,8 +563,11 @@ int av7110_fw_request(struct av7110 *av7
}
start = jiffies;
- while (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2)) {
- if (time_after(jiffies, start + ARM_WAIT_FREE)) {
+ while (1) {
+ err = time_after(jiffies, start + ARM_WAIT_FREE);
+ if (rdebi(av7110, DEBINOSWAP, COMMAND, 0, 2) == 0)
+ break;
+ if (err) {
printk(KERN_ERR "%s: timeout waiting for COMMAND to complete\n", __FUNCTION__);
up(&av7110->dcomlock);
return -ETIMEDOUT;
@@ -566,8 +579,11 @@ int av7110_fw_request(struct av7110 *av7
#ifndef _NOHANDSHAKE
start = jiffies;
- while (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2 )) {
- if (time_after(jiffies, start + ARM_WAIT_SHAKE)) {
+ while (1) {
+ err = time_after(jiffies, start + ARM_WAIT_SHAKE);
+ if (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2) == 0)
+ break;
+ if (err) {
printk(KERN_ERR "%s: timeout waiting for HANDSHAKE_REG\n", __FUNCTION__);
up(&av7110->dcomlock);
return -ETIMEDOUT;
@@ -707,12 +723,16 @@ static inline int SetFont(struct av7110
static int FlushText(struct av7110 *av7110)
{
unsigned long start;
+ int err;
if (down_interruptible(&av7110->dcomlock))
return -ERESTARTSYS;
start = jiffies;
- while (rdebi(av7110, DEBINOSWAP, BUFF1_BASE, 0, 2)) {
- if (time_after(jiffies, start + ARM_WAIT_OSD)) {
+ while (1) {
+ err = time_after(jiffies, start + ARM_WAIT_OSD);
+ if (rdebi(av7110, DEBINOSWAP, BUFF1_BASE, 0, 2) == 0)
+ break;
+ if (err) {
printk(KERN_ERR "dvb-ttpci: %s(): timeout waiting for BUFF1_BASE == 0\n",
__FUNCTION__);
up(&av7110->dcomlock);
@@ -735,8 +755,11 @@ static int WriteText(struct av7110 *av71
return -ERESTARTSYS;
start = jiffies;
- while (rdebi(av7110, DEBINOSWAP, BUFF1_BASE, 0, 2)) {
- if (time_after(jiffies, start + ARM_WAIT_OSD)) {
+ while (1) {
+ ret = time_after(jiffies, start + ARM_WAIT_OSD);
+ if (rdebi(av7110, DEBINOSWAP, BUFF1_BASE, 0, 2) == 0)
+ break;
+ if (ret) {
printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for BUFF1_BASE == 0\n",
__FUNCTION__);
up(&av7110->dcomlock);
@@ -746,8 +769,11 @@ static int WriteText(struct av7110 *av71
}
#ifndef _NOHANDSHAKE
start = jiffies;
- while (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2)) {
- if (time_after(jiffies, start + ARM_WAIT_SHAKE)) {
+ while (1) {
+ ret = time_after(jiffies, start + ARM_WAIT_SHAKE);
+ if (rdebi(av7110, DEBINOSWAP, HANDSHAKE_REG, 0, 2) == 0)
+ break;
+ if (ret) {
printk(KERN_ERR "dvb-ttpci: %s: timeout waiting for HANDSHAKE_REG\n",
__FUNCTION__);
up(&av7110->dcomlock);
--
^ permalink raw reply [flat|nested] 9+ messages in thread
* [DVB patch 4/8] frontend: add driver for LGDT3302
2005-07-02 1:55 [DVB patch 0/8] DVB update Johannes Stezenbach
` (2 preceding siblings ...)
2005-07-02 1:55 ` [DVB patch 3/8] ttpci: fix timeout handling to be save with PREEMPT Johannes Stezenbach
@ 2005-07-02 1:55 ` Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 5/8] usb/pci: correct syntax of driver name fields Johannes Stezenbach
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Johannes Stezenbach @ 2005-07-02 1:55 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Mac Michaels, Michael Krufky
[-- Attachment #1: dvb-frontend-lgdt3302.patch --]
[-- Type: text/plain, Size: 27580 bytes --]
From: Mac Michaels <wmichaels1@earthlink.net>
Add support for LGDT3302 (ATSC VSB/QAM) used in DViCO FusionHDTV3 Gold.
Signed-off-by: Mac Michaels <wmichaels1@earthlink.net>
Signed-off-by: Michael Krufky <mkrufky@m1k.net>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
drivers/media/dvb/frontends/Kconfig | 7
drivers/media/dvb/frontends/Makefile | 1
drivers/media/dvb/frontends/dvb-pll.c | 13
drivers/media/dvb/frontends/dvb-pll.h | 1
drivers/media/dvb/frontends/lgdt3302.c | 618 ++++++++++++++++++++++++++++
drivers/media/dvb/frontends/lgdt3302.h | 49 ++
drivers/media/dvb/frontends/lgdt3302_priv.h | 72 +++
7 files changed, 761 insertions(+)
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/frontends/Kconfig
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/frontends/Kconfig 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/frontends/Kconfig 2005-07-02 03:22:29.000000000 +0200
@@ -187,4 +187,11 @@ config DVB_BCM3510
An ATSC 8VSB/16VSB and QAM64/256 tuner module. Say Y when you want to
support this frontend.
+config DVB_LGDT3302
+ tristate "LGDT3302 based (DViCO FusionHDTV3 Gold)"
+ depends on DVB_CORE
+ help
+ An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
+ to support this frontend.
+
endmenu
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/frontends/Makefile
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/frontends/Makefile 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/frontends/Makefile 2005-07-02 03:22:29.000000000 +0200
@@ -30,3 +30,4 @@ obj-$(CONFIG_DVB_OR51211) += or51211.o
obj-$(CONFIG_DVB_OR51132) += or51132.o
obj-$(CONFIG_DVB_BCM3510) += bcm3510.o
obj-$(CONFIG_DVB_S5H1420) += s5h1420.o
+obj-$(CONFIG_DVB_LGDT3302) += lgdt3302.o
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/frontends/dvb-pll.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/frontends/dvb-pll.c 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/frontends/dvb-pll.c 2005-07-02 03:22:29.000000000 +0200
@@ -93,6 +93,19 @@ struct dvb_pll_desc dvb_pll_lg_z201 = {
};
EXPORT_SYMBOL(dvb_pll_lg_z201);
+struct dvb_pll_desc dvb_pll_microtune_4042 = {
+ .name = "Microtune 4042 FI5",
+ .min = 57000000,
+ .max = 858000000,
+ .count = 3,
+ .entries = {
+ { 162000000, 44000000, 62500, 0x8e, 0xa1 },
+ { 457000000, 44000000, 62500, 0x8e, 0x91 },
+ { 999999999, 44000000, 62500, 0x8e, 0x31 },
+ },
+};
+EXPORT_SYMBOL(dvb_pll_microtune_4042);
+
struct dvb_pll_desc dvb_pll_unknown_1 = {
.name = "unknown 1", /* used by dntv live dvb-t */
.min = 174000000,
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/frontends/dvb-pll.h
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/frontends/dvb-pll.h 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/frontends/dvb-pll.h 2005-07-02 03:22:29.000000000 +0200
@@ -24,6 +24,7 @@ extern struct dvb_pll_desc dvb_pll_thoms
extern struct dvb_pll_desc dvb_pll_thomson_dtt759x;
extern struct dvb_pll_desc dvb_pll_thomson_dtt7610;
extern struct dvb_pll_desc dvb_pll_lg_z201;
+extern struct dvb_pll_desc dvb_pll_microtune_4042;
extern struct dvb_pll_desc dvb_pll_unknown_1;
extern struct dvb_pll_desc dvb_pll_tua6010xs;
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/frontends/lgdt3302.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/frontends/lgdt3302.c 2005-07-02 03:22:29.000000000 +0200
@@ -0,0 +1,618 @@
+/*
+ * $Id: lgdt3302.c,v 1.2 2005/06/28 23:50:48 mkrufky Exp $
+ *
+ * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM
+ *
+ * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
+ *
+ * Based on code from Kirk Lapray <kirk_lapray@bigfoot.com>
+ * Copyright (C) 2005
+ *
+ * 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.
+ *
+ * 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.
+ *
+ */
+
+/*
+ * NOTES ABOUT THIS DRIVER
+ *
+ * This driver supports DViCO FusionHDTV 3 Gold under Linux.
+ *
+ * TODO:
+ * BER and signal strength always return 0.
+ *
+ */
+
+#include <linux/version.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <asm/byteorder.h>
+
+#include "dvb_frontend.h"
+#include "dvb-pll.h"
+#include "lgdt3302_priv.h"
+#include "lgdt3302.h"
+
+static int debug = 0;
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug,"Turn on/off lgdt3302 frontend debugging (default:off).");
+#define dprintk(args...) \
+do { \
+if (debug) printk(KERN_DEBUG "lgdt3302: " args); \
+} while (0)
+
+struct lgdt3302_state
+{
+ struct i2c_adapter* i2c;
+ struct dvb_frontend_ops ops;
+
+ /* Configuration settings */
+ const struct lgdt3302_config* config;
+
+ struct dvb_frontend frontend;
+
+ /* Demodulator private data */
+ fe_modulation_t current_modulation;
+
+ /* Tuner private data */
+ u32 current_frequency;
+};
+
+static int i2c_writebytes (struct lgdt3302_state* state,
+ u8 addr, /* demod_address or pll_address */
+ u8 *buf, /* data bytes to send */
+ int len /* number of bytes to send */ )
+{
+ if (addr == state->config->pll_address) {
+ struct i2c_msg msg =
+ { .addr = addr, .flags = 0, .buf = buf, .len = len };
+ int err;
+
+ if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
+ printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err);
+ return -EREMOTEIO;
+ }
+ } else {
+ u8 tmp[] = { buf[0], buf[1] };
+ struct i2c_msg msg =
+ { .addr = addr, .flags = 0, .buf = tmp, .len = 2 };
+ int err;
+ int i;
+
+ for (i=1; i<len; i++) {
+ tmp[1] = buf[i];
+ if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
+ printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err);
+ return -EREMOTEIO;
+ }
+ tmp[0]++;
+ }
+ }
+ return 0;
+}
+static int i2c_readbytes (struct lgdt3302_state* state,
+ u8 addr, /* demod_address or pll_address */
+ u8 *buf, /* holds data bytes read */
+ int len /* number of bytes to read */ )
+{
+ struct i2c_msg msg =
+ { .addr = addr, .flags = I2C_M_RD, .buf = buf, .len = len };
+ int err;
+
+ if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
+ printk(KERN_WARNING "lgdt3302: %s error (addr %02x, err == %i)\n", __FUNCTION__, addr, err);
+ return -EREMOTEIO;
+ }
+ return 0;
+}
+
+/*
+ * This routine writes the register (reg) to the demod bus
+ * then reads the data returned for (len) bytes.
+ */
+
+static u8 i2c_selectreadbytes (struct lgdt3302_state* state,
+ enum I2C_REG reg, u8* buf, int len)
+{
+ u8 wr [] = { reg };
+ struct i2c_msg msg [] = {
+ { .addr = state->config->demod_address,
+ .flags = 0, .buf = wr, .len = 1 },
+ { .addr = state->config->demod_address,
+ .flags = I2C_M_RD, .buf = buf, .len = len },
+ };
+ int ret;
+ ret = i2c_transfer(state->i2c, msg, 2);
+ if (ret != 2) {
+ printk(KERN_WARNING "lgdt3302: %s: addr 0x%02x select 0x%02x error (ret == %i)\n", __FUNCTION__, state->config->demod_address, reg, ret);
+ } else {
+ ret = 0;
+ }
+ return ret;
+}
+
+/* Software reset */
+int lgdt3302_SwReset(struct lgdt3302_state* state)
+{
+ u8 ret;
+ u8 reset[] = {
+ IRQ_MASK,
+ 0x00 /* bit 6 is active low software reset
+ * bits 5-0 are 1 to mask interrupts */
+ };
+
+ ret = i2c_writebytes(state,
+ state->config->demod_address,
+ reset, sizeof(reset));
+ if (ret == 0) {
+ /* spec says reset takes 100 ns why wait */
+ /* mdelay(100); */ /* keep low for 100mS */
+ reset[1] = 0x7f; /* force reset high (inactive)
+ * and unmask interrupts */
+ ret = i2c_writebytes(state,
+ state->config->demod_address,
+ reset, sizeof(reset));
+ }
+ /* Spec does not indicate a need for this either */
+ /*mdelay(5); */ /* wait 5 msec before doing more */
+ return ret;
+}
+
+static int lgdt3302_init(struct dvb_frontend* fe)
+{
+ /* Hardware reset is done using gpio[0] of cx23880x chip.
+ * I'd like to do it here, but don't know how to find chip address.
+ * cx88-cards.c arranges for the reset bit to be inactive (high).
+ * Maybe there needs to be a callable function in cx88-core or
+ * the caller of this function needs to do it. */
+
+ dprintk("%s entered\n", __FUNCTION__);
+ return lgdt3302_SwReset((struct lgdt3302_state*) fe->demodulator_priv);
+}
+
+static int lgdt3302_read_ber(struct dvb_frontend* fe, u32* ber)
+{
+ *ber = 0; /* Dummy out for now */
+ return 0;
+}
+
+static int lgdt3302_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
+{
+ struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv;
+ u8 buf[2];
+
+ i2c_selectreadbytes(state, PACKET_ERR_COUNTER1, buf, sizeof(buf));
+
+ *ucblocks = (buf[0] << 8) | buf[1];
+ return 0;
+}
+
+static int lgdt3302_set_parameters(struct dvb_frontend* fe,
+ struct dvb_frontend_parameters *param)
+{
+ u8 buf[4];
+ struct lgdt3302_state* state =
+ (struct lgdt3302_state*) fe->demodulator_priv;
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10)
+
+ /* Use 50MHz parameter values from spec sheet since xtal is 50 */
+ static u8 top_ctrl_cfg[] = { TOP_CONTROL, 0x03 };
+ static u8 vsb_freq_cfg[] = { VSB_CARRIER_FREQ0, 0x00, 0x87, 0x8e, 0x01 };
+ static u8 demux_ctrl_cfg[] = { DEMUX_CONTROL, 0xfb };
+ static u8 agc_rf_cfg[] = { AGC_RF_BANDWIDTH0, 0x40, 0x93, 0x00 };
+ static u8 agc_ctrl_cfg[] = { AGC_FUNC_CTRL2, 0xc6, 0x40 };
+ static u8 agc_delay_cfg[] = { AGC_DELAY0, 0x00, 0x00, 0x00 };
+ static u8 agc_loop_cfg[] = { AGC_LOOP_BANDWIDTH0, 0x08, 0x9a };
+
+ /* Change only if we are actually changing the modulation */
+ if (state->current_modulation != param->u.vsb.modulation) {
+ switch(param->u.vsb.modulation) {
+ case VSB_8:
+ dprintk("%s: VSB_8 MODE\n", __FUNCTION__);
+
+ /* Select VSB mode and serial MPEG interface */
+ top_ctrl_cfg[1] = 0x07;
+ break;
+
+ case QAM_64:
+ dprintk("%s: QAM_64 MODE\n", __FUNCTION__);
+
+ /* Select QAM_64 mode and serial MPEG interface */
+ top_ctrl_cfg[1] = 0x04;
+ break;
+
+ case QAM_256:
+ dprintk("%s: QAM_256 MODE\n", __FUNCTION__);
+
+ /* Select QAM_256 mode and serial MPEG interface */
+ top_ctrl_cfg[1] = 0x05;
+ break;
+ default:
+ printk(KERN_WARNING "lgdt3302: %s: Modulation type(%d) UNSUPPORTED\n", __FUNCTION__, param->u.vsb.modulation);
+ return -1;
+ }
+ /* Initializations common to all modes */
+
+ /* Select the requested mode */
+ i2c_writebytes(state, state->config->demod_address,
+ top_ctrl_cfg, sizeof(top_ctrl_cfg));
+
+ /* Change the value of IFBW[11:0]
+ of AGC IF/RF loop filter bandwidth register */
+ i2c_writebytes(state, state->config->demod_address,
+ agc_rf_cfg, sizeof(agc_rf_cfg));
+
+ /* Change the value of bit 6, 'nINAGCBY' and
+ 'NSSEL[1:0] of ACG function control register 2 */
+ /* Change the value of bit 6 'RFFIX'
+ of AGC function control register 3 */
+ i2c_writebytes(state, state->config->demod_address,
+ agc_ctrl_cfg, sizeof(agc_ctrl_cfg));
+
+ /* Change the TPCLK pin polarity
+ data is valid on falling clock */
+ i2c_writebytes(state, state->config->demod_address,
+ demux_ctrl_cfg, sizeof(demux_ctrl_cfg));
+
+ if (param->u.vsb.modulation == VSB_8) {
+ /* Initialization for VSB modes only */
+ /* Change the value of NCOCTFV[25:0]of carrier
+ recovery center frequency register for VSB */
+ i2c_writebytes(state, state->config->demod_address,
+ vsb_freq_cfg, sizeof(vsb_freq_cfg));
+ } else {
+ /* Initialization for QAM modes only */
+ /* Set the value of 'INLVTHD' register 0x2a/0x2c
+ to value from 'IFACC' register 0x39/0x3b -1 */
+ int value;
+ i2c_selectreadbytes(state, AGC_RFIF_ACC0,
+ &agc_delay_cfg[1], 3);
+ value = ((agc_delay_cfg[1] & 0x0f) << 8) | agc_delay_cfg[3];
+ value = value -1;
+ dprintk("%s IFACC -1 = 0x%03x\n", __FUNCTION__, value);
+ agc_delay_cfg[1] = (value >> 8) & 0x0f;
+ agc_delay_cfg[2] = 0x00;
+ agc_delay_cfg[3] = value & 0xff;
+ i2c_writebytes(state, state->config->demod_address,
+ agc_delay_cfg, sizeof(agc_delay_cfg));
+
+ /* Change the value of IAGCBW[15:8]
+ of inner AGC loop filter bandwith */
+ i2c_writebytes(state, state->config->demod_address,
+ agc_loop_cfg, sizeof(agc_loop_cfg));
+ }
+
+ state->config->set_ts_params(fe, 0);
+ lgdt3302_SwReset(state);
+ state->current_modulation = param->u.vsb.modulation;
+ }
+#else
+ printk("lgdt3302: %s: you need a newer kernel for this, sorry\n",__FUNCTION__);
+#endif
+
+ /* Change only if we are actually changing the channel */
+ if (state->current_frequency != param->frequency) {
+ dvb_pll_configure(state->config->pll_desc, buf,
+ param->frequency, 0);
+ dprintk("%s: tuner bytes: 0x%02x 0x%02x "
+ "0x%02x 0x%02x\n", __FUNCTION__, buf[0],buf[1],buf[2],buf[3]);
+ i2c_writebytes(state, state->config->pll_address ,buf, 4);
+
+ /* Check the status of the tuner pll */
+ i2c_readbytes(state, state->config->pll_address, buf, 1);
+ dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]);
+
+ lgdt3302_SwReset(state);
+
+ /* Update current frequency */
+ state->current_frequency = param->frequency;
+ }
+ return 0;
+}
+
+static int lgdt3302_get_frontend(struct dvb_frontend* fe,
+ struct dvb_frontend_parameters* param)
+{
+ struct lgdt3302_state *state = fe->demodulator_priv;
+ param->frequency = state->current_frequency;
+ return 0;
+}
+
+static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status)
+{
+ struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv;
+ u8 buf[3];
+
+ *status = 0; /* Reset status result */
+
+ /* Check the status of the tuner pll */
+ i2c_readbytes(state, state->config->pll_address, buf, 1);
+ dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]);
+ if ((buf[0] & 0xc0) != 0x40)
+ return 0; /* Tuner PLL not locked or not powered on */
+
+ /*
+ * You must set the Mask bits to 1 in the IRQ_MASK in order
+ * to see that status bit in the IRQ_STATUS register.
+ * This is done in SwReset();
+ */
+
+ /* signal status */
+ i2c_selectreadbytes(state, TOP_CONTROL, buf, sizeof(buf));
+ dprintk("%s: TOP_CONTROL = 0x%02x, IRO_MASK = 0x%02x, IRQ_STATUS = 0x%02x\n", __FUNCTION__, buf[0], buf[1], buf[2]);
+ if ((buf[2] & 0x30) == 0x10)
+ *status |= FE_HAS_SIGNAL;
+
+ /* sync status */
+ if ((buf[2] & 0x03) == 0x01) {
+ *status |= FE_HAS_SYNC;
+ }
+
+ /* FEC error status */
+ if ((buf[2] & 0x0c) == 0x08) {
+ *status |= FE_HAS_LOCK;
+ *status |= FE_HAS_VITERBI;
+ }
+
+#if 0
+ /* Alternative method to check for a signal */
+ /* AGC status register */
+ i2c_selectreadbytes(state, AGC_STATUS, buf, 1);
+ dprintk("%s: AGC_STATUS = 0x%02x\n", __FUNCTION__, buf[0]);
+ if ((buf[0] & 0x0c) == 0x80) /* Test signal does not exist flag */
+ /* Test AGC lock flag */
+ *status |= FE_HAS_SIGNAL;
+ else
+ return 0;
+
+ /* Carrier Recovery Lock Status Register */
+ i2c_selectreadbytes(state, CARRIER_LOCK, buf, 1);
+ dprintk("%s: CARRIER_LOCK = 0x%02x\n", __FUNCTION__, buf[0]);
+ switch (state->current_modulation) {
+ case QAM_256:
+ case QAM_64:
+ /* Need to undestand why there are 3 lock levels here */
+ if ((buf[0] & 0x07) == 0x07)
+ *status |= FE_HAS_CARRIER;
+ else
+ return 0;
+ break;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10)
+ case VSB_8:
+ if ((buf[0] & 0x80) == 0x80)
+ *status |= FE_HAS_CARRIER;
+ else
+ return 0;
+ break;
+#endif
+ default:
+ printk("KERN_WARNING lgdt3302: %s: Modulation set to unsupported value\n", __FUNCTION__);
+ }
+#endif
+
+ return 0;
+}
+
+static int lgdt3302_read_signal_strength(struct dvb_frontend* fe, u16* strength)
+{
+ /* not directly available. */
+ return 0;
+}
+
+static int lgdt3302_read_snr(struct dvb_frontend* fe, u16* snr)
+{
+#ifdef SNR_IN_DB
+ /*
+ * Spec sheet shows formula for SNR_EQ = 10 log10(25 * 24**2 / noise)
+ * and SNR_PH = 10 log10(25 * 32**2 / noise) for equalizer and phase tracker
+ * respectively. The following tables are built on these formulas.
+ * The usual definition is SNR = 20 log10(signal/noise)
+ * If the specification is wrong the value retuned is 1/2 the actual SNR in db.
+ *
+ * This table is a an ordered list of noise values computed by the
+ * formula from the spec sheet such that the index into the table
+ * starting at 43 or 45 is the SNR value in db. There are duplicate noise
+ * value entries at the beginning because the SNR varies more than
+ * 1 db for a change of 1 digit in noise at very small values of noise.
+ *
+ * Examples from SNR_EQ table:
+ * noise SNR
+ * 0 43
+ * 1 42
+ * 2 39
+ * 3 37
+ * 4 36
+ * 5 35
+ * 6 34
+ * 7 33
+ * 8 33
+ * 9 32
+ * 10 32
+ * 11 31
+ * 12 31
+ * 13 30
+ */
+
+ static const u32 SNR_EQ[] =
+ { 1, 2, 2, 2, 3, 3, 4, 4, 5, 7,
+ 9, 11, 13, 17, 21, 26, 33, 41, 52, 65,
+ 81, 102, 129, 162, 204, 257, 323, 406, 511, 644,
+ 810, 1020, 1284, 1616, 2035, 2561, 3224, 4059, 5110, 6433,
+ 8098, 10195, 12835, 16158, 20341, 25608, 32238, 40585, 51094, 64323,
+ 80978, 101945, 128341, 161571, 203406, 256073, 0x40000
+ };
+
+ static const u32 SNR_PH[] =
+ { 1, 2, 2, 2, 3, 3, 4, 5, 6, 8,
+ 10, 12, 15, 19, 23, 29, 37, 46, 58, 73,
+ 91, 115, 144, 182, 229, 288, 362, 456, 574, 722,
+ 909, 1144, 1440, 1813, 2282, 2873, 3617, 4553, 5732, 7216,
+ 9084, 11436, 14396, 18124, 22817, 28724, 36161, 45524, 57312, 72151,
+ 90833, 114351, 143960, 181235, 228161, 0x040000
+ };
+
+ static u8 buf[5];/* read data buffer */
+ static u32 noise; /* noise value */
+ static u32 snr_db; /* index into SNR_EQ[] */
+ struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv;
+
+ /* read both equalizer and pase tracker noise data */
+ i2c_selectreadbytes(state, EQPH_ERR0, buf, sizeof(buf));
+
+ if (state->current_modulation == VSB_8) {
+ /* Equalizer Mean-Square Error Register for VSB */
+ noise = ((buf[0] & 7) << 16) | (buf[1] << 8) | buf[2];
+
+ /*
+ * Look up noise value in table.
+ * A better search algorithm could be used...
+ * watch out there are duplicate entries.
+ */
+ for (snr_db = 0; snr_db < sizeof(SNR_EQ); snr_db++) {
+ if (noise < SNR_EQ[snr_db]) {
+ *snr = 43 - snr_db;
+ break;
+ }
+ }
+ } else {
+ /* Phase Tracker Mean-Square Error Register for QAM */
+ noise = ((buf[0] & 7<<3) << 13) | (buf[3] << 8) | buf[4];
+
+ /* Look up noise value in table. */
+ for (snr_db = 0; snr_db < sizeof(SNR_PH); snr_db++) {
+ if (noise < SNR_PH[snr_db]) {
+ *snr = 45 - snr_db;
+ break;
+ }
+ }
+ }
+#else
+ /* Return the raw noise value */
+ static u8 buf[5];/* read data buffer */
+ static u32 noise; /* noise value */
+ struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv;
+
+ /* read both equalizer and pase tracker noise data */
+ i2c_selectreadbytes(state, EQPH_ERR0, buf, sizeof(buf));
+
+ if (state->current_modulation == VSB_8) {
+ /* Equalizer Mean-Square Error Register for VSB */
+ noise = ((buf[0] & 7) << 16) | (buf[1] << 8) | buf[2];
+ } else {
+ /* Phase Tracker Mean-Square Error Register for QAM */
+ noise = ((buf[0] & 7<<3) << 13) | (buf[3] << 8) | buf[4];
+ }
+
+ /* Small values for noise mean signal is better so invert noise */
+ /* Noise is 19 bit value so discard 3 LSB*/
+ *snr = ~noise>>3;
+#endif
+
+ dprintk("%s: noise = 0x%05x, snr = %idb\n",__FUNCTION__, noise, *snr);
+
+ return 0;
+}
+
+static int lgdt3302_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fe_tune_settings)
+{
+ /* I have no idea about this - it may not be needed */
+ fe_tune_settings->min_delay_ms = 500;
+ fe_tune_settings->step_size = 0;
+ fe_tune_settings->max_drift = 0;
+ return 0;
+}
+
+static void lgdt3302_release(struct dvb_frontend* fe)
+{
+ struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv;
+ kfree(state);
+}
+
+static struct dvb_frontend_ops lgdt3302_ops;
+
+struct dvb_frontend* lgdt3302_attach(const struct lgdt3302_config* config,
+ struct i2c_adapter* i2c)
+{
+ struct lgdt3302_state* state = NULL;
+ u8 buf[1];
+
+ /* Allocate memory for the internal state */
+ state = (struct lgdt3302_state*) kmalloc(sizeof(struct lgdt3302_state), GFP_KERNEL);
+ if (state == NULL)
+ goto error;
+ memset(state,0,sizeof(*state));
+
+ /* Setup the state */
+ state->config = config;
+ state->i2c = i2c;
+ memcpy(&state->ops, &lgdt3302_ops, sizeof(struct dvb_frontend_ops));
+ /* Verify communication with demod chip */
+ if (i2c_selectreadbytes(state, 2, buf, 1))
+ goto error;
+
+ state->current_frequency = -1;
+ state->current_modulation = -1;
+
+ /* Create dvb_frontend */
+ state->frontend.ops = &state->ops;
+ state->frontend.demodulator_priv = state;
+ return &state->frontend;
+
+error:
+ if (state)
+ kfree(state);
+ dprintk("%s: ERROR\n",__FUNCTION__);
+ return NULL;
+}
+
+static struct dvb_frontend_ops lgdt3302_ops = {
+ .info = {
+ .name= "LG Electronics LGDT3302 VSB/QAM Frontend",
+ .type = FE_ATSC,
+ .frequency_min= 54000000,
+ .frequency_max= 858000000,
+ .frequency_stepsize= 62500,
+ /* Symbol rate is for all VSB modes need to check QAM */
+ .symbol_rate_min = 10762000,
+ .symbol_rate_max = 10762000,
+ .caps = FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_8VSB
+ },
+ .init = lgdt3302_init,
+ .set_frontend = lgdt3302_set_parameters,
+ .get_frontend = lgdt3302_get_frontend,
+ .get_tune_settings = lgdt3302_get_tune_settings,
+ .read_status = lgdt3302_read_status,
+ .read_ber = lgdt3302_read_ber,
+ .read_signal_strength = lgdt3302_read_signal_strength,
+ .read_snr = lgdt3302_read_snr,
+ .read_ucblocks = lgdt3302_read_ucblocks,
+ .release = lgdt3302_release,
+};
+
+MODULE_DESCRIPTION("LGDT3302 [DViCO FusionHDTV 3 Gold] (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver");
+MODULE_AUTHOR("Wilson Michaels");
+MODULE_LICENSE("GPL");
+
+EXPORT_SYMBOL(lgdt3302_attach);
+
+/*
+ * Local variables:
+ * c-basic-offset: 8
+ * compile-command: "make DVB=1"
+ * End:
+ */
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/frontends/lgdt3302.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/frontends/lgdt3302.h 2005-07-02 03:22:29.000000000 +0200
@@ -0,0 +1,49 @@
+/*
+ * $Id: lgdt3302.h,v 1.2 2005/06/28 23:50:48 mkrufky Exp $
+ *
+ * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM
+ *
+ * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
+ *
+ * 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.
+ *
+ * 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.
+ *
+ */
+
+#ifndef LGDT3302_H
+#define LGDT3302_H
+
+#include <linux/dvb/frontend.h>
+
+struct lgdt3302_config
+{
+ /* The demodulator's i2c address */
+ u8 demod_address;
+ u8 pll_address;
+ struct dvb_pll_desc *pll_desc;
+
+ /* Need to set device param for start_dma */
+ int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured);
+};
+
+extern struct dvb_frontend* lgdt3302_attach(const struct lgdt3302_config* config,
+ struct i2c_adapter* i2c);
+
+#endif /* LGDT3302_H */
+
+/*
+ * Local variables:
+ * c-basic-offset: 8
+ * End:
+ */
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/frontends/lgdt3302_priv.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/frontends/lgdt3302_priv.h 2005-07-02 03:22:29.000000000 +0200
@@ -0,0 +1,72 @@
+/*
+ * $Id: lgdt3302_priv.h,v 1.2 2005/06/28 23:50:48 mkrufky Exp $
+ *
+ * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM
+ *
+ * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
+ *
+ * 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.
+ *
+ * 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.
+ *
+ */
+
+#ifndef _LGDT3302_PRIV_
+#define _LGDT3302_PRIV_
+
+/* i2c control register addresses */
+enum I2C_REG {
+ TOP_CONTROL= 0x00,
+ IRQ_MASK= 0x01,
+ IRQ_STATUS= 0x02,
+ VSB_CARRIER_FREQ0= 0x16,
+ VSB_CARRIER_FREQ1= 0x17,
+ VSB_CARRIER_FREQ2= 0x18,
+ VSB_CARRIER_FREQ3= 0x19,
+ CARRIER_MSEQAM1= 0x1a,
+ CARRIER_MSEQAM2= 0x1b,
+ CARRIER_LOCK= 0x1c,
+ TIMING_RECOVERY= 0x1d,
+ AGC_DELAY0= 0x2a,
+ AGC_DELAY1= 0x2b,
+ AGC_DELAY2= 0x2c,
+ AGC_RF_BANDWIDTH0= 0x2d,
+ AGC_RF_BANDWIDTH1= 0x2e,
+ AGC_RF_BANDWIDTH2= 0x2f,
+ AGC_LOOP_BANDWIDTH0= 0x30,
+ AGC_LOOP_BANDWIDTH1= 0x31,
+ AGC_FUNC_CTRL1= 0x32,
+ AGC_FUNC_CTRL2= 0x33,
+ AGC_FUNC_CTRL3= 0x34,
+ AGC_RFIF_ACC0= 0x39,
+ AGC_RFIF_ACC1= 0x3a,
+ AGC_RFIF_ACC2= 0x3b,
+ AGC_STATUS= 0x3f,
+ SYNC_STATUS_VSB= 0x43,
+ EQPH_ERR0= 0x47,
+ EQ_ERR1= 0x48,
+ EQ_ERR2= 0x49,
+ PH_ERR1= 0x4a,
+ PH_ERR2= 0x4b,
+ DEMUX_CONTROL= 0x66,
+ PACKET_ERR_COUNTER1= 0x6a,
+ PACKET_ERR_COUNTER2= 0x6b,
+};
+
+#endif /* _LGDT3302_PRIV_ */
+
+/*
+ * Local variables:
+ * c-basic-offset: 8
+ * End:
+ */
--
^ permalink raw reply [flat|nested] 9+ messages in thread
* [DVB patch 5/8] usb/pci: correct syntax of driver name fields
2005-07-02 1:55 [DVB patch 0/8] DVB update Johannes Stezenbach
` (3 preceding siblings ...)
2005-07-02 1:55 ` [DVB patch 4/8] frontend: add driver for LGDT3302 Johannes Stezenbach
@ 2005-07-02 1:55 ` Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 6/8] dst: fix tuning problem Johannes Stezenbach
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Johannes Stezenbach @ 2005-07-02 1:55 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Patrick Boettcher
[-- Attachment #1: dvb-usb-pci-name-fix.patch --]
[-- Type: text/plain, Size: 8178 bytes --]
From: Patrick Boettcher <pb@linuxtv.org>
Change the name-field of the pci_driver and usb_driver structs to the name of
the module after compilation. It seems that this field is used in some places
where special characters are not allowed.
Thanks to Alan Halverson for finding this problem.
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
drivers/media/dvb/b2c2/flexcop-pci.c | 2 +-
drivers/media/dvb/b2c2/flexcop-usb.c | 2 +-
drivers/media/dvb/dvb-usb/a800.c | 2 +-
drivers/media/dvb/dvb-usb/cxusb.c | 2 +-
drivers/media/dvb/dvb-usb/dibusb-mb.c | 2 +-
drivers/media/dvb/dvb-usb/dibusb-mc.c | 2 +-
drivers/media/dvb/dvb-usb/digitv.c | 2 +-
drivers/media/dvb/dvb-usb/nova-t-usb2.c | 2 +-
drivers/media/dvb/dvb-usb/umt-010.c | 2 +-
drivers/media/dvb/dvb-usb/vp7045.c | 6 +++---
10 files changed, 12 insertions(+), 12 deletions(-)
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/b2c2/flexcop-pci.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/b2c2/flexcop-pci.c 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/b2c2/flexcop-pci.c 2005-07-02 03:22:30.000000000 +0200
@@ -409,7 +409,7 @@ static struct pci_device_id flexcop_pci_
MODULE_DEVICE_TABLE(pci, flexcop_pci_tbl);
static struct pci_driver flexcop_pci_driver = {
- .name = "Technisat/B2C2 FlexCop II/IIb PCI",
+ .name = "b2c2_flexcop_pci",
.id_table = flexcop_pci_tbl,
.probe = flexcop_pci_probe,
.remove = flexcop_pci_remove,
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/b2c2/flexcop-usb.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/b2c2/flexcop-usb.c 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/b2c2/flexcop-usb.c 2005-07-02 03:22:30.000000000 +0200
@@ -545,7 +545,7 @@ static struct usb_device_id flexcop_usb_
/* usb specific object needed to register this driver with the usb subsystem */
static struct usb_driver flexcop_usb_driver = {
.owner = THIS_MODULE,
- .name = "Technisat/B2C2 FlexCop II/IIb/III USB",
+ .name = "b2c2_flexcop_usb",
.probe = flexcop_usb_probe,
.disconnect = flexcop_usb_disconnect,
.id_table = flexcop_usb_table,
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/a800.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/dvb-usb/a800.c 2005-07-02 03:22:25.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/a800.c 2005-07-02 03:22:30.000000000 +0200
@@ -149,7 +149,7 @@ static struct dvb_usb_properties a800_pr
static struct usb_driver a800_driver = {
.owner = THIS_MODULE,
- .name = "AVerMedia AverTV DVB-T USB 2.0 (A800)",
+ .name = "dvb_usb_a800",
.probe = a800_probe,
.disconnect = dvb_usb_device_exit,
.id_table = a800_table,
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/cxusb.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/dvb-usb/cxusb.c 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/cxusb.c 2005-07-02 03:22:30.000000000 +0200
@@ -262,7 +262,7 @@ static struct dvb_usb_properties cxusb_p
static struct usb_driver cxusb_driver = {
.owner = THIS_MODULE,
- .name = "cxusb",
+ .name = "dvb_usb_cxusb",
.probe = cxusb_probe,
.disconnect = dvb_usb_device_exit,
.id_table = cxusb_table,
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/dibusb-mb.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/dvb-usb/dibusb-mb.c 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/dibusb-mb.c 2005-07-02 03:22:30.000000000 +0200
@@ -317,7 +317,7 @@ static struct dvb_usb_properties dibusb2
static struct usb_driver dibusb_driver = {
.owner = THIS_MODULE,
- .name = "DiBcom based USB DVB-T devices (DiB3000M-B based)",
+ .name = "dvb_usb_dibusb_mb",
.probe = dibusb_probe,
.disconnect = dvb_usb_device_exit,
.id_table = dibusb_dib3000mb_table,
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/dibusb-mc.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/dvb-usb/dibusb-mc.c 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/dibusb-mc.c 2005-07-02 03:22:30.000000000 +0200
@@ -83,7 +83,7 @@ static struct dvb_usb_properties dibusb_
static struct usb_driver dibusb_mc_driver = {
.owner = THIS_MODULE,
- .name = "DiBcom based USB2.0 DVB-T (DiB3000M-C/P based) devices",
+ .name = "dvb_usb_dibusb_mc",
.probe = dibusb_mc_probe,
.disconnect = dvb_usb_device_exit,
.id_table = dibusb_dib3000mc_table,
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/digitv.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/dvb-usb/digitv.c 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/digitv.c 2005-07-02 03:22:30.000000000 +0200
@@ -228,7 +228,7 @@ static struct dvb_usb_properties digitv_
static struct usb_driver digitv_driver = {
.owner = THIS_MODULE,
- .name = "Nebula Electronics uDigiTV DVB-T USB2.0 device",
+ .name = "dvb_usb_digitv",
.probe = digitv_probe,
.disconnect = dvb_usb_device_exit,
.id_table = digitv_table,
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/nova-t-usb2.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/dvb-usb/nova-t-usb2.c 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/nova-t-usb2.c 2005-07-02 03:22:30.000000000 +0200
@@ -203,7 +203,7 @@ static struct dvb_usb_properties nova_t_
static struct usb_driver nova_t_driver = {
.owner = THIS_MODULE,
- .name = "Hauppauge WinTV-NOVA-T usb2",
+ .name = "dvb_usb_nova_t_usb2",
.probe = nova_t_probe,
.disconnect = dvb_usb_device_exit,
.id_table = nova_t_table,
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/umt-010.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/dvb-usb/umt-010.c 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/umt-010.c 2005-07-02 03:22:30.000000000 +0200
@@ -129,7 +129,7 @@ static struct dvb_usb_properties umt_pro
static struct usb_driver umt_driver = {
.owner = THIS_MODULE,
- .name = "HanfTek UMT-010 USB2.0 DVB-T devices",
+ .name = "dvb_usb_umt_010",
.probe = umt_probe,
.disconnect = dvb_usb_device_exit,
.id_table = umt_table,
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/vp7045.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/dvb-usb/vp7045.c 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/vp7045.c 2005-07-02 03:22:30.000000000 +0200
@@ -44,7 +44,7 @@ int vp7045_usb_op(struct dvb_usb_device
if (usb_control_msg(d->udev,
usb_sndctrlpipe(d->udev,0),
TH_COMMAND_OUT, USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0,
- outbuf, 20, 2*HZ) != 20) {
+ outbuf, 20, 2000) != 20) {
err("USB control message 'out' went wrong.");
ret = -EIO;
goto unlock;
@@ -55,7 +55,7 @@ int vp7045_usb_op(struct dvb_usb_device
if (usb_control_msg(d->udev,
usb_rcvctrlpipe(d->udev,0),
TH_COMMAND_IN, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0,
- inbuf, 12, 2*HZ) != 12) {
+ inbuf, 12, 2000) != 12) {
err("USB control message 'in' went wrong.");
ret = -EIO;
goto unlock;
@@ -255,7 +255,7 @@ static struct dvb_usb_properties vp7045_
/* usb specific object needed to register this driver with the usb subsystem */
static struct usb_driver vp7045_usb_driver = {
.owner = THIS_MODULE,
- .name = "dvb-usb-vp7045",
+ .name = "dvb_usb_vp7045",
.probe = vp7045_usb_probe,
.disconnect = dvb_usb_device_exit,
.id_table = vp7045_usb_table,
--
^ permalink raw reply [flat|nested] 9+ messages in thread
* [DVB patch 6/8] dst: fix tuning problem
2005-07-02 1:55 [DVB patch 0/8] DVB update Johannes Stezenbach
` (4 preceding siblings ...)
2005-07-02 1:55 ` [DVB patch 5/8] usb/pci: correct syntax of driver name fields Johannes Stezenbach
@ 2005-07-02 1:55 ` Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 7/8] usb: add supprt for WideView WT-220U Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 8/8] usb: README update Johannes Stezenbach
7 siblings, 0 replies; 9+ messages in thread
From: Johannes Stezenbach @ 2005-07-02 1:55 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Steffen Motzer, Manu Abraham
[-- Attachment #1: dvb-dst-tuning-fix.patch --]
[-- Type: text/plain, Size: 1017 bytes --]
From: Steffen Motzer <motzersn@t-link.de>
Fix tuning failure for 200103A, 200103A failed to tune to low band
due to wrong tone setting on the 200103A.
Signed-off-by: Steffen Motzer <motzersn@t-link.de>
Signed-off-by: Manu Abraham <manu@kromtek.com>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
drivers/media/dvb/bt8xx/dst.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletion(-)
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/bt8xx/dst.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/bt8xx/dst.c 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/bt8xx/dst.c 2005-07-02 03:22:31.000000000 +0200
@@ -1147,7 +1147,11 @@ static int dst_set_tone(struct dvb_front
switch (tone) {
case SEC_TONE_OFF:
- state->tx_tuna[2] = 0xff;
+ if (state->type_flags & DST_TYPE_HAS_OBS_REGS)
+ state->tx_tuna[2] = 0x00;
+ else
+ state->tx_tuna[2] = 0xff;
+
break;
case SEC_TONE_ON:
--
^ permalink raw reply [flat|nested] 9+ messages in thread
* [DVB patch 7/8] usb: add supprt for WideView WT-220U
2005-07-02 1:55 [DVB patch 0/8] DVB update Johannes Stezenbach
` (5 preceding siblings ...)
2005-07-02 1:55 ` [DVB patch 6/8] dst: fix tuning problem Johannes Stezenbach
@ 2005-07-02 1:55 ` Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 8/8] usb: README update Johannes Stezenbach
7 siblings, 0 replies; 9+ messages in thread
From: Johannes Stezenbach @ 2005-07-02 1:55 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Patrick Boettcher
[-- Attachment #1: dvb-usb-wideview-wt220u.patch --]
[-- Type: text/plain, Size: 15349 bytes --]
From: Patrick Boettcher <pb@linuxtv.org>
Add support and rewrote some parts with the help of vendor information
(Thanks to Steve Chang from WideView, Inc.):
o added support for the WT-220U (Pensize DVB-T receiver)
o corrected byte order for unc,ber and the pid filter
o corrected number of pids that can be fetched at the same time.
o added some comments in Kconfig-file
o added USB IDs for the WT-220U
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
drivers/media/dvb/dvb-usb/Kconfig | 4 +
drivers/media/dvb/dvb-usb/dtt200u-fe.c | 72 +++++++++++++-------------
drivers/media/dvb/dvb-usb/dtt200u.c | 86 +++++++++++++++++++++++++++-----
drivers/media/dvb/dvb-usb/dtt200u.h | 38 +++++---------
drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 3 -
5 files changed, 130 insertions(+), 73 deletions(-)
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/Kconfig
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/dvb-usb/Kconfig 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/Kconfig 2005-07-02 03:22:32.000000000 +0200
@@ -109,9 +109,11 @@ config DVB_USB_NOVA_T_USB2
Say Y here to support the Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 receiver.
config DVB_USB_DTT200U
- tristate "WideView/Yakumo/Hama/Typhoon/Yuan DVB-T USB2.0 support"
+ tristate "WideView WT-200U and WT-220U (pen) DVB-T USB2.0 support (Yakumo/Hama/Typhoon/Yuan)"
depends on DVB_USB
help
Say Y here to support the WideView/Yakumo/Hama/Typhoon/Yuan DVB-T USB2.0 receiver.
The receivers are also known as DTT200U (Yakumo) and UB300 (Yuan).
+
+ The WT-220U and its clones are pen-sized.
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/dtt200u-fe.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/dvb-usb/dtt200u-fe.c 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/dtt200u-fe.c 2005-07-02 03:22:32.000000000 +0200
@@ -14,61 +14,58 @@
struct dtt200u_fe_state {
struct dvb_usb_device *d;
+ fe_status_t stat;
+
struct dvb_frontend_parameters fep;
struct dvb_frontend frontend;
};
-#define moan(which,what) info("unexpected value in '%s' for cmd '%02x' - please report to linux-dvb@linuxtv.org",which,what)
-
static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat)
{
struct dtt200u_fe_state *state = fe->demodulator_priv;
- u8 bw = GET_TUNE_STAT;
- u8 br[3] = { 0 };
-// u8 bdeb[5] = { 0 };
+ u8 st = GET_TUNE_STATUS, b[3];
+
+ dvb_usb_generic_rw(state->d,&st,1,b,3,0);
- dvb_usb_generic_rw(state->d,&bw,1,br,3,0);
- switch (br[0]) {
+ switch (b[0]) {
case 0x01:
- *stat = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK;
+ *stat = FE_HAS_SIGNAL | FE_HAS_CARRIER |
+ FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK;
break;
- case 0x00:
- *stat = 0;
+ case 0x00: /* pending */
+ *stat = FE_TIMEDOUT; /* during set_frontend */
break;
default:
- moan("br[0]",GET_TUNE_STAT);
+ case 0x02: /* failed */
+ *stat = 0;
break;
}
-
-// bw[0] = 0x88;
-// dvb_usb_generic_rw(state->d,bw,1,bdeb,5,0);
-
-// deb_info("%02x: %02x %02x %02x %02x %02x\n",bw[0],bdeb[0],bdeb[1],bdeb[2],bdeb[3],bdeb[4]);
-
return 0;
}
+
static int dtt200u_fe_read_ber(struct dvb_frontend* fe, u32 *ber)
{
struct dtt200u_fe_state *state = fe->demodulator_priv;
- u8 bw = GET_BER;
- *ber = 0;
- dvb_usb_generic_rw(state->d,&bw,1,(u8*) ber,3,0);
+ u8 bw = GET_VIT_ERR_CNT,b[3];
+ dvb_usb_generic_rw(state->d,&bw,1,b,3,0);
+ *ber = (b[0] << 16) | (b[1] << 8) | b[2];
return 0;
}
static int dtt200u_fe_read_unc_blocks(struct dvb_frontend* fe, u32 *unc)
{
struct dtt200u_fe_state *state = fe->demodulator_priv;
- u8 bw = GET_UNK;
- *unc = 0;
- dvb_usb_generic_rw(state->d,&bw,1,(u8*) unc,3,0);
+ u8 bw = GET_RS_UNCOR_BLK_CNT,b[2];
+
+ dvb_usb_generic_rw(state->d,&bw,1,b,2,0);
+ *unc = (b[0] << 8) | b[1];
return 0;
}
static int dtt200u_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strength)
{
struct dtt200u_fe_state *state = fe->demodulator_priv;
- u8 bw = GET_SIG_STRENGTH, b;
+ u8 bw = GET_AGC, b;
dvb_usb_generic_rw(state->d,&bw,1,&b,1,0);
*strength = (b << 8) | b;
return 0;
@@ -86,7 +83,7 @@ static int dtt200u_fe_read_snr(struct dv
static int dtt200u_fe_init(struct dvb_frontend* fe)
{
struct dtt200u_fe_state *state = fe->demodulator_priv;
- u8 b = RESET_DEMOD;
+ u8 b = SET_INIT;
return dvb_usb_generic_write(state->d,&b,1);
}
@@ -98,8 +95,8 @@ static int dtt200u_fe_sleep(struct dvb_f
static int dtt200u_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune)
{
tune->min_delay_ms = 1500;
- tune->step_size = 166667;
- tune->max_drift = 166667 * 2;
+ tune->step_size = 0;
+ tune->max_drift = 0;
return 0;
}
@@ -107,27 +104,32 @@ static int dtt200u_fe_set_frontend(struc
struct dvb_frontend_parameters *fep)
{
struct dtt200u_fe_state *state = fe->demodulator_priv;
+ int i;
+ fe_status_t st;
u16 freq = fep->frequency / 250000;
- u8 bw,bwbuf[2] = { SET_BANDWIDTH, 0 }, freqbuf[3] = { SET_FREQUENCY, 0, 0 };
+ u8 bwbuf[2] = { SET_BANDWIDTH, 0 },freqbuf[3] = { SET_RF_FREQ, 0, 0 };
switch (fep->u.ofdm.bandwidth) {
- case BANDWIDTH_8_MHZ: bw = 8; break;
- case BANDWIDTH_7_MHZ: bw = 7; break;
- case BANDWIDTH_6_MHZ: bw = 6; break;
+ case BANDWIDTH_8_MHZ: bwbuf[1] = 8; break;
+ case BANDWIDTH_7_MHZ: bwbuf[1] = 7; break;
+ case BANDWIDTH_6_MHZ: bwbuf[1] = 6; break;
case BANDWIDTH_AUTO: return -EOPNOTSUPP;
default:
return -EINVAL;
}
- deb_info("set_frontend\n");
- bwbuf[1] = bw;
dvb_usb_generic_write(state->d,bwbuf,2);
freqbuf[1] = freq & 0xff;
freqbuf[2] = (freq >> 8) & 0xff;
dvb_usb_generic_write(state->d,freqbuf,3);
- memcpy(&state->fep,fep,sizeof(struct dvb_frontend_parameters));
+ for (i = 0; i < 30; i++) {
+ msleep(20);
+ dtt200u_fe_read_status(fe, &st);
+ if (st & FE_TIMEDOUT)
+ continue;
+ }
return 0;
}
@@ -174,7 +176,7 @@ success:
static struct dvb_frontend_ops dtt200u_fe_ops = {
.info = {
- .name = "DTT200U (Yakumo/Typhoon/Hama) DVB-T",
+ .name = "WideView USB DVB-T",
.type = FE_OFDM,
.frequency_min = 44250000,
.frequency_max = 867250000,
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/dtt200u.c
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/dvb-usb/dtt200u.c 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/dtt200u.c 2005-07-02 03:22:32.000000000 +0200
@@ -3,6 +3,8 @@
*
* Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de)
*
+ * Thanks to Steve Chang from WideView for providing support for the WT-220U.
+ *
* 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, version 2.
@@ -16,14 +18,24 @@ int dvb_usb_dtt200u_debug;
module_param_named(debug,dvb_usb_dtt200u_debug, int, 0644);
MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2 (or-able))." DVB_USB_DEBUG_STATUS);
+static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff)
+{
+ u8 b = SET_INIT;
+
+ if (onoff)
+ dvb_usb_generic_write(d,&b,2);
+
+ return 0;
+}
+
static int dtt200u_streaming_ctrl(struct dvb_usb_device *d, int onoff)
{
- u8 b_streaming[2] = { SET_TS_CTRL, onoff };
+ u8 b_streaming[2] = { SET_STREAMING, onoff };
u8 b_rst_pid = RESET_PID_FILTER;
dvb_usb_generic_write(d,b_streaming,2);
- if (!onoff)
+ if (onoff == 0)
dvb_usb_generic_write(d,&b_rst_pid,1);
return 0;
}
@@ -36,7 +48,7 @@ static int dtt200u_pid_filter(struct dvb
b_pid[0] = SET_PID_FILTER;
b_pid[1] = index;
b_pid[2] = pid & 0xff;
- b_pid[3] = (pid >> 8) & 0xff;
+ b_pid[3] = (pid >> 8) & 0x1f;
return dvb_usb_generic_write(d,b_pid,4);
}
@@ -54,9 +66,9 @@ static struct dvb_usb_rc_key dtt200u_rc_
{ 0x80, 0x08, KEY_5 },
{ 0x80, 0x09, KEY_6 },
{ 0x80, 0x0a, KEY_7 },
- { 0x00, 0x0c, KEY_ZOOM },
+ { 0x80, 0x0c, KEY_ZOOM },
{ 0x80, 0x0d, KEY_0 },
- { 0x00, 0x0e, KEY_SELECT },
+ { 0x80, 0x0e, KEY_SELECT },
{ 0x80, 0x12, KEY_POWER },
{ 0x80, 0x1a, KEY_CHANNELUP },
{ 0x80, 0x1b, KEY_8 },
@@ -66,7 +78,7 @@ static struct dvb_usb_rc_key dtt200u_rc_
static int dtt200u_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
{
- u8 key[5],cmd = GET_RC_KEY;
+ u8 key[5],cmd = GET_RC_CODE;
dvb_usb_generic_rw(d,&cmd,1,key,5,0);
dvb_usb_nec_rc_key_to_event(d,key,event,state);
if (key[0] != 0)
@@ -81,32 +93,41 @@ static int dtt200u_frontend_attach(struc
}
static struct dvb_usb_properties dtt200u_properties;
+static struct dvb_usb_properties wt220u_properties;
static int dtt200u_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
- return dvb_usb_device_init(intf,&dtt200u_properties,THIS_MODULE);
+ if (dvb_usb_device_init(intf,&dtt200u_properties,THIS_MODULE) == 0 ||
+ dvb_usb_device_init(intf,&wt220u_properties,THIS_MODULE) == 0)
+ return 0;
+
+ return -ENODEV;
}
static struct usb_device_id dtt200u_usb_table [] = {
+// { USB_DEVICE(0x04b4,0x8613) },
{ USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_DTT200U_COLD) },
{ USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_DTT200U_WARM) },
+ { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_COLD) },
+ { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_WARM) },
{ 0 },
};
MODULE_DEVICE_TABLE(usb, dtt200u_usb_table);
static struct dvb_usb_properties dtt200u_properties = {
.caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING,
- .pid_filter_count = 255, /* It is a guess, but there are at least 10 */
+ .pid_filter_count = 15,
.usb_ctrl = CYPRESS_FX2,
.firmware = "dvb-usb-dtt200u-01.fw",
+ .power_ctrl = dtt200u_power_ctrl,
.streaming_ctrl = dtt200u_streaming_ctrl,
.pid_filter = dtt200u_pid_filter,
.frontend_attach = dtt200u_frontend_attach,
- .rc_interval = 200,
+ .rc_interval = 300,
.rc_key_map = dtt200u_rc_keys,
.rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys),
.rc_query = dtt200u_rc_query,
@@ -127,7 +148,7 @@ static struct dvb_usb_properties dtt200u
.num_device_descs = 1,
.devices = {
- { .name = "WideView/Yakumo/Hama/Typhoon DVB-T USB2.0)",
+ { .name = "WideView/Yuan/Yakumo/Hama/Typhoon DVB-T USB2.0 (WT-200U)",
.cold_ids = { &dtt200u_usb_table[0], NULL },
.warm_ids = { &dtt200u_usb_table[1], NULL },
},
@@ -135,10 +156,51 @@ static struct dvb_usb_properties dtt200u
}
};
+static struct dvb_usb_properties wt220u_properties = {
+ .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING,
+ .pid_filter_count = 15,
+
+ .usb_ctrl = CYPRESS_FX2,
+ .firmware = "dvb-usb-wt220u-01.fw",
+
+ .power_ctrl = dtt200u_power_ctrl,
+ .streaming_ctrl = dtt200u_streaming_ctrl,
+ .pid_filter = dtt200u_pid_filter,
+ .frontend_attach = dtt200u_frontend_attach,
+
+ .rc_interval = 300,
+ .rc_key_map = dtt200u_rc_keys,
+ .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys),
+ .rc_query = dtt200u_rc_query,
+
+ .generic_bulk_ctrl_endpoint = 0x01,
+
+ /* parameter for the MPEG2-data transfer */
+ .urb = {
+ .type = DVB_USB_BULK,
+ .count = 7,
+ .endpoint = 0x02,
+ .u = {
+ .bulk = {
+ .buffersize = 4096,
+ }
+ }
+ },
+
+ .num_device_descs = 1,
+ .devices = {
+ { .name = "WideView WT-220U PenType Receiver (and clones)",
+ .cold_ids = { &dtt200u_usb_table[2], NULL },
+ .warm_ids = { &dtt200u_usb_table[3], NULL },
+ },
+ { 0 },
+ }
+};
+
/* usb specific object needed to register this driver with the usb subsystem */
static struct usb_driver dtt200u_usb_driver = {
.owner = THIS_MODULE,
- .name = "dtt200u",
+ .name = "dvb_usb_dtt200u",
.probe = dtt200u_usb_probe,
.disconnect = dvb_usb_device_exit,
.id_table = dtt200u_usb_table,
@@ -166,6 +228,6 @@ module_init(dtt200u_usb_module_init);
module_exit(dtt200u_usb_module_exit);
MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
-MODULE_DESCRIPTION("Driver for the WideView/Yakumo/Hama/Typhoon DVB-T USB2.0 device");
+MODULE_DESCRIPTION("Driver for the WideView/Yakumo/Hama/Typhoon DVB-T USB2.0 devices");
MODULE_VERSION("1.0");
MODULE_LICENSE("GPL");
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/dtt200u.h
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/dvb-usb/dtt200u.h 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/dtt200u.h 2005-07-02 03:22:32.000000000 +0200
@@ -22,44 +22,34 @@ extern int dvb_usb_dtt200u_debug;
/* guessed protocol description (reverse engineered):
* read
* 00 - USB type 0x02 for usb2.0, 0x01 for usb1.1
- * 81 - <TS_LOCK> <current frequency divided by 250000>
- * 82 - crash - do not touch
- * 83 - crash - do not touch
- * 84 - remote control
- * 85 - crash - do not touch (OK, stop testing here)
* 88 - locking 2 bytes (0x80 0x40 == no signal, 0x89 0x20 == nice signal)
- * 89 - noise-to-signal
- * 8a - unkown 1 byte - signal_strength
- * 8c - ber ???
- * 8d - ber
- * 8e - unc
*/
-#define GET_SPEED 0x00
-#define GET_TUNE_STAT 0x81
-#define GET_RC_KEY 0x84
-#define GET_STATUS 0x88
-#define GET_SNR 0x89
-#define GET_SIG_STRENGTH 0x8a
-#define GET_UNK 0x8c
-#define GET_BER 0x8d
-#define GET_UNC 0x8e
+#define GET_SPEED 0x00
+#define GET_TUNE_STATUS 0x81
+#define GET_RC_CODE 0x84
+#define GET_CONFIGURATION 0x88
+#define GET_AGC 0x89
+#define GET_SNR 0x8a
+#define GET_VIT_ERR_CNT 0x8c
+#define GET_RS_ERR_CNT 0x8d
+#define GET_RS_UNCOR_BLK_CNT 0x8e
/* write
- * 01 - reset the demod
+ * 01 - init
* 02 - frequency (divided by 250000)
* 03 - bandwidth
* 04 - pid table (index pid(7:0) pid(12:8))
* 05 - reset the pid table
- * 08 - demod transfer enabled or not (FX2 transfer is enabled by default)
+ * 08 - transfer switch
*/
-#define RESET_DEMOD 0x01
-#define SET_FREQUENCY 0x02
+#define SET_INIT 0x01
+#define SET_RF_FREQ 0x02
#define SET_BANDWIDTH 0x03
#define SET_PID_FILTER 0x04
#define RESET_PID_FILTER 0x05
-#define SET_TS_CTRL 0x08
+#define SET_STREAMING 0x08
extern struct dvb_frontend * dtt200u_fe_attach(struct dvb_usb_device *d);
Index: linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
===================================================================
--- linux-2.6.13-rc1-mm1.orig/drivers/media/dvb/dvb-usb/dvb-usb-ids.h 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/drivers/media/dvb/dvb-usb/dvb-usb-ids.h 2005-07-02 03:22:32.000000000 +0200
@@ -72,6 +72,8 @@
#define USB_PID_HANFTEK_UMT_010_WARM 0x0015
#define USB_PID_DTT200U_COLD 0x0201
#define USB_PID_DTT200U_WARM 0x0301
+#define USB_PID_WT220U_COLD 0x0222
+#define USB_PID_WT220U_WARM 0x0221
#define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300
#define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301
#define USB_PID_NEBULA_DIGITV 0x0201
@@ -84,5 +86,4 @@
#define USB_PID_KYE_DVB_T_COLD 0x701e
#define USB_PID_KYE_DVB_T_WARM 0x701f
-
#endif
--
^ permalink raw reply [flat|nested] 9+ messages in thread
* [DVB patch 8/8] usb: README update
2005-07-02 1:55 [DVB patch 0/8] DVB update Johannes Stezenbach
` (6 preceding siblings ...)
2005-07-02 1:55 ` [DVB patch 7/8] usb: add supprt for WideView WT-220U Johannes Stezenbach
@ 2005-07-02 1:55 ` Johannes Stezenbach
7 siblings, 0 replies; 9+ messages in thread
From: Johannes Stezenbach @ 2005-07-02 1:55 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Patrick Boettcher
[-- Attachment #1: dvb-usb-readme-update.patch --]
[-- Type: text/plain, Size: 3465 bytes --]
From: Patrick Boettcher <pb@linuxtv.org>
Updated the readme file to point to the DVB USB wikipage to find
out which firmware necessary, + minor updates.
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
Documentation/dvb/README.dvb-usb | 28 ++++++++++------------------
1 files changed, 10 insertions(+), 18 deletions(-)
Index: linux-2.6.13-rc1-mm1/Documentation/dvb/README.dvb-usb
===================================================================
--- linux-2.6.13-rc1-mm1.orig/Documentation/dvb/README.dvb-usb 2005-07-02 03:22:09.000000000 +0200
+++ linux-2.6.13-rc1-mm1/Documentation/dvb/README.dvb-usb 2005-07-02 03:22:34.000000000 +0200
@@ -48,6 +48,7 @@ cards/drivers/firmwares:
http://www.linuxtv.org/wiki/index.php/DVB_USB
0. History & News:
+ 2005-06-30 - added support for WideView WT-220U (Thanks to Steve Chang)
2005-05-30 - added basic isochronous support to the dvb-usb-framework
added support for Conexant Hybrid reference design and Nebula DigiTV USB
2005-04-17 - all dibusb devices ported to make use of the dvb-usb-framework
@@ -64,7 +65,7 @@ http://www.linuxtv.org/wiki/index.php/DV
2005-01-31 - distorted streaming is gone for USB1.1 devices
2005-01-13 - moved the mirrored pid_filter_table back to dvb-dibusb
- first almost working version for HanfTek UMT-010
- - found out, that Yakumo/HAMA/Typhoon are predessors of the HanfTek UMT-010
+ - found out, that Yakumo/HAMA/Typhoon are predecessors of the HanfTek UMT-010
2005-01-10 - refactoring completed, now everything is very delightful
- tuner quirks for some weird devices (Artec T1 AN2235 device has sometimes a
Panasonic Tuner assembled). Tunerprobing implemented. Thanks a lot to Gunnar Wittich.
@@ -114,25 +115,13 @@ http://www.linuxtv.org/wiki/index.php/DV
1. How to use?
1.1. Firmware
-Most of the USB drivers need to download a firmware to start working.
+Most of the USB drivers need to download a firmware to the device before start
+working.
-for USB1.1 (AN2135) you need: dvb-usb-dibusb-5.0.0.11.fw
-for USB2.0 HanfTek: dvb-usb-umt-010-02.fw
-for USB2.0 DiBcom: dvb-usb-dibusb-6.0.0.8.fw
-for USB2.0 AVerMedia AverTV DVB-T USB2: dvb-usb-avertv-a800-01.fw
-for USB2.0 TwinhanDTV Alpha/MagicBox II: dvb-usb-vp7045-01.fw
+Have a look at the Wikipage for the DVB-USB-drivers to find out, which firmware
+you need for your device:
-The files can be found on http://www.linuxtv.org/download/firmware/ .
-
-We do not have the permission (yet) to publish the following firmware-files.
-You'll need to extract them from the windows drivers.
-
-You should be able to use "get_dvb_firmware dvb-usb" to get the firmware:
-
-for USB1.1 (AN2235) (a few Artec T1 devices): dvb-usb-dibusb-an2235-01.fw
-for USB2.0 Hauppauge: dvb-usb-nova-t-usb2-01.fw
-for USB2.0 ADSTech/Kworld USB2.0: dvb-usb-adstech-usb2-01.fw
-for USB2.0 Yakumo/Typhoon/Hama: dvb-usb-dtt200u-01.fw
+http://www.linuxtv.org/wiki/index.php/DVB_USB
1.2. Compiling
@@ -226,6 +215,9 @@ Patches, comments and suggestions are ve
Jennifer Chen, Jeff and Jack from Twinhan for kindly supporting by
writing the vp7045-driver.
+ Steve Chang from WideView for providing information for new devices and
+ firmware files.
+
Michael Paxton for submitting remote control keymaps.
Some guys on the linux-dvb mailing list for encouraging me.
--
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-07-02 2:11 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-02 1:55 [DVB patch 0/8] DVB update Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 1/8] usb: A800 rc and timeout fixes Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 2/8] usb: dont use HZ for timeouts Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 3/8] ttpci: fix timeout handling to be save with PREEMPT Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 4/8] frontend: add driver for LGDT3302 Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 5/8] usb/pci: correct syntax of driver name fields Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 6/8] dst: fix tuning problem Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 7/8] usb: add supprt for WideView WT-220U Johannes Stezenbach
2005-07-02 1:55 ` [DVB patch 8/8] usb: README update Johannes Stezenbach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox