aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/dib7000p.c
diff options
context:
space:
mode:
authorPatrick Boettcher <pb@linuxtv.org>2007-07-30 11:49:04 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 21:03:44 -0400
commit01373a5c97ced83d4cb520f7e56c80454a198bfb (patch)
tree4423207d7f0c50de6fa3672943c07ff49d5da773 /drivers/media/dvb/frontends/dib7000p.c
parentb6884a17fc70e979ef34e4b5560988b522bb50a0 (diff)
V4L/DVB (5955): Add support for DiB7070-based devices
This changeset adds support for DiB7070P-based devices by adding the dib0070-driver and putting the appropriate layouts into dib0700_devices.c It also includes a new firmware for the dib0700 which is necessary to make the DiB7070-boards work and it also should fix the i2c-problems on some boards. Signed-off-by: Jean-Philippe Sibers <jpsibers@dibcom.fr> Signed-off-by: Patrick Boettcher <pboettcher@dibcom.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/frontends/dib7000p.c')
-rw-r--r--drivers/media/dvb/frontends/dib7000p.c44
1 files changed, 38 insertions, 6 deletions
diff --git a/drivers/media/dvb/frontends/dib7000p.c b/drivers/media/dvb/frontends/dib7000p.c
index 156c53ab56db..1175ab9a4532 100644
--- a/drivers/media/dvb/frontends/dib7000p.c
+++ b/drivers/media/dvb/frontends/dib7000p.c
@@ -36,9 +36,9 @@ struct dib7000p_state {
36 struct dibx000_agc_config *current_agc; 36 struct dibx000_agc_config *current_agc;
37 u32 timf; 37 u32 timf;
38 38
39 uint8_t div_force_off : 1; 39 u8 div_force_off : 1;
40 uint8_t div_state : 1; 40 u8 div_state : 1;
41 uint16_t div_sync_wait; 41 u16 div_sync_wait;
42 42
43 u8 agc_state; 43 u8 agc_state;
44 44
@@ -156,7 +156,7 @@ static int dib7000p_set_diversity_in(struct dvb_frontend *demod, int onoff)
156 dprintk( "diversity combination deactivated - forced by COFDM parameters"); 156 dprintk( "diversity combination deactivated - forced by COFDM parameters");
157 onoff = 0; 157 onoff = 0;
158 } 158 }
159 state->div_state = (uint8_t)onoff; 159 state->div_state = (u8)onoff;
160 160
161 if (onoff) { 161 if (onoff) {
162 dib7000p_write_word(state, 204, 6); 162 dib7000p_write_word(state, 204, 6);
@@ -294,6 +294,16 @@ static int dib7000p_sad_calib(struct dib7000p_state *state)
294 return 0; 294 return 0;
295} 295}
296 296
297int dib7000p_set_wbd_ref(struct dvb_frontend *demod, u16 value)
298{
299 struct dib7000p_state *state = demod->demodulator_priv;
300 if (value > 4095)
301 value = 4095;
302 state->wbd_ref = value;
303 return dib7000p_write_word(state, 105, (dib7000p_read_word(state, 105) & 0xf000) | value);
304}
305
306EXPORT_SYMBOL(dib7000p_set_wbd_ref);
297static void dib7000p_reset_pll(struct dib7000p_state *state) 307static void dib7000p_reset_pll(struct dib7000p_state *state)
298{ 308{
299 struct dibx000_bandwidth_config *bw = &state->cfg.bw[0]; 309 struct dibx000_bandwidth_config *bw = &state->cfg.bw[0];
@@ -335,6 +345,28 @@ static int dib7000p_reset_gpio(struct dib7000p_state *st)
335 return 0; 345 return 0;
336} 346}
337 347
348static int dib7000p_cfg_gpio(struct dib7000p_state *st, u8 num, u8 dir, u8 val)
349{
350 st->gpio_dir = dib7000p_read_word(st, 1029);
351 st->gpio_dir &= ~(1 << num); /* reset the direction bit */
352 st->gpio_dir |= (dir & 0x1) << num; /* set the new direction */
353 dib7000p_write_word(st, 1029, st->gpio_dir);
354
355 st->gpio_val = dib7000p_read_word(st, 1030);
356 st->gpio_val &= ~(1 << num); /* reset the direction bit */
357 st->gpio_val |= (val & 0x01) << num; /* set the new value */
358 dib7000p_write_word(st, 1030, st->gpio_val);
359
360 return 0;
361}
362
363int dib7000p_set_gpio(struct dvb_frontend *demod, u8 num, u8 dir, u8 val)
364{
365 struct dib7000p_state *state = demod->demodulator_priv;
366 return dib7000p_cfg_gpio(state, num, dir, val);
367}
368
369EXPORT_SYMBOL(dib7000p_set_gpio);
338static u16 dib7000p_defaults[] = 370static u16 dib7000p_defaults[] =
339 371
340{ 372{
@@ -501,7 +533,7 @@ static int dib7000p_update_lna(struct dib7000p_state *state)
501 533
502 // when there is no LNA to program return immediatly 534 // when there is no LNA to program return immediatly
503 if (state->cfg.update_lna) { 535 if (state->cfg.update_lna) {
504 // read dyn_gain here (because it is demod-dependent and not tuner) 536 // read dyn_gain here (because it is demod-dependent and not fe)
505 dyn_gain = dib7000p_read_word(state, 394); 537 dyn_gain = dib7000p_read_word(state, 394);
506 if (state->cfg.update_lna(&state->demod,dyn_gain)) { // LNA has changed 538 if (state->cfg.update_lna(&state->demod,dyn_gain)) { // LNA has changed
507 dib7000p_restart_agc(state); 539 dib7000p_restart_agc(state);
@@ -617,7 +649,7 @@ static int dib7000p_agc_startup(struct dvb_frontend *demod, struct dvb_frontend_
617 break; 649 break;
618 650
619 case 3: /* split search ended */ 651 case 3: /* split search ended */
620 agc_split = (uint8_t)dib7000p_read_word(state, 396); /* store the split value for the next time */ 652 agc_split = (u8)dib7000p_read_word(state, 396); /* store the split value for the next time */
621 dib7000p_write_word(state, 78, dib7000p_read_word(state, 394)); /* set AGC gain start value */ 653 dib7000p_write_word(state, 78, dib7000p_read_word(state, 394)); /* set AGC gain start value */
622 654
623 dib7000p_write_word(state, 75, state->current_agc->setup); /* std AGC loop */ 655 dib7000p_write_word(state, 75, state->current_agc->setup); /* std AGC loop */