aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/tda10086.c
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 /drivers/media/dvb/frontends/tda10086.c
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>
Diffstat (limited to 'drivers/media/dvb/frontends/tda10086.c')
-rw-r--r--drivers/media/dvb/frontends/tda10086.c28
1 files changed, 22 insertions, 6 deletions
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