Commit 63ad4e44 authored by Manu Abraham's avatar Manu Abraham Committed by Mauro Carvalho Chehab

V4L/DVB (4177): DCTNEW and ATSC fixes

Signed-off-by: default avatarManu Abraham <manu@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 77e0be12
...@@ -466,29 +466,41 @@ static int dst_set_symbolrate(struct dst_state *state, u32 srate) ...@@ -466,29 +466,41 @@ static int dst_set_symbolrate(struct dst_state *state, u32 srate)
} }
dprintk(verbose, DST_INFO, 1, "set symrate %u", srate); dprintk(verbose, DST_INFO, 1, "set symrate %u", srate);
srate /= 1000; srate /= 1000;
if (state->type_flags & DST_TYPE_HAS_SYMDIV) { if (state->dst_type == DST_TYPE_IS_SAT) {
sval = srate; if (state->type_flags & DST_TYPE_HAS_SYMDIV) {
sval <<= 20; sval = srate;
do_div(sval, 88000); sval <<= 20;
symcalc = (u32) sval; do_div(sval, 88000);
dprintk(verbose, DST_INFO, 1, "set symcalc %u", symcalc); symcalc = (u32) sval;
state->tx_tuna[5] = (u8) (symcalc >> 12); dprintk(verbose, DST_INFO, 1, "set symcalc %u", symcalc);
state->tx_tuna[6] = (u8) (symcalc >> 4); state->tx_tuna[5] = (u8) (symcalc >> 12);
state->tx_tuna[7] = (u8) (symcalc << 4); state->tx_tuna[6] = (u8) (symcalc >> 4);
} else { state->tx_tuna[7] = (u8) (symcalc << 4);
state->tx_tuna[5] = (u8) (srate >> 16) & 0x7f; } else {
state->tx_tuna[6] = (u8) (srate >> 8); state->tx_tuna[5] = (u8) (srate >> 16) & 0x7f;
state->tx_tuna[7] = (u8) srate; state->tx_tuna[6] = (u8) (srate >> 8);
} state->tx_tuna[7] = (u8) srate;
state->tx_tuna[8] &= ~0x20; }
if (state->type_flags & DST_TYPE_HAS_OBS_REGS) { state->tx_tuna[8] &= ~0x20;
if (srate > 8000) if (state->type_flags & DST_TYPE_HAS_OBS_REGS) {
state->tx_tuna[8] |= 0x20; if (srate > 8000)
state->tx_tuna[8] |= 0x20;
}
} else if (state->dst_type == DST_TYPE_IS_CABLE) {
dprintk(verbose, DST_DEBUG, 1, "%s", state->fw_name);
if (!strncmp(state->fw_name, "DCTNEW", 6)) {
state->tx_tuna[5] = (u8) (srate >> 8);
state->tx_tuna[6] = (u8) srate;
state->tx_tuna[7] = 0x00;
} else if (!strncmp(state->fw_name, "DCT-CI", 6)) {
state->tx_tuna[5] = 0x00;
state->tx_tuna[6] = (u8) (srate >> 8);
state->tx_tuna[7] = (u8) srate;
}
} }
return 0; return 0;
} }
static int dst_set_modulation(struct dst_state *state, fe_modulation_t modulation) static int dst_set_modulation(struct dst_state *state, fe_modulation_t modulation)
{ {
if (state->dst_type != DST_TYPE_IS_CABLE) if (state->dst_type != DST_TYPE_IS_CABLE)
...@@ -509,7 +521,10 @@ static int dst_set_modulation(struct dst_state *state, fe_modulation_t modulatio ...@@ -509,7 +521,10 @@ static int dst_set_modulation(struct dst_state *state, fe_modulation_t modulatio
state->tx_tuna[8] = 0x80; state->tx_tuna[8] = 0x80;
break; break;
case QAM_256: case QAM_256:
state->tx_tuna[8] = 0x00; if (!strncmp(state->fw_name, "DCTNEW", 6))
state->tx_tuna[8] = 0xff;
else if (!strncmp(state->fw_name, "DCT-CI", 6))
state->tx_tuna[8] = 0x00;
break; break;
case QPSK: case QPSK:
case QAM_AUTO: case QAM_AUTO:
...@@ -644,6 +659,13 @@ struct tuner_types tuner_list[] = { ...@@ -644,6 +659,13 @@ struct tuner_types tuner_list[] = {
.fw_name = "DSTMCI" .fw_name = "DSTMCI"
}, },
{
.tuner_type = TUNER_TYPE_UNKNOWN,
.tuner_name = "UNKNOWN",
.board_name = "VP2021",
.fw_name = "DCTNEW"
},
{ {
.tuner_type = TUNER_TYPE_UNKNOWN, .tuner_type = TUNER_TYPE_UNKNOWN,
.tuner_name = "UNKNOWN", .tuner_name = "UNKNOWN",
...@@ -831,7 +853,7 @@ static struct dst_types dst_tlist[] = { ...@@ -831,7 +853,7 @@ static struct dst_types dst_tlist[] = {
.device_id = "DCTNEW", .device_id = "DCTNEW",
.offset = 1, .offset = 1,
.dst_type = DST_TYPE_IS_CABLE, .dst_type = DST_TYPE_IS_CABLE,
.type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_3 | DST_TYPE_HAS_FW_BUILD, .type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_3 | DST_TYPE_HAS_FW_BUILD | DST_TYPE_MULTI_FE,
.dst_feature = 0, .dst_feature = 0,
.tuner_type = 0 .tuner_type = 0
}, },
...@@ -1099,8 +1121,7 @@ static int dst_get_device_id(struct dst_state *state) ...@@ -1099,8 +1121,7 @@ static int dst_get_device_id(struct dst_state *state)
/* Card capabilities */ /* Card capabilities */
state->dst_hw_cap = p_dst_type->dst_feature; state->dst_hw_cap = p_dst_type->dst_feature;
dprintk(verbose, DST_ERROR, 1, "Recognise [%s]", p_dst_type->device_id); dprintk(verbose, DST_ERROR, 1, "Recognise [%s]", p_dst_type->device_id);
strncpy(&state->fw_name[0], p_dst_type->device_id, 6);
// if (p_dst_type->tuner_type != TUNER_TYPE_MULTI) {
/* Multiple tuners */ /* Multiple tuners */
if (p_dst_type->tuner_type & TUNER_TYPE_MULTI) { if (p_dst_type->tuner_type & TUNER_TYPE_MULTI) {
switch (use_dst_type) { switch (use_dst_type) {
...@@ -1319,8 +1340,12 @@ static int dst_get_tuna(struct dst_state *state) ...@@ -1319,8 +1340,12 @@ static int dst_get_tuna(struct dst_state *state)
state->diseq_flags &= ~(HAS_LOCK); state->diseq_flags &= ~(HAS_LOCK);
if (!dst_wait_dst_ready(state, NO_DELAY)) if (!dst_wait_dst_ready(state, NO_DELAY))
return -EIO; return -EIO;
if (state->type_flags & DST_TYPE_HAS_NEWTUNE) // if (state->type_flags & DST_TYPE_HAS_NEWTUNE)
/* how to get variable length reply ???? */ // /* how to get variable length reply ???? */
if ((state->type_flags & DST_TYPE_HAS_NEWTUNE) &&
!(state->dst_type == DST_TYPE_IS_CABLE) &&
!(state->dst_type == DST_TYPE_IS_ATSC))
retval = read_dst(state, state->rx_tuna, 10); retval = read_dst(state, state->rx_tuna, 10);
else else
retval = read_dst(state, &state->rx_tuna[2], FIXED_COMM); retval = read_dst(state, &state->rx_tuna[2], FIXED_COMM);
...@@ -1328,7 +1353,11 @@ static int dst_get_tuna(struct dst_state *state) ...@@ -1328,7 +1353,11 @@ static int dst_get_tuna(struct dst_state *state)
dprintk(verbose, DST_DEBUG, 1, "read not successful"); dprintk(verbose, DST_DEBUG, 1, "read not successful");
return retval; return retval;
} }
if (state->type_flags & DST_TYPE_HAS_NEWTUNE) { // if (state->type_flags & DST_TYPE_HAS_NEWTUNE) {
if ((state->type_flags & DST_TYPE_HAS_NEWTUNE) &&
!(state->dst_type == DST_TYPE_IS_CABLE) &&
!(state->dst_type == DST_TYPE_IS_ATSC) {
if (state->rx_tuna[9] != dst_check_sum(&state->rx_tuna[0], 9)) { if (state->rx_tuna[9] != dst_check_sum(&state->rx_tuna[0], 9)) {
dprintk(verbose, DST_INFO, 1, "checksum failure ? "); dprintk(verbose, DST_INFO, 1, "checksum failure ? ");
return -EIO; return -EIO;
...@@ -1374,7 +1403,11 @@ static int dst_write_tuna(struct dvb_frontend *fe) ...@@ -1374,7 +1403,11 @@ static int dst_write_tuna(struct dvb_frontend *fe)
dprintk(verbose, DST_DEBUG, 1, "DST Communication initialization failed."); dprintk(verbose, DST_DEBUG, 1, "DST Communication initialization failed.");
goto error; goto error;
} }
if (state->type_flags & DST_TYPE_HAS_NEWTUNE) { // if (state->type_flags & DST_TYPE_HAS_NEWTUNE) {
if ((state->type_flags & DST_TYPE_HAS_NEWTUNE) &&
(!(state->dst_type == DST_TYPE_IS_CABLE)) &&
(!(state->dst_type == DST_TYPE_IS_ATSC))) {
state->tx_tuna[9] = dst_check_sum(&state->tx_tuna[0], 9); state->tx_tuna[9] = dst_check_sum(&state->tx_tuna[0], 9);
retval = write_dst(state, &state->tx_tuna[0], 10); retval = write_dst(state, &state->tx_tuna[0], 10);
} else { } else {
...@@ -1528,8 +1561,7 @@ static int dst_init(struct dvb_frontend *fe) ...@@ -1528,8 +1561,7 @@ static int dst_init(struct dvb_frontend *fe)
static u8 sat_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x55, 0xbd, 0x50, 0x00, 0x00 }; static u8 sat_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x55, 0xbd, 0x50, 0x00, 0x00 };
static u8 ter_tuna_188[] = { 0x09, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 }; static u8 ter_tuna_188[] = { 0x09, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 };
static u8 ter_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 }; static u8 ter_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 };
static u8 cab_tuna_204[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 }; static u8 cable_tuna[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 };
static u8 cab_tuna_188[] = { 0x09, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 };
static u8 atsc_tuner[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 }; static u8 atsc_tuner[] = { 0x00, 0x00, 0x03, 0xb6, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00 };
state->inversion = INVERSION_OFF; state->inversion = INVERSION_OFF;
...@@ -1544,7 +1576,7 @@ static int dst_init(struct dvb_frontend *fe) ...@@ -1544,7 +1576,7 @@ static int dst_init(struct dvb_frontend *fe)
else if (state->dst_type == DST_TYPE_IS_TERR) else if (state->dst_type == DST_TYPE_IS_TERR)
memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? ter_tuna_188 : ter_tuna_204), sizeof (ter_tuna_204)); memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? ter_tuna_188 : ter_tuna_204), sizeof (ter_tuna_204));
else if (state->dst_type == DST_TYPE_IS_CABLE) else if (state->dst_type == DST_TYPE_IS_CABLE)
memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? cab_tuna_188 : cab_tuna_204), sizeof (cab_tuna_204)); memcpy(state->tx_tuna, cable_tuna, sizeof (cable_tuna));
else if (state->dst_type == DST_TYPE_IS_ATSC) else if (state->dst_type == DST_TYPE_IS_ATSC)
memcpy(state->tx_tuna, atsc_tuner, sizeof (atsc_tuner)); memcpy(state->tx_tuna, atsc_tuner, sizeof (atsc_tuner));
......
...@@ -138,6 +138,7 @@ struct dst_state { ...@@ -138,6 +138,7 @@ struct dst_state {
u32 tuner_type; u32 tuner_type;
char *tuner_name; char *tuner_name;
struct mutex dst_mutex; struct mutex dst_mutex;
u8 fw_name[8];
}; };
struct tuner_types { struct tuner_types {
......
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