Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 285503
b: refs/heads/master
c: fd60721
h: refs/heads/master
i:
  285501: 5866b7c
  285499: 2f9f798
  285495: 54ce632
  285487: faf18a5
  285471: 86c58ee
  285439: 3f73f14
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Dec 31, 2011
1 parent b7a28cb commit ac7b78c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a27378c60247a166ed2a941043b4588695c02d91
refs/heads/master: fd6072122fac77b8a5ff5891ee89a208aaab8f25
52 changes: 28 additions & 24 deletions trunk/drivers/media/dvb/frontends/cx22700.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ static int cx22700_set_inversion (struct cx22700_state* state, int inversion)
}
}

static int cx22700_set_tps (struct cx22700_state *state, struct dvb_ofdm_parameters *p)
static int cx22700_set_tps(struct cx22700_state *state,
struct dtv_frontend_properties *p)
{
static const u8 qam_tab [4] = { 0, 1, 0, 2 };
static const u8 fec_tab [6] = { 0, 1, 2, 0, 3, 4 };
Expand All @@ -146,25 +147,25 @@ static int cx22700_set_tps (struct cx22700_state *state, struct dvb_ofdm_paramet
p->transmission_mode != TRANSMISSION_MODE_8K)
return -EINVAL;

if (p->constellation != QPSK &&
p->constellation != QAM_16 &&
p->constellation != QAM_64)
if (p->modulation != QPSK &&
p->modulation != QAM_16 &&
p->modulation != QAM_64)
return -EINVAL;

if (p->hierarchy_information < HIERARCHY_NONE ||
p->hierarchy_information > HIERARCHY_4)
if (p->hierarchy < HIERARCHY_NONE ||
p->hierarchy > HIERARCHY_4)
return -EINVAL;

if (p->bandwidth < BANDWIDTH_8_MHZ || p->bandwidth > BANDWIDTH_6_MHZ)
if (p->bandwidth_hz > 8000000 || p->bandwidth_hz < 6000000)
return -EINVAL;

if (p->bandwidth == BANDWIDTH_7_MHZ)
if (p->bandwidth_hz == 7000000)
cx22700_writereg (state, 0x09, cx22700_readreg (state, 0x09 | 0x10));
else
cx22700_writereg (state, 0x09, cx22700_readreg (state, 0x09 & ~0x10));

val = qam_tab[p->constellation - QPSK];
val |= p->hierarchy_information - HIERARCHY_NONE;
val = qam_tab[p->modulation - QPSK];
val |= p->hierarchy - HIERARCHY_NONE;

cx22700_writereg (state, 0x04, val);

Expand All @@ -184,7 +185,8 @@ static int cx22700_set_tps (struct cx22700_state *state, struct dvb_ofdm_paramet
return 0;
}

static int cx22700_get_tps (struct cx22700_state* state, struct dvb_ofdm_parameters *p)
static int cx22700_get_tps(struct cx22700_state *state,
struct dtv_frontend_properties *p)
{
static const fe_modulation_t qam_tab [3] = { QPSK, QAM_16, QAM_64 };
static const fe_code_rate_t fec_tab [5] = { FEC_1_2, FEC_2_3, FEC_3_4,
Expand All @@ -199,14 +201,14 @@ static int cx22700_get_tps (struct cx22700_state* state, struct dvb_ofdm_paramet
val = cx22700_readreg (state, 0x01);

if ((val & 0x7) > 4)
p->hierarchy_information = HIERARCHY_AUTO;
p->hierarchy = HIERARCHY_AUTO;
else
p->hierarchy_information = HIERARCHY_NONE + (val & 0x7);
p->hierarchy = HIERARCHY_NONE + (val & 0x7);

if (((val >> 3) & 0x3) > 2)
p->constellation = QAM_AUTO;
p->modulation = QAM_AUTO;
else
p->constellation = qam_tab[(val >> 3) & 0x3];
p->modulation = qam_tab[(val >> 3) & 0x3];

val = cx22700_readreg (state, 0x02);

Expand Down Expand Up @@ -318,8 +320,9 @@ static int cx22700_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
return 0;
}

static int cx22700_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
static int cx22700_set_frontend(struct dvb_frontend *fe)
{
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
struct cx22700_state* state = fe->demodulator_priv;

cx22700_writereg (state, 0x00, 0x02); /* XXX CHECKME: soft reset*/
Expand All @@ -330,21 +333,22 @@ static int cx22700_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
}

cx22700_set_inversion (state, p->inversion);
cx22700_set_tps (state, &p->u.ofdm);
cx22700_set_inversion(state, c->inversion);
cx22700_set_tps(state, c);
cx22700_writereg (state, 0x37, 0x01); /* PAL loop filter off */
cx22700_writereg (state, 0x00, 0x01); /* restart acquire */

return 0;
}

static int cx22700_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
static int cx22700_get_frontend(struct dvb_frontend *fe,
struct dtv_frontend_properties *c)
{
struct cx22700_state* state = fe->demodulator_priv;
u8 reg09 = cx22700_readreg (state, 0x09);

p->inversion = reg09 & 0x1 ? INVERSION_ON : INVERSION_OFF;
return cx22700_get_tps (state, &p->u.ofdm);
c->inversion = reg09 & 0x1 ? INVERSION_ON : INVERSION_OFF;
return cx22700_get_tps(state, c);
}

static int cx22700_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
Expand Down Expand Up @@ -401,7 +405,7 @@ struct dvb_frontend* cx22700_attach(const struct cx22700_config* config,
}

static struct dvb_frontend_ops cx22700_ops = {

.delsys = { SYS_DVBT },
.info = {
.name = "Conexant CX22700 DVB-T",
.type = FE_OFDM,
Expand All @@ -419,8 +423,8 @@ static struct dvb_frontend_ops cx22700_ops = {
.init = cx22700_init,
.i2c_gate_ctrl = cx22700_i2c_gate_ctrl,

.set_frontend_legacy = cx22700_set_frontend,
.get_frontend_legacy = cx22700_get_frontend,
.set_frontend = cx22700_set_frontend,
.get_frontend = cx22700_get_frontend,
.get_tune_settings = cx22700_get_tune_settings,

.read_status = cx22700_read_status,
Expand Down

0 comments on commit ac7b78c

Please sign in to comment.