Commit 3f400925 authored by Manu Abraham's avatar Manu Abraham Committed by Mauro Carvalho Chehab

V4L/DVB (9469): Port STB0899 and STB6100

Signed-off-by: default avatarManu Abraham <manu@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 9bb17eee
...@@ -293,7 +293,7 @@ static enum stb0899_status stb0899_search_carrier(struct stb0899_state *state) ...@@ -293,7 +293,7 @@ static enum stb0899_status stb0899_search_carrier(struct stb0899_state *state)
if (stb0899_check_carrier(state) == NOCARRIER) { if (stb0899_check_carrier(state) == NOCARRIER) {
index++; index++;
last_derot_freq = derot_freq; last_derot_freq = derot_freq;
derot_freq += index * internal->direction * internal->derot_step; /* next zig zag derotator position */ derot_freq += index * internal->direction * internal->derot_step; /* next zig zag derotator position */
if(ABS(derot_freq) > derot_limit) if(ABS(derot_freq) > derot_limit)
next_loop--; next_loop--;
...@@ -309,11 +309,11 @@ static enum stb0899_status stb0899_search_carrier(struct stb0899_state *state) ...@@ -309,11 +309,11 @@ static enum stb0899_status stb0899_search_carrier(struct stb0899_state *state)
} }
} }
internal->direction = -internal->direction; /* Change zigzag direction */ internal->direction = -internal->direction; /* Change zigzag direction */
} while ((internal->status != CARRIEROK) && next_loop); } while ((internal->status != CARRIEROK) && next_loop);
if (internal->status == CARRIEROK) { if (internal->status == CARRIEROK) {
stb0899_read_regs(state, STB0899_CFRM, cfr, 2); /* get derotator frequency */ stb0899_read_regs(state, STB0899_CFRM, cfr, 2); /* get derotator frequency */
internal->derot_freq = state->config->inversion * MAKEWORD16(cfr[0], cfr[1]); internal->derot_freq = state->config->inversion * MAKEWORD16(cfr[0], cfr[1]);
dprintk(state->verbose, FE_DEBUG, 1, "----> CARRIER OK !, Derot Freq=%d", internal->derot_freq); dprintk(state->verbose, FE_DEBUG, 1, "----> CARRIER OK !, Derot Freq=%d", internal->derot_freq);
} else { } else {
...@@ -396,7 +396,7 @@ static enum stb0899_status stb0899_search_data(struct stb0899_state *state) ...@@ -396,7 +396,7 @@ static enum stb0899_status stb0899_search_data(struct stb0899_state *state)
do { do {
if ((internal->status != CARRIEROK) || (stb0899_check_data(state) != DATAOK)) { if ((internal->status != CARRIEROK) || (stb0899_check_data(state) != DATAOK)) {
derot_freq += index * internal->direction * derot_step; /* next zig zag derotator position */ derot_freq += index * internal->direction * derot_step; /* next zig zag derotator position */
if (ABS(derot_freq) > derot_limit) if (ABS(derot_freq) > derot_limit)
next_loop--; next_loop--;
...@@ -414,11 +414,11 @@ static enum stb0899_status stb0899_search_data(struct stb0899_state *state) ...@@ -414,11 +414,11 @@ static enum stb0899_status stb0899_search_data(struct stb0899_state *state)
index++; index++;
} }
} }
internal->direction = -internal->direction; /* change zig zag direction */ internal->direction = -internal->direction; /* change zig zag direction */
} while ((internal->status != DATAOK) && next_loop); } while ((internal->status != DATAOK) && next_loop);
if (internal->status == DATAOK) { if (internal->status == DATAOK) {
stb0899_read_regs(state, STB0899_CFRM, cfr, 2); /* get derotator frequency */ stb0899_read_regs(state, STB0899_CFRM, cfr, 2); /* get derotator frequency */
internal->derot_freq = state->config->inversion * MAKEWORD16(cfr[0], cfr[1]); internal->derot_freq = state->config->inversion * MAKEWORD16(cfr[0], cfr[1]);
dprintk(state->verbose, FE_DEBUG, 1, "------> DATAOK ! Derot Freq=%d", internal->derot_freq); dprintk(state->verbose, FE_DEBUG, 1, "------> DATAOK ! Derot Freq=%d", internal->derot_freq);
} }
...@@ -568,12 +568,12 @@ enum stb0899_status stb0899_dvbs_algo(struct stb0899_state *state) ...@@ -568,12 +568,12 @@ enum stb0899_status stb0899_dvbs_algo(struct stb0899_state *state)
STB0899_SETFIELD_VAL(DEMAPVIT_KDIVIDER, reg, 60); STB0899_SETFIELD_VAL(DEMAPVIT_KDIVIDER, reg, 60);
stb0899_write_reg(state, STB0899_DEMAPVIT, reg); stb0899_write_reg(state, STB0899_DEMAPVIT, reg);
stb0899_write_reg(state, STB0899_EQON, 0x01); /* Equalizer OFF while acquiring */ stb0899_write_reg(state, STB0899_EQON, 0x01); /* Equalizer OFF while acquiring */
stb0899_write_reg(state, STB0899_VITSYNC, 0x19); stb0899_write_reg(state, STB0899_VITSYNC, 0x19);
stb0899_first_subrange(state); stb0899_first_subrange(state);
do { do {
/* Initialisations */ /* Initialisations */
cfr[0] = cfr[1] = 0; cfr[0] = cfr[1] = 0;
stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* RESET derotator frequency */ stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* RESET derotator frequency */
...@@ -588,7 +588,7 @@ enum stb0899_status stb0899_dvbs_algo(struct stb0899_state *state) ...@@ -588,7 +588,7 @@ enum stb0899_status stb0899_dvbs_algo(struct stb0899_state *state)
/* enable tuner I/O */ /* enable tuner I/O */
stb0899_i2c_gate_ctrl(&state->frontend, 1); stb0899_i2c_gate_ctrl(&state->frontend, 1);
/* Move tuner to frequency */ /* Move tuner to frequency */
dprintk(state->verbose, FE_DEBUG, 1, "Tuner set frequency"); dprintk(state->verbose, FE_DEBUG, 1, "Tuner set frequency");
if (state->config->tuner_set_frequency) if (state->config->tuner_set_frequency)
state->config->tuner_set_frequency(&state->frontend, internal->freq); state->config->tuner_set_frequency(&state->frontend, internal->freq);
......
This diff is collapsed.
...@@ -160,7 +160,7 @@ enum stb0899_fec { ...@@ -160,7 +160,7 @@ enum stb0899_fec {
struct stb0899_params { struct stb0899_params {
u32 freq; /* Frequency */ u32 freq; /* Frequency */
u32 srate; /* Symbol rate */ u32 srate; /* Symbol rate */
enum dvbfe_fec fecrate; enum fe_code_rate fecrate;
}; };
struct stb0899_internal { struct stb0899_internal {
...@@ -220,7 +220,7 @@ struct stb0899_state { ...@@ -220,7 +220,7 @@ struct stb0899_state {
struct stb0899_internal internal; /* Device internal parameters */ struct stb0899_internal internal; /* Device internal parameters */
/* cached params from API */ /* cached params from API */
enum dvbfe_delsys delsys; enum fe_delivery_system delsys;
struct stb0899_params params; struct stb0899_params params;
u32 rx_freq; /* DiSEqC 2.0 receiver freq */ u32 rx_freq; /* DiSEqC 2.0 receiver freq */
......
...@@ -305,7 +305,7 @@ static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency) ...@@ -305,7 +305,7 @@ static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency)
int rc; int rc;
const struct stb6100_lkup *ptr; const struct stb6100_lkup *ptr;
struct stb6100_state *state = fe->tuner_priv; struct stb6100_state *state = fe->tuner_priv;
struct dvbfe_params params; struct dvb_frontend_parameters p;
u32 srate = 0, fvco, nint, nfrac; u32 srate = 0, fvco, nint, nfrac;
u8 regs[STB6100_NUMREGS]; u8 regs[STB6100_NUMREGS];
...@@ -313,28 +313,12 @@ static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency) ...@@ -313,28 +313,12 @@ static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency)
if ((rc = stb6100_read_regs(state, regs)) < 0) if ((rc = stb6100_read_regs(state, regs)) < 0)
return rc; return rc;
if (fe->ops.get_params) {
dprintk(verbose, FE_DEBUG, 1, "Get Frontend parameters"); if (fe->ops.get_frontend) {
fe->ops.get_params(fe, &params); dprintk(verbose, FE_DEBUG, 1, "Get frontend parameters");
} fe->ops.get_frontend(fe, &p);
switch (params.delivery) {
case DVBFE_DELSYS_DVBS:
srate = params.delsys.dvbs.symbol_rate;
dprintk(verbose, FE_DEBUG, 1, "Delivery system = DVB-S, Symbol Rate=[%d]", srate);
break;
case DVBFE_DELSYS_DSS:
dprintk(verbose, FE_DEBUG, 1, "Delivery system = DSS, Symbol Rate=[%d]", srate);
srate = params.delsys.dss.symbol_rate;
break;
case DVBFE_DELSYS_DVBS2:
dprintk(verbose, FE_DEBUG, 1, "Delivery system = DVB-S2, Symbol Rate=[%d]", srate);
srate = params.delsys.dvbs2.symbol_rate;
break;
default:
dprintk(verbose, FE_NOTICE, 1, "symbol rate unknown!");
srate = 22000000; /* just a typical default value */
break;
} }
srate = p.u.qpsk.symbol_rate;
/* Baseband gain. */ /* Baseband gain. */
if (srate >= 15000000) if (srate >= 15000000)
......
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