diff options
Diffstat (limited to 'drivers/media/dvb/ttpci/budget.c')
-rw-r--r-- | drivers/media/dvb/ttpci/budget.c | 98 |
1 files changed, 1 insertions, 97 deletions
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index bfb80925019a..c23c02d95641 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include "tda8083.h" | 42 | #include "tda8083.h" |
43 | #include "s5h1420.h" | 43 | #include "s5h1420.h" |
44 | #include "lnbp21.h" | 44 | #include "lnbp21.h" |
45 | #include "bsru6.h" | ||
45 | 46 | ||
46 | static void Set22K (struct budget *budget, int state) | 47 | static void Set22K (struct budget *budget, int state) |
47 | { | 48 | { |
@@ -220,103 +221,6 @@ static struct ves1x93_config alps_bsrv2_config = | |||
220 | .pll_set = alps_bsrv2_pll_set, | 221 | .pll_set = alps_bsrv2_pll_set, |
221 | }; | 222 | }; |
222 | 223 | ||
223 | static u8 alps_bsru6_inittab[] = { | ||
224 | 0x01, 0x15, | ||
225 | 0x02, 0x00, | ||
226 | 0x03, 0x00, | ||
227 | 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */ | ||
228 | 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */ | ||
229 | 0x06, 0x40, /* DAC not used, set to high impendance mode */ | ||
230 | 0x07, 0x00, /* DAC LSB */ | ||
231 | 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */ | ||
232 | 0x09, 0x00, /* FIFO */ | ||
233 | 0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */ | ||
234 | 0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */ | ||
235 | 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ | ||
236 | 0x10, 0x3f, // AGC2 0x3d | ||
237 | 0x11, 0x84, | ||
238 | 0x12, 0xb9, | ||
239 | 0x15, 0xc9, // lock detector threshold | ||
240 | 0x16, 0x00, | ||
241 | 0x17, 0x00, | ||
242 | 0x18, 0x00, | ||
243 | 0x19, 0x00, | ||
244 | 0x1a, 0x00, | ||
245 | 0x1f, 0x50, | ||
246 | 0x20, 0x00, | ||
247 | 0x21, 0x00, | ||
248 | 0x22, 0x00, | ||
249 | 0x23, 0x00, | ||
250 | 0x28, 0x00, // out imp: normal out type: parallel FEC mode:0 | ||
251 | 0x29, 0x1e, // 1/2 threshold | ||
252 | 0x2a, 0x14, // 2/3 threshold | ||
253 | 0x2b, 0x0f, // 3/4 threshold | ||
254 | 0x2c, 0x09, // 5/6 threshold | ||
255 | 0x2d, 0x05, // 7/8 threshold | ||
256 | 0x2e, 0x01, | ||
257 | 0x31, 0x1f, // test all FECs | ||
258 | 0x32, 0x19, // viterbi and synchro search | ||
259 | 0x33, 0xfc, // rs control | ||
260 | 0x34, 0x93, // error control | ||
261 | 0x0f, 0x52, | ||
262 | 0xff, 0xff | ||
263 | }; | ||
264 | |||
265 | static int alps_bsru6_set_symbol_rate(struct dvb_frontend* fe, u32 srate, u32 ratio) | ||
266 | { | ||
267 | u8 aclk = 0; | ||
268 | u8 bclk = 0; | ||
269 | |||
270 | if (srate < 1500000) { aclk = 0xb7; bclk = 0x47; } | ||
271 | else if (srate < 3000000) { aclk = 0xb7; bclk = 0x4b; } | ||
272 | else if (srate < 7000000) { aclk = 0xb7; bclk = 0x4f; } | ||
273 | else if (srate < 14000000) { aclk = 0xb7; bclk = 0x53; } | ||
274 | else if (srate < 30000000) { aclk = 0xb6; bclk = 0x53; } | ||
275 | else if (srate < 45000000) { aclk = 0xb4; bclk = 0x51; } | ||
276 | |||
277 | stv0299_writereg (fe, 0x13, aclk); | ||
278 | stv0299_writereg (fe, 0x14, bclk); | ||
279 | stv0299_writereg (fe, 0x1f, (ratio >> 16) & 0xff); | ||
280 | stv0299_writereg (fe, 0x20, (ratio >> 8) & 0xff); | ||
281 | stv0299_writereg (fe, 0x21, (ratio ) & 0xf0); | ||
282 | |||
283 | return 0; | ||
284 | } | ||
285 | |||
286 | static int alps_bsru6_pll_set(struct dvb_frontend* fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters* params) | ||
287 | { | ||
288 | u8 data[4]; | ||
289 | u32 div; | ||
290 | struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) }; | ||
291 | |||
292 | if ((params->frequency < 950000) || (params->frequency > 2150000)) return -EINVAL; | ||
293 | |||
294 | div = (params->frequency + (125 - 1)) / 125; // round correctly | ||
295 | data[0] = (div >> 8) & 0x7f; | ||
296 | data[1] = div & 0xff; | ||
297 | data[2] = 0x80 | ((div & 0x18000) >> 10) | 4; | ||
298 | data[3] = 0xC4; | ||
299 | |||
300 | if (params->frequency > 1530000) data[3] = 0xc0; | ||
301 | |||
302 | if (i2c_transfer(i2c, &msg, 1) != 1) return -EIO; | ||
303 | return 0; | ||
304 | } | ||
305 | |||
306 | static struct stv0299_config alps_bsru6_config = { | ||
307 | |||
308 | .demod_address = 0x68, | ||
309 | .inittab = alps_bsru6_inittab, | ||
310 | .mclk = 88000000UL, | ||
311 | .invert = 1, | ||
312 | .skip_reinit = 0, | ||
313 | .lock_output = STV0229_LOCKOUTPUT_1, | ||
314 | .volt13_op0_op1 = STV0299_VOLT13_OP1, | ||
315 | .min_delay_ms = 100, | ||
316 | .set_symbol_rate = alps_bsru6_set_symbol_rate, | ||
317 | .pll_set = alps_bsru6_pll_set, | ||
318 | }; | ||
319 | |||
320 | static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) | 224 | static int alps_tdbe2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) |
321 | { | 225 | { |
322 | struct budget* budget = (struct budget*) fe->dvb->priv; | 226 | struct budget* budget = (struct budget*) fe->dvb->priv; |