Lines Matching +full:ave +full:- +full:ctrl

4  *  Copyright (C) 2001-5, B2C2 inc.
8 * This driver is "hard-coded" to be used with the 1st generation of
9 * Technisat/B2C2's Air2PC ATSC PCI/USB cards/boxes. The pll-programming
13 * The driver works also with QAM64 DVB-C, but had an unreasonable high
17 * called "dvb-fe-bcm3510-01.fw".
31 * Ave, Cambridge, MA 02139, USA.
68 MODULE_PARM_DESC(debug, "set debugging level (1=info,2=i2c (|-able)).");
85 …struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = b, .len = len + 1 … in bcm3510_writebytes()
94 if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { in bcm3510_writebytes()
97 __func__, state->config->demod_address, reg, err); in bcm3510_writebytes()
98 return -EREMOTEIO; in bcm3510_writebytes()
107 { .addr = state->config->demod_address, .flags = 0, .buf = &reg, .len = 1 }, in bcm3510_readbytes()
108 { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = buf, .len = len } in bcm3510_readbytes()
114 if ((err = i2c_transfer (state->i2c, msg, 2)) != 2) { in bcm3510_readbytes()
116 __func__, state->config->demod_address, reg, err); in bcm3510_readbytes()
117 return -EREMOTEIO; in bcm3510_readbytes()
133 return bcm3510_readbytes(state,reg,&v->raw,1); in bcm3510_readB()
165 deb_info("HAB is running already - clearing it.\n"); in bcm3510_hab_send_request()
168 // return -EBUSY; in bcm3510_hab_send_request()
202 return -ETIMEDOUT; in bcm3510_hab_send_request()
212 return -EINVAL; in bcm3510_do_hab_cmd()
217 return -EINVAL; in bcm3510_do_hab_cmd()
228 if (mutex_lock_interruptible(&st->hab_mutex) < 0) in bcm3510_do_hab_cmd()
229 return -EAGAIN; in bcm3510_do_hab_cmd()
241 mutex_unlock(&st->hab_mutex); in bcm3510_do_hab_cmd()
258 return -EBUSY;
284 if (time_after(jiffies,st->next_status_check)) { in bcm3510_refresh_state()
285 …bcm3510_do_hab_cmd(st, CMD_STATUS, MSGID_STATUS1, NULL,0, (u8 *)&st->status1, sizeof(st->status1)); in bcm3510_refresh_state()
286 …bcm3510_do_hab_cmd(st, CMD_STATUS, MSGID_STATUS2, NULL,0, (u8 *)&st->status2, sizeof(st->status2)); in bcm3510_refresh_state()
287 st->next_status_check = jiffies + (st->status_check_interval*HZ)/1000; in bcm3510_refresh_state()
294 struct bcm3510_state* st = fe->demodulator_priv; in bcm3510_read_status()
298 if (st->status1.STATUS1.RECEIVER_LOCK) in bcm3510_read_status()
301 if (st->status1.STATUS1.FEC_LOCK) in bcm3510_read_status()
304 if (st->status1.STATUS1.OUT_PLL_LOCK) in bcm3510_read_status()
308 st->status_check_interval = 1500; in bcm3510_read_status()
310 st->status_check_interval = 500; in bcm3510_read_status()
318 struct bcm3510_state* st = fe->demodulator_priv; in bcm3510_read_ber()
321 *ber = (st->status2.LDBER0 << 16) | (st->status2.LDBER1 << 8) | st->status2.LDBER2; in bcm3510_read_ber()
327 struct bcm3510_state* st = fe->demodulator_priv; in bcm3510_read_unc()
329 *unc = (st->status2.LDUERC0 << 8) | st->status2.LDUERC1; in bcm3510_read_unc()
335 struct bcm3510_state* st = fe->demodulator_priv; in bcm3510_read_signal_strength()
339 t = st->status2.SIGNAL; in bcm3510_read_signal_strength()
346 t -= 90; in bcm3510_read_signal_strength()
355 struct bcm3510_state* st = fe->demodulator_priv; in bcm3510_read_snr()
358 *snr = st->status1.SNR_EST0*1000 + ((st->status1.SNR_EST1*1000) >> 8); in bcm3510_read_snr()
378 c.ctl_dat[0].ctrl.size = BITS_8; in bcm3510_tuner_cmd()
382 c.ctl_dat[1].ctrl.size = BITS_8; in bcm3510_tuner_cmd()
386 c.ctl_dat[2].ctrl.size = BITS_3; in bcm3510_tuner_cmd()
390 c.ctl_dat[3].ctrl.size = BITS_3; in bcm3510_tuner_cmd()
391 c.ctl_dat[3].ctrl.clk_off = 1; in bcm3510_tuner_cmd()
392 c.ctl_dat[3].ctrl.cs0 = 1; in bcm3510_tuner_cmd()
396 c.ctl_dat[4].ctrl.size = BITS_8; in bcm3510_tuner_cmd()
400 c.ctl_dat[5].ctrl.size = BITS_8; in bcm3510_tuner_cmd()
404 c.ctl_dat[6].ctrl.size = BITS_3; in bcm3510_tuner_cmd()
408 c.ctl_dat[7].ctrl.size = BITS_3; in bcm3510_tuner_cmd()
409 c.ctl_dat[7].ctrl.clk_off = 1; in bcm3510_tuner_cmd()
410 c.ctl_dat[7].ctrl.cs0 = 1; in bcm3510_tuner_cmd()
414 c.ctl_dat[8].ctrl.size = BITS_8; in bcm3510_tuner_cmd()
418 c.ctl_dat[9].ctrl.size = BITS_8; in bcm3510_tuner_cmd()
422 c.ctl_dat[10].ctrl.size = BITS_3; in bcm3510_tuner_cmd()
426 c.ctl_dat[11].ctrl.size = BITS_3; in bcm3510_tuner_cmd()
427 c.ctl_dat[11].ctrl.clk_off = 1; in bcm3510_tuner_cmd()
428 c.ctl_dat[11].ctrl.cs1 = 1; in bcm3510_tuner_cmd()
432 c.ctl_dat[12].ctrl.size = BITS_8; in bcm3510_tuner_cmd()
436 c.ctl_dat[13].ctrl.size = BITS_8; in bcm3510_tuner_cmd()
440 c.ctl_dat[14].ctrl.size = BITS_3; in bcm3510_tuner_cmd()
444 c.ctl_dat[15].ctrl.size = BITS_3; in bcm3510_tuner_cmd()
445 c.ctl_dat[15].ctrl.clk_off = 1; in bcm3510_tuner_cmd()
446 c.ctl_dat[15].ctrl.cs1 = 1; in bcm3510_tuner_cmd()
470 freq -= 470001; in bcm3510_set_freq()
473 freq -= 90001; in bcm3510_set_freq()
476 freq -= 76001; in bcm3510_set_freq()
479 freq -= 54001; in bcm3510_set_freq()
492 return -EINVAL; in bcm3510_set_freq()
497 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in bcm3510_set_frontend()
498 struct bcm3510_state* st = fe->demodulator_priv; in bcm3510_set_frontend()
504 switch (c->modulation) { in bcm3510_set_frontend()
543 return -EINVAL; in bcm3510_set_frontend()
571 ret = bcm3510_set_freq(st, c->frequency); in bcm3510_set_frontend()
575 memset(&st->status1,0,sizeof(st->status1)); in bcm3510_set_frontend()
576 memset(&st->status2,0,sizeof(st->status2)); in bcm3510_set_frontend()
577 st->status_check_interval = 500; in bcm3510_set_frontend()
592 s->min_delay_ms = 1000; in bcm3510_get_tune_settings()
593 s->step_size = 0; in bcm3510_get_tune_settings()
594 s->max_drift = 0; in bcm3510_get_tune_settings()
600 struct bcm3510_state* state = fe->demodulator_priv; in bcm3510_release()
608 #define BCM3510_DEFAULT_FIRMWARE "dvb-fe-bcm3510-01.fw"
632 struct bcm3510_state* st = fe->demodulator_priv; in bcm3510_download_firmware()
639 if ((ret = st->config->request_firmware(fe, &fw, BCM3510_DEFAULT_FIRMWARE)) < 0) { in bcm3510_download_firmware()
643 deb_info("got firmware: %zu\n", fw->size); in bcm3510_download_firmware()
645 b = fw->data; in bcm3510_download_firmware()
646 for (i = 0; i < fw->size;) { in bcm3510_download_firmware()
649 deb_info("firmware chunk, addr: 0x%04x, len: 0x%04x, total length: 0x%04zx\n",addr,len,fw->size); in bcm3510_download_firmware()
676 return -ENODEV; in bcm3510_check_firmware_version()
700 return -ETIMEDOUT; in bcm3510_reset()
724 return -ETIMEDOUT; in bcm3510_clear_reset()
736 deb_info("AP is already running - firmware already loaded.\n"); in bcm3510_init_cold()
745 /* tri-state */ in bcm3510_init_cold()
751 if ((ret = bcm3510_download_firmware(&st->frontend)) < 0 || in bcm3510_init_cold()
762 struct bcm3510_state* st = fe->demodulator_priv; in bcm3510_init()
783 return -ENODEV; in bcm3510_init()
809 state->config = config; in bcm3510_attach()
810 state->i2c = i2c; in bcm3510_attach()
813 memcpy(&state->frontend.ops, &bcm3510_ops, sizeof(struct dvb_frontend_ops)); in bcm3510_attach()
814 state->frontend.demodulator_priv = state; in bcm3510_attach()
816 mutex_init(&state->hab_mutex); in bcm3510_attach()
831 return &state->frontend; in bcm3510_attach()