From patchwork Mon Apr 9 16:47:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10331779 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 DB8E760236 for ; Mon, 9 Apr 2018 16:48:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD7012015F for ; Mon, 9 Apr 2018 16:48:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C21172881D; Mon, 9 Apr 2018 16:48:27 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, 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 5A2032015F for ; Mon, 9 Apr 2018 16:48:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753480AbeDIQsZ (ORCPT ); Mon, 9 Apr 2018 12:48:25 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:41281 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753384AbeDIQsI (ORCPT ); Mon, 9 Apr 2018 12:48:08 -0400 Received: by mail-wr0-f194.google.com with SMTP id s12so10252855wrc.8 for ; Mon, 09 Apr 2018 09:48:08 -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=myxxu3qgXKkcebKT8+15RtHpNB3OpOkNku42PHXsQzY=; b=NjEieuxt8RDNDeqrVhcLugO8Z0905IpMg30Pmk/Ga/rCC2iF62pBqbTNRgYfm4Mbwd DvrJjSRSkP5Xd1sV04YxKToWr3vuDJ1YWdcU2tWXBsiEf8p6WfyAAu9K3tEHSGPxgrA2 iZdV2kJmAWym/mZu+lSTAFzcZuxeqQWhPsT/DOxtjXigv8hmC1CR20mVCZu0R0oe12IO sSIBdwrdReyEV1dsqT21JpmIk9jN4YQbfLFng/ZeK84KGHVpi3+BSFGziLa9pQuI5f/I LIIxj942EQjeysBhYiLHe17Ia34xEvZcKl6vK66xEifwoXVADC3Kj7AMNiNfid7SFZW9 CccA== 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=myxxu3qgXKkcebKT8+15RtHpNB3OpOkNku42PHXsQzY=; b=mKLcrBh/ZBNnoXDRDlRCs0+I/qX/IXHp4VV42xokSPx5MB9cgM1t7p1fRK7zjCYrat e7H1lOft50XqHL6TJMQzSs7YalB0hkZZEPZPax3RByKCo6uhzifPWMIeDLznFMr/dpHa sN3/gJFaHjX7o4vjXzsh2BFmB1Jm62GVYGRuna68XztXxkdgBo5D+WFLkoma27PnSQZJ bIushwye7JnBccX5KZw43Ph9kd02AEMfoiSef4vIgXYCHlyeLg4L+yBudDZGGXlMx9Kl 3q9ZPnJUoaeL77V5BqA2sN5AtAG+o6yK8uEbRYRxmbBMZT1aMGLrOamnwCB2jU3CE9Mr ikAw== X-Gm-Message-State: AElRT7EW1xpSjNskh+/tcQOYGZcb5Zx7JLzQfYJ4NgddmWBcVNVQ29nP RnHfyzKt/rq+yW6WWeQ/JSMl2g== X-Google-Smtp-Source: AIpwx497aLqBueWq43Ubwvfrq6/MADQaCPAh3+80Lnj7UAhi7/L3Jtrgw8ph1DK1AFzKkylofZv6oQ== X-Received: by 10.223.155.145 with SMTP id d17mr28086386wrc.145.1523292487141; Mon, 09 Apr 2018 09:48:07 -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 11sm1380416wmd.1.2018.04.09.09.48.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 09:48:06 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Subject: [PATCH v2 13/19] [media] ddbridge: make DMA buffer count and size modparam-configurable Date: Mon, 9 Apr 2018 18:47:46 +0200 Message-Id: <20180409164752.641-14-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180409164752.641-1-d.scheller.oss@gmail.com> References: <20180409164752.641-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 Make the number of DMA buffers and their size configurable using module parameters. Being able to set these to a higher number might help on busy systems when handling overall high data rates without having to edit the driver sources and recompile things. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/ddbridge-core.c | 30 ++++++++++++++++++++++++------ drivers/media/pci/ddbridge/ddbridge.h | 12 ------------ 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index e9c2e3e5d64b..8907551b02e4 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -96,6 +96,15 @@ static int stv0910_single; module_param(stv0910_single, int, 0444); MODULE_PARM_DESC(stv0910_single, "use stv0910 cards as single demods"); +static int dma_buf_num = 8; +module_param(dma_buf_num, int, 0444); +MODULE_PARM_DESC(dma_buf_num, "Number of DMA buffers, possible values: 8-32"); + +static int dma_buf_size = 21; +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 DEFINE_MUTEX(redirect_lock); @@ -2187,16 +2196,16 @@ static void ddb_dma_init(struct ddb_io *io, int nr, int out) INIT_WORK(&dma->work, output_work); dma->regs = rm->odma->base + rm->odma->size * nr; dma->bufregs = rm->odma_buf->base + rm->odma_buf->size * nr; - dma->num = OUTPUT_DMA_BUFS; - dma->size = OUTPUT_DMA_SIZE; - dma->div = OUTPUT_DMA_IRQ_DIV; + dma->num = dma_buf_num; + dma->size = dma_buf_size * 128 * 47; + dma->div = 1; } else { INIT_WORK(&dma->work, input_work); dma->regs = rm->idma->base + rm->idma->size * nr; dma->bufregs = rm->idma_buf->base + rm->idma_buf->size * nr; - dma->num = INPUT_DMA_BUFS; - dma->size = INPUT_DMA_SIZE; - dma->div = INPUT_DMA_IRQ_DIV; + dma->num = dma_buf_num; + dma->size = dma_buf_size * 128 * 47; + dma->div = 1; } ddbwritel(io->port->dev, 0, DMA_BUFFER_ACK(dma)); dev_dbg(io->port->dev->dev, "init link %u, io %u, dma %u, dmaregs %08x bufregs %08x\n", @@ -3353,6 +3362,15 @@ int ddb_exit_ddbridge(int stage, int error) int ddb_init_ddbridge(void) { + if (dma_buf_num < 8) + dma_buf_num = 8; + if (dma_buf_num > 32) + dma_buf_num = 32; + if (dma_buf_size < 1) + dma_buf_size = 1; + if (dma_buf_size > 43) + dma_buf_size = 43; + if (ddb_class_create() < 0) return -1; ddb_wq = alloc_workqueue("ddbridge", 0, 0); diff --git a/drivers/media/pci/ddbridge/ddbridge.h b/drivers/media/pci/ddbridge/ddbridge.h index de9ddf1068bf..86db6f19369a 100644 --- a/drivers/media/pci/ddbridge/ddbridge.h +++ b/drivers/media/pci/ddbridge/ddbridge.h @@ -136,20 +136,8 @@ struct ddb_info { const struct ddb_regmap *regmap; }; -/* DMA_SIZE MUST be smaller than 256k and - * MUST be divisible by 188 and 128 !!! - */ - #define DMA_MAX_BUFS 32 /* hardware table limit */ -#define INPUT_DMA_BUFS 8 -#define INPUT_DMA_SIZE (128 * 47 * 21) -#define INPUT_DMA_IRQ_DIV 1 - -#define OUTPUT_DMA_BUFS 8 -#define OUTPUT_DMA_SIZE (128 * 47 * 21) -#define OUTPUT_DMA_IRQ_DIV 1 - struct ddb; struct ddb_port;