/*
* at76c651.c
- *
+ *
* Atmel DVB-C Frontend Driver (at76c651/tua6010xs)
*
* Copyright (C) 2001 fnbrd <fnbrd@gmx.de>
if (state->revision == 0x11) {
at76c651_writereg(state, 0x2E, 0x38);
at76c651_writereg(state, 0x2F, 0x13);
-}
+ }
at76c651_disable_interrupts(state);
return at76c651_writereg(state, 0x60, feciqinv);
}
-
-
-
-
-
-
-
-
static int at76c651_set_parameters(struct dvb_frontend* fe,
- struct dvb_frontend_parameters *p)
+ struct dvb_frontend_parameters *p)
{
int ret;
- struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv;
+ struct at76c651_state* state = fe->demodulator_priv;
at76c651_writereg(state, 0x0c, 0xc3);
state->config->pll_set(fe, p);
static int at76c651_set_defaults(struct dvb_frontend* fe)
{
- struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv;
+ struct at76c651_state* state = fe->demodulator_priv;
at76c651_set_symbol_rate(state, 6900000);
at76c651_set_qam(state, QAM_64);
at76c651_writereg(state, 0x0c, 0xc3);
state->config->pll_init(fe);
at76c651_writereg(state, 0x0c, 0xc2);
-}
+ }
return 0;
}
static int at76c651_read_status(struct dvb_frontend* fe, fe_status_t* status)
- {
- struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv;
- u8 sync;
+{
+ struct at76c651_state* state = fe->demodulator_priv;
+ u8 sync;
- /*
- * Bits: FEC, CAR, EQU, TIM, AGC2, AGC1, ADC, PLL (PLL=0)
- */
+ /*
+ * Bits: FEC, CAR, EQU, TIM, AGC2, AGC1, ADC, PLL (PLL=0)
+ */
sync = at76c651_readreg(state, 0x80);
- *status = 0;
-
- if (sync & (0x04 | 0x10)) /* AGC1 || TIM */
- *status |= FE_HAS_SIGNAL;
-
- if (sync & 0x10) /* TIM */
- *status |= FE_HAS_CARRIER;
-
- if (sync & 0x80) /* FEC */
- *status |= FE_HAS_VITERBI;
-
- if (sync & 0x40) /* CAR */
- *status |= FE_HAS_SYNC;
-
- if ((sync & 0xF0) == 0xF0) /* TIM && EQU && CAR && FEC */
- *status |= FE_HAS_LOCK;
+ *status = 0;
+
+ if (sync & (0x04 | 0x10)) /* AGC1 || TIM */
+ *status |= FE_HAS_SIGNAL;
+ if (sync & 0x10) /* TIM */
+ *status |= FE_HAS_CARRIER;
+ if (sync & 0x80) /* FEC */
+ *status |= FE_HAS_VITERBI;
+ if (sync & 0x40) /* CAR */
+ *status |= FE_HAS_SYNC;
+ if ((sync & 0xF0) == 0xF0) /* TIM && EQU && CAR && FEC */
+ *status |= FE_HAS_LOCK;
return 0;
- }
+}
static int at76c651_read_ber(struct dvb_frontend* fe, u32* ber)
- {
- struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv;
+{
+ struct at76c651_state* state = fe->demodulator_priv;
*ber = (at76c651_readreg(state, 0x81) & 0x0F) << 16;
*ber |= at76c651_readreg(state, 0x82) << 8;
*ber |= at76c651_readreg(state, 0x83);
- *ber *= 10;
+ *ber *= 10;
return 0;
- }
+}
static int at76c651_read_signal_strength(struct dvb_frontend* fe, u16* strength)
- {
- struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv;
+{
+ struct at76c651_state* state = fe->demodulator_priv;
u8 gain = ~at76c651_readreg(state, 0x91);
*strength = (gain << 8) | gain;
static int at76c651_read_snr(struct dvb_frontend* fe, u16* snr)
{
- struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv;
+ struct at76c651_state* state = fe->demodulator_priv;
*snr = 0xFFFF -
((at76c651_readreg(state, 0x8F) << 8) |
at76c651_readreg(state, 0x90));
-
return 0;
}
static int at76c651_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
- {
- struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv;
+{
+ struct at76c651_state* state = fe->demodulator_priv;
*ucblocks = at76c651_readreg(state, 0x82);
fesettings->step_size = 0;
fesettings->max_drift = 0;
return 0;
- }
+}
static void at76c651_release(struct dvb_frontend* fe)
{
- struct at76c651_state* state = (struct at76c651_state*) fe->demodulator_priv;
- kfree(state);
- }
+ struct at76c651_state* state = fe->demodulator_priv;
+ kfree(state);
+}
static struct dvb_frontend_ops at76c651_ops;
struct at76c651_state* state = NULL;
/* allocate memory for the internal state */
- state = (struct at76c651_state*) kmalloc(sizeof(struct at76c651_state), GFP_KERNEL);
+ state = kmalloc(sizeof(struct at76c651_state), GFP_KERNEL);
if (state == NULL) goto error;
/* setup the state */
return &state->frontend;
error:
- if (state) kfree(state);
+ kfree(state);
return NULL;
}