From: Daniel Scheller <d.scheller.oss@gmail.com>
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 [thread overview]
Message-ID: <20180409164752.641-14-d.scheller.oss@gmail.com> (raw)
In-Reply-To: <20180409164752.641-1-d.scheller.oss@gmail.com>
From: Daniel Scheller <d.scheller@gmx.net>
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 <d.scheller@gmx.net>
---
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;
--
2.16.1
next prev parent reply other threads:[~2018-04-09 16:48 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-09 16:47 [PATCH v2 00/19] dddvb/ddbridge-0.9.33 Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 01/19] [media] dvb-frontends/stv0910: add init values for TSINSDELM/L Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 02/19] [media] dvb-frontends/stv0910: fix CNR reporting in read_snr() Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 03/19] [media] ddbridge: move modparams to ddbridge-core.c Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 04/19] [media] ddbridge: move ddb_wq and the wq+class initialisation to -core Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 05/19] [media] ddbridge: move MSI IRQ cleanup to a helper function Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 06/19] [media] ddbridge: request/free_irq using pci_irq_vector, enable MSI-X Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 07/19] [media] ddbridge: add helper for IRQ handler setup Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 08/19] [media] ddbridge: add macros to handle IRQs in nibble and byte blocks Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 09/19] [media] ddbridge: improve separated MSI IRQ handling Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 10/19] [media] ddbridge: use spin_lock_irqsave() in output_work() Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 11/19] [media] ddbridge: fix output buffer check Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 12/19] [media] ddbridge: set devid entry for link 0 Daniel Scheller
2018-04-09 16:47 ` Daniel Scheller [this message]
2018-04-09 16:47 ` [PATCH v2 14/19] [media] ddbridge: support dummy tuners with 125MByte/s dummy data stream Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 15/19] [media] ddbridge: initial support for MCI-based MaxSX8 cards Daniel Scheller
2018-05-04 14:47 ` Mauro Carvalho Chehab
2018-04-09 16:47 ` [PATCH v2 16/19] [media] ddbridge/max: implement MCI/MaxSX8 attach function Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 17/19] [media] ddbridge: add hardware defs and PCI IDs for MCI cards Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 18/19] [media] ddbridge: recognize and attach the MaxSX8 cards Daniel Scheller
2018-04-09 16:47 ` [PATCH v2 19/19] [media] ddbridge: set driver version to 0.9.33-integrated Daniel Scheller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180409164752.641-14-d.scheller.oss@gmail.com \
--to=d.scheller.oss@gmail.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mchehab@s-opensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox