From patchwork Mon Apr 2 18:24:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10320159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DE41860116 for ; Mon, 2 Apr 2018 18:24:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDEDC28A4C for ; Mon, 2 Apr 2018 18:24:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2C6428A67; Mon, 2 Apr 2018 18:24:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4215E28A4C for ; Mon, 2 Apr 2018 18:24:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753072AbeDBSYq (ORCPT ); Mon, 2 Apr 2018 14:24:46 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:38959 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753442AbeDBSYp (ORCPT ); Mon, 2 Apr 2018 14:24:45 -0400 Received: by mail-wr0-f195.google.com with SMTP id c24so15021022wrc.6 for ; Mon, 02 Apr 2018 11:24:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=11YoexhDzd2nUlfR8rtSZ+c590qBEWhn/fCq0Uv0/To=; b=ZPcSuD9kK5s6VzGSSKC9iIvVzQHm8MIMmkiQvZWR7MJrCmmNb31niitDwR6qeLc3w8 ve0aV1rwsPvmL/z55CegD2Ia4ET/0TpEqhdM2izwCFQSi4z5oM/eK81oDUP5x44dPC2b SIaByvlE0hxSTG0yFvz8r0rdGtZ6wbMo2J6h6uzHslqjFUV/YUN4abhZptqdnrh2MruY ycl4zF4B2SHkbeTSpyvrJHC+Khv2x46kH0Apy3yQr+pMxYwyeLBDrYOqyd3qmKQp3cnQ 07rjbcJ5EPmUCN4ZiI9JNelHfMaHnbVpNaJIrVZhGLaPBcknh1ymg1qe63+mhQR7ewSd 4wJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=11YoexhDzd2nUlfR8rtSZ+c590qBEWhn/fCq0Uv0/To=; b=fCdwMR0K+1EF1AnAmux5XfSGEaJgq0H1N7XYnZFaZxntybkfBOkt/IJpXR4VwUFgtV ACKNhOF4oYRJJNuDDdIqaT4QaR2dNSzSMyaqexpDx1Lg0vH/XW3B0M2kcTWXlOSw779R 3JbifAz5XAl7Nv7vJfjI/7X4cu1AvFXwESiD9Wj3Voyb509gXvCN9NIbpJEQiX9+5G2v BwDxwHQEpyO0zYD0r7IsfKVDCkbHO1XKVnRxbiLP7ckmGvJjXW3PceONUNz+WaT+qBES TMZLZVQHOj+DNvSgZUwEgNmTKagJnwisfUfmqkowzTHPP/RDjuFxWEjmznq/rbNFJ96l 3bRQ== X-Gm-Message-State: AElRT7HU2TI7VdARWGz3CDDIiXMmTdo7KBWkDD508bK/xw26b0qRcXyR KzHDxHdQire7Z5kKrFhuA06klQ== X-Google-Smtp-Source: AIpwx4/vDK53tfIw9YBR1rSbJu3KlvSvp4AdHuG8EmKQzRAk0Qgcsq1cCJV1fkwPMhwyD64M5Vu6jA== X-Received: by 10.223.184.188 with SMTP id i57mr7334861wrf.105.1522693483703; Mon, 02 Apr 2018 11:24:43 -0700 (PDT) Received: from dvbdev.wuest.de (ip-84-118-193-200.unity-media.net. [84.118.193.200]) by smtp.gmail.com with ESMTPSA id x9sm2368273wrb.18.2018.04.02.11.24.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Apr 2018 11:24:43 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Subject: [PATCH 15/20] [media] ddbridge: support dummy tuners with 125MByte/s dummy data stream Date: Mon, 2 Apr 2018 20:24:22 +0200 Message-Id: <20180402182427.20918-16-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180402182427.20918-1-d.scheller.oss@gmail.com> References: <20180402182427.20918-1-d.scheller.oss@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Scheller The Octopus V3 and Octopus Mini devices support set up of a dummy tuner mode on port 0 that will deliver a continuous data stream of 125MBytes per second while raising IRQs and filling the DMA buffers, which comes handy for some stress, PCIe link and IRQ handling testing. The dummy frontend is registered using dvb_dummy_fe's QAM dummy frontend. Set ddbridge.dummy_tuner to 1 to enable this on the supported cards. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/Kconfig | 1 + drivers/media/pci/ddbridge/ddbridge-core.c | 36 ++++++++++++++++++++++++++++++ drivers/media/pci/ddbridge/ddbridge.h | 1 + 3 files changed, 38 insertions(+) diff --git a/drivers/media/pci/ddbridge/Kconfig b/drivers/media/pci/ddbridge/Kconfig index a422dde2f34a..16faef265e97 100644 --- a/drivers/media/pci/ddbridge/Kconfig +++ b/drivers/media/pci/ddbridge/Kconfig @@ -14,6 +14,7 @@ config DVB_DDBRIDGE select MEDIA_TUNER_TDA18212 if MEDIA_SUBDRV_AUTOSELECT select DVB_MXL5XX if MEDIA_SUBDRV_AUTOSELECT select DVB_CXD2099 if MEDIA_SUBDRV_AUTOSELECT + select DVB_DUMMY_FE if MEDIA_SUBDRV_AUTOSELECT ---help--- Support for cards with the Digital Devices PCI express bridge: - Octopus PCIe Bridge diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 8907551b02e4..59e137516003 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -54,6 +54,7 @@ #include "stv6111.h" #include "lnbh25.h" #include "cxd2099.h" +#include "dvb_dummy_fe.h" /****************************************************************************/ @@ -105,6 +106,11 @@ module_param(dma_buf_size, int, 0444); MODULE_PARM_DESC(dma_buf_size, "DMA buffer size as multiple of 128*47, possible values: 1-43"); +static int dummy_tuner; +module_param(dummy_tuner, int, 0444); +MODULE_PARM_DESC(dummy_tuner, + "attach dummy tuner to port 0 on Octopus V3 or Octopus Mini cards"); + /****************************************************************************/ static DEFINE_MUTEX(redirect_lock); @@ -548,6 +554,9 @@ static void ddb_input_start(struct ddb_input *input) ddbwritel(dev, 0x09, TS_CONTROL(input)); + if (input->port->type == DDB_TUNER_DUMMY) + ddbwritel(dev, 0x000fff01, TS_CONTROL2(input)); + if (input->dma) { input->dma->running = 1; spin_unlock_irq(&input->dma->lock); @@ -1255,6 +1264,20 @@ static int tuner_attach_stv6111(struct ddb_input *input, int type) return 0; } +static int demod_attach_dummy(struct ddb_input *input) +{ + struct ddb_dvb *dvb = &input->port->dvb[input->nr & 1]; + struct device *dev = input->port->dev->dev; + + dvb->fe = dvb_attach(dvb_dummy_fe_qam_attach); + if (!dvb->fe) { + dev_err(dev, "QAM dummy attach failed!\n"); + return -ENODEV; + } + + return 0; +} + static int start_feed(struct dvb_demux_feed *dvbdmxfeed) { struct dvb_demux *dvbdmx = dvbdmxfeed->demux; @@ -1547,6 +1570,10 @@ static int dvb_input_attach(struct ddb_input *input) if (tuner_attach_tda18212(input, port->type) < 0) goto err_tuner; break; + case DDB_TUNER_DUMMY: + if (demod_attach_dummy(input) < 0) + goto err_detach; + break; default: return 0; } @@ -1809,6 +1836,15 @@ static void ddb_port_probe(struct ddb_port *port) /* Handle missing ports and ports without I2C */ + if (dummy_tuner && !port->nr && + dev->link[0].ids.device == 0x0005) { + port->name = "DUMMY"; + port->class = DDB_PORT_TUNER; + port->type = DDB_TUNER_DUMMY; + port->type_name = "DUMMY"; + return; + } + if (port->nr == ts_loop) { port->name = "TS LOOP"; port->class = DDB_PORT_LOOP; diff --git a/drivers/media/pci/ddbridge/ddbridge.h b/drivers/media/pci/ddbridge/ddbridge.h index 86db6f19369a..cb69021a3443 100644 --- a/drivers/media/pci/ddbridge/ddbridge.h +++ b/drivers/media/pci/ddbridge/ddbridge.h @@ -236,6 +236,7 @@ struct ddb_port { char *name; char *type_name; u32 type; +#define DDB_TUNER_DUMMY 0xffffffff #define DDB_TUNER_NONE 0 #define DDB_TUNER_DVBS_ST 1 #define DDB_TUNER_DVBS_ST_AA 2