Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 330982
b: refs/heads/master
c: 0ce67a2
h: refs/heads/master
v: v3
  • Loading branch information
Antti Palosaari authored and Mauro Carvalho Chehab committed Sep 15, 2012
1 parent 7fa8334 commit 030f553
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e1f43269710daf3ab0d8d0da428f7f647c11676d
refs/heads/master: 0ce67a2a59b26dd1b087115141c71ddd89514b77
113 changes: 113 additions & 0 deletions trunk/drivers/media/dvb-frontends/rtl2832.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,118 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe)
return ret;
}

static int rtl2832_get_frontend(struct dvb_frontend *fe)
{
struct rtl2832_priv *priv = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int ret;
u8 buf[3];

if (priv->sleeping)
return 0;

ret = rtl2832_rd_regs(priv, 0x3c, 3, buf, 2);
if (ret)
goto err;

ret = rtl2832_rd_reg(priv, 0x51, 3, &buf[2]);
if (ret)
goto err;

dbg("%s: TPS=%*ph", __func__, 3, buf);

switch ((buf[0] >> 2) & 3) {
case 0:
c->modulation = QPSK;
break;
case 1:
c->modulation = QAM_16;
break;
case 2:
c->modulation = QAM_64;
break;
}

switch ((buf[2] >> 2) & 1) {
case 0:
c->transmission_mode = TRANSMISSION_MODE_2K;
break;
case 1:
c->transmission_mode = TRANSMISSION_MODE_8K;
}

switch ((buf[2] >> 0) & 3) {
case 0:
c->guard_interval = GUARD_INTERVAL_1_32;
break;
case 1:
c->guard_interval = GUARD_INTERVAL_1_16;
break;
case 2:
c->guard_interval = GUARD_INTERVAL_1_8;
break;
case 3:
c->guard_interval = GUARD_INTERVAL_1_4;
break;
}

switch ((buf[0] >> 4) & 7) {
case 0:
c->hierarchy = HIERARCHY_NONE;
break;
case 1:
c->hierarchy = HIERARCHY_1;
break;
case 2:
c->hierarchy = HIERARCHY_2;
break;
case 3:
c->hierarchy = HIERARCHY_4;
break;
}

switch ((buf[1] >> 3) & 7) {
case 0:
c->code_rate_HP = FEC_1_2;
break;
case 1:
c->code_rate_HP = FEC_2_3;
break;
case 2:
c->code_rate_HP = FEC_3_4;
break;
case 3:
c->code_rate_HP = FEC_5_6;
break;
case 4:
c->code_rate_HP = FEC_7_8;
break;
}

switch ((buf[1] >> 0) & 7) {
case 0:
c->code_rate_LP = FEC_1_2;
break;
case 1:
c->code_rate_LP = FEC_2_3;
break;
case 2:
c->code_rate_LP = FEC_3_4;
break;
case 3:
c->code_rate_LP = FEC_5_6;
break;
case 4:
c->code_rate_LP = FEC_7_8;
break;
}

return 0;
err:
dbg("%s: failed=%d", __func__, ret);
return ret;
}

static int rtl2832_read_status(struct dvb_frontend *fe, fe_status_t *status)
{
struct rtl2832_priv *priv = fe->demodulator_priv;
Expand Down Expand Up @@ -749,6 +861,7 @@ static struct dvb_frontend_ops rtl2832_ops = {
.get_tune_settings = rtl2832_get_tune_settings,

.set_frontend = rtl2832_set_frontend,
.get_frontend = rtl2832_get_frontend,

.read_status = rtl2832_read_status,
.i2c_gate_ctrl = rtl2832_i2c_gate_ctrl,
Expand Down

0 comments on commit 030f553

Please sign in to comment.