Commit 9fa7c419 authored by Luis Alves's avatar Luis Alves Committed by Mauro Carvalho Chehab

[media] cx24117: Add complete demod command list

This patch adds the complete list of all the commands known
for the cx24117 demodulator.
Signed-off-by: default avatarLuis Alves <ljalvs@gmail.com>
Signed-off-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 3f823e09
...@@ -135,15 +135,33 @@ ...@@ -135,15 +135,33 @@
enum cmds { enum cmds {
CMD_SET_VCO = 0x10, CMD_SET_VCOFREQ = 0x10,
CMD_TUNEREQUEST = 0x11, CMD_TUNEREQUEST = 0x11,
CMD_MPEGCONFIG = 0x13, CMD_GLOBAL_MPEGCFG = 0x13,
CMD_TUNERINIT = 0x14, CMD_MPEGCFG = 0x14,
CMD_LNBSEND = 0x21, /* Formerly CMD_SEND_DISEQC */ CMD_TUNERINIT = 0x15,
CMD_GET_SRATE = 0x18,
CMD_SET_GOLDCODE = 0x19,
CMD_GET_AGCACC = 0x1a,
CMD_DEMODINIT = 0x1b,
CMD_GETCTLACC = 0x1c,
CMD_LNBCONFIG = 0x20,
CMD_LNBSEND = 0x21,
CMD_LNBDCLEVEL = 0x22, CMD_LNBDCLEVEL = 0x22,
CMD_SET_TONE = 0x23, CMD_LNBPCBCONFIG = 0x23,
CMD_UPDFWVERS = 0x35, CMD_LNBSENDTONEBST = 0x24,
CMD_TUNERSLEEP = 0x36, CMD_LNBUPDREPLY = 0x25,
CMD_SET_GPIOMODE = 0x30,
CMD_SET_GPIOEN = 0x31,
CMD_SET_GPIODIR = 0x32,
CMD_SET_GPIOOUT = 0x33,
CMD_ENABLERSCORR = 0x34,
CMD_FWVERSION = 0x35,
CMD_SET_SLEEPMODE = 0x36,
CMD_BERCTRL = 0x3c,
CMD_EVENTCTRL = 0x3d,
}; };
static LIST_HEAD(hybrid_tuner_instance_list); static LIST_HEAD(hybrid_tuner_instance_list);
...@@ -619,8 +637,8 @@ static int cx24117_load_firmware(struct dvb_frontend *fe, ...@@ -619,8 +637,8 @@ static int cx24117_load_firmware(struct dvb_frontend *fe,
cx24117_writereg(state, 0xf7, 0x0c); cx24117_writereg(state, 0xf7, 0x0c);
cx24117_writereg(state, 0xe0, 0x00); cx24117_writereg(state, 0xe0, 0x00);
/* CMD 1B */ /* Init demodulator */
cmd.args[0] = 0x1b; cmd.args[0] = CMD_DEMODINIT;
cmd.args[1] = 0x00; cmd.args[1] = 0x00;
cmd.args[2] = 0x01; cmd.args[2] = 0x01;
cmd.args[3] = 0x00; cmd.args[3] = 0x00;
...@@ -629,8 +647,8 @@ static int cx24117_load_firmware(struct dvb_frontend *fe, ...@@ -629,8 +647,8 @@ static int cx24117_load_firmware(struct dvb_frontend *fe,
if (ret != 0) if (ret != 0)
goto error; goto error;
/* CMD 10 */ /* Set VCO frequency */
cmd.args[0] = CMD_SET_VCO; cmd.args[0] = CMD_SET_VCOFREQ;
cmd.args[1] = 0x06; cmd.args[1] = 0x06;
cmd.args[2] = 0x2b; cmd.args[2] = 0x2b;
cmd.args[3] = 0xd8; cmd.args[3] = 0xd8;
...@@ -648,8 +666,8 @@ static int cx24117_load_firmware(struct dvb_frontend *fe, ...@@ -648,8 +666,8 @@ static int cx24117_load_firmware(struct dvb_frontend *fe,
if (ret != 0) if (ret != 0)
goto error; goto error;
/* CMD 15 */ /* Tuner init */
cmd.args[0] = 0x15; cmd.args[0] = CMD_TUNERINIT;
cmd.args[1] = 0x00; cmd.args[1] = 0x00;
cmd.args[2] = 0x01; cmd.args[2] = 0x01;
cmd.args[3] = 0x00; cmd.args[3] = 0x00;
...@@ -667,8 +685,8 @@ static int cx24117_load_firmware(struct dvb_frontend *fe, ...@@ -667,8 +685,8 @@ static int cx24117_load_firmware(struct dvb_frontend *fe,
if (ret != 0) if (ret != 0)
goto error; goto error;
/* CMD 13 */ /* Global MPEG config */
cmd.args[0] = CMD_MPEGCONFIG; cmd.args[0] = CMD_GLOBAL_MPEGCFG;
cmd.args[1] = 0x00; cmd.args[1] = 0x00;
cmd.args[2] = 0x00; cmd.args[2] = 0x00;
cmd.args[3] = 0x00; cmd.args[3] = 0x00;
...@@ -679,9 +697,9 @@ static int cx24117_load_firmware(struct dvb_frontend *fe, ...@@ -679,9 +697,9 @@ static int cx24117_load_firmware(struct dvb_frontend *fe,
if (ret != 0) if (ret != 0)
goto error; goto error;
/* CMD 14 */ /* MPEG config for each demod */
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
cmd.args[0] = CMD_TUNERINIT; cmd.args[0] = CMD_MPEGCFG;
cmd.args[1] = (u8) i; cmd.args[1] = (u8) i;
cmd.args[2] = 0x00; cmd.args[2] = 0x00;
cmd.args[3] = 0x05; cmd.args[3] = 0x05;
...@@ -699,8 +717,8 @@ static int cx24117_load_firmware(struct dvb_frontend *fe, ...@@ -699,8 +717,8 @@ static int cx24117_load_firmware(struct dvb_frontend *fe,
cx24117_writereg(state, 0xcf, 0x00); cx24117_writereg(state, 0xcf, 0x00);
cx24117_writereg(state, 0xe5, 0x04); cx24117_writereg(state, 0xe5, 0x04);
/* Firmware CMD 35: Get firmware version */ /* Get firmware version */
cmd.args[0] = CMD_UPDFWVERS; cmd.args[0] = CMD_FWVERSION;
cmd.len = 2; cmd.len = 2;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
cmd.args[1] = i; cmd.args[1] = i;
...@@ -779,8 +797,8 @@ static int cx24117_read_signal_strength(struct dvb_frontend *fe, ...@@ -779,8 +797,8 @@ static int cx24117_read_signal_strength(struct dvb_frontend *fe,
u8 reg = (state->demod == 0) ? u8 reg = (state->demod == 0) ?
CX24117_REG_SSTATUS0 : CX24117_REG_SSTATUS1; CX24117_REG_SSTATUS0 : CX24117_REG_SSTATUS1;
/* Firmware CMD 1A */ /* Read AGC accumulator register */
cmd.args[0] = 0x1a; cmd.args[0] = CMD_GET_AGCACC;
cmd.args[1] = (u8) state->demod; cmd.args[1] = (u8) state->demod;
cmd.len = 2; cmd.len = 2;
ret = cx24117_cmd_execute(fe, &cmd); ret = cx24117_cmd_execute(fe, &cmd);
...@@ -899,8 +917,8 @@ static int cx24117_set_voltage(struct dvb_frontend *fe, ...@@ -899,8 +917,8 @@ static int cx24117_set_voltage(struct dvb_frontend *fe,
voltage == SEC_VOLTAGE_18 ? "SEC_VOLTAGE_18" : voltage == SEC_VOLTAGE_18 ? "SEC_VOLTAGE_18" :
"SEC_VOLTAGE_OFF"); "SEC_VOLTAGE_OFF");
/* CMD 32 */ /* Set GPIO direction */
cmd.args[0] = 0x32; cmd.args[0] = CMD_SET_GPIODIR;
cmd.args[1] = reg; cmd.args[1] = reg;
cmd.args[2] = reg; cmd.args[2] = reg;
cmd.len = 3; cmd.len = 3;
...@@ -910,8 +928,8 @@ static int cx24117_set_voltage(struct dvb_frontend *fe, ...@@ -910,8 +928,8 @@ static int cx24117_set_voltage(struct dvb_frontend *fe,
if ((voltage == SEC_VOLTAGE_13) || if ((voltage == SEC_VOLTAGE_13) ||
(voltage == SEC_VOLTAGE_18)) { (voltage == SEC_VOLTAGE_18)) {
/* CMD 33 */ /* Set GPIO logic level */
cmd.args[0] = 0x33; cmd.args[0] = CMD_SET_GPIOOUT;
cmd.args[1] = reg; cmd.args[1] = reg;
cmd.args[2] = reg; cmd.args[2] = reg;
cmd.len = 3; cmd.len = 3;
...@@ -926,7 +944,7 @@ static int cx24117_set_voltage(struct dvb_frontend *fe, ...@@ -926,7 +944,7 @@ static int cx24117_set_voltage(struct dvb_frontend *fe,
/* Wait for voltage/min repeat delay */ /* Wait for voltage/min repeat delay */
msleep(100); msleep(100);
/* CMD 22 - CMD_LNBDCLEVEL */ /* Set 13V/18V select pin */
cmd.args[0] = CMD_LNBDCLEVEL; cmd.args[0] = CMD_LNBDCLEVEL;
cmd.args[1] = state->demod ? 0 : 1; cmd.args[1] = state->demod ? 0 : 1;
cmd.args[2] = (voltage == SEC_VOLTAGE_18 ? 0x01 : 0x00); cmd.args[2] = (voltage == SEC_VOLTAGE_18 ? 0x01 : 0x00);
...@@ -935,7 +953,7 @@ static int cx24117_set_voltage(struct dvb_frontend *fe, ...@@ -935,7 +953,7 @@ static int cx24117_set_voltage(struct dvb_frontend *fe,
/* Min delay time before DiSEqC send */ /* Min delay time before DiSEqC send */
msleep(20); msleep(20);
} else { } else {
cmd.args[0] = 0x33; cmd.args[0] = CMD_SET_GPIOOUT;
cmd.args[1] = 0x00; cmd.args[1] = 0x00;
cmd.args[2] = reg; cmd.args[2] = reg;
cmd.len = 3; cmd.len = 3;
...@@ -968,8 +986,7 @@ static int cx24117_set_tone(struct dvb_frontend *fe, ...@@ -968,8 +986,7 @@ static int cx24117_set_tone(struct dvb_frontend *fe,
msleep(20); msleep(20);
/* Set the tone */ /* Set the tone */
/* CMD 23 - CMD_SET_TONE */ cmd.args[0] = CMD_LNBPCBCONFIG;
cmd.args[0] = CMD_SET_TONE;
cmd.args[1] = (state->demod ? 0 : 1); cmd.args[1] = (state->demod ? 0 : 1);
cmd.args[2] = 0x00; cmd.args[2] = 0x00;
cmd.args[3] = 0x00; cmd.args[3] = 0x00;
...@@ -1231,8 +1248,8 @@ static int cx24117_initfe(struct dvb_frontend *fe) ...@@ -1231,8 +1248,8 @@ static int cx24117_initfe(struct dvb_frontend *fe)
mutex_lock(&state->priv->fe_lock); mutex_lock(&state->priv->fe_lock);
/* Firmware CMD 36: Power config */ /* Set sleep mode off */
cmd.args[0] = CMD_TUNERSLEEP; cmd.args[0] = CMD_SET_SLEEPMODE;
cmd.args[1] = (state->demod ? 1 : 0); cmd.args[1] = (state->demod ? 1 : 0);
cmd.args[2] = 0; cmd.args[2] = 0;
cmd.len = 3; cmd.len = 3;
...@@ -1244,8 +1261,8 @@ static int cx24117_initfe(struct dvb_frontend *fe) ...@@ -1244,8 +1261,8 @@ static int cx24117_initfe(struct dvb_frontend *fe)
if (ret != 0) if (ret != 0)
goto exit; goto exit;
/* CMD 3C */ /* Set BER control */
cmd.args[0] = 0x3c; cmd.args[0] = CMD_BERCTRL;
cmd.args[1] = (state->demod ? 1 : 0); cmd.args[1] = (state->demod ? 1 : 0);
cmd.args[2] = 0x10; cmd.args[2] = 0x10;
cmd.args[3] = 0x10; cmd.args[3] = 0x10;
...@@ -1254,8 +1271,8 @@ static int cx24117_initfe(struct dvb_frontend *fe) ...@@ -1254,8 +1271,8 @@ static int cx24117_initfe(struct dvb_frontend *fe)
if (ret != 0) if (ret != 0)
goto exit; goto exit;
/* CMD 34 */ /* Set RS correction (enable/disable) */
cmd.args[0] = 0x34; cmd.args[0] = CMD_ENABLERSCORR;
cmd.args[1] = (state->demod ? 1 : 0); cmd.args[1] = (state->demod ? 1 : 0);
cmd.args[2] = CX24117_OCC; cmd.args[2] = CX24117_OCC;
cmd.len = 3; cmd.len = 3;
...@@ -1278,8 +1295,8 @@ static int cx24117_sleep(struct dvb_frontend *fe) ...@@ -1278,8 +1295,8 @@ static int cx24117_sleep(struct dvb_frontend *fe)
dev_dbg(&state->priv->i2c->dev, "%s() demod%d\n", dev_dbg(&state->priv->i2c->dev, "%s() demod%d\n",
__func__, state->demod); __func__, state->demod);
/* Firmware CMD 36: Power config */ /* Set sleep mode on */
cmd.args[0] = CMD_TUNERSLEEP; cmd.args[0] = CMD_SET_SLEEPMODE;
cmd.args[1] = (state->demod ? 1 : 0); cmd.args[1] = (state->demod ? 1 : 0);
cmd.args[2] = 1; cmd.args[2] = 1;
cmd.len = 3; cmd.len = 3;
...@@ -1558,7 +1575,8 @@ static int cx24117_get_frontend(struct dvb_frontend *fe) ...@@ -1558,7 +1575,8 @@ static int cx24117_get_frontend(struct dvb_frontend *fe)
u8 buf[0x1f-4]; u8 buf[0x1f-4];
cmd.args[0] = 0x1c; /* Read current tune parameters */
cmd.args[0] = CMD_GETCTLACC;
cmd.args[1] = (u8) state->demod; cmd.args[1] = (u8) state->demod;
cmd.len = 2; cmd.len = 2;
ret = cx24117_cmd_execute(fe, &cmd); ret = cx24117_cmd_execute(fe, &cmd);
......
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