aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHartmut Hackmann <hartmut.hackmann@t-online.de>2008-02-09 21:54:24 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-02-18 09:15:18 -0500
commitea75baf4b0f117564bd50827a49c4b14d61d24e9 (patch)
treec7618a6ea479a00747f48b3ea926a3ab8a7865f8
parent83947d307d63dc0c30ab0809714f0bcbbdf8c3e2 (diff)
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: Hartmut Hackmann <hartmut.hackmann@t-online.de> Acked-by: Oliver Endriss <o.endriss@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/dvb/dvb-usb/ttusb2.c1
-rw-r--r--drivers/media/dvb/frontends/tda10086.c28
-rw-r--r--drivers/media/dvb/frontends/tda10086.h3
-rw-r--r--drivers/media/dvb/ttpci/budget.c1
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c5
5 files changed, 30 insertions, 8 deletions
diff --git a/drivers/media/dvb/dvb-usb/ttusb2.c b/drivers/media/dvb/dvb-usb/ttusb2.c
index 88dc4367a2e3..3b9da9c25c6e 100644
--- a/drivers/media/dvb/dvb-usb/ttusb2.c
+++ b/drivers/media/dvb/dvb-usb/ttusb2.c
@@ -144,6 +144,7 @@ static int ttusb2_power_ctrl(struct dvb_usb_device *d, int onoff)
144static struct tda10086_config tda10086_config = { 144static struct tda10086_config tda10086_config = {
145 .demod_address = 0x0e, 145 .demod_address = 0x0e,
146 .invert = 0, 146 .invert = 0,
147 .diseqc_tone = 1,
147}; 148};
148 149
149static int ttusb2_frontend_attach(struct dvb_usb_adapter *adap) 150static int ttusb2_frontend_attach(struct dvb_usb_adapter *adap)
diff --git a/drivers/media/dvb/frontends/tda10086.c b/drivers/media/dvb/frontends/tda10086.c
index 9d26ace65151..0d2b69a99ad4 100644
--- a/drivers/media/dvb/frontends/tda10086.c
+++ b/drivers/media/dvb/frontends/tda10086.c
@@ -106,9 +106,12 @@ static int tda10086_write_mask(struct tda10086_state *state, int reg, int mask,
106static int tda10086_init(struct dvb_frontend* fe) 106static int tda10086_init(struct dvb_frontend* fe)
107{ 107{
108 struct tda10086_state* state = fe->demodulator_priv; 108 struct tda10086_state* state = fe->demodulator_priv;
109 u8 t22k_off = 0x80;
109 110
110 dprintk ("%s\n", __FUNCTION__); 111 dprintk ("%s\n", __FUNCTION__);
111 112
113 if (state->config->diseqc_tone)
114 t22k_off = 0;
112 // reset 115 // reset
113 tda10086_write_byte(state, 0x00, 0x00); 116 tda10086_write_byte(state, 0x00, 0x00);
114 msleep(10); 117 msleep(10);
@@ -158,7 +161,7 @@ static int tda10086_init(struct dvb_frontend* fe)
158 tda10086_write_byte(state, 0x3d, 0x80); 161 tda10086_write_byte(state, 0x3d, 0x80);
159 162
160 // setup SEC 163 // setup SEC
161 tda10086_write_byte(state, 0x36, 0x80); // all SEC off, no 22k tone 164 tda10086_write_byte(state, 0x36, t22k_off); // all SEC off, 22k tone
162 tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000))); // } tone frequency 165 tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000))); // } tone frequency
163 tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); // } 166 tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); // }
164 167
@@ -180,16 +183,20 @@ static void tda10086_diseqc_wait(struct tda10086_state *state)
180static int tda10086_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone) 183static int tda10086_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
181{ 184{
182 struct tda10086_state* state = fe->demodulator_priv; 185 struct tda10086_state* state = fe->demodulator_priv;
186 u8 t22k_off = 0x80;
183 187
184 dprintk ("%s\n", __FUNCTION__); 188 dprintk ("%s\n", __FUNCTION__);
185 189
190 if (state->config->diseqc_tone)
191 t22k_off = 0;
192
186 switch (tone) { 193 switch (tone) {
187 case SEC_TONE_OFF: 194 case SEC_TONE_OFF:
188 tda10086_write_byte(state, 0x36, 0x80); 195 tda10086_write_byte(state, 0x36, t22k_off);
189 break; 196 break;
190 197
191 case SEC_TONE_ON: 198 case SEC_TONE_ON:
192 tda10086_write_byte(state, 0x36, 0x81); 199 tda10086_write_byte(state, 0x36, 0x01 + t22k_off);
193 break; 200 break;
194 } 201 }
195 202
@@ -202,9 +209,13 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe,
202 struct tda10086_state* state = fe->demodulator_priv; 209 struct tda10086_state* state = fe->demodulator_priv;
203 int i; 210 int i;
204 u8 oldval; 211 u8 oldval;
212 u8 t22k_off = 0x80;
205 213
206 dprintk ("%s\n", __FUNCTION__); 214 dprintk ("%s\n", __FUNCTION__);
207 215
216 if (state->config->diseqc_tone)
217 t22k_off = 0;
218
208 if (cmd->msg_len > 6) 219 if (cmd->msg_len > 6)
209 return -EINVAL; 220 return -EINVAL;
210 oldval = tda10086_read_byte(state, 0x36); 221 oldval = tda10086_read_byte(state, 0x36);
@@ -212,7 +223,8 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe,
212 for(i=0; i< cmd->msg_len; i++) { 223 for(i=0; i< cmd->msg_len; i++) {
213 tda10086_write_byte(state, 0x48+i, cmd->msg[i]); 224 tda10086_write_byte(state, 0x48+i, cmd->msg[i]);
214 } 225 }
215 tda10086_write_byte(state, 0x36, 0x88 | ((cmd->msg_len - 1) << 4)); 226 tda10086_write_byte(state, 0x36, (0x08 + t22k_off)
227 | ((cmd->msg_len - 1) << 4));
216 228
217 tda10086_diseqc_wait(state); 229 tda10086_diseqc_wait(state);
218 230
@@ -225,16 +237,20 @@ static int tda10086_send_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t minic
225{ 237{
226 struct tda10086_state* state = fe->demodulator_priv; 238 struct tda10086_state* state = fe->demodulator_priv;
227 u8 oldval = tda10086_read_byte(state, 0x36); 239 u8 oldval = tda10086_read_byte(state, 0x36);
240 u8 t22k_off = 0x80;
228 241
229 dprintk ("%s\n", __FUNCTION__); 242 dprintk ("%s\n", __FUNCTION__);
230 243
244 if (state->config->diseqc_tone)
245 t22k_off = 0;
246
231 switch(minicmd) { 247 switch(minicmd) {
232 case SEC_MINI_A: 248 case SEC_MINI_A:
233 tda10086_write_byte(state, 0x36, 0x84); 249 tda10086_write_byte(state, 0x36, 0x04 + t22k_off);
234 break; 250 break;
235 251
236 case SEC_MINI_B: 252 case SEC_MINI_B:
237 tda10086_write_byte(state, 0x36, 0x86); 253 tda10086_write_byte(state, 0x36, 0x06 + t22k_off);
238 break; 254 break;
239 } 255 }
240 256
diff --git a/drivers/media/dvb/frontends/tda10086.h b/drivers/media/dvb/frontends/tda10086.h
index ed584a8f4a89..eeceaeee78ff 100644
--- a/drivers/media/dvb/frontends/tda10086.h
+++ b/drivers/media/dvb/frontends/tda10086.h
@@ -33,6 +33,9 @@ struct tda10086_config
33 33
34 /* does the "inversion" need inverted? */ 34 /* does the "inversion" need inverted? */
35 u8 invert; 35 u8 invert;
36
37 /* do we need the diseqc signal with carrier? */
38 u8 diseqc_tone;
36}; 39};
37 40
38#if defined(CONFIG_DVB_TDA10086) || (defined(CONFIG_DVB_TDA10086_MODULE) && defined(MODULE)) 41#if defined(CONFIG_DVB_TDA10086) || (defined(CONFIG_DVB_TDA10086_MODULE) && defined(MODULE))
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
index 9268a82bada6..14b00f57b5de 100644
--- a/drivers/media/dvb/ttpci/budget.c
+++ b/drivers/media/dvb/ttpci/budget.c
@@ -351,6 +351,7 @@ static struct s5h1420_config s5h1420_config = {
351static struct tda10086_config tda10086_config = { 351static struct tda10086_config tda10086_config = {
352 .demod_address = 0x0e, 352 .demod_address = 0x0e,
353 .invert = 0, 353 .invert = 0,
354 .diseqc_tone = 1,
354}; 355};
355 356
356static u8 read_pwm(struct budget* budget) 357static u8 read_pwm(struct budget* budget)
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index e58f437ea9f7..ea2be9eceeb8 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -841,6 +841,7 @@ static struct tda1004x_config ads_tech_duo_config = {
841static struct tda10086_config flydvbs = { 841static struct tda10086_config flydvbs = {
842 .demod_address = 0x0e, 842 .demod_address = 0x0e,
843 .invert = 0, 843 .invert = 0,
844 .diseqc_tone = 0,
844}; 845};
845 846
846/* ================================================================== 847/* ==================================================================
@@ -955,9 +956,9 @@ static int dvb_init(struct saa7134_dev *dev)
955 configure_tda827x_fe(dev, &tda827x_lifeview_config); 956 configure_tda827x_fe(dev, &tda827x_lifeview_config);
956 break; 957 break;
957 case SAA7134_BOARD_FLYDVB_TRIO: 958 case SAA7134_BOARD_FLYDVB_TRIO:
958 if(! use_frontend) { //terrestrial 959 if(! use_frontend) { /* terrestrial */
959 configure_tda827x_fe(dev, &lifeview_trio_config); 960 configure_tda827x_fe(dev, &lifeview_trio_config);
960 } else { //satellite 961 } else { /* satellite */
961 dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); 962 dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap);
962 if (dev->dvb.frontend) { 963 if (dev->dvb.frontend) {
963 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63, 964 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63,