media: dvb_frontend: move algo-specific settings to a function
As we're planning to call this code from somewhere else, let's first move it to its own function. Link: https://lore.kernel.org/linux-media/daa69edd80e7fcf979062273f3067cb7b5573d52.1592419750.git.mchehab+huawei@kernel.org Reviewed-by: Marc Gonzalez <marc.w.gonzalez@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
bb5d418076
commit
d6af27c3a6
@ -1791,6 +1791,53 @@ static int dvbv3_set_delivery_system(struct dvb_frontend *fe)
|
|||||||
return emulate_delivery_system(fe, delsys);
|
return emulate_delivery_system(fe, delsys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void prepare_tuning_algo_parameters(struct dvb_frontend *fe)
|
||||||
|
{
|
||||||
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
||||||
|
struct dvb_frontend_private *fepriv = fe->frontend_priv;
|
||||||
|
struct dvb_frontend_tune_settings fetunesettings = { 0 };
|
||||||
|
|
||||||
|
/* get frontend-specific tuning settings */
|
||||||
|
if (fe->ops.get_tune_settings && (fe->ops.get_tune_settings(fe, &fetunesettings) == 0)) {
|
||||||
|
fepriv->min_delay = (fetunesettings.min_delay_ms * HZ) / 1000;
|
||||||
|
fepriv->max_drift = fetunesettings.max_drift;
|
||||||
|
fepriv->step_size = fetunesettings.step_size;
|
||||||
|
} else {
|
||||||
|
/* default values */
|
||||||
|
switch (c->delivery_system) {
|
||||||
|
case SYS_DVBS:
|
||||||
|
case SYS_DVBS2:
|
||||||
|
case SYS_ISDBS:
|
||||||
|
case SYS_TURBO:
|
||||||
|
case SYS_DVBC_ANNEX_A:
|
||||||
|
case SYS_DVBC_ANNEX_C:
|
||||||
|
fepriv->min_delay = HZ / 20;
|
||||||
|
fepriv->step_size = c->symbol_rate / 16000;
|
||||||
|
fepriv->max_drift = c->symbol_rate / 2000;
|
||||||
|
break;
|
||||||
|
case SYS_DVBT:
|
||||||
|
case SYS_DVBT2:
|
||||||
|
case SYS_ISDBT:
|
||||||
|
case SYS_DTMB:
|
||||||
|
fepriv->min_delay = HZ / 20;
|
||||||
|
fepriv->step_size = dvb_frontend_get_stepsize(fe) * 2;
|
||||||
|
fepriv->max_drift = (dvb_frontend_get_stepsize(fe) * 2) + 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/*
|
||||||
|
* FIXME: This sounds wrong! if freqency_stepsize is
|
||||||
|
* defined by the frontend, why not use it???
|
||||||
|
*/
|
||||||
|
fepriv->min_delay = HZ / 20;
|
||||||
|
fepriv->step_size = 0; /* no zigzag */
|
||||||
|
fepriv->max_drift = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (dvb_override_tune_delay > 0)
|
||||||
|
fepriv->min_delay = (dvb_override_tune_delay * HZ) / 1000;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dtv_property_process_set - Sets a single DTV property
|
* dtv_property_process_set - Sets a single DTV property
|
||||||
* @fe: Pointer to &struct dvb_frontend
|
* @fe: Pointer to &struct dvb_frontend
|
||||||
@ -2183,7 +2230,6 @@ static int dtv_set_frontend(struct dvb_frontend *fe)
|
|||||||
{
|
{
|
||||||
struct dvb_frontend_private *fepriv = fe->frontend_priv;
|
struct dvb_frontend_private *fepriv = fe->frontend_priv;
|
||||||
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
|
||||||
struct dvb_frontend_tune_settings fetunesettings;
|
|
||||||
u32 rolloff = 0;
|
u32 rolloff = 0;
|
||||||
|
|
||||||
if (dvb_frontend_check_parameters(fe) < 0)
|
if (dvb_frontend_check_parameters(fe) < 0)
|
||||||
@ -2261,46 +2307,7 @@ static int dtv_set_frontend(struct dvb_frontend *fe)
|
|||||||
if (c->hierarchy == HIERARCHY_NONE && c->code_rate_LP == FEC_NONE)
|
if (c->hierarchy == HIERARCHY_NONE && c->code_rate_LP == FEC_NONE)
|
||||||
c->code_rate_LP = FEC_AUTO;
|
c->code_rate_LP = FEC_AUTO;
|
||||||
|
|
||||||
/* get frontend-specific tuning settings */
|
prepare_tuning_algo_parameters(fe);
|
||||||
memset(&fetunesettings, 0, sizeof(struct dvb_frontend_tune_settings));
|
|
||||||
if (fe->ops.get_tune_settings && (fe->ops.get_tune_settings(fe, &fetunesettings) == 0)) {
|
|
||||||
fepriv->min_delay = (fetunesettings.min_delay_ms * HZ) / 1000;
|
|
||||||
fepriv->max_drift = fetunesettings.max_drift;
|
|
||||||
fepriv->step_size = fetunesettings.step_size;
|
|
||||||
} else {
|
|
||||||
/* default values */
|
|
||||||
switch (c->delivery_system) {
|
|
||||||
case SYS_DVBS:
|
|
||||||
case SYS_DVBS2:
|
|
||||||
case SYS_ISDBS:
|
|
||||||
case SYS_TURBO:
|
|
||||||
case SYS_DVBC_ANNEX_A:
|
|
||||||
case SYS_DVBC_ANNEX_C:
|
|
||||||
fepriv->min_delay = HZ / 20;
|
|
||||||
fepriv->step_size = c->symbol_rate / 16000;
|
|
||||||
fepriv->max_drift = c->symbol_rate / 2000;
|
|
||||||
break;
|
|
||||||
case SYS_DVBT:
|
|
||||||
case SYS_DVBT2:
|
|
||||||
case SYS_ISDBT:
|
|
||||||
case SYS_DTMB:
|
|
||||||
fepriv->min_delay = HZ / 20;
|
|
||||||
fepriv->step_size = dvb_frontend_get_stepsize(fe) * 2;
|
|
||||||
fepriv->max_drift = (dvb_frontend_get_stepsize(fe) * 2) + 1;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
/*
|
|
||||||
* FIXME: This sounds wrong! if freqency_stepsize is
|
|
||||||
* defined by the frontend, why not use it???
|
|
||||||
*/
|
|
||||||
fepriv->min_delay = HZ / 20;
|
|
||||||
fepriv->step_size = 0; /* no zigzag */
|
|
||||||
fepriv->max_drift = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (dvb_override_tune_delay > 0)
|
|
||||||
fepriv->min_delay = (dvb_override_tune_delay * HZ) / 1000;
|
|
||||||
|
|
||||||
fepriv->state = FESTATE_RETUNE;
|
fepriv->state = FESTATE_RETUNE;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user