Lines Matching +full:frame +full:- +full:inversion

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 TDA10023 - DVB-C decoder
4 (as used in Philips CU1216-3 NIM and the Reelbox DVB-C tuner card)
56 …struct i2c_msg msg [] = { { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 … in tda10023_readreg()
57 { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } }; in tda10023_readreg()
60 ret = i2c_transfer (state->i2c, msg, 2); in tda10023_readreg()
62 int num = state->frontend.dvb ? state->frontend.dvb->num : -1; in tda10023_readreg()
72 struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 }; in tda10023_writereg()
75 ret = i2c_transfer (state->i2c, &msg, 1); in tda10023_writereg()
77 int num = state->frontend.dvb ? state->frontend.dvb->num : -1; in tda10023_writereg()
81 return (ret != 1) ? -EREMOTEIO : 0; in tda10023_writereg()
120 struct i2c_msg msg = {.addr=state->config->demod_address, .flags=0, .buf=buf, .len=2}; in lock_tuner()
122 if(i2c_transfer(state->i2c, &msg, 1) != 1) in lock_tuner()
125 return -EREMOTEIO; in lock_tuner()
134 struct i2c_msg msg_post={.addr=state->config->demod_address, .flags=0, .buf=buf, .len=2}; in unlock_tuner()
136 if(i2c_transfer(state->i2c, &msg_post, 1) != 1) in unlock_tuner()
139 return -EREMOTEIO; in unlock_tuner()
146 reg0 |= state->reg0 & 0x63; in tda10023_setup_reg0()
151 state->reg0 = reg0; in tda10023_setup_reg0()
164 u32 sysclk_x_10 = state->sysclk * 10; in tda10023_set_symbolrate()
189 BDRI = (state->sysclk)*16; in tda10023_set_symbolrate()
202 do_div(BDRX, state->sysclk); /* BDRX/=SYSCLK; */ in tda10023_set_symbolrate()
219 struct tda10023_state* state = fe->demodulator_priv; in tda10023_init()
227 /* 012 */ 0x28, 0xff, (state->pll_m-1), in tda10023_init()
229 /* 015 */ 0x29, 0xff, ((state->pll_p-1)<<6)|(state->pll_n-1), in tda10023_init()
271 dprintk("DVB: TDA10023(%d): init chip\n", fe->dvb->num); in tda10023_init()
274 if (state->config->deltaf) { in tda10023_init()
275 tda10023_inittab[80] = (state->config->deltaf & 0xff); in tda10023_init()
276 tda10023_inittab[83] = (state->config->deltaf >> 8); in tda10023_init()
279 if (state->config->output_mode) in tda10023_init()
280 tda10023_inittab[95] = state->config->output_mode; in tda10023_init()
293 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in tda10023_set_parameters()
294 u32 delsys = c->delivery_system; in tda10023_set_parameters()
295 unsigned qam = c->modulation; in tda10023_set_parameters()
297 struct tda10023_state* state = fe->demodulator_priv; in tda10023_set_parameters()
316 return -EINVAL; in tda10023_set_parameters()
321 * "if (qam > 5) return -EINVAL;" in tda10023_set_parameters()
335 return -EINVAL; in tda10023_set_parameters()
338 if (fe->ops.tuner_ops.set_params) { in tda10023_set_parameters()
339 fe->ops.tuner_ops.set_params(fe); in tda10023_set_parameters()
340 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); in tda10023_set_parameters()
343 tda10023_set_symbolrate(state, c->symbol_rate); in tda10023_set_parameters()
350 tda10023_writereg(state, 0x04, (c->inversion ? 0x12 : 0x32)); in tda10023_set_parameters()
351 tda10023_writebit(state, 0x04, 0x60, (c->inversion ? 0 : 0x20)); in tda10023_set_parameters()
368 struct tda10023_state* state = fe->demodulator_priv; in tda10023_read_status()
373 //0x11[1] == CARLOCK -> Carrier locked in tda10023_read_status()
374 //0x11[2] == FSYNC -> Frame synchronisation in tda10023_read_status()
375 //0x11[3] == FEL -> Front End locked in tda10023_read_status()
376 //0x11[6] == NODVB -> DVB Mode Information in tda10023_read_status()
393 struct tda10023_state* state = fe->demodulator_priv; in tda10023_read_ber()
406 struct tda10023_state* state = fe->demodulator_priv; in tda10023_read_signal_strength()
409 u16 gain = ((255-tda10023_readreg(state, 0x17))) + (255-ifgain)/16; in tda10023_read_signal_strength()
410 // Max raw value is about 0xb0 -> Normalize to >0xf0 after 0x90 in tda10023_read_signal_strength()
412 gain=gain+2*(gain-0x90); in tda10023_read_signal_strength()
422 struct tda10023_state* state = fe->demodulator_priv; in tda10023_read_snr()
431 struct tda10023_state* state = fe->demodulator_priv; in tda10023_read_ucblocks()
449 struct tda10023_state* state = fe->demodulator_priv; in tda10023_get_frontend()
461 state->frontend.dvb->num, afc, in tda10023_get_frontend()
462 -((s32)p->symbol_rate * afc) >> 10); in tda10023_get_frontend()
465 p->inversion = (inv&0x20?0:1); in tda10023_get_frontend()
466 p->modulation = ((state->reg0 >> 2) & 7) + QAM_16; in tda10023_get_frontend()
468 p->fec_inner = FEC_NONE; in tda10023_get_frontend()
469 p->frequency = ((p->frequency + 31250) / 62500) * 62500; in tda10023_get_frontend()
472 p->frequency -= ((s32)p->symbol_rate * afc) >> 10; in tda10023_get_frontend()
479 struct tda10023_state* state = fe->demodulator_priv; in tda10023_sleep()
489 struct tda10023_state* state = fe->demodulator_priv; in tda10023_i2c_gate_ctrl()
501 struct tda10023_state* state = fe->demodulator_priv; in tda10023_release()
518 state->config = config; in tda10023_attach()
519 state->i2c = i2c; in tda10023_attach()
527 memcpy(&state->frontend.ops, &tda10023_ops, sizeof(struct dvb_frontend_ops)); in tda10023_attach()
528 state->pwm = pwm; in tda10023_attach()
529 state->reg0 = REG0_INIT_VAL; in tda10023_attach()
530 if (state->config->xtal) { in tda10023_attach()
531 state->xtal = state->config->xtal; in tda10023_attach()
532 state->pll_m = state->config->pll_m; in tda10023_attach()
533 state->pll_p = state->config->pll_p; in tda10023_attach()
534 state->pll_n = state->config->pll_n; in tda10023_attach()
537 state->xtal = 28920000; in tda10023_attach()
538 state->pll_m = 8; in tda10023_attach()
539 state->pll_p = 4; in tda10023_attach()
540 state->pll_n = 1; in tda10023_attach()
544 state->sysclk = (state->xtal * state->pll_m / \ in tda10023_attach()
545 (state->pll_n * state->pll_p)); in tda10023_attach()
547 state->frontend.ops.info.symbol_rate_min = (state->sysclk/2)/64; in tda10023_attach()
548 state->frontend.ops.info.symbol_rate_max = (state->sysclk/2)/4; in tda10023_attach()
551 __func__, state->xtal, state->pll_m, state->pll_p, in tda10023_attach()
552 state->pll_n); in tda10023_attach()
554 state->frontend.demodulator_priv = state; in tda10023_attach()
555 return &state->frontend; in tda10023_attach()
565 .name = "Philips TDA10023 DVB-C",
593 MODULE_DESCRIPTION("Philips TDA10023 DVB-C demodulator driver");