[media] Remove Annex A/C selection via roll-off factor
Instead of using a roll-off factor, change DRX-K & friends to select the bandwidth filter and the Nyquist half roll-off via delivery system. This provides a cleaner support for Annex A/C switch. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Родитель
669a4ba44d
Коммит
fd66c45dd5
|
@ -629,11 +629,13 @@ static void xc_debug_dump(struct xc5000_priv *priv)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xc5000_set_params(struct dvb_frontend *fe,
|
static int xc5000_set_params(struct dvb_frontend *fe,
|
||||||
struct dvb_frontend_parameters *params)
|
struct dvb_frontend_parameters *params)
|
||||||
{
|
{
|
||||||
|
int ret, b;
|
||||||
struct xc5000_priv *priv = fe->tuner_priv;
|
struct xc5000_priv *priv = fe->tuner_priv;
|
||||||
int ret;
|
u32 bw = fe->dtv_property_cache.bandwidth_hz;
|
||||||
u32 bw;
|
u32 freq = fe->dtv_property_cache.frequency;
|
||||||
|
u32 delsys = fe->dtv_property_cache.delivery_system;
|
||||||
|
|
||||||
if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) {
|
if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) {
|
||||||
if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) {
|
if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) {
|
||||||
|
@ -642,104 +644,77 @@ static int xc5000_set_params(struct dvb_frontend *fe,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency);
|
dprintk(1, "%s() frequency=%d (Hz)\n", __func__, freq);
|
||||||
|
|
||||||
if (fe->ops.info.type == FE_ATSC) {
|
switch (delsys) {
|
||||||
dprintk(1, "%s() ATSC\n", __func__);
|
case SYS_ATSC:
|
||||||
switch (params->u.vsb.modulation) {
|
dprintk(1, "%s() VSB modulation\n", __func__);
|
||||||
case VSB_8:
|
priv->rf_mode = XC_RF_MODE_AIR;
|
||||||
case VSB_16:
|
priv->freq_hz = freq - 1750000;
|
||||||
dprintk(1, "%s() VSB modulation\n", __func__);
|
priv->bandwidth = BANDWIDTH_6_MHZ;
|
||||||
priv->rf_mode = XC_RF_MODE_AIR;
|
priv->video_standard = DTV6;
|
||||||
priv->freq_hz = params->frequency - 1750000;
|
break;
|
||||||
priv->bandwidth = BANDWIDTH_6_MHZ;
|
case SYS_DVBC_ANNEX_B:
|
||||||
priv->video_standard = DTV6;
|
dprintk(1, "%s() QAM modulation\n", __func__);
|
||||||
break;
|
priv->rf_mode = XC_RF_MODE_CABLE;
|
||||||
case QAM_64:
|
priv->freq_hz = freq - 1750000;
|
||||||
case QAM_256:
|
priv->bandwidth = BANDWIDTH_6_MHZ;
|
||||||
case QAM_AUTO:
|
priv->video_standard = DTV6;
|
||||||
dprintk(1, "%s() QAM modulation\n", __func__);
|
break;
|
||||||
priv->rf_mode = XC_RF_MODE_CABLE;
|
case SYS_DVBT:
|
||||||
priv->freq_hz = params->frequency - 1750000;
|
case SYS_DVBT2:
|
||||||
priv->bandwidth = BANDWIDTH_6_MHZ;
|
|
||||||
priv->video_standard = DTV6;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
} else if (fe->ops.info.type == FE_OFDM) {
|
|
||||||
dprintk(1, "%s() OFDM\n", __func__);
|
dprintk(1, "%s() OFDM\n", __func__);
|
||||||
switch (params->u.ofdm.bandwidth) {
|
switch (bw) {
|
||||||
case BANDWIDTH_6_MHZ:
|
case 6000000:
|
||||||
priv->bandwidth = BANDWIDTH_6_MHZ;
|
priv->bandwidth = BANDWIDTH_6_MHZ;
|
||||||
priv->video_standard = DTV6;
|
priv->video_standard = DTV6;
|
||||||
priv->freq_hz = params->frequency - 1750000;
|
priv->freq_hz = freq - 1750000;
|
||||||
break;
|
break;
|
||||||
case BANDWIDTH_7_MHZ:
|
case 7000000:
|
||||||
priv->bandwidth = BANDWIDTH_7_MHZ;
|
priv->bandwidth = BANDWIDTH_7_MHZ;
|
||||||
priv->video_standard = DTV7;
|
priv->video_standard = DTV7;
|
||||||
priv->freq_hz = params->frequency - 2250000;
|
priv->freq_hz = freq - 2250000;
|
||||||
break;
|
break;
|
||||||
case BANDWIDTH_8_MHZ:
|
case 8000000:
|
||||||
priv->bandwidth = BANDWIDTH_8_MHZ;
|
priv->bandwidth = BANDWIDTH_8_MHZ;
|
||||||
priv->video_standard = DTV8;
|
priv->video_standard = DTV8;
|
||||||
priv->freq_hz = params->frequency - 2750000;
|
priv->freq_hz = freq - 2750000;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printk(KERN_ERR "xc5000 bandwidth not set!\n");
|
printk(KERN_ERR "xc5000 bandwidth not set!\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
priv->rf_mode = XC_RF_MODE_AIR;
|
priv->rf_mode = XC_RF_MODE_AIR;
|
||||||
} else if (fe->ops.info.type == FE_QAM) {
|
case SYS_DVBC_ANNEX_A:
|
||||||
switch (params->u.qam.modulation) {
|
case SYS_DVBC_ANNEX_C:
|
||||||
case QAM_256:
|
dprintk(1, "%s() QAM modulation\n", __func__);
|
||||||
case QAM_AUTO:
|
priv->rf_mode = XC_RF_MODE_CABLE;
|
||||||
case QAM_16:
|
if (bw <= 6000000) {
|
||||||
case QAM_32:
|
priv->bandwidth = BANDWIDTH_6_MHZ;
|
||||||
case QAM_64:
|
priv->video_standard = DTV6;
|
||||||
case QAM_128:
|
priv->freq_hz = freq - 1750000;
|
||||||
dprintk(1, "%s() QAM modulation\n", __func__);
|
b = 6;
|
||||||
priv->rf_mode = XC_RF_MODE_CABLE;
|
} else if (bw <= 7000000) {
|
||||||
/*
|
priv->bandwidth = BANDWIDTH_7_MHZ;
|
||||||
* Using a higher bandwidth at the tuner filter may
|
priv->video_standard = DTV7;
|
||||||
* allow inter-carrier interference.
|
priv->freq_hz = freq - 2250000;
|
||||||
* So, determine the minimal channel spacing, in order
|
b = 7;
|
||||||
* to better adjust the tuner filter.
|
} else {
|
||||||
* According with ITU-T J.83, the bandwidth is given by:
|
priv->bandwidth = BANDWIDTH_8_MHZ;
|
||||||
* bw = Simbol Rate * (1 + roll_off), where the roll_off
|
priv->video_standard = DTV7_8;
|
||||||
* is equal to 0.15 for Annex A, and 0.13 for annex C
|
priv->freq_hz = freq - 2750000;
|
||||||
*/
|
b = 8;
|
||||||
if (fe->dtv_property_cache.rolloff == ROLLOFF_13)
|
|
||||||
bw = (params->u.qam.symbol_rate * 113) / 100;
|
|
||||||
else
|
|
||||||
bw = (params->u.qam.symbol_rate * 115) / 100;
|
|
||||||
if (bw <= 6000000) {
|
|
||||||
priv->bandwidth = BANDWIDTH_6_MHZ;
|
|
||||||
priv->video_standard = DTV6;
|
|
||||||
priv->freq_hz = params->frequency - 1750000;
|
|
||||||
} else if (bw <= 7000000) {
|
|
||||||
priv->bandwidth = BANDWIDTH_7_MHZ;
|
|
||||||
priv->video_standard = DTV7;
|
|
||||||
priv->freq_hz = params->frequency - 2250000;
|
|
||||||
} else {
|
|
||||||
priv->bandwidth = BANDWIDTH_8_MHZ;
|
|
||||||
priv->video_standard = DTV7_8;
|
|
||||||
priv->freq_hz = params->frequency - 2750000;
|
|
||||||
}
|
|
||||||
dprintk(1, "%s() Bandwidth %dMHz (%d)\n", __func__,
|
|
||||||
BANDWIDTH_6_MHZ ? 6: 8, bw);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
dprintk(1, "%s() Unsupported QAM type\n", __func__);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
} else {
|
dprintk(1, "%s() Bandwidth %dMHz (%d)\n", __func__,
|
||||||
printk(KERN_ERR "xc5000 modulation type not supported!\n");
|
b, bw);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printk(KERN_ERR "xc5000: delivery system is not supported!\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintk(1, "%s() frequency=%d (compensated)\n",
|
dprintk(1, "%s() frequency=%d (compensated to %d)\n",
|
||||||
__func__, priv->freq_hz);
|
__func__, freq, priv->freq_hz);
|
||||||
|
|
||||||
ret = xc_SetSignalSource(priv, priv->rf_mode);
|
ret = xc_SetSignalSource(priv, priv->rf_mode);
|
||||||
if (ret != XC_RESULT_SUCCESS) {
|
if (ret != XC_RESULT_SUCCESS) {
|
||||||
|
|
|
@ -1011,7 +1011,7 @@ static void dtv_property_dump(struct dtv_property *tvp)
|
||||||
|
|
||||||
static int is_legacy_delivery_system(fe_delivery_system_t s)
|
static int is_legacy_delivery_system(fe_delivery_system_t s)
|
||||||
{
|
{
|
||||||
if((s == SYS_UNDEFINED) || (s == SYS_DVBC_ANNEX_AC) ||
|
if((s == SYS_UNDEFINED) || (s == SYS_DVBC_ANNEX_A) ||
|
||||||
(s == SYS_DVBC_ANNEX_B) || (s == SYS_DVBT) || (s == SYS_DVBS) ||
|
(s == SYS_DVBC_ANNEX_B) || (s == SYS_DVBT) || (s == SYS_DVBS) ||
|
||||||
(s == SYS_ATSC))
|
(s == SYS_ATSC))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1032,8 +1032,7 @@ static void dtv_property_cache_init(struct dvb_frontend *fe,
|
||||||
c->delivery_system = SYS_DVBS;
|
c->delivery_system = SYS_DVBS;
|
||||||
break;
|
break;
|
||||||
case FE_QAM:
|
case FE_QAM:
|
||||||
c->delivery_system = SYS_DVBC_ANNEX_AC;
|
c->delivery_system = SYS_DVBC_ANNEX_A;
|
||||||
c->rolloff = ROLLOFF_15; /* implied for Annex A */
|
|
||||||
break;
|
break;
|
||||||
case FE_OFDM:
|
case FE_OFDM:
|
||||||
c->delivery_system = SYS_DVBT;
|
c->delivery_system = SYS_DVBT;
|
||||||
|
@ -1144,9 +1143,10 @@ static void dtv_property_legacy_params_sync(struct dvb_frontend *fe)
|
||||||
*/
|
*/
|
||||||
static void dtv_property_adv_params_sync(struct dvb_frontend *fe)
|
static void dtv_property_adv_params_sync(struct dvb_frontend *fe)
|
||||||
{
|
{
|
||||||
const struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
||||||
struct dvb_frontend_private *fepriv = fe->frontend_priv;
|
struct dvb_frontend_private *fepriv = fe->frontend_priv;
|
||||||
struct dvb_frontend_parameters *p = &fepriv->parameters_in;
|
struct dvb_frontend_parameters *p = &fepriv->parameters_in;
|
||||||
|
u32 rolloff = 0;
|
||||||
|
|
||||||
p->frequency = c->frequency;
|
p->frequency = c->frequency;
|
||||||
p->inversion = c->inversion;
|
p->inversion = c->inversion;
|
||||||
|
@ -1178,6 +1178,23 @@ static void dtv_property_adv_params_sync(struct dvb_frontend *fe)
|
||||||
else
|
else
|
||||||
p->u.ofdm.bandwidth = BANDWIDTH_AUTO;
|
p->u.ofdm.bandwidth = BANDWIDTH_AUTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* On DVB-C, the bandwidth is a function of roll-off and symbol rate.
|
||||||
|
* The bandwidth is required for DVB-C tuners, in order to avoid
|
||||||
|
* inter-channel noise. Instead of estimating the minimal required
|
||||||
|
* bandwidth on every single driver, calculates it here and fills
|
||||||
|
* it at the cache bandwidth parameter.
|
||||||
|
* While not officially supported, a side effect of handling it at
|
||||||
|
* the cache level is that a program could retrieve the bandwidth
|
||||||
|
* via DTV_BANDWIDTH_HZ, wich may be useful for test programs.
|
||||||
|
*/
|
||||||
|
if (c->delivery_system == SYS_DVBC_ANNEX_A)
|
||||||
|
rolloff = 115;
|
||||||
|
if (c->delivery_system == SYS_DVBC_ANNEX_C)
|
||||||
|
rolloff = 113;
|
||||||
|
if (rolloff)
|
||||||
|
c->bandwidth_hz = (c->symbol_rate * rolloff) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dtv_property_cache_submit(struct dvb_frontend *fe)
|
static void dtv_property_cache_submit(struct dvb_frontend *fe)
|
||||||
|
|
|
@ -6215,6 +6215,7 @@ static int drxk_set_parameters(struct dvb_frontend *fe,
|
||||||
struct dvb_frontend_parameters *p)
|
struct dvb_frontend_parameters *p)
|
||||||
{
|
{
|
||||||
struct drxk_state *state = fe->demodulator_priv;
|
struct drxk_state *state = fe->demodulator_priv;
|
||||||
|
u32 delsys = fe->dtv_property_cache.delivery_system;
|
||||||
u32 IF;
|
u32 IF;
|
||||||
|
|
||||||
dprintk(1, "\n");
|
dprintk(1, "\n");
|
||||||
|
@ -6225,11 +6226,15 @@ static int drxk_set_parameters(struct dvb_frontend *fe,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fe->ops.info.type == FE_QAM) {
|
switch (delsys) {
|
||||||
if (fe->dtv_property_cache.rolloff == ROLLOFF_13)
|
case SYS_DVBC_ANNEX_A:
|
||||||
state->m_itut_annex_c = true;
|
state->m_itut_annex_c = false;
|
||||||
else
|
break;
|
||||||
state->m_itut_annex_c = false;
|
case SYS_DVBC_ANNEX_C:
|
||||||
|
state->m_itut_annex_c = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fe->ops.i2c_gate_ctrl)
|
if (fe->ops.i2c_gate_ctrl)
|
||||||
|
|
|
@ -1130,50 +1130,44 @@ static int set_params(struct dvb_frontend *fe,
|
||||||
struct tda_state *state = fe->tuner_priv;
|
struct tda_state *state = fe->tuner_priv;
|
||||||
int status = 0;
|
int status = 0;
|
||||||
int Standard;
|
int Standard;
|
||||||
u32 bw;
|
u32 bw = fe->dtv_property_cache.bandwidth_hz;
|
||||||
|
u32 delsys = fe->dtv_property_cache.delivery_system;
|
||||||
|
|
||||||
state->m_Frequency = params->frequency;
|
state->m_Frequency = fe->dtv_property_cache.frequency;
|
||||||
|
|
||||||
if (fe->ops.info.type == FE_OFDM)
|
switch (delsys) {
|
||||||
switch (params->u.ofdm.bandwidth) {
|
case SYS_DVBT:
|
||||||
case BANDWIDTH_6_MHZ:
|
case SYS_DVBT2:
|
||||||
|
switch (bw) {
|
||||||
|
case 6000000:
|
||||||
Standard = HF_DVBT_6MHZ;
|
Standard = HF_DVBT_6MHZ;
|
||||||
break;
|
break;
|
||||||
case BANDWIDTH_7_MHZ:
|
case 7000000:
|
||||||
Standard = HF_DVBT_7MHZ;
|
Standard = HF_DVBT_7MHZ;
|
||||||
break;
|
break;
|
||||||
default:
|
case 8000000:
|
||||||
case BANDWIDTH_8_MHZ:
|
|
||||||
Standard = HF_DVBT_8MHZ;
|
Standard = HF_DVBT_8MHZ;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
else if (fe->ops.info.type == FE_QAM) {
|
case SYS_DVBC_ANNEX_A:
|
||||||
/*
|
case SYS_DVBC_ANNEX_C:
|
||||||
* Using a higher bandwidth at the tuner filter may
|
|
||||||
* allow inter-carrier interference.
|
|
||||||
* So, determine the minimal channel spacing, in order
|
|
||||||
* to better adjust the tuner filter.
|
|
||||||
* According with ITU-T J.83, the bandwidth is given by:
|
|
||||||
* bw = Simbol Rate * (1 + roll_off), where the roll_off
|
|
||||||
* is equal to 0.15 for Annex A, and 0.13 for annex C
|
|
||||||
*/
|
|
||||||
if (fe->dtv_property_cache.rolloff == ROLLOFF_13)
|
|
||||||
bw = (params->u.qam.symbol_rate * 113) / 100;
|
|
||||||
else
|
|
||||||
bw = (params->u.qam.symbol_rate * 115) / 100;
|
|
||||||
if (bw <= 6000000)
|
if (bw <= 6000000)
|
||||||
Standard = HF_DVBC_6MHZ;
|
Standard = HF_DVBC_6MHZ;
|
||||||
else if (bw <= 7000000)
|
else if (bw <= 7000000)
|
||||||
Standard = HF_DVBC_7MHZ;
|
Standard = HF_DVBC_7MHZ;
|
||||||
else
|
else
|
||||||
Standard = HF_DVBC_8MHZ;
|
Standard = HF_DVBC_8MHZ;
|
||||||
} else
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
do {
|
do {
|
||||||
status = RFTrackingFiltersCorrection(state, params->frequency);
|
status = RFTrackingFiltersCorrection(state, state->m_Frequency);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
break;
|
break;
|
||||||
status = ChannelConfiguration(state, params->frequency, Standard);
|
status = ChannelConfiguration(state, state->m_Frequency,
|
||||||
|
Standard);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -331,8 +331,6 @@ typedef enum fe_rolloff {
|
||||||
ROLLOFF_20,
|
ROLLOFF_20,
|
||||||
ROLLOFF_25,
|
ROLLOFF_25,
|
||||||
ROLLOFF_AUTO,
|
ROLLOFF_AUTO,
|
||||||
ROLLOFF_15, /* DVB-C Annex A */
|
|
||||||
ROLLOFF_13, /* DVB-C Annex C */
|
|
||||||
} fe_rolloff_t;
|
} fe_rolloff_t;
|
||||||
|
|
||||||
typedef enum fe_delivery_system {
|
typedef enum fe_delivery_system {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче