Commit bffab93c authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] si2168: add support for DVB-T2

Add support for DVB-T2.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 19229240
...@@ -66,6 +66,7 @@ static int si2168_cmd_execute(struct si2168 *s, struct si2168_cmd *cmd) ...@@ -66,6 +66,7 @@ static int si2168_cmd_execute(struct si2168 *s, struct si2168_cmd *cmd)
static int si2168_read_status(struct dvb_frontend *fe, fe_status_t *status) static int si2168_read_status(struct dvb_frontend *fe, fe_status_t *status)
{ {
struct si2168 *s = fe->demodulator_priv; struct si2168 *s = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int ret; int ret;
struct si2168_cmd cmd; struct si2168_cmd cmd;
...@@ -76,10 +77,24 @@ static int si2168_read_status(struct dvb_frontend *fe, fe_status_t *status) ...@@ -76,10 +77,24 @@ static int si2168_read_status(struct dvb_frontend *fe, fe_status_t *status)
goto err; goto err;
} }
cmd.args[0] = 0xa0; switch (c->delivery_system) {
cmd.args[1] = 0x01; case SYS_DVBT:
cmd.wlen = 2; cmd.args[0] = 0xa0;
cmd.rlen = 13; cmd.args[1] = 0x01;
cmd.wlen = 2;
cmd.rlen = 13;
break;
case SYS_DVBT2:
cmd.args[0] = 0x50;
cmd.args[1] = 0x01;
cmd.wlen = 2;
cmd.rlen = 14;
break;
default:
ret = -EINVAL;
goto err;
}
ret = si2168_cmd_execute(s, &cmd); ret = si2168_cmd_execute(s, &cmd);
if (ret) if (ret)
goto err; goto err;
...@@ -125,7 +140,7 @@ static int si2168_set_frontend(struct dvb_frontend *fe) ...@@ -125,7 +140,7 @@ static int si2168_set_frontend(struct dvb_frontend *fe)
struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int ret; int ret;
struct si2168_cmd cmd; struct si2168_cmd cmd;
u8 bandwidth; u8 bandwidth, delivery_system;
dev_dbg(&s->client->dev, dev_dbg(&s->client->dev,
"%s: delivery_system=%u modulation=%u frequency=%u bandwidth_hz=%u symbol_rate=%u inversion=%u\n", "%s: delivery_system=%u modulation=%u frequency=%u bandwidth_hz=%u symbol_rate=%u inversion=%u\n",
...@@ -138,18 +153,30 @@ static int si2168_set_frontend(struct dvb_frontend *fe) ...@@ -138,18 +153,30 @@ static int si2168_set_frontend(struct dvb_frontend *fe)
goto err; goto err;
} }
switch (c->delivery_system) {
case SYS_DVBT:
delivery_system = 0x20;
break;
case SYS_DVBT2:
delivery_system = 0x70;
break;
default:
ret = -EINVAL;
goto err;
}
switch (c->bandwidth_hz) { switch (c->bandwidth_hz) {
case 5000000: case 5000000:
bandwidth = 0x25; bandwidth = 0x05;
break; break;
case 6000000: case 6000000:
bandwidth = 0x26; bandwidth = 0x06;
break; break;
case 7000000: case 7000000:
bandwidth = 0x27; bandwidth = 0x07;
break; break;
case 8000000: case 8000000:
bandwidth = 0x28; bandwidth = 0x08;
break; break;
default: default:
ret = -EINVAL; ret = -EINVAL;
...@@ -170,7 +197,11 @@ static int si2168_set_frontend(struct dvb_frontend *fe) ...@@ -170,7 +197,11 @@ static int si2168_set_frontend(struct dvb_frontend *fe)
if (ret) if (ret)
goto err; goto err;
memcpy(cmd.args, "\x89\x21\x06\x11\xff\x98", 6); /* that has no big effect */
if (c->delivery_system == SYS_DVBT)
memcpy(cmd.args, "\x89\x21\x06\x11\xff\x98", 6);
else if (c->delivery_system == SYS_DVBT2)
memcpy(cmd.args, "\x89\x21\x06\x11\x89\x20", 6);
cmd.wlen = 6; cmd.wlen = 6;
cmd.rlen = 3; cmd.rlen = 3;
ret = si2168_cmd_execute(s, &cmd); ret = si2168_cmd_execute(s, &cmd);
...@@ -241,7 +272,7 @@ static int si2168_set_frontend(struct dvb_frontend *fe) ...@@ -241,7 +272,7 @@ static int si2168_set_frontend(struct dvb_frontend *fe)
goto err; goto err;
memcpy(cmd.args, "\x14\x00\x0a\x10\x00\x00", 6); memcpy(cmd.args, "\x14\x00\x0a\x10\x00\x00", 6);
cmd.args[4] = bandwidth; cmd.args[4] = delivery_system | bandwidth;
cmd.wlen = 6; cmd.wlen = 6;
cmd.rlen = 1; cmd.rlen = 1;
ret = si2168_cmd_execute(s, &cmd); ret = si2168_cmd_execute(s, &cmd);
...@@ -583,7 +614,7 @@ static int si2168_deselect(struct i2c_adapter *adap, void *mux_priv, u32 chan) ...@@ -583,7 +614,7 @@ static int si2168_deselect(struct i2c_adapter *adap, void *mux_priv, u32 chan)
} }
static const struct dvb_frontend_ops si2168_ops = { static const struct dvb_frontend_ops si2168_ops = {
.delsys = {SYS_DVBT}, .delsys = {SYS_DVBT, SYS_DVBT2},
.info = { .info = {
.name = "Silicon Labs Si2168", .name = "Silicon Labs Si2168",
.caps = FE_CAN_FEC_1_2 | .caps = FE_CAN_FEC_1_2 |
......
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