Commit 5581e130 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] dvb: simplify get_tune_settings() struct

In the past, dvb_frontent_parameters were passed inside the
struct where get_tuner_settings should store their result.

This is not needed anymore, as all parameters needed are stored
already at the fe property cache. So, use it, where needed.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent b1e9a650
...@@ -1977,13 +1977,10 @@ static int dvb_frontend_ioctl_legacy(struct file *file, ...@@ -1977,13 +1977,10 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
fepriv->parameters_out = fepriv->parameters_in; fepriv->parameters_out = fepriv->parameters_in;
memset(&fetunesettings, 0, sizeof(struct dvb_frontend_tune_settings)); memset(&fetunesettings, 0, sizeof(struct dvb_frontend_tune_settings));
memcpy(&fetunesettings.parameters, parg,
sizeof (struct dvb_frontend_parameters));
/* force auto frequency inversion if requested */ /* force auto frequency inversion if requested */
if (dvb_force_auto_inversion) { if (dvb_force_auto_inversion) {
fepriv->parameters_in.inversion = INVERSION_AUTO; fepriv->parameters_in.inversion = INVERSION_AUTO;
fetunesettings.parameters.inversion = INVERSION_AUTO;
} }
if (fe->ops.info.type == FE_OFDM) { if (fe->ops.info.type == FE_OFDM) {
/* without hierarchical coding code_rate_LP is irrelevant, /* without hierarchical coding code_rate_LP is irrelevant,
......
...@@ -52,7 +52,6 @@ struct dvb_frontend_tune_settings { ...@@ -52,7 +52,6 @@ struct dvb_frontend_tune_settings {
int min_delay_ms; int min_delay_ms;
int step_size; int step_size;
int max_drift; int max_drift;
struct dvb_frontend_parameters parameters;
}; };
struct dvb_frontend; struct dvb_frontend;
......
...@@ -639,7 +639,6 @@ static int s5h1420_set_frontend(struct dvb_frontend *fe) ...@@ -639,7 +639,6 @@ static int s5h1420_set_frontend(struct dvb_frontend *fe)
dprintk("enter %s\n", __func__); dprintk("enter %s\n", __func__);
/* check if we should do a fast-tune */ /* check if we should do a fast-tune */
memcpy(&fesettings.parameters, p, sizeof(struct dtv_frontend_properties));
s5h1420_get_tune_settings(fe, &fesettings); s5h1420_get_tune_settings(fe, &fesettings);
frequency_delta = p->frequency - state->tunedfreq; frequency_delta = p->frequency - state->tunedfreq;
if ((frequency_delta > -fesettings.max_drift) && if ((frequency_delta > -fesettings.max_drift) &&
...@@ -782,29 +781,30 @@ static int s5h1420_get_frontend(struct dvb_frontend* fe, ...@@ -782,29 +781,30 @@ static int s5h1420_get_frontend(struct dvb_frontend* fe,
static int s5h1420_get_tune_settings(struct dvb_frontend* fe, static int s5h1420_get_tune_settings(struct dvb_frontend* fe,
struct dvb_frontend_tune_settings* fesettings) struct dvb_frontend_tune_settings* fesettings)
{ {
if (fesettings->parameters.u.qpsk.symbol_rate > 20000000) { struct dtv_frontend_properties *p = &fe->dtv_property_cache;
if (p->symbol_rate > 20000000) {
fesettings->min_delay_ms = 50; fesettings->min_delay_ms = 50;
fesettings->step_size = 2000; fesettings->step_size = 2000;
fesettings->max_drift = 8000; fesettings->max_drift = 8000;
} else if (fesettings->parameters.u.qpsk.symbol_rate > 12000000) { } else if (p->symbol_rate > 12000000) {
fesettings->min_delay_ms = 100; fesettings->min_delay_ms = 100;
fesettings->step_size = 1500; fesettings->step_size = 1500;
fesettings->max_drift = 9000; fesettings->max_drift = 9000;
} else if (fesettings->parameters.u.qpsk.symbol_rate > 8000000) { } else if (p->symbol_rate > 8000000) {
fesettings->min_delay_ms = 100; fesettings->min_delay_ms = 100;
fesettings->step_size = 1000; fesettings->step_size = 1000;
fesettings->max_drift = 8000; fesettings->max_drift = 8000;
} else if (fesettings->parameters.u.qpsk.symbol_rate > 4000000) { } else if (p->symbol_rate > 4000000) {
fesettings->min_delay_ms = 100; fesettings->min_delay_ms = 100;
fesettings->step_size = 500; fesettings->step_size = 500;
fesettings->max_drift = 7000; fesettings->max_drift = 7000;
} else if (fesettings->parameters.u.qpsk.symbol_rate > 2000000) { } else if (p->symbol_rate > 2000000) {
fesettings->min_delay_ms = 200; fesettings->min_delay_ms = 200;
fesettings->step_size = (fesettings->parameters.u.qpsk.symbol_rate / 8000); fesettings->step_size = (p->symbol_rate / 8000);
fesettings->max_drift = 14 * fesettings->step_size; fesettings->max_drift = 14 * fesettings->step_size;
} else { } else {
fesettings->min_delay_ms = 200; fesettings->min_delay_ms = 200;
fesettings->step_size = (fesettings->parameters.u.qpsk.symbol_rate / 8000); fesettings->step_size = (p->symbol_rate / 8000);
fesettings->max_drift = 18 * fesettings->step_size; fesettings->max_drift = 18 * fesettings->step_size;
} }
......
...@@ -647,14 +647,15 @@ static int stv0299_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) ...@@ -647,14 +647,15 @@ static int stv0299_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
static int stv0299_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) static int stv0299_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings)
{ {
struct stv0299_state* state = fe->demodulator_priv; struct stv0299_state* state = fe->demodulator_priv;
struct dtv_frontend_properties *p = &fe->dtv_property_cache;
fesettings->min_delay_ms = state->config->min_delay_ms; fesettings->min_delay_ms = state->config->min_delay_ms;
if (fesettings->parameters.u.qpsk.symbol_rate < 10000000) { if (p->symbol_rate < 10000000) {
fesettings->step_size = fesettings->parameters.u.qpsk.symbol_rate / 32000; fesettings->step_size = p->symbol_rate / 32000;
fesettings->max_drift = 5000; fesettings->max_drift = 5000;
} else { } else {
fesettings->step_size = fesettings->parameters.u.qpsk.symbol_rate / 16000; fesettings->step_size = p->symbol_rate / 16000;
fesettings->max_drift = fesettings->parameters.u.qpsk.symbol_rate / 2000; fesettings->max_drift = p->symbol_rate / 2000;
} }
return 0; return 0;
} }
......
...@@ -664,29 +664,31 @@ static int tda10086_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) ...@@ -664,29 +664,31 @@ static int tda10086_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
static int tda10086_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) static int tda10086_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings)
{ {
if (fesettings->parameters.u.qpsk.symbol_rate > 20000000) { struct dtv_frontend_properties *p = &fe->dtv_property_cache;
if (p->symbol_rate > 20000000) {
fesettings->min_delay_ms = 50; fesettings->min_delay_ms = 50;
fesettings->step_size = 2000; fesettings->step_size = 2000;
fesettings->max_drift = 8000; fesettings->max_drift = 8000;
} else if (fesettings->parameters.u.qpsk.symbol_rate > 12000000) { } else if (p->symbol_rate > 12000000) {
fesettings->min_delay_ms = 100; fesettings->min_delay_ms = 100;
fesettings->step_size = 1500; fesettings->step_size = 1500;
fesettings->max_drift = 9000; fesettings->max_drift = 9000;
} else if (fesettings->parameters.u.qpsk.symbol_rate > 8000000) { } else if (p->symbol_rate > 8000000) {
fesettings->min_delay_ms = 100; fesettings->min_delay_ms = 100;
fesettings->step_size = 1000; fesettings->step_size = 1000;
fesettings->max_drift = 8000; fesettings->max_drift = 8000;
} else if (fesettings->parameters.u.qpsk.symbol_rate > 4000000) { } else if (p->symbol_rate > 4000000) {
fesettings->min_delay_ms = 100; fesettings->min_delay_ms = 100;
fesettings->step_size = 500; fesettings->step_size = 500;
fesettings->max_drift = 7000; fesettings->max_drift = 7000;
} else if (fesettings->parameters.u.qpsk.symbol_rate > 2000000) { } else if (p->symbol_rate > 2000000) {
fesettings->min_delay_ms = 200; fesettings->min_delay_ms = 200;
fesettings->step_size = (fesettings->parameters.u.qpsk.symbol_rate / 8000); fesettings->step_size = p->symbol_rate / 8000;
fesettings->max_drift = 14 * fesettings->step_size; fesettings->max_drift = 14 * fesettings->step_size;
} else { } else {
fesettings->min_delay_ms = 200; fesettings->min_delay_ms = 200;
fesettings->step_size = (fesettings->parameters.u.qpsk.symbol_rate / 8000); fesettings->step_size = p->symbol_rate / 8000;
fesettings->max_drift = 18 * fesettings->step_size; fesettings->max_drift = 18 * fesettings->step_size;
} }
......
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