From patchwork Sun Apr 1 15:53:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Steinar H. Gunderson" X-Patchwork-Id: 10524 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1SEN6p-0006q2-UH for patchwork@linuxtv.org; Sun, 01 Apr 2012 17:54:27 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-2) with esmtp for id 1SEN6p-0003Mi-GZ; Sun, 01 Apr 2012 17:54:27 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752619Ab2DAPyT (ORCPT ); Sun, 1 Apr 2012 11:54:19 -0400 Received: from cassarossa.samfundet.no ([129.241.93.19]:40880 "EHLO cassarossa.samfundet.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751948Ab2DAPyG (ORCPT ); Sun, 1 Apr 2012 11:54:06 -0400 Received: from pannekake.samfundet.no ([2001:700:300:1800::dddd] ident=unknown) by cassarossa.samfundet.no with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1SEN6S-0001VN-2t; Sun, 01 Apr 2012 17:54:04 +0200 Received: from sesse by pannekake.samfundet.no with local (Exim 4.72) (envelope-from ) id 1SEN6R-0008Np-OJ; Sun, 01 Apr 2012 17:54:03 +0200 From: "Steinar H. Gunderson" To: linux-media@vger.kernel.org Cc: "Steinar H. Gunderson" Subject: [PATCH 11/11] Enable Mantis CA support. Date: Sun, 1 Apr 2012 17:53:51 +0200 Message-Id: <1333295631-31866-11-git-send-email-sgunderson@bigfoot.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <20120401155330.GA31901@uio.no> References: <20120401155330.GA31901@uio.no> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.4.1.154227 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODY_SIZE_5000_5999 0, BODY_SIZE_7000_LESS 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __SANE_MSGID 0, __STOCK_PHRASE_7 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' From: "Steinar H. Gunderson" Not my patch originally; picked up from verbal descriptions on the linux-media list, and fixed up slightly. Signed-off-by: Steinar H. Gunderson --- drivers/media/dvb/mantis/mantis_ca.c | 4 +++- drivers/media/dvb/mantis/mantis_core.c | 20 -------------------- drivers/media/dvb/mantis/mantis_dvb.c | 4 +++- drivers/media/dvb/mantis/mantis_pci.c | 23 +++++++++++++++++++++++ drivers/media/dvb/mantis/mantis_pci.h | 2 ++ 5 files changed, 31 insertions(+), 22 deletions(-) diff --git a/drivers/media/dvb/mantis/mantis_ca.c b/drivers/media/dvb/mantis/mantis_ca.c index cdff4b7..cb3be63 100644 --- a/drivers/media/dvb/mantis/mantis_ca.c +++ b/drivers/media/dvb/mantis/mantis_ca.c @@ -34,6 +34,7 @@ #include "mantis_link.h" #include "mantis_hif.h" #include "mantis_reg.h" +#include "mantis_pci.h" #include "mantis_ca.h" @@ -125,6 +126,7 @@ static int mantis_ca_slot_shutdown(struct dvb_ca_en50221 *en50221, int slot) struct mantis_pci *mantis = ca->ca_priv; dprintk(MANTIS_DEBUG, 1, "Slot(%d): Slot shutdown", slot); + mantis_set_direction(mantis, 0); /* Disable TS through CAM */ return 0; } @@ -135,7 +137,7 @@ static int mantis_ts_control(struct dvb_ca_en50221 *en50221, int slot) struct mantis_pci *mantis = ca->ca_priv; dprintk(MANTIS_DEBUG, 1, "Slot(%d): TS control", slot); -/* mantis_set_direction(mantis, 1); */ /* Enable TS through CAM */ + mantis_set_direction(mantis, 1); /* Enable TS through CAM */ return 0; } diff --git a/drivers/media/dvb/mantis/mantis_core.c b/drivers/media/dvb/mantis/mantis_core.c index 22524a8..2efacac 100644 --- a/drivers/media/dvb/mantis/mantis_core.c +++ b/drivers/media/dvb/mantis/mantis_core.c @@ -213,23 +213,3 @@ void gpio_set_bits(struct mantis_pci *mantis, u32 bitpos, u8 value) udelay(100); } -/* direction = 0 , no CI passthrough ; 1 , CI passthrough */ -void mantis_set_direction(struct mantis_pci *mantis, int direction) -{ - u32 reg; - - reg = mmread(0x28); - dprintk(verbose, MANTIS_DEBUG, 1, "TS direction setup"); - if (direction == 0x01) { - /* to CI */ - reg |= 0x04; - mmwrite(reg, 0x28); - reg &= 0xff - 0x04; - mmwrite(reg, 0x28); - } else { - reg &= 0xff - 0x04; - mmwrite(reg, 0x28); - reg |= 0x04; - mmwrite(reg, 0x28); - } -} diff --git a/drivers/media/dvb/mantis/mantis_dvb.c b/drivers/media/dvb/mantis/mantis_dvb.c index e5180e4..8c38c0b 100644 --- a/drivers/media/dvb/mantis/mantis_dvb.c +++ b/drivers/media/dvb/mantis/mantis_dvb.c @@ -239,6 +239,8 @@ int __devinit mantis_dvb_init(struct mantis_pci *mantis) mantis->fe = NULL; goto err5; } + + mantis_ca_init(mantis); } } @@ -274,7 +276,6 @@ int __devexit mantis_dvb_exit(struct mantis_pci *mantis) int 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); @@ -282,6 +283,7 @@ int __devexit mantis_dvb_exit(struct mantis_pci *mantis) dvb_frontend_detach(mantis->fe); } + mantis_ca_exit(mantis); tasklet_kill(&mantis->tasklet); dvb_net_release(&mantis->dvbnet); diff --git a/drivers/media/dvb/mantis/mantis_pci.c b/drivers/media/dvb/mantis/mantis_pci.c index 371558a..9c60240 100644 --- a/drivers/media/dvb/mantis/mantis_pci.c +++ b/drivers/media/dvb/mantis/mantis_pci.c @@ -97,6 +97,7 @@ int __devinit mantis_pci_init(struct mantis_pci *mantis) pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &latency); mantis->latency = latency; mantis->revision = pdev->revision; + mantis_set_direction(mantis, 0); dprintk(MANTIS_ERROR, 0, " Mantis Rev %d [%04x:%04x], ", mantis->revision, @@ -110,6 +111,7 @@ int __devinit mantis_pci_init(struct mantis_pci *mantis) mantis->mantis_addr, mantis->mmio); + mmwrite(0x00, MANTIS_INT_MASK); err = request_irq(pdev->irq, config->irq_handler, IRQF_SHARED, @@ -165,6 +167,27 @@ void mantis_pci_exit(struct mantis_pci *mantis) } EXPORT_SYMBOL_GPL(mantis_pci_exit); +/* direction = 0 , no CI passthrough ; 1 , CI passthrough */ +void mantis_set_direction(struct mantis_pci *mantis, int direction) +{ + u32 reg; + + reg = mmread(0x28); + dprintk(MANTIS_DEBUG, 1, "TS direction setup"); + if (direction == 0x01) { + /* to CI */ + reg |= 0x04; + mmwrite(reg, 0x28); + reg &= 0xff - 0x04; + mmwrite(reg, 0x28); + } else { + reg &= 0xff - 0x04; + mmwrite(reg, 0x28); + reg |= 0x04; + mmwrite(reg, 0x28); + } +} + MODULE_DESCRIPTION("Mantis PCI DTV bridge driver"); MODULE_AUTHOR("Manu Abraham"); MODULE_LICENSE("GPL"); diff --git a/drivers/media/dvb/mantis/mantis_pci.h b/drivers/media/dvb/mantis/mantis_pci.h index 65f0045..37c0672 100644 --- a/drivers/media/dvb/mantis/mantis_pci.h +++ b/drivers/media/dvb/mantis/mantis_pci.h @@ -24,4 +24,6 @@ extern int mantis_pci_init(struct mantis_pci *mantis); extern void mantis_pci_exit(struct mantis_pci *mantis); +void mantis_set_direction(struct mantis_pci *mantis, int direction); + #endif /* __MANTIS_PCI_H */