Commit e5526848 authored by Daniel Scheller's avatar Daniel Scheller Committed by Mauro Carvalho Chehab

media: ddbridge/mci: split MaxSX8 specific code off to ddbridge-sx8.c

Split off all code specific to the MaxSX8 cards to a separate ddbridge-sx8
module and hook it up in the Makefile. This also adds evaluation of the
mci_type to allow for using different attach handling for different cards.
As different cards can implement things differently (ie. support differing
frontend_ops, and have different base structs being put ontop of the
common mci_base struct), this introduces the mci_cfg struct which is
initially used to hold a few specifics to the -sx8 submodule. While at it,
the handling of the i/q mode is adjusted slightly. Besides this and
handling mci_base and sx8_base struct pointers where needed, all code
is copied unmodified from ddbridge-mci.c.

Picked up from the upstream dddvb GIT.
Signed-off-by: default avatarDaniel Scheller <d.scheller@gmx.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 84409a95
......@@ -4,7 +4,8 @@
#
ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-ci.o \
ddbridge-hw.o ddbridge-i2c.o ddbridge-max.o ddbridge-mci.o
ddbridge-hw.o ddbridge-i2c.o ddbridge-max.o ddbridge-mci.o \
ddbridge-sx8.o
obj-$(CONFIG_DVB_DDBRIDGE) += ddbridge.o
......
......@@ -1593,7 +1593,7 @@ static int dvb_input_attach(struct ddb_input *input)
goto err_detach;
break;
case DDB_TUNER_MCI_SX8:
if (ddb_fe_attach_mci(input) < 0)
if (ddb_fe_attach_mci(input, port->type) < 0)
goto err_detach;
break;
default:
......
......@@ -457,21 +457,29 @@ int ddb_fe_attach_mxl5xx(struct ddb_input *input)
/******************************************************************************/
/* MAX MCI related functions */
int ddb_fe_attach_mci(struct ddb_input *input)
int ddb_fe_attach_mci(struct ddb_input *input, u32 type)
{
struct ddb *dev = input->port->dev;
struct ddb_dvb *dvb = &input->port->dvb[input->nr & 1];
struct ddb_port *port = input->port;
struct ddb_link *link = &dev->link[port->lnr];
int demod, tuner;
struct mci_cfg cfg;
demod = input->nr;
tuner = demod & 3;
if (fmode == 3)
tuner = 0;
dvb->fe = ddb_mci_attach(input, 0, demod, &dvb->set_input);
switch (type) {
case DDB_TUNER_MCI_SX8:
cfg = ddb_max_sx8_cfg;
if (fmode == 3)
tuner = 0;
break;
default:
return -EINVAL;
}
dvb->fe = ddb_mci_attach(input, &cfg, demod, &dvb->set_input);
if (!dvb->fe) {
dev_err(dev->dev, "No MAXSX8 found!\n");
dev_err(dev->dev, "No MCI card found!\n");
return -ENODEV;
}
if (!dvb->set_input) {
......
......@@ -25,6 +25,6 @@
int ddb_lnb_init_fmode(struct ddb *dev, struct ddb_link *link, u32 fm);
int ddb_fe_attach_mxl5xx(struct ddb_input *input);
int ddb_fe_attach_mci(struct ddb_input *input);
int ddb_fe_attach_mci(struct ddb_input *input, u32 type);
#endif /* _DDBRIDGE_MAX_H */
This diff is collapsed.
......@@ -211,18 +211,11 @@ struct mci_base {
void *key;
struct ddb_link *link;
struct completion completion;
struct device *dev;
struct mutex tuner_lock; /* concurrent tuner access lock */
u8 adr;
struct mutex mci_lock; /* concurrent MCI access lock */
int count;
u8 tuner_use_count[MCI_TUNER_MAX];
u8 assigned_demod[MCI_DEMOD_MAX];
u32 used_ldpc_bitrate[MCI_DEMOD_MAX];
u8 demod_in_use[MCI_DEMOD_MAX];
u32 iq_mode;
int type;
};
struct mci {
......@@ -231,20 +224,27 @@ struct mci {
int nr;
int demod;
int tuner;
int first_time_lock;
int started;
struct mci_result signal_info;
};
u32 bb_mode;
struct mci_cfg {
int type;
struct dvb_frontend_ops *fe_ops;
u32 base_size;
u32 state_size;
int (*init)(struct mci *mci);
int (*base_init)(struct mci_base *mci_base);
int (*set_input)(struct dvb_frontend *fe, int input);
};
/* defined in ddbridge-sx8.c */
extern const struct mci_cfg ddb_max_sx8_cfg;
int ddb_mci_cmd(struct mci *state, struct mci_command *command,
struct mci_result *result);
int ddb_mci_config(struct mci *state, u32 config);
struct dvb_frontend
*ddb_mci_attach(struct ddb_input *input,
int mci_type, int nr,
*ddb_mci_attach(struct ddb_input *input, struct mci_cfg *cfg, int nr,
int (**fn_set_input)(struct dvb_frontend *fe, int input));
#endif /* _DDBRIDGE_MCI_H_ */
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment