diff --git a/ddbridge/ddbridge-modulator.c b/ddbridge/ddbridge-modulator.c index 5b41b61..dd19996 100644 --- a/ddbridge/ddbridge-modulator.c +++ b/ddbridge/ddbridge-modulator.c @@ -1477,12 +1477,46 @@ static int mod3_set_ari(struct ddb_mod *mod, u32 rate) } +static int mod3_set_sample_rate(struct ddb_mod *mod, u32 rate) +{ + u32 cic, inc; + + switch (rate) { + case SYS_DVBT_6: + inc = 1917396114; + cic = 8; + break; + case SYS_DVBT_7: + inc = 1957341867; + cic = 7; + break; + case SYS_DVBT_8: + //rate = 8126984; + inc = 1917396114; + cic = 6; + break; + case SYS_ISDBT_6: + inc = 1988410754; + cic = 7; + break; + default: + return -EINVAL; + } + ddbwritel(mod->port->dev, inc, SDR_CHANNEL_ARICW(mod->port->nr)); + ddbwritel(mod->port->dev, cic << 8, SDR_CHANNEL_CONFIG(mod->port->nr)); + return 0; +} + + static int mod3_prop_proc(struct ddb_mod *mod, struct dtv_property *tvp) { switch (tvp->cmd) { case MODULATOR_OUTPUT_ARI: return mod3_set_ari(mod, tvp->u.data); + case MODULATOR_OUTPUT_RATE: + return mod3_set_sample_rate(mod, tvp->u.data); + case MODULATOR_FREQUENCY: return mod3_set_frequency(mod, tvp->u.data); @@ -1550,6 +1584,9 @@ static int mod_prop_get3(struct ddb_mod *mod, struct dtv_property *tvp) case MODULATOR_INFO: tvp->u.data = dev->link[0].info->version; return 0; + case MODULATOR_GAIN: + tvp->u.data = 0xff & ddbreadl(dev, RF_VGA); + return 0; default: return -1; } @@ -1569,7 +1606,7 @@ static int mod_prop_get(struct ddb_mod *mod, struct dtv_property *tvp) return 0; case MODULATOR_GAIN: - tvp->u.data = 0xff & ddbreadl(dev, RF_VGA);; + tvp->u.data = 0xff & ddbreadl(dev, RF_VGA); return 0; case MODULATOR_ATTENUATOR: