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

cxd2099: control buffer mode with a modparam

Make the cxd2099ar buffer mode be toggled by a module parameter instead of
hiding it behind a compile-time define (might come in handy for testing
purposes).

Backport of https://git.linuxtv.org/media_tree.git/commit/?id=2b64e4de39c791fa12cd7ec0307f01609d4b7f1b
This commit is contained in:
Daniel Scheller 2017-08-27 19:02:12 +02:00
parent 5751c3fb1a
commit f765e5e99e

View File

@ -36,7 +36,9 @@
#include "cxd2099.h"
//#define BUFFER_MODE 1
static int buffermode;
module_param(buffermode, int, 0444);
MODULE_PARM_DESC(buffermode, "Enable use of the CXD2099AR buffer mode (default: disabled)");
static int read_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount);
@ -253,7 +255,6 @@ static int write_reg(struct cxd *ci, u8 reg, u8 val)
return write_regm(ci, reg, val, 0xff);
}
#ifdef BUFFER_MODE
static int write_block(struct cxd *ci, u8 adr, u8 *data, u16 n)
{
int status = 0;
@ -283,7 +284,6 @@ static int write_block(struct cxd *ci, u8 adr, u8 *data, u16 n)
}
return status;
}
#endif
static void set_mode(struct cxd *ci, int mode)
{
@ -657,8 +657,6 @@ static int read_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount)
return len;
}
#ifdef BUFFER_MODE
static int write_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount)
{
struct cxd *ci = ca->data;
@ -677,7 +675,6 @@ static int write_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount)
return status;
return ecount;
}
#endif
static struct dvb_ca_en50221 en_templ = {
.read_attribute_mem = read_attribute_mem,
@ -688,10 +685,8 @@ static struct dvb_ca_en50221 en_templ = {
.slot_shutdown = slot_shutdown,
.slot_ts_enable = slot_ts_enable,
.poll_slot_status = poll_slot_status,
#ifdef BUFFER_MODE
.read_data = read_data,
.write_data = write_data,
#endif
};
struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg,
@ -721,6 +716,14 @@ struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg,
ci->en.data = ci;
init(ci);
pr_info("Attached CXD2099AR at %02x\n", ci->cfg.adr);
if (!buffermode) {
ci->en.read_data = NULL;
ci->en.write_data = NULL;
} else {
pr_info("Using CXD2099AR buffer mode");
}
return &ci->en;
}
EXPORT_SYMBOL(cxd2099_attach);