23 #include <linux/kernel.h>
24 #include <linux/module.h>
25 #include <linux/string.h>
26 #include <linux/slab.h>
42 #define dprintk if (debug) printk
51 dprintk(
"nxt6000: nxt6000_write error (reg: 0x%02X, data: 0x%02X, ret: %d)\n", reg, data, ret);
53 return (ret != 1) ? -
EIO : 0;
62 {.
addr = state->
config->demod_address,.flags = 0,.buf = b0,.len = 1},
63 {.addr = state->
config->demod_address,.flags =
I2C_M_RD,.buf = b1,.len = 1}
69 dprintk(
"nxt6000: nxt6000_read error (reg: 0x%02X, ret: %d)\n", reg, ret);
91 nominal_rate = 0x55B7;
95 nominal_rate = 0x6400;
99 nominal_rate = 0x7249;
114 switch (guard_interval) {
154 switch (transmission_mode) {
157 if ((result = nxt6000_writereg(state,
EN_DMD_RACQ, 0x00 | (nxt6000_readreg(state,
EN_DMD_RACQ) & ~0x03))) < 0)
164 if ((result = nxt6000_writereg(state,
EN_DMD_RACQ, 0x02 | (nxt6000_readreg(state,
EN_DMD_RACQ) & ~0x03))) < 0)
180 nxt6000_writereg(state,
BER_CTRL, (0x01 << 1) | 0x01);
192 nxt6000_writereg(state,
OFDM_CAS_CTL, (0x01 << 7) | (0x02 << 3) | 0x04);
193 nxt6000_writereg(state,
CAS_FREQ, 0xBB);
199 nxt6000_writereg(state,
EN_DMD_RACQ, (1 << 7) | (3 << 4) | 2);
202 if (state->
config->clock_inversion)
226 printk(
"NXT6000 status:");
230 printk(
" DATA DESCR LOCK: %d,", val & 0x01);
231 printk(
" DATA SYNC LOCK: %d,", (val >> 1) & 0x01);
235 printk(
" VITERBI LOCK: %d,", (val >> 7) & 0x01);
237 switch ((val >> 4) & 0x07) {
240 printk(
" VITERBI CODERATE: 1/2,");
244 printk(
" VITERBI CODERATE: 2/3,");
248 printk(
" VITERBI CODERATE: 3/4,");
252 printk(
" VITERBI CODERATE: 5/6,");
256 printk(
" VITERBI CODERATE: 7/8,");
260 printk(
" VITERBI CODERATE: Reserved,");
266 printk(
" CHCTrack: %d,", (val >> 7) & 0x01);
267 printk(
" TPSLock: %d,", (val >> 6) & 0x01);
268 printk(
" SYRLock: %d,", (val >> 5) & 0x01);
269 printk(
" AGCLock: %d,", (val >> 4) & 0x01);
271 switch (val & 0x0F) {
274 printk(
" CoreState: IDLE,");
278 printk(
" CoreState: WAIT_AGC,");
282 printk(
" CoreState: WAIT_SYR,");
286 printk(
" CoreState: WAIT_PPM,");
290 printk(
" CoreState: WAIT_TRL,");
294 printk(
" CoreState: WAIT_TPS,");
298 printk(
" CoreState: MONITOR_TPS,");
302 printk(
" CoreState: Reserved,");
308 printk(
" SYRLock: %d,", (val >> 4) & 0x01);
309 printk(
" SYRMode: %s,", (val >> 2) & 0x01 ?
"8K" :
"2K");
311 switch ((val >> 4) & 0x03) {
314 printk(
" SYRGuard: 1/32,");
318 printk(
" SYRGuard: 1/16,");
322 printk(
" SYRGuard: 1/8,");
326 printk(
" SYRGuard: 1/4,");
332 switch ((val >> 4) & 0x07) {
355 printk(
" TPSLP: Reserved,");
359 switch (val & 0x07) {
382 printk(
" TPSHP: Reserved,");
388 printk(
" TPSMode: %s,", val & 0x01 ?
"8K" :
"2K");
390 switch ((val >> 4) & 0x03) {
393 printk(
" TPSGuard: 1/32,");
397 printk(
" TPSGuard: 1/16,");
401 printk(
" TPSGuard: 1/8,");
405 printk(
" TPSGuard: 1/4,");
415 printk(
" RF AGC LOCK: %d,", (val >> 4) & 0x01);
444 nxt6000_dump_status(state);
453 nxt6000_reset(state);
459 static int nxt6000_set_frontend(
struct dvb_frontend *fe)
465 if (fe->
ops.tuner_ops.set_params) {
466 fe->
ops.tuner_ops.set_params(fe);
467 if (fe->
ops.i2c_gate_ctrl) fe->
ops.i2c_gate_ctrl(fe, 0);
482 result = nxt6000_set_inversion(state, p->
inversion);
511 *ber = (nxt6000_readreg( state,
VIT_BER_1 ) << 8 ) |
519 static int nxt6000_read_signal_strength(
struct dvb_frontend* fe,
u16* signal_strength)
523 *signal_strength = (
short) (511 -
525 ((nxt6000_readreg(state,
AGC_GAIN_2) & 0x03) << 8)));
578 .name =
"NxtWave NXT6000 DVB-T",
580 .frequency_max = 863250000,
581 .frequency_stepsize = 62500,
583 .symbol_rate_min = 0,
584 .symbol_rate_max = 9360000,
585 .symbol_rate_tolerance = 4000,
594 .release = nxt6000_release,
596 .init = nxt6000_init,
597 .i2c_gate_ctrl = nxt6000_i2c_gate_ctrl,
599 .get_tune_settings = nxt6000_fe_get_tune_settings,
601 .set_frontend = nxt6000_set_frontend,
603 .read_status = nxt6000_read_status,
604 .read_ber = nxt6000_read_ber,
605 .read_signal_strength = nxt6000_read_signal_strength,
606 .read_snr = nxt6000_read_snr,