add auto delivery system adjustment

This commit is contained in:
rjkm
2025-07-29 15:25:23 +02:00
parent 2f69b12029
commit 7b7efb77e1
5 changed files with 39 additions and 8 deletions

View File

@@ -659,7 +659,7 @@ static struct mci_cfg *ddb_max_cfgs [] = {
struct dvb_frontend *ddb_mx_attach(struct ddb_input *input, int nr, int tuner, int type) struct dvb_frontend *ddb_mx_attach(struct ddb_input *input, int nr, int tuner, int type)
{ {
return ddb_mci_attach(input, ddb_max_cfgs[type & 3], nr, tuner); return ddb_mci_attach(input, ddb_max_cfgs[type & 3], nr, tuner, (type & 4) >> 2);
} }
EXPORT_SYMBOL(ddb_mx_attach); EXPORT_SYMBOL(ddb_mx_attach);

View File

@@ -555,8 +555,8 @@ int ddb_fe_attach_mci(struct ddb_input *input, u32 type)
fm = 3; fm = 3;
if (!demod) if (!demod)
ddb_mci_cmd_link_simple(link, MCI_CMD_SET_INPUT_CONFIG, ddb_mci_cmd_link_simple(link, MCI_CMD_SET_INPUT_CONFIG,
0xff, (delmode & 0x10) | 3); 0xff, 3);
dvb->fe = ddb_mx_attach(input, demod, tuner, 3); dvb->fe = ddb_mx_attach(input, demod, tuner, 3 | (delmode & 4));
dvb->input = 0; dvb->input = 0;
break; break;
case DDB_TUNER_MCI_M8A: case DDB_TUNER_MCI_M8A:
@@ -586,8 +586,8 @@ int ddb_fe_attach_mci(struct ddb_input *input, u32 type)
} }
if (!demod) if (!demod)
ddb_mci_cmd_link_simple(link, MCI_CMD_SET_INPUT_CONFIG, ddb_mci_cmd_link_simple(link, MCI_CMD_SET_INPUT_CONFIG,
0xff, mode | (delmode & 0x10)); 0xff, mode);
dvb->fe = ddb_mx_attach(input, demod, tuner, mmode); dvb->fe = ddb_mx_attach(input, demod, tuner, mmode | (delmode & 4));
dvb->input = tuner; dvb->input = tuner;
fm = 0; fm = 0;
break; break;

View File

@@ -402,8 +402,37 @@ static struct mci_base *match_base(void *key)
return NULL; return NULL;
} }
enum fe_delivery_system todelsys[16] = {
SYS_DVBS, SYS_DVBS2, SYS_DVBS2, SYS_DVBC_ANNEX_A,
SYS_DVBT, SYS_DVBT2, SYS_DVBC2, SYS_DVBC_ANNEX_B,
SYS_ISDBT, SYS_ISDBC, SYS_ISDBS, SYS_ISDBS3,
SYS_ATSC, SYS_ATSC3, SYS_UNDEFINED, SYS_UNDEFINED
};
static void adjust_caps(struct mci *mci)
{
int i, j;
u16 dels;
memset(&mci->cmd, 0, sizeof(struct mci_command));
mci->cmd.command = MCI_CMD_GET_CAPABILITIES;
if (ddb_mci_cmd(mci, &mci->cmd, &mci->result))
return;
if (mci->signal_info.status & 0x80)
return;
dels = mci->result.mx_capabilities.standards;
printk("CAPS = %02x\n", dels);
for (i = j = 0; i < 16; i++) {
if (dels & (1 << i))
mci->fe.ops.delsys[j++] = todelsys[i];
}
if (j < 16)
mci->fe.ops.delsys[j] = 0;
}
struct dvb_frontend *ddb_mci_attach(struct ddb_input *input, struct dvb_frontend *ddb_mci_attach(struct ddb_input *input,
struct mci_cfg *cfg, int nr, int tuner) struct mci_cfg *cfg, int nr,
int tuner, u8 flags)
{ {
struct ddb_port *port = input->port; struct ddb_port *port = input->port;
struct ddb *dev = port->dev; struct ddb *dev = port->dev;
@@ -440,6 +469,8 @@ struct dvb_frontend *ddb_mci_attach(struct ddb_input *input,
cfg->base_init(base); cfg->base_init(base);
} }
memcpy(&state->fe.ops, cfg->fe_ops, sizeof(struct dvb_frontend_ops)); memcpy(&state->fe.ops, cfg->fe_ops, sizeof(struct dvb_frontend_ops));
if (flags & 1)
adjust_caps(state);
state->fe.demodulator_priv = state; state->fe.demodulator_priv = state;
state->nr = nr; state->nr = nr;
state->demod = nr; state->demod = nr;

View File

@@ -659,5 +659,5 @@ struct dvb_frontend *ddb_sx8_attach(struct ddb_input *input, int nr, int tuner,
int (**fn_set_input)(struct dvb_frontend *fe, int input)) int (**fn_set_input)(struct dvb_frontend *fe, int input))
{ {
*fn_set_input = set_input; *fn_set_input = set_input;
return ddb_mci_attach(input, &ddb_max_sx8_cfg, nr, tuner); return ddb_mci_attach(input, &ddb_max_sx8_cfg, nr, tuner, 0);
} }

View File

@@ -580,7 +580,7 @@ int ddb_lnb_init_fmode(struct ddb *dev, struct ddb_link *link, u32 fm);
struct ddb_irq *ddb_irq_set(struct ddb *dev, u32 link, u32 nr, struct ddb_irq *ddb_irq_set(struct ddb *dev, u32 link, u32 nr,
void (*handler)(void *), void *data); void (*handler)(void *), void *data);
struct dvb_frontend *ddb_mci_attach(struct ddb_input *input, struct mci_cfg *cfg, int nr, int tuner); struct dvb_frontend *ddb_mci_attach(struct ddb_input *input, struct mci_cfg *cfg, int nr, int tuner, u8 flags);
struct dvb_frontend *ddb_sx8_attach(struct ddb_input *input, int nr, int tuner, struct dvb_frontend *ddb_sx8_attach(struct ddb_input *input, int nr, int tuner,
int (**fn_set_input)(struct dvb_frontend *fe, int input)); int (**fn_set_input)(struct dvb_frontend *fe, int input));
struct dvb_frontend *ddb_mx_attach(struct ddb_input *input, int nr, int tuner, int type); struct dvb_frontend *ddb_mx_attach(struct ddb_input *input, int nr, int tuner, int type);