Commit ea75baf4 authored by Hartmut Hackmann's avatar Hartmut Hackmann Committed by Mauro Carvalho Chehab

V4L/DVB (7186): tda10086: make the 22kHz tone for DISEQC a config option

Some cards need the diseqc signal modulated, while some just need
the envelope to control the LNB supply.

This fixes Bug 9887
Signed-off-by: default avatarHartmut Hackmann <hartmut.hackmann@t-online.de>
Acked-by: default avatarOliver Endriss <o.endriss@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 83947d30
...@@ -144,6 +144,7 @@ static int ttusb2_power_ctrl(struct dvb_usb_device *d, int onoff) ...@@ -144,6 +144,7 @@ static int ttusb2_power_ctrl(struct dvb_usb_device *d, int onoff)
static struct tda10086_config tda10086_config = { static struct tda10086_config tda10086_config = {
.demod_address = 0x0e, .demod_address = 0x0e,
.invert = 0, .invert = 0,
.diseqc_tone = 1,
}; };
static int ttusb2_frontend_attach(struct dvb_usb_adapter *adap) static int ttusb2_frontend_attach(struct dvb_usb_adapter *adap)
......
...@@ -106,9 +106,12 @@ static int tda10086_write_mask(struct tda10086_state *state, int reg, int mask, ...@@ -106,9 +106,12 @@ static int tda10086_write_mask(struct tda10086_state *state, int reg, int mask,
static int tda10086_init(struct dvb_frontend* fe) static int tda10086_init(struct dvb_frontend* fe)
{ {
struct tda10086_state* state = fe->demodulator_priv; struct tda10086_state* state = fe->demodulator_priv;
u8 t22k_off = 0x80;
dprintk ("%s\n", __FUNCTION__); dprintk ("%s\n", __FUNCTION__);
if (state->config->diseqc_tone)
t22k_off = 0;
// reset // reset
tda10086_write_byte(state, 0x00, 0x00); tda10086_write_byte(state, 0x00, 0x00);
msleep(10); msleep(10);
...@@ -158,7 +161,7 @@ static int tda10086_init(struct dvb_frontend* fe) ...@@ -158,7 +161,7 @@ static int tda10086_init(struct dvb_frontend* fe)
tda10086_write_byte(state, 0x3d, 0x80); tda10086_write_byte(state, 0x3d, 0x80);
// setup SEC // setup SEC
tda10086_write_byte(state, 0x36, 0x80); // all SEC off, no 22k tone tda10086_write_byte(state, 0x36, t22k_off); // all SEC off, 22k tone
tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000))); // } tone frequency tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000))); // } tone frequency
tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); // } tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); // }
...@@ -180,16 +183,20 @@ static void tda10086_diseqc_wait(struct tda10086_state *state) ...@@ -180,16 +183,20 @@ static void tda10086_diseqc_wait(struct tda10086_state *state)
static int tda10086_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone) static int tda10086_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
{ {
struct tda10086_state* state = fe->demodulator_priv; struct tda10086_state* state = fe->demodulator_priv;
u8 t22k_off = 0x80;
dprintk ("%s\n", __FUNCTION__); dprintk ("%s\n", __FUNCTION__);
if (state->config->diseqc_tone)
t22k_off = 0;
switch (tone) { switch (tone) {
case SEC_TONE_OFF: case SEC_TONE_OFF:
tda10086_write_byte(state, 0x36, 0x80); tda10086_write_byte(state, 0x36, t22k_off);
break; break;
case SEC_TONE_ON: case SEC_TONE_ON:
tda10086_write_byte(state, 0x36, 0x81); tda10086_write_byte(state, 0x36, 0x01 + t22k_off);
break; break;
} }
...@@ -202,9 +209,13 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe, ...@@ -202,9 +209,13 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe,
struct tda10086_state* state = fe->demodulator_priv; struct tda10086_state* state = fe->demodulator_priv;
int i; int i;
u8 oldval; u8 oldval;
u8 t22k_off = 0x80;
dprintk ("%s\n", __FUNCTION__); dprintk ("%s\n", __FUNCTION__);
if (state->config->diseqc_tone)
t22k_off = 0;
if (cmd->msg_len > 6) if (cmd->msg_len > 6)
return -EINVAL; return -EINVAL;
oldval = tda10086_read_byte(state, 0x36); oldval = tda10086_read_byte(state, 0x36);
...@@ -212,7 +223,8 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe, ...@@ -212,7 +223,8 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe,
for(i=0; i< cmd->msg_len; i++) { for(i=0; i< cmd->msg_len; i++) {
tda10086_write_byte(state, 0x48+i, cmd->msg[i]); tda10086_write_byte(state, 0x48+i, cmd->msg[i]);
} }
tda10086_write_byte(state, 0x36, 0x88 | ((cmd->msg_len - 1) << 4)); tda10086_write_byte(state, 0x36, (0x08 + t22k_off)
| ((cmd->msg_len - 1) << 4));
tda10086_diseqc_wait(state); tda10086_diseqc_wait(state);
...@@ -225,16 +237,20 @@ static int tda10086_send_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t minic ...@@ -225,16 +237,20 @@ static int tda10086_send_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t minic
{ {
struct tda10086_state* state = fe->demodulator_priv; struct tda10086_state* state = fe->demodulator_priv;
u8 oldval = tda10086_read_byte(state, 0x36); u8 oldval = tda10086_read_byte(state, 0x36);
u8 t22k_off = 0x80;
dprintk ("%s\n", __FUNCTION__); dprintk ("%s\n", __FUNCTION__);
if (state->config->diseqc_tone)
t22k_off = 0;
switch(minicmd) { switch(minicmd) {
case SEC_MINI_A: case SEC_MINI_A:
tda10086_write_byte(state, 0x36, 0x84); tda10086_write_byte(state, 0x36, 0x04 + t22k_off);
break; break;
case SEC_MINI_B: case SEC_MINI_B:
tda10086_write_byte(state, 0x36, 0x86); tda10086_write_byte(state, 0x36, 0x06 + t22k_off);
break; break;
} }
......
...@@ -33,6 +33,9 @@ struct tda10086_config ...@@ -33,6 +33,9 @@ struct tda10086_config
/* does the "inversion" need inverted? */ /* does the "inversion" need inverted? */
u8 invert; u8 invert;
/* do we need the diseqc signal with carrier? */
u8 diseqc_tone;
}; };
#if defined(CONFIG_DVB_TDA10086) || (defined(CONFIG_DVB_TDA10086_MODULE) && defined(MODULE)) #if defined(CONFIG_DVB_TDA10086) || (defined(CONFIG_DVB_TDA10086_MODULE) && defined(MODULE))
......
...@@ -351,6 +351,7 @@ static struct s5h1420_config s5h1420_config = { ...@@ -351,6 +351,7 @@ static struct s5h1420_config s5h1420_config = {
static struct tda10086_config tda10086_config = { static struct tda10086_config tda10086_config = {
.demod_address = 0x0e, .demod_address = 0x0e,
.invert = 0, .invert = 0,
.diseqc_tone = 1,
}; };
static u8 read_pwm(struct budget* budget) static u8 read_pwm(struct budget* budget)
......
...@@ -841,6 +841,7 @@ static struct tda1004x_config ads_tech_duo_config = { ...@@ -841,6 +841,7 @@ static struct tda1004x_config ads_tech_duo_config = {
static struct tda10086_config flydvbs = { static struct tda10086_config flydvbs = {
.demod_address = 0x0e, .demod_address = 0x0e,
.invert = 0, .invert = 0,
.diseqc_tone = 0,
}; };
/* ================================================================== /* ==================================================================
...@@ -955,9 +956,9 @@ static int dvb_init(struct saa7134_dev *dev) ...@@ -955,9 +956,9 @@ static int dvb_init(struct saa7134_dev *dev)
configure_tda827x_fe(dev, &tda827x_lifeview_config); configure_tda827x_fe(dev, &tda827x_lifeview_config);
break; break;
case SAA7134_BOARD_FLYDVB_TRIO: case SAA7134_BOARD_FLYDVB_TRIO:
if(! use_frontend) { //terrestrial if(! use_frontend) { /* terrestrial */
configure_tda827x_fe(dev, &lifeview_trio_config); configure_tda827x_fe(dev, &lifeview_trio_config);
} else { //satellite } else { /* satellite */
dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap);
if (dev->dvb.frontend) { if (dev->dvb.frontend) {
if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63, if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63,
......
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