Add mantis DVB driver and mb86a16 and tda665x DVB front-ends,

backported by Bjørn Mork (Closes: #577264)

svn path=/dists/sid/linux-2.6/; revision=15824
This commit is contained in:
Ben Hutchings 2010-06-03 01:02:13 +00:00
parent ce47b79657
commit 4b301a8bb4
124 changed files with 21765 additions and 0 deletions

2
debian/changelog vendored
View File

@ -6,6 +6,8 @@ linux-2.6 (2.6.32-16) UNRELEASED; urgency=low
[ Ben Hutchings ]
* Add stable 2.6.32.15
* Add mantis DVB driver and mb86a16 and tda665x DVB front-ends,
backported by Bjørn Mork (Closes: #577264)
[ Aurelien Jarno ]
* [sh4] fix sh_tmu clocksource following recent nohz changes.

View File

@ -861,6 +861,13 @@ CONFIG_DVB_ISL6421=m
CONFIG_DVB_LGS8GXX=m
CONFIG_DVB_DUMMY_FE=m
##
## file: drivers/media/dvb/mantis/Kconfig
##
CONFIG_MANTIS_CORE=m
CONFIG_DVB_MANTIS=m
CONFIG_DVB_HOPPER=m
##
## file: drivers/media/dvb/pluto2/Kconfig
##

View File

@ -0,0 +1,55 @@
From fe35ee5ef79e1cd1342634fa1500a0421988b3b6 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Wed, 2 Dec 2009 21:58:38 -0300
Subject: [PATCH 002/120] V4L/DVB (13700): [MB86A16] Need a bit of settling time
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit a890cce595c86013ca1fba644c25c01b86149b23)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/frontends/mb86a16.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/frontends/mb86a16.c b/drivers/media/dvb/frontends/mb86a16.c
index 6a78a0c..e8fa908 100644
--- a/drivers/media/dvb/frontends/mb86a16.c
+++ b/drivers/media/dvb/frontends/mb86a16.c
@@ -243,11 +243,16 @@ static int initial_set(struct mb86a16_state *state)
{
if (stlp_set(state, 5, 7))
goto err;
+
+ udelay(100);
if (afcex_data_set(state, 0, 0))
goto err;
+
+ udelay(100);
if (afcofs_data_set(state, 0, 0))
goto err;
+ udelay(100);
if (mb86a16_write(state, MB86A16_CRLFILTCOEF1, 0x16) < 0)
goto err;
if (mb86a16_write(state, 0x2f, 0x21) < 0)
@@ -1149,11 +1154,12 @@ static int mb86a16_set_fe(struct mb86a16_state *state)
v, R, swp_ofs, &fOSC,
&afcex_freq, &AFCEX_L, &AFCEX_H);
+ udelay(100);
if (rf_val_set(state, fOSC, state->srate, R) < 0) {
dprintk(verbose, MB86A16_ERROR, 1, "rf val set error");
return -1;
}
-
+ udelay(100);
if (afcex_data_set(state, AFCEX_L, AFCEX_H) < 0) {
dprintk(verbose, MB86A16_ERROR, 1, "afcex data set error");
return -1;
--
1.7.1

View File

@ -0,0 +1,34 @@
From fbf94c261a933ab3acd5497a1159816045c26eef Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Wed, 2 Dec 2009 21:59:20 -0300
Subject: [PATCH 003/120] V4L/DVB (13701): [MB86A16] Reduce Carrier Recovery range to 3Mhz
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit b05c90de08b582172b8f63dd751ac0a1aee421e9)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/frontends/mb86a16.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/media/dvb/frontends/mb86a16.c b/drivers/media/dvb/frontends/mb86a16.c
index e8fa908..47c0d57 100644
--- a/drivers/media/dvb/frontends/mb86a16.c
+++ b/drivers/media/dvb/frontends/mb86a16.c
@@ -1036,8 +1036,7 @@ static int mb86a16_set_fe(struct mb86a16_state *state)
dprintk(verbose, MB86A16_INFO, 1, "freq=%d Mhz, symbrt=%d Ksps", state->frequency, state->srate);
- fcp = 5000; // (carrier recovery [kHz])
-// fcp = 3000;
+ fcp = 3000;
swp_ofs = state->srate / 4;
for (i = 0; i < 60; i++)
--
1.7.1

View File

@ -0,0 +1,42 @@
From b35828c55f84e1508afad74323fdb0550e381bd3 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Wed, 2 Dec 2009 22:00:50 -0300
Subject: [PATCH 004/120] V4L/DVB (13702): [MB86A16] need to wait a bit more than the computed time for a Factor of safety
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit e15c7ccd31faa0618478ad78e11423891919a87e)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/frontends/mb86a16.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/frontends/mb86a16.c b/drivers/media/dvb/frontends/mb86a16.c
index 47c0d57..ad03b11 100644
--- a/drivers/media/dvb/frontends/mb86a16.c
+++ b/drivers/media/dvb/frontends/mb86a16.c
@@ -417,7 +417,8 @@ static int signal_det(struct mb86a16_state *state,
int ret ;
int smrtd ;
int wait_sym ;
- int wait_t ;
+
+ u32 wait_t;
unsigned char S[3] ;
int i ;
@@ -1429,6 +1430,7 @@ static int mb86a16_set_fe(struct mb86a16_state *state)
S2T = 7; S4T = 2; S5T = 8; ETH = 7; VIA = 2;
wait_t = 7 + (2097152 + state->srate / 2) / state->srate;
}
+ wait_t *= 2; /* FOS */
S2T_set(state, S2T);
S45T_set(state, S4T, S5T);
Vi_set(state, ETH, VIA);
--
1.7.1

View File

@ -0,0 +1,33 @@
From 31aae7389d036427f3b20a84dec73a2118c75304 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Wed, 2 Dec 2009 22:01:39 -0300
Subject: [PATCH 005/120] V4L/DVB (13703): [MB86A16] Fix wrong message printed out
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 776c3ebe9678f86b9b0e72d541208bb39f9551c6)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/frontends/mb86a16.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/frontends/mb86a16.c b/drivers/media/dvb/frontends/mb86a16.c
index ad03b11..82b1271 100644
--- a/drivers/media/dvb/frontends/mb86a16.c
+++ b/drivers/media/dvb/frontends/mb86a16.c
@@ -1475,7 +1475,7 @@ static int mb86a16_set_fe(struct mb86a16_state *state)
SEQ_set(state, 1);
}
} else {
- dprintk(verbose, MB86A16_INFO, 1, "NO -- SIGNAL");
+ dprintk(verbose, MB86A16_INFO, 1, "NO -- SYNC");
SEQ_set(state, 1);
}
}
--
1.7.1

View File

@ -0,0 +1,32 @@
From 4844107b6f8acb246ce82630bcfb6e92e94b8e7c Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Wed, 2 Dec 2009 22:02:19 -0300
Subject: [PATCH 006/120] V4L/DVB (13704): [MB86A16] FIX: Don't loop again, if we have SYNC
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 071e3060a5f482e5948608d55e28bc7f5dd759cd)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/frontends/mb86a16.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/frontends/mb86a16.c b/drivers/media/dvb/frontends/mb86a16.c
index 82b1271..361e476 100644
--- a/drivers/media/dvb/frontends/mb86a16.c
+++ b/drivers/media/dvb/frontends/mb86a16.c
@@ -1487,6 +1487,7 @@ static int mb86a16_set_fe(struct mb86a16_state *state)
if (sync) {
dprintk(verbose, MB86A16_INFO, 1, "******* SYNC *******");
freqerr_chk(state, state->frequency, state->srate, 1);
+ break;
}
}
--
1.7.1

View File

@ -0,0 +1,355 @@
From 2ac08a99c42cdf87914cfb844e4a7bbdd5a9c40d Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Wed, 2 Dec 2009 22:06:15 -0300
Subject: [PATCH 007/120] V4L/DVB (13705): [Mantis] FIX: Do not return IRQ_HANDLED in the unlikely case
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit bd1fcac0148fb4a44395227edb0ff8ee31e09de1)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_pci.c | 328 +++++++++++++++++++++++++++++++++
1 files changed, 328 insertions(+), 0 deletions(-)
create mode 100644 drivers/media/dvb/mantis/mantis_pci.c
diff --git a/drivers/media/dvb/mantis/mantis_pci.c b/drivers/media/dvb/mantis/mantis_pci.c
new file mode 100644
index 0000000..68ff1b2
--- /dev/null
+++ b/drivers/media/dvb/mantis/mantis_pci.c
@@ -0,0 +1,328 @@
+/*
+ Mantis PCI bridge driver
+
+ Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@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.
+
+ 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 <asm/io.h>
+#include <asm/pgtable.h>
+#include <asm/page.h>
+#include <linux/kmod.h>
+#include <linux/vmalloc.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include "mantis_common.h"
+#include "mantis_core.h"
+
+#include <asm/irq.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/interrupt.h>
+
+unsigned int verbose = 1;
+module_param(verbose, int, 0644);
+MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)");
+
+unsigned int devs;
+
+#define PCI_VENDOR_ID_MANTIS 0x1822
+#define PCI_DEVICE_ID_MANTIS_R11 0x4e35
+#define DRIVER_NAME "Mantis"
+
+static struct pci_device_id mantis_pci_table[] = {
+ { PCI_DEVICE(PCI_VENDOR_ID_MANTIS, PCI_DEVICE_ID_MANTIS_R11) },
+ { 0 },
+};
+
+MODULE_DEVICE_TABLE(pci, mantis_pci_table);
+
+static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
+{
+ int i = 0, interrupts = 0;
+ u32 stat = 0, mask = 0, lstat = 0, mstat = 0;
+ struct mantis_pci *mantis;
+
+ mantis = (struct mantis_pci *) dev_id;
+ if (unlikely(mantis == NULL)) {
+ dprintk(verbose, MANTIS_ERROR, 1, "Mantis == NULL");
+ return IRQ_NONE;
+ }
+ stat = mmread(MANTIS_INT_STAT);
+ mask = mmread(MANTIS_INT_MASK);
+ mstat = lstat = stat & ~MANTIS_INT_RISCSTAT;
+
+ if (!(stat & mask)) {
+ dprintk(verbose, MANTIS_DEBUG, 1, "Not ours !");
+ return IRQ_NONE;
+ }
+ mmwrite(lstat, MANTIS_INT_STAT);
+ interrupts = hweight32(stat);
+ dprintk(verbose, MANTIS_DEBUG, 0, "=== Interrupts[%04x/%04x]=%d [", stat, mask, interrupts);
+
+ while (lstat) {
+ if (lstat & MANTIS_INT_RISCEN) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* DMA enabl *");
+ lstat &= ~MANTIS_INT_RISCEN;
+
+ } else if (lstat & MANTIS_INT_I2CRACK) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* I2C R-ACK *");
+ mantis->mantis_int_stat = stat;
+ mantis->mantis_int_mask = mask;
+ wake_up(&mantis->i2c_wq);
+ lstat &= ~MANTIS_INT_I2CRACK;
+
+ } else if (lstat & MANTIS_INT_PCMCIA7) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-07 *");
+ lstat &= ~MANTIS_INT_PCMCIA7;
+
+ } else if (lstat & MANTIS_INT_PCMCIA6) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-06 *");
+ lstat &= ~MANTIS_INT_PCMCIA6;
+
+ } else if (lstat & MANTIS_INT_PCMCIA5) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-05 *");
+ lstat &= ~MANTIS_INT_PCMCIA5;
+
+ } else if (lstat & MANTIS_INT_PCMCIA4) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-04 *");
+ lstat &= ~MANTIS_INT_PCMCIA4;
+
+ } else if (lstat & MANTIS_INT_PCMCIA3) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-03 *");
+ lstat &= ~MANTIS_INT_PCMCIA3;
+
+ } else if (lstat & MANTIS_INT_PCMCIA2) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-02 *");
+ lstat &= ~MANTIS_INT_PCMCIA2;
+
+ } else if (lstat & MANTIS_INT_PCMCIA1) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-01 *");
+ lstat &= ~MANTIS_INT_PCMCIA1;
+
+ } else if (lstat & MANTIS_INT_PCMCIA0) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-00 *");
+ lstat &= ~MANTIS_INT_PCMCIA0;
+
+ } else if (lstat & MANTIS_INT_IRQ0) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-0 *");
+ lstat &= ~MANTIS_INT_IRQ0;
+
+ } else if (lstat & MANTIS_INT_IRQ1) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-1 *");
+ lstat &= ~MANTIS_INT_IRQ1;
+
+ } else if (lstat & MANTIS_INT_OCERR) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* INT OCERR *");
+ lstat &= ~MANTIS_INT_OCERR;
+
+ } else if (lstat & MANTIS_INT_PABORT) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* INT PABRT *");
+ lstat &= ~MANTIS_INT_PABORT;
+
+ } else if (lstat & MANTIS_INT_RIPERR) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* INT RIPRR *");
+ lstat &= ~MANTIS_INT_RIPERR;
+
+ } else if (lstat & MANTIS_INT_PPERR) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* INT PPERR *");
+ lstat &= ~MANTIS_INT_PPERR;
+
+ } else if (lstat & MANTIS_INT_FTRGT) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* INT FTRGT *");
+ lstat &= ~MANTIS_INT_FTRGT;
+
+ } else if (lstat & MANTIS_INT_RISCI) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* INT RISCI *");
+ mantis->finished_block = (stat & MANTIS_INT_RISCSTAT) >> 28;
+ tasklet_schedule(&mantis->tasklet);
+ lstat &= ~MANTIS_INT_RISCI;
+
+ } else if (lstat & MANTIS_INT_I2CDONE) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* I2C DONE *");
+ mantis->mantis_int_stat = stat;
+ mantis->mantis_int_mask = mask;
+ lstat &= ~MANTIS_INT_I2CDONE;
+ } else {
+ dprintk(verbose, MANTIS_DEBUG, 0,
+ "* Unknown [%04x/%04x] *", stat, mask);
+ break;
+ }
+ i++;
+ if (i > interrupts) {
+ dprintk(verbose, MANTIS_ERROR, 1, "going Loopy ! -- BREAK --");
+ break;
+ }
+ }
+ dprintk(verbose, MANTIS_DEBUG, 0, "] ===\n");
+
+ return IRQ_HANDLED;
+}
+
+
+static int __devinit mantis_pci_probe(struct pci_dev *pdev,
+ const struct pci_device_id *mantis_pci_table)
+{
+ u8 revision, latency;
+ struct mantis_pci *mantis;
+ int ret = 0;
+
+ devs++;
+
+ mantis = kmalloc(sizeof (struct mantis_pci), GFP_KERNEL);
+ if (mantis == NULL) {
+ printk("%s: Out of memory\n", __func__);
+ ret = -ENOMEM;
+ goto err;
+ }
+ memset(mantis, 0, sizeof (struct mantis_pci));
+ mantis->num = devs;
+ if (pci_enable_device(pdev)) {
+ dprintk(verbose, MANTIS_ERROR, 1, "Mantis PCI enable failed");
+ ret = -ENODEV;
+ goto err;
+ }
+ mantis->mantis_addr = pci_resource_start(pdev, 0);
+ if (!request_mem_region(pci_resource_start(pdev, 0),
+ pci_resource_len(pdev, 0), DRIVER_NAME)) {
+ ret = -ENODEV;
+ goto err0;
+ }
+
+ if ((mantis->mantis_mmio = ioremap(mantis->mantis_addr, 0x1000)) == NULL) {
+ dprintk(verbose, MANTIS_ERROR, 1, "IO remap failed");
+ ret = -ENODEV;
+ goto err1;
+ }
+
+ // Clear and disable all interrupts at startup
+ // to avoid lockup situations
+ mmwrite(0x00, MANTIS_INT_MASK);
+ if (request_irq(pdev->irq, mantis_pci_irq, IRQF_SHARED | IRQF_DISABLED,
+ DRIVER_NAME, mantis) < 0) {
+
+ dprintk(verbose, MANTIS_ERROR, 1, "Mantis IRQ reg failed");
+ ret = -ENODEV;
+ goto err2;
+ }
+ pci_set_master(pdev);
+ pci_set_drvdata(pdev, mantis);
+ pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &latency);
+ pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
+ mantis->latency = latency;
+ mantis->revision = revision;
+ mantis->pdev = pdev;
+ init_waitqueue_head(&mantis->i2c_wq);
+
+ // CAM bypass
+ //mmwrite(mmread(MANTIS_INT_MASK) | MANTIS_INT_IRQ1, MANTIS_INT_MASK);
+ dprintk(verbose, MANTIS_INFO, 1, "gpif status: %04x irqcfg: %04x", mmread(0x9c), mmread(0x98));
+ if ((mmread(0x9c) & 0x200) != 0) { //CAM inserted
+ msleep_interruptible(1);
+ if ((mmread(0x9c) & 0x200) != 0)
+ mmwrite(((mmread(0x98) | 0x01) & ~0x02), 0x98);
+ else
+ mmwrite(((mmread(0x98) | 0x02) & ~0x01), 0x98);
+
+ } else {
+ mmwrite(((mmread(0x98) | 0x02) & ~0x01), 0x98);
+ }
+ mantis_set_direction(mantis, 0);
+
+ // default latency if none specified
+ if (!latency)
+ pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 32);
+ dprintk(verbose, MANTIS_ERROR, 0, "Mantis Rev %d, ",
+ mantis->revision);
+
+ dprintk(verbose, MANTIS_ERROR, 0,
+ "irq: %d, latency: %d\n memory: 0x%lx, mmio: 0x%p\n",
+ pdev->irq, mantis->latency,
+ mantis->mantis_addr, mantis->mantis_mmio);
+
+ // No more PCI specific stuff !
+ if (mantis_core_init(mantis) < 0) {
+ dprintk(verbose, MANTIS_ERROR, 1, "Mantis core init failed");
+ ret = -ENODEV;
+ goto err2;
+ }
+
+ return 0;
+
+ // Error conditions ..
+err2:
+ dprintk(verbose, MANTIS_DEBUG, 1, "Err: IO Unmap");
+ if (mantis->mantis_mmio)
+ iounmap(mantis->mantis_mmio);
+err1:
+ dprintk(verbose, MANTIS_DEBUG, 1, "Err: Release regions");
+ release_mem_region(pci_resource_start(pdev, 0),
+ pci_resource_len(pdev, 0));
+ pci_disable_device(pdev);
+err0:
+ dprintk(verbose, MANTIS_DEBUG, 1, "Err: Free");
+ kfree(mantis);
+err:
+ dprintk(verbose, MANTIS_DEBUG, 1, "Err:");
+ return ret;
+}
+
+static void __devexit mantis_pci_remove(struct pci_dev *pdev)
+{
+ struct mantis_pci *mantis = pci_get_drvdata(pdev);
+
+ if (mantis == NULL) {
+ dprintk(verbose, MANTIS_ERROR, 1, "Aeio, Mantis NULL ptr");
+ return;
+ }
+ mantis_core_exit(mantis);
+ dprintk(verbose, MANTIS_ERROR, 1, "Removing -->Mantis irq: %d, latency: %d\n memory: 0x%lx, mmio: 0x%p",
+ pdev->irq, mantis->latency, mantis->mantis_addr,
+ mantis->mantis_mmio);
+
+ free_irq(pdev->irq, mantis);
+ pci_release_regions(pdev);
+ if (mantis_dma_exit(mantis) < 0)
+ dprintk(verbose, MANTIS_ERROR, 1, "DMA exit failed");
+
+ pci_set_drvdata(pdev, NULL);
+ pci_disable_device(pdev);
+ kfree(mantis);
+}
+
+static struct pci_driver mantis_pci_driver = {
+ .name = DRIVER_NAME,
+ .id_table = mantis_pci_table,
+ .probe = mantis_pci_probe,
+ .remove = mantis_pci_remove,
+};
+
+static int __devinit mantis_pci_init(void)
+{
+ return pci_register_driver(&mantis_pci_driver);
+}
+
+static void __devexit mantis_pci_exit(void)
+{
+ pci_unregister_driver(&mantis_pci_driver);
+}
+
+module_init(mantis_pci_init);
+module_exit(mantis_pci_exit);
+
+MODULE_DESCRIPTION("Mantis PCI DTV bridge driver");
+MODULE_AUTHOR("Manu Abraham");
+MODULE_LICENSE("GPL");
--
1.7.1

View File

@ -0,0 +1,807 @@
From e3f2c48d4b2eabd87147855967d5dadccda8dc3c Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Wed, 2 Dec 2009 22:07:24 -0300
Subject: [PATCH 008/120] V4L/DVB (13706): [MB86A16] Overhaul
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* better ISR handling
* I2C fixes
* better handling of configurations
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit df0cca174b4d85ea041509a13e5e68b377758bf1)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_common.h | 14 ++-
drivers/media/dvb/mantis/mantis_core.c | 95 ++++++++---------
drivers/media/dvb/mantis/mantis_dvb.c | 13 +--
drivers/media/dvb/mantis/mantis_i2c.c | 68 +++++-------
drivers/media/dvb/mantis/mantis_pci.c | 170 +++++++++++-------------------
drivers/media/dvb/mantis/mantis_vp1033.c | 8 ++
drivers/media/dvb/mantis/mantis_vp1033.h | 6 +-
drivers/media/dvb/mantis/mantis_vp1034.c | 8 ++
drivers/media/dvb/mantis/mantis_vp1034.h | 7 +-
drivers/media/dvb/mantis/mantis_vp2033.c | 20 +++-
drivers/media/dvb/mantis/mantis_vp2033.h | 6 +-
drivers/media/dvb/mantis/mantis_vp3030.c | 10 ++-
drivers/media/dvb/mantis/mantis_vp3030.h | 8 +-
13 files changed, 215 insertions(+), 218 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index ba360f8..60a7457 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -65,10 +65,19 @@
#define mmaor(dat, addr) mmwrite((dat) | ((mask) & mmread(addr)), addr)
+struct mantis_hwconfig {
+ char *model_name;
+ char *dev_type;
+};
+
+
struct mantis_pci {
/* PCI stuff */
u16 vendor_id;
u16 device_id;
+ u16 subsystem_vendor;
+ u16 subsystem_device;
+
u8 latency;
struct pci_dev *pdev;
@@ -110,7 +119,7 @@ struct mantis_pci {
u8 feeds;
- struct mantis_config *config;
+ struct mantis_hwconfig *hwconfig;
u32 mantis_int_stat;
u32 mantis_int_mask;
@@ -121,7 +130,8 @@ struct mantis_pci {
u32 sub_device_id;
/* A12 A13 A14 */
- int gpio_status;};
+ int gpio_status;
+};
extern unsigned int verbose;
extern unsigned int devs;
diff --git a/drivers/media/dvb/mantis/mantis_core.c b/drivers/media/dvb/mantis/mantis_core.c
index 1112277..1012959 100644
--- a/drivers/media/dvb/mantis/mantis_core.c
+++ b/drivers/media/dvb/mantis/mantis_core.c
@@ -20,7 +20,10 @@
#include "mantis_common.h"
#include "mantis_core.h"
-
+#include "mantis_vp1033.h"
+#include "mantis_vp1034.h"
+#include "mantis_vp2033.h"
+#include "mantis_vp3030.h"
static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
{
@@ -45,7 +48,7 @@ static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
return err;
}
- msleep_interruptible(2);
+// msleep_interruptible(2);
return 0;
}
@@ -72,41 +75,6 @@ static int write_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
return 0;
}
-static int get_subdevice_id(struct mantis_pci *mantis)
-{
- int err;
- static u8 sub_device_id[2];
-
- mantis->sub_device_id = 0;
- sub_device_id[0] = 0xfc;
- if ((err = read_eeprom_byte(mantis, &sub_device_id[0], 2)) < 0) {
- dprintk(verbose, MANTIS_ERROR, 1, "Mantis EEPROM read error");
- return err;
- }
- mantis->sub_device_id = (sub_device_id[0] << 8) | sub_device_id[1];
- dprintk(verbose, MANTIS_ERROR, 1, "Sub Device ID=[0x%04x]",
- mantis->sub_device_id);
-
- return 0;
-}
-
-static int get_subvendor_id(struct mantis_pci *mantis)
-{
- int err;
- static u8 sub_vendor_id[2];
-
- mantis->sub_vendor_id = 0;
- sub_vendor_id[0] = 0xfe;
- if ((err = read_eeprom_byte(mantis, &sub_vendor_id[0], 2)) < 0) {
- dprintk(verbose, MANTIS_ERROR, 1, "Mantis EEPROM read error");
- return err;
- }
- mantis->sub_vendor_id = (sub_vendor_id[0] << 8) | sub_vendor_id[1];
- dprintk(verbose, MANTIS_ERROR, 1, "Sub Vendor ID=[0x%04x]",
- mantis->sub_vendor_id);
-
- return 0;
-}
static int get_mac_address(struct mantis_pci *mantis)
{
@@ -118,8 +86,8 @@ static int get_mac_address(struct mantis_pci *mantis)
return err;
}
- dprintk(verbose, MANTIS_ERROR, 1,
- "MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]",
+ dprintk(verbose, MANTIS_ERROR, 0,
+ " MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]\n",
mantis->mac_address[0], mantis->mac_address[1],
mantis->mac_address[2], mantis->mac_address[3],
mantis->mac_address[4], mantis->mac_address[5]);
@@ -127,11 +95,51 @@ static int get_mac_address(struct mantis_pci *mantis)
return 0;
}
+#define MANTIS_MODEL_UNKNOWN "UNKNOWN"
+#define MANTIS_DEV_UNKNOWN "UNKNOWN"
+
+struct mantis_hwconfig unknown_device = {
+ .model_name = MANTIS_MODEL_UNKNOWN,
+ .dev_type = MANTIS_DEV_UNKNOWN,
+};
+
+static void mantis_load_config(struct mantis_pci *mantis)
+{
+ switch (mantis->subsystem_device) {
+ case MANTIS_VP_1033_DVB_S: // VP-1033
+ mantis->hwconfig = &vp1033_mantis_config;
+ break;
+ case MANTIS_VP_1034_DVB_S: // VP-1034
+ mantis->hwconfig = &vp1034_mantis_config;
+ break;
+ case MANTIS_VP_2033_DVB_C: // VP-2033
+ mantis->hwconfig = &vp2033_mantis_config;
+ break;
+ case MANTIS_VP_3030_DVB_T: // VP-3030
+ mantis->hwconfig = &vp3030_mantis_config;
+ break;
+ default:
+ mantis->hwconfig = &unknown_device;
+ break;
+ }
+}
int mantis_core_init(struct mantis_pci *mantis)
{
int err = 0;
+ mantis_load_config(mantis);
+ dprintk(verbose, MANTIS_ERROR, 0, "found a %s PCI %s device on (%02x:%02x.%x),\n",
+ mantis->hwconfig->model_name, mantis->hwconfig->dev_type,
+ mantis->pdev->bus->number, PCI_SLOT(mantis->pdev->devfn), PCI_FUNC(mantis->pdev->devfn));
+ dprintk(verbose, MANTIS_ERROR, 0, " Mantis Rev %d [%04x:%04x], ",
+ mantis->revision,
+ mantis->subsystem_vendor, mantis->subsystem_device);
+ dprintk(verbose, MANTIS_ERROR, 0,
+ "irq: %d, latency: %d\n memory: 0x%lx, mmio: 0x%p\n",
+ mantis->pdev->irq, mantis->latency,
+ mantis->mantis_addr, mantis->mantis_mmio);
+
if ((err = mantis_i2c_init(mantis)) < 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Mantis I2C init failed");
return err;
@@ -140,14 +148,6 @@ int mantis_core_init(struct mantis_pci *mantis)
dprintk(verbose, MANTIS_ERROR, 1, "get MAC address failed");
return err;
}
- if ((err = get_subvendor_id(mantis)) < 0) {
- dprintk(verbose, MANTIS_ERROR, 1, "get Sub vendor ID failed");
- return err;
- }
- if ((err = get_subdevice_id(mantis)) < 0) {
- dprintk(verbose, MANTIS_ERROR, 1, "get Sub device ID failed");
- return err;
- }
if ((err = mantis_dma_init(mantis)) < 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Mantis DMA init failed");
return err;
@@ -162,7 +162,6 @@ int mantis_core_init(struct mantis_pci *mantis)
int mantis_core_exit(struct mantis_pci *mantis)
{
-
mantis_dma_stop(mantis);
dprintk(verbose, MANTIS_ERROR, 1, "DMA engine stopping");
if (mantis_dma_exit(mantis) < 0)
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c
index 5830d4a..319bb8b 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -206,22 +206,13 @@ err0:
return result;
}
-#define MANTIS_VP_1027_DVB_S 0x0013
-#define MANTIS_VP_1033_DVB_S 0x0016
-#define MANTIS_VP_1034_DVB_S 0x0014
-#define MANTIS_VP_1040_DVB_S2
-#define MANTIS_VP_1041_DVB_S2
-#define MANTIS_VP_2033_DVB_C 0x0008
-#define MANTIS_VP_3024_DVB_T 0x0009
-#define MANTIS_VP_3030_DVB_T 0x0024
-
int __devinit mantis_frontend_init(struct mantis_pci *mantis)
{
dprintk(verbose, MANTIS_DEBUG, 1, "Mantis frontend Init");
mantis_fe_powerup(mantis);
mantis_frontend_reset(mantis);
- dprintk(verbose, MANTIS_DEBUG, 1, "Device ID=%02x", mantis->sub_device_id);
- switch (mantis->sub_device_id) {
+ dprintk(verbose, MANTIS_DEBUG, 1, "Device ID=%02x", mantis->subsystem_device);
+ switch (mantis->subsystem_device) {
case MANTIS_VP_1033_DVB_S: // VP-1033
dprintk(verbose, MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)");
mantis->fe = stv0299_attach(&lgtdqcs001f_config,
diff --git a/drivers/media/dvb/mantis/mantis_i2c.c b/drivers/media/dvb/mantis/mantis_i2c.c
index cfecb34..8b90a2a 100644
--- a/drivers/media/dvb/mantis/mantis_i2c.c
+++ b/drivers/media/dvb/mantis/mantis_i2c.c
@@ -33,32 +33,27 @@
static int mantis_ack_wait(struct mantis_pci *mantis)
{
int rc = 0;
+ u32 timeout = 0;
if (wait_event_interruptible_timeout(mantis->i2c_wq,
- mantis->mantis_int_stat & MANTIS_INT_I2CRACK,
- msecs_to_jiffies(50)) == -ERESTARTSYS)
+ mantis->mantis_int_stat & MANTIS_INT_I2CDONE,
+ msecs_to_jiffies(50)) == -ERESTARTSYS) {
+ dprintk(verbose, MANTIS_DEBUG, 1, "I2C Transfer failed, Master !I2CDONE");
rc = -EREMOTEIO;
-/*
- // Wait till we are done
- while (mantis->mantis_int_stat & MANTIS_INT_I2CRACK){
- if (mantis->mantis_int_stat & MANTIS_INT_I2CDONE) {
- mantis->mantis_int_stat &= ~MANTIS_INT_I2CRACK;
-// dprintk(verbose, MANTIS_DEBUG, 1, "SLAVE RACK 'ed .. Waiting for I2CDONE");
+ }
+ while (!(mantis->mantis_int_stat & MANTIS_INT_I2CRACK)) {
+ dprintk(verbose, MANTIS_DEBUG, 1, "Waiting for Slave RACK");
+ mantis->mantis_int_stat = mmread(MANTIS_INT_STAT);
+ msleep(5);
+ timeout++;
+ if (timeout > 500) {
+ dprintk(verbose, MANTIS_ERROR, 1, "Slave RACK Fail !");
+ rc = -EREMOTEIO;
break;
}
}
-
- if (mantis->mantis_int_stat & MANTIS_INT_I2CDONE) {
-// dprintk(verbose, MANTIS_DEBUG, 1, "Mantis Int I2CDONE");
- rc = 1;
- }
-
- mantis->mantis_int_stat &= ~MANTIS_INT_I2CDONE;
-*/
- // ..
- if (mantis->mantis_int_stat & MANTIS_INT_I2CRACK)
- msleep_interruptible(10);
+ udelay(350);
return rc;
}
@@ -67,7 +62,7 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
{
u32 rxd, i;
- dprintk(verbose, MANTIS_DEBUG, 1, "Address=[0x%02x]", msg->addr);
+ dprintk(verbose, MANTIS_INFO, 0, " %s: Address=[0x%02x] <R>[ ", __func__, msg->addr);
for (i = 0; i < msg->len; i++) {
rxd = (msg->addr << 25) | (1 << 24)
| MANTIS_I2C_RATE_3
@@ -77,18 +72,17 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
if (i == (msg->len - 1))
rxd &= ~MANTIS_I2C_STOP;
+ mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT);
mmwrite(rxd, MANTIS_I2CDATA_CTL);
- if (mantis_ack_wait(mantis) < 0) {
+ if (mantis_ack_wait(mantis) != 0) {
dprintk(verbose, MANTIS_DEBUG, 1, "ACK failed<R>");
- return -EIO;
+ return -EREMOTEIO;
}
rxd = mmread(MANTIS_I2CDATA_CTL);
msg->buf[i] = (u8)((rxd >> 8) & 0xFF);
- dprintk(verbose, MANTIS_DEBUG, 1,
- "Data<R[%d]>=[0x%02x]", i, msg->buf[i]);
-
- msleep_interruptible(2);
+ dprintk(verbose, MANTIS_INFO, 0, "%02x ", msg->buf[i]);
}
+ dprintk(verbose, MANTIS_INFO, 0, "]\n");
return 0;
}
@@ -98,9 +92,9 @@ static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg
int i;
u32 txd = 0;
- dprintk(verbose, MANTIS_DEBUG, 1, "Address=[0x%02x]", msg->addr);
+ dprintk(verbose, MANTIS_INFO, 0, " %s: Address=[0x%02x] <W>[ ", __func__, msg->addr);
for (i = 0; i < msg->len; i++) {
- dprintk(verbose, MANTIS_DEBUG, 1, "Data<W[%d]>=[0x%02x]", i, msg->buf[i]);
+ dprintk(verbose, MANTIS_INFO, 0, "%02x ", msg->buf[i]);
txd = (msg->addr << 25) | (msg->buf[i] << 8)
| MANTIS_I2C_RATE_3
| MANTIS_I2C_STOP
@@ -109,13 +103,14 @@ static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg
if (i == (msg->len - 1))
txd &= ~MANTIS_I2C_STOP;
+ mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT);
mmwrite(txd, MANTIS_I2CDATA_CTL);
- if (mantis_ack_wait(mantis) < 0) {
+ if (mantis_ack_wait(mantis) != 0) {
dprintk(verbose, MANTIS_DEBUG, 1, "ACK failed<W>");
- return -1;
+ return -EREMOTEIO;
}
- udelay(500);
}
+ dprintk(verbose, MANTIS_INFO, 0, "]\n");
return 0;
}
@@ -159,7 +154,7 @@ static struct i2c_adapter mantis_i2c_adapter = {
int __devinit mantis_i2c_init(struct mantis_pci *mantis)
{
- u32 intstat;
+ u32 intstat, intmask;
memcpy(&mantis->adapter, &mantis_i2c_adapter, sizeof (mantis_i2c_adapter));
i2c_set_adapdata(&mantis->adapter, mantis);
@@ -169,15 +164,12 @@ int __devinit mantis_i2c_init(struct mantis_pci *mantis)
dprintk(verbose, MANTIS_DEBUG, 1, "Initializing I2C ..");
- // Clear all interrupts
intstat = mmread(MANTIS_INT_STAT);
+ intmask = mmread(MANTIS_INT_MASK);
mmwrite(intstat, MANTIS_INT_STAT);
+ mmwrite(intmask | MANTIS_INT_I2CDONE, MANTIS_INT_MASK);
- mmwrite(mmread(MANTIS_INT_MASK) | MANTIS_INT_I2CDONE,
- MANTIS_INT_MASK);
-
- dprintk(verbose, MANTIS_DEBUG, 1, "[0x%08x/%08x]",
- mmread(MANTIS_INT_STAT), mmread(MANTIS_INT_MASK));
+ dprintk(verbose, MANTIS_DEBUG, 1, "[0x%08x/%08x]", intstat, intmask);
return 0;
}
diff --git a/drivers/media/dvb/mantis/mantis_pci.c b/drivers/media/dvb/mantis/mantis_pci.c
index 68ff1b2..0bc25d2 100644
--- a/drivers/media/dvb/mantis/mantis_pci.c
+++ b/drivers/media/dvb/mantis/mantis_pci.c
@@ -52,7 +52,6 @@ MODULE_DEVICE_TABLE(pci, mantis_pci_table);
static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
{
- int i = 0, interrupts = 0;
u32 stat = 0, mask = 0, lstat = 0, mstat = 0;
struct mantis_pci *mantis;
@@ -64,109 +63,67 @@ static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
stat = mmread(MANTIS_INT_STAT);
mask = mmread(MANTIS_INT_MASK);
mstat = lstat = stat & ~MANTIS_INT_RISCSTAT;
-
- if (!(stat & mask)) {
- dprintk(verbose, MANTIS_DEBUG, 1, "Not ours !");
+ if (!(stat & mask))
return IRQ_NONE;
+
+ mantis->mantis_int_stat = stat;
+ mantis->mantis_int_mask = mask;
+ dprintk(verbose, MANTIS_DEBUG, 0, "=== Interrupts[%04x/%04x]= [", stat, mask);
+ if (stat & MANTIS_INT_RISCEN) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* DMA enabl *");
+ }
+ if (stat & MANTIS_INT_I2CRACK) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* I2C R-ACK *");
+// wake_up(&mantis->i2c_wq);
+ }
+ if (stat & MANTIS_INT_PCMCIA7) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-07 *");
+ }
+ if (stat & MANTIS_INT_IRQ0) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-0 *");
+ }
+ if (stat & MANTIS_INT_IRQ1) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-1 *");
+ }
+ if (stat & MANTIS_INT_OCERR) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* INT OCERR *");
+ }
+ if (stat & MANTIS_INT_PABORT) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* INT PABRT *");
+ }
+ if (stat & MANTIS_INT_RIPERR) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* INT RIPRR *");
}
- mmwrite(lstat, MANTIS_INT_STAT);
- interrupts = hweight32(stat);
- dprintk(verbose, MANTIS_DEBUG, 0, "=== Interrupts[%04x/%04x]=%d [", stat, mask, interrupts);
-
- while (lstat) {
- if (lstat & MANTIS_INT_RISCEN) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* DMA enabl *");
- lstat &= ~MANTIS_INT_RISCEN;
-
- } else if (lstat & MANTIS_INT_I2CRACK) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* I2C R-ACK *");
- mantis->mantis_int_stat = stat;
- mantis->mantis_int_mask = mask;
- wake_up(&mantis->i2c_wq);
- lstat &= ~MANTIS_INT_I2CRACK;
-
- } else if (lstat & MANTIS_INT_PCMCIA7) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-07 *");
- lstat &= ~MANTIS_INT_PCMCIA7;
-
- } else if (lstat & MANTIS_INT_PCMCIA6) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-06 *");
- lstat &= ~MANTIS_INT_PCMCIA6;
-
- } else if (lstat & MANTIS_INT_PCMCIA5) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-05 *");
- lstat &= ~MANTIS_INT_PCMCIA5;
-
- } else if (lstat & MANTIS_INT_PCMCIA4) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-04 *");
- lstat &= ~MANTIS_INT_PCMCIA4;
-
- } else if (lstat & MANTIS_INT_PCMCIA3) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-03 *");
- lstat &= ~MANTIS_INT_PCMCIA3;
-
- } else if (lstat & MANTIS_INT_PCMCIA2) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-02 *");
- lstat &= ~MANTIS_INT_PCMCIA2;
-
- } else if (lstat & MANTIS_INT_PCMCIA1) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-01 *");
- lstat &= ~MANTIS_INT_PCMCIA1;
-
- } else if (lstat & MANTIS_INT_PCMCIA0) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-00 *");
- lstat &= ~MANTIS_INT_PCMCIA0;
-
- } else if (lstat & MANTIS_INT_IRQ0) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-0 *");
- lstat &= ~MANTIS_INT_IRQ0;
-
- } else if (lstat & MANTIS_INT_IRQ1) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-1 *");
- lstat &= ~MANTIS_INT_IRQ1;
-
- } else if (lstat & MANTIS_INT_OCERR) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* INT OCERR *");
- lstat &= ~MANTIS_INT_OCERR;
-
- } else if (lstat & MANTIS_INT_PABORT) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* INT PABRT *");
- lstat &= ~MANTIS_INT_PABORT;
-
- } else if (lstat & MANTIS_INT_RIPERR) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* INT RIPRR *");
- lstat &= ~MANTIS_INT_RIPERR;
-
- } else if (lstat & MANTIS_INT_PPERR) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* INT PPERR *");
- lstat &= ~MANTIS_INT_PPERR;
-
- } else if (lstat & MANTIS_INT_FTRGT) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* INT FTRGT *");
- lstat &= ~MANTIS_INT_FTRGT;
-
- } else if (lstat & MANTIS_INT_RISCI) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* INT RISCI *");
- mantis->finished_block = (stat & MANTIS_INT_RISCSTAT) >> 28;
- tasklet_schedule(&mantis->tasklet);
- lstat &= ~MANTIS_INT_RISCI;
-
- } else if (lstat & MANTIS_INT_I2CDONE) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* I2C DONE *");
- mantis->mantis_int_stat = stat;
- mantis->mantis_int_mask = mask;
- lstat &= ~MANTIS_INT_I2CDONE;
- } else {
- dprintk(verbose, MANTIS_DEBUG, 0,
- "* Unknown [%04x/%04x] *", stat, mask);
- break;
- }
- i++;
- if (i > interrupts) {
- dprintk(verbose, MANTIS_ERROR, 1, "going Loopy ! -- BREAK --");
- break;
- }
+ if (stat & MANTIS_INT_PPERR) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* INT PPERR *");
}
+ if (stat & MANTIS_INT_FTRGT) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* INT FTRGT *");
+ }
+ if (stat & MANTIS_INT_RISCI) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* INT RISCI *");
+ mantis->finished_block = (stat & MANTIS_INT_RISCSTAT) >> 28;
+ tasklet_schedule(&mantis->tasklet);
+ }
+ if (stat & MANTIS_INT_I2CDONE) {
+ dprintk(verbose, MANTIS_DEBUG, 0, "* I2C DONE *");
+ wake_up(&mantis->i2c_wq);
+ }
+ mmwrite(stat, MANTIS_INT_STAT);
+ stat &= ~(MANTIS_INT_RISCEN | MANTIS_INT_I2CDONE |
+ MANTIS_INT_I2CRACK | MANTIS_INT_PCMCIA7 |
+ MANTIS_INT_PCMCIA6 | MANTIS_INT_PCMCIA5 |
+ MANTIS_INT_PCMCIA4 | MANTIS_INT_PCMCIA3 |
+ MANTIS_INT_PCMCIA2 | MANTIS_INT_PCMCIA1 |
+ MANTIS_INT_PCMCIA0 | MANTIS_INT_IRQ1 |
+ MANTIS_INT_IRQ0 | MANTIS_INT_OCERR |
+ MANTIS_INT_PABORT | MANTIS_INT_RIPERR |
+ MANTIS_INT_PPERR | MANTIS_INT_FTRGT |
+ MANTIS_INT_RISCI);
+
+ if (stat)
+ dprintk(verbose, MANTIS_DEBUG, 0, "* Unknown [%04x] *", stat);
+
dprintk(verbose, MANTIS_DEBUG, 0, "] ===\n");
return IRQ_HANDLED;
@@ -180,8 +137,6 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
struct mantis_pci *mantis;
int ret = 0;
- devs++;
-
mantis = kmalloc(sizeof (struct mantis_pci), GFP_KERNEL);
if (mantis == NULL) {
printk("%s: Out of memory\n", __func__);
@@ -190,6 +145,8 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
}
memset(mantis, 0, sizeof (struct mantis_pci));
mantis->num = devs;
+ devs++;
+
if (pci_enable_device(pdev)) {
dprintk(verbose, MANTIS_ERROR, 1, "Mantis PCI enable failed");
ret = -ENODEV;
@@ -225,11 +182,13 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
mantis->latency = latency;
mantis->revision = revision;
mantis->pdev = pdev;
+ mantis->subsystem_vendor = pdev->subsystem_vendor;
+ mantis->subsystem_device = pdev->subsystem_device;
init_waitqueue_head(&mantis->i2c_wq);
// CAM bypass
//mmwrite(mmread(MANTIS_INT_MASK) | MANTIS_INT_IRQ1, MANTIS_INT_MASK);
- dprintk(verbose, MANTIS_INFO, 1, "gpif status: %04x irqcfg: %04x", mmread(0x9c), mmread(0x98));
+ dprintk(verbose, MANTIS_INFO, 0, "\ngpif status: %04x irqcfg: %04x\n", mmread(0x9c), mmread(0x98));
if ((mmread(0x9c) & 0x200) != 0) { //CAM inserted
msleep_interruptible(1);
if ((mmread(0x9c) & 0x200) != 0)
@@ -242,11 +201,8 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
}
mantis_set_direction(mantis, 0);
- // default latency if none specified
if (!latency)
pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 32);
- dprintk(verbose, MANTIS_ERROR, 0, "Mantis Rev %d, ",
- mantis->revision);
dprintk(verbose, MANTIS_ERROR, 0,
"irq: %d, latency: %d\n memory: 0x%lx, mmio: 0x%p\n",
diff --git a/drivers/media/dvb/mantis/mantis_vp1033.c b/drivers/media/dvb/mantis/mantis_vp1033.c
index 720f4fb..07fcc45 100644
--- a/drivers/media/dvb/mantis/mantis_vp1033.c
+++ b/drivers/media/dvb/mantis/mantis_vp1033.c
@@ -81,6 +81,14 @@ struct stv0299_config lgtdqcs001f_config = {
// .pll_set = lgtdqcs001f_pll_set,
};
+#define MANTIS_MODEL_NAME "VP-1033"
+#define MANTIS_DEV_TYPE "DVB-S/DSS"
+
+struct mantis_hwconfig vp1033_mantis_config = {
+ .model_name = MANTIS_MODEL_NAME,
+ .dev_type = MANTIS_DEV_TYPE,
+};
+
int lgtdqcs001f_tuner_set(struct dvb_frontend *fe,
struct dvb_frontend_parameters *params)
{
diff --git a/drivers/media/dvb/mantis/mantis_vp1033.h b/drivers/media/dvb/mantis/mantis_vp1033.h
index d50f092..e245706 100644
--- a/drivers/media/dvb/mantis/mantis_vp1033.h
+++ b/drivers/media/dvb/mantis/mantis_vp1033.h
@@ -21,10 +21,14 @@
#ifndef __MANTIS_VP1033_H
#define __MANTIS_VP1033_H
-#include "stv0299.h"
#include "dvb_frontend.h"
+#include "mantis_common.h"
+#include "stv0299.h"
+
+#define MANTIS_VP_1033_DVB_S 0x0016
extern struct stv0299_config lgtdqcs001f_config;
+extern struct mantis_hwconfig vp1033_mantis_config;
extern int lgtdqcs001f_tuner_set(struct dvb_frontend *fe,
struct dvb_frontend_parameters *params);
diff --git a/drivers/media/dvb/mantis/mantis_vp1034.c b/drivers/media/dvb/mantis/mantis_vp1034.c
index b85ac29..c9c9479 100644
--- a/drivers/media/dvb/mantis/mantis_vp1034.c
+++ b/drivers/media/dvb/mantis/mantis_vp1034.c
@@ -26,6 +26,14 @@ struct mb86a16_config vp1034_config = {
.set_voltage = vp1034_set_voltage,
};
+#define MANTIS_MODEL_NAME "VP-1034"
+#define MANTIS_DEV_TYPE "DVB-S/DSS"
+
+struct mantis_hwconfig vp1034_mantis_config = {
+ .model_name = MANTIS_MODEL_NAME,
+ .dev_type = MANTIS_DEV_TYPE,
+};
+
int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
{
struct mantis_pci *mantis = fe->dvb->priv;
diff --git a/drivers/media/dvb/mantis/mantis_vp1034.h b/drivers/media/dvb/mantis/mantis_vp1034.h
index 2324dad..2194857 100644
--- a/drivers/media/dvb/mantis/mantis_vp1034.h
+++ b/drivers/media/dvb/mantis/mantis_vp1034.h
@@ -21,9 +21,14 @@
#ifndef __MANTIS_VP1034_H
#define __MANTIS_VP1034_H
-#include "mb86a16.h"
#include "dvb_frontend.h"
+#include "mantis_common.h"
+#include "mb86a16.h"
+
+
+#define MANTIS_VP_1034_DVB_S 0x0014
+extern struct mantis_hwconfig vp1034_mantis_config;
extern struct mb86a16_config vp1034_config;
extern int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage);
diff --git a/drivers/media/dvb/mantis/mantis_vp2033.c b/drivers/media/dvb/mantis/mantis_vp2033.c
index bca9eba..e989597 100644
--- a/drivers/media/dvb/mantis/mantis_vp2033.c
+++ b/drivers/media/dvb/mantis/mantis_vp2033.c
@@ -32,9 +32,17 @@ struct tda10021_state {
u8 reg0;
};
+#define MANTIS_MODEL_NAME "VP-2033"
+#define MANTIS_DEV_TYPE "DVB-C"
+
+struct mantis_hwconfig vp2033_mantis_config = {
+ .model_name = MANTIS_MODEL_NAME,
+ .dev_type = MANTIS_DEV_TYPE,
+};
+
struct cu1216_config philips_cu1216_config = {
- .demod_address = 0x18 >> 1,
- .pll_set = philips_cu1216_tuner_set,
+ .demod_address = 0x18 >> 1,
+ .pll_set = philips_cu1216_tuner_set,
// .fe_reset = mantis_fe_reset,
};
@@ -47,10 +55,10 @@ int philips_cu1216_tuner_set(struct dvb_frontend *fe,
u8 buf[4];
struct i2c_msg msg = {
- .addr = 0xc0 >> 1,
- .flags = 0,
- .buf = buf,
- .len = sizeof (buf)
+ .addr = 0xc0 >> 1,
+ .flags = 0,
+ .buf = buf,
+ .len = sizeof (buf)
};
#define TUNER_MUL 62500
diff --git a/drivers/media/dvb/mantis/mantis_vp2033.h b/drivers/media/dvb/mantis/mantis_vp2033.h
index 29baba1..513c491 100644
--- a/drivers/media/dvb/mantis/mantis_vp2033.h
+++ b/drivers/media/dvb/mantis/mantis_vp2033.h
@@ -21,10 +21,14 @@
#ifndef __MANTIS_VP2033_H
#define __MANTIS_VP2033_H
-#include "cu1216.h"
#include "dvb_frontend.h"
+#include "mantis_common.h"
+#include "cu1216.h"
+
+#define MANTIS_VP_2033_DVB_C 0x0008
extern struct cu1216_config philips_cu1216_config;
+extern struct mantis_hwconfig vp2033_mantis_config;
extern int philips_cu1216_tuner_set(struct dvb_frontend *fe,
struct dvb_frontend_parameters *params);
diff --git a/drivers/media/dvb/mantis/mantis_vp3030.c b/drivers/media/dvb/mantis/mantis_vp3030.c
index f44f226..8043e5d 100644
--- a/drivers/media/dvb/mantis/mantis_vp3030.c
+++ b/drivers/media/dvb/mantis/mantis_vp3030.c
@@ -22,7 +22,15 @@
#include "mantis_vp3030.h"
struct zl10353_config mantis_vp3030_config = {
- .demod_address = 0x0f,
+ .demod_address = 0x0f,
+};
+
+#define MANTIS_MODEL_NAME "VP-3030"
+#define MANTIS_DEV_TYPE "DVB-T"
+
+struct mantis_hwconfig vp3030_mantis_config = {
+ .model_name = MANTIS_MODEL_NAME,
+ .dev_type = MANTIS_DEV_TYPE,
};
int panasonic_en57h12d5_set_params(struct dvb_frontend *fe,
diff --git a/drivers/media/dvb/mantis/mantis_vp3030.h b/drivers/media/dvb/mantis/mantis_vp3030.h
index f8e72cc..acc50a4 100644
--- a/drivers/media/dvb/mantis/mantis_vp3030.h
+++ b/drivers/media/dvb/mantis/mantis_vp3030.h
@@ -21,10 +21,14 @@
#ifndef __MANTIS_VP3030_H
#define __MANTIS_VP3030_H
-#include "zl10353.h"
-#include "dvb-pll.h"
#include "dvb_frontend.h"
+#include "mantis_common.h"
+#include "dvb-pll.h"
+#include "zl10353.h"
+
+#define MANTIS_VP_3030_DVB_T 0x0024
extern struct zl10353_config mantis_vp3030_config;
+extern struct mantis_hwconfig vp3030_mantis_config;
#endif // __MANTIS_VP3030_H
--
1.7.1

View File

@ -0,0 +1,44 @@
From e550152089a3e43bcfd98b77e3277fe9011818aa Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Wed, 2 Dec 2009 22:09:53 -0300
Subject: [PATCH 009/120] V4L/DVB (13707): [Mantis] Whitespace cleanup
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 55172773c57221c7c81e445d04f811f2f0478c3e)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_common.h | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index 60a7457..d39cbe0 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -83,7 +83,7 @@ struct mantis_pci {
struct pci_dev *pdev;
unsigned long mantis_addr;
- volatile void __iomem *mantis_mmio;
+ volatile void __iomem *mantis_mmio;
u8 irq;
u8 revision;
@@ -121,8 +121,8 @@ struct mantis_pci {
struct mantis_hwconfig *hwconfig;
- u32 mantis_int_stat;
- u32 mantis_int_mask;
+ u32 mantis_int_stat;
+ u32 mantis_int_mask;
/* board specific */
u8 mac_address[8];
--
1.7.1

View File

@ -0,0 +1,97 @@
From 1642e6b7ccf673805e3d7eb09c4f91f7e3b5563e Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Wed, 2 Dec 2009 22:11:00 -0300
Subject: [PATCH 010/120] V4L/DVB (13708): [Mantis] Remove some dead code
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit da7365f46607207c8166167ba497e3cb3e02270d)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_core.c | 2 --
drivers/media/dvb/mantis/mantis_pci.c | 1 -
drivers/media/dvb/mantis/mantis_vp2033.c | 14 +-------------
3 files changed, 1 insertions(+), 16 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_core.c b/drivers/media/dvb/mantis/mantis_core.c
index 1012959..d159ad6 100644
--- a/drivers/media/dvb/mantis/mantis_core.c
+++ b/drivers/media/dvb/mantis/mantis_core.c
@@ -48,7 +48,6 @@ static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
return err;
}
-// msleep_interruptible(2);
return 0;
}
@@ -75,7 +74,6 @@ static int write_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
return 0;
}
-
static int get_mac_address(struct mantis_pci *mantis)
{
int err;
diff --git a/drivers/media/dvb/mantis/mantis_pci.c b/drivers/media/dvb/mantis/mantis_pci.c
index 0bc25d2..402f866 100644
--- a/drivers/media/dvb/mantis/mantis_pci.c
+++ b/drivers/media/dvb/mantis/mantis_pci.c
@@ -74,7 +74,6 @@ static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
}
if (stat & MANTIS_INT_I2CRACK) {
dprintk(verbose, MANTIS_DEBUG, 0, "* I2C R-ACK *");
-// wake_up(&mantis->i2c_wq);
}
if (stat & MANTIS_INT_PCMCIA7) {
dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-07 *");
diff --git a/drivers/media/dvb/mantis/mantis_vp2033.c b/drivers/media/dvb/mantis/mantis_vp2033.c
index e989597..853b558 100644
--- a/drivers/media/dvb/mantis/mantis_vp2033.c
+++ b/drivers/media/dvb/mantis/mantis_vp2033.c
@@ -21,17 +21,6 @@
#include "mantis_common.h"
#include "mantis_vp2033.h"
-struct tda10021_state {
- struct i2c_adapter *i2c;
- struct dvb_frontend_ops ops;
- /* configuration settings */
- const struct tda10021_config *config;
- struct dvb_frontend frontend;
-
- u8 pwm;
- u8 reg0;
-};
-
#define MANTIS_MODEL_NAME "VP-2033"
#define MANTIS_DEV_TYPE "DVB-C"
@@ -49,7 +38,6 @@ struct cu1216_config philips_cu1216_config = {
int philips_cu1216_tuner_set(struct dvb_frontend *fe,
struct dvb_frontend_parameters *params)
{
-// struct tda10021_state *state = fe->demodulator_priv;
struct mantis_pci *mantis = fe->dvb->priv;
u8 buf[4];
@@ -71,11 +59,11 @@ int philips_cu1216_tuner_set(struct dvb_frontend *fe,
buf[3] = (params->frequency < 150000000 ? 0xA1 :
params->frequency < 445000000 ? 0x92 : 0x34);
-// if (i2c_transfer(state->i2c, &msg, 1) < 0) {
if (i2c_transfer(&mantis->adapter, &msg, 1) < 0) {
printk("%s tuner not ack!\n", __FUNCTION__);
return -EIO;
}
msleep(100);
+
return 0;
}
--
1.7.1

View File

@ -0,0 +1,77 @@
From 1ba7c3f04e2d1804a7ccb3874e68459fc50a8865 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Thu, 3 Dec 2009 05:37:51 -0300
Subject: [PATCH 011/120] V4L/DVB (13709): [Mantis/VP-1034] Switch 13/18v for the VP-1034 properly
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 715d341c59d2563940ae07b12f949555ccbe3efb)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_i2c.c | 10 +++++++---
drivers/media/dvb/mantis/mantis_vp1034.c | 6 ++++--
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_i2c.c b/drivers/media/dvb/mantis/mantis_i2c.c
index 8b90a2a..53c5f88 100644
--- a/drivers/media/dvb/mantis/mantis_i2c.c
+++ b/drivers/media/dvb/mantis/mantis_i2c.c
@@ -39,7 +39,7 @@ static int mantis_ack_wait(struct mantis_pci *mantis)
mantis->mantis_int_stat & MANTIS_INT_I2CDONE,
msecs_to_jiffies(50)) == -ERESTARTSYS) {
- dprintk(verbose, MANTIS_DEBUG, 1, "I2C Transfer failed, Master !I2CDONE");
+ dprintk(verbose, MANTIS_DEBUG, 1, "Master !I2CDONE");
rc = -EREMOTEIO;
}
while (!(mantis->mantis_int_stat & MANTIS_INT_I2CRACK)) {
@@ -62,7 +62,9 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
{
u32 rxd, i;
- dprintk(verbose, MANTIS_INFO, 0, " %s: Address=[0x%02x] <R>[ ", __func__, msg->addr);
+ dprintk(verbose, MANTIS_INFO, 0, " %s: Address=[0x%02x] <R>[ ",
+ __func__, msg->addr);
+
for (i = 0; i < msg->len; i++) {
rxd = (msg->addr << 25) | (1 << 24)
| MANTIS_I2C_RATE_3
@@ -92,7 +94,9 @@ static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg
int i;
u32 txd = 0;
- dprintk(verbose, MANTIS_INFO, 0, " %s: Address=[0x%02x] <W>[ ", __func__, msg->addr);
+ dprintk(verbose, MANTIS_INFO, 0, " %s: Address=[0x%02x] <W>[ ",
+ __func__, msg->addr);
+
for (i = 0; i < msg->len; i++) {
dprintk(verbose, MANTIS_INFO, 0, "%02x ", msg->buf[i]);
txd = (msg->addr << 25) | (msg->buf[i] << 8)
diff --git a/drivers/media/dvb/mantis/mantis_vp1034.c b/drivers/media/dvb/mantis/mantis_vp1034.c
index c9c9479..f6766d0 100644
--- a/drivers/media/dvb/mantis/mantis_vp1034.c
+++ b/drivers/media/dvb/mantis/mantis_vp1034.c
@@ -40,12 +40,14 @@ int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
switch (voltage) {
case SEC_VOLTAGE_13:
- mmwrite((mmread(MANTIS_GPIF_ADDR)) | voltage, MANTIS_GPIF_ADDR);
dprintk(verbose, MANTIS_ERROR, 1, "Polarization=[13V]");
+ gpio_set_bits(mantis, 13, 1);
+ gpio_set_bits(mantis, 14, 0);
break;
case SEC_VOLTAGE_18:
- mmwrite((mmread(MANTIS_GPIF_ADDR)) & voltage, MANTIS_GPIF_ADDR);
dprintk(verbose, MANTIS_ERROR, 1, "Polarization=[18V]");
+ gpio_set_bits(mantis, 13, 1);
+ gpio_set_bits(mantis, 14, 1);
break;
case SEC_VOLTAGE_OFF:
dprintk(verbose, MANTIS_ERROR, 1, "Frontend (dummy) POWERDOWN");
--
1.7.1

View File

@ -0,0 +1,107 @@
From 8a21c066cd6ca5cbbfc16ac463889ba0b291ef7f Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Thu, 3 Dec 2009 05:38:33 -0300
Subject: [PATCH 012/120] V4L/DVB (13710): [Mantis] FIX: Use swfilter (188/204) accordingly
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 01a8c3eebb3c83df337f88332756f16154cecc0f)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_common.h | 4 +++-
drivers/media/dvb/mantis/mantis_dma.c | 2 --
drivers/media/dvb/mantis/mantis_vp1033.c | 1 +
drivers/media/dvb/mantis/mantis_vp1034.c | 1 +
drivers/media/dvb/mantis/mantis_vp2033.c | 1 +
drivers/media/dvb/mantis/mantis_vp3030.c | 1 +
6 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index d39cbe0..197393e 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -64,13 +64,15 @@
#define mmor(dat, addr) mmwrite((dat) | mmread(addr), addr)
#define mmaor(dat, addr) mmwrite((dat) | ((mask) & mmread(addr)), addr)
+#define MANTIS_TS_188 0
+#define MANTIS_TS_204 1
struct mantis_hwconfig {
char *model_name;
char *dev_type;
+ u32 ts_size;
};
-
struct mantis_pci {
/* PCI stuff */
u16 vendor_id;
diff --git a/drivers/media/dvb/mantis/mantis_dma.c b/drivers/media/dvb/mantis/mantis_dma.c
index 9e3aa5e..b8fd1c7 100644
--- a/drivers/media/dvb/mantis/mantis_dma.c
+++ b/drivers/media/dvb/mantis/mantis_dma.c
@@ -154,8 +154,6 @@ err:
return err;
}
-
-
static inline void mantis_risc_program(struct mantis_pci *mantis)
{
u32 buf_pos = 0;
diff --git a/drivers/media/dvb/mantis/mantis_vp1033.c b/drivers/media/dvb/mantis/mantis_vp1033.c
index 07fcc45..daf02c1 100644
--- a/drivers/media/dvb/mantis/mantis_vp1033.c
+++ b/drivers/media/dvb/mantis/mantis_vp1033.c
@@ -87,6 +87,7 @@ struct stv0299_config lgtdqcs001f_config = {
struct mantis_hwconfig vp1033_mantis_config = {
.model_name = MANTIS_MODEL_NAME,
.dev_type = MANTIS_DEV_TYPE,
+ .ts_size = MANTIS_TS_204,
};
int lgtdqcs001f_tuner_set(struct dvb_frontend *fe,
diff --git a/drivers/media/dvb/mantis/mantis_vp1034.c b/drivers/media/dvb/mantis/mantis_vp1034.c
index f6766d0..a2fe9d4 100644
--- a/drivers/media/dvb/mantis/mantis_vp1034.c
+++ b/drivers/media/dvb/mantis/mantis_vp1034.c
@@ -32,6 +32,7 @@ struct mb86a16_config vp1034_config = {
struct mantis_hwconfig vp1034_mantis_config = {
.model_name = MANTIS_MODEL_NAME,
.dev_type = MANTIS_DEV_TYPE,
+ .ts_size = MANTIS_TS_204,
};
int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
diff --git a/drivers/media/dvb/mantis/mantis_vp2033.c b/drivers/media/dvb/mantis/mantis_vp2033.c
index 853b558..15772fe 100644
--- a/drivers/media/dvb/mantis/mantis_vp2033.c
+++ b/drivers/media/dvb/mantis/mantis_vp2033.c
@@ -27,6 +27,7 @@
struct mantis_hwconfig vp2033_mantis_config = {
.model_name = MANTIS_MODEL_NAME,
.dev_type = MANTIS_DEV_TYPE,
+ .ts_size = MANTIS_TS_188,
};
struct cu1216_config philips_cu1216_config = {
diff --git a/drivers/media/dvb/mantis/mantis_vp3030.c b/drivers/media/dvb/mantis/mantis_vp3030.c
index 8043e5d..cab092c 100644
--- a/drivers/media/dvb/mantis/mantis_vp3030.c
+++ b/drivers/media/dvb/mantis/mantis_vp3030.c
@@ -31,6 +31,7 @@ struct zl10353_config mantis_vp3030_config = {
struct mantis_hwconfig vp3030_mantis_config = {
.model_name = MANTIS_MODEL_NAME,
.dev_type = MANTIS_DEV_TYPE,
+ .ts_size = MANTIS_TS_188,
};
int panasonic_en57h12d5_set_params(struct dvb_frontend *fe,
--
1.7.1

View File

@ -0,0 +1,44 @@
From 891a939f0043167db8a735c2a5d0b90734b22147 Mon Sep 17 00:00:00 2001
From: Marko Ristola <marko.ristola@kolumbus.fi>
Date: Thu, 3 Dec 2009 05:39:22 -0300
Subject: [PATCH 013/120] V4L/DVB (13711): [Mantis] FIX: Do nor toggle GPIF status
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Marko Ristola <marko.ristola@kolumbus.fi>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit e4deee04ffda9b44f367a40dbad8306ab88cb321)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_dma.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_dma.c b/drivers/media/dvb/mantis/mantis_dma.c
index b8fd1c7..e207870 100644
--- a/drivers/media/dvb/mantis/mantis_dma.c
+++ b/drivers/media/dvb/mantis/mantis_dma.c
@@ -190,7 +190,8 @@ void mantis_dma_start(struct mantis_pci *mantis)
mantis_risc_program(mantis);
mmwrite(cpu_to_le32(mantis->risc_dma), MANTIS_RISC_START);
- mmwrite(MANTIS_GPIF_RDWRN, MANTIS_GPIF_ADDR);
+// mmwrite(MANTIS_GPIF_RDWRN, MANTIS_GPIF_ADDR);
+ mmwrite(mmread(MANTIS_GPIF_ADDR) | MANTIS_GPIF_RDWRN, MANTIS_GPIF_ADDR);
mmwrite(0, MANTIS_DMA_CTL);
mantis->last_block = mantis->finished_block = 0;
@@ -210,6 +211,8 @@ void mantis_dma_stop(struct mantis_pci *mantis)
mask = mmread(MANTIS_INT_MASK);
dprintk(verbose, MANTIS_DEBUG, 1, "Mantis Stop DMA engine");
+ mmwrite((mmread(MANTIS_GPIF_ADDR) & (~(MANTIS_GPIF_RDWRN))), MANTIS_GPIF_ADDR);
+
mmwrite((mmread(MANTIS_DMA_CTL) & ~(MANTIS_FIFO_EN |
MANTIS_DCAP_EN |
MANTIS_RISC_EN)), MANTIS_DMA_CTL);
--
1.7.1

View File

@ -0,0 +1,69 @@
From 18bf84a35a0b9ea89c4262125457c2938b37f149 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Thu, 3 Dec 2009 05:42:10 -0300
Subject: [PATCH 014/120] V4L/DVB (13712): [Mantis] Add locking for concurrent access
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit e2f67e4fb931b975058b3bd48eaac43780c92c88)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_common.h | 2 ++
drivers/media/dvb/mantis/mantis_i2c.c | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index 197393e..e354e76 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -25,6 +25,7 @@
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/pci.h>
+#include <linux/mutex.h>
#include "dvbdev.h"
#include "dvb_demux.h"
@@ -109,6 +110,7 @@ struct mantis_pci {
struct i2c_adapter adapter;
int i2c_rc;
wait_queue_head_t i2c_wq;
+ struct mutex i2c_lock;
/* DVB stuff */
struct dvb_adapter dvb_adapter;
diff --git a/drivers/media/dvb/mantis/mantis_i2c.c b/drivers/media/dvb/mantis/mantis_i2c.c
index 53c5f88..39fabe5 100644
--- a/drivers/media/dvb/mantis/mantis_i2c.c
+++ b/drivers/media/dvb/mantis/mantis_i2c.c
@@ -125,6 +125,7 @@ static int mantis_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, in
struct mantis_pci *mantis;
mantis = i2c_get_adapdata(adapter);
+ mutex_lock(&mantis->i2c_lock);
for (i = 0; i < num; i++) {
if (msgs[i].flags & I2C_M_RD)
ret = mantis_i2c_read(mantis, &msgs[i]);
@@ -134,6 +135,7 @@ static int mantis_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, in
if (ret < 0)
return ret;
}
+ mutex_unlock(&mantis->i2c_lock);
return num;
}
@@ -160,6 +162,7 @@ int __devinit mantis_i2c_init(struct mantis_pci *mantis)
{
u32 intstat, intmask;
+ mutex_init(&mantis->i2c_lock);
memcpy(&mantis->adapter, &mantis_i2c_adapter, sizeof (mantis_i2c_adapter));
i2c_set_adapdata(&mantis->adapter, mantis);
mantis->i2c_rc = i2c_add_adapter(&mantis->adapter);
--
1.7.1

View File

@ -0,0 +1,41 @@
From 7966bbe3618b2095cd5534ac88d80e7a189b0ccf Mon Sep 17 00:00:00 2001
From: Sigmund Augdal <sigmund@snap.tv>
Date: Thu, 3 Dec 2009 05:44:00 -0300
Subject: [PATCH 015/120] V4L/DVB (13713): [MB86A16] Fix: Initialize SNR/STATUS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Sigmund Augdal <sigmund@snap.tv>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 1fa1f107852484157c5453cc6c4a60c792f06c35)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/frontends/mb86a16.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/frontends/mb86a16.c b/drivers/media/dvb/frontends/mb86a16.c
index 361e476..4f8ef2e 100644
--- a/drivers/media/dvb/frontends/mb86a16.c
+++ b/drivers/media/dvb/frontends/mb86a16.c
@@ -595,6 +595,7 @@ static int mb86a16_read_status(struct dvb_frontend *fe, fe_status_t *status)
{
struct mb86a16_state *state = fe->demodulator_priv;
+ *status = 0;
if (state->signal & 0x02)
*status |= FE_HAS_VITERBI;
if (state->signal & 0x01)
@@ -1693,6 +1694,7 @@ static int mb86a16_read_snr(struct dvb_frontend *fe, u16 *snr)
int low_tide = 2, high_tide = 30, q_level;
u8 cn;
+ *snr = 0;
if (mb86a16_read(state, 0x26, &cn) != 2) {
dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
return -EREMOTEIO;
--
1.7.1

View File

@ -0,0 +1,75 @@
From fb7e4ac1badaa9f12f3825caeb391dcb95b3bd9b Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Thu, 3 Dec 2009 05:44:38 -0300
Subject: [PATCH 016/120] V4L/DVB (13714): [MB86A16] FIX/Code simplification: use hwconfig->ts_size instead of ts_size
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
thanks to Marko Ristola for pointing it out
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 33c79630dd9fb7658dbb885a22e3a8127b16a38a)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_common.h | 1 -
drivers/media/dvb/mantis/mantis_dma.c | 4 ++--
drivers/media/dvb/mantis/mantis_dvb.c | 1 -
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index e354e76..d4865e4 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -92,7 +92,6 @@ struct mantis_pci {
u8 revision;
unsigned int num;
- u16 ts_size;
/* RISC Core */
u32 finished_block;
diff --git a/drivers/media/dvb/mantis/mantis_dma.c b/drivers/media/dvb/mantis/mantis_dma.c
index e207870..ea23a89 100644
--- a/drivers/media/dvb/mantis/mantis_dma.c
+++ b/drivers/media/dvb/mantis/mantis_dma.c
@@ -190,7 +190,6 @@ void mantis_dma_start(struct mantis_pci *mantis)
mantis_risc_program(mantis);
mmwrite(cpu_to_le32(mantis->risc_dma), MANTIS_RISC_START);
-// mmwrite(MANTIS_GPIF_RDWRN, MANTIS_GPIF_ADDR);
mmwrite(mmread(MANTIS_GPIF_ADDR) | MANTIS_GPIF_RDWRN, MANTIS_GPIF_ADDR);
mmwrite(0, MANTIS_DMA_CTL);
@@ -227,12 +226,13 @@ void mantis_dma_stop(struct mantis_pci *mantis)
void mantis_dma_xfer(unsigned long data)
{
struct mantis_pci *mantis = (struct mantis_pci *) data;
+ struct mantis_hwconfig *config = mantis->hwconfig;
while (mantis->last_block != mantis->finished_block) {
dprintk(verbose, MANTIS_DEBUG, 1, "last block=[%d] finished block=[%d]",
mantis->last_block, mantis->finished_block);
- (mantis->ts_size ? dvb_dmx_swfilter_204: dvb_dmx_swfilter)
+ (config->ts_size ? dvb_dmx_swfilter_204: dvb_dmx_swfilter)
(&mantis->demux, &mantis->buf_cpu[mantis->last_block * MANTIS_BLOCK_BYTES], MANTIS_BLOCK_BYTES);
mantis->last_block = (mantis->last_block + 1) % MANTIS_BLOCK_COUNT;
}
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c
index 319bb8b..7fe8541 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -142,7 +142,6 @@ int __devinit mantis_dvb_init(struct mantis_pci *mantis)
mantis->demux.start_feed = mantis_dvb_start_feed;
mantis->demux.stop_feed = mantis_dvb_stop_feed;
mantis->demux.write_to_decoder = NULL;
- mantis->ts_size = 1; //188
dprintk(verbose, MANTIS_DEBUG, 1, "dvb_dmx_init");
if ((result = dvb_dmx_init(&mantis->demux)) < 0) {
dprintk(verbose, MANTIS_ERROR, 1,
--
1.7.1

View File

@ -0,0 +1,57 @@
From 229bcc82455f75e57609caab078bba2b94c4db4e Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Thu, 3 Dec 2009 05:46:06 -0300
Subject: [PATCH 017/120] V4L/DVB (13715): [Mantis] Kernel I2C changes: use PCI parent device
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 8154bad4c488c1a23fb504a6e751d71a39733b76)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_common.h | 2 +-
drivers/media/dvb/mantis/mantis_i2c.c | 10 +++++++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index d4865e4..34d2389 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -83,7 +83,7 @@ struct mantis_pci {
u8 latency;
- struct pci_dev *pdev;
+ struct pci_dev *pdev;
unsigned long mantis_addr;
volatile void __iomem *mantis_mmio;
diff --git a/drivers/media/dvb/mantis/mantis_i2c.c b/drivers/media/dvb/mantis/mantis_i2c.c
index 39fabe5..005df1e 100644
--- a/drivers/media/dvb/mantis/mantis_i2c.c
+++ b/drivers/media/dvb/mantis/mantis_i2c.c
@@ -161,11 +161,15 @@ static struct i2c_adapter mantis_i2c_adapter = {
int __devinit mantis_i2c_init(struct mantis_pci *mantis)
{
u32 intstat, intmask;
+ struct i2c_adapter *i2c_adapter = &mantis->adapter;
+ struct pci_dev *pdev = mantis->pdev;
mutex_init(&mantis->i2c_lock);
- memcpy(&mantis->adapter, &mantis_i2c_adapter, sizeof (mantis_i2c_adapter));
- i2c_set_adapdata(&mantis->adapter, mantis);
- mantis->i2c_rc = i2c_add_adapter(&mantis->adapter);
+ memcpy(i2c_adapter, &mantis_i2c_adapter, sizeof (mantis_i2c_adapter));
+ i2c_set_adapdata(i2c_adapter, mantis);
+
+ i2c_adapter->dev.parent = &pdev->dev;
+ mantis->i2c_rc = i2c_add_adapter(i2c_adapter);
if (mantis->i2c_rc < 0)
return mantis->i2c_rc;
--
1.7.1

View File

@ -0,0 +1,39 @@
From f0fb46cca3273252efbb9671e781f6d0b31f05fb Mon Sep 17 00:00:00 2001
From: David Woodhouse <dwmw2@infradead.org>
Date: Thu, 3 Dec 2009 05:47:11 -0300
Subject: [PATCH 018/120] V4L/DVB (13716): [Mantis] Bug: incorrect byte swap
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
You know, the worst endianness errors are not the cases where
people forget to byte-swap, but the cases where they either byte-swap
with the wrong size, or byte-swap when they shouldn't have done so at
all. Those ones defeat the casual reader of the code.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 417036844823313901d7f7d7b963f215cc3b0641)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_dma.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_dma.c b/drivers/media/dvb/mantis/mantis_dma.c
index ea23a89..f685992 100644
--- a/drivers/media/dvb/mantis/mantis_dma.c
+++ b/drivers/media/dvb/mantis/mantis_dma.c
@@ -189,7 +189,7 @@ void mantis_dma_start(struct mantis_pci *mantis)
dprintk(verbose, MANTIS_DEBUG, 1, "Mantis Start DMA engine");
mantis_risc_program(mantis);
- mmwrite(cpu_to_le32(mantis->risc_dma), MANTIS_RISC_START);
+ mmwrite(mantis->risc_dma, MANTIS_RISC_START);
mmwrite(mmread(MANTIS_GPIF_ADDR) | MANTIS_GPIF_RDWRN, MANTIS_GPIF_ADDR);
mmwrite(0, MANTIS_DMA_CTL);
--
1.7.1

View File

@ -0,0 +1,243 @@
From 084ae03964c65b3c484533ca43c6c2cadab7795c Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Thu, 3 Dec 2009 05:48:13 -0300
Subject: [PATCH 019/120] V4L/DVB (13717): [MB86A16] Statistics Updates
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Demodulator status check made reliable
* Code simplification for Viterbi Sync check, makes
acquisition more reliable
* Implement a BER monitor
* Implement a Signal strength monitor
* Implement a "simple" UCB monitor, no real UCB monitor
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 77557abef0de3f1f1e8f563db6df8710a9e930fe)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/frontends/mb86a16.c | 142 +++++++++++++++++++++++++++------
1 files changed, 117 insertions(+), 25 deletions(-)
diff --git a/drivers/media/dvb/frontends/mb86a16.c b/drivers/media/dvb/frontends/mb86a16.c
index 4f8ef2e..eddb35b 100644
--- a/drivers/media/dvb/frontends/mb86a16.c
+++ b/drivers/media/dvb/frontends/mb86a16.c
@@ -36,7 +36,6 @@ struct mb86a16_state {
struct i2c_adapter *i2c_adap;
const struct mb86a16_config *config;
struct dvb_frontend frontend;
- u8 signal;
// tuning parameters
int frequency;
@@ -593,17 +592,39 @@ err:
static int mb86a16_read_status(struct dvb_frontend *fe, fe_status_t *status)
{
+ u8 stat, stat2;
struct mb86a16_state *state = fe->demodulator_priv;
*status = 0;
- if (state->signal & 0x02)
- *status |= FE_HAS_VITERBI;
- if (state->signal & 0x01)
+
+ if (mb86a16_read(state, MB86A16_SIG1, &stat) != 2)
+ goto err;
+ if (mb86a16_read(state, MB86A16_SIG2, &stat2) != 2)
+ goto err;
+ if ((stat > 25) && (stat2 > 25))
+ *status |= FE_HAS_SIGNAL;
+ if ((stat > 45) && (stat2 > 45))
+ *status |= FE_HAS_CARRIER;
+
+ if (mb86a16_read(state, MB86A16_STATUS, &stat) != 2)
+ goto err;
+
+ if (stat & 0x01)
*status |= FE_HAS_SYNC;
- if (state->signal & 0x03)
+ if (stat & 0x01)
+ *status |= FE_HAS_VITERBI;
+
+ if (mb86a16_read(state, MB86A16_FRAMESYNC, &stat) != 2)
+ goto err;
+
+ if ((stat & 0x0f) && (*status & FE_HAS_VITERBI))
*status |= FE_HAS_LOCK;
return 0;
+
+err:
+ dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+ return -EREMOTEIO;
}
static int sync_chk(struct mb86a16_state *state,
@@ -1439,10 +1460,6 @@ static int mb86a16_set_fe(struct mb86a16_state *state)
msleep_interruptible(wait_t);
sync = sync_chk(state, &VIRM);
dprintk(verbose, MB86A16_INFO, 1, "-------- Viterbi=[%d] SYNC=[%d] ---------", VIRM, sync);
- if (mb86a16_read(state, 0x0d, &state->signal) != 2) {
- dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
- return -EREMOTEIO;
- }
if (VIRM) {
if (VIRM == 4) { // 5/6
if (SIG1 > 110)
@@ -1459,22 +1476,14 @@ static int mb86a16_set_fe(struct mb86a16_state *state)
iq_vt_set(state, 1);
FEC_srst(state);
}
- if (SIG1 > 110)
- wait_t = ( 786432 + state->srate / 2) / state->srate;
- else
- wait_t = (1572864 + state->srate / 2) / state->srate;
-
- msleep_interruptible(wait_t);
- SEQ_set(state, 1);
- } else { // 1/2, 2/3, 3/4, 7/8
- if (SIG1 > 110)
- wait_t = ( 786432 + state->srate / 2) / state->srate;
- else
- wait_t = (1572864 + state->srate / 2) / state->srate;
-
- msleep_interruptible(wait_t);
- SEQ_set(state, 1);
}
+ // 1/2, 2/3, 3/4, 7/8
+ if (SIG1 > 110)
+ wait_t = ( 786432 + state->srate / 2) / state->srate;
+ else
+ wait_t = (1572864 + state->srate / 2) / state->srate;
+ msleep_interruptible(wait_t);
+ SEQ_set(state, 1);
} else {
dprintk(verbose, MB86A16_INFO, 1, "NO -- SYNC");
SEQ_set(state, 1);
@@ -1648,12 +1657,85 @@ static int mb86a16_sleep(struct dvb_frontend *fe)
static int mb86a16_read_ber(struct dvb_frontend *fe, u32 *ber)
{
+ u8 ber_mon, ber_tab, ber_lsb, ber_mid, ber_msb, ber_tim, ber_rst;
+ u32 timer;
+
+ struct mb86a16_state *state = fe->demodulator_priv;
+
+ *ber = 0;
+ if (mb86a16_read(state, MB86A16_BERMON, &ber_mon) != 2)
+ goto err;
+ if (mb86a16_read(state, MB86A16_BERTAB, &ber_tab) != 2)
+ goto err;
+ if (mb86a16_read(state, MB86A16_BERLSB, &ber_lsb) != 2)
+ goto err;
+ if (mb86a16_read(state, MB86A16_BERMID, &ber_mid) != 2)
+ goto err;
+ if (mb86a16_read(state, MB86A16_BERMSB, &ber_msb) != 2)
+ goto err;
+ /* BER monitor invalid when BER_EN = 0 */
+ if (ber_mon & 0x04) {
+ /* coarse, fast calculation */
+ *ber = ber_tab & 0x1f;
+ dprintk(verbose, MB86A16_DEBUG, 1, "BER coarse=[0x%02x]", *ber);
+ if (ber_mon & 0x01) {
+ /*
+ * BER_SEL = 1, The monitored BER is the estimated
+ * value with a Reed-Solomon decoder error amount at
+ * the deinterleaver output.
+ * monitored BER is expressed as a 20 bit output in total
+ */
+ ber_rst = ber_mon >> 3;
+ *ber = (((ber_msb << 8) | ber_mid) << 8) | ber_lsb;
+ if (ber_rst == 0)
+ timer = 12500000;
+ if (ber_rst == 1)
+ timer = 25000000;
+ if (ber_rst == 2)
+ timer = 50000000;
+ if (ber_rst == 3)
+ timer = 100000000;
+
+ *ber /= timer;
+ dprintk(verbose, MB86A16_DEBUG, 1, "BER fine=[0x%02x]", *ber);
+ } else {
+ /*
+ * BER_SEL = 0, The monitored BER is the estimated
+ * value with a Viterbi decoder error amount at the
+ * QPSK demodulator output.
+ * monitored BER is expressed as a 24 bit output in total
+ */
+ ber_tim = ber_mon >> 1;
+ *ber = (((ber_msb << 8) | ber_mid) << 8) | ber_lsb;
+ if (ber_tim == 0)
+ timer = 16;
+ if (ber_tim == 1)
+ timer = 24;
+
+ *ber /= 2 ^ timer;
+ dprintk(verbose, MB86A16_DEBUG, 1, "BER fine=[0x%02x]", *ber);
+ }
+ }
return 0;
+err:
+ dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+ return -EREMOTEIO;
}
static int mb86a16_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
{
+ u8 agcm = 0;
+ struct mb86a16_state *state = fe->demodulator_priv;
+
*strength = 0;
+ if (mb86a16_read(state, MB86A16_AGCM, &agcm) != 2) {
+ dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+ return -EREMOTEIO;
+ }
+
+ *strength = ((0xff - agcm) * 100) / 256;
+ dprintk(verbose, MB86A16_DEBUG, 1, "Signal strength=[%d %%]", (u8) *strength);
+ *strength = (0xffff - 0xff) + agcm;
return 0;
}
@@ -1708,12 +1790,22 @@ static int mb86a16_read_snr(struct dvb_frontend *fe, u16 *snr)
}
q_level = (*snr * 100) / (high_tide - low_tide);
dprintk(verbose, MB86A16_ERROR, 1, "SNR (Quality) = [%d dB], Level=%d %%", *snr, q_level);
+ *snr = (0xffff - 0xff) + *snr;
return 0;
}
static int mb86a16_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
{
+ u8 dist;
+ struct mb86a16_state *state = fe->demodulator_priv;
+
+ if (mb86a16_read(state, MB86A16_DISTMON, &dist) != 2) {
+ dprintk(verbose, MB86A16_ERROR, 1, "I2C transfer error");
+ return -EREMOTEIO;
+ }
+ *ucblocks = dist;
+
return 0;
}
@@ -1723,7 +1815,7 @@ static struct dvb_frontend_ops mb86a16_ops = {
.type = FE_QPSK,
.frequency_min = 950000,
.frequency_max = 2150000,
- .frequency_stepsize = 125,
+ .frequency_stepsize = 3000,
.frequency_tolerance = 0,
.symbol_rate_min = 1000000,
.symbol_rate_max = 45000000,
--
1.7.1

View File

@ -0,0 +1,58 @@
From 4f0ee023bddd9630a8ed5ba19c249bbea3a21682 Mon Sep 17 00:00:00 2001
From: Marko Ristola <marko.ristola@kolumbus.fi>
Date: Fri, 4 Dec 2009 04:35:35 -0300
Subject: [PATCH 020/120] V4L/DVB (13718): [Mantis] Use gpio_set_bits to turn OFF the bits as well
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Marko Ristola <marko.ristola@kolumbus.fi>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit f8e26cdec5ac25ae8d73e278e21033292de5430b)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_core.c | 16 +++++++---------
1 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_core.c b/drivers/media/dvb/mantis/mantis_core.c
index d159ad6..16d693e 100644
--- a/drivers/media/dvb/mantis/mantis_core.c
+++ b/drivers/media/dvb/mantis/mantis_core.c
@@ -172,25 +172,23 @@ int mantis_core_exit(struct mantis_pci *mantis)
return 0;
}
+// Turn the given bit on or off.
void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value)
{
- u32 reg;
+ u32 currVal, newVal;
+
+ currVal = mmread(MANTIS_GPIF_ADDR);
if (value)
- reg = 0x0000;
+ newVal = currVal | (1 << bitpos);
else
- reg = 0xffff;
-
- reg = (value << bitpos);
+ newVal = currVal & (~(1 << bitpos));
- mmwrite(mmread(MANTIS_GPIF_ADDR) | reg, MANTIS_GPIF_ADDR);
+ mmwrite(newVal, MANTIS_GPIF_ADDR);
mmwrite(0x00, MANTIS_GPIF_DOUT);
udelay(100);
- mmwrite(mmread(MANTIS_GPIF_ADDR) | reg, MANTIS_GPIF_ADDR);
- mmwrite(0x00, MANTIS_GPIF_DOUT);
}
-
//direction = 0 , no CI passthrough ; 1 , CI passthrough
void mantis_set_direction(struct mantis_pci *mantis, int direction)
{
--
1.7.1

View File

@ -0,0 +1,166 @@
From 9c53a416608b8ad355793252d21146cb656f3d83 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 04:39:14 -0300
Subject: [PATCH 021/120] V4L/DVB (13719): [Mantis/VP-2033] Initial test switch to the tda10021, from the cu1216
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 2687d832fe0141015e2391f3755d9499e6efb83e)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_dvb.c | 2 +-
drivers/media/dvb/mantis/mantis_vp2033.c | 80 +++++++++++++++++++++--------
drivers/media/dvb/mantis/mantis_vp2033.h | 8 ++--
3 files changed, 63 insertions(+), 27 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c
index 7fe8541..f255695 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -239,7 +239,7 @@ int __devinit mantis_frontend_init(struct mantis_pci *mantis)
break;
case MANTIS_VP_2033_DVB_C: // VP-2033
dprintk(verbose, MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
- mantis->fe = cu1216_attach(&philips_cu1216_config, &mantis->adapter);
+ mantis->fe = tda10021_attach(&philips_cu1216_config, &mantis->adapter, read_pwm(mantis));
if (mantis->fe) {
mantis->fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set;
dprintk(verbose, MANTIS_ERROR, 1,
diff --git a/drivers/media/dvb/mantis/mantis_vp2033.c b/drivers/media/dvb/mantis/mantis_vp2033.c
index 15772fe..4664d29 100644
--- a/drivers/media/dvb/mantis/mantis_vp2033.c
+++ b/drivers/media/dvb/mantis/mantis_vp2033.c
@@ -27,44 +27,80 @@
struct mantis_hwconfig vp2033_mantis_config = {
.model_name = MANTIS_MODEL_NAME,
.dev_type = MANTIS_DEV_TYPE,
- .ts_size = MANTIS_TS_188,
+ .ts_size = MANTIS_TS_204,
};
-struct cu1216_config philips_cu1216_config = {
- .demod_address = 0x18 >> 1,
- .pll_set = philips_cu1216_tuner_set,
-// .fe_reset = mantis_fe_reset,
+struct tda1002x_config philips_cu1216_config = {
+ .demod_address = 0x18 >> 1,
+ .invert = 1,
};
-int philips_cu1216_tuner_set(struct dvb_frontend *fe,
- struct dvb_frontend_parameters *params)
+u8 read_pwm(struct mantis_pci *mantis)
{
- struct mantis_pci *mantis = fe->dvb->priv;
+ u8 b = 0xff;
+ u8 pwm;
+ struct i2c_msg msg[] = {
+ {.addr = 0x50,.flags = 0,.buf = &b,.len = 1},
+ {.addr = 0x50,.flags = I2C_M_RD,.buf = &pwm,.len = 1}
+ };
- u8 buf[4];
+ if ((i2c_transfer(&mantis->adapter, msg, 2) != 2)
+ || (pwm == 0xff))
+ pwm = 0x48;
- struct i2c_msg msg = {
- .addr = 0xc0 >> 1,
- .flags = 0,
- .buf = buf,
- .len = sizeof (buf)
- };
+ return pwm;
+}
+
+int philips_cu1216_tuner_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
+{
+ struct mantis_pci *mantis = fe->dvb->priv;
+
+ u8 buf[6];
+ struct i2c_msg msg = {.addr = 0x60,.flags = 0,.buf = buf,.len = sizeof(buf) };
+ int i;
+#define CU1216_IF 36125000
#define TUNER_MUL 62500
- u32 div = (params->frequency + 36125000 + TUNER_MUL / 2) / TUNER_MUL;
+ u32 div = (params->frequency + CU1216_IF + TUNER_MUL / 2) / TUNER_MUL;
buf[0] = (div >> 8) & 0x7f;
buf[1] = div & 0xff;
- buf[2] = 0x86;
- buf[3] = (params->frequency < 150000000 ? 0xA1 :
- params->frequency < 445000000 ? 0x92 : 0x34);
+ buf[2] = 0xce;
+ buf[3] = (params->frequency < 150000000 ? 0x01 :
+ params->frequency < 445000000 ? 0x02 : 0x04);
+ buf[4] = 0xde;
+ buf[5] = 0x20;
- if (i2c_transfer(&mantis->adapter, &msg, 1) < 0) {
- printk("%s tuner not ack!\n", __FUNCTION__);
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 1);
+
+ if (i2c_transfer(&mantis->adapter, &msg, 1) != 1)
return -EIO;
+
+ /* wait for the pll lock */
+ msg.flags = I2C_M_RD;
+ msg.len = 1;
+ for (i = 0; i < 20; i++) {
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 1);
+
+ if (i2c_transfer(&mantis->adapter, &msg, 1) == 1 && (buf[0] & 0x40))
+ break;
+
+ msleep(10);
}
- msleep(100);
+
+ /* switch the charge pump to the lower current */
+ msg.flags = 0;
+ msg.len = 2;
+ msg.buf = &buf[2];
+ buf[2] &= ~0x40;
+ if (fe->ops.i2c_gate_ctrl)
+ fe->ops.i2c_gate_ctrl(fe, 1);
+
+ if (i2c_transfer(&mantis->adapter, &msg, 1) != 1)
+ return -EIO;
return 0;
}
diff --git a/drivers/media/dvb/mantis/mantis_vp2033.h b/drivers/media/dvb/mantis/mantis_vp2033.h
index 513c491..fcf8b85 100644
--- a/drivers/media/dvb/mantis/mantis_vp2033.h
+++ b/drivers/media/dvb/mantis/mantis_vp2033.h
@@ -23,15 +23,15 @@
#include "dvb_frontend.h"
#include "mantis_common.h"
-#include "cu1216.h"
+#include "tda1002x.h"
#define MANTIS_VP_2033_DVB_C 0x0008
-extern struct cu1216_config philips_cu1216_config;
+extern struct tda1002x_config philips_cu1216_config;
extern struct mantis_hwconfig vp2033_mantis_config;
-extern int philips_cu1216_tuner_set(struct dvb_frontend *fe,
- struct dvb_frontend_parameters *params);
+extern int philips_cu1216_tuner_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params);
+extern u8 read_pwm(struct mantis_pci *mantis);
#endif // __MANTIS_VP2033_H
--
1.7.1

View File

@ -0,0 +1,70 @@
From 0183b53c0988827e62d106f984f36752ec0ac2fd Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 04:39:48 -0300
Subject: [PATCH 022/120] V4L/DVB (13720): [Mantis/Terratec Cinergy C] Add support for the Terratec Cinergy C PCI
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 51d20db8bb9c5a14ac2320664289f13bd52625c6)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_core.c | 1 +
drivers/media/dvb/mantis/mantis_dvb.c | 13 +++++++++++++
drivers/media/dvb/mantis/mantis_vp2033.h | 1 +
3 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_core.c b/drivers/media/dvb/mantis/mantis_core.c
index 16d693e..3b5fea7 100644
--- a/drivers/media/dvb/mantis/mantis_core.c
+++ b/drivers/media/dvb/mantis/mantis_core.c
@@ -111,6 +111,7 @@ static void mantis_load_config(struct mantis_pci *mantis)
mantis->hwconfig = &vp1034_mantis_config;
break;
case MANTIS_VP_2033_DVB_C: // VP-2033
+ case TERRATEC_CINERGY_C_PCI: // Terratec Cinergy C PCI
mantis->hwconfig = &vp2033_mantis_config;
break;
case MANTIS_VP_3030_DVB_T: // VP-3030
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c
index f255695..e2aec0c 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -251,6 +251,19 @@ int __devinit mantis_frontend_init(struct mantis_pci *mantis)
}
break;
+ case TERRATEC_CINERGY_C_PCI:
+ dprintk(verbose, MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
+ mantis->fe = tda10023_attach(&philips_cu1216_config, &mantis->adapter, read_pwm(mantis));
+ if (mantis->fe) {
+ mantis->fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set;
+ dprintk(verbose, MANTIS_ERROR, 1,
+ "found Philips CU1216 DVB-C frontend 0x%02x",
+ philips_cu1216_config.demod_address);
+
+ dprintk(verbose, MANTIS_ERROR, 1,
+ "Mantis DVB-C Philips CU1216 frontend attach success");
+ }
+ break;
default:
dprintk(verbose, MANTIS_DEBUG, 1, "Unknown frontend:[0x%02x]",
mantis->sub_device_id);
diff --git a/drivers/media/dvb/mantis/mantis_vp2033.h b/drivers/media/dvb/mantis/mantis_vp2033.h
index fcf8b85..0a753f7 100644
--- a/drivers/media/dvb/mantis/mantis_vp2033.h
+++ b/drivers/media/dvb/mantis/mantis_vp2033.h
@@ -26,6 +26,7 @@
#include "tda1002x.h"
#define MANTIS_VP_2033_DVB_C 0x0008
+#define TERRATEC_CINERGY_C_PCI 0x1178
extern struct tda1002x_config philips_cu1216_config;
extern struct mantis_hwconfig vp2033_mantis_config;
--
1.7.1

View File

@ -0,0 +1,43 @@
From f8100ec2b738717d465ffefe3f5f0a65703c4a49 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 04:40:16 -0300
Subject: [PATCH 023/120] V4L/DVB (13721): [Mantis] Bug! Before bailing out, Unlock
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Thanks to hotwings <user.vdr@gmail.com> for pointing out the bug
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 99d96e4e9202aa046e3e2be1813ff59c84e67608)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_i2c.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_i2c.c b/drivers/media/dvb/mantis/mantis_i2c.c
index 005df1e..45d9e6b 100644
--- a/drivers/media/dvb/mantis/mantis_i2c.c
+++ b/drivers/media/dvb/mantis/mantis_i2c.c
@@ -133,11 +133,15 @@ static int mantis_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, in
ret = mantis_i2c_write(mantis, &msgs[i]);
if (ret < 0)
- return ret;
+ goto bail_out;
}
mutex_unlock(&mantis->i2c_lock);
return num;
+
+bail_out:
+ mutex_unlock(&mantis->i2c_lock);
+ return ret;
}
static u32 mantis_i2c_func(struct i2c_adapter *adapter)
--
1.7.1

View File

@ -0,0 +1,70 @@
From f828198b4e3907591098362a2896925f84ba7c55 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 04:40:50 -0300
Subject: [PATCH 024/120] V4L/DVB (13722): [Mantis] Revert 13560
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 5e68b0aedaa34447d86ae5cc6d071251c62bef37)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_core.c | 1 -
drivers/media/dvb/mantis/mantis_dvb.c | 13 -------------
drivers/media/dvb/mantis/mantis_vp2033.h | 1 -
3 files changed, 0 insertions(+), 15 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_core.c b/drivers/media/dvb/mantis/mantis_core.c
index 3b5fea7..16d693e 100644
--- a/drivers/media/dvb/mantis/mantis_core.c
+++ b/drivers/media/dvb/mantis/mantis_core.c
@@ -111,7 +111,6 @@ static void mantis_load_config(struct mantis_pci *mantis)
mantis->hwconfig = &vp1034_mantis_config;
break;
case MANTIS_VP_2033_DVB_C: // VP-2033
- case TERRATEC_CINERGY_C_PCI: // Terratec Cinergy C PCI
mantis->hwconfig = &vp2033_mantis_config;
break;
case MANTIS_VP_3030_DVB_T: // VP-3030
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c
index e2aec0c..f255695 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -251,19 +251,6 @@ int __devinit mantis_frontend_init(struct mantis_pci *mantis)
}
break;
- case TERRATEC_CINERGY_C_PCI:
- dprintk(verbose, MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
- mantis->fe = tda10023_attach(&philips_cu1216_config, &mantis->adapter, read_pwm(mantis));
- if (mantis->fe) {
- mantis->fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set;
- dprintk(verbose, MANTIS_ERROR, 1,
- "found Philips CU1216 DVB-C frontend 0x%02x",
- philips_cu1216_config.demod_address);
-
- dprintk(verbose, MANTIS_ERROR, 1,
- "Mantis DVB-C Philips CU1216 frontend attach success");
- }
- break;
default:
dprintk(verbose, MANTIS_DEBUG, 1, "Unknown frontend:[0x%02x]",
mantis->sub_device_id);
diff --git a/drivers/media/dvb/mantis/mantis_vp2033.h b/drivers/media/dvb/mantis/mantis_vp2033.h
index 0a753f7..fcf8b85 100644
--- a/drivers/media/dvb/mantis/mantis_vp2033.h
+++ b/drivers/media/dvb/mantis/mantis_vp2033.h
@@ -26,7 +26,6 @@
#include "tda1002x.h"
#define MANTIS_VP_2033_DVB_C 0x0008
-#define TERRATEC_CINERGY_C_PCI 0x1178
extern struct tda1002x_config philips_cu1216_config;
extern struct mantis_hwconfig vp2033_mantis_config;
--
1.7.1

View File

@ -0,0 +1,191 @@
From 4cd0ecb27fcee453c4b435d6bb5fd4e5994f5d2a Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 04:42:22 -0300
Subject: [PATCH 025/120] V4L/DVB (13723): [Mantis/VP-2040, Terratec Cinergy C] Add support for the Cinergy C, VP-2040 clone
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit b2eb1312faa26703e71b7b3945c8773213e9ee49)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/Makefile | 13 ++++++++--
drivers/media/dvb/mantis/mantis_core.c | 4 +++
drivers/media/dvb/mantis/mantis_dvb.c | 16 ++++++++++++-
drivers/media/dvb/mantis/mantis_vp2040.c | 36 ++++++++++++++++++++++++++++++
drivers/media/dvb/mantis/mantis_vp2040.h | 33 +++++++++++++++++++++++++++
5 files changed, 98 insertions(+), 4 deletions(-)
create mode 100644 drivers/media/dvb/mantis/mantis_vp2040.c
create mode 100644 drivers/media/dvb/mantis/mantis_vp2040.h
diff --git a/drivers/media/dvb/mantis/Makefile b/drivers/media/dvb/mantis/Makefile
index a980ff2..2be21bf 100644
--- a/drivers/media/dvb/mantis/Makefile
+++ b/drivers/media/dvb/mantis/Makefile
@@ -1,6 +1,13 @@
-mantis-objs = mantis_core.o mantis_dma.o mantis_pci.o mantis_i2c.o \
- mantis_dvb.o mantis_vp1033.o mantis_vp1034.o mantis_vp2033.o \
- mantis_vp3030.o
+mantis-objs = mantis_core.o \
+ mantis_dma.o \
+ mantis_pci.o \
+ mantis_i2c.o \
+ mantis_dvb.o \
+ mantis_vp1033.o \
+ mantis_vp1034.o \
+ mantis_vp2033.o \
+ mantis_vp2040.o \
+ mantis_vp3030.o
obj-$(CONFIG_DVB_MANTIS) += mantis.o
diff --git a/drivers/media/dvb/mantis/mantis_core.c b/drivers/media/dvb/mantis/mantis_core.c
index 16d693e..96b9392 100644
--- a/drivers/media/dvb/mantis/mantis_core.c
+++ b/drivers/media/dvb/mantis/mantis_core.c
@@ -23,6 +23,7 @@
#include "mantis_vp1033.h"
#include "mantis_vp1034.h"
#include "mantis_vp2033.h"
+#include "mantis_vp2040.h"
#include "mantis_vp3030.h"
static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
@@ -113,6 +114,9 @@ static void mantis_load_config(struct mantis_pci *mantis)
case MANTIS_VP_2033_DVB_C: // VP-2033
mantis->hwconfig = &vp2033_mantis_config;
break;
+ case TERRATEC_CINERGY_C_PCI: // VP-2040 clone
+ mantis->hwconfig = &vp2040_mantis_config;
+ break;
case MANTIS_VP_3030_DVB_T: // VP-3030
mantis->hwconfig = &vp3030_mantis_config;
break;
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c
index f255695..15012ea 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -28,6 +28,7 @@
#include "mantis_vp1033.h"
#include "mantis_vp1034.h"
#include "mantis_vp2033.h"
+#include "mantis_vp2040.h"
#include "mantis_vp3030.h"
/* Tuner power supply control */
@@ -243,7 +244,7 @@ int __devinit mantis_frontend_init(struct mantis_pci *mantis)
if (mantis->fe) {
mantis->fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set;
dprintk(verbose, MANTIS_ERROR, 1,
- "found Philips CU1216 DVB-C frontend @ 0x%02x",
+ "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x",
philips_cu1216_config.demod_address);
dprintk(verbose, MANTIS_ERROR, 1,
@@ -251,6 +252,19 @@ int __devinit mantis_frontend_init(struct mantis_pci *mantis)
}
break;
+ case TERRATEC_CINERGY_C_PCI:
+ dprintk(verbose, MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
+ mantis->fe = tda10023_attach(&tda10023_cu1216_config, &mantis->adapter, read_pwm(mantis));
+ if (mantis->fe) {
+ mantis->fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set;
+ dprintk(verbose, MANTIS_ERROR, 1,
+ "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x",
+ philips_cu1216_config.demod_address);
+
+ dprintk(verbose, MANTIS_ERROR, 1,
+ "Mantis DVB-C Philips CU1216 frontend attach success");
+ }
+ break;
default:
dprintk(verbose, MANTIS_DEBUG, 1, "Unknown frontend:[0x%02x]",
mantis->sub_device_id);
diff --git a/drivers/media/dvb/mantis/mantis_vp2040.c b/drivers/media/dvb/mantis/mantis_vp2040.c
new file mode 100644
index 0000000..07da738
--- /dev/null
+++ b/drivers/media/dvb/mantis/mantis_vp2040.c
@@ -0,0 +1,36 @@
+/*
+ Mantis VP-2040 driver
+
+ Copyright (C) Manu Abraham (abraham.manu@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.
+
+ 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 "mantis_common.h"
+#include "mantis_vp2040.h"
+
+#define MANTIS_MODEL_NAME "VP-2040"
+#define MANTIS_DEV_TYPE "DVB-C"
+
+struct mantis_hwconfig vp2040_mantis_config = {
+ .model_name = MANTIS_MODEL_NAME,
+ .dev_type = MANTIS_DEV_TYPE,
+ .ts_size = MANTIS_TS_204,
+};
+
+struct tda1002x_config tda10023_cu1216_config = {
+ .demod_address = 0x18 >> 1,
+ .invert = 1,
+};
diff --git a/drivers/media/dvb/mantis/mantis_vp2040.h b/drivers/media/dvb/mantis/mantis_vp2040.h
new file mode 100644
index 0000000..825ccbb
--- /dev/null
+++ b/drivers/media/dvb/mantis/mantis_vp2040.h
@@ -0,0 +1,33 @@
+/*
+ Mantis VP-2040 driver
+
+ Copyright (C) Manu Abraham (abraham.manu@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.
+
+ 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 __MANTIS_VP2040_H
+#define __MANTIS_VP2040_H
+
+#include "dvb_frontend.h"
+#include "mantis_common.h"
+#include "tda1002x.h"
+
+#define TERRATEC_CINERGY_C_PCI 0x1178
+
+extern struct tda1002x_config tda10023_cu1216_config;
+extern struct mantis_hwconfig vp2040_mantis_config;
+
+#endif //__MANTIS_VP2040_H
--
1.7.1

View File

@ -0,0 +1,439 @@
From 420fe00706948d2e6ce0f71d253a17b1023f263f Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 04:43:04 -0300
Subject: [PATCH 026/120] V4L/DVB (13724): [Mantis/VP-1041] Initial support for Mantis VP-1041
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 873c8c25ebca50bd60e21784c4d442c4fecb8658)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/Makefile | 1 +
drivers/media/dvb/mantis/mantis_core.c | 4 +
drivers/media/dvb/mantis/mantis_dvb.c | 18 ++
drivers/media/dvb/mantis/mantis_vp1041.c | 295 ++++++++++++++++++++++++++++++
drivers/media/dvb/mantis/mantis_vp1041.h | 36 ++++
5 files changed, 354 insertions(+), 0 deletions(-)
create mode 100644 drivers/media/dvb/mantis/mantis_vp1041.c
create mode 100644 drivers/media/dvb/mantis/mantis_vp1041.h
diff --git a/drivers/media/dvb/mantis/Makefile b/drivers/media/dvb/mantis/Makefile
index 2be21bf..bdf3e36 100644
--- a/drivers/media/dvb/mantis/Makefile
+++ b/drivers/media/dvb/mantis/Makefile
@@ -5,6 +5,7 @@ mantis-objs = mantis_core.o \
mantis_dvb.o \
mantis_vp1033.o \
mantis_vp1034.o \
+ mantis_vp1041.o \
mantis_vp2033.o \
mantis_vp2040.o \
mantis_vp3030.o
diff --git a/drivers/media/dvb/mantis/mantis_core.c b/drivers/media/dvb/mantis/mantis_core.c
index 96b9392..47cfb75 100644
--- a/drivers/media/dvb/mantis/mantis_core.c
+++ b/drivers/media/dvb/mantis/mantis_core.c
@@ -22,6 +22,7 @@
#include "mantis_core.h"
#include "mantis_vp1033.h"
#include "mantis_vp1034.h"
+#include "mantis_vp1041.h"
#include "mantis_vp2033.h"
#include "mantis_vp2040.h"
#include "mantis_vp3030.h"
@@ -111,6 +112,9 @@ static void mantis_load_config(struct mantis_pci *mantis)
case MANTIS_VP_1034_DVB_S: // VP-1034
mantis->hwconfig = &vp1034_mantis_config;
break;
+ case MANTIS_VP_1041_DVB_S2: // VP-1041
+ mantis->hwconfig = &vp1041_mantis_config;
+ break;
case MANTIS_VP_2033_DVB_C: // VP-2033
mantis->hwconfig = &vp2033_mantis_config;
break;
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c
index 15012ea..a4750bb 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -27,6 +27,7 @@
#include "dvb_frontend.h"
#include "mantis_vp1033.h"
#include "mantis_vp1034.h"
+#include "mantis_vp1041.h"
#include "mantis_vp2033.h"
#include "mantis_vp2040.h"
#include "mantis_vp3030.h"
@@ -238,6 +239,23 @@ int __devinit mantis_frontend_init(struct mantis_pci *mantis)
}
break;
+ case MANTIS_VP_1041_DVB_S2:
+ mantis->fe = stb0899_attach(&vp1041_config, &mantis->adapter);
+ if (mantis->fe) {
+ dprintk(verbose, MANTIS_ERROR, 1,
+ "found STB0899 DVB-S/DVB-S2 frontend @0x%02x",
+ vp1041_config.demod_address);
+
+ if (stb6100_attach(mantis->fe, &vp1041_stb6100_config, &mantis->adapter)) {
+ if (!lnbp21_attach(mantis->fe, &mantis->adapter, 0, 0)) {
+ printk("%s: No LNBP21 found!\n", __FUNCTION__);
+ mantis->fe = NULL;
+ }
+ } else {
+ mantis->fe = NULL;
+ }
+ }
+ break;
case MANTIS_VP_2033_DVB_C: // VP-2033
dprintk(verbose, MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
mantis->fe = tda10021_attach(&philips_cu1216_config, &mantis->adapter, read_pwm(mantis));
diff --git a/drivers/media/dvb/mantis/mantis_vp1041.c b/drivers/media/dvb/mantis/mantis_vp1041.c
new file mode 100644
index 0000000..a3279f0
--- /dev/null
+++ b/drivers/media/dvb/mantis/mantis_vp1041.c
@@ -0,0 +1,295 @@
+/*
+ Mantis VP-1041 driver
+
+ Copyright (C) Manu Abraham (abraham.manu@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.
+
+ 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 "mantis_common.h"
+#include "mantis_vp1041.h"
+#include "stb0899_reg.h"
+#include "stb0899_cfg.h"
+#include "stb6100_cfg.h"
+
+#define MANTIS_MODEL_NAME "VP-1041"
+#define MANTIS_DEV_TYPE "DSS/DVB-S/DVB-S2"
+
+struct mantis_hwconfig vp1041_mantis_config = {
+ .model_name = MANTIS_MODEL_NAME,
+ .dev_type = MANTIS_DEV_TYPE,
+ .ts_size = MANTIS_TS_188,
+};
+
+static const struct stb0899_s1_reg vp1041_stb0899_s1_init_1[] = {
+
+// 0x0000000b , /* SYSREG */
+ { STB0899_DEV_ID , 0x30 },
+ { STB0899_DISCNTRL1 , 0x32 },
+ { STB0899_DISCNTRL2 , 0x80 },
+ { STB0899_DISRX_ST0 , 0x04 },
+ { STB0899_DISRX_ST1 , 0x00 },
+ { STB0899_DISPARITY , 0x00 },
+ { STB0899_DISFIFO , 0x00 },
+ { STB0899_DISSTATUS , 0x20 },
+ { STB0899_DISF22 , 0x99 },
+ { STB0899_DISF22RX , 0xa8 },
+ //SYSREG ?
+ { STB0899_ACRPRESC , 0x11 },
+ { STB0899_ACRDIV1 , 0x0a },
+ { STB0899_ACRDIV2 , 0x05 },
+ { STB0899_DACR1 , 0x00 },
+ { STB0899_DACR2 , 0x00 },
+ { STB0899_OUTCFG , 0x00 },
+ { STB0899_MODECFG , 0x00 },
+ { STB0899_IRQSTATUS_3 , 0xfe },
+ { STB0899_IRQSTATUS_2 , 0x03 },
+ { STB0899_IRQSTATUS_1 , 0x7c },
+ { STB0899_IRQSTATUS_0 , 0xf4 },
+ { STB0899_IRQMSK_3 , 0xf3 },
+ { STB0899_IRQMSK_2 , 0xfc },
+ { STB0899_IRQMSK_1 , 0xff },
+ { STB0899_IRQMSK_0 , 0xff },
+ { STB0899_IRQCFG , 0x00 },
+ { STB0899_I2CCFG , 0x88 },
+ { STB0899_I2CRPT , 0x5c },
+ { STB0899_IOPVALUE5 , 0x00 },
+ { STB0899_IOPVALUE4 , 0x33 },
+ { STB0899_IOPVALUE3 , 0x6d },
+ { STB0899_IOPVALUE2 , 0x90 },
+ { STB0899_IOPVALUE1 , 0x60 },
+ { STB0899_IOPVALUE0 , 0x00 },
+ { STB0899_GPIO00CFG , 0x82 },
+ { STB0899_GPIO01CFG , 0x82 },
+ { STB0899_GPIO02CFG , 0x82 },
+ { STB0899_GPIO03CFG , 0x82 },
+ { STB0899_GPIO04CFG , 0x82 },
+ { STB0899_GPIO05CFG , 0x82 },
+ { STB0899_GPIO06CFG , 0x82 },
+ { STB0899_GPIO07CFG , 0x82 },
+ { STB0899_GPIO08CFG , 0x82 },
+ { STB0899_GPIO09CFG , 0x82 },
+ { STB0899_GPIO10CFG , 0x82 },
+ { STB0899_GPIO11CFG , 0x82 },
+ { STB0899_GPIO12CFG , 0x82 },
+ { STB0899_GPIO13CFG , 0x82 },
+ { STB0899_GPIO14CFG , 0x82 },
+ { STB0899_GPIO15CFG , 0x82 },
+ { STB0899_GPIO16CFG , 0x82 },
+ { STB0899_GPIO17CFG , 0x82 },
+ { STB0899_GPIO18CFG , 0x82 },
+ { STB0899_GPIO19CFG , 0x82 },
+ { STB0899_GPIO20CFG , 0x82 },
+ { STB0899_SDATCFG , 0xb8 },
+ { STB0899_SCLTCFG , 0xba },
+ { STB0899_AGCRFCFG , 0x1c }, /* 0x11 */
+ { STB0899_GPIO22 , 0x82 }, /* AGCBB2CFG */
+ { STB0899_GPIO21 , 0x91 }, /* AGCBB1CFG */
+ { STB0899_DIRCLKCFG , 0x82 },
+ { STB0899_CLKOUT27CFG , 0x7e },
+ { STB0899_STDBYCFG , 0x82 },
+ { STB0899_CS0CFG , 0x82 },
+ { STB0899_CS1CFG , 0x82 },
+ { STB0899_DISEQCOCFG , 0x20 },
+ { STB0899_GPIO32CFG , 0x82 },
+ { STB0899_GPIO33CFG , 0x82 },
+ { STB0899_GPIO34CFG , 0x82 },
+ { STB0899_GPIO35CFG , 0x82 },
+ { STB0899_GPIO36CFG , 0x82 },
+ { STB0899_GPIO37CFG , 0x82 },
+ { STB0899_GPIO38CFG , 0x82 },
+ { STB0899_GPIO39CFG , 0x82 },
+ { STB0899_NCOARSE , 0x17 }, /* 0x15 = 27 Mhz Clock, F/3 = 198MHz, F/6 = 99MHz */
+ { STB0899_SYNTCTRL , 0x02 }, /* 0x00 = CLK from CLKI, 0x02 = CLK from XTALI */
+ { STB0899_FILTCTRL , 0x00 },
+ { STB0899_SYSCTRL , 0x01 },
+ { STB0899_STOPCLK1 , 0x20 },
+ { STB0899_STOPCLK2 , 0x00 },
+ { STB0899_INTBUFSTATUS , 0x00 },
+ { STB0899_INTBUFCTRL , 0x0a },
+ { 0xffff , 0xff },
+};
+
+static const struct stb0899_s1_reg vp1041_stb0899_s1_init_3[] = {
+ { STB0899_DEMOD , 0x00 },
+ { STB0899_RCOMPC , 0xc9 },
+ { STB0899_AGC1CN , 0x41 },
+ { STB0899_AGC1REF , 0x10 },
+ { STB0899_RTC , 0x7a },
+ { STB0899_TMGCFG , 0x4e },
+ { STB0899_AGC2REF , 0x34 },
+ { STB0899_TLSR , 0x84 },
+ { STB0899_CFD , 0xc7 },
+ { STB0899_ACLC , 0x87 },
+ { STB0899_BCLC , 0x94 },
+ { STB0899_EQON , 0x41 },
+ { STB0899_LDT , 0xdd },
+ { STB0899_LDT2 , 0xc9 },
+ { STB0899_EQUALREF , 0xb4 },
+ { STB0899_TMGRAMP , 0x10 },
+ { STB0899_TMGTHD , 0x30 },
+ { STB0899_IDCCOMP , 0xfb },
+ { STB0899_QDCCOMP , 0x03 },
+ { STB0899_POWERI , 0x3b },
+ { STB0899_POWERQ , 0x3d },
+ { STB0899_RCOMP , 0x81 },
+ { STB0899_AGCIQIN , 0x80 },
+ { STB0899_AGC2I1 , 0x04 },
+ { STB0899_AGC2I2 , 0xf5 },
+ { STB0899_TLIR , 0x25 },
+ { STB0899_RTF , 0x80 },
+ { STB0899_DSTATUS , 0x00 },
+ { STB0899_LDI , 0xca },
+ { STB0899_CFRM , 0xf1 },
+ { STB0899_CFRL , 0xf3 },
+ { STB0899_NIRM , 0x2a },
+ { STB0899_NIRL , 0x05 },
+ { STB0899_ISYMB , 0x17 },
+ { STB0899_QSYMB , 0xfa },
+ { STB0899_SFRH , 0x2f },
+ { STB0899_SFRM , 0x68 },
+ { STB0899_SFRL , 0x40 },
+ { STB0899_SFRUPH , 0x2f },
+ { STB0899_SFRUPM , 0x68 },
+ { STB0899_SFRUPL , 0x40 },
+ { STB0899_EQUAI1 , 0xfd },
+ { STB0899_EQUAQ1 , 0x04 },
+ { STB0899_EQUAI2 , 0x0f },
+ { STB0899_EQUAQ2 , 0xff },
+ { STB0899_EQUAI3 , 0xdf },
+ { STB0899_EQUAQ3 , 0xfa },
+ { STB0899_EQUAI4 , 0x37 },
+ { STB0899_EQUAQ4 , 0x0d },
+ { STB0899_EQUAI5 , 0xbd },
+ { STB0899_EQUAQ5 , 0xf7 },
+ { STB0899_DSTATUS2 , 0x00 },
+ { STB0899_VSTATUS , 0x00 },
+ { STB0899_VERROR , 0xff },
+ { STB0899_IQSWAP , 0x2a },
+ { STB0899_ECNT1M , 0x00 },
+ { STB0899_ECNT1L , 0x00 },
+ { STB0899_ECNT2M , 0x00 },
+ { STB0899_ECNT2L , 0x00 },
+ { STB0899_ECNT3M , 0x00 },
+ { STB0899_ECNT3L , 0x00 },
+ { STB0899_FECAUTO1 , 0x06 },
+ { STB0899_FECM , 0x01 },
+ { STB0899_VTH12 , 0xf0 },
+ { STB0899_VTH23 , 0xa0 },
+ { STB0899_VTH34 , 0x78 },
+ { STB0899_VTH56 , 0x4e },
+ { STB0899_VTH67 , 0x48 },
+ { STB0899_VTH78 , 0x38 },
+ { STB0899_PRVIT , 0xff },
+ { STB0899_VITSYNC , 0x19 },
+ { STB0899_RSULC , 0xb1 }, /* DVB = 0xb1, DSS = 0xa1 */
+ { STB0899_TSULC , 0x42 },
+ { STB0899_RSLLC , 0x40 },
+ { STB0899_TSLPL , 0x12 },
+ { STB0899_TSCFGH , 0x0c },
+ { STB0899_TSCFGM , 0x00 },
+ { STB0899_TSCFGL , 0x0c },
+ { STB0899_TSOUT , 0x0d }, /* 0x0d for CAM */
+ { STB0899_RSSYNCDEL , 0x00 },
+ { STB0899_TSINHDELH , 0x02 },
+ { STB0899_TSINHDELM , 0x00 },
+ { STB0899_TSINHDELL , 0x00 },
+ { STB0899_TSLLSTKM , 0x00 },
+ { STB0899_TSLLSTKL , 0x00 },
+ { STB0899_TSULSTKM , 0x00 },
+ { STB0899_TSULSTKL , 0xab },
+ { STB0899_PCKLENUL , 0x00 },
+ { STB0899_PCKLENLL , 0xcc },
+ { STB0899_RSPCKLEN , 0xcc },
+ { STB0899_TSSTATUS , 0x80 },
+ { STB0899_ERRCTRL1 , 0xb6 },
+ { STB0899_ERRCTRL2 , 0x96 },
+ { STB0899_ERRCTRL3 , 0x89 },
+ { STB0899_DMONMSK1 , 0x27 },
+ { STB0899_DMONMSK0 , 0x03 },
+ { STB0899_DEMAPVIT , 0x5c },
+ { STB0899_PLPARM , 0x1f },
+ { STB0899_PDELCTRL , 0x48 },
+ { STB0899_PDELCTRL2 , 0x00 },
+ { STB0899_BBHCTRL1 , 0x00 },
+ { STB0899_BBHCTRL2 , 0x00 },
+ { STB0899_HYSTTHRESH , 0x77 },
+ { STB0899_MATCSTM , 0x00 },
+ { STB0899_MATCSTL , 0x00 },
+ { STB0899_UPLCSTM , 0x00 },
+ { STB0899_UPLCSTL , 0x00 },
+ { STB0899_DFLCSTM , 0x00 },
+ { STB0899_DFLCSTL , 0x00 },
+ { STB0899_SYNCCST , 0x00 },
+ { STB0899_SYNCDCSTM , 0x00 },
+ { STB0899_SYNCDCSTL , 0x00 },
+ { STB0899_ISI_ENTRY , 0x00 },
+ { STB0899_ISI_BIT_EN , 0x00 },
+ { STB0899_MATSTRM , 0x00 },
+ { STB0899_MATSTRL , 0x00 },
+ { STB0899_UPLSTRM , 0x00 },
+ { STB0899_UPLSTRL , 0x00 },
+ { STB0899_DFLSTRM , 0x00 },
+ { STB0899_DFLSTRL , 0x00 },
+ { STB0899_SYNCSTR , 0x00 },
+ { STB0899_SYNCDSTRM , 0x00 },
+ { STB0899_SYNCDSTRL , 0x00 },
+ { STB0899_CFGPDELSTATUS1 , 0x10 },
+ { STB0899_CFGPDELSTATUS2 , 0x00 },
+ { STB0899_BBFERRORM , 0x00 },
+ { STB0899_BBFERRORL , 0x00 },
+ { STB0899_UPKTERRORM , 0x00 },
+ { STB0899_UPKTERRORL , 0x00 },
+ { 0xffff , 0xff },
+};
+
+struct stb0899_config vp1041_config = {
+ .init_dev = vp1041_stb0899_s1_init_1,
+ .init_s2_demod = stb0899_s2_init_2,
+ .init_s1_demod = vp1041_stb0899_s1_init_3,
+ .init_s2_fec = stb0899_s2_init_4,
+ .init_tst = stb0899_s1_init_5,
+
+ .demod_address = 0x68, /* 0xd0 >> 1 */
+
+ .xtal_freq = 27000000,
+ .inversion = IQ_SWAP_ON, /* 1 */
+
+ .esno_ave = STB0899_DVBS2_ESNO_AVE,
+ .esno_quant = STB0899_DVBS2_ESNO_QUANT,
+ .avframes_coarse = STB0899_DVBS2_AVFRAMES_COARSE,
+ .avframes_fine = STB0899_DVBS2_AVFRAMES_FINE,
+ .miss_threshold = STB0899_DVBS2_MISS_THRESHOLD,
+ .uwp_threshold_acq = STB0899_DVBS2_UWP_THRESHOLD_ACQ,
+ .uwp_threshold_track = STB0899_DVBS2_UWP_THRESHOLD_TRACK,
+ .uwp_threshold_sof = STB0899_DVBS2_UWP_THRESHOLD_SOF,
+ .sof_search_timeout = STB0899_DVBS2_SOF_SEARCH_TIMEOUT,
+
+ .btr_nco_bits = STB0899_DVBS2_BTR_NCO_BITS,
+ .btr_gain_shift_offset = STB0899_DVBS2_BTR_GAIN_SHIFT_OFFSET,
+ .crl_nco_bits = STB0899_DVBS2_CRL_NCO_BITS,
+ .ldpc_max_iter = STB0899_DVBS2_LDPC_MAX_ITER,
+
+ .tuner_get_frequency = stb6100_get_frequency,
+ .tuner_set_frequency = stb6100_set_frequency,
+ .tuner_set_bandwidth = stb6100_set_bandwidth,
+ .tuner_get_bandwidth = stb6100_get_bandwidth,
+ .tuner_set_rfsiggain = NULL,
+};
+
+struct stb6100_config vp1041_stb6100_config = {
+ .tuner_address = 0x60,
+ .refclock = 27000000,
+};
diff --git a/drivers/media/dvb/mantis/mantis_vp1041.h b/drivers/media/dvb/mantis/mantis_vp1041.h
new file mode 100644
index 0000000..53f4cb1
--- /dev/null
+++ b/drivers/media/dvb/mantis/mantis_vp1041.h
@@ -0,0 +1,36 @@
+/*
+ Mantis VP-1041 driver
+
+ Copyright (C) Manu Abraham (abraham.manu@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.
+
+ 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 __MANTIS_VP1041_H
+#define __MANTIS_VP1041_H
+
+#include "dvb_frontend.h"
+#include "mantis_common.h"
+#include "stb0899_drv.h"
+#include "stb6100.h"
+#include "lnbp21.h"
+
+#define MANTIS_VP_1041_DVB_S2 0x0031
+
+extern struct mantis_hwconfig vp1041_mantis_config;
+extern struct stb0899_config vp1041_config;
+extern struct stb6100_config vp1041_stb6100_config;
+
+#endif // __MANTIS_VP1041_H
--
1.7.1

View File

@ -0,0 +1,212 @@
From 10b2d83487ca10de1738257dbe3277dffe572776 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 04:44:55 -0300
Subject: [PATCH 027/120] V4L/DVB (13725): [Mantis/VP-1041] Revert to old register initialization parameters, for now.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Thanks to eso46 for pointing it out
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 0131258ba7a5f776627da953b4cef775568026ea)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_vp1041.c | 126 +++++++++++++++---------------
1 files changed, 63 insertions(+), 63 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_vp1041.c b/drivers/media/dvb/mantis/mantis_vp1041.c
index a3279f0..8854ef3 100644
--- a/drivers/media/dvb/mantis/mantis_vp1041.c
+++ b/drivers/media/dvb/mantis/mantis_vp1041.c
@@ -125,102 +125,102 @@ static const struct stb0899_s1_reg vp1041_stb0899_s1_init_1[] = {
static const struct stb0899_s1_reg vp1041_stb0899_s1_init_3[] = {
{ STB0899_DEMOD , 0x00 },
{ STB0899_RCOMPC , 0xc9 },
- { STB0899_AGC1CN , 0x41 },
+ { STB0899_AGC1CN , 0x01 },
{ STB0899_AGC1REF , 0x10 },
- { STB0899_RTC , 0x7a },
+ { STB0899_RTC , 0x23 },
{ STB0899_TMGCFG , 0x4e },
{ STB0899_AGC2REF , 0x34 },
{ STB0899_TLSR , 0x84 },
- { STB0899_CFD , 0xc7 },
+ { STB0899_CFD , 0xf7 },
{ STB0899_ACLC , 0x87 },
{ STB0899_BCLC , 0x94 },
{ STB0899_EQON , 0x41 },
- { STB0899_LDT , 0xdd },
- { STB0899_LDT2 , 0xc9 },
+ { STB0899_LDT , 0xf1 },
+ { STB0899_LDT2 , 0xe3 },
{ STB0899_EQUALREF , 0xb4 },
{ STB0899_TMGRAMP , 0x10 },
{ STB0899_TMGTHD , 0x30 },
- { STB0899_IDCCOMP , 0xfb },
- { STB0899_QDCCOMP , 0x03 },
- { STB0899_POWERI , 0x3b },
- { STB0899_POWERQ , 0x3d },
- { STB0899_RCOMP , 0x81 },
+ { STB0899_IDCCOMP , 0xfd },
+ { STB0899_QDCCOMP , 0xff },
+ { STB0899_POWERI , 0x0c },
+ { STB0899_POWERQ , 0x0f },
+ { STB0899_RCOMP , 0x6c },
{ STB0899_AGCIQIN , 0x80 },
- { STB0899_AGC2I1 , 0x04 },
- { STB0899_AGC2I2 , 0xf5 },
- { STB0899_TLIR , 0x25 },
- { STB0899_RTF , 0x80 },
+ { STB0899_AGC2I1 , 0x06 },
+ { STB0899_AGC2I2 , 0x00 },
+ { STB0899_TLIR , 0x30 },
+ { STB0899_RTF , 0x7f },
{ STB0899_DSTATUS , 0x00 },
- { STB0899_LDI , 0xca },
- { STB0899_CFRM , 0xf1 },
- { STB0899_CFRL , 0xf3 },
- { STB0899_NIRM , 0x2a },
- { STB0899_NIRL , 0x05 },
- { STB0899_ISYMB , 0x17 },
- { STB0899_QSYMB , 0xfa },
+ { STB0899_LDI , 0xbc },
+ { STB0899_CFRM , 0xea },
+ { STB0899_CFRL , 0x31 },
+ { STB0899_NIRM , 0x2b },
+ { STB0899_NIRL , 0x80 },
+ { STB0899_ISYMB , 0x1d },
+ { STB0899_QSYMB , 0xa6 },
{ STB0899_SFRH , 0x2f },
{ STB0899_SFRM , 0x68 },
{ STB0899_SFRL , 0x40 },
{ STB0899_SFRUPH , 0x2f },
{ STB0899_SFRUPM , 0x68 },
{ STB0899_SFRUPL , 0x40 },
- { STB0899_EQUAI1 , 0xfd },
- { STB0899_EQUAQ1 , 0x04 },
- { STB0899_EQUAI2 , 0x0f },
- { STB0899_EQUAQ2 , 0xff },
- { STB0899_EQUAI3 , 0xdf },
- { STB0899_EQUAQ3 , 0xfa },
- { STB0899_EQUAI4 , 0x37 },
- { STB0899_EQUAQ4 , 0x0d },
- { STB0899_EQUAI5 , 0xbd },
- { STB0899_EQUAQ5 , 0xf7 },
+ { STB0899_EQUAI1 , 0x02 },
+ { STB0899_EQUAQ1 , 0xff },
+ { STB0899_EQUAI2 , 0x04 },
+ { STB0899_EQUAQ2 , 0x05 },
+ { STB0899_EQUAI3 , 0x02 },
+ { STB0899_EQUAQ3 , 0xfd },
+ { STB0899_EQUAI4 , 0x03 },
+ { STB0899_EQUAQ4 , 0x07 },
+ { STB0899_EQUAI5 , 0x08 },
+ { STB0899_EQUAQ5 , 0xf5 },
{ STB0899_DSTATUS2 , 0x00 },
{ STB0899_VSTATUS , 0x00 },
- { STB0899_VERROR , 0xff },
+ { STB0899_VERROR , 0x86 },
{ STB0899_IQSWAP , 0x2a },
{ STB0899_ECNT1M , 0x00 },
{ STB0899_ECNT1L , 0x00 },
{ STB0899_ECNT2M , 0x00 },
{ STB0899_ECNT2L , 0x00 },
- { STB0899_ECNT3M , 0x00 },
- { STB0899_ECNT3L , 0x00 },
+ { STB0899_ECNT3M , 0x0a },
+ { STB0899_ECNT3L , 0xad },
{ STB0899_FECAUTO1 , 0x06 },
{ STB0899_FECM , 0x01 },
- { STB0899_VTH12 , 0xf0 },
- { STB0899_VTH23 , 0xa0 },
- { STB0899_VTH34 , 0x78 },
- { STB0899_VTH56 , 0x4e },
- { STB0899_VTH67 , 0x48 },
- { STB0899_VTH78 , 0x38 },
+ { STB0899_VTH12 , 0xb0 },
+ { STB0899_VTH23 , 0x7a },
+ { STB0899_VTH34 , 0x58 },
+ { STB0899_VTH56 , 0x38 },
+ { STB0899_VTH67 , 0x34 },
+ { STB0899_VTH78 , 0x24 },
{ STB0899_PRVIT , 0xff },
{ STB0899_VITSYNC , 0x19 },
{ STB0899_RSULC , 0xb1 }, /* DVB = 0xb1, DSS = 0xa1 */
{ STB0899_TSULC , 0x42 },
- { STB0899_RSLLC , 0x40 },
+ { STB0899_RSLLC , 0x41 },
{ STB0899_TSLPL , 0x12 },
{ STB0899_TSCFGH , 0x0c },
{ STB0899_TSCFGM , 0x00 },
- { STB0899_TSCFGL , 0x0c },
- { STB0899_TSOUT , 0x0d }, /* 0x0d for CAM */
+ { STB0899_TSCFGL , 0x00 },
+ { STB0899_TSOUT , 0x69 }, /* 0x0d for CAM */
{ STB0899_RSSYNCDEL , 0x00 },
{ STB0899_TSINHDELH , 0x02 },
{ STB0899_TSINHDELM , 0x00 },
{ STB0899_TSINHDELL , 0x00 },
- { STB0899_TSLLSTKM , 0x00 },
- { STB0899_TSLLSTKL , 0x00 },
+ { STB0899_TSLLSTKM , 0x1b },
+ { STB0899_TSLLSTKL , 0xb3 },
{ STB0899_TSULSTKM , 0x00 },
- { STB0899_TSULSTKL , 0xab },
- { STB0899_PCKLENUL , 0x00 },
+ { STB0899_TSULSTKL , 0x00 },
+ { STB0899_PCKLENUL , 0xbc },
{ STB0899_PCKLENLL , 0xcc },
- { STB0899_RSPCKLEN , 0xcc },
- { STB0899_TSSTATUS , 0x80 },
+ { STB0899_RSPCKLEN , 0xbd },
+ { STB0899_TSSTATUS , 0x90 },
{ STB0899_ERRCTRL1 , 0xb6 },
- { STB0899_ERRCTRL2 , 0x96 },
- { STB0899_ERRCTRL3 , 0x89 },
+ { STB0899_ERRCTRL2 , 0x95 },
+ { STB0899_ERRCTRL3 , 0x8d },
{ STB0899_DMONMSK1 , 0x27 },
{ STB0899_DMONMSK0 , 0x03 },
{ STB0899_DEMAPVIT , 0x5c },
- { STB0899_PLPARM , 0x1f },
+ { STB0899_PLPARM , 0x19 },
{ STB0899_PDELCTRL , 0x48 },
{ STB0899_PDELCTRL2 , 0x00 },
{ STB0899_BBHCTRL1 , 0x00 },
@@ -237,19 +237,19 @@ static const struct stb0899_s1_reg vp1041_stb0899_s1_init_3[] = {
{ STB0899_SYNCDCSTL , 0x00 },
{ STB0899_ISI_ENTRY , 0x00 },
{ STB0899_ISI_BIT_EN , 0x00 },
- { STB0899_MATSTRM , 0x00 },
- { STB0899_MATSTRL , 0x00 },
- { STB0899_UPLSTRM , 0x00 },
- { STB0899_UPLSTRL , 0x00 },
- { STB0899_DFLSTRM , 0x00 },
+ { STB0899_MATSTRM , 0xf0 },
+ { STB0899_MATSTRL , 0x02 },
+ { STB0899_UPLSTRM , 0x45 },
+ { STB0899_UPLSTRL , 0x60 },
+ { STB0899_DFLSTRM , 0xe3 },
{ STB0899_DFLSTRL , 0x00 },
- { STB0899_SYNCSTR , 0x00 },
- { STB0899_SYNCDSTRM , 0x00 },
- { STB0899_SYNCDSTRL , 0x00 },
- { STB0899_CFGPDELSTATUS1 , 0x10 },
- { STB0899_CFGPDELSTATUS2 , 0x00 },
+ { STB0899_SYNCSTR , 0x47 },
+ { STB0899_SYNCDSTRM , 0x05 },
+ { STB0899_SYNCDSTRL , 0x18 },
+ { STB0899_CFGPDELSTATUS1 , 0x19 },
+ { STB0899_CFGPDELSTATUS2 , 0x2b },
{ STB0899_BBFERRORM , 0x00 },
- { STB0899_BBFERRORL , 0x00 },
+ { STB0899_BBFERRORL , 0x01 },
{ STB0899_UPKTERRORM , 0x00 },
{ STB0899_UPKTERRORL , 0x00 },
{ 0xffff , 0xff },
--
1.7.1

View File

@ -0,0 +1,58 @@
From 4a9230dd5b0b24c1ee13959924a240835c58f132 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 04:47:30 -0300
Subject: [PATCH 028/120] V4L/DVB (13726): [Mantis/Skystar HD2] Add support for the Technisat Skystar HD2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 35afca912ffb8ea5a060ff53a59266ccaa769c98)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_core.c | 1 +
drivers/media/dvb/mantis/mantis_dvb.c | 1 +
drivers/media/dvb/mantis/mantis_vp1041.h | 1 +
3 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_core.c b/drivers/media/dvb/mantis/mantis_core.c
index 47cfb75..a164bb1 100644
--- a/drivers/media/dvb/mantis/mantis_core.c
+++ b/drivers/media/dvb/mantis/mantis_core.c
@@ -113,6 +113,7 @@ static void mantis_load_config(struct mantis_pci *mantis)
mantis->hwconfig = &vp1034_mantis_config;
break;
case MANTIS_VP_1041_DVB_S2: // VP-1041
+ case TECHNISAT_SKYSTAR_HD2:
mantis->hwconfig = &vp1041_mantis_config;
break;
case MANTIS_VP_2033_DVB_C: // VP-2033
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c
index a4750bb..9634b97 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -240,6 +240,7 @@ int __devinit mantis_frontend_init(struct mantis_pci *mantis)
}
break;
case MANTIS_VP_1041_DVB_S2:
+ case TECHNISAT_SKYSTAR_HD2:
mantis->fe = stb0899_attach(&vp1041_config, &mantis->adapter);
if (mantis->fe) {
dprintk(verbose, MANTIS_ERROR, 1,
diff --git a/drivers/media/dvb/mantis/mantis_vp1041.h b/drivers/media/dvb/mantis/mantis_vp1041.h
index 53f4cb1..2cc83a6 100644
--- a/drivers/media/dvb/mantis/mantis_vp1041.h
+++ b/drivers/media/dvb/mantis/mantis_vp1041.h
@@ -28,6 +28,7 @@
#include "lnbp21.h"
#define MANTIS_VP_1041_DVB_S2 0x0031
+#define TECHNISAT_SKYSTAR_HD2 0x0001
extern struct mantis_hwconfig vp1041_mantis_config;
extern struct stb0899_config vp1041_config;
--
1.7.1

View File

@ -0,0 +1,33 @@
From ffabdfc2881ac07aa8ce7b27869f4372e887e7e7 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 04:48:03 -0300
Subject: [PATCH 029/120] V4L/DVB (13727): [Mantis/VP-1041] Bugfix: Sigh! Don't look for the STOP bit
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 1159531a93f04346d94f72fdb4719c3f7e7d0a8c)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_vp1041.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_vp1041.c b/drivers/media/dvb/mantis/mantis_vp1041.c
index 8854ef3..7dee1af 100644
--- a/drivers/media/dvb/mantis/mantis_vp1041.c
+++ b/drivers/media/dvb/mantis/mantis_vp1041.c
@@ -64,7 +64,7 @@ static const struct stb0899_s1_reg vp1041_stb0899_s1_init_1[] = {
{ STB0899_IRQMSK_0 , 0xff },
{ STB0899_IRQCFG , 0x00 },
{ STB0899_I2CCFG , 0x88 },
- { STB0899_I2CRPT , 0x5c },
+ { STB0899_I2CRPT , 0x58 },
{ STB0899_IOPVALUE5 , 0x00 },
{ STB0899_IOPVALUE4 , 0x33 },
{ STB0899_IOPVALUE3 , 0x6d },
--
1.7.1

View File

@ -0,0 +1,36 @@
From 76360bfbbbd52a857a5aabc8430801025593f2df Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 04:52:23 -0300
Subject: [PATCH 030/120] V4L/DVB (13728): [Mantis] Add in some Host Interface definitions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 9ce39460837202920fb9bad88eeec13fc75e7a13)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_hif.h | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
create mode 100644 drivers/media/dvb/mantis/mantis_hif.h
diff --git a/drivers/media/dvb/mantis/mantis_hif.h b/drivers/media/dvb/mantis/mantis_hif.h
new file mode 100644
index 0000000..33b4f2b
--- /dev/null
+++ b/drivers/media/dvb/mantis/mantis_hif.h
@@ -0,0 +1,9 @@
+#ifndef __MANTIS_HIF_H
+#define __MANTIS_HIF_H
+
+#define MANTIS_HIF_MEMRD 1
+#define MANTIS_HIF_MEMWR 2
+#define MANTIS_HIF_IOMRD 3
+#define MANTIS_HIF_IOMWR 4
+
+#endif // __MANTIS_HIF_H
--
1.7.1

View File

@ -0,0 +1,48 @@
From 4bb6decd82cafbf52b671ca1c12f71b579b9814c Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 04:53:07 -0300
Subject: [PATCH 031/120] V4L/DVB (13729): [Mantis] Add in a license header
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 23fc1b2b00e849f6ec8628da77e2f282aedbebf3)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_hif.h | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_hif.h b/drivers/media/dvb/mantis/mantis_hif.h
index 33b4f2b..7ef45ce 100644
--- a/drivers/media/dvb/mantis/mantis_hif.h
+++ b/drivers/media/dvb/mantis/mantis_hif.h
@@ -1,3 +1,23 @@
+/*
+ Mantis PCI bridge driver
+
+ Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@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.
+
+ 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 __MANTIS_HIF_H
#define __MANTIS_HIF_H
--
1.7.1

View File

@ -0,0 +1,45 @@
From a2b6bd1a3794cb067d95f8e0af7d02b3f9ab2e69 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 04:59:05 -0300
Subject: [PATCH 032/120] V4L/DVB (13730): [Mantis] Add in some UART definitions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit cb428c3fe9667eb7521769f25f65b9dbf52a33ca)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_uart.h | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
create mode 100644 drivers/media/dvb/mantis/mantis_uart.h
diff --git a/drivers/media/dvb/mantis/mantis_uart.h b/drivers/media/dvb/mantis/mantis_uart.h
new file mode 100644
index 0000000..6c9a17c
--- /dev/null
+++ b/drivers/media/dvb/mantis/mantis_uart.h
@@ -0,0 +1,18 @@
+#ifndef __MANTIS_UART_H
+#define __MANTIS_UART_H
+
+enum mantis_baud {
+ MANTIS_BAUD_9600 = 0,
+ MANTIS_BAUD_19200,
+ MANTIS_BAUD_38400,
+ MANTIS_BAUD_57600,
+ MANTIS_BAUD_115200
+};
+
+enum mantis_parity {
+ MANTIS_PARITY_NONE = 0,
+ MANTIS_PARITY_EVEN,
+ MANTIS_PARITY_ODD
+};
+
+#endif // __MANTIS_UART_H
--
1.7.1

View File

@ -0,0 +1,48 @@
From 6f11d90b8e18eec1587f9b3d7ca3e500114c26a3 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 04:59:44 -0300
Subject: [PATCH 033/120] V4L/DVB (13731): [Mantis] Add in a license header
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit d4f4ae046d2a9cd6b7ddb39e336a73ed92b63fe8)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_uart.h | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_uart.h b/drivers/media/dvb/mantis/mantis_uart.h
index 6c9a17c..6113863 100644
--- a/drivers/media/dvb/mantis/mantis_uart.h
+++ b/drivers/media/dvb/mantis/mantis_uart.h
@@ -1,3 +1,23 @@
+/*
+ Mantis PCI bridge driver
+
+ Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@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.
+
+ 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 __MANTIS_UART_H
#define __MANTIS_UART_H
--
1.7.1

View File

@ -0,0 +1,78 @@
From 30987d95eb9450a448f71c575e0bd031cc657378 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:00:30 -0300
Subject: [PATCH 034/120] V4L/DVB (13732): [Mantis] Add in some Link Layer definitions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit dd827da1e7d6ecf81883af68731cf0f1c2393c6d)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_link.h | 51 ++++++++++++++++++++++++++++++++
1 files changed, 51 insertions(+), 0 deletions(-)
create mode 100644 drivers/media/dvb/mantis/mantis_link.h
diff --git a/drivers/media/dvb/mantis/mantis_link.h b/drivers/media/dvb/mantis/mantis_link.h
new file mode 100644
index 0000000..2849457
--- /dev/null
+++ b/drivers/media/dvb/mantis/mantis_link.h
@@ -0,0 +1,51 @@
+/*
+ Mantis PCI bridge driver
+
+ Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@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.
+
+ 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 __MANTIS_LINK_H
+#define __MANTIS_LINK_H
+
+enum mantis_sbuf_status {
+ MANTIS_SBUF_DATA_AVAIL = 1,
+ MANTIS_SBUF_DATA_EMPTY = 2,
+ MANTIS_SBUF_DATA_OVFLW = 3
+};
+
+struct mantis_slot {
+ u32 timeout;
+};
+
+struct mantis_ca {
+ struct mantis_slot slot;
+
+ struct tasklet_struct hif_evm_tasklet;
+
+ u32 hif_event;
+ wait_queue_head_t hif_opdone_wq;
+ wait_queue_head_t hif_brrdyw_wq;
+ wait_queue_head_t hif_data_wq;
+ u32 hif_job_queue
+
+ enum mantis_sbuf_status sbuf_status;
+
+ struct dvb_device *ca_dev;
+ void *ca_priv;
+};
+
+#endif // __MANTIS_LINK_H
--
1.7.1

View File

@ -0,0 +1,124 @@
From 5a523189c824cae44f9cbac72014a5604511bbea Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:03:35 -0300
Subject: [PATCH 035/120] V4L/DVB (13733): [Mantis] Start with the PCMCIA interface
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit bc4ed42fdf762a2049b255de92626ad1cfd86d8e)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/Makefile | 17 ++++++++-------
drivers/media/dvb/mantis/mantis_common.h | 4 +++
drivers/media/dvb/mantis/mantis_link.h | 2 +-
drivers/media/dvb/mantis/mantis_pcmcia.c | 34 ++++++++++++++++++++++++++++++
4 files changed, 48 insertions(+), 9 deletions(-)
create mode 100644 drivers/media/dvb/mantis/mantis_pcmcia.c
diff --git a/drivers/media/dvb/mantis/Makefile b/drivers/media/dvb/mantis/Makefile
index bdf3e36..fa9e806 100644
--- a/drivers/media/dvb/mantis/Makefile
+++ b/drivers/media/dvb/mantis/Makefile
@@ -1,11 +1,12 @@
-mantis-objs = mantis_core.o \
- mantis_dma.o \
- mantis_pci.o \
- mantis_i2c.o \
- mantis_dvb.o \
- mantis_vp1033.o \
- mantis_vp1034.o \
- mantis_vp1041.o \
+mantis-objs = mantis_core.o \
+ mantis_dma.o \
+ mantis_pci.o \
+ mantis_i2c.o \
+ mantis_dvb.o \
+ mantis_pcmcia.o \
+ mantis_vp1033.o \
+ mantis_vp1034.o \
+ mantis_vp1041.o \
mantis_vp2033.o \
mantis_vp2040.o \
mantis_vp3030.o
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index 34d2389..24fc6da 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -35,6 +35,8 @@
#include <linux/i2c.h>
#include "mantis_reg.h"
+#include "mantis_link.h"
+
#define MANTIS_ERROR 0
#define MANTIS_NOTICE 1
#define MANTIS_INFO 2
@@ -134,6 +136,8 @@ struct mantis_pci {
/* A12 A13 A14 */
int gpio_status;
+
+ struct mantis_ca *mantis_ca;
};
extern unsigned int verbose;
diff --git a/drivers/media/dvb/mantis/mantis_link.h b/drivers/media/dvb/mantis/mantis_link.h
index 2849457..2d9b64f 100644
--- a/drivers/media/dvb/mantis/mantis_link.h
+++ b/drivers/media/dvb/mantis/mantis_link.h
@@ -40,7 +40,7 @@ struct mantis_ca {
wait_queue_head_t hif_opdone_wq;
wait_queue_head_t hif_brrdyw_wq;
wait_queue_head_t hif_data_wq;
- u32 hif_job_queue
+ u32 hif_job_queue;
enum mantis_sbuf_status sbuf_status;
diff --git a/drivers/media/dvb/mantis/mantis_pcmcia.c b/drivers/media/dvb/mantis/mantis_pcmcia.c
new file mode 100644
index 0000000..63f9621
--- /dev/null
+++ b/drivers/media/dvb/mantis/mantis_pcmcia.c
@@ -0,0 +1,34 @@
+/*
+ Mantis PCI bridge driver
+
+ Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@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.
+
+ 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 "mantis_common.h"
+
+int mantis_pcmcia_init(struct mantis_ca *ca)
+{
+ struct mantis_pci *mantis = ca->ca_priv;
+
+ return 0;
+}
+
+void mantis_pcmcia_exit(struct mantis_ca *ca)
+{
+ struct mantis_pci *mantis = ca->ca_priv;
+
+}
--
1.7.1

View File

@ -0,0 +1,91 @@
From d507f514ba5dd6b3ce52467628ddb7ffc7335219 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:04:18 -0300
Subject: [PATCH 036/120] V4L/DVB (13734): [Mantis] Initial go at an Event Manager
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit d575571e8eda92c2cfd727ef050d17e30878fee6)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/Makefile | 1 +
drivers/media/dvb/mantis/mantis_common.h | 2 +
drivers/media/dvb/mantis/mantis_evm.c | 37 ++++++++++++++++++++++++++++++
3 files changed, 40 insertions(+), 0 deletions(-)
create mode 100644 drivers/media/dvb/mantis/mantis_evm.c
diff --git a/drivers/media/dvb/mantis/Makefile b/drivers/media/dvb/mantis/Makefile
index fa9e806..38d0e6d 100644
--- a/drivers/media/dvb/mantis/Makefile
+++ b/drivers/media/dvb/mantis/Makefile
@@ -3,6 +3,7 @@ mantis-objs = mantis_core.o \
mantis_pci.o \
mantis_i2c.o \
mantis_dvb.o \
+ mantis_evm.o \
mantis_pcmcia.o \
mantis_vp1033.o \
mantis_vp1034.o \
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index 24fc6da..f9891eb 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -77,6 +77,8 @@ struct mantis_hwconfig {
};
struct mantis_pci {
+ unsigned int verbose;
+
/* PCI stuff */
u16 vendor_id;
u16 device_id;
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
new file mode 100644
index 0000000..c9359d6
--- /dev/null
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -0,0 +1,37 @@
+/*
+ Mantis PCI bridge driver
+
+ Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@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.
+
+ 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 "mantis_common.h"
+#include "mantis_link.h"
+
+int mantis_evmgr_init(struct mantis_ca *ca)
+{
+ struct mantis_pci *mantis = ca->ca_priv;
+
+ dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Initializing Mantis Host I/F Event manager");
+ return 0;
+}
+
+void mantis_evmgr_exit(struct mantis_ca *ca)
+{
+ struct mantis_pci *mantis = ca->ca_priv;
+
+ dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting");
+}
--
1.7.1

View File

@ -0,0 +1,188 @@
From cbfb85e388ffddbeaffde6b3a1d86f602ceb45b0 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:05:19 -0300
Subject: [PATCH 037/120] V4L/DVB (13735): [Mantis] Implement the Event Manager tasklet
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit fadfa070d30434dd228362c933827eb6ce137f2d)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_evm.c | 65 +++++++++++++++++++++++++++++++++
drivers/media/dvb/mantis/mantis_reg.h | 58 +++++++++++++++++++++++++++++-
2 files changed, 122 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index c9359d6..9f1740e 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -20,12 +20,76 @@
#include "mantis_common.h"
#include "mantis_link.h"
+#include "mantis_hif.h"
+
+void mantis_hifevm_tasklet(unsigned long data)
+{
+ struct mantis_ca *ca = (struct mantis_ca *) data;
+ struct mantis_pci *mantis = ca->ca_priv;
+
+ u32 gpif_stat;
+
+ gpif_stat = mmread(MANTIS_GPIF_STATUS);
+
+ if (gpif_stat & MANTIS_GPIF_DETSTAT) {
+ if (gpif_stat & MANTIS_CARD_PLUGIN) {
+ dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Plugin", mantis->num);
+ mmwrite(0xdada0000, MANTIS_CARD_RESET);
+ // Plugin call here
+ gpif_stat = 0; // crude !
+ }
+ } else {
+ if (gpif_stat & MANTIS_CARD_PLUGOUT) {
+ dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Unplug", mantis->num);
+ mmwrite(0xdada0000, MANTIS_CARD_RESET);
+ // Unplug call here
+ gpif_stat = 0; // crude !
+ }
+ }
+
+ if (gpif_stat & MANTIS_GPIF_EXTIRQ)
+ dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Ext IRQ", mantis->num);
+
+ if (gpif_stat & MANTIS_SBUF_WSTO)
+ dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Timeout", mantis->num);
+
+ if (gpif_stat & MANTIS_GPIF_OTHERR)
+ dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Alignment Error", mantis->num);
+
+ if (gpif_stat & MANTIS_SBUF_OVFLW)
+ dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Overflow", mantis->num);
+
+ if (gpif_stat & MANTIS_GPIF_BRRDY) {
+ dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Read Ready", mantis->num);
+ ca->sbuf_status = MANTIS_SBUF_DATA_AVAIL;
+ if (ca->hif_job_queue & MANTIS_HIF_MEMRD)
+ wake_up(&ca->hif_brrdyw_wq);
+ }
+ if (gpif_stat & MANTIS_GPIF_WRACK)
+ dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Slave Write ACK", mantis->num);
+
+ if (gpif_stat & MANTIS_GPIF_INTSTAT)
+ dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): GPIF IRQ", mantis->num);
+
+ if (gpif_stat & MANTIS_SBUF_EMPTY)
+ dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Empty", mantis->num);
+
+ if (gpif_stat & MANTIS_SBUF_OPDONE) {
+ dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer operation complete", mantis->num);
+ if (ca->hif_job_queue) {
+ wake_up(&ca->hif_opdone_wq);
+ ca->hif_event = MANTIS_SBUF_OPDONE;
+ }
+ }
+}
int mantis_evmgr_init(struct mantis_ca *ca)
{
struct mantis_pci *mantis = ca->ca_priv;
dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Initializing Mantis Host I/F Event manager");
+ tasklet_init(&ca->hif_evm_tasklet, mantis_hifevm_tasklet, (unsigned long) ca);
+
return 0;
}
@@ -34,4 +98,5 @@ void mantis_evmgr_exit(struct mantis_ca *ca)
struct mantis_pci *mantis = ca->ca_priv;
dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting");
+ tasklet_kill(&ca->hif_evm_tasklet);
}
diff --git a/drivers/media/dvb/mantis/mantis_reg.h b/drivers/media/dvb/mantis/mantis_reg.h
index 1b54e09..d9862b7 100644
--- a/drivers/media/dvb/mantis/mantis_reg.h
+++ b/drivers/media/dvb/mantis/mantis_reg.h
@@ -73,6 +73,40 @@
#define MANTIS_I2C_STOP (0x01 << 5)
#define MANTIS_I2C_PGMODE (0x01 << 3)
+#define MANTIS_GPIF_CFGSLA 0x84
+#define MANTIS_GPIF_WAITSMPL (0x07 << 28)
+#define MANTIS_GPIF_BYTEADDRSUB (0x01 << 25)
+#define MANTIS_GPIF_WAITPOL (0x01 << 24)
+#define MANTIS_GPIF_NCDELAY (0x07 << 20)
+#define MANTIS_GPIF_RW2CSDELAY (0x07 << 16)
+#define MANTIS_GPIF_SLFTIMEDMODE (0x01 << 15)
+#define MANTIS_GPIF_SLFTIMEDDELY (0x7f << 8)
+#define MANTIS_GPIF_DEVTYPE (0x07 << 4)
+#define MANTIS_GPIF_BIGENDIAN (0x01 << 3)
+#define MANTIS_GPIF_FETCHCMD (0x03 << 1)
+#define MANTIS_GPIF_HWORDDEV (0x01 << 0)
+
+#define MANTIS_GPIF_WSTOPER 0x90
+#define MANTIS_GPIF_WSTOPERWREN3 (0x01 << 31)
+#define MANTIS_GPIF_PARBOOTN (0x01 << 29)
+#define MANTIS_GPIF_WSTOPERSLID3 (0x1f << 24)
+#define MANTIS_GPIF_WSTOPERWREN2 (0x01 << 23)
+#define MANTIS_GPIF_WSTOPERSLID2 (0x1f << 16)
+#define MANTIS_GPIF_WSTOPERWREN1 (0x01 << 15)
+#define MANTIS_GPIF_WSTOPERSLID1 (0x1f << 8)
+#define MANTIS_GPIF_WSTOPERWREN0 (0x01 << 7)
+#define MANTIS_GPIF_WSTOPERSLID0 (0x1f << 0)
+
+#define MANTIS_GPIF_CS2RW 0x94
+#define MANTIS_GPIF_CS2RWWREN3 (0x01 << 31)
+#define MANTIS_GPIF_CS2RWDELY3 (0x3f << 24)
+#define MANTIS_GPIF_CS2RWWREN2 (0x01 << 23)
+#define MANTIS_GPIF_CS2RWDELY2 (0x3f << 16)
+#define MANTIS_GPIF_CS2RWWREN1 (0x01 << 15)
+#define MANTIS_GPIF_CS2RWDELY1 (0x3f << 8)
+#define MANTIS_GPIF_CS2RWWREN0 (0x01 << 7)
+#define MANTIS_GPIF_CS2RWDELY0 (0x3f << 0)
+
#define MANTIS_GPIF_IRQCFG 0x98
#define MANTIS_GPIF_IRQPOL (0x01 << 8)
#define MANTIS_MASK_WRACK (0x01 << 7)
@@ -99,11 +133,33 @@
#define MANTIS_CARD_PLUGIN (0x01 << 1)
#define MANTIS_CARD_PLUGOUT (0x01 << 0)
+#define MANTIS_GPIF_BRADDR 0xa0
+#define MANTIS_GPIF_PCMCIAREG (0x01 << 27)
+#define MANTIS_GPIF_PCMCIAIOM (0x01 << 26)
+#define MANTIS_GPIF_BR_ADDR (0xfffffff << 0)
+
+#define MANTIS_GPIF_BRBYTES 0xa4
+#define MANTIS_GPIF_BRCNT (0xfff << 0)
+
+#define MANTIS_PCMCIA_RESET 0xa8
+#define MANTIS_PCMCIA_RSTVAL (0xff << 0)
+
+#define MANTIS_CARD_RESET 0xac
+
#define MANTIS_GPIF_ADDR 0xb0
-#define MANTIS_GPIF_RDWRN (0x01 << 31)
+#define MANTIS_GPIF_RDWRN (0x01 << 31)
+#define MANTIS_GPIF_PCMCIAREG (0x01 << 27)
+#define MANTIS_GPIF_PCMCIAIOM (0x01 << 26)
+#define MANTIS_GPIF_HIF_ADDR (0xfffffff << 0)
#define MANTIS_GPIF_DOUT 0xb4
+#define MANTIS_GPIF_HIF_DOUT (0xfffffff << 0)
+
#define MANTIS_GPIF_DIN 0xb8
+#define MANTIS_GPIF_HIF_DIN (0xfffffff << 0)
+#define MANTIS_GPIF_SPARE 0xbc
+#define MANTIS_GPIF_LOGICRD (0xffff << 16)
+#define MANTIS_GPIF_LOGICRW (0xffff << 0)
#endif //__MANTIS_REG_H
--
1.7.1

View File

@ -0,0 +1,136 @@
From a82939e5aec354205b103cfe30ddb7d892e8fa73 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:06:00 -0300
Subject: [PATCH 038/120] V4L/DVB (13736): [Mantis] Implement CAM Plug IN and Unplug events
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Sigh! how i wish things were simpler ...
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 8ce571f5e7eb7186f676af3b60af7980c2fc7929)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_link.h | 8 ++++
drivers/media/dvb/mantis/mantis_pcmcia.c | 66 ++++++++++++++++++++++++++++++
2 files changed, 74 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_link.h b/drivers/media/dvb/mantis/mantis_link.h
index 2d9b64f..c6b3222 100644
--- a/drivers/media/dvb/mantis/mantis_link.h
+++ b/drivers/media/dvb/mantis/mantis_link.h
@@ -31,6 +31,12 @@ struct mantis_slot {
u32 timeout;
};
+/* Physical layer */
+enum mantis_slot_state {
+ MODULE_INSERTED = 3,
+ MODULE_XTRACTED = 4
+};
+
struct mantis_ca {
struct mantis_slot slot;
@@ -44,6 +50,8 @@ struct mantis_ca {
enum mantis_sbuf_status sbuf_status;
+ enum mantis_slot_state slot_state;
+
struct dvb_device *ca_dev;
void *ca_priv;
};
diff --git a/drivers/media/dvb/mantis/mantis_pcmcia.c b/drivers/media/dvb/mantis/mantis_pcmcia.c
index 63f9621..960123f 100644
--- a/drivers/media/dvb/mantis/mantis_pcmcia.c
+++ b/drivers/media/dvb/mantis/mantis_pcmcia.c
@@ -19,11 +19,75 @@
*/
#include "mantis_common.h"
+#include "mantis_link.h" /* temporary due to physical layer stuff */
+
+/*
+ * If Slot state is already PLUG_IN event and we are called
+ * again, definitely it is jitter alone
+ */
+void mantis_event_cam_plugin(struct mantis_ca *ca)
+{
+ struct mantis_pci *mantis = ca->ca_priv;
+
+ u32 gpif_irqcfg;
+
+ if (ca->slot_state == MODULE_XTRACTED) {
+ dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event: CAM Plugged IN: Adapter(%d) Slot(0)", mantis->num);
+ udelay(50);
+ mmwrite(0xda000000, MANTIS_CARD_RESET);
+ gpif_irqcfg = mmread(MANTIS_GPIF_IRQCFG);
+ gpif_irqcfg |= MANTIS_MASK_PLUGOUT;
+ gpif_irqcfg &= ~MANTIS_MASK_PLUGIN;
+ mmwrite(gpif_irqcfg, MANTIS_GPIF_IRQCFG);
+ udelay(500);
+ ca->slot_state = MODULE_INSERTED;
+ }
+ udelay(100);
+}
+
+/*
+ * If Slot state is already UN_PLUG event and we are called
+ * again, definitely it is jitter alone
+ */
+void mantis_event_cam_unplug(struct mantis_ca *ca)
+{
+ struct mantis_pci *mantis = ca->ca_priv;
+
+ u32 gpif_irqcfg;
+
+ if (ca->slot_state == MODULE_INSERTED) {
+ dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event: CAM Unplugged: Adapter(%d) Slot(0)", mantis->num);
+ udelay(50);
+ mmwrite(0x00da0000, MANTIS_CARD_RESET);
+ gpif_irqcfg = mmread(MANTIS_GPIF_IRQCFG);
+ gpif_irqcfg |= MANTIS_MASK_PLUGIN;
+ gpif_irqcfg &= ~MANTIS_MASK_PLUGOUT;
+ mmwrite(gpif_irqcfg, MANTIS_GPIF_IRQCFG);
+ udelay(500);
+ ca->slot_state = MODULE_XTRACTED;
+ }
+ udelay(100);
+}
int mantis_pcmcia_init(struct mantis_ca *ca)
{
struct mantis_pci *mantis = ca->ca_priv;
+ u32 gpif_stat, card_stat;
+
+ gpif_stat = mmread(MANTIS_GPIF_STATUS);
+ card_stat = mmread(MANTIS_GPIF_IRQCFG);
+
+ if (gpif_stat & MANTIS_GPIF_DETSTAT) {
+ dprintk(mantis->verbose, MANTIS_DEBUG, 1, "CAM found on Adapter(%d) Slot(0)", mantis->num);
+ mmwrite(card_stat | MANTIS_MASK_PLUGOUT, MANTIS_GPIF_IRQCFG);
+ ca->slot_state = MODULE_INSERTED;
+ } else {
+ dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Empty Slot on Adapter(%d) Slot(0)", mantis->num);
+ mmwrite(card_stat | MANTIS_MASK_PLUGIN, MANTIS_GPIF_IRQCFG);
+ ca->slot_state = MODULE_XTRACTED;
+ }
+
return 0;
}
@@ -31,4 +95,6 @@ void mantis_pcmcia_exit(struct mantis_ca *ca)
{
struct mantis_pci *mantis = ca->ca_priv;
+ mmwrite(mmread(MANTIS_GPIF_STATUS) & (~MANTIS_CARD_PLUGOUT | ~MANTIS_CARD_PLUGIN), MANTIS_GPIF_STATUS);
+ mmwrite(mmread(MANTIS_INT_MASK) & ~MANTIS_INT_IRQ0, MANTIS_INT_MASK);
}
--
1.7.1

View File

@ -0,0 +1,206 @@
From 2bce8cd841e4d14bd67ece014de12f5c0ccea046 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:06:38 -0300
Subject: [PATCH 039/120] V4L/DVB (13737): [Mantis] Register the CA device, dummy functions for now
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 50d82602760c99d2c954c33360990c00146532cd)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/Makefile | 1 +
drivers/media/dvb/mantis/mantis_ca.c | 127 ++++++++++++++++++++++++++++++++
drivers/media/dvb/mantis/mantis_evm.c | 4 +
drivers/media/dvb/mantis/mantis_link.h | 8 ++
4 files changed, 140 insertions(+), 0 deletions(-)
create mode 100644 drivers/media/dvb/mantis/mantis_ca.c
diff --git a/drivers/media/dvb/mantis/Makefile b/drivers/media/dvb/mantis/Makefile
index 38d0e6d..c4da0d8 100644
--- a/drivers/media/dvb/mantis/Makefile
+++ b/drivers/media/dvb/mantis/Makefile
@@ -4,6 +4,7 @@ mantis-objs = mantis_core.o \
mantis_i2c.o \
mantis_dvb.o \
mantis_evm.o \
+ mantis_ca.o \
mantis_pcmcia.o \
mantis_vp1033.o \
mantis_vp1034.o \
diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c
new file mode 100644
index 0000000..6e440d3
--- /dev/null
+++ b/drivers/media/dvb/mantis/mantis_ca.c
@@ -0,0 +1,127 @@
+/*
+ Mantis PCI bridge driver
+
+ Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@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.
+
+ 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 "mantis_common.h"
+#include "mantis_link.h"
+#include "mantis_hif.h"
+
+
+static int mantis_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long parg)
+{
+ return 0;
+}
+
+static int mantis_ca_open(struct inode *inode, struct file *file)
+{
+ return 0;
+}
+
+static int mantis_ca_release(struct inode *inode, struct file *file)
+{
+ return 0;
+}
+
+static ssize_t mantis_ca_read(struct file *file, char __user *buffer, size_t count, loff_t *ofset)
+{
+ struct dvb_device *dvbdev = file->private_data;
+ struct mantis_ca *ca = dvbdev->priv;
+
+ int status;
+
+ return 0;
+error:
+ return status;
+}
+
+static ssize_t mantis_ca_write(struct file *file, const char __user *buffer, size_t count, loff_t *offset)
+{
+ struct dvb_device *dvbdev = file->private_data;
+ struct mantis_ca *ca = dvbdev->priv;
+
+ int status;
+
+ return 0;
+error:
+ return status;
+}
+
+static struct file_operations mantis_fops = {
+ .owner = THIS_MODULE,
+ .ioctl = mantis_ca_ioctl,
+ .open = mantis_ca_open,
+ .release = mantis_ca_release,
+ .read = mantis_ca_read,
+ .write = mantis_ca_write,
+};
+
+static struct dvb_device mantis_ca = {
+ .priv = NULL,
+ .users = 1,
+ .readers = 1,
+ .writers = 1,
+ .fops = &mantis_fops,
+};
+
+struct dvb_device *mantis_ca_init(struct mantis_pci *mantis)
+{
+ int ret;
+
+ struct dvb_device *dvbdev;
+ struct dvb_adapter *dvb_adapter = &mantis->dvb_adapter;
+ struct mantis_ca *ca;
+
+ if (!(ca = kzalloc(sizeof (struct mantis_ca), GFP_KERNEL))) {
+ dprintk(verbose, MANTIS_ERROR, 1, "Out of memory!, exiting ..");
+ return NULL;
+ }
+
+ ca->ca_priv = mantis;
+ mantis->mantis_ca = ca;
+ mantis_evmgr_init(ca);
+
+ dprintk(verbose, MANTIS_ERROR, 0, "CA: Registering Mantis Adapter(%d) Slot(0)\n", mantis->num);
+ if (dvb_register_device(dvb_adapter, &dvbdev, &mantis_ca, ca, DVB_DEVICE_CA) == 0) {
+ ca->ca_dev = dvbdev;
+ return ca->ca_dev;
+ }
+ return 0;
+
+error:
+ if (ca != NULL) {
+ dprintk(verbose, MANTIS_ERROR, 1, "Error ..");
+ if (ca->ca_dev != NULL)
+ dvb_unregister_device(ca->ca_dev);
+
+ kfree(ca);
+ }
+ return NULL;
+}
+
+void mantis_ca_exit(struct mantis_pci *mantis)
+{
+ struct mantis_ca *ca = mantis->mantis_ca;
+
+ mantis_evmgr_exit(ca);
+ dprintk(verbose, MANTIS_ERROR, 0, "CA: Unregister Mantis Adapter(%d) Slot(0)\n", mantis->num);
+ if (ca->ca_dev)
+ dvb_unregister_device(ca->ca_dev);
+
+ kfree(ca);
+}
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index 9f1740e..c4a1c89 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -90,6 +90,8 @@ int mantis_evmgr_init(struct mantis_ca *ca)
dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Initializing Mantis Host I/F Event manager");
tasklet_init(&ca->hif_evm_tasklet, mantis_hifevm_tasklet, (unsigned long) ca);
+ mantis_pcmcia_init(ca);
+
return 0;
}
@@ -99,4 +101,6 @@ void mantis_evmgr_exit(struct mantis_ca *ca)
dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting");
tasklet_kill(&ca->hif_evm_tasklet);
+
+ mantis_pcmcia_exit(ca);
}
diff --git a/drivers/media/dvb/mantis/mantis_link.h b/drivers/media/dvb/mantis/mantis_link.h
index c6b3222..a45dd71 100644
--- a/drivers/media/dvb/mantis/mantis_link.h
+++ b/drivers/media/dvb/mantis/mantis_link.h
@@ -56,4 +56,12 @@ struct mantis_ca {
void *ca_priv;
};
+/* CA */
+extern void mantis_event_cam_plugin(struct mantis_ca *ca);
+extern void mantis_event_cam_unplug(struct mantis_ca *ca);
+extern int mantis_pcmcia_init(struct mantis_ca *ca);
+extern void mantis_pcmcia_exit(struct mantis_ca *ca);
+extern int mantis_evmgr_init(struct mantis_ca *ca);
+extern void mantis_evmgr_exit(struct mantis_ca *ca);
+
#endif // __MANTIS_LINK_H
--
1.7.1

View File

@ -0,0 +1,216 @@
From 3333df30c7b63f37c47d31829ace399caaf9cedd Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:07:41 -0300
Subject: [PATCH 040/120] V4L/DVB (13738): [Mantis] Enable IRQ0 events
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit d9dd5f7168d6a61491996fc02e4deb9d96308178)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_ca.c | 4 ++--
drivers/media/dvb/mantis/mantis_dvb.c | 2 ++
drivers/media/dvb/mantis/mantis_evm.c | 26 +++++++++++++-------------
drivers/media/dvb/mantis/mantis_pci.c | 10 ++++------
drivers/media/dvb/mantis/mantis_pcmcia.c | 9 +++++----
5 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c
index 6e440d3..e6de3c9 100644
--- a/drivers/media/dvb/mantis/mantis_ca.c
+++ b/drivers/media/dvb/mantis/mantis_ca.c
@@ -93,12 +93,12 @@ struct dvb_device *mantis_ca_init(struct mantis_pci *mantis)
}
ca->ca_priv = mantis;
- mantis->mantis_ca = ca;
- mantis_evmgr_init(ca);
dprintk(verbose, MANTIS_ERROR, 0, "CA: Registering Mantis Adapter(%d) Slot(0)\n", mantis->num);
if (dvb_register_device(dvb_adapter, &dvbdev, &mantis_ca, ca, DVB_DEVICE_CA) == 0) {
ca->ca_dev = dvbdev;
+ mantis->mantis_ca = ca;
+ mantis_evmgr_init(ca);
return ca->ca_dev;
}
return 0;
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c
index 9634b97..3325b59 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -190,6 +190,8 @@ int __devinit mantis_dvb_init(struct mantis_pci *mantis)
dvb_net_init(&mantis->dvb_adapter, &mantis->dvbnet, &mantis->demux.dmx);
tasklet_init(&mantis->tasklet, mantis_dma_xfer, (unsigned long) mantis);
mantis_frontend_init(mantis);
+ mantis_ca_init(mantis);
+
return 0;
/* Error conditions .. */
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index c4a1c89..d81068d 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -33,14 +33,14 @@ void mantis_hifevm_tasklet(unsigned long data)
if (gpif_stat & MANTIS_GPIF_DETSTAT) {
if (gpif_stat & MANTIS_CARD_PLUGIN) {
- dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Plugin", mantis->num);
+ dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Plugin", mantis->num);
mmwrite(0xdada0000, MANTIS_CARD_RESET);
// Plugin call here
gpif_stat = 0; // crude !
}
} else {
if (gpif_stat & MANTIS_CARD_PLUGOUT) {
- dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Unplug", mantis->num);
+ dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Unplug", mantis->num);
mmwrite(0xdada0000, MANTIS_CARD_RESET);
// Unplug call here
gpif_stat = 0; // crude !
@@ -48,34 +48,34 @@ void mantis_hifevm_tasklet(unsigned long data)
}
if (gpif_stat & MANTIS_GPIF_EXTIRQ)
- dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Ext IRQ", mantis->num);
+ dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Ext IRQ", mantis->num);
if (gpif_stat & MANTIS_SBUF_WSTO)
- dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Timeout", mantis->num);
+ dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Timeout", mantis->num);
if (gpif_stat & MANTIS_GPIF_OTHERR)
- dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Alignment Error", mantis->num);
+ dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Alignment Error", mantis->num);
if (gpif_stat & MANTIS_SBUF_OVFLW)
- dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Overflow", mantis->num);
+ dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Overflow", mantis->num);
if (gpif_stat & MANTIS_GPIF_BRRDY) {
- dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Read Ready", mantis->num);
+ dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Read Ready", mantis->num);
ca->sbuf_status = MANTIS_SBUF_DATA_AVAIL;
if (ca->hif_job_queue & MANTIS_HIF_MEMRD)
wake_up(&ca->hif_brrdyw_wq);
}
if (gpif_stat & MANTIS_GPIF_WRACK)
- dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Slave Write ACK", mantis->num);
+ dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Slave Write ACK", mantis->num);
if (gpif_stat & MANTIS_GPIF_INTSTAT)
- dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): GPIF IRQ", mantis->num);
+ dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): GPIF IRQ", mantis->num);
if (gpif_stat & MANTIS_SBUF_EMPTY)
- dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Empty", mantis->num);
+ dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Empty", mantis->num);
if (gpif_stat & MANTIS_SBUF_OPDONE) {
- dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer operation complete", mantis->num);
+ dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer operation complete", mantis->num);
if (ca->hif_job_queue) {
wake_up(&ca->hif_opdone_wq);
ca->hif_event = MANTIS_SBUF_OPDONE;
@@ -87,7 +87,7 @@ int mantis_evmgr_init(struct mantis_ca *ca)
{
struct mantis_pci *mantis = ca->ca_priv;
- dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Initializing Mantis Host I/F Event manager");
+ dprintk(verbose, MANTIS_DEBUG, 1, "Initializing Mantis Host I/F Event manager");
tasklet_init(&ca->hif_evm_tasklet, mantis_hifevm_tasklet, (unsigned long) ca);
mantis_pcmcia_init(ca);
@@ -99,7 +99,7 @@ void mantis_evmgr_exit(struct mantis_ca *ca)
{
struct mantis_pci *mantis = ca->ca_priv;
- dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting");
+ dprintk(verbose, MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting");
tasklet_kill(&ca->hif_evm_tasklet);
mantis_pcmcia_exit(ca);
diff --git a/drivers/media/dvb/mantis/mantis_pci.c b/drivers/media/dvb/mantis/mantis_pci.c
index 402f866..814c6ac 100644
--- a/drivers/media/dvb/mantis/mantis_pci.c
+++ b/drivers/media/dvb/mantis/mantis_pci.c
@@ -54,12 +54,15 @@ static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
{
u32 stat = 0, mask = 0, lstat = 0, mstat = 0;
struct mantis_pci *mantis;
+ struct mantis_ca *ca;
mantis = (struct mantis_pci *) dev_id;
if (unlikely(mantis == NULL)) {
dprintk(verbose, MANTIS_ERROR, 1, "Mantis == NULL");
return IRQ_NONE;
}
+ ca = mantis->mantis_ca;
+
stat = mmread(MANTIS_INT_STAT);
mask = mmread(MANTIS_INT_MASK);
mstat = lstat = stat & ~MANTIS_INT_RISCSTAT;
@@ -72,14 +75,9 @@ static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
if (stat & MANTIS_INT_RISCEN) {
dprintk(verbose, MANTIS_DEBUG, 0, "* DMA enabl *");
}
- if (stat & MANTIS_INT_I2CRACK) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* I2C R-ACK *");
- }
- if (stat & MANTIS_INT_PCMCIA7) {
- dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-07 *");
- }
if (stat & MANTIS_INT_IRQ0) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-0 *");
+ tasklet_schedule(&ca->hif_evm_tasklet);
}
if (stat & MANTIS_INT_IRQ1) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-1 *");
diff --git a/drivers/media/dvb/mantis/mantis_pcmcia.c b/drivers/media/dvb/mantis/mantis_pcmcia.c
index 960123f..47cc720 100644
--- a/drivers/media/dvb/mantis/mantis_pcmcia.c
+++ b/drivers/media/dvb/mantis/mantis_pcmcia.c
@@ -32,7 +32,7 @@ void mantis_event_cam_plugin(struct mantis_ca *ca)
u32 gpif_irqcfg;
if (ca->slot_state == MODULE_XTRACTED) {
- dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event: CAM Plugged IN: Adapter(%d) Slot(0)", mantis->num);
+ dprintk(verbose, MANTIS_DEBUG, 1, "Event: CAM Plugged IN: Adapter(%d) Slot(0)", mantis->num);
udelay(50);
mmwrite(0xda000000, MANTIS_CARD_RESET);
gpif_irqcfg = mmread(MANTIS_GPIF_IRQCFG);
@@ -56,7 +56,7 @@ void mantis_event_cam_unplug(struct mantis_ca *ca)
u32 gpif_irqcfg;
if (ca->slot_state == MODULE_INSERTED) {
- dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event: CAM Unplugged: Adapter(%d) Slot(0)", mantis->num);
+ dprintk(verbose, MANTIS_DEBUG, 1, "Event: CAM Unplugged: Adapter(%d) Slot(0)", mantis->num);
udelay(50);
mmwrite(0x00da0000, MANTIS_CARD_RESET);
gpif_irqcfg = mmread(MANTIS_GPIF_IRQCFG);
@@ -75,15 +75,16 @@ int mantis_pcmcia_init(struct mantis_ca *ca)
u32 gpif_stat, card_stat;
+ mmwrite(mmread(MANTIS_INT_MASK) | MANTIS_INT_IRQ0, MANTIS_INT_MASK);
gpif_stat = mmread(MANTIS_GPIF_STATUS);
card_stat = mmread(MANTIS_GPIF_IRQCFG);
if (gpif_stat & MANTIS_GPIF_DETSTAT) {
- dprintk(mantis->verbose, MANTIS_DEBUG, 1, "CAM found on Adapter(%d) Slot(0)", mantis->num);
+ dprintk(verbose, MANTIS_DEBUG, 1, "CAM found on Adapter(%d) Slot(0)", mantis->num);
mmwrite(card_stat | MANTIS_MASK_PLUGOUT, MANTIS_GPIF_IRQCFG);
ca->slot_state = MODULE_INSERTED;
} else {
- dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Empty Slot on Adapter(%d) Slot(0)", mantis->num);
+ dprintk(verbose, MANTIS_DEBUG, 1, "Empty Slot on Adapter(%d) Slot(0)", mantis->num);
mmwrite(card_stat | MANTIS_MASK_PLUGIN, MANTIS_GPIF_IRQCFG);
ca->slot_state = MODULE_XTRACTED;
}
--
1.7.1

View File

@ -0,0 +1,51 @@
From 8d27616d891a20191696372dc90d55405926bfdf Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:08:25 -0300
Subject: [PATCH 041/120] V4L/DVB (13739): [Mantis] Event Manager: Handle Masked events only
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 3062b1571a1d3520c4d3160ebbfca8002b1d6963)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_dvb.c | 1 +
drivers/media/dvb/mantis/mantis_evm.c | 5 ++++-
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c
index 3325b59..ade4449 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -313,6 +313,7 @@ int __devinit mantis_frontend_init(struct mantis_pci *mantis)
int __devexit mantis_dvb_exit(struct mantis_pci *mantis)
{
+ mantis_ca_exit(mantis);
tasklet_kill(&mantis->tasklet);
dvb_net_release(&mantis->dvbnet);
mantis->demux.dmx.remove_frontend(&mantis->demux.dmx, &mantis->fe_mem);
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index d81068d..c35ddd8 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -27,9 +27,12 @@ void mantis_hifevm_tasklet(unsigned long data)
struct mantis_ca *ca = (struct mantis_ca *) data;
struct mantis_pci *mantis = ca->ca_priv;
- u32 gpif_stat;
+ u32 gpif_stat, gpif_mask;
gpif_stat = mmread(MANTIS_GPIF_STATUS);
+ gpif_mask = mmread(MANTIS_GPIF_IRQCFG);
+ if (!((gpif_stat & 0xff) & (gpif_mask & 0xff)))
+ return;
if (gpif_stat & MANTIS_GPIF_DETSTAT) {
if (gpif_stat & MANTIS_CARD_PLUGIN) {
--
1.7.1

View File

@ -0,0 +1,126 @@
From 287e7877d3f49afcee6587b36e0c854ef50319b1 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:09:04 -0300
Subject: [PATCH 042/120] V4L/DVB (13740): [Mantis] Schedule the work instead of handling the task directly
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 12855cac87218d0c92ffdebb7270cec040cf5a6a)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_common.h | 4 ++++
drivers/media/dvb/mantis/mantis_evm.c | 17 +++++++----------
drivers/media/dvb/mantis/mantis_link.h | 4 +++-
drivers/media/dvb/mantis/mantis_pci.c | 2 +-
4 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index f9891eb..7f1cfad 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -151,4 +151,8 @@ extern int mantis_dvb_exit(struct mantis_pci *mantis);
extern void mantis_dma_xfer(unsigned long data);
extern void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value);
+extern struct dvb_device *mantis_ca_init(struct mantis_pci *mantis);
+extern void mantis_ca_exit(struct mantis_pci *mantis);
+
+
#endif //__MANTIS_COMMON_H
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index c35ddd8..7451483 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -22,9 +22,9 @@
#include "mantis_link.h"
#include "mantis_hif.h"
-void mantis_hifevm_tasklet(unsigned long data)
+static void mantis_hifevm_work(struct work_struct *work)
{
- struct mantis_ca *ca = (struct mantis_ca *) data;
+ struct mantis_ca *ca = container_of(work, struct mantis_ca, hif_evm_work);
struct mantis_pci *mantis = ca->ca_priv;
u32 gpif_stat, gpif_mask;
@@ -38,15 +38,13 @@ void mantis_hifevm_tasklet(unsigned long data)
if (gpif_stat & MANTIS_CARD_PLUGIN) {
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Plugin", mantis->num);
mmwrite(0xdada0000, MANTIS_CARD_RESET);
- // Plugin call here
- gpif_stat = 0; // crude !
+ mantis_event_cam_plugin(ca);
}
} else {
if (gpif_stat & MANTIS_CARD_PLUGOUT) {
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Unplug", mantis->num);
mmwrite(0xdada0000, MANTIS_CARD_RESET);
- // Unplug call here
- gpif_stat = 0; // crude !
+ mantis_event_cam_unplug(ca);
}
}
@@ -91,9 +89,9 @@ int mantis_evmgr_init(struct mantis_ca *ca)
struct mantis_pci *mantis = ca->ca_priv;
dprintk(verbose, MANTIS_DEBUG, 1, "Initializing Mantis Host I/F Event manager");
- tasklet_init(&ca->hif_evm_tasklet, mantis_hifevm_tasklet, (unsigned long) ca);
-
+ INIT_WORK(&ca->hif_evm_work, mantis_hifevm_work);
mantis_pcmcia_init(ca);
+ schedule_work(&ca->hif_evm_work);
return 0;
}
@@ -103,7 +101,6 @@ void mantis_evmgr_exit(struct mantis_ca *ca)
struct mantis_pci *mantis = ca->ca_priv;
dprintk(verbose, MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting");
- tasklet_kill(&ca->hif_evm_tasklet);
-
+ flush_scheduled_work();
mantis_pcmcia_exit(ca);
}
diff --git a/drivers/media/dvb/mantis/mantis_link.h b/drivers/media/dvb/mantis/mantis_link.h
index a45dd71..33b39b7 100644
--- a/drivers/media/dvb/mantis/mantis_link.h
+++ b/drivers/media/dvb/mantis/mantis_link.h
@@ -21,6 +21,8 @@
#ifndef __MANTIS_LINK_H
#define __MANTIS_LINK_H
+#include <linux/workqueue.h>
+
enum mantis_sbuf_status {
MANTIS_SBUF_DATA_AVAIL = 1,
MANTIS_SBUF_DATA_EMPTY = 2,
@@ -40,7 +42,7 @@ enum mantis_slot_state {
struct mantis_ca {
struct mantis_slot slot;
- struct tasklet_struct hif_evm_tasklet;
+ struct work_struct hif_evm_work;
u32 hif_event;
wait_queue_head_t hif_opdone_wq;
diff --git a/drivers/media/dvb/mantis/mantis_pci.c b/drivers/media/dvb/mantis/mantis_pci.c
index 814c6ac..6eecd54 100644
--- a/drivers/media/dvb/mantis/mantis_pci.c
+++ b/drivers/media/dvb/mantis/mantis_pci.c
@@ -77,7 +77,7 @@ static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
}
if (stat & MANTIS_INT_IRQ0) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-0 *");
- tasklet_schedule(&ca->hif_evm_tasklet);
+ schedule_work(&ca->hif_evm_work);
}
if (stat & MANTIS_INT_IRQ1) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-1 *");
--
1.7.1

View File

@ -0,0 +1,283 @@
From 158ceffb222e98f0547309d0722fd69e2a5ed4a8 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:09:47 -0300
Subject: [PATCH 043/120] V4L/DVB (13741): [Mantis] Implement HIF Mem Read/Write operations
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit d8b14f8a76d71c84622a211f57baf15f61cc9703)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/Makefile | 1 +
drivers/media/dvb/mantis/mantis_dma.c | 4 +-
drivers/media/dvb/mantis/mantis_evm.c | 3 +-
drivers/media/dvb/mantis/mantis_hif.c | 139 ++++++++++++++++++++++++++++++++
drivers/media/dvb/mantis/mantis_link.h | 10 ++-
drivers/media/dvb/mantis/mantis_reg.h | 8 +-
6 files changed, 157 insertions(+), 8 deletions(-)
create mode 100644 drivers/media/dvb/mantis/mantis_hif.c
diff --git a/drivers/media/dvb/mantis/Makefile b/drivers/media/dvb/mantis/Makefile
index c4da0d8..d002ef9 100644
--- a/drivers/media/dvb/mantis/Makefile
+++ b/drivers/media/dvb/mantis/Makefile
@@ -4,6 +4,7 @@ mantis-objs = mantis_core.o \
mantis_i2c.o \
mantis_dvb.o \
mantis_evm.o \
+ mantis_hif.o \
mantis_ca.o \
mantis_pcmcia.o \
mantis_vp1033.o \
diff --git a/drivers/media/dvb/mantis/mantis_dma.c b/drivers/media/dvb/mantis/mantis_dma.c
index f685992..250f49a 100644
--- a/drivers/media/dvb/mantis/mantis_dma.c
+++ b/drivers/media/dvb/mantis/mantis_dma.c
@@ -190,7 +190,7 @@ void mantis_dma_start(struct mantis_pci *mantis)
mantis_risc_program(mantis);
mmwrite(mantis->risc_dma, MANTIS_RISC_START);
- mmwrite(mmread(MANTIS_GPIF_ADDR) | MANTIS_GPIF_RDWRN, MANTIS_GPIF_ADDR);
+ mmwrite(mmread(MANTIS_GPIF_HIFADDR) | MANTIS_GPIF_HIFRDWRN, MANTIS_GPIF_HIFADDR);
mmwrite(0, MANTIS_DMA_CTL);
mantis->last_block = mantis->finished_block = 0;
@@ -210,7 +210,7 @@ void mantis_dma_stop(struct mantis_pci *mantis)
mask = mmread(MANTIS_INT_MASK);
dprintk(verbose, MANTIS_DEBUG, 1, "Mantis Stop DMA engine");
- mmwrite((mmread(MANTIS_GPIF_ADDR) & (~(MANTIS_GPIF_RDWRN))), MANTIS_GPIF_ADDR);
+ mmwrite((mmread(MANTIS_GPIF_HIFADDR) & (~(MANTIS_GPIF_HIFRDWRN))), MANTIS_GPIF_HIFADDR);
mmwrite((mmread(MANTIS_DMA_CTL) & ~(MANTIS_FIFO_EN |
MANTIS_DCAP_EN |
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index 7451483..dbcdca3 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -92,7 +92,7 @@ int mantis_evmgr_init(struct mantis_ca *ca)
INIT_WORK(&ca->hif_evm_work, mantis_hifevm_work);
mantis_pcmcia_init(ca);
schedule_work(&ca->hif_evm_work);
-
+ mantis_hif_init(ca);
return 0;
}
@@ -102,5 +102,6 @@ void mantis_evmgr_exit(struct mantis_ca *ca)
dprintk(verbose, MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting");
flush_scheduled_work();
+ mantis_hif_exit(ca);
mantis_pcmcia_exit(ca);
}
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
new file mode 100644
index 0000000..1472008
--- /dev/null
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -0,0 +1,139 @@
+/*
+ Mantis PCI bridge driver
+
+ Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@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.
+
+ 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 "mantis_common.h"
+#include "mantis_hif.h"
+#include "mantis_link.h" /* temporary due to physical layer stuff */
+
+static int mantis_hif_data_available(struct mantis_ca *ca)
+{
+ struct mantis_pci *mantis = ca->ca_priv;
+ int rc = 0;
+
+ if (wait_event_interruptible_timeout(ca->hif_data_wq,
+ ca->sbuf_status & MANTIS_SBUF_DATA_AVAIL,
+ msecs_to_jiffies(500)) == -ERESTARTSYS) {
+
+ dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Read wait event timeout !", mantis->num);
+ rc = -EREMOTEIO;
+ }
+ ca->sbuf_status &= ~MANTIS_SBUF_DATA_AVAIL;
+ udelay(2);
+ return rc;
+}
+
+static int mantis_hif_sbuf_opdone_wait(struct mantis_ca *ca)
+{
+ struct mantis_pci *mantis = ca->ca_priv;
+ int rc = 0;
+
+ if (wait_event_interruptible_timeout(ca->hif_opdone_wq,
+ ca->hif_event & MANTIS_SBUF_OPDONE,
+ msecs_to_jiffies(500)) == -ERESTARTSYS) {
+
+ dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): Smart buffer operation timeout !", mantis->num);
+ rc = -EREMOTEIO;
+ }
+ ca->hif_event &= ~MANTIS_SBUF_OPDONE;
+ udelay(5);
+ return rc;
+}
+
+int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr)
+{
+ struct mantis_pci *mantis = ca->ca_priv;
+ u32 hif_addr = 0, data, count = 4;
+
+ hif_addr |= MANTIS_GPIF_HIFRDWRN;
+ hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
+ hif_addr &= ~MANTIS_GPIF_PCMCIAIOM;
+ hif_addr |= addr;
+
+ mmwrite(hif_addr, MANTIS_GPIF_BRADDR);
+ mmwrite(count, MANTIS_GPIF_BRBYTES);
+
+ udelay(20);
+
+ mmwrite(hif_addr, MANTIS_GPIF_HIFADDR);
+ if (mantis_hif_data_available(ca) != 0) {
+ dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): GPIF Smart Buffer burst read failed", mantis->num);
+ return -EREMOTEIO;
+ }
+ if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
+ dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): GPIF Smart Buffer operation failed", mantis->num);
+ return -EREMOTEIO;
+ }
+ data = mmread(MANTIS_GPIF_HIFDIN);
+
+ return (data >> 24) & 0xff;
+}
+
+int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data)
+{
+ struct mantis_slot *slot = ca->slot;
+ struct mantis_pci *mantis = ca->ca_priv;
+ u32 hif_addr = 0;
+
+ hif_addr &= ~MANTIS_GPIF_HIFRDWRN;
+ hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
+ hif_addr &= ~MANTIS_GPIF_PCMCIAIOM;
+ hif_addr |= addr;
+
+ mmwrite(slot->slave_cfg, MANTIS_GPIF_CFGSLA); /* Slot0 alone for now */
+
+ mmwrite(hif_addr, MANTIS_GPIF_HIFADDR);
+ mmwrite(data, MANTIS_GPIF_HIFDOUT);
+ ca->hif_job_queue = MANTIS_HIF_MEMWR;
+
+ if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
+ ca->hif_job_queue &= ~MANTIS_HIF_MEMWR;
+ dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
+ return -EREMOTEIO;
+ }
+ ca->hif_job_queue &= ~MANTIS_HIF_MEMWR;
+ return 0;
+}
+
+int mantis_hif_init(struct mantis_ca *ca)
+{
+ struct mantis_pci *mantis = ca->ca_priv;
+ u32 irqcfg;
+
+ dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Initializing Mantis Host Interface", mantis->num);
+ init_waitqueue_head(&ca->hif_data_wq);
+ init_waitqueue_head(&ca->hif_opdone_wq);
+
+ irqcfg = mmread(MANTIS_GPIF_IRQCFG);
+ irqcfg |= MANTIS_MASK_BRRDY;
+ mmwrite(irqcfg, MANTIS_GPIF_IRQCFG);
+
+ return 0;
+}
+
+void mantis_hif_exit(struct mantis_ca *ca)
+{
+ struct mantis_pci *mantis = ca->ca_priv;
+ u32 irqcfg;
+
+ dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Exiting Mantis Host Interface", mantis->num);
+ irqcfg = mmread(MANTIS_GPIF_IRQCFG);
+ irqcfg &= ~MANTIS_MASK_BRRDY;
+ mmwrite(irqcfg, MANTIS_GPIF_IRQCFG);
+}
diff --git a/drivers/media/dvb/mantis/mantis_link.h b/drivers/media/dvb/mantis/mantis_link.h
index 33b39b7..8862502 100644
--- a/drivers/media/dvb/mantis/mantis_link.h
+++ b/drivers/media/dvb/mantis/mantis_link.h
@@ -31,6 +31,8 @@ enum mantis_sbuf_status {
struct mantis_slot {
u32 timeout;
+ u32 slave_cfg;
+ u32 bar;
};
/* Physical layer */
@@ -40,7 +42,7 @@ enum mantis_slot_state {
};
struct mantis_ca {
- struct mantis_slot slot;
+ struct mantis_slot slot[4];
struct work_struct hif_evm_work;
@@ -66,4 +68,10 @@ extern void mantis_pcmcia_exit(struct mantis_ca *ca);
extern int mantis_evmgr_init(struct mantis_ca *ca);
extern void mantis_evmgr_exit(struct mantis_ca *ca);
+/* HIF */
+extern int mantis_hif_init(struct mantis_ca *ca);
+extern void mantis_hif_exit(struct mantis_ca *ca);
+extern int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr);
+extern int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data);
+
#endif // __MANTIS_LINK_H
diff --git a/drivers/media/dvb/mantis/mantis_reg.h b/drivers/media/dvb/mantis/mantis_reg.h
index d9862b7..6f5cd49 100644
--- a/drivers/media/dvb/mantis/mantis_reg.h
+++ b/drivers/media/dvb/mantis/mantis_reg.h
@@ -147,16 +147,16 @@
#define MANTIS_CARD_RESET 0xac
#define MANTIS_GPIF_ADDR 0xb0
-#define MANTIS_GPIF_RDWRN (0x01 << 31)
+#define MANTIS_GPIF_HIFRDWRN (0x01 << 31)
#define MANTIS_GPIF_PCMCIAREG (0x01 << 27)
#define MANTIS_GPIF_PCMCIAIOM (0x01 << 26)
-#define MANTIS_GPIF_HIF_ADDR (0xfffffff << 0)
+#define MANTIS_GPIF_HIFADDR (0xfffffff << 0)
#define MANTIS_GPIF_DOUT 0xb4
-#define MANTIS_GPIF_HIF_DOUT (0xfffffff << 0)
+#define MANTIS_GPIF_HIFDOUT (0xfffffff << 0)
#define MANTIS_GPIF_DIN 0xb8
-#define MANTIS_GPIF_HIF_DIN (0xfffffff << 0)
+#define MANTIS_GPIF_HIFDIN (0xfffffff << 0)
#define MANTIS_GPIF_SPARE 0xbc
#define MANTIS_GPIF_LOGICRD (0xffff << 16)
--
1.7.1

View File

@ -0,0 +1,98 @@
From 478797be24c766baff385b4fa05a278fc9b29624 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:10:25 -0300
Subject: [PATCH 044/120] V4L/DVB (13742): [Mantis] Implement PCMCIA I/O Rd/Wr operations
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit c9a750c909cbde15ecd0f8545f48e051bfee6271)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_hif.c | 54 ++++++++++++++++++++++++++++++++
drivers/media/dvb/mantis/mantis_link.h | 2 +
2 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index 1472008..42aedf7 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -111,6 +111,60 @@ int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data)
return 0;
}
+int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr, u32 count, u32 *data)
+{
+ struct mantis_pci *mantis = ca->ca_priv;
+ u32 hif_addr = 0;
+
+ hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
+ hif_addr |= MANTIS_GPIF_HIFRDWRN;
+ hif_addr |= MANTIS_GPIF_PCMCIAIOM;
+ hif_addr |= addr;
+
+ mmwrite(hif_addr, MANTIS_GPIF_HIFADDR);
+ ca->hif_job_queue = MANTIS_HIF_IOMRD;
+
+ if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
+ ca->hif_job_queue &= ~MANTIS_HIF_IOMRD;
+ dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
+ return -EREMOTEIO;
+ }
+ udelay(50);
+ ca->hif_job_queue &= ~MANTIS_HIF_IOMRD;
+ *data = mmread(MANTIS_GPIF_HIFDIN);
+ hif_addr |= MANTIS_GPIF_PCMCIAREG;
+ mmwrite(hif_addr, MANTIS_GPIF_HIFADDR);
+
+ return 0;
+}
+
+int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u32 data)
+{
+ struct mantis_pci *mantis = ca->ca_priv;
+ u32 hif_addr = 0;
+
+ hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
+ hif_addr &= ~MANTIS_GPIF_HIFRDWRN;
+ hif_addr |= MANTIS_GPIF_PCMCIAIOM;
+ hif_addr |= addr;
+
+ mmwrite(hif_addr, MANTIS_GPIF_HIFADDR);
+ mmwrite(data, MANTIS_GPIF_HIFDOUT);
+
+ ca->hif_job_queue = MANTIS_HIF_IOMWR;
+ if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
+ ca->hif_job_queue &= ~MANTIS_HIF_IOMWR;
+ dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
+ return -EREMOTEIO;
+ }
+ udelay(50);
+ ca->hif_job_queue &= ~MANTIS_HIF_IOMWR;
+ hif_addr |= MANTIS_GPIF_PCMCIAREG;
+ mmwrite(hif_addr, MANTIS_GPIF_HIFADDR);
+
+ return 0;
+}
+
int mantis_hif_init(struct mantis_ca *ca)
{
struct mantis_pci *mantis = ca->ca_priv;
diff --git a/drivers/media/dvb/mantis/mantis_link.h b/drivers/media/dvb/mantis/mantis_link.h
index 8862502..478900e 100644
--- a/drivers/media/dvb/mantis/mantis_link.h
+++ b/drivers/media/dvb/mantis/mantis_link.h
@@ -73,5 +73,7 @@ extern int mantis_hif_init(struct mantis_ca *ca);
extern void mantis_hif_exit(struct mantis_ca *ca);
extern int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr);
extern int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data);
+extern int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr, u32 count, u32 *data);
+extern int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u32 data);
#endif // __MANTIS_LINK_H
--
1.7.1

View File

@ -0,0 +1,284 @@
From 441648289a943154181cdb4324d9220ef78e8dde Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:11:14 -0300
Subject: [PATCH 045/120] V4L/DVB (13743): [Mantis CA] Use DVB_CA Tuple parser
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 6053240f5cc914d40ac9c7afe15008bf3e46359c)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_ca.c | 129 ++++++++++++++++--------------
drivers/media/dvb/mantis/mantis_common.h | 2 +-
drivers/media/dvb/mantis/mantis_hif.c | 10 +-
drivers/media/dvb/mantis/mantis_link.h | 9 ++-
4 files changed, 80 insertions(+), 70 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c
index e6de3c9..4be61ca 100644
--- a/drivers/media/dvb/mantis/mantis_ca.c
+++ b/drivers/media/dvb/mantis/mantis_ca.c
@@ -22,96 +22,104 @@
#include "mantis_link.h"
#include "mantis_hif.h"
-
-static int mantis_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long parg)
+static int mantis_ca_read_attr_mem(struct dvb_ca_en50221 *en50221, int slot, int addr)
{
- return 0;
+ struct mantis_ca *ca = en50221->data;
+
+ if (slot != 0)
+ return -EINVAL;
+
+ return mantis_hif_read_mem(ca, addr);
}
-static int mantis_ca_open(struct inode *inode, struct file *file)
+static int mantis_ca_write_attr_mem(struct dvb_ca_en50221 *en50221, int slot, int addr, u8 data)
{
- return 0;
+ struct mantis_ca *ca = en50221->data;
+
+ if (slot != 0)
+ return -EINVAL;
+
+ return mantis_hif_write_mem(ca, addr, data);
}
-static int mantis_ca_release(struct inode *inode, struct file *file)
+static int mantis_ca_read_cam_ctl(struct dvb_ca_en50221 *en50221, int slot, u8 addr)
{
- return 0;
+ struct mantis_ca *ca = en50221->data;
+
+ if (slot != 0)
+ return -EINVAL;
+
+ return mantis_hif_read_iom(ca, addr);
}
-static ssize_t mantis_ca_read(struct file *file, char __user *buffer, size_t count, loff_t *ofset)
+static int mantis_ca_write_cam_ctl(struct dvb_ca_en50221 *en50221, int slot, u8 addr, u8 data)
{
- struct dvb_device *dvbdev = file->private_data;
- struct mantis_ca *ca = dvbdev->priv;
+ struct mantis_ca *ca = en50221->data;
- int status;
+ if (slot != 0)
+ return -EINVAL;
- return 0;
-error:
- return status;
+ return mantis_hif_write_iom(ca, addr, data);
}
-static ssize_t mantis_ca_write(struct file *file, const char __user *buffer, size_t count, loff_t *offset)
+static int mantis_ca_slot_reset(struct dvb_ca_en50221 *en50221, int slot)
{
- struct dvb_device *dvbdev = file->private_data;
- struct mantis_ca *ca = dvbdev->priv;
+ return 0;
+}
- int status;
+static int mantis_ca_slot_shutdown(struct dvb_ca_en50221 *en50221, int slot)
+{
+ return 0;
+}
+static int mantis_ts_control(struct dvb_ca_en50221 *en50221, int slot)
+{
return 0;
-error:
- return status;
}
-static struct file_operations mantis_fops = {
- .owner = THIS_MODULE,
- .ioctl = mantis_ca_ioctl,
- .open = mantis_ca_open,
- .release = mantis_ca_release,
- .read = mantis_ca_read,
- .write = mantis_ca_write,
-};
-
-static struct dvb_device mantis_ca = {
- .priv = NULL,
- .users = 1,
- .readers = 1,
- .writers = 1,
- .fops = &mantis_fops,
-};
-
-struct dvb_device *mantis_ca_init(struct mantis_pci *mantis)
+static int mantis_slot_status(struct dvb_ca_en50221 *en50221, int slot, int open)
{
- int ret;
+ return 0;
+}
- struct dvb_device *dvbdev;
+int mantis_ca_init(struct mantis_pci *mantis)
+{
struct dvb_adapter *dvb_adapter = &mantis->dvb_adapter;
struct mantis_ca *ca;
+ int ca_flags = 0, result;
if (!(ca = kzalloc(sizeof (struct mantis_ca), GFP_KERNEL))) {
dprintk(verbose, MANTIS_ERROR, 1, "Out of memory!, exiting ..");
- return NULL;
+ result = -ENOMEM;
+ goto err;
}
ca->ca_priv = mantis;
-
- dprintk(verbose, MANTIS_ERROR, 0, "CA: Registering Mantis Adapter(%d) Slot(0)\n", mantis->num);
- if (dvb_register_device(dvb_adapter, &dvbdev, &mantis_ca, ca, DVB_DEVICE_CA) == 0) {
- ca->ca_dev = dvbdev;
- mantis->mantis_ca = ca;
- mantis_evmgr_init(ca);
- return ca->ca_dev;
+ mantis->mantis_ca = ca;
+
+ /* register CA interface */
+ ca->en50221.owner = THIS_MODULE;
+ ca->en50221.read_attribute_mem = mantis_ca_read_attr_mem;
+ ca->en50221.write_attribute_mem = mantis_ca_write_attr_mem;
+ ca->en50221.read_cam_control = mantis_ca_read_cam_ctl;
+ ca->en50221.write_cam_control = mantis_ca_write_cam_ctl;
+ ca->en50221.slot_reset = mantis_ca_slot_reset;
+ ca->en50221.slot_shutdown = mantis_ca_slot_shutdown;
+ ca->en50221.slot_ts_enable = mantis_ts_control;
+ ca->en50221.poll_slot_status = mantis_slot_status;
+ ca->en50221.data = ca;
+
+ dprintk(verbose, MANTIS_ERROR, 1, "Registering EN50221 device");
+ if ((result = dvb_ca_en50221_init(dvb_adapter, &ca->en50221, ca_flags, 1)) != 0) {
+ dprintk(verbose, MANTIS_ERROR, 1, "EN50221: Initialization failed");
+ goto err;
}
+ dprintk(verbose, MANTIS_ERROR, 1, "Registered EN50221 device");
+ mantis_evmgr_init(ca);
return 0;
-
-error:
- if (ca != NULL) {
- dprintk(verbose, MANTIS_ERROR, 1, "Error ..");
- if (ca->ca_dev != NULL)
- dvb_unregister_device(ca->ca_dev);
-
- kfree(ca);
- }
- return NULL;
+err:
+ kfree(ca);
+ return result;
}
void mantis_ca_exit(struct mantis_pci *mantis)
@@ -119,9 +127,8 @@ void mantis_ca_exit(struct mantis_pci *mantis)
struct mantis_ca *ca = mantis->mantis_ca;
mantis_evmgr_exit(ca);
- dprintk(verbose, MANTIS_ERROR, 0, "CA: Unregister Mantis Adapter(%d) Slot(0)\n", mantis->num);
- if (ca->ca_dev)
- dvb_unregister_device(ca->ca_dev);
+ dprintk(verbose, MANTIS_ERROR, 1, "Unregistering EN50221 device");
+ dvb_ca_en50221_release(&ca->en50221);
kfree(ca);
}
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index 7f1cfad..0aa4001 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -151,7 +151,7 @@ extern int mantis_dvb_exit(struct mantis_pci *mantis);
extern void mantis_dma_xfer(unsigned long data);
extern void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value);
-extern struct dvb_device *mantis_ca_init(struct mantis_pci *mantis);
+extern int mantis_ca_init(struct mantis_pci *mantis);
extern void mantis_ca_exit(struct mantis_pci *mantis);
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index 42aedf7..6a1ea96 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -111,10 +111,10 @@ int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data)
return 0;
}
-int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr, u32 count, u32 *data)
+int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr)
{
struct mantis_pci *mantis = ca->ca_priv;
- u32 hif_addr = 0;
+ u32 data, hif_addr = 0;
hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
hif_addr |= MANTIS_GPIF_HIFRDWRN;
@@ -131,14 +131,14 @@ int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr, u32 count, u32 *data)
}
udelay(50);
ca->hif_job_queue &= ~MANTIS_HIF_IOMRD;
- *data = mmread(MANTIS_GPIF_HIFDIN);
+ data = mmread(MANTIS_GPIF_HIFDIN);
hif_addr |= MANTIS_GPIF_PCMCIAREG;
mmwrite(hif_addr, MANTIS_GPIF_HIFADDR);
- return 0;
+ return data;
}
-int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u32 data)
+int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data)
{
struct mantis_pci *mantis = ca->ca_priv;
u32 hif_addr = 0;
diff --git a/drivers/media/dvb/mantis/mantis_link.h b/drivers/media/dvb/mantis/mantis_link.h
index 478900e..23ff2d6 100644
--- a/drivers/media/dvb/mantis/mantis_link.h
+++ b/drivers/media/dvb/mantis/mantis_link.h
@@ -22,6 +22,7 @@
#define __MANTIS_LINK_H
#include <linux/workqueue.h>
+#include "dvb_ca_en50221.h"
enum mantis_sbuf_status {
MANTIS_SBUF_DATA_AVAIL = 1,
@@ -56,8 +57,10 @@ struct mantis_ca {
enum mantis_slot_state slot_state;
- struct dvb_device *ca_dev;
+// struct dvb_device *ca_dev;
void *ca_priv;
+
+ struct dvb_ca_en50221 en50221;
};
/* CA */
@@ -73,7 +76,7 @@ extern int mantis_hif_init(struct mantis_ca *ca);
extern void mantis_hif_exit(struct mantis_ca *ca);
extern int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr);
extern int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data);
-extern int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr, u32 count, u32 *data);
-extern int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u32 data);
+extern int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr);
+extern int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data);
#endif // __MANTIS_LINK_H
--
1.7.1

View File

@ -0,0 +1,36 @@
From d91b92d5da6dcd0c23d9f2721a8d4e93768104f8 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:11:41 -0300
Subject: [PATCH 046/120] V4L/DVB (13744): [Mantis CA] Use Module status to signal Slot events
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 4e9fbeeedc22d287b5d05e32bbc647cd2dc8c663)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_ca.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c
index 4be61ca..cd6bed7 100644
--- a/drivers/media/dvb/mantis/mantis_ca.c
+++ b/drivers/media/dvb/mantis/mantis_ca.c
@@ -79,6 +79,11 @@ static int mantis_ts_control(struct dvb_ca_en50221 *en50221, int slot)
static int mantis_slot_status(struct dvb_ca_en50221 *en50221, int slot, int open)
{
+ struct mantis_ca *ca = en50221->data;
+
+ if (ca->slot_state == MODULE_INSERTED)
+ return DVB_CA_EN50221_POLL_CAM_PRESENT | DVB_CA_EN50221_POLL_CAM_READY;
+
return 0;
}
--
1.7.1

View File

@ -0,0 +1,160 @@
From b46a35d800073ece545324778801b37461676b2a Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:12:16 -0300
Subject: [PATCH 047/120] V4L/DVB (13745): [Mantis CA] Add some debug statements
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 2133ffbf08e7fca0614ea73cb5c43cc6435b4414)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_ca.c | 34 +++++++++++++++++++++++++++++++++
drivers/media/dvb/mantis/mantis_hif.c | 4 +++
2 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c
index cd6bed7..a8b8c88 100644
--- a/drivers/media/dvb/mantis/mantis_ca.c
+++ b/drivers/media/dvb/mantis/mantis_ca.c
@@ -25,6 +25,9 @@
static int mantis_ca_read_attr_mem(struct dvb_ca_en50221 *en50221, int slot, int addr)
{
struct mantis_ca *ca = en50221->data;
+ struct mantis_pci *mantis = ca->ca_priv;
+
+ dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): Request Attribute Mem Read", slot);
if (slot != 0)
return -EINVAL;
@@ -35,6 +38,9 @@ static int mantis_ca_read_attr_mem(struct dvb_ca_en50221 *en50221, int slot, int
static int mantis_ca_write_attr_mem(struct dvb_ca_en50221 *en50221, int slot, int addr, u8 data)
{
struct mantis_ca *ca = en50221->data;
+ struct mantis_pci *mantis = ca->ca_priv;
+
+ dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): Request Attribute Mem Write", slot);
if (slot != 0)
return -EINVAL;
@@ -45,6 +51,9 @@ static int mantis_ca_write_attr_mem(struct dvb_ca_en50221 *en50221, int slot, in
static int mantis_ca_read_cam_ctl(struct dvb_ca_en50221 *en50221, int slot, u8 addr)
{
struct mantis_ca *ca = en50221->data;
+ struct mantis_pci *mantis = ca->ca_priv;
+
+ dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): Request CAM control Read", slot);
if (slot != 0)
return -EINVAL;
@@ -55,6 +64,9 @@ static int mantis_ca_read_cam_ctl(struct dvb_ca_en50221 *en50221, int slot, u8 a
static int mantis_ca_write_cam_ctl(struct dvb_ca_en50221 *en50221, int slot, u8 addr, u8 data)
{
struct mantis_ca *ca = en50221->data;
+ struct mantis_pci *mantis = ca->ca_priv;
+
+ dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): Request CAM control Write", slot);
if (slot != 0)
return -EINVAL;
@@ -64,22 +76,40 @@ static int mantis_ca_write_cam_ctl(struct dvb_ca_en50221 *en50221, int slot, u8
static int mantis_ca_slot_reset(struct dvb_ca_en50221 *en50221, int slot)
{
+ struct mantis_ca *ca = en50221->data;
+ struct mantis_pci *mantis = ca->ca_priv;
+
+ dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): Slot RESET", slot);
+
return 0;
}
static int mantis_ca_slot_shutdown(struct dvb_ca_en50221 *en50221, int slot)
{
+ struct mantis_ca *ca = en50221->data;
+ struct mantis_pci *mantis = ca->ca_priv;
+
+ dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): Slot shutdown", slot);
+
return 0;
}
static int mantis_ts_control(struct dvb_ca_en50221 *en50221, int slot)
{
+ struct mantis_ca *ca = en50221->data;
+ struct mantis_pci *mantis = ca->ca_priv;
+
+ dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): TS control", slot);
+
return 0;
}
static int mantis_slot_status(struct dvb_ca_en50221 *en50221, int slot, int open)
{
struct mantis_ca *ca = en50221->data;
+ struct mantis_pci *mantis = ca->ca_priv;
+
+ dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): Poll Slot status", slot);
if (ca->slot_state == MODULE_INSERTED)
return DVB_CA_EN50221_POLL_CAM_PRESENT | DVB_CA_EN50221_POLL_CAM_READY;
@@ -93,6 +123,7 @@ int mantis_ca_init(struct mantis_pci *mantis)
struct mantis_ca *ca;
int ca_flags = 0, result;
+ dprintk(verbose, MANTIS_DEBUG, 1, "Initializing Mantis CA");
if (!(ca = kzalloc(sizeof (struct mantis_ca), GFP_KERNEL))) {
dprintk(verbose, MANTIS_ERROR, 1, "Out of memory!, exiting ..");
result = -ENOMEM;
@@ -130,6 +161,9 @@ err:
void mantis_ca_exit(struct mantis_pci *mantis)
{
struct mantis_ca *ca = mantis->mantis_ca;
+ struct mantis_pci *mantis = ca->ca_priv;
+
+ dprintk(verbose, MANTIS_DEBUG, 1, "Mantis CA exit");
mantis_evmgr_exit(ca);
dprintk(verbose, MANTIS_ERROR, 1, "Unregistering EN50221 device");
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index 6a1ea96..42e0360 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -61,6 +61,7 @@ int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr)
struct mantis_pci *mantis = ca->ca_priv;
u32 hif_addr = 0, data, count = 4;
+ dprintk(verbose, MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF Mem Read", mantis->num);
hif_addr |= MANTIS_GPIF_HIFRDWRN;
hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
hif_addr &= ~MANTIS_GPIF_PCMCIAIOM;
@@ -91,6 +92,7 @@ int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data)
struct mantis_pci *mantis = ca->ca_priv;
u32 hif_addr = 0;
+ dprintk(verbose, MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF Mem Write", mantis->num);
hif_addr &= ~MANTIS_GPIF_HIFRDWRN;
hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
hif_addr &= ~MANTIS_GPIF_PCMCIAIOM;
@@ -116,6 +118,7 @@ int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr)
struct mantis_pci *mantis = ca->ca_priv;
u32 data, hif_addr = 0;
+ dprintk(verbose, MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF I/O Read", mantis->num);
hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
hif_addr |= MANTIS_GPIF_HIFRDWRN;
hif_addr |= MANTIS_GPIF_PCMCIAIOM;
@@ -143,6 +146,7 @@ int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data)
struct mantis_pci *mantis = ca->ca_priv;
u32 hif_addr = 0;
+ dprintk(verbose, MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF I/O Write", mantis->num);
hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
hif_addr &= ~MANTIS_GPIF_HIFRDWRN;
hif_addr |= MANTIS_GPIF_PCMCIAIOM;
--
1.7.1

View File

@ -0,0 +1,32 @@
From c48439992c53ba8752b68fa1504c435d841c259b Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:12:51 -0300
Subject: [PATCH 048/120] V4L/DVB (13746): [Mantis CA] Bug: Remove duplicated symbol
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit fbe1e43abc6ada6bcd3e9866b01e41f093f12c62)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_ca.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c
index a8b8c88..f6d70cb 100644
--- a/drivers/media/dvb/mantis/mantis_ca.c
+++ b/drivers/media/dvb/mantis/mantis_ca.c
@@ -161,7 +161,6 @@ err:
void mantis_ca_exit(struct mantis_pci *mantis)
{
struct mantis_ca *ca = mantis->mantis_ca;
- struct mantis_pci *mantis = ca->ca_priv;
dprintk(verbose, MANTIS_DEBUG, 1, "Mantis CA exit");
--
1.7.1

View File

@ -0,0 +1,118 @@
From 8e9b8bbb3f9bd6573fc55306be2b87a369342ed1 Mon Sep 17 00:00:00 2001
From: Sigmund Augdal <sigmund@snap.tv>
Date: Fri, 4 Dec 2009 05:13:21 -0300
Subject: [PATCH 049/120] V4L/DVB (13747): [Mantis] Bug Fix!: Use Register Address rather than register field
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Sigmund Augdal <sigmund@snap.tv>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit a0c59063a7fe92524ab8fa6e31997b177a8f3029)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_dma.c | 4 ++--
drivers/media/dvb/mantis/mantis_hif.c | 20 ++++++++++----------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_dma.c b/drivers/media/dvb/mantis/mantis_dma.c
index 250f49a..d15a1eb 100644
--- a/drivers/media/dvb/mantis/mantis_dma.c
+++ b/drivers/media/dvb/mantis/mantis_dma.c
@@ -190,7 +190,7 @@ void mantis_dma_start(struct mantis_pci *mantis)
mantis_risc_program(mantis);
mmwrite(mantis->risc_dma, MANTIS_RISC_START);
- mmwrite(mmread(MANTIS_GPIF_HIFADDR) | MANTIS_GPIF_HIFRDWRN, MANTIS_GPIF_HIFADDR);
+ mmwrite(mmread(MANTIS_GPIF_ADDR) | MANTIS_GPIF_HIFRDWRN, MANTIS_GPIF_ADDR);
mmwrite(0, MANTIS_DMA_CTL);
mantis->last_block = mantis->finished_block = 0;
@@ -210,7 +210,7 @@ void mantis_dma_stop(struct mantis_pci *mantis)
mask = mmread(MANTIS_INT_MASK);
dprintk(verbose, MANTIS_DEBUG, 1, "Mantis Stop DMA engine");
- mmwrite((mmread(MANTIS_GPIF_HIFADDR) & (~(MANTIS_GPIF_HIFRDWRN))), MANTIS_GPIF_HIFADDR);
+ mmwrite((mmread(MANTIS_GPIF_ADDR) & (~(MANTIS_GPIF_HIFRDWRN))), MANTIS_GPIF_ADDR);
mmwrite((mmread(MANTIS_DMA_CTL) & ~(MANTIS_FIFO_EN |
MANTIS_DCAP_EN |
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index 42e0360..9e058be 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -72,7 +72,7 @@ int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr)
udelay(20);
- mmwrite(hif_addr, MANTIS_GPIF_HIFADDR);
+ mmwrite(hif_addr, MANTIS_GPIF_ADDR);
if (mantis_hif_data_available(ca) != 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): GPIF Smart Buffer burst read failed", mantis->num);
return -EREMOTEIO;
@@ -81,7 +81,7 @@ int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr)
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): GPIF Smart Buffer operation failed", mantis->num);
return -EREMOTEIO;
}
- data = mmread(MANTIS_GPIF_HIFDIN);
+ data = mmread(MANTIS_GPIF_DIN);
return (data >> 24) & 0xff;
}
@@ -100,8 +100,8 @@ int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data)
mmwrite(slot->slave_cfg, MANTIS_GPIF_CFGSLA); /* Slot0 alone for now */
- mmwrite(hif_addr, MANTIS_GPIF_HIFADDR);
- mmwrite(data, MANTIS_GPIF_HIFDOUT);
+ mmwrite(hif_addr, MANTIS_GPIF_ADDR);
+ mmwrite(data, MANTIS_GPIF_DOUT);
ca->hif_job_queue = MANTIS_HIF_MEMWR;
if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
@@ -124,7 +124,7 @@ int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr)
hif_addr |= MANTIS_GPIF_PCMCIAIOM;
hif_addr |= addr;
- mmwrite(hif_addr, MANTIS_GPIF_HIFADDR);
+ mmwrite(hif_addr, MANTIS_GPIF_ADDR);
ca->hif_job_queue = MANTIS_HIF_IOMRD;
if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
@@ -134,9 +134,9 @@ int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr)
}
udelay(50);
ca->hif_job_queue &= ~MANTIS_HIF_IOMRD;
- data = mmread(MANTIS_GPIF_HIFDIN);
+ data = mmread(MANTIS_GPIF_DIN);
hif_addr |= MANTIS_GPIF_PCMCIAREG;
- mmwrite(hif_addr, MANTIS_GPIF_HIFADDR);
+ mmwrite(hif_addr, MANTIS_GPIF_ADDR);
return data;
}
@@ -152,8 +152,8 @@ int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data)
hif_addr |= MANTIS_GPIF_PCMCIAIOM;
hif_addr |= addr;
- mmwrite(hif_addr, MANTIS_GPIF_HIFADDR);
- mmwrite(data, MANTIS_GPIF_HIFDOUT);
+ mmwrite(hif_addr, MANTIS_GPIF_ADDR);
+ mmwrite(data, MANTIS_GPIF_DOUT);
ca->hif_job_queue = MANTIS_HIF_IOMWR;
if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
@@ -164,7 +164,7 @@ int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data)
udelay(50);
ca->hif_job_queue &= ~MANTIS_HIF_IOMWR;
hif_addr |= MANTIS_GPIF_PCMCIAREG;
- mmwrite(hif_addr, MANTIS_GPIF_HIFADDR);
+ mmwrite(hif_addr, MANTIS_GPIF_ADDR);
return 0;
}
--
1.7.1

View File

@ -0,0 +1,59 @@
From 247814436649330068a2f8ef83f2641b347a9d84 Mon Sep 17 00:00:00 2001
From: Magnus Horlin <magnus@alefors.se>
Date: Fri, 4 Dec 2009 05:14:34 -0300
Subject: [PATCH 050/120] V4L/DVB (13748): [Mantis/VP-2040] Add support for VP-2040 (TDA10023 frontend based)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Magnus Horlin <magnus@alefors.se>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit ea30d81a9634cb4c13bbef46877f0d7730c57552)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_core.c | 1 +
drivers/media/dvb/mantis/mantis_dvb.c | 1 +
drivers/media/dvb/mantis/mantis_vp2040.h | 1 +
3 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_core.c b/drivers/media/dvb/mantis/mantis_core.c
index a164bb1..b94d051 100644
--- a/drivers/media/dvb/mantis/mantis_core.c
+++ b/drivers/media/dvb/mantis/mantis_core.c
@@ -119,6 +119,7 @@ static void mantis_load_config(struct mantis_pci *mantis)
case MANTIS_VP_2033_DVB_C: // VP-2033
mantis->hwconfig = &vp2033_mantis_config;
break;
+ case MANTIS_VP_2040_DVB_C: // VP-2040
case TERRATEC_CINERGY_C_PCI: // VP-2040 clone
mantis->hwconfig = &vp2040_mantis_config;
break;
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c
index ade4449..3940aed 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -273,6 +273,7 @@ int __devinit mantis_frontend_init(struct mantis_pci *mantis)
}
break;
+ case MANTIS_VP_2040_DVB_C: // VP-2040
case TERRATEC_CINERGY_C_PCI:
dprintk(verbose, MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
mantis->fe = tda10023_attach(&tda10023_cu1216_config, &mantis->adapter, read_pwm(mantis));
diff --git a/drivers/media/dvb/mantis/mantis_vp2040.h b/drivers/media/dvb/mantis/mantis_vp2040.h
index 825ccbb..69463cc 100644
--- a/drivers/media/dvb/mantis/mantis_vp2040.h
+++ b/drivers/media/dvb/mantis/mantis_vp2040.h
@@ -25,6 +25,7 @@
#include "mantis_common.h"
#include "tda1002x.h"
+#define MANTIS_VP_2040_DVB_C 0x0043
#define TERRATEC_CINERGY_C_PCI 0x1178
extern struct tda1002x_config tda10023_cu1216_config;
--
1.7.1

View File

@ -0,0 +1,38 @@
From e6afe15c76aabc6d84c5503c38b0f963fefb9fef Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:15:10 -0300
Subject: [PATCH 051/120] V4L/DVB (13749): [Mantis CA] CA_SLAVE: Do not change Slave Configuration setup
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
(Need to sanitize this cleanly for different Slaves)
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit ac23f4c86c3c901f95d72fc2262b22e6230d4feb)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_hif.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index 9e058be..d18fe41 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -171,9 +171,11 @@ int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data)
int mantis_hif_init(struct mantis_ca *ca)
{
+ struct mantis_slot *slot = ca->slot;
struct mantis_pci *mantis = ca->ca_priv;
u32 irqcfg;
+ slot[0].slave_cfg = 0x70773028;
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Initializing Mantis Host Interface", mantis->num);
init_waitqueue_head(&ca->hif_data_wq);
init_waitqueue_head(&ca->hif_opdone_wq);
--
1.7.1

View File

@ -0,0 +1,60 @@
From f37097db4c2acf80ca104250d60535bba9da4dbd Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:15:38 -0300
Subject: [PATCH 052/120] V4L/DVB (13750): [Mantis] GPIO_CONTROL: Cache a given GPIO Bit Setup for a given event
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 4d5a28efda3ce12529e4b90832184f62c7a50848)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_common.h | 2 +-
drivers/media/dvb/mantis/mantis_core.c | 11 +++++------
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index 0aa4001..75f0773 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -137,7 +137,7 @@ struct mantis_pci {
u32 sub_device_id;
/* A12 A13 A14 */
- int gpio_status;
+ u32 gpio_status;
struct mantis_ca *mantis_ca;
};
diff --git a/drivers/media/dvb/mantis/mantis_core.c b/drivers/media/dvb/mantis/mantis_core.c
index b94d051..3fd3b08 100644
--- a/drivers/media/dvb/mantis/mantis_core.c
+++ b/drivers/media/dvb/mantis/mantis_core.c
@@ -185,16 +185,15 @@ int mantis_core_exit(struct mantis_pci *mantis)
// Turn the given bit on or off.
void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value)
{
- u32 currVal, newVal;
-
- currVal = mmread(MANTIS_GPIF_ADDR);
+ u32 cur;
+ cur = mmread(MANTIS_GPIF_ADDR);
if (value)
- newVal = currVal | (1 << bitpos);
+ mantis->gpio_status = cur | (1 << bitpos);
else
- newVal = currVal & (~(1 << bitpos));
+ mantis->gpio_status = cur & (~(1 << bitpos));
- mmwrite(newVal, MANTIS_GPIF_ADDR);
+ mmwrite(mantis->gpio_status, MANTIS_GPIF_ADDR);
mmwrite(0x00, MANTIS_GPIF_DOUT);
udelay(100);
}
--
1.7.1

View File

@ -0,0 +1,82 @@
From d7b96790304cbd2a5cb6024310ec90ff9f2f3b5b Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:16:24 -0300
Subject: [PATCH 053/120] V4L/DVB (13751): [Mantis] GPIO_CONTROL: Do not toggle GPIO CW's on HIF operations
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit b2d8f5eafd31cd7bc722dc93057d8c5fd5b688ab)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_common.h | 2 ++
drivers/media/dvb/mantis/mantis_hif.c | 9 +++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index 75f0773..49f2f11 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -142,6 +142,8 @@ struct mantis_pci {
struct mantis_ca *mantis_ca;
};
+#define MANTIS_HIF_STATUS (mantis->gpio_status << 12)
+
extern unsigned int verbose;
extern unsigned int devs;
extern unsigned int i2c;
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index d18fe41..96611b6 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -56,6 +56,7 @@ static int mantis_hif_sbuf_opdone_wait(struct mantis_ca *ca)
return rc;
}
+
int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr)
{
struct mantis_pci *mantis = ca->ca_priv;
@@ -67,7 +68,7 @@ int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr)
hif_addr &= ~MANTIS_GPIF_PCMCIAIOM;
hif_addr |= addr;
- mmwrite(hif_addr, MANTIS_GPIF_BRADDR);
+ mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_BRADDR);
mmwrite(count, MANTIS_GPIF_BRBYTES);
udelay(20);
@@ -100,7 +101,7 @@ int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data)
mmwrite(slot->slave_cfg, MANTIS_GPIF_CFGSLA); /* Slot0 alone for now */
- mmwrite(hif_addr, MANTIS_GPIF_ADDR);
+ mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR);
mmwrite(data, MANTIS_GPIF_DOUT);
ca->hif_job_queue = MANTIS_HIF_MEMWR;
@@ -124,7 +125,7 @@ int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr)
hif_addr |= MANTIS_GPIF_PCMCIAIOM;
hif_addr |= addr;
- mmwrite(hif_addr, MANTIS_GPIF_ADDR);
+ mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR);
ca->hif_job_queue = MANTIS_HIF_IOMRD;
if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
@@ -152,7 +153,7 @@ int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data)
hif_addr |= MANTIS_GPIF_PCMCIAIOM;
hif_addr |= addr;
- mmwrite(hif_addr, MANTIS_GPIF_ADDR);
+ mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR);
mmwrite(data, MANTIS_GPIF_DOUT);
ca->hif_job_queue = MANTIS_HIF_IOMWR;
--
1.7.1

View File

@ -0,0 +1,46 @@
From 7353f94022a6db6679736088921deb74c1f5c9cd Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:17:14 -0300
Subject: [PATCH 054/120] V4L/DVB (13752): [Mantis CA] CAM_CONTROL: All CAM control operations now handled by the worker thread
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit b619f9f8a111be3f6ec8ec2671eb93c66a673b90)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_pci.c | 15 +--------------
1 files changed, 1 insertions(+), 14 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_pci.c b/drivers/media/dvb/mantis/mantis_pci.c
index 6eecd54..4873fa9 100644
--- a/drivers/media/dvb/mantis/mantis_pci.c
+++ b/drivers/media/dvb/mantis/mantis_pci.c
@@ -183,20 +183,7 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
mantis->subsystem_device = pdev->subsystem_device;
init_waitqueue_head(&mantis->i2c_wq);
- // CAM bypass
- //mmwrite(mmread(MANTIS_INT_MASK) | MANTIS_INT_IRQ1, MANTIS_INT_MASK);
- dprintk(verbose, MANTIS_INFO, 0, "\ngpif status: %04x irqcfg: %04x\n", mmread(0x9c), mmread(0x98));
- if ((mmread(0x9c) & 0x200) != 0) { //CAM inserted
- msleep_interruptible(1);
- if ((mmread(0x9c) & 0x200) != 0)
- mmwrite(((mmread(0x98) | 0x01) & ~0x02), 0x98);
- else
- mmwrite(((mmread(0x98) | 0x02) & ~0x01), 0x98);
-
- } else {
- mmwrite(((mmread(0x98) | 0x02) & ~0x01), 0x98);
- }
- mantis_set_direction(mantis, 0);
+ mantis_set_direction(mantis, 0); /* CAM bypass */
if (!latency)
pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 32);
--
1.7.1

View File

@ -0,0 +1,36 @@
From 0f6112987a8789ba97f6cdf2c0f538b8730e8f7c Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:17:46 -0300
Subject: [PATCH 055/120] V4L/DVB (13753): [Mantis CA] SLOT_CONTROL: Implement Slot RESET
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit fb6de9c5fe13fd5cd866c49204e6bd91d73f83b0)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_ca.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c
index f6d70cb..a30eb84 100644
--- a/drivers/media/dvb/mantis/mantis_ca.c
+++ b/drivers/media/dvb/mantis/mantis_ca.c
@@ -80,6 +80,11 @@ static int mantis_ca_slot_reset(struct dvb_ca_en50221 *en50221, int slot)
struct mantis_pci *mantis = ca->ca_priv;
dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): Slot RESET", slot);
+ udelay(500); /* Wait.. */
+ mmwrite(0xda, MANTIS_PCMCIA_RESET); /* Leading edge assert */
+ udelay(500);
+ mmwrite(0x00, MANTIS_PCMCIA_RESET); /* Trailing edge deassert */
+ msleep(1000);
return 0;
}
--
1.7.1

View File

@ -0,0 +1,61 @@
From 13c3b8254171a89f941116d15e7312a2ccc1c800 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:18:27 -0300
Subject: [PATCH 056/120] V4L/DVB (13754): [Mantis] CAM_CONTROL: Implement TS control
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 990f8d1e161429ee1a0e9708f7989543e4648f73)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_ca.c | 1 +
drivers/media/dvb/mantis/mantis_common.h | 2 ++
drivers/media/dvb/mantis/mantis_core.h | 4 ----
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c
index a30eb84..b9d808b 100644
--- a/drivers/media/dvb/mantis/mantis_ca.c
+++ b/drivers/media/dvb/mantis/mantis_ca.c
@@ -105,6 +105,7 @@ static int mantis_ts_control(struct dvb_ca_en50221 *en50221, int slot)
struct mantis_pci *mantis = ca->ca_priv;
dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): TS control", slot);
+ mantis_set_direction(mantis, 1); /* Enable TS through CAM */
return 0;
}
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index 49f2f11..ac3eefe 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -153,6 +153,8 @@ extern int mantis_dvb_exit(struct mantis_pci *mantis);
extern void mantis_dma_xfer(unsigned long data);
extern void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value);
+extern void mantis_set_direction(struct mantis_pci *mantis, int direction);
+
extern int mantis_ca_init(struct mantis_pci *mantis);
extern void mantis_ca_exit(struct mantis_pci *mantis);
diff --git a/drivers/media/dvb/mantis/mantis_core.h b/drivers/media/dvb/mantis/mantis_core.h
index 31b2a75..a809394 100644
--- a/drivers/media/dvb/mantis/mantis_core.h
+++ b/drivers/media/dvb/mantis/mantis_core.h
@@ -53,9 +53,5 @@ extern int mantis_i2c_init(struct mantis_pci *mantis);
extern int mantis_i2c_exit(struct mantis_pci *mantis);
extern int mantis_core_init(struct mantis_pci *mantis);
extern int mantis_core_exit(struct mantis_pci *mantis);
-//extern void mantis_fe_powerup(struct mantis_pci *mantis);
-//extern void mantis_fe_powerdown(struct mantis_pci *mantis);
-//extern void mantis_fe_reset(struct dvb_frontend *fe);
-extern void mantis_set_direction(struct mantis_pci *mantis, int direction);
#endif //__MANTIS_CORE_H
--
1.7.1

View File

@ -0,0 +1,34 @@
From 6b927ab4cd36fc85e465f3d2c50ebe64010eea40 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:18:53 -0300
Subject: [PATCH 057/120] V4L/DVB (13755): [Mantis CA] CAM_CONTROL: Use appropriate flags
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit f9ce1c3f32aa472c667c4d43d01c42922fb356ca)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_ca.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c
index b9d808b..2c49f6b 100644
--- a/drivers/media/dvb/mantis/mantis_ca.c
+++ b/drivers/media/dvb/mantis/mantis_ca.c
@@ -138,6 +138,9 @@ int mantis_ca_init(struct mantis_pci *mantis)
ca->ca_priv = mantis;
mantis->mantis_ca = ca;
+ ca_flags = DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE |
+ DVB_CA_EN50221_FLAG_IRQ_FR |
+ DVB_CA_EN50221_FLAG_IRQ_DA;
/* register CA interface */
ca->en50221.owner = THIS_MODULE;
--
1.7.1

View File

@ -0,0 +1,43 @@
From cd299782e9a680134268093555ab3afa14dc5d2b Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:19:26 -0300
Subject: [PATCH 058/120] V4L/DVB (13756): [Mantis CA] CAM_CONTROL: Use CAMCHANGE_IRQ events
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 05691cdbf479282e3d3c2e3386cb865cbf611e3a)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_evm.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index dbcdca3..79c3c62 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -39,12 +39,18 @@ static void mantis_hifevm_work(struct work_struct *work)
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Plugin", mantis->num);
mmwrite(0xdada0000, MANTIS_CARD_RESET);
mantis_event_cam_plugin(ca);
+ dvb_ca_en50221_camchange_irq(&ca->en50221,
+ 0,
+ DVB_CA_EN50221_CAMCHANGE_INSERTED);
}
} else {
if (gpif_stat & MANTIS_CARD_PLUGOUT) {
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Unplug", mantis->num);
mmwrite(0xdada0000, MANTIS_CARD_RESET);
mantis_event_cam_unplug(ca);
+ dvb_ca_en50221_camchange_irq(&ca->en50221,
+ 0,
+ DVB_CA_EN50221_CAMCHANGE_REMOVED);
}
}
--
1.7.1

View File

@ -0,0 +1,34 @@
From df6c3197692071a03bb5dd3e69025246f297daca Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:20:14 -0300
Subject: [PATCH 059/120] V4L/DVB (13757): [Mantis CA] CAM_CONTROL: Use FRDA_IRQ Events
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit bb928a7a21273f67455912f0935ff943ddb35d0c)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_evm.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index 79c3c62..ee04955 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -69,8 +69,7 @@ static void mantis_hifevm_work(struct work_struct *work)
if (gpif_stat & MANTIS_GPIF_BRRDY) {
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Read Ready", mantis->num);
ca->sbuf_status = MANTIS_SBUF_DATA_AVAIL;
- if (ca->hif_job_queue & MANTIS_HIF_MEMRD)
- wake_up(&ca->hif_brrdyw_wq);
+ dvb_ca_en50221_frda_irq(&ca->en50221, 0);
}
if (gpif_stat & MANTIS_GPIF_WRACK)
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Slave Write ACK", mantis->num);
--
1.7.1

View File

@ -0,0 +1,49 @@
From f51c7ca2ec38e36ed014dccf9df62d0432c35544 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:20:44 -0300
Subject: [PATCH 060/120] V4L/DVB (13758): [Mantis CA] CAM_CONTROL: Use CAMREADY_IRQ event
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 2ec9b00bd0386b71c8a84a3990a13ea9656fe8dd)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_ca.c | 1 +
drivers/media/dvb/mantis/mantis_evm.c | 5 +----
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c
index 2c49f6b..abd8855 100644
--- a/drivers/media/dvb/mantis/mantis_ca.c
+++ b/drivers/media/dvb/mantis/mantis_ca.c
@@ -85,6 +85,7 @@ static int mantis_ca_slot_reset(struct dvb_ca_en50221 *en50221, int slot)
udelay(500);
mmwrite(0x00, MANTIS_PCMCIA_RESET); /* Trailing edge deassert */
msleep(1000);
+ dvb_ca_en50221_camready_irq(&ca->en50221, 0);
return 0;
}
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index ee04955..4695715 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -82,10 +82,7 @@ static void mantis_hifevm_work(struct work_struct *work)
if (gpif_stat & MANTIS_SBUF_OPDONE) {
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer operation complete", mantis->num);
- if (ca->hif_job_queue) {
- wake_up(&ca->hif_opdone_wq);
- ca->hif_event = MANTIS_SBUF_OPDONE;
- }
+
}
}
--
1.7.1

View File

@ -0,0 +1,35 @@
From db4106b3bfa9aad451695c41278d66e47953c0b6 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:21:05 -0300
Subject: [PATCH 061/120] V4L/DVB (13759): [Mantis] HIF I/O: Use the LSB octet only
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Thanks to Abylai Ospan for pointing this out.
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 9c8679554db8cf39ccec5a90cfaa12b164585556)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_hif.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index 96611b6..1ccd869 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -139,7 +139,7 @@ int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr)
hif_addr |= MANTIS_GPIF_PCMCIAREG;
mmwrite(hif_addr, MANTIS_GPIF_ADDR);
- return data;
+ return (u8) data;
}
int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data)
--
1.7.1

View File

@ -0,0 +1,35 @@
From bba61c53a60cd9b46494dd84eda68bb53a0a69de Mon Sep 17 00:00:00 2001
From: Sigmund Augdal <sigmund@snap.tv>
Date: Fri, 4 Dec 2009 05:21:27 -0300
Subject: [PATCH 062/120] V4L/DVB (13760): [Mantis CA] CA_MODULE: Look for module status on driver load
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Sigmund Augdal <sigmund@snap.tv>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 86c75c5c2b9318f4b3218615ada18badabd3f166)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_pcmcia.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_pcmcia.c b/drivers/media/dvb/mantis/mantis_pcmcia.c
index 47cc720..59f1a06 100644
--- a/drivers/media/dvb/mantis/mantis_pcmcia.c
+++ b/drivers/media/dvb/mantis/mantis_pcmcia.c
@@ -83,6 +83,9 @@ int mantis_pcmcia_init(struct mantis_ca *ca)
dprintk(verbose, MANTIS_DEBUG, 1, "CAM found on Adapter(%d) Slot(0)", mantis->num);
mmwrite(card_stat | MANTIS_MASK_PLUGOUT, MANTIS_GPIF_IRQCFG);
ca->slot_state = MODULE_INSERTED;
+ dvb_ca_en50221_camchange_irq(&ca->en50221,
+ 0,
+ DVB_CA_EN50221_CAMCHANGE_INSERTED);
} else {
dprintk(verbose, MANTIS_DEBUG, 1, "Empty Slot on Adapter(%d) Slot(0)", mantis->num);
mmwrite(card_stat | MANTIS_MASK_PLUGIN, MANTIS_GPIF_IRQCFG);
--
1.7.1

View File

@ -0,0 +1,46 @@
From c08c027326170324bdbe68ba172a075fd318951a Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:21:51 -0300
Subject: [PATCH 063/120] V4L/DVB (13761): [Mantis] HIF I/O: Temporary workaround, use SBUF_OPDONE flag instead
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Dnumgis got hit with this bug, using a temporary workaround
for the time being rather than digging deep at this point.
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit cc0e4aacaf4c3660fa759ce1299377baaf9efd8b)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_evm.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index 4695715..532bcff 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -68,8 +68,6 @@ static void mantis_hifevm_work(struct work_struct *work)
if (gpif_stat & MANTIS_GPIF_BRRDY) {
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Read Ready", mantis->num);
- ca->sbuf_status = MANTIS_SBUF_DATA_AVAIL;
- dvb_ca_en50221_frda_irq(&ca->en50221, 0);
}
if (gpif_stat & MANTIS_GPIF_WRACK)
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Slave Write ACK", mantis->num);
@@ -82,7 +80,8 @@ static void mantis_hifevm_work(struct work_struct *work)
if (gpif_stat & MANTIS_SBUF_OPDONE) {
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer operation complete", mantis->num);
-
+ ca->sbuf_status = MANTIS_SBUF_DATA_AVAIL;
+ dvb_ca_en50221_frda_irq(&ca->en50221, 0);
}
}
--
1.7.1

View File

@ -0,0 +1,34 @@
From 296c3247f8ffccad5cd54f6cd1dcd1d6d5d67e29 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:22:33 -0300
Subject: [PATCH 064/120] V4L/DVB (13762): [Mantis CA] CA_MODULE: Look for the module status on driver unload as well
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 88a6fa9dfec0a585409acbb49a7f86a933b35d2b)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_pcmcia.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_pcmcia.c b/drivers/media/dvb/mantis/mantis_pcmcia.c
index 59f1a06..4156a08 100644
--- a/drivers/media/dvb/mantis/mantis_pcmcia.c
+++ b/drivers/media/dvb/mantis/mantis_pcmcia.c
@@ -90,6 +90,9 @@ int mantis_pcmcia_init(struct mantis_ca *ca)
dprintk(verbose, MANTIS_DEBUG, 1, "Empty Slot on Adapter(%d) Slot(0)", mantis->num);
mmwrite(card_stat | MANTIS_MASK_PLUGIN, MANTIS_GPIF_IRQCFG);
ca->slot_state = MODULE_XTRACTED;
+ dvb_ca_en50221_camchange_irq(&ca->en50221,
+ 0,
+ DVB_CA_EN50221_CAMCHANGE_REMOVED);
}
return 0;
--
1.7.1

View File

@ -0,0 +1,49 @@
From 03f4f0b232a65b033edc0ffbfa907ca7f25a68a8 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:22:57 -0300
Subject: [PATCH 065/120] V4L/DVB (13763): [Mantis] HIF I/O: trim delays a bit appropriately
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 8e0d58ecee2abc12f298862b7f9a90d1593e8006)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_hif.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index 1ccd869..880b996 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -133,11 +133,11 @@ int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr)
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
return -EREMOTEIO;
}
- udelay(50);
ca->hif_job_queue &= ~MANTIS_HIF_IOMRD;
data = mmread(MANTIS_GPIF_DIN);
hif_addr |= MANTIS_GPIF_PCMCIAREG;
mmwrite(hif_addr, MANTIS_GPIF_ADDR);
+ udelay(50);
return (u8) data;
}
@@ -162,10 +162,10 @@ int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data)
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
return -EREMOTEIO;
}
- udelay(50);
ca->hif_job_queue &= ~MANTIS_HIF_IOMWR;
hif_addr |= MANTIS_GPIF_PCMCIAREG;
mmwrite(hif_addr, MANTIS_GPIF_ADDR);
+ udelay(50);
return 0;
}
--
1.7.1

View File

@ -0,0 +1,38 @@
From 98d02f326cfc11b8fac8e031391dc9ddd092bc52 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:23:17 -0300
Subject: [PATCH 066/120] V4L/DVB (13764): [Mantis CA] SLOT: Add some debug status
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 5e2a0c99019bbc78d6fb00caf7a79f03df020b3c)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_ca.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c
index abd8855..b79a892 100644
--- a/drivers/media/dvb/mantis/mantis_ca.c
+++ b/drivers/media/dvb/mantis/mantis_ca.c
@@ -118,8 +118,12 @@ static int mantis_slot_status(struct dvb_ca_en50221 *en50221, int slot, int open
dprintk(verbose, MANTIS_DEBUG, 1, "Slot(%d): Poll Slot status", slot);
- if (ca->slot_state == MODULE_INSERTED)
+ if (ca->slot_state == MODULE_INSERTED) {
+ dprintk(verbose, MANTIS_DEBUG, 1, "CA Module present and ready");
return DVB_CA_EN50221_POLL_CAM_PRESENT | DVB_CA_EN50221_POLL_CAM_READY;
+ } else {
+ dprintk(verbose, MANTIS_DEBUG, 1, "CA Module not present or not ready");
+ }
return 0;
}
--
1.7.1

View File

@ -0,0 +1,66 @@
From b56e3266dc0a8ab03381e11ab8582693bd17a4ef Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:23:38 -0300
Subject: [PATCH 067/120] V4L/DVB (13765): [Mantis] HIF I/O: Add some debug statements
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 8b9c385f765bcc7fc5ae802830ffcb4b6ca6bc9c)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_hif.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index 880b996..c2cecc3 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -51,6 +51,7 @@ static int mantis_hif_sbuf_opdone_wait(struct mantis_ca *ca)
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): Smart buffer operation timeout !", mantis->num);
rc = -EREMOTEIO;
}
+ dprintk(verbose, MANTIS_DEBUG, 1, "Smart Buffer Operation complete");
ca->hif_event &= ~MANTIS_SBUF_OPDONE;
udelay(5);
return rc;
@@ -83,7 +84,7 @@ int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr)
return -EREMOTEIO;
}
data = mmread(MANTIS_GPIF_DIN);
-
+ dprintk(verbose, MANTIS_DEBUG, 1, "Mem Read: 0x%02x", data);
return (data >> 24) & 0xff;
}
@@ -111,6 +112,8 @@ int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data)
return -EREMOTEIO;
}
ca->hif_job_queue &= ~MANTIS_HIF_MEMWR;
+ dprintk(verbose, MANTIS_DEBUG, 1, "Mem Write: (0x%02x to 0x%02x)", data, addr);
+
return 0;
}
@@ -137,6 +140,7 @@ int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr)
data = mmread(MANTIS_GPIF_DIN);
hif_addr |= MANTIS_GPIF_PCMCIAREG;
mmwrite(hif_addr, MANTIS_GPIF_ADDR);
+ dprintk(verbose, MANTIS_DEBUG, 1, "I/O Read: 0x%02x", data);
udelay(50);
return (u8) data;
@@ -165,6 +169,7 @@ int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data)
ca->hif_job_queue &= ~MANTIS_HIF_IOMWR;
hif_addr |= MANTIS_GPIF_PCMCIAREG;
mmwrite(hif_addr, MANTIS_GPIF_ADDR);
+ dprintk(verbose, MANTIS_DEBUG, 1, "I/O Write: (0x%02x to 0x%02x)", data, addr);
udelay(50);
return 0;
--
1.7.1

View File

@ -0,0 +1,34 @@
From 1278188295bed9ed92291c3d8b751573e3756ae0 Mon Sep 17 00:00:00 2001
From: Sigmund Augdal <sigmund@snap.tv>
Date: Fri, 4 Dec 2009 05:24:01 -0300
Subject: [PATCH 068/120] V4L/DVB (13766): [Mantis] Bug: Fix wrong exit condition
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Sigmund Augdal <sigmund@snap.tv>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit b29453aca0eeecba52a76c3d67b1a52c3ca6e656)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_evm.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index 532bcff..214ae5e 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -31,8 +31,6 @@ static void mantis_hifevm_work(struct work_struct *work)
gpif_stat = mmread(MANTIS_GPIF_STATUS);
gpif_mask = mmread(MANTIS_GPIF_IRQCFG);
- if (!((gpif_stat & 0xff) & (gpif_mask & 0xff)))
- return;
if (gpif_stat & MANTIS_GPIF_DETSTAT) {
if (gpif_stat & MANTIS_CARD_PLUGIN) {
--
1.7.1

View File

@ -0,0 +1,36 @@
From 5d6d71e9bc1b015d2233cc54eff468675ca21ef2 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:24:47 -0300
Subject: [PATCH 069/120] V4L/DVB (13767): [Mantis/VP-1041] Bug: Add in missing Master clock settings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Thanks to Ershov and Igor for pointing it out.
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 18b6de42d77e7762be929a4a858c359de352e1e2)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_vp1041.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_vp1041.c b/drivers/media/dvb/mantis/mantis_vp1041.c
index 7dee1af..8eb1afd 100644
--- a/drivers/media/dvb/mantis/mantis_vp1041.c
+++ b/drivers/media/dvb/mantis/mantis_vp1041.c
@@ -267,6 +267,9 @@ struct stb0899_config vp1041_config = {
.xtal_freq = 27000000,
.inversion = IQ_SWAP_ON, /* 1 */
+ .lo_clk = 76500000,
+ .hi_clk = 99000000,
+
.esno_ave = STB0899_DVBS2_ESNO_AVE,
.esno_quant = STB0899_DVBS2_ESNO_QUANT,
.avframes_coarse = STB0899_DVBS2_AVFRAMES_COARSE,
--
1.7.1

View File

@ -0,0 +1,58 @@
From 3233c1c265a9216a4ac171d000f32ebc8921885e Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:25:18 -0300
Subject: [PATCH 070/120] V4L/DVB (13768): [Mantis] Enable WRACK
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit adcc9dd57e814d5ac3928f92f431fbe4808e936f)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_evm.c | 10 +++++++++-
drivers/media/dvb/mantis/mantis_hif.c | 1 +
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index 214ae5e..000cf39 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -27,11 +27,19 @@ static void mantis_hifevm_work(struct work_struct *work)
struct mantis_ca *ca = container_of(work, struct mantis_ca, hif_evm_work);
struct mantis_pci *mantis = ca->ca_priv;
- u32 gpif_stat, gpif_mask;
+ u32 gpif_stat, gpif_mask, rst_mask, rst_stat;
+
+ rst_mask = MANTIS_GPIF_WRACK |
+ MANTIS_GPIF_OTHERR |
+ MANTIS_SBUF_WSTO |
+ MANTIS_GPIF_EXTIRQ;
gpif_stat = mmread(MANTIS_GPIF_STATUS);
gpif_mask = mmread(MANTIS_GPIF_IRQCFG);
+ rst_stat = gpif_stat & rst_mask;
+ mmwrite(rst_stat, MANTIS_GPIF_STATUS);
+
if (gpif_stat & MANTIS_GPIF_DETSTAT) {
if (gpif_stat & MANTIS_CARD_PLUGIN) {
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Plugin", mantis->num);
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index c2cecc3..2f1a6cb 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -188,6 +188,7 @@ int mantis_hif_init(struct mantis_ca *ca)
irqcfg = mmread(MANTIS_GPIF_IRQCFG);
irqcfg |= MANTIS_MASK_BRRDY;
+ irqcfg |= MANTIS_MASK_WRACK;
mmwrite(irqcfg, MANTIS_GPIF_IRQCFG);
return 0;
--
1.7.1

View File

@ -0,0 +1,36 @@
From c06d22ea77fc3584534c556b738895c79f523065 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:25:45 -0300
Subject: [PATCH 071/120] V4L/DVB (13769): [Mantis] Smart Buffer Burst Read Ready cannot flag FR/DA Irq
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 9e49e8d913209e7221f761193f18a91d130b9e2d)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_evm.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index 000cf39..1594bb8 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -72,9 +72,9 @@ static void mantis_hifevm_work(struct work_struct *work)
if (gpif_stat & MANTIS_SBUF_OVFLW)
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Overflow", mantis->num);
- if (gpif_stat & MANTIS_GPIF_BRRDY) {
+ if (gpif_stat & MANTIS_GPIF_BRRDY)
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Read Ready", mantis->num);
- }
+
if (gpif_stat & MANTIS_GPIF_WRACK)
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Slave Write ACK", mantis->num);
--
1.7.1

View File

@ -0,0 +1,32 @@
From 25933d9a587b31a403afcf97ee51aeaacf0006fa Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:26:18 -0300
Subject: [PATCH 072/120] V4L/DVB (13770): [Mantis] Bug Do not trigger FR/DA IRQ from SBUF OPDONE
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit f668c7292bda7f64400eaa8d45c3a785eecab990)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_evm.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index 1594bb8..d603601 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -87,7 +87,6 @@ static void mantis_hifevm_work(struct work_struct *work)
if (gpif_stat & MANTIS_SBUF_OPDONE) {
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer operation complete", mantis->num);
ca->sbuf_status = MANTIS_SBUF_DATA_AVAIL;
- dvb_ca_en50221_frda_irq(&ca->en50221, 0);
}
}
--
1.7.1

View File

@ -0,0 +1,123 @@
From 968a9a10f909e19de0dd828d251d4513bc7f0ba7 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:26:46 -0300
Subject: [PATCH 073/120] V4L/DVB (13771): [Mantis] Reset Flags at the earliest possible
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 17b77fc2d404910ca691661038ceb4c02d912d16)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_common.h | 2 ++
drivers/media/dvb/mantis/mantis_evm.c | 18 +++++-------------
drivers/media/dvb/mantis/mantis_pci.c | 12 ++++++++++++
3 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index ac3eefe..27ecfdb 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -139,6 +139,8 @@ struct mantis_pci {
/* A12 A13 A14 */
u32 gpio_status;
+ u32 gpif_status;
+
struct mantis_ca *mantis_ca;
};
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index d603601..4c4c144 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -27,19 +27,11 @@ static void mantis_hifevm_work(struct work_struct *work)
struct mantis_ca *ca = container_of(work, struct mantis_ca, hif_evm_work);
struct mantis_pci *mantis = ca->ca_priv;
- u32 gpif_stat, gpif_mask, rst_mask, rst_stat;
-
- rst_mask = MANTIS_GPIF_WRACK |
- MANTIS_GPIF_OTHERR |
- MANTIS_SBUF_WSTO |
- MANTIS_GPIF_EXTIRQ;
+ u32 gpif_stat, gpif_mask;
gpif_stat = mmread(MANTIS_GPIF_STATUS);
gpif_mask = mmread(MANTIS_GPIF_IRQCFG);
- rst_stat = gpif_stat & rst_mask;
- mmwrite(rst_stat, MANTIS_GPIF_STATUS);
-
if (gpif_stat & MANTIS_GPIF_DETSTAT) {
if (gpif_stat & MANTIS_CARD_PLUGIN) {
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Plugin", mantis->num);
@@ -60,13 +52,13 @@ static void mantis_hifevm_work(struct work_struct *work)
}
}
- if (gpif_stat & MANTIS_GPIF_EXTIRQ)
+ if (mantis->gpif_status & MANTIS_GPIF_EXTIRQ)
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Ext IRQ", mantis->num);
- if (gpif_stat & MANTIS_SBUF_WSTO)
+ if (mantis->gpif_status & MANTIS_SBUF_WSTO)
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Timeout", mantis->num);
- if (gpif_stat & MANTIS_GPIF_OTHERR)
+ if (mantis->gpif_status & MANTIS_GPIF_OTHERR)
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Alignment Error", mantis->num);
if (gpif_stat & MANTIS_SBUF_OVFLW)
@@ -75,7 +67,7 @@ static void mantis_hifevm_work(struct work_struct *work)
if (gpif_stat & MANTIS_GPIF_BRRDY)
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Read Ready", mantis->num);
- if (gpif_stat & MANTIS_GPIF_WRACK)
+ if (mantis->gpif_status & MANTIS_GPIF_WRACK)
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Slave Write ACK", mantis->num);
if (gpif_stat & MANTIS_GPIF_INTSTAT)
diff --git a/drivers/media/dvb/mantis/mantis_pci.c b/drivers/media/dvb/mantis/mantis_pci.c
index 4873fa9..f57e2a4 100644
--- a/drivers/media/dvb/mantis/mantis_pci.c
+++ b/drivers/media/dvb/mantis/mantis_pci.c
@@ -53,6 +53,8 @@ MODULE_DEVICE_TABLE(pci, mantis_pci_table);
static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
{
u32 stat = 0, mask = 0, lstat = 0, mstat = 0;
+ u32 rst_stat = 0, rst_mask = 0;
+
struct mantis_pci *mantis;
struct mantis_ca *ca;
@@ -69,6 +71,15 @@ static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
if (!(stat & mask))
return IRQ_NONE;
+ rst_mask = MANTIS_GPIF_WRACK |
+ MANTIS_GPIF_OTHERR |
+ MANTIS_SBUF_WSTO |
+ MANTIS_GPIF_EXTIRQ;
+
+ rst_stat = mmread(MANTIS_GPIF_STATUS);
+ rst_stat &= rst_mask;
+ mmwrite(rst_stat, MANTIS_GPIF_STATUS);
+
mantis->mantis_int_stat = stat;
mantis->mantis_int_mask = mask;
dprintk(verbose, MANTIS_DEBUG, 0, "=== Interrupts[%04x/%04x]= [", stat, mask);
@@ -77,6 +88,7 @@ static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
}
if (stat & MANTIS_INT_IRQ0) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-0 *");
+ mantis->gpif_status = rst_stat;
schedule_work(&ca->hif_evm_work);
}
if (stat & MANTIS_INT_IRQ1) {
--
1.7.1

View File

@ -0,0 +1,42 @@
From bca78435121081f27d817455c44e7420fbc6bc37 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:27:26 -0300
Subject: [PATCH 074/120] V4L/DVB (13772): [Mantis] Do not enable Common Memory Access
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 578413228ae72a09b29bf29e879e5b919ded0ac4)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_hif.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index 2f1a6cb..151de2d 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -138,8 +138,6 @@ int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr)
}
ca->hif_job_queue &= ~MANTIS_HIF_IOMRD;
data = mmread(MANTIS_GPIF_DIN);
- hif_addr |= MANTIS_GPIF_PCMCIAREG;
- mmwrite(hif_addr, MANTIS_GPIF_ADDR);
dprintk(verbose, MANTIS_DEBUG, 1, "I/O Read: 0x%02x", data);
udelay(50);
@@ -167,8 +165,6 @@ int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data)
return -EREMOTEIO;
}
ca->hif_job_queue &= ~MANTIS_HIF_IOMWR;
- hif_addr |= MANTIS_GPIF_PCMCIAREG;
- mmwrite(hif_addr, MANTIS_GPIF_ADDR);
dprintk(verbose, MANTIS_DEBUG, 1, "I/O Write: (0x%02x to 0x%02x)", data, addr);
udelay(50);
--
1.7.1

View File

@ -0,0 +1,42 @@
From f885a5c0c7bd350ad4f082370f9a5b34acd47fce Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:27:53 -0300
Subject: [PATCH 075/120] V4L/DVB (13773): [Mantis] Enable all interrupts
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit c90d345fd7d66899d743611a47163f9904df90bc)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_hif.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index 151de2d..fa4bb6d 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -182,9 +182,14 @@ int mantis_hif_init(struct mantis_ca *ca)
init_waitqueue_head(&ca->hif_data_wq);
init_waitqueue_head(&ca->hif_opdone_wq);
- irqcfg = mmread(MANTIS_GPIF_IRQCFG);
- irqcfg |= MANTIS_MASK_BRRDY;
- irqcfg |= MANTIS_MASK_WRACK;
+ irqcfg = mmread(MANTIS_GPIF_IRQCFG);
+ irqcfg = MANTIS_MASK_BRRDY |
+ MANTIS_MASK_WRACK |
+ MANTIS_MASK_EXTIRQ |
+ MANTIS_MASK_WSTO |
+ MANTIS_MASK_OTHERR |
+ MANTIS_MASK_OVFLW;
+
mmwrite(irqcfg, MANTIS_GPIF_IRQCFG);
return 0;
--
1.7.1

View File

@ -0,0 +1,50 @@
From 6c879c97e12ca27a73026c73069babe5fee648c5 Mon Sep 17 00:00:00 2001
From: Sigmund Augdal <sigmund@snap.tv>
Date: Fri, 4 Dec 2009 05:28:24 -0300
Subject: [PATCH 076/120] V4L/DVB (13774): [Mantis] Remove redundant wait for Burst Reads, wakeup the HIF event
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Sigmund Augdal <sigmund@snap.tv>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit c02e15150c85619f22a98675124503ed93bf1914)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_evm.c | 2 ++
drivers/media/dvb/mantis/mantis_hif.c | 4 ----
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index 4c4c144..008e2c2 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -79,6 +79,8 @@ static void mantis_hifevm_work(struct work_struct *work)
if (gpif_stat & MANTIS_SBUF_OPDONE) {
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer operation complete", mantis->num);
ca->sbuf_status = MANTIS_SBUF_DATA_AVAIL;
+ ca->hif_event = MANTIS_SBUF_OPDONE;
+ wake_up(&ca->hif_opdone_wq);
}
}
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index fa4bb6d..6c51d17 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -75,10 +75,6 @@ int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr)
udelay(20);
mmwrite(hif_addr, MANTIS_GPIF_ADDR);
- if (mantis_hif_data_available(ca) != 0) {
- dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): GPIF Smart Buffer burst read failed", mantis->num);
- return -EREMOTEIO;
- }
if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): GPIF Smart Buffer operation failed", mantis->num);
return -EREMOTEIO;
--
1.7.1

View File

@ -0,0 +1,84 @@
From 5a8397a8434636fb2921245563fb8511148bee08 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:29:03 -0300
Subject: [PATCH 077/120] V4L/DVB (13775): [Mantis] Remove unnecessary job queues
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit b9fd5877463605b91743552b4989666792bf4fbc)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_hif.c | 10 ----------
drivers/media/dvb/mantis/mantis_link.h | 1 -
2 files changed, 0 insertions(+), 11 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index 6c51d17..621dce3 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -97,17 +97,13 @@ int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data)
hif_addr |= addr;
mmwrite(slot->slave_cfg, MANTIS_GPIF_CFGSLA); /* Slot0 alone for now */
-
mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR);
mmwrite(data, MANTIS_GPIF_DOUT);
- ca->hif_job_queue = MANTIS_HIF_MEMWR;
if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
- ca->hif_job_queue &= ~MANTIS_HIF_MEMWR;
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
return -EREMOTEIO;
}
- ca->hif_job_queue &= ~MANTIS_HIF_MEMWR;
dprintk(verbose, MANTIS_DEBUG, 1, "Mem Write: (0x%02x to 0x%02x)", data, addr);
return 0;
@@ -125,14 +121,11 @@ int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr)
hif_addr |= addr;
mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR);
- ca->hif_job_queue = MANTIS_HIF_IOMRD;
if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
- ca->hif_job_queue &= ~MANTIS_HIF_IOMRD;
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
return -EREMOTEIO;
}
- ca->hif_job_queue &= ~MANTIS_HIF_IOMRD;
data = mmread(MANTIS_GPIF_DIN);
dprintk(verbose, MANTIS_DEBUG, 1, "I/O Read: 0x%02x", data);
udelay(50);
@@ -154,13 +147,10 @@ int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data)
mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR);
mmwrite(data, MANTIS_GPIF_DOUT);
- ca->hif_job_queue = MANTIS_HIF_IOMWR;
if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
- ca->hif_job_queue &= ~MANTIS_HIF_IOMWR;
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
return -EREMOTEIO;
}
- ca->hif_job_queue &= ~MANTIS_HIF_IOMWR;
dprintk(verbose, MANTIS_DEBUG, 1, "I/O Write: (0x%02x to 0x%02x)", data, addr);
udelay(50);
diff --git a/drivers/media/dvb/mantis/mantis_link.h b/drivers/media/dvb/mantis/mantis_link.h
index 23ff2d6..a85f502 100644
--- a/drivers/media/dvb/mantis/mantis_link.h
+++ b/drivers/media/dvb/mantis/mantis_link.h
@@ -51,7 +51,6 @@ struct mantis_ca {
wait_queue_head_t hif_opdone_wq;
wait_queue_head_t hif_brrdyw_wq;
wait_queue_head_t hif_data_wq;
- u32 hif_job_queue;
enum mantis_sbuf_status sbuf_status;
--
1.7.1

View File

@ -0,0 +1,39 @@
From 20cef9cdc3581a9023fd09a0f202c7f53149a75f Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:29:25 -0300
Subject: [PATCH 078/120] V4L/DVB (13776): [Mantis] Use a simple timeout instead, interruptible
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
timeouts sleep unnecessarily too long
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit ac8f04d2723b3de7c36430d67401ce89c858e117)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_hif.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index 621dce3..a2359f7 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -44,9 +44,9 @@ static int mantis_hif_sbuf_opdone_wait(struct mantis_ca *ca)
struct mantis_pci *mantis = ca->ca_priv;
int rc = 0;
- if (wait_event_interruptible_timeout(ca->hif_opdone_wq,
- ca->hif_event & MANTIS_SBUF_OPDONE,
- msecs_to_jiffies(500)) == -ERESTARTSYS) {
+ if (wait_event_timeout(ca->hif_opdone_wq,
+ ca->hif_event & MANTIS_SBUF_OPDONE,
+ msecs_to_jiffies(500)) == -ERESTARTSYS) {
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): Smart buffer operation timeout !", mantis->num);
rc = -EREMOTEIO;
--
1.7.1

View File

@ -0,0 +1,99 @@
From 836746e92296047dfc0fa5b66ef32d67893f48e4 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:29:48 -0300
Subject: [PATCH 079/120] V4L/DVB (13777): [Mantis] Use a Write wait queue for Write events
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit e0e099a708043a2341d8987014ce4ba98a4dbd30)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_hif.c | 34 ++++++++++++++++++++++++++++++-
drivers/media/dvb/mantis/mantis_link.h | 1 +
2 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index a2359f7..dc50fac 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -57,6 +57,35 @@ static int mantis_hif_sbuf_opdone_wait(struct mantis_ca *ca)
return rc;
}
+static int mantis_hif_write_wait(struct mantis_ca *ca)
+{
+ struct mantis_pci *mantis = ca->ca_priv;
+ u32 opdone = 0, timeout = 0;
+ int rc = 0;
+
+ if (wait_event_timeout(ca->hif_write_wq,
+ mantis->gpif_status & MANTIS_GPIF_WRACK,
+ msecs_to_jiffies(500)) == -ERESTARTSYS) {
+
+ dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): Write ACK timed out !", mantis->num);
+ rc = -EREMOTEIO;
+ }
+ dprintk(verbose, MANTIS_DEBUG, 1, "Write Acknowledged");
+ mantis->gpif_status &= ~MANTIS_GPIF_WRACK;
+ while (!opdone) {
+ opdone = (mmread(MANTIS_GPIF_STATUS) & MANTIS_SBUF_OPDONE);
+ udelay(500);
+ timeout++;
+ if (timeout > 100) {
+ dprintk(verbose, MANTIS_ERROR, 1, "Adater(%d) Slot(0): Write operation timed out!", mantis->num);
+ rc = -ETIMEDOUT;
+ break;
+ }
+ }
+ dprintk(verbose, MANTIS_DEBUG, 1, "HIF Write success");
+ return rc;
+}
+
int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr)
{
@@ -100,7 +129,7 @@ int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data)
mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR);
mmwrite(data, MANTIS_GPIF_DOUT);
- if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
+ if (mantis_hif_write_wait(ca) != 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
return -EREMOTEIO;
}
@@ -147,7 +176,7 @@ int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data)
mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR);
mmwrite(data, MANTIS_GPIF_DOUT);
- if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
+ if (mantis_hif_write_wait(ca) != 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
return -EREMOTEIO;
}
@@ -167,6 +196,7 @@ int mantis_hif_init(struct mantis_ca *ca)
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Initializing Mantis Host Interface", mantis->num);
init_waitqueue_head(&ca->hif_data_wq);
init_waitqueue_head(&ca->hif_opdone_wq);
+ init_waitqueue_head(&ca->hif_write_wq);
irqcfg = mmread(MANTIS_GPIF_IRQCFG);
irqcfg = MANTIS_MASK_BRRDY |
diff --git a/drivers/media/dvb/mantis/mantis_link.h b/drivers/media/dvb/mantis/mantis_link.h
index a85f502..599ff1b 100644
--- a/drivers/media/dvb/mantis/mantis_link.h
+++ b/drivers/media/dvb/mantis/mantis_link.h
@@ -51,6 +51,7 @@ struct mantis_ca {
wait_queue_head_t hif_opdone_wq;
wait_queue_head_t hif_brrdyw_wq;
wait_queue_head_t hif_data_wq;
+ wait_queue_head_t hif_write_wq; /* HIF Write op */
enum mantis_sbuf_status sbuf_status;
--
1.7.1

View File

@ -0,0 +1,36 @@
From b985d00f6cc8780a4bb59651f685aec65c3f6470 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:30:11 -0300
Subject: [PATCH 080/120] V4L/DVB (13778): [Mantis] Wr ACK is already handled in the fast path,
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
do not use the event manager to handle the fast events
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 4d019faf48ff03b6ff3463d8e5da54d61f153623)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_evm.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index 008e2c2..9be55f7 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -67,9 +67,6 @@ static void mantis_hifevm_work(struct work_struct *work)
if (gpif_stat & MANTIS_GPIF_BRRDY)
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Read Ready", mantis->num);
- if (mantis->gpif_status & MANTIS_GPIF_WRACK)
- dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Slave Write ACK", mantis->num);
-
if (gpif_stat & MANTIS_GPIF_INTSTAT)
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): GPIF IRQ", mantis->num);
--
1.7.1

View File

@ -0,0 +1,34 @@
From a2b40d936b9dc0a2adf4eb204fea8b2660e958ba Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:30:33 -0300
Subject: [PATCH 081/120] V4L/DVB (13779): [Mantis] Missing wakeup for write queue
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Thanks to Sigmund for pointing it out
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 25e9eba42ce11a05933068cf6a42dd8d4ed5edb8)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_pci.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_pci.c b/drivers/media/dvb/mantis/mantis_pci.c
index f57e2a4..a068ffb 100644
--- a/drivers/media/dvb/mantis/mantis_pci.c
+++ b/drivers/media/dvb/mantis/mantis_pci.c
@@ -89,6 +89,7 @@ static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
if (stat & MANTIS_INT_IRQ0) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-0 *");
mantis->gpif_status = rst_stat;
+ wake_up(&ca->hif_write_wq);
schedule_work(&ca->hif_evm_work);
}
if (stat & MANTIS_INT_IRQ1) {
--
1.7.1

View File

@ -0,0 +1,37 @@
From da671ce16df2bbc12053996f0308bc6414c355e4 Mon Sep 17 00:00:00 2001
From: Sigmund Augdal <sigmund@snap.tv>
Date: Fri, 4 Dec 2009 05:30:59 -0300
Subject: [PATCH 082/120] V4L/DVB (13780): [Mantis] HIF I/O: Enable Interrupts for Read
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Sigmund Augdal <sigmund@snap.tv>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit c63e507346c042af7fe26d49bbbdce9898ea3eea)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_hif.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index dc50fac..323d1fb 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -149,6 +149,11 @@ int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr)
hif_addr |= MANTIS_GPIF_PCMCIAIOM;
hif_addr |= addr;
+ mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_BRADDR);
+ mmwrite(1, MANTIS_GPIF_BRBYTES);
+
+ udelay(20);
+
mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR);
if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
--
1.7.1

View File

@ -0,0 +1,99 @@
From 708cce89d29f05833e37b720b2258cd397c18a0d Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:31:21 -0300
Subject: [PATCH 083/120] V4L/DVB (13781): [Mantis CA] Bug: Fix wrong usage of HIFRDWRN
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit b29f6ac248e49d8425aa91afb1b53d1f6d47ebe3)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_hif.c | 24 +++++++++++-------------
1 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index 323d1fb..3368253 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -53,7 +53,6 @@ static int mantis_hif_sbuf_opdone_wait(struct mantis_ca *ca)
}
dprintk(verbose, MANTIS_DEBUG, 1, "Smart Buffer Operation complete");
ca->hif_event &= ~MANTIS_SBUF_OPDONE;
- udelay(5);
return rc;
}
@@ -93,17 +92,16 @@ int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr)
u32 hif_addr = 0, data, count = 4;
dprintk(verbose, MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF Mem Read", mantis->num);
- hif_addr |= MANTIS_GPIF_HIFRDWRN;
hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
hif_addr &= ~MANTIS_GPIF_PCMCIAIOM;
+ hif_addr |= MANTIS_HIF_STATUS;
hif_addr |= addr;
- mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_BRADDR);
+ mmwrite(hif_addr, MANTIS_GPIF_BRADDR);
mmwrite(count, MANTIS_GPIF_BRBYTES);
-
udelay(20);
+ mmwrite(hif_addr | MANTIS_GPIF_HIFRDWRN, MANTIS_GPIF_ADDR);
- mmwrite(hif_addr, MANTIS_GPIF_ADDR);
if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): GPIF Smart Buffer operation failed", mantis->num);
return -EREMOTEIO;
@@ -123,10 +121,11 @@ int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data)
hif_addr &= ~MANTIS_GPIF_HIFRDWRN;
hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
hif_addr &= ~MANTIS_GPIF_PCMCIAIOM;
- hif_addr |= addr;
+ hif_addr |= MANTIS_HIF_STATUS;
+ hif_addr |= addr;
mmwrite(slot->slave_cfg, MANTIS_GPIF_CFGSLA); /* Slot0 alone for now */
- mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR);
+ mmwrite(hif_addr, MANTIS_GPIF_ADDR);
mmwrite(data, MANTIS_GPIF_DOUT);
if (mantis_hif_write_wait(ca) != 0) {
@@ -145,16 +144,14 @@ int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr)
dprintk(verbose, MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF I/O Read", mantis->num);
hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
- hif_addr |= MANTIS_GPIF_HIFRDWRN;
hif_addr |= MANTIS_GPIF_PCMCIAIOM;
+ hif_addr |= MANTIS_HIF_STATUS;
hif_addr |= addr;
- mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_BRADDR);
+ mmwrite(hif_addr, MANTIS_GPIF_BRADDR);
mmwrite(1, MANTIS_GPIF_BRBYTES);
-
udelay(20);
-
- mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR);
+ mmwrite(hif_addr | MANTIS_GPIF_HIFRDWRN, MANTIS_GPIF_ADDR);
if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
@@ -176,9 +173,10 @@ int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data)
hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
hif_addr &= ~MANTIS_GPIF_HIFRDWRN;
hif_addr |= MANTIS_GPIF_PCMCIAIOM;
+ hif_addr |= MANTIS_HIF_STATUS;
hif_addr |= addr;
- mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR);
+ mmwrite(hif_addr, MANTIS_GPIF_ADDR);
mmwrite(data, MANTIS_GPIF_DOUT);
if (mantis_hif_write_wait(ca) != 0) {
--
1.7.1

View File

@ -0,0 +1,36 @@
From 69ffe7b35779fd6b84735ae4011e314cc649734f Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:31:45 -0300
Subject: [PATCH 084/120] V4L/DVB (13782): [Mantis] Temporarily disable FRDA irq
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit e26c2b46201e5ae38111391c293cec08870b7f6d)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_ca.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c
index b79a892..177b048 100644
--- a/drivers/media/dvb/mantis/mantis_ca.c
+++ b/drivers/media/dvb/mantis/mantis_ca.c
@@ -143,10 +143,7 @@ int mantis_ca_init(struct mantis_pci *mantis)
ca->ca_priv = mantis;
mantis->mantis_ca = ca;
- ca_flags = DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE |
- DVB_CA_EN50221_FLAG_IRQ_FR |
- DVB_CA_EN50221_FLAG_IRQ_DA;
-
+ ca_flags = DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE;
/* register CA interface */
ca->en50221.owner = THIS_MODULE;
ca->en50221.read_attribute_mem = mantis_ca_read_attr_mem;
--
1.7.1

View File

@ -0,0 +1,59 @@
From 1afd0c9e1ec56c4692e6d74c449009774edc61c7 Mon Sep 17 00:00:00 2001
From: Marko Viitamaki <mau2@suomi24.fi>
Date: Fri, 4 Dec 2009 05:32:30 -0300
Subject: [PATCH 085/120] V4L/DVB (13783): [Mantis/Technisat Cablestar HD2] Add support for the Technisat Cablestar HD2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Marko Viitamaki <mau2@suomi24.fi>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit f5701b67767c6b81a035c9e2b539025f91d1e84d)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_core.c | 1 +
drivers/media/dvb/mantis/mantis_dvb.c | 1 +
drivers/media/dvb/mantis/mantis_vp2040.h | 1 +
3 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_core.c b/drivers/media/dvb/mantis/mantis_core.c
index 3fd3b08..c3d0d53 100644
--- a/drivers/media/dvb/mantis/mantis_core.c
+++ b/drivers/media/dvb/mantis/mantis_core.c
@@ -121,6 +121,7 @@ static void mantis_load_config(struct mantis_pci *mantis)
break;
case MANTIS_VP_2040_DVB_C: // VP-2040
case TERRATEC_CINERGY_C_PCI: // VP-2040 clone
+ case TECHNISAT_CABLESTAR_HD2:
mantis->hwconfig = &vp2040_mantis_config;
break;
case MANTIS_VP_3030_DVB_T: // VP-3030
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c
index 3940aed..c3a35be 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -275,6 +275,7 @@ int __devinit mantis_frontend_init(struct mantis_pci *mantis)
break;
case MANTIS_VP_2040_DVB_C: // VP-2040
case TERRATEC_CINERGY_C_PCI:
+ case TECHNISAT_CABLESTAR_HD2:
dprintk(verbose, MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
mantis->fe = tda10023_attach(&tda10023_cu1216_config, &mantis->adapter, read_pwm(mantis));
if (mantis->fe) {
diff --git a/drivers/media/dvb/mantis/mantis_vp2040.h b/drivers/media/dvb/mantis/mantis_vp2040.h
index 69463cc..645dade 100644
--- a/drivers/media/dvb/mantis/mantis_vp2040.h
+++ b/drivers/media/dvb/mantis/mantis_vp2040.h
@@ -27,6 +27,7 @@
#define MANTIS_VP_2040_DVB_C 0x0043
#define TERRATEC_CINERGY_C_PCI 0x1178
+#define TECHNISAT_CABLESTAR_HD2 0x0002
extern struct tda1002x_config tda10023_cu1216_config;
extern struct mantis_hwconfig vp2040_mantis_config;
--
1.7.1

View File

@ -0,0 +1,36 @@
From 1aba53af9711a20d7ec3ac40652b49a0da5bece9 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:32:51 -0300
Subject: [PATCH 086/120] V4L/DVB (13784): [Mantis] Use PCI API instead of hardcoded length
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit ff63ac56705539e162d2f020a0c2a607eae37d7b)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_pci.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_pci.c b/drivers/media/dvb/mantis/mantis_pci.c
index a068ffb..d3a62b1 100644
--- a/drivers/media/dvb/mantis/mantis_pci.c
+++ b/drivers/media/dvb/mantis/mantis_pci.c
@@ -169,7 +169,10 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
goto err0;
}
- if ((mantis->mantis_mmio = ioremap(mantis->mantis_addr, 0x1000)) == NULL) {
+ mantis->mantis_mmio = ioremap(pci_resource_start(pdev, 0),
+ pci_resource_len(pdev, 0));
+
+ if (!mantis->mantis_mmio) {
dprintk(verbose, MANTIS_ERROR, 1, "IO remap failed");
ret = -ENODEV;
goto err1;
--
1.7.1

View File

@ -0,0 +1,38 @@
From 4ac6de6b8db05b596deaec2273e359f4cdef1a34 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:33:10 -0300
Subject: [PATCH 087/120] V4L/DVB (13785): [Mantis] Do not disable IRQ's while being invoked
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 13d5036ea0636e6204e1b17bd12ea25061a686be)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_pci.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_pci.c b/drivers/media/dvb/mantis/mantis_pci.c
index d3a62b1..94abcee 100644
--- a/drivers/media/dvb/mantis/mantis_pci.c
+++ b/drivers/media/dvb/mantis/mantis_pci.c
@@ -181,8 +181,11 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
// Clear and disable all interrupts at startup
// to avoid lockup situations
mmwrite(0x00, MANTIS_INT_MASK);
- if (request_irq(pdev->irq, mantis_pci_irq, IRQF_SHARED | IRQF_DISABLED,
- DRIVER_NAME, mantis) < 0) {
+ if (request_irq(pdev->irq,
+ mantis_pci_irq,
+ IRQF_SHARED,
+ DRIVER_NAME,
+ mantis) < 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Mantis IRQ reg failed");
ret = -ENODEV;
--
1.7.1

View File

@ -0,0 +1,33 @@
From 14fef7b5eac3d398487efe43a4b939df5e8fcf72 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:33:31 -0300
Subject: [PATCH 088/120] V4L/DVB (13786): [Mantis] Bug: HIF bits already shifted ..
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 263645de70175d8b5a5e392a1856e99e2e1b7209)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_common.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index 27ecfdb..6b9f92b 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -144,7 +144,7 @@ struct mantis_pci {
struct mantis_ca *mantis_ca;
};
-#define MANTIS_HIF_STATUS (mantis->gpio_status << 12)
+#define MANTIS_HIF_STATUS (mantis->gpio_status)
extern unsigned int verbose;
extern unsigned int devs;
--
1.7.1

View File

@ -0,0 +1,85 @@
From a9c5af3e2ab2bd90a3beae38d26f6be86b2d6bdd Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:33:56 -0300
Subject: [PATCH 089/120] V4L/DVB (13787): [Mantis] Fix build
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 616f75e1979f5bd1f3241581c720349c2c31f6e7)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_dvb.c | 5 ++++-
drivers/media/dvb/mantis/mantis_vp1033.c | 2 +-
drivers/media/dvb/mantis/mantis_vp2040.c | 2 +-
drivers/media/dvb/mantis/mantis_vp2040.h | 2 +-
4 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c
index c3a35be..5172e85 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -32,6 +32,8 @@
#include "mantis_vp2040.h"
#include "mantis_vp3030.h"
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
/* Tuner power supply control */
void mantis_fe_powerup(struct mantis_pci *mantis)
{
@@ -128,7 +130,8 @@ int __devinit mantis_dvb_init(struct mantis_pci *mantis)
dprintk(verbose, MANTIS_DEBUG, 1, "dvb_register_adapter");
if (dvb_register_adapter(&mantis->dvb_adapter,
"Mantis dvb adapter", THIS_MODULE,
- &mantis->pdev->dev) < 0) {
+ &mantis->pdev->dev,
+ adapter_nr) < 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Error registering adapter");
return -ENODEV;
diff --git a/drivers/media/dvb/mantis/mantis_vp1033.c b/drivers/media/dvb/mantis/mantis_vp1033.c
index daf02c1..797c4e0 100644
--- a/drivers/media/dvb/mantis/mantis_vp1033.c
+++ b/drivers/media/dvb/mantis/mantis_vp1033.c
@@ -74,7 +74,7 @@ struct stv0299_config lgtdqcs001f_config = {
.invert = 1,
// .enhanced_tuning = 0,
.skip_reinit = 0,
- .lock_output = STV0229_LOCKOUTPUT_0,
+// .lock_output = STV0229_LOCKOUTPUT_0,
.volt13_op0_op1 = STV0299_VOLT13_OP0,
.min_delay_ms = 100,
.set_symbol_rate = lgtdqcs001f_set_symbol_rate,
diff --git a/drivers/media/dvb/mantis/mantis_vp2040.c b/drivers/media/dvb/mantis/mantis_vp2040.c
index 07da738..f77be7b 100644
--- a/drivers/media/dvb/mantis/mantis_vp2040.c
+++ b/drivers/media/dvb/mantis/mantis_vp2040.c
@@ -30,7 +30,7 @@ struct mantis_hwconfig vp2040_mantis_config = {
.ts_size = MANTIS_TS_204,
};
-struct tda1002x_config tda10023_cu1216_config = {
+struct tda10023_config tda10023_cu1216_config = {
.demod_address = 0x18 >> 1,
.invert = 1,
};
diff --git a/drivers/media/dvb/mantis/mantis_vp2040.h b/drivers/media/dvb/mantis/mantis_vp2040.h
index 645dade..c745754 100644
--- a/drivers/media/dvb/mantis/mantis_vp2040.h
+++ b/drivers/media/dvb/mantis/mantis_vp2040.h
@@ -29,7 +29,7 @@
#define TERRATEC_CINERGY_C_PCI 0x1178
#define TECHNISAT_CABLESTAR_HD2 0x0002
-extern struct tda1002x_config tda10023_cu1216_config;
+extern struct tda10023_config tda10023_cu1216_config;
extern struct mantis_hwconfig vp2040_mantis_config;
#endif //__MANTIS_VP2040_H
--
1.7.1

View File

@ -0,0 +1,153 @@
From 4107aa8cfe04d3f56fbcfd38480286a8a1327c32 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:34:19 -0300
Subject: [PATCH 090/120] V4L/DVB (13788): [Mantis CA] use a lock for the relevant CI Read/Write operations
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit f684336bba673b6656cb98144130ab52dafc3240)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_hif.c | 16 ++++++++++++++++
drivers/media/dvb/mantis/mantis_link.h | 2 ++
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index 3368253..b1e1aa0 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -92,6 +92,7 @@ int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr)
u32 hif_addr = 0, data, count = 4;
dprintk(verbose, MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF Mem Read", mantis->num);
+ mutex_lock(&ca->ca_lock);
hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
hif_addr &= ~MANTIS_GPIF_PCMCIAIOM;
hif_addr |= MANTIS_HIF_STATUS;
@@ -104,9 +105,11 @@ int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr)
if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): GPIF Smart Buffer operation failed", mantis->num);
+ mutex_unlock(&ca->ca_lock);
return -EREMOTEIO;
}
data = mmread(MANTIS_GPIF_DIN);
+ mutex_unlock(&ca->ca_lock);
dprintk(verbose, MANTIS_DEBUG, 1, "Mem Read: 0x%02x", data);
return (data >> 24) & 0xff;
}
@@ -118,6 +121,7 @@ int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data)
u32 hif_addr = 0;
dprintk(verbose, MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF Mem Write", mantis->num);
+ mutex_lock(&ca->ca_lock);
hif_addr &= ~MANTIS_GPIF_HIFRDWRN;
hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
hif_addr &= ~MANTIS_GPIF_PCMCIAIOM;
@@ -130,9 +134,11 @@ int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data)
if (mantis_hif_write_wait(ca) != 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
+ mutex_unlock(&ca->ca_lock);
return -EREMOTEIO;
}
dprintk(verbose, MANTIS_DEBUG, 1, "Mem Write: (0x%02x to 0x%02x)", data, addr);
+ mutex_unlock(&ca->ca_lock);
return 0;
}
@@ -143,6 +149,7 @@ int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr)
u32 data, hif_addr = 0;
dprintk(verbose, MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF I/O Read", mantis->num);
+ mutex_lock(&ca->ca_lock);
hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
hif_addr |= MANTIS_GPIF_PCMCIAIOM;
hif_addr |= MANTIS_HIF_STATUS;
@@ -155,11 +162,13 @@ int mantis_hif_read_iom(struct mantis_ca *ca, u32 addr)
if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
+ mutex_unlock(&ca->ca_lock);
return -EREMOTEIO;
}
data = mmread(MANTIS_GPIF_DIN);
dprintk(verbose, MANTIS_DEBUG, 1, "I/O Read: 0x%02x", data);
udelay(50);
+ mutex_unlock(&ca->ca_lock);
return (u8) data;
}
@@ -170,6 +179,7 @@ int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data)
u32 hif_addr = 0;
dprintk(verbose, MANTIS_DEBUG, 1, "Adapter(%d) Slot(0): Request HIF I/O Write", mantis->num);
+ mutex_lock(&ca->ca_lock);
hif_addr &= ~MANTIS_GPIF_PCMCIAREG;
hif_addr &= ~MANTIS_GPIF_HIFRDWRN;
hif_addr |= MANTIS_GPIF_PCMCIAIOM;
@@ -181,9 +191,11 @@ int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data)
if (mantis_hif_write_wait(ca) != 0) {
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
+ mutex_unlock(&ca->ca_lock);
return -EREMOTEIO;
}
dprintk(verbose, MANTIS_DEBUG, 1, "I/O Write: (0x%02x to 0x%02x)", data, addr);
+ mutex_unlock(&ca->ca_lock);
udelay(50);
return 0;
@@ -201,6 +213,7 @@ int mantis_hif_init(struct mantis_ca *ca)
init_waitqueue_head(&ca->hif_opdone_wq);
init_waitqueue_head(&ca->hif_write_wq);
+ mutex_lock(&ca->ca_lock);
irqcfg = mmread(MANTIS_GPIF_IRQCFG);
irqcfg = MANTIS_MASK_BRRDY |
MANTIS_MASK_WRACK |
@@ -210,6 +223,7 @@ int mantis_hif_init(struct mantis_ca *ca)
MANTIS_MASK_OVFLW;
mmwrite(irqcfg, MANTIS_GPIF_IRQCFG);
+ mutex_unlock(&ca->ca_lock);
return 0;
}
@@ -220,7 +234,9 @@ void mantis_hif_exit(struct mantis_ca *ca)
u32 irqcfg;
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Exiting Mantis Host Interface", mantis->num);
+ mutex_lock(&ca->ca_lock);
irqcfg = mmread(MANTIS_GPIF_IRQCFG);
irqcfg &= ~MANTIS_MASK_BRRDY;
mmwrite(irqcfg, MANTIS_GPIF_IRQCFG);
+ mutex_unlock(&ca->ca_lock);
}
diff --git a/drivers/media/dvb/mantis/mantis_link.h b/drivers/media/dvb/mantis/mantis_link.h
index 599ff1b..f9aaaa5 100644
--- a/drivers/media/dvb/mantis/mantis_link.h
+++ b/drivers/media/dvb/mantis/mantis_link.h
@@ -21,6 +21,7 @@
#ifndef __MANTIS_LINK_H
#define __MANTIS_LINK_H
+#include <linux/mutex.h>
#include <linux/workqueue.h>
#include "dvb_ca_en50221.h"
@@ -61,6 +62,7 @@ struct mantis_ca {
void *ca_priv;
struct dvb_ca_en50221 en50221;
+ struct mutex ca_lock;
};
/* CA */
--
1.7.1

View File

@ -0,0 +1,33 @@
From 4e784e4246afe710385c324556011f844546fa72 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:34:44 -0300
Subject: [PATCH 091/120] V4L/DVB (13789): [Mantis CA] Initialize the mutex
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 99b55b2c4478e6370aaa85173f5090a070c50a08)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_ca.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c
index 177b048..53c01b3 100644
--- a/drivers/media/dvb/mantis/mantis_ca.c
+++ b/drivers/media/dvb/mantis/mantis_ca.c
@@ -156,6 +156,8 @@ int mantis_ca_init(struct mantis_pci *mantis)
ca->en50221.poll_slot_status = mantis_slot_status;
ca->en50221.data = ca;
+ mutex_init(&ca->ca_lock);
+
dprintk(verbose, MANTIS_ERROR, 1, "Registering EN50221 device");
if ((result = dvb_ca_en50221_init(dvb_adapter, &ca->en50221, ca_flags, 1)) != 0) {
dprintk(verbose, MANTIS_ERROR, 1, "EN50221: Initialization failed");
--
1.7.1

View File

@ -0,0 +1,50 @@
From 5de34a19be663f0499a7c5e2246cb8d55122a983 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:35:07 -0300
Subject: [PATCH 092/120] V4L/DVB (13790): [Mantis] Relocate queue initialization
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit 42f541bfd1a9bad84a288d59a98fdb284df61a45)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_ca.c | 4 ++++
drivers/media/dvb/mantis/mantis_hif.c | 3 ---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c
index 53c01b3..7aa27e0 100644
--- a/drivers/media/dvb/mantis/mantis_ca.c
+++ b/drivers/media/dvb/mantis/mantis_ca.c
@@ -158,6 +158,10 @@ int mantis_ca_init(struct mantis_pci *mantis)
mutex_init(&ca->ca_lock);
+ init_waitqueue_head(&ca->hif_data_wq);
+ init_waitqueue_head(&ca->hif_opdone_wq);
+ init_waitqueue_head(&ca->hif_write_wq);
+
dprintk(verbose, MANTIS_ERROR, 1, "Registering EN50221 device");
if ((result = dvb_ca_en50221_init(dvb_adapter, &ca->en50221, ca_flags, 1)) != 0) {
dprintk(verbose, MANTIS_ERROR, 1, "EN50221: Initialization failed");
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c
index b1e1aa0..99a9724 100644
--- a/drivers/media/dvb/mantis/mantis_hif.c
+++ b/drivers/media/dvb/mantis/mantis_hif.c
@@ -209,9 +209,6 @@ int mantis_hif_init(struct mantis_ca *ca)
slot[0].slave_cfg = 0x70773028;
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Initializing Mantis Host Interface", mantis->num);
- init_waitqueue_head(&ca->hif_data_wq);
- init_waitqueue_head(&ca->hif_opdone_wq);
- init_waitqueue_head(&ca->hif_write_wq);
mutex_lock(&ca->ca_lock);
irqcfg = mmread(MANTIS_GPIF_IRQCFG);
--
1.7.1

View File

@ -0,0 +1,76 @@
From 06342162d084a1660160e453a6a8a62440364f83 Mon Sep 17 00:00:00 2001
From: Niklas Edmundsson <nikke@acc.umu.se>
Date: Fri, 4 Dec 2009 05:38:52 -0300
Subject: [PATCH 093/120] V4L/DVB (13792): [Mantis/VP-2033] Do not claim TDA10023
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Do not rely on the PCI ID alone
Signed-off-by: Niklas Edmundsson <nikke@acc.umu.se>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit ec1b6ff1cce9d406a9a5f84a1d1205328f2c515a)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_dvb.c | 33 +++++++++++++++++----------------
1 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c
index 5172e85..de18bb9 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -263,31 +263,32 @@ int __devinit mantis_frontend_init(struct mantis_pci *mantis)
}
break;
case MANTIS_VP_2033_DVB_C: // VP-2033
+ case MANTIS_VP_2040_DVB_C: // VP-2040
+ case TERRATEC_CINERGY_C_PCI:
+ case TECHNISAT_CABLESTAR_HD2:
dprintk(verbose, MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
- mantis->fe = tda10021_attach(&philips_cu1216_config, &mantis->adapter, read_pwm(mantis));
+ mantis->fe = tda10021_attach(&philips_cu1216_config,
+ &mantis->adapter,
+ read_pwm(mantis));
+
if (mantis->fe) {
- mantis->fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set;
dprintk(verbose, MANTIS_ERROR, 1,
"found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x",
philips_cu1216_config.demod_address);
-
- dprintk(verbose, MANTIS_ERROR, 1,
- "Mantis DVB-C Philips CU1216 frontend attach success");
-
+ } else {
+ mantis->fe = tda10023_attach(&tda10023_cu1216_config,
+ &mantis->adapter,
+ read_pwm(mantis));
+
+ if (mantis->fe) {
+ dprintk(verbose, MANTIS_ERROR, 1,
+ "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x",
+ philips_cu1216_config.demod_address);
+ }
}
- break;
- case MANTIS_VP_2040_DVB_C: // VP-2040
- case TERRATEC_CINERGY_C_PCI:
- case TECHNISAT_CABLESTAR_HD2:
- dprintk(verbose, MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
- mantis->fe = tda10023_attach(&tda10023_cu1216_config, &mantis->adapter, read_pwm(mantis));
if (mantis->fe) {
mantis->fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set;
dprintk(verbose, MANTIS_ERROR, 1,
- "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x",
- philips_cu1216_config.demod_address);
-
- dprintk(verbose, MANTIS_ERROR, 1,
"Mantis DVB-C Philips CU1216 frontend attach success");
}
break;
--
1.7.1

View File

@ -0,0 +1,478 @@
From 3b3b57c4823e90f07e6fb6cf4df7e7c670aafdbc Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:39:57 -0300
Subject: [PATCH 094/120] V4L/DVB (13794): [Mantis/VP-3028] Initial go at Serial interface implementation, add support for VP-3028
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit add206368462434ba97e8fe4de98e5d47ffdb0a0)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/Makefile | 2 +
drivers/media/dvb/mantis/mantis_common.h | 10 ++
drivers/media/dvb/mantis/mantis_core.c | 8 ++
drivers/media/dvb/mantis/mantis_pci.c | 2 +
drivers/media/dvb/mantis/mantis_uart.c | 139 ++++++++++++++++++++++++++++++
drivers/media/dvb/mantis/mantis_uart.h | 25 +++++-
drivers/media/dvb/mantis/mantis_vp1033.c | 3 +
drivers/media/dvb/mantis/mantis_vp1034.c | 3 +
drivers/media/dvb/mantis/mantis_vp1041.c | 3 +
drivers/media/dvb/mantis/mantis_vp2033.c | 3 +
drivers/media/dvb/mantis/mantis_vp2040.c | 3 +
drivers/media/dvb/mantis/mantis_vp3028.c | 38 ++++++++
drivers/media/dvb/mantis/mantis_vp3028.h | 13 +++
drivers/media/dvb/mantis/mantis_vp3030.c | 3 +
14 files changed, 253 insertions(+), 2 deletions(-)
create mode 100644 drivers/media/dvb/mantis/mantis_uart.c
create mode 100644 drivers/media/dvb/mantis/mantis_vp3028.c
create mode 100644 drivers/media/dvb/mantis/mantis_vp3028.h
diff --git a/drivers/media/dvb/mantis/Makefile b/drivers/media/dvb/mantis/Makefile
index d002ef9..bb88cdc 100644
--- a/drivers/media/dvb/mantis/Makefile
+++ b/drivers/media/dvb/mantis/Makefile
@@ -1,4 +1,5 @@
mantis-objs = mantis_core.o \
+ mantis_uart.o \
mantis_dma.o \
mantis_pci.o \
mantis_i2c.o \
@@ -12,6 +13,7 @@ mantis-objs = mantis_core.o \
mantis_vp1041.o \
mantis_vp2033.o \
mantis_vp2040.o \
+ mantis_vp3028.o \
mantis_vp3030.o
obj-$(CONFIG_DVB_MANTIS) += mantis.o
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index 6b9f92b..6a02adf 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -26,6 +26,7 @@
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/mutex.h>
+#include <linux/workqueue.h>
#include "dvbdev.h"
#include "dvb_demux.h"
@@ -34,6 +35,7 @@
#include "dvb_net.h"
#include <linux/i2c.h>
#include "mantis_reg.h"
+#include "mantis_uart.h"
#include "mantis_link.h"
@@ -74,6 +76,10 @@ struct mantis_hwconfig {
char *model_name;
char *dev_type;
u32 ts_size;
+
+ enum mantis_baud baud_rate;
+ enum mantis_parity parity;
+ u32 bytes;
};
struct mantis_pci {
@@ -142,6 +148,10 @@ struct mantis_pci {
u32 gpif_status;
struct mantis_ca *mantis_ca;
+
+ wait_queue_head_t uart_wq;
+ struct work_struct uart_work;
+ spinlock_t uart_lock;
};
#define MANTIS_HIF_STATUS (mantis->gpio_status)
diff --git a/drivers/media/dvb/mantis/mantis_core.c b/drivers/media/dvb/mantis/mantis_core.c
index c3d0d53..52b3e9e 100644
--- a/drivers/media/dvb/mantis/mantis_core.c
+++ b/drivers/media/dvb/mantis/mantis_core.c
@@ -165,6 +165,10 @@ int mantis_core_init(struct mantis_pci *mantis)
dprintk(verbose, MANTIS_DEBUG, 1, "Mantis DVB init failed");
return err;
}
+ if ((err = mantis_uart_init(mantis)) < 0) {
+ dprintk(verbose, MANTIS_DEBUG, 1, "Mantis UART init failed");
+ return err;
+ }
return 0;
}
@@ -173,6 +177,10 @@ int mantis_core_exit(struct mantis_pci *mantis)
{
mantis_dma_stop(mantis);
dprintk(verbose, MANTIS_ERROR, 1, "DMA engine stopping");
+
+ mantis_uart_exit(mantis);
+ dprintk(verbose, MANTIS_ERROR, 1, "UART exit failed");
+
if (mantis_dma_exit(mantis) < 0)
dprintk(verbose, MANTIS_ERROR, 1, "DMA exit failed");
if (mantis_dvb_exit(mantis) < 0)
diff --git a/drivers/media/dvb/mantis/mantis_pci.c b/drivers/media/dvb/mantis/mantis_pci.c
index 94abcee..d1eac40 100644
--- a/drivers/media/dvb/mantis/mantis_pci.c
+++ b/drivers/media/dvb/mantis/mantis_pci.c
@@ -27,6 +27,7 @@
#include <linux/device.h>
#include "mantis_common.h"
#include "mantis_core.h"
+#include "mantis_uart.h"
#include <asm/irq.h>
#include <linux/signal.h>
@@ -94,6 +95,7 @@ static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
}
if (stat & MANTIS_INT_IRQ1) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-1 *");
+ schedule_work(&mantis->uart_work);
}
if (stat & MANTIS_INT_OCERR) {
dprintk(verbose, MANTIS_DEBUG, 0, "* INT OCERR *");
diff --git a/drivers/media/dvb/mantis/mantis_uart.c b/drivers/media/dvb/mantis/mantis_uart.c
new file mode 100644
index 0000000..786fcc3
--- /dev/null
+++ b/drivers/media/dvb/mantis/mantis_uart.c
@@ -0,0 +1,139 @@
+#include <linux/spinlock.h>
+#include "mantis_common.h"
+
+struct mantis_uart_params {
+ enum mantis_baud baud_rate;
+ enum mantis_parity parity;
+};
+
+#define UART_MAX_BUF 16
+
+int mantis_uart_read(struct mantis_pci *mantis, u8 *data)
+{
+ struct mantis_hwconfig *config = mantis->hwconfig;
+ u32 stat, i;
+ unsigned long flags;
+
+ /* get data */
+ for (i = 0; i < (config->bytes + 1); i++) {
+
+ if (stat & MANTIS_UART_RXFIFO_FULL) {
+ dprintk(verbose, MANTIS_ERROR, 1, "RX Fifo FULL");
+ }
+ data[i] = mmread(MANTIS_UART_RXD) & 0x3f;
+
+ stat = mmread(MANTIS_UART_STAT);
+
+ dprintk(verbose, MANTIS_DEBUG, 1, "Reading ... <%02x>", data[i] & 0x3f);
+
+ if (data[i] & (1 << 7)) {
+ dprintk(verbose, MANTIS_ERROR, 1, "UART framing error");
+ return -EINVAL;
+ }
+ if (data[i] & (1 << 6)) {
+ dprintk(verbose, MANTIS_ERROR, 1, "UART parity error");
+ return -EINVAL;
+ }
+ }
+
+ return 0;
+}
+
+static void mantis_uart_work(struct work_struct *work)
+{
+ struct mantis_pci *mantis = container_of(work, struct mantis_pci, uart_work);
+ struct mantis_hwconfig *config = mantis->hwconfig;
+ u8 buf[16];
+ int i;
+
+ dprintk(verbose, MANTIS_DEBUG, 1, "UART read");
+ mantis_uart_read(mantis, buf);
+
+ dprintk(verbose, MANTIS_DEBUG, 1, "UART: ");
+ for (i = 0; i < (config->bytes + 1); i++)
+ dprintk(verbose, MANTIS_DEBUG, 0, "<%02x> ", buf[i]);
+
+ dprintk(verbose, MANTIS_DEBUG, 0, "\n");
+}
+
+static int mantis_uart_setup(struct mantis_pci *mantis,
+ struct mantis_uart_params *params)
+{
+ char* rates[] = { "B_9600", "B_19200", "B_38400", "B_57600", "B_115200" };
+ char* parity[] = { "NONE", "ODD", "EVEN" };
+
+ u32 reg;
+
+ dprintk(verbose, MANTIS_DEBUG, 1, "Set Parity <%s> Baud Rate <%s>",
+ parity[params->parity],
+ rates[params->baud_rate]);
+
+ mmwrite((mmread(MANTIS_UART_CTL) | (params->parity & 0x3)), MANTIS_UART_CTL);
+
+ reg = mmread(MANTIS_UART_BAUD);
+
+ switch (params->baud_rate) {
+ case MANTIS_BAUD_9600:
+ reg |= 0xd8;
+ break;
+ case MANTIS_BAUD_19200:
+ reg |= 0x6c;
+ break;
+ case MANTIS_BAUD_38400:
+ reg |= 0x36;
+ break;
+ case MANTIS_BAUD_57600:
+ reg |= 0x23;
+ break;
+ case MANTIS_BAUD_115200:
+ reg |= 0x11;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ mmwrite(reg, MANTIS_UART_BAUD);
+
+ return 0;
+}
+
+int mantis_uart_init(struct mantis_pci *mantis)
+{
+ struct mantis_hwconfig *config = mantis->hwconfig;
+ struct mantis_uart_params params;
+
+ dprintk(verbose, MANTIS_DEBUG, 1, "Initializing UART ..");
+ /* default parity: */
+ params.baud_rate = config->baud_rate;
+ params.parity = config->parity;
+
+ init_waitqueue_head(&mantis->uart_wq);
+ spin_lock_init(&mantis->uart_lock);
+
+ INIT_WORK(&mantis->uart_work, mantis_uart_work);
+
+ /* disable interrupt */
+ mmwrite(mmread(MANTIS_UART_CTL) & 0xffef, MANTIS_UART_CTL);
+
+ mantis_uart_setup(mantis, &params);
+
+ /* default 1 byte */
+ mmwrite((mmread(MANTIS_UART_BAUD) | (config->bytes << 8)), MANTIS_UART_BAUD);
+
+ /* flush buffer */
+ mmwrite((mmread(MANTIS_UART_CTL) | MANTIS_UART_RXFLUSH), MANTIS_UART_CTL);
+
+ /* enable interrupt */
+ mmwrite(mmread(MANTIS_INT_MASK) | 0x800, MANTIS_INT_MASK);
+ mmwrite(mmread(MANTIS_UART_CTL) | MANTIS_UART_RXINT, MANTIS_UART_CTL);
+
+ schedule_work(&mantis->uart_work);
+
+ return 0;
+}
+
+void mantis_uart_exit(struct mantis_pci *mantis)
+{
+ /* disable interrupt */
+ mmwrite(mmread(MANTIS_UART_CTL) & 0xffef, MANTIS_UART_CTL);
+}
diff --git a/drivers/media/dvb/mantis/mantis_uart.h b/drivers/media/dvb/mantis/mantis_uart.h
index 6113863..e9f938d 100644
--- a/drivers/media/dvb/mantis/mantis_uart.h
+++ b/drivers/media/dvb/mantis/mantis_uart.h
@@ -21,6 +21,21 @@
#ifndef __MANTIS_UART_H
#define __MANTIS_UART_H
+#define MANTIS_UART_CTL 0xe0
+#define MANTIS_UART_RXINT (1 << 4)
+#define MANTIS_UART_RXFLUSH (1 << 2)
+
+#define MANTIS_UART_RXD 0xe8
+#define MANTIS_UART_BAUD 0xec
+
+#define MANTIS_UART_STAT 0xf0
+#define MANTIS_UART_RXFIFO_DATA (1 << 7)
+#define MANTIS_UART_RXFIFO_EMPTY (1 << 6)
+#define MANTIS_UART_RXFIFO_FULL (1 << 3)
+#define MANTIS_UART_FRAME_ERR (1 << 2)
+#define MANTIS_UART_PARITY_ERR (1 << 1)
+#define MANTIS_UART_RXTHRESH_INT (1 << 0)
+
enum mantis_baud {
MANTIS_BAUD_9600 = 0,
MANTIS_BAUD_19200,
@@ -30,9 +45,15 @@ enum mantis_baud {
};
enum mantis_parity {
- MANTIS_PARITY_NONE = 0,
+ MANTIS_PARITY_UNDEFINED = 0,
MANTIS_PARITY_EVEN,
- MANTIS_PARITY_ODD
+ MANTIS_PARITY_ODD,
+ MANTIS_PARITY_NONE
};
+struct mantis_pci;
+
+extern int mantis_uart_init(struct mantis_pci *mantis);
+extern void mantis_uart_exit(struct mantis_pci *mantis);
+
#endif // __MANTIS_UART_H
diff --git a/drivers/media/dvb/mantis/mantis_vp1033.c b/drivers/media/dvb/mantis/mantis_vp1033.c
index 797c4e0..64cdfb8 100644
--- a/drivers/media/dvb/mantis/mantis_vp1033.c
+++ b/drivers/media/dvb/mantis/mantis_vp1033.c
@@ -88,6 +88,9 @@ struct mantis_hwconfig vp1033_mantis_config = {
.model_name = MANTIS_MODEL_NAME,
.dev_type = MANTIS_DEV_TYPE,
.ts_size = MANTIS_TS_204,
+ .baud_rate = MANTIS_BAUD_9600,
+ .parity = MANTIS_PARITY_NONE,
+ .bytes = 0,
};
int lgtdqcs001f_tuner_set(struct dvb_frontend *fe,
diff --git a/drivers/media/dvb/mantis/mantis_vp1034.c b/drivers/media/dvb/mantis/mantis_vp1034.c
index a2fe9d4..28f3420 100644
--- a/drivers/media/dvb/mantis/mantis_vp1034.c
+++ b/drivers/media/dvb/mantis/mantis_vp1034.c
@@ -33,6 +33,9 @@ struct mantis_hwconfig vp1034_mantis_config = {
.model_name = MANTIS_MODEL_NAME,
.dev_type = MANTIS_DEV_TYPE,
.ts_size = MANTIS_TS_204,
+ .baud_rate = MANTIS_BAUD_9600,
+ .parity = MANTIS_PARITY_NONE,
+ .bytes = 0,
};
int vp1034_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
diff --git a/drivers/media/dvb/mantis/mantis_vp1041.c b/drivers/media/dvb/mantis/mantis_vp1041.c
index 8eb1afd..90df80b 100644
--- a/drivers/media/dvb/mantis/mantis_vp1041.c
+++ b/drivers/media/dvb/mantis/mantis_vp1041.c
@@ -31,6 +31,9 @@ struct mantis_hwconfig vp1041_mantis_config = {
.model_name = MANTIS_MODEL_NAME,
.dev_type = MANTIS_DEV_TYPE,
.ts_size = MANTIS_TS_188,
+ .baud_rate = MANTIS_BAUD_9600,
+ .parity = MANTIS_PARITY_NONE,
+ .bytes = 0,
};
static const struct stb0899_s1_reg vp1041_stb0899_s1_init_1[] = {
diff --git a/drivers/media/dvb/mantis/mantis_vp2033.c b/drivers/media/dvb/mantis/mantis_vp2033.c
index 4664d29..1171e69 100644
--- a/drivers/media/dvb/mantis/mantis_vp2033.c
+++ b/drivers/media/dvb/mantis/mantis_vp2033.c
@@ -28,6 +28,9 @@ struct mantis_hwconfig vp2033_mantis_config = {
.model_name = MANTIS_MODEL_NAME,
.dev_type = MANTIS_DEV_TYPE,
.ts_size = MANTIS_TS_204,
+ .baud_rate = MANTIS_BAUD_9600,
+ .parity = MANTIS_PARITY_NONE,
+ .bytes = 0,
};
struct tda1002x_config philips_cu1216_config = {
diff --git a/drivers/media/dvb/mantis/mantis_vp2040.c b/drivers/media/dvb/mantis/mantis_vp2040.c
index f77be7b..ce73d6b 100644
--- a/drivers/media/dvb/mantis/mantis_vp2040.c
+++ b/drivers/media/dvb/mantis/mantis_vp2040.c
@@ -28,6 +28,9 @@ struct mantis_hwconfig vp2040_mantis_config = {
.model_name = MANTIS_MODEL_NAME,
.dev_type = MANTIS_DEV_TYPE,
.ts_size = MANTIS_TS_204,
+ .baud_rate = MANTIS_BAUD_9600,
+ .parity = MANTIS_PARITY_NONE,
+ .bytes = 0,
};
struct tda10023_config tda10023_cu1216_config = {
diff --git a/drivers/media/dvb/mantis/mantis_vp3028.c b/drivers/media/dvb/mantis/mantis_vp3028.c
new file mode 100644
index 0000000..7f8918c
--- /dev/null
+++ b/drivers/media/dvb/mantis/mantis_vp3028.c
@@ -0,0 +1,38 @@
+/*
+ Mantis VP-3028 driver
+
+ Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@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.
+
+ 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 "mantis_common.h"
+#include "mantis_vp3028.h"
+
+struct zl10353_config mantis_vp3028_config = {
+ .demod_address = 0x0f,
+};
+
+#define MANTIS_MODEL_NAME "VP-3028"
+#define MANTIS_DEV_TYPE "DVB-T"
+
+struct mantis_hwconfig vp3028_mantis_config = {
+ .model_name = MANTIS_MODEL_NAME,
+ .dev_type = MANTIS_DEV_TYPE,
+ .ts_size = MANTIS_TS_188,
+ .baud_rate = MANTIS_BAUD_9600,
+ .parity = MANTIS_PARITY_NONE,
+ .bytes = 0,
+};
diff --git a/drivers/media/dvb/mantis/mantis_vp3028.h b/drivers/media/dvb/mantis/mantis_vp3028.h
new file mode 100644
index 0000000..c51628d
--- /dev/null
+++ b/drivers/media/dvb/mantis/mantis_vp3028.h
@@ -0,0 +1,13 @@
+#ifndef __MANTIS_VP3028_H
+#define __MANTIS_VP3028_H
+
+#include "dvb_frontend.h"
+#include "mantis_common.h"
+#include "zl10353.h"
+
+#define MANTIS_VP_3028_DVB_T 0x0028
+
+extern struct zl10353_config mantis_vp3028_config;
+extern struct mantis_hwconfig vp3028_mantis_config;
+
+#endif /* __MANTIS_VP3028_H */
diff --git a/drivers/media/dvb/mantis/mantis_vp3030.c b/drivers/media/dvb/mantis/mantis_vp3030.c
index cab092c..9ca8040 100644
--- a/drivers/media/dvb/mantis/mantis_vp3030.c
+++ b/drivers/media/dvb/mantis/mantis_vp3030.c
@@ -32,6 +32,9 @@ struct mantis_hwconfig vp3030_mantis_config = {
.model_name = MANTIS_MODEL_NAME,
.dev_type = MANTIS_DEV_TYPE,
.ts_size = MANTIS_TS_188,
+ .baud_rate = MANTIS_BAUD_9600,
+ .parity = MANTIS_PARITY_NONE,
+ .bytes = 0,
};
int panasonic_en57h12d5_set_params(struct dvb_frontend *fe,
--
1.7.1

View File

@ -0,0 +1,58 @@
From b25634d125f19cc7836dd9a7ec202feb7ea54c37 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:41:52 -0300
Subject: [PATCH 096/120] V4L/DVB (13796): [Mantis] Add missing file in previous commit
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit ad0ac434cb3b34640a4e81d7e80a1512c6e40253)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/mantis_ioc.h | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
create mode 100644 drivers/media/dvb/mantis/mantis_ioc.h
diff --git a/drivers/media/dvb/mantis/mantis_ioc.h b/drivers/media/dvb/mantis/mantis_ioc.h
new file mode 100644
index 0000000..2052640
--- /dev/null
+++ b/drivers/media/dvb/mantis/mantis_ioc.h
@@ -0,0 +1,31 @@
+#ifndef __MANTIS_IOC_H
+#define __MANTIS_IOC_H
+
+#define GPIF_A00 0x00
+#define GPIF_A01 0x01
+#define GPIF_A02 0x02
+#define GPIF_A03 0x03
+#define GPIF_A04 0x04
+#define GPIF_A05 0x05
+#define GPIF_A06 0x06
+#define GPIF_A07 0x07
+#define GPIF_A08 0x08
+#define GPIF_A09 0x09
+#define GPIF_A10 0x0a
+#define GPIF_A11 0x0b
+
+#define GPIF_A12 0x0c
+#define GPIF_A13 0x0d
+#define GPIF_A14 0x0e
+
+enum mantis_stream_control {
+ STREAM_TO_HIF = 0,
+ STREAM_TO_CAM
+};
+
+extern int mantis_get_mac(struct mantis_pci *mantis);
+extern void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value);
+
+extern int mantis_stream_control(struct mantis_pci *mantis, enum mantis_stream_control stream_ctl);
+
+#endif /* __MANTIS_IOC_H */
--
1.7.1

View File

@ -0,0 +1,902 @@
From 5cda8f1fd8c3f76a70ce98448e17fa738e15a63c Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:56:35 -0300
Subject: [PATCH 097/120] V4L/DVB (13797): [Mantis/Hopper/TDA665x] Large overhaul,
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Initial go at VP-3028, VP-3030 devices.
* I2C communication improvements,
* Add TDA665x support
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked with minor conflict from commit 3e978a8284080d801d20cda377d9cf7c12fe68b9)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/frontends/Kconfig | 11 ++
drivers/media/dvb/frontends/Makefile | 1 +
drivers/media/dvb/frontends/tda665x.c | 257 ++++++++++++++++++++++++++++++
drivers/media/dvb/frontends/tda665x.h | 52 ++++++
drivers/media/dvb/mantis/hopper_cards.c | 1 -
drivers/media/dvb/mantis/mantis_cards.c | 11 +-
drivers/media/dvb/mantis/mantis_dma.c | 3 +-
drivers/media/dvb/mantis/mantis_dvb.c | 22 ++-
drivers/media/dvb/mantis/mantis_i2c.c | 141 +++++++++++------
drivers/media/dvb/mantis/mantis_i2c.h | 3 +
drivers/media/dvb/mantis/mantis_ioc.c | 42 ++----
drivers/media/dvb/mantis/mantis_vp3030.c | 52 +++---
12 files changed, 479 insertions(+), 117 deletions(-)
create mode 100644 drivers/media/dvb/frontends/tda665x.c
create mode 100644 drivers/media/dvb/frontends/tda665x.h
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
index d7c4837..5a1d66c 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -557,6 +557,17 @@ config DVB_LGS8GXX
help
A DMB-TH tuner module. Say Y when you want to support this frontend.
+config DVB_TDA665x
+ tristate "TDA665x tuner"
+ depends on DVB_CORE && I2C
+ default m if DVB_FE_CUSTOMISE
+ help
+ Support for tuner modules based on Philips TDA6650/TDA6651 chips.
+ Say Y when you want to support this chip.
+
+ Currently supported tuners:
+ * Panasonic ENV57H12D5 (ET-50DT)
+
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 3523767..af944a8 100644
--- a/drivers/media/dvb/frontends/Makefile
+++ b/drivers/media/dvb/frontends/Makefile
@@ -63,6 +63,7 @@ obj-$(CONFIG_DVB_TDA10048) += tda10048.o
obj-$(CONFIG_DVB_TUNER_CX24113) += cx24113.o
obj-$(CONFIG_DVB_S5H1411) += s5h1411.o
obj-$(CONFIG_DVB_LGS8GL5) += lgs8gl5.o
+obj-$(CONFIG_DVB_TDA665x) += tda665x.o
obj-$(CONFIG_DVB_LGS8GXX) += lgs8gxx.o
obj-$(CONFIG_DVB_DUMMY_FE) += dvb_dummy_fe.o
obj-$(CONFIG_DVB_AF9013) += af9013.o
diff --git a/drivers/media/dvb/frontends/tda665x.c b/drivers/media/dvb/frontends/tda665x.c
new file mode 100644
index 0000000..0732a2d
--- /dev/null
+++ b/drivers/media/dvb/frontends/tda665x.c
@@ -0,0 +1,257 @@
+/*
+ TDA665x tuner driver
+ Copyright (C) Manu Abraham (abraham.manu@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.
+
+ 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/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+
+#include "dvb_frontend.h"
+#include "tda665x.h"
+
+struct tda665x_state {
+ struct dvb_frontend *fe;
+ struct i2c_adapter *i2c;
+ const struct tda665x_config *config;
+
+ u32 frequency;
+ u32 bandwidth;
+};
+
+static int tda665x_read(struct tda665x_state *state, u8 *buf)
+{
+ const struct tda665x_config *config = state->config;
+ int err = 0;
+ struct i2c_msg msg = { .addr = config->addr, .flags = I2C_M_RD, .buf = buf, .len = 2 };
+
+ err = i2c_transfer(state->i2c, &msg, 1);
+ if (err != 1)
+ goto exit;
+
+ return err;
+exit:
+ printk("%s: I/O Error err=<%d>\n", __func__, err);
+ return err;
+}
+
+static int tda665x_write(struct tda665x_state *state, u8 *buf, u8 length)
+{
+ const struct tda665x_config *config = state->config;
+ int err = 0;
+ struct i2c_msg msg = { .addr = config->addr, .flags = 0, .buf = buf, .len = length };
+
+ err = i2c_transfer(state->i2c, &msg, 1);
+ if (err != 1)
+ goto exit;
+
+ return err;
+exit:
+ printk("%s: I/O Error err=<%d>\n", __func__, err);
+ return err;
+}
+
+static int tda665x_get_state(struct dvb_frontend *fe,
+ enum tuner_param param,
+ struct tuner_state *tstate)
+{
+ struct tda665x_state *state = fe->tuner_priv;
+ int err = 0;
+
+ switch (param) {
+ case DVBFE_TUNER_FREQUENCY:
+ tstate->frequency = state->frequency;
+ break;
+ case DVBFE_TUNER_BANDWIDTH:
+ break;
+ default:
+ printk("%s: Unknown parameter (param=%d)\n", __func__, param);
+ err = -EINVAL;
+ break;
+ }
+
+ return err;
+}
+
+static int tda665x_get_status(struct dvb_frontend *fe, u32 *status)
+{
+ struct tda665x_state *state = fe->tuner_priv;
+ u8 result = 0;
+ int err = 0;
+
+ *status = 0;
+
+ err = tda665x_read(state, &result);
+ if (err < 0)
+ goto exit;
+
+ if ((result >> 6) & 0x01) {
+ printk("%s: Tuner Phase Locked\n", __func__);
+ *status = 1;
+ }
+
+ return err;
+exit:
+ printk("%s: I/O Error\n", __func__);
+ return err;
+}
+
+static int tda665x_set_state(struct dvb_frontend *fe,
+ enum tuner_param param,
+ struct tuner_state *tstate)
+{
+ struct tda665x_state *state = fe->tuner_priv;
+ const struct tda665x_config *config = state->config;
+ u32 frequency, status = 0;
+ u8 buf[4];
+ int err = 0;
+
+ if (param & DVBFE_TUNER_FREQUENCY) {
+
+ frequency = tstate->frequency;
+ if ((frequency < config->frequency_max) || (frequency > config->frequency_min)) {
+ printk("%s: Frequency beyond limits, frequency=%d\n", __func__, frequency);
+ return -EINVAL;
+ }
+
+ frequency += config->frequency_offst;
+ frequency *= config->ref_multiplier;
+ frequency += config->ref_divider >> 1;
+ frequency /= config->ref_divider;
+
+ buf[0] = (u8 ) (frequency & 0x7f00) >> 8;
+ buf[1] = (u8 ) (frequency & 0x00ff) >> 0;
+ buf[2] = 0x80 | 0x40 | 0x02;
+ buf[3] = 0x00;
+
+ /* restore frequency */
+ frequency = tstate->frequency;
+
+ if (frequency < 153000000) {
+ /* VHF-L */
+ buf[3] |= 0x01; /* fc, Low Band, 47 - 153 MHz */
+ if (frequency < 68000000)
+ buf[3] |= 0x40; /* 83uA */
+ if (frequency < 1040000000)
+ buf[3] |= 0x60; /* 122uA */
+ if (frequency < 1250000000)
+ buf[3] |= 0x80; /* 163uA */
+ else
+ buf[3] |= 0xa0; /* 254uA */
+ } else if (frequency < 438000000) {
+ /* VHF-H */
+ buf[3] |= 0x02; /* fc, Mid Band, 153 - 438 MHz */
+ if (frequency < 230000000)
+ buf[3] |= 0x40;
+ if (frequency < 300000000)
+ buf[3] |= 0x60;
+ else
+ buf[3] |= 0x80;
+ } else {
+ /* UHF */
+ buf[3] |= 0x04; /* fc, High Band, 438 - 862 MHz */
+ if (frequency < 470000000)
+ buf[3] |= 0x60;
+ if (frequency < 526000000)
+ buf[3] |= 0x80;
+ else
+ buf[3] |= 0xa0;
+ }
+
+ /* Set params */
+ err = tda665x_write(state, buf, 5);
+ if (err < 0)
+ goto exit;
+
+ /* sleep for some time */
+ printk("%s: Waiting to Phase LOCK\n", __func__);
+ msleep(20);
+ /* check status */
+ err = tda665x_get_status(fe, &status);
+ if (err < 0)
+ goto exit;
+
+ if (status == 1) {
+ printk("%s: Tuner Phase locked: status=%d\n", __func__, status);
+ state->frequency = frequency; /* cache successful state */
+ } else {
+ printk("%s: No Phase lock: status=%d\n", __func__, status);
+ }
+ } else {
+ printk("%s: Unknown parameter (param=%d)\n", __func__, param);
+ return -EINVAL;
+ }
+
+ return 0;
+exit:
+ printk("%s: I/O Error\n", __func__);
+ return err;
+}
+
+static int tda665x_release(struct dvb_frontend *fe)
+{
+ struct tda665x_state *state = fe->tuner_priv;
+
+ fe->tuner_priv = NULL;
+ kfree(state);
+ return 0;
+}
+
+static struct dvb_tuner_ops tda665x_ops = {
+
+ .set_state = tda665x_set_state,
+ .get_state = tda665x_get_state,
+ .get_status = tda665x_get_status,
+ .release = tda665x_release
+};
+
+struct dvb_frontend *tda665x_attach(struct dvb_frontend *fe,
+ const struct tda665x_config *config,
+ struct i2c_adapter *i2c)
+{
+ struct tda665x_state *state = NULL;
+ struct dvb_tuner_info *info;
+
+ state = kzalloc(sizeof (struct tda665x_state), GFP_KERNEL);
+ if (state == NULL)
+ goto exit;
+
+ state->config = config;
+ state->i2c = i2c;
+ state->fe = fe;
+ fe->tuner_priv = state;
+ fe->ops.tuner_ops = tda665x_ops;
+ info = &fe->ops.tuner_ops.info;
+
+ memcpy(info->name, config->name, sizeof (config->name));
+ info->frequency_min = config->frequency_min;
+ info->frequency_max = config->frequency_max;
+ info->frequency_step = config->frequency_offst;
+
+ printk("%s: Attaching TDA665x (%s) tuner\n", __func__, info->name);
+
+ return fe;
+
+exit:
+ kfree(state);
+ return NULL;
+}
+EXPORT_SYMBOL(tda665x_attach);
+
+MODULE_DESCRIPTION("TDA665x driver");
+MODULE_AUTHOR("Manu Abraham");
+MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/frontends/tda665x.h b/drivers/media/dvb/frontends/tda665x.h
new file mode 100644
index 0000000..c0b544d
--- /dev/null
+++ b/drivers/media/dvb/frontends/tda665x.h
@@ -0,0 +1,52 @@
+/*
+ TDA665x tuner driver
+ Copyright (C) Manu Abraham (abraham.manu@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.
+
+ 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 __TDA665x_H
+#define __TDA665x_H
+
+struct tda665x_config {
+ char name[128];
+
+ u8 addr;
+ u32 frequency_min;
+ u32 frequency_max;
+ u32 frequency_offst;
+ u32 ref_multiplier;
+ u32 ref_divider;
+};
+
+#if defined(CONFIG_DVB_TDA665x) || (defined(CONFIG_DVB_TDA665x_MODULE) && defined(MODULE))
+
+extern struct dvb_frontend *tda665x_attach(struct dvb_frontend *fe,
+ const struct tda665x_config *config,
+ struct i2c_adapter *i2c);
+
+#else
+
+static inline struct dvb_frontend *tda665x_attach(struct dvb_frontend *fe,
+ const struct tda665x_config *config,
+ struct i2c_adapter *i2c)
+{
+ printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__);
+ return NULL;
+}
+
+#endif /* CONFIG_DVB_TDA665x */
+
+#endif /* __TDA665x_H */
diff --git a/drivers/media/dvb/mantis/hopper_cards.c b/drivers/media/dvb/mantis/hopper_cards.c
index 749e3f3..01a9ff0 100644
--- a/drivers/media/dvb/mantis/hopper_cards.c
+++ b/drivers/media/dvb/mantis/hopper_cards.c
@@ -219,7 +219,6 @@ static void __devexit hopper_pci_remove(struct pci_dev *pdev)
struct mantis_pci *mantis = pci_get_drvdata(pdev);
if (mantis) {
-// mantis_uart_exit(mantis);
mantis_dvb_exit(mantis);
mantis_dma_exit(mantis);
mantis_i2c_exit(mantis);
diff --git a/drivers/media/dvb/mantis/mantis_cards.c b/drivers/media/dvb/mantis/mantis_cards.c
index d486c7f..638177c 100644
--- a/drivers/media/dvb/mantis/mantis_cards.c
+++ b/drivers/media/dvb/mantis/mantis_cards.c
@@ -50,7 +50,6 @@ static char *label[10] = {
"RACK"
};
-
static irqreturn_t mantis_irq_handler(int irq, void *dev_id)
{
u32 stat = 0, mask = 0, lstat = 0, mstat = 0;
@@ -199,6 +198,14 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev, const struct pci_dev
return err;
+fail7:
+ dprintk(MANTIS_ERROR, 1, "ERROR: Mantis UART exit! <%d>", err);
+ mantis_uart_exit(mantis);
+
+fail6:
+ dprintk(MANTIS_ERROR, 1, "ERROR: Mantis CA exit! <%d>", err);
+ mantis_ca_exit(mantis);
+
fail5:
dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DVB exit! <%d>", err);
mantis_dvb_exit(mantis);
@@ -228,8 +235,6 @@ static void __devexit mantis_pci_remove(struct pci_dev *pdev)
struct mantis_pci *mantis = pci_get_drvdata(pdev);
if (mantis) {
- mantis_uart_exit(mantis);
-// mantis_ca_exit(mantis);
mantis_dvb_exit(mantis);
mantis_dma_exit(mantis);
mantis_i2c_exit(mantis);
diff --git a/drivers/media/dvb/mantis/mantis_dma.c b/drivers/media/dvb/mantis/mantis_dma.c
index 8ebcd96..eab3645 100644
--- a/drivers/media/dvb/mantis/mantis_dma.c
+++ b/drivers/media/dvb/mantis/mantis_dma.c
@@ -153,8 +153,7 @@ int mantis_dma_init(struct mantis_pci *mantis)
if (mantis_alloc_buffers(mantis) < 0) {
dprintk(MANTIS_ERROR, 1, "Error allocating DMA buffer");
- // Stop RISC Engine
-// mmwrite(mmread(MANTIS_DMA_CTL) & ~MANTIS_RISC_EN, MANTIS_DMA_CTL);
+ /* Stop RISC Engine */
mmwrite(0, MANTIS_DMA_CTL);
goto err;
diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c
index be911d7..42f658b 100644
--- a/drivers/media/dvb/mantis/mantis_dvb.c
+++ b/drivers/media/dvb/mantis/mantis_dvb.c
@@ -252,14 +252,19 @@ int __devinit mantis_dvb_init(struct mantis_pci *mantis)
err5:
tasklet_kill(&mantis->tasklet);
dvb_net_release(&mantis->dvbnet);
+
err4:
mantis->demux.dmx.remove_frontend(&mantis->demux.dmx, &mantis->fe_mem);
+
err3:
mantis->demux.dmx.remove_frontend(&mantis->demux.dmx, &mantis->fe_hw);
+
err2:
dvb_dmxdev_release(&mantis->dmxdev);
+
err1:
dvb_dmx_release(&mantis->demux);
+
err0:
dvb_unregister_adapter(&mantis->dvb_adapter);
@@ -271,21 +276,24 @@ int __devexit mantis_dvb_exit(struct mantis_pci *mantis)
{
int err;
- err = mantis_frontend_shutdown(mantis);
- if (err != 0)
- dprintk(MANTIS_ERROR, 1, "Frontend exit while POWER ON! <%d>", err);
+ if (mantis->fe) {
+// mantis_ca_exit(mantis);
+ err = mantis_frontend_shutdown(mantis);
+ if (err != 0)
+ dprintk(MANTIS_ERROR, 1, "Frontend exit while POWER ON! <%d>", err);
+
+ dvb_unregister_frontend(mantis->fe);
+ }
-// mantis_ca_exit(mantis);
tasklet_kill(&mantis->tasklet);
dvb_net_release(&mantis->dvbnet);
+
mantis->demux.dmx.remove_frontend(&mantis->demux.dmx, &mantis->fe_mem);
mantis->demux.dmx.remove_frontend(&mantis->demux.dmx, &mantis->fe_hw);
+
dvb_dmxdev_release(&mantis->dmxdev);
dvb_dmx_release(&mantis->demux);
- if (mantis->fe)
- dvb_unregister_frontend(mantis->fe);
-
dprintk(MANTIS_DEBUG, 1, "dvb_unregister_adapter");
dvb_unregister_adapter(&mantis->dvb_adapter);
diff --git a/drivers/media/dvb/mantis/mantis_i2c.c b/drivers/media/dvb/mantis/mantis_i2c.c
index ba55f0a..16b9e7e 100644
--- a/drivers/media/dvb/mantis/mantis_i2c.c
+++ b/drivers/media/dvb/mantis/mantis_i2c.c
@@ -35,38 +35,9 @@
#define I2C_HW_B_MANTIS 0x1c
-static int mantis_ack_wait(struct mantis_pci *mantis)
-{
- int rc = 0;
- u32 timeout = 0;
-
- if (wait_event_timeout(mantis->i2c_wq,
- mantis->mantis_int_stat & MANTIS_INT_I2CDONE,
- msecs_to_jiffies(50)) == -ERESTARTSYS) {
-
- dprintk(MANTIS_DEBUG, 1, "Master !I2CDONE");
- rc = -EREMOTEIO;
- }
-
- while (!(mantis->mantis_int_stat & MANTIS_INT_I2CRACK)) {
- dprintk(MANTIS_DEBUG, 1, "Waiting for Slave RACK");
- mantis->mantis_int_stat = mmread(MANTIS_INT_STAT);
- msleep(5);
- timeout++;
- if (timeout > 500) {
- dprintk(MANTIS_ERROR, 1, "Slave RACK Fail !");
- rc = -EREMOTEIO;
- break;
- }
- }
- udelay(350);
-
- return rc;
-}
-
static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
{
- u32 rxd, i;
+ u32 rxd, i, stat, trials;
dprintk(MANTIS_INFO, 0, " %s: Address=[0x%02x] <R>[ ",
__func__, msg->addr);
@@ -82,10 +53,15 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT);
mmwrite(rxd, MANTIS_I2CDATA_CTL);
- if (mantis_ack_wait(mantis) != 0) {
- dprintk(MANTIS_DEBUG, 1, "ACK failed<R>");
- return -EREMOTEIO;
+
+ /* wait for xfer completion */
+ for (trials = 0; trials < 100; trials++) {
+ udelay(500);
+ stat = mmread(MANTIS_INT_STAT);
+ if (stat & MANTIS_INT_I2CDONE)
+ break;
}
+
rxd = mmread(MANTIS_I2CDATA_CTL);
msg->buf[i] = (u8)((rxd >> 8) & 0xFF);
dprintk(MANTIS_INFO, 0, "%02x ", msg->buf[i]);
@@ -98,7 +74,7 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg)
{
int i;
- u32 txd = 0;
+ u32 txd = 0, stat, trials;
dprintk(MANTIS_INFO, 0, " %s: Address=[0x%02x] <W>[ ",
__func__, msg->addr);
@@ -115,9 +91,13 @@ static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg
mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT);
mmwrite(txd, MANTIS_I2CDATA_CTL);
- if (mantis_ack_wait(mantis) != 0) {
- dprintk(MANTIS_DEBUG, 1, "ACK failed<W>");
- return -EREMOTEIO;
+
+ /* wait for xfer completion */
+ for (trials = 0; trials < 100; trials++) {
+ udelay(500);
+ stat = mmread(MANTIS_INT_STAT);
+ if (stat & MANTIS_INT_I2CDONE)
+ break;
}
}
dprintk(MANTIS_INFO, 0, "]\n");
@@ -127,20 +107,77 @@ static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg
static int mantis_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
{
- int ret = 0, i;
+ int ret = 0, i = 0, trials;
+ u32 stat, data, txd;
struct mantis_pci *mantis;
+ struct mantis_hwconfig *config;
mantis = i2c_get_adapdata(adapter);
+ BUG_ON(!mantis);
+ config = mantis->hwconfig;
+ BUG_ON(!config);
+
+ dprintk(MANTIS_DEBUG, 1, "Messages:%d", num);
mutex_lock(&mantis->i2c_lock);
- for (i = 0; i < num; i++) {
- if (msgs[i].flags & I2C_M_RD)
- ret = mantis_i2c_read(mantis, &msgs[i]);
- else
- ret = mantis_i2c_write(mantis, &msgs[i]);
-
- if (ret < 0)
- goto bail_out;
+
+ while (i < num) {
+ /* Byte MODE */
+ if (((i + 1) < num) &&
+ (msgs[i].len < 2) &&
+ (msgs[i + 1].len < 2) &&
+ (msgs[i + 1].flags & I2C_M_RD)) {
+
+ dprintk(MANTIS_DEBUG, 0, " Byte MODE:\n");
+
+ /* Read operation */
+ txd = msgs[i].addr << 25 | (0x1 << 24)
+ | (msgs[i].buf[0] << 16)
+ | MANTIS_I2C_RATE_3;
+
+ mmwrite(txd, MANTIS_I2CDATA_CTL);
+ /* wait for xfer completion */
+ for (trials = 0; trials < 100; trials++) {
+ udelay(500);
+ stat = mmread(MANTIS_INT_STAT);
+ if (stat & MANTIS_INT_I2CDONE)
+ break;
+ }
+
+ /* check for xfer completion */
+ if (stat & MANTIS_INT_I2CDONE) {
+ /* check xfer was acknowledged */
+ if (stat & MANTIS_INT_I2CRACK) {
+ data = mmread(MANTIS_I2CDATA_CTL);
+ msgs[i + 1].buf[0] = (data >> 8) & 0xff;
+ dprintk(MANTIS_DEBUG, 0, " Byte <%d> RXD=0x%02x [%02x]\n", 0x0, data, msgs[i + 1].buf[0]);
+ } else {
+ /* I/O error */
+ dprintk(MANTIS_ERROR, 1, " I/O error, LINE:%d", __LINE__);
+ ret = -EIO;
+ break;
+ }
+ } else {
+ /* I/O error */
+ dprintk(MANTIS_ERROR, 1, " I/O error, LINE:%d", __LINE__);
+ ret = -EIO;
+ break;
+ }
+ i += 2; /* Write/Read operation in one go */
+ }
+
+ if (i < num) {
+ if (msgs[i].flags & I2C_M_RD)
+ ret = mantis_i2c_read(mantis, &msgs[i]);
+ else
+ ret = mantis_i2c_write(mantis, &msgs[i]);
+
+ i++;
+ if (ret < 0)
+ goto bail_out;
+ }
+
}
+
mutex_unlock(&mantis->i2c_lock);
return num;
@@ -189,9 +226,9 @@ int __devinit mantis_i2c_init(struct mantis_pci *mantis)
intstat = mmread(MANTIS_INT_STAT);
intmask = mmread(MANTIS_INT_MASK);
mmwrite(intstat, MANTIS_INT_STAT);
- mmwrite(intmask | MANTIS_INT_I2CDONE, MANTIS_INT_MASK);
-
- dprintk(MANTIS_DEBUG, 1, "Status=<%02x> Mask=<%02x>", intstat, intmask);
+ dprintk(MANTIS_DEBUG, 1, "Disabling I2C interrupt");
+ intmask = mmread(MANTIS_INT_MASK);
+ mmwrite((intmask & ~MANTIS_INT_I2CDONE), MANTIS_INT_MASK);
return 0;
}
@@ -199,6 +236,12 @@ EXPORT_SYMBOL_GPL(mantis_i2c_init);
int __devexit mantis_i2c_exit(struct mantis_pci *mantis)
{
+ u32 intmask;
+
+ dprintk(MANTIS_DEBUG, 1, "Disabling I2C interrupt");
+ intmask = mmread(MANTIS_INT_MASK);
+ mmwrite((intmask & ~MANTIS_INT_I2CDONE), MANTIS_INT_MASK);
+
dprintk(MANTIS_DEBUG, 1, "Removing I2C adapter");
return i2c_del_adapter(&mantis->adapter);
}
diff --git a/drivers/media/dvb/mantis/mantis_i2c.h b/drivers/media/dvb/mantis/mantis_i2c.h
index 1e49ecf..d40da4f 100644
--- a/drivers/media/dvb/mantis/mantis_i2c.h
+++ b/drivers/media/dvb/mantis/mantis_i2c.h
@@ -1,6 +1,9 @@
#ifndef __MANTIS_I2C_H
#define __MANTIS_I2C_H
+#define I2C_STOP (1 << 0)
+#define I2C_READ (1 << 1)
+
extern int mantis_i2c_init(struct mantis_pci *mantis);
extern int mantis_i2c_exit(struct mantis_pci *mantis);
diff --git a/drivers/media/dvb/mantis/mantis_ioc.c b/drivers/media/dvb/mantis/mantis_ioc.c
index 4700088..448e2c3 100644
--- a/drivers/media/dvb/mantis/mantis_ioc.c
+++ b/drivers/media/dvb/mantis/mantis_ioc.c
@@ -36,13 +36,14 @@
#include "mantis_reg.h"
#include "mantis_ioc.h"
-static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
+static int read_eeprom_bytes(struct mantis_pci *mantis, u8 reg, u8 *data, u8 length)
{
struct i2c_adapter *adapter = &mantis->adapter;
-
int err;
+ u8 buf = reg;
+
struct i2c_msg msg[] = {
- { .addr = 0x50, .flags = 0, .buf = data, .len = 1 },
+ { .addr = 0x50, .flags = 0, .buf = &buf, .len = 1 },
{ .addr = 0x50, .flags = I2C_M_RD, .buf = data, .len = length },
};
@@ -56,32 +57,12 @@ static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
return 0;
}
-
-static int write_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
-{
- struct i2c_adapter *adapter = &mantis->adapter;
- int err;
-
- struct i2c_msg msg = { .addr = 0x50, .flags = 0, .buf = data, .len = length };
-
- err = i2c_transfer(adapter, &msg, 1);
- if (err < 0) {
- dprintk(MANTIS_ERROR, 1, "ERROR: i2c write: < err=%i length=0x%02x d0=0x%02x, d1=0x%02x >",
- err, length, data[0], data[1]);
-
- return err;
- }
-
- return 0;
-}
-
int mantis_get_mac(struct mantis_pci *mantis)
{
int err;
+ u8 mac_addr[6] = {0};
- mantis->mac_address[0] = 0x08;
-
- err = read_eeprom_byte(mantis, &mantis->mac_address[0], 6);
+ err = read_eeprom_bytes(mantis, 0x08, mac_addr, 6);
if (err < 0) {
dprintk(MANTIS_ERROR, 1, "ERROR: Mantis EEPROM read error <%d>", err);
@@ -90,9 +71,12 @@ int mantis_get_mac(struct mantis_pci *mantis)
dprintk(MANTIS_ERROR, 0,
" MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]\n",
- mantis->mac_address[0], mantis->mac_address[1],
- mantis->mac_address[2], mantis->mac_address[3],
- mantis->mac_address[4], mantis->mac_address[5]);
+ mac_addr[0],
+ mac_addr[1],
+ mac_addr[2],
+ mac_addr[3],
+ mac_addr[4],
+ mac_addr[5]);
return 0;
}
@@ -103,12 +87,14 @@ void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value)
{
u32 cur;
+ dprintk(MANTIS_DEBUG, 1, "Set Bit <%d> to <%d>", bitpos, value);
cur = mmread(MANTIS_GPIF_ADDR);
if (value)
mantis->gpio_status = cur | (1 << bitpos);
else
mantis->gpio_status = cur & (~(1 << bitpos));
+ dprintk(MANTIS_DEBUG, 1, "GPIO Value <%02x>", mantis->gpio_status);
mmwrite(mantis->gpio_status, MANTIS_GPIF_ADDR);
mmwrite(0x00, MANTIS_GPIF_DOUT);
}
diff --git a/drivers/media/dvb/mantis/mantis_vp3030.c b/drivers/media/dvb/mantis/mantis_vp3030.c
index 4b974ee..9efcfa7 100644
--- a/drivers/media/dvb/mantis/mantis_vp3030.c
+++ b/drivers/media/dvb/mantis/mantis_vp3030.c
@@ -30,46 +30,41 @@
#include "dvb_net.h"
#include "zl10353.h"
+#include "tda665x.h"
#include "mantis_common.h"
+#include "mantis_ioc.h"
+#include "mantis_dvb.h"
#include "mantis_vp3030.h"
struct zl10353_config mantis_vp3030_config = {
- .demod_address = 0x0f,
+ .demod_address = 0x0f,
+};
+
+struct tda665x_config env57h12d5_config = {
+ .name = "ENV57H12D5 (ET-50DT)",
+ .addr = 0x60,
+ .frequency_min = 47000000,
+ .frequency_max = 862000000,
+ .frequency_offst = 3616667,
+ .ref_multiplier = 6, /* 1/6 MHz */
+ .ref_divider = 100000, /* 1/6 MHz */
};
#define MANTIS_MODEL_NAME "VP-3030"
#define MANTIS_DEV_TYPE "DVB-T"
-int panasonic_en57h12d5_set_params(struct dvb_frontend *fe,
- struct dvb_frontend_parameters *params)
-{
- u8 buf[4];
- int rc;
- struct mantis_pci *mantis = fe->dvb->priv;
-
- struct i2c_msg tuner_msg = {
- .addr = 0x60,
- .flags = 0,
- .buf = buf,
- .len = sizeof (buf)
- };
-
- if ((params->frequency < 950000) || (params->frequency > 2150000))
- return -EINVAL;
- rc = i2c_transfer(&mantis->adapter, &tuner_msg, 1);
- if (rc != 1) {
- printk("%s: I2C Transfer returned [%d]\n", __func__, rc);
- return -EIO;
- }
- msleep_interruptible(1);
- printk("%s: Send params to tuner ok!!!\n", __func__);
-
- return 0;
-}
static int vp3030_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
{
struct i2c_adapter *adapter = &mantis->adapter;
+ struct mantis_hwconfig *config = mantis->hwconfig;
+ int err = 0;
+
+ gpio_set_bits(mantis, config->reset, 0);
+ msleep(100);
+ err = mantis_frontend_power(mantis, POWER_ON);
+ msleep(100);
+ gpio_set_bits(mantis, config->reset, 1);
dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");
fe = zl10353_attach(&mantis_vp3030_config, adapter);
@@ -77,6 +72,7 @@ static int vp3030_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *
if (!fe)
return -1;
+ tda665x_attach(fe, &env57h12d5_config, adapter);
mantis->fe = fe;
dprintk(MANTIS_ERROR, 1, "Done!");
@@ -93,4 +89,6 @@ struct mantis_hwconfig vp3030_config = {
.bytes = 0,
.frontend_init = vp3030_frontend_init,
+ .power = GPIF_A12,
+ .reset = GPIF_A13,
};
--
1.7.1

View File

@ -0,0 +1,546 @@
From bed5750526eb93a1e12733dd2c4d6baba0299cc5 Mon Sep 17 00:00:00 2001
From: Manu Abraham <abraham.manu@gmail.com>
Date: Fri, 4 Dec 2009 05:57:28 -0300
Subject: [PATCH 098/120] V4L/DVB (13798): [Mantis] Enable power for all cards, use byte mode only on relevant devices
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
(cherry picked from commit bc832fa2c0310c25ed60204616ccef4f8db088f3)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
drivers/media/dvb/mantis/hopper_vp3028.c | 27 ++++++++++++----
drivers/media/dvb/mantis/mantis_common.h | 13 ++++++--
drivers/media/dvb/mantis/mantis_i2c.c | 47 +++++++++++++++++++++------
drivers/media/dvb/mantis/mantis_vp1033.c | 36 ++++++++++++++++-----
drivers/media/dvb/mantis/mantis_vp1034.c | 32 ++++++++++++++-----
drivers/media/dvb/mantis/mantis_vp2033.c | 50 ++++++++++++++++++++---------
drivers/media/dvb/mantis/mantis_vp2040.c | 51 ++++++++++++++++++++----------
drivers/media/dvb/mantis/mantis_vp3030.c | 22 ++++++++++---
8 files changed, 203 insertions(+), 75 deletions(-)
diff --git a/drivers/media/dvb/mantis/hopper_vp3028.c b/drivers/media/dvb/mantis/hopper_vp3028.c
index ba0c7e5..16b39d3 100644
--- a/drivers/media/dvb/mantis/hopper_vp3028.c
+++ b/drivers/media/dvb/mantis/hopper_vp3028.c
@@ -45,17 +45,30 @@ struct zl10353_config hopper_vp3028_config = {
static int vp3028_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe)
{
struct i2c_adapter *adapter = &mantis->adapter;
+ struct mantis_hwconfig *config = mantis->hwconfig;
int err = 0;
+ gpio_set_bits(mantis, config->reset, 0);
+ msleep(100);
err = mantis_frontend_power(mantis, POWER_ON);
- mantis_frontend_soft_reset(mantis);
-
- dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");
- fe = zl10353_attach(&hopper_vp3028_config, adapter);
-
- if (!fe)
- return -1;
+ msleep(100);
+ gpio_set_bits(mantis, config->reset, 1);
+ err = mantis_frontend_power(mantis, POWER_ON);
+ if (err == 0) {
+ msleep(250);
+ dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");
+ fe = zl10353_attach(&hopper_vp3028_config, adapter);
+
+ if (!fe)
+ return -1;
+ } else {
+ dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+ adapter->name,
+ err);
+
+ return -EIO;
+ }
dprintk(MANTIS_ERROR, 1, "Done!");
return 0;
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h
index e912c59..6ae3aab 100644
--- a/drivers/media/dvb/mantis/mantis_common.h
+++ b/drivers/media/dvb/mantis/mantis_common.h
@@ -32,6 +32,7 @@
#define MANTIS_NOTICE 1
#define MANTIS_INFO 2
#define MANTIS_DEBUG 3
+#define MANTIS_TMG 9
#define dprintk(y, z, format, arg...) do { \
if (z) { \
@@ -43,6 +44,8 @@
printk(KERN_INFO "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
else if ((mantis->verbose > MANTIS_DEBUG) && (mantis->verbose > y)) \
printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
+ else if ((mantis->verbose > MANTIS_TMG) && (mantis->verbose > y)) \
+ printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \
} else { \
if (mantis->verbose > y) \
printk(format , ##arg); \
@@ -54,9 +57,6 @@
#define mmwrite(dat, addr) mwrite((dat), (mantis->mmio + (addr)))
#define mmread(addr) mread(mantis->mmio + (addr))
-#define mmand(dat, addr) mmwrite((dat) & mmread(addr), addr)
-#define mmor(dat, addr) mmwrite((dat) | mmread(addr), addr)
-#define mmaor(dat, addr) mmwrite((dat) | ((mask) & mmread(addr)), addr)
#define MANTIS_TS_188 0
#define MANTIS_TS_204 1
@@ -75,6 +75,11 @@
.driver_data = (unsigned long) (__configptr) \
}
+enum mantis_i2c_mode {
+ MANTIS_PAGE_MODE = 0,
+ MANTIS_BYTE_MODE,
+};
+
struct mantis_pci;
struct mantis_hwconfig {
@@ -91,6 +96,8 @@ struct mantis_hwconfig {
u8 power;
u8 reset;
+
+ enum mantis_i2c_mode i2c_mode;
};
struct mantis_pci {
diff --git a/drivers/media/dvb/mantis/mantis_i2c.c b/drivers/media/dvb/mantis/mantis_i2c.c
index 16b9e7e..758f32a 100644
--- a/drivers/media/dvb/mantis/mantis_i2c.c
+++ b/drivers/media/dvb/mantis/mantis_i2c.c
@@ -35,6 +35,8 @@
#define I2C_HW_B_MANTIS 0x1c
+#define TRIALS 10000
+
static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
{
u32 rxd, i, stat, trials;
@@ -55,13 +57,25 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
mmwrite(rxd, MANTIS_I2CDATA_CTL);
/* wait for xfer completion */
- for (trials = 0; trials < 100; trials++) {
- udelay(500);
+ for (trials = 0; trials < TRIALS; trials++) {
+ msleep(1);
stat = mmread(MANTIS_INT_STAT);
if (stat & MANTIS_INT_I2CDONE)
break;
}
+ dprintk(MANTIS_TMG, 0, "I2CDONE: trials=%d\n", trials);
+
+ /* wait for xfer completion */
+ for (trials = 0; trials < TRIALS; trials++) {
+ stat = mmread(MANTIS_INT_STAT);
+ if (stat & MANTIS_INT_I2CRACK)
+ break;
+ msleep(1);
+ }
+
+ dprintk(MANTIS_TMG, 0, "I2CRACK: trials=%d\n", trials);
+
rxd = mmread(MANTIS_I2CDATA_CTL);
msg->buf[i] = (u8)((rxd >> 8) & 0xFF);
dprintk(MANTIS_INFO, 0, "%02x ", msg->buf[i]);
@@ -93,12 +107,24 @@ static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg
mmwrite(txd, MANTIS_I2CDATA_CTL);
/* wait for xfer completion */
- for (trials = 0; trials < 100; trials++) {
- udelay(500);
+ for (trials = 0; trials < TRIALS; trials++) {
+ msleep(1);
stat = mmread(MANTIS_INT_STAT);
if (stat & MANTIS_INT_I2CDONE)
break;
}
+
+ dprintk(MANTIS_TMG, 0, "I2CDONE: trials=%d\n", trials);
+
+ /* wait for xfer completion */
+ for (trials = 0; trials < TRIALS; trials++) {
+ stat = mmread(MANTIS_INT_STAT);
+ if (stat & MANTIS_INT_I2CRACK)
+ break;
+ msleep(1);
+ }
+
+ dprintk(MANTIS_TMG, 0, "I2CRACK: trials=%d\n", trials);
}
dprintk(MANTIS_INFO, 0, "]\n");
@@ -122,10 +148,11 @@ static int mantis_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, in
while (i < num) {
/* Byte MODE */
- if (((i + 1) < num) &&
- (msgs[i].len < 2) &&
- (msgs[i + 1].len < 2) &&
- (msgs[i + 1].flags & I2C_M_RD)) {
+ if ((config->i2c_mode & MANTIS_BYTE_MODE) &&
+ ((i + 1) < num) &&
+ (msgs[i].len < 2) &&
+ (msgs[i + 1].len < 2) &&
+ (msgs[i + 1].flags & I2C_M_RD)) {
dprintk(MANTIS_DEBUG, 0, " Byte MODE:\n");
@@ -136,8 +163,8 @@ static int mantis_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, in
mmwrite(txd, MANTIS_I2CDATA_CTL);
/* wait for xfer completion */
- for (trials = 0; trials < 100; trials++) {
- udelay(500);
+ for (trials = 0; trials < TRIALS; trials++) {
+ msleep(1);
stat = mmread(MANTIS_INT_STAT);
if (stat & MANTIS_INT_I2CDONE)
break;
diff --git a/drivers/media/dvb/mantis/mantis_vp1033.c b/drivers/media/dvb/mantis/mantis_vp1033.c
index f2092ce..0bea6e8 100644
--- a/drivers/media/dvb/mantis/mantis_vp1033.c
+++ b/drivers/media/dvb/mantis/mantis_vp1033.c
@@ -31,7 +31,10 @@
#include "stv0299.h"
#include "mantis_common.h"
+#include "mantis_ioc.h"
+#include "mantis_dvb.h"
#include "mantis_vp1033.h"
+#include "mantis_reg.h"
u8 lgtdqcs001f_inittab[] = {
0x01, 0x15,
@@ -163,19 +166,32 @@ static int vp1033_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *
{
struct i2c_adapter *adapter = &mantis->adapter;
- dprintk(MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)");
- fe = stv0299_attach(&lgtdqcs001f_config, adapter);
+ int err = 0;
- if (fe) {
- fe->ops.tuner_ops.set_params = lgtdqcs001f_tuner_set;
- dprintk(MANTIS_ERROR, 1, "found STV0299 DVB-S frontend @ 0x%02x",
- lgtdqcs001f_config.demod_address);
+ err = mantis_frontend_power(mantis, POWER_ON);
+ if (err == 0) {
+ mantis_frontend_soft_reset(mantis);
+ msleep(250);
- dprintk(MANTIS_ERROR, 1, "Mantis DVB-S STV0299 frontend attach success");
+ dprintk(MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)");
+ fe = stv0299_attach(&lgtdqcs001f_config, adapter);
+
+ if (fe) {
+ fe->ops.tuner_ops.set_params = lgtdqcs001f_tuner_set;
+ dprintk(MANTIS_ERROR, 1, "found STV0299 DVB-S frontend @ 0x%02x",
+ lgtdqcs001f_config.demod_address);
+
+ dprintk(MANTIS_ERROR, 1, "Mantis DVB-S STV0299 frontend attach success");
+ } else {
+ return -1;
+ }
} else {
- return -1;
- }
+ dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+ adapter->name,
+ err);
+ return -EIO;
+ }
mantis->fe = fe;
dprintk(MANTIS_ERROR, 1, "Done!");
@@ -192,4 +208,6 @@ struct mantis_hwconfig vp1033_config = {
.bytes = 0,
.frontend_init = vp1033_frontend_init,
+ .power = GPIF_A12,
+ .reset = GPIF_A13,
};
diff --git a/drivers/media/dvb/mantis/mantis_vp1034.c b/drivers/media/dvb/mantis/mantis_vp1034.c
index 40778ec..98a4ec8 100644
--- a/drivers/media/dvb/mantis/mantis_vp1034.c
+++ b/drivers/media/dvb/mantis/mantis_vp1034.c
@@ -32,6 +32,7 @@
#include "mb86a16.h"
#include "mantis_common.h"
#include "mantis_ioc.h"
+#include "mantis_dvb.h"
#include "mantis_vp1034.h"
#include "mantis_reg.h"
@@ -74,17 +75,30 @@ static int vp1034_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *
{
struct i2c_adapter *adapter = &mantis->adapter;
- dprintk(MANTIS_ERROR, 1, "Probing for MB86A16 (DVB-S/DSS)");
- fe = mb86a16_attach(&vp1034_mb86a16_config, adapter);
- if (fe) {
- dprintk(MANTIS_ERROR, 1,
- "found MB86A16 DVB-S/DSS frontend @0x%02x",
- vp1034_mb86a16_config.demod_address);
+ int err = 0;
+ err = mantis_frontend_power(mantis, POWER_ON);
+ if (err == 0) {
+ mantis_frontend_soft_reset(mantis);
+ msleep(250);
+
+ dprintk(MANTIS_ERROR, 1, "Probing for MB86A16 (DVB-S/DSS)");
+ fe = mb86a16_attach(&vp1034_mb86a16_config, adapter);
+ if (fe) {
+ dprintk(MANTIS_ERROR, 1,
+ "found MB86A16 DVB-S/DSS frontend @0x%02x",
+ vp1034_mb86a16_config.demod_address);
+
+ } else {
+ return -1;
+ }
} else {
- return -1;
- }
+ dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+ adapter->name,
+ err);
+ return -EIO;
+ }
mantis->fe = fe;
dprintk(MANTIS_ERROR, 1, "Done!");
@@ -101,4 +115,6 @@ struct mantis_hwconfig vp1034_config = {
.bytes = 0,
.frontend_init = vp1034_frontend_init,
+ .power = GPIF_A12,
+ .reset = GPIF_A13,
};
diff --git a/drivers/media/dvb/mantis/mantis_vp2033.c b/drivers/media/dvb/mantis/mantis_vp2033.c
index 8773291..cef108c 100644
--- a/drivers/media/dvb/mantis/mantis_vp2033.c
+++ b/drivers/media/dvb/mantis/mantis_vp2033.c
@@ -31,6 +31,8 @@
#include "tda1002x.h"
#include "mantis_common.h"
+#include "mantis_ioc.h"
+#include "mantis_dvb.h"
#include "mantis_vp2033.h"
#define MANTIS_MODEL_NAME "VP-2033"
@@ -123,32 +125,46 @@ static int vp2033_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *
{
struct i2c_adapter *adapter = &mantis->adapter;
- dprintk(MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
- fe = tda10021_attach(&vp2033_tda1002x_cu1216_config,
- adapter,
- read_pwm(mantis));
+ int err = 0;
- if (fe) {
- dprintk(MANTIS_ERROR, 1,
- "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x",
- vp2033_tda1002x_cu1216_config.demod_address);
- } else {
- fe = tda10023_attach(&vp2033_tda10023_cu1216_config,
+ err = mantis_frontend_power(mantis, POWER_ON);
+ if (err == 0) {
+ mantis_frontend_soft_reset(mantis);
+ msleep(250);
+
+ dprintk(MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
+ fe = tda10021_attach(&vp2033_tda1002x_cu1216_config,
adapter,
read_pwm(mantis));
if (fe) {
dprintk(MANTIS_ERROR, 1,
- "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x",
+ "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x",
vp2033_tda1002x_cu1216_config.demod_address);
+ } else {
+ fe = tda10023_attach(&vp2033_tda10023_cu1216_config,
+ adapter,
+ read_pwm(mantis));
+
+ if (fe) {
+ dprintk(MANTIS_ERROR, 1,
+ "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x",
+ vp2033_tda1002x_cu1216_config.demod_address);
+ }
}
- }
- if (fe) {
- fe->ops.tuner_ops.set_params = tda1002x_cu1216_tuner_set;
- dprintk(MANTIS_ERROR, 1, "Mantis DVB-C Philips CU1216 frontend attach success");
+ if (fe) {
+ fe->ops.tuner_ops.set_params = tda1002x_cu1216_tuner_set;
+ dprintk(MANTIS_ERROR, 1, "Mantis DVB-C Philips CU1216 frontend attach success");
+ } else {
+ return -1;
+ }
} else {
- return -1;
+ dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+ adapter->name,
+ err);
+
+ return -EIO;
}
mantis->fe = fe;
@@ -167,4 +183,6 @@ struct mantis_hwconfig vp2033_config = {
.bytes = 0,
.frontend_init = vp2033_frontend_init,
+ .power = GPIF_A12,
+ .reset = GPIF_A13,
};
diff --git a/drivers/media/dvb/mantis/mantis_vp2040.c b/drivers/media/dvb/mantis/mantis_vp2040.c
index 51b082f..e201988 100644
--- a/drivers/media/dvb/mantis/mantis_vp2040.c
+++ b/drivers/media/dvb/mantis/mantis_vp2040.c
@@ -31,6 +31,8 @@
#include "tda1002x.h"
#include "mantis_common.h"
+#include "mantis_ioc.h"
+#include "mantis_dvb.h"
#include "mantis_vp2040.h"
#define MANTIS_MODEL_NAME "VP-2040"
@@ -123,34 +125,47 @@ static int vp2040_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *
{
struct i2c_adapter *adapter = &mantis->adapter;
- dprintk(MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
- fe = tda10021_attach(&vp2040_tda1002x_cu1216_config,
- adapter,
- read_pwm(mantis));
+ int err = 0;
- if (fe) {
- dprintk(MANTIS_ERROR, 1,
- "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x",
- vp2040_tda1002x_cu1216_config.demod_address);
- } else {
- fe = tda10023_attach(&vp2040_tda10023_cu1216_config,
+ err = mantis_frontend_power(mantis, POWER_ON);
+ if (err == 0) {
+ mantis_frontend_soft_reset(mantis);
+ msleep(250);
+
+ dprintk(MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)");
+ fe = tda10021_attach(&vp2040_tda1002x_cu1216_config,
adapter,
read_pwm(mantis));
if (fe) {
dprintk(MANTIS_ERROR, 1,
- "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x",
+ "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x",
vp2040_tda1002x_cu1216_config.demod_address);
+ } else {
+ fe = tda10023_attach(&vp2040_tda10023_cu1216_config,
+ adapter,
+ read_pwm(mantis));
+
+ if (fe) {
+ dprintk(MANTIS_ERROR, 1,
+ "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x",
+ vp2040_tda1002x_cu1216_config.demod_address);
+ }
}
- }
- if (fe) {
- fe->ops.tuner_ops.set_params = tda1002x_cu1216_tuner_set;
- dprintk(MANTIS_ERROR, 1, "Mantis DVB-C Philips CU1216 frontend attach success");
+ if (fe) {
+ fe->ops.tuner_ops.set_params = tda1002x_cu1216_tuner_set;
+ dprintk(MANTIS_ERROR, 1, "Mantis DVB-C Philips CU1216 frontend attach success");
+ } else {
+ return -1;
+ }
} else {
- return -1;
- }
+ dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+ adapter->name,
+ err);
+ return -EIO;
+ }
mantis->fe = fe;
dprintk(MANTIS_DEBUG, 1, "Done!");
@@ -167,4 +182,6 @@ struct mantis_hwconfig vp2040_config = {
.bytes = 0,
.frontend_init = vp2040_frontend_init,
+ .power = GPIF_A12,
+ .reset = GPIF_A13,
};
diff --git a/drivers/media/dvb/mantis/mantis_vp3030.c b/drivers/media/dvb/mantis/mantis_vp3030.c
index 9efcfa7..a44fac3 100644
--- a/drivers/media/dvb/mantis/mantis_vp3030.c
+++ b/drivers/media/dvb/mantis/mantis_vp3030.c
@@ -66,13 +66,23 @@ static int vp3030_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *
msleep(100);
gpio_set_bits(mantis, config->reset, 1);
- dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");
- fe = zl10353_attach(&mantis_vp3030_config, adapter);
+ if (err == 0) {
+ msleep(250);
+ dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)");
+ fe = zl10353_attach(&mantis_vp3030_config, adapter);
- if (!fe)
- return -1;
+ if (!fe)
+ return -1;
- tda665x_attach(fe, &env57h12d5_config, adapter);
+ tda665x_attach(fe, &env57h12d5_config, adapter);
+ } else {
+ dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>",
+ adapter->name,
+ err);
+
+ return -EIO;
+
+ }
mantis->fe = fe;
dprintk(MANTIS_ERROR, 1, "Done!");
@@ -91,4 +101,6 @@ struct mantis_hwconfig vp3030_config = {
.frontend_init = vp3030_frontend_init,
.power = GPIF_A12,
.reset = GPIF_A13,
+
+ .i2c_mode = MANTIS_BYTE_MODE
};
--
1.7.1

Some files were not shown because too many files have changed in this diff Show More