1
0
mirror of https://github.com/DigitalDevices/dddvb.git synced 2023-10-10 13:37:43 +02:00

change dma buffer number and size from defines to module parameters

This commit is contained in:
Ralph Metzler 2017-10-23 00:14:39 +02:00
parent e239a6d772
commit 7e6f9d6e9d
2 changed files with 27 additions and 31 deletions

View File

@ -66,7 +66,16 @@ MODULE_PARM_DESC(no_init, "do not initialize most devices");
static int stv0910_single; static int stv0910_single;
module_param(stv0910_single, int, 0444); module_param(stv0910_single, int, 0444);
MODULE_PARM_DESC(no_init, "use stv0910 cards as single demods"); 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, "dma buffer number, 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");
#define DDB_MAX_ADAPTER 64 #define DDB_MAX_ADAPTER 64
static struct ddb *ddbs[DDB_MAX_ADAPTER]; static struct ddb *ddbs[DDB_MAX_ADAPTER];
@ -2324,11 +2333,11 @@ static void ddb_dma_init(struct ddb_io *io, int nr, int out)
io->port->dev->link[0].info->version == 3) { io->port->dev->link[0].info->version == 3) {
dma->num = OUTPUT_DMA_BUFS_SDR; dma->num = OUTPUT_DMA_BUFS_SDR;
dma->size = OUTPUT_DMA_SIZE_SDR; dma->size = OUTPUT_DMA_SIZE_SDR;
dma->div = OUTPUT_DMA_IRQ_DIV_SDR; dma->div = 1;
} else { } else {
dma->num = OUTPUT_DMA_BUFS; dma->num = dma_buf_num;
dma->size = OUTPUT_DMA_SIZE; dma->size = dma_buf_size * 128 * 47;
dma->div = OUTPUT_DMA_IRQ_DIV; dma->div = 1;
} }
} else { } else {
#ifdef DDB_USE_WORK #ifdef DDB_USE_WORK
@ -2338,9 +2347,9 @@ static void ddb_dma_init(struct ddb_io *io, int nr, int out)
#endif #endif
dma->regs = rm->idma->base + rm->idma->size * nr; dma->regs = rm->idma->base + rm->idma->size * nr;
dma->bufregs = rm->idma_buf->base + rm->idma_buf->size * nr; dma->bufregs = rm->idma_buf->base + rm->idma_buf->size * nr;
dma->num = INPUT_DMA_BUFS; dma->num = dma_buf_num;
dma->size = INPUT_DMA_SIZE; dma->size = dma_buf_size * 128 * 47;
dma->div = INPUT_DMA_IRQ_DIV; dma->div = 1;
} }
ddbwritel(io->port->dev, 0, DMA_BUFFER_ACK(dma)); ddbwritel(io->port->dev, 0, DMA_BUFFER_ACK(dma));
dev_info(io->port->dev->dev, "init link %u, io %u, dma %u, dmaregs %08x bufregs %08x\n", dev_info(io->port->dev->dev, "init link %u, io %u, dma %u, dmaregs %08x bufregs %08x\n",
@ -4436,6 +4445,16 @@ int ddb_exit_ddbridge(int stage, int error)
int ddb_init_ddbridge(void) 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;
printk("dma_buf_num = %u, dma_buf_size = %u\n", dma_buf_num, dma_buf_size);
if (ddb_class_create() < 0) if (ddb_class_create() < 0)
return -1; return -1;
ddb_wq = alloc_workqueue("ddbridge", 0, 0); ddb_wq = alloc_workqueue("ddbridge", 0, 0);

View File

@ -176,32 +176,9 @@ struct ddb_info {
const struct ddb_regmap *regmap; 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 DMA_MAX_BUFS 32 /* hardware table limit */
#ifdef SMALL_DMA_BUFS
#define INPUT_DMA_BUFS 32
#define INPUT_DMA_SIZE (128 * 47 * 5)
#define INPUT_DMA_IRQ_DIV 1
#define OUTPUT_DMA_BUFS 32
#define OUTPUT_DMA_SIZE (128 * 47 * 5)
#define OUTPUT_DMA_IRQ_DIV 1
#else
#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
#endif
#define OUTPUT_DMA_BUFS_SDR 32 #define OUTPUT_DMA_BUFS_SDR 32
#define OUTPUT_DMA_SIZE_SDR (256 * 1024) #define OUTPUT_DMA_SIZE_SDR (256 * 1024)
#define OUTPUT_DMA_IRQ_DIV_SDR 1
struct ddb; struct ddb;
struct ddb_port; struct ddb_port;