Lines Matching refs:state
35 struct af9015_state *state = d_to_priv(d); in af9015_ctrl_msg() local
41 state->buf[0] = req->cmd; in af9015_ctrl_msg()
42 state->buf[1] = state->seq++; in af9015_ctrl_msg()
43 state->buf[2] = req->i2c_addr; in af9015_ctrl_msg()
44 state->buf[3] = req->addr >> 8; in af9015_ctrl_msg()
45 state->buf[4] = req->addr & 0xff; in af9015_ctrl_msg()
46 state->buf[5] = req->mbox; in af9015_ctrl_msg()
47 state->buf[6] = req->addr_len; in af9015_ctrl_msg()
48 state->buf[7] = req->data_len; in af9015_ctrl_msg()
58 state->buf[2] |= 0x01; /* set I2C direction */ in af9015_ctrl_msg()
60 state->buf[0] = READ_WRITE_I2C; in af9015_ctrl_msg()
65 state->buf[0] = WRITE_VIRTUAL_MEMORY; in af9015_ctrl_msg()
93 memcpy(&state->buf[REQ_HDR_LEN], req->data, req->data_len); in af9015_ctrl_msg()
103 state->buf, wlen, state->buf, rlen); in af9015_ctrl_msg()
108 if (rlen && state->buf[1]) { in af9015_ctrl_msg()
110 KBUILD_MODNAME, state->buf[1]); in af9015_ctrl_msg()
117 memcpy(req->data, &state->buf[ACK_HDR_LEN], req->data_len); in af9015_ctrl_msg()
152 struct af9015_state *state = d_to_priv(d); in af9015_write_reg_i2c() local
155 if (addr == state->af9013_config[0].i2c_addr || in af9015_write_reg_i2c()
156 addr == state->af9013_config[1].i2c_addr) in af9015_write_reg_i2c()
165 struct af9015_state *state = d_to_priv(d); in af9015_read_reg_i2c() local
168 if (addr == state->af9013_config[0].i2c_addr || in af9015_read_reg_i2c()
169 addr == state->af9013_config[1].i2c_addr) in af9015_read_reg_i2c()
211 struct af9015_state *state = d_to_priv(d); in af9015_i2c_xfer() local
243 if (msg[i].addr == state->af9013_config[0].i2c_addr || in af9015_i2c_xfer()
244 msg[i].addr == state->af9013_config[1].i2c_addr) { in af9015_i2c_xfer()
260 if (msg[i].addr == state->af9013_config[0].i2c_addr) in af9015_i2c_xfer()
277 if (msg[i].addr == state->af9013_config[0].i2c_addr) { in af9015_i2c_xfer()
295 if (msg[i].addr == state->af9013_config[0].i2c_addr) in af9015_i2c_xfer()
353 struct af9015_state *state = d_to_priv(d); in af9015_download_firmware() local
363 state->firmware_size = fw->size; in af9015_download_firmware()
364 state->firmware_checksum = checksum; in af9015_download_firmware()
405 struct af9015_state *state = d_to_priv(d); in af9015_eeprom_hash() local
421 state->eeprom_sum *= GOLDEN_RATIO_PRIME_32; in af9015_eeprom_hash()
422 state->eeprom_sum += le32_to_cpu(((__le32 *)buf)[i]); in af9015_eeprom_hash()
429 __func__, state->eeprom_sum); in af9015_eeprom_hash()
438 struct af9015_state *state = d_to_priv(d); in af9015_read_config() local
460 state->ir_mode = val; in af9015_read_config()
469 state->dual_mode = val; in af9015_read_config()
470 dev_dbg(&d->udev->dev, "%s: TS mode=%d\n", __func__, state->dual_mode); in af9015_read_config()
474 state->dual_mode = 0; in af9015_read_config()
476 if (state->dual_mode) { in af9015_read_config()
483 state->af9013_config[1].i2c_addr = val; in af9015_read_config()
486 for (i = 0; i < state->dual_mode + 1; i++) { in af9015_read_config()
496 state->af9013_config[i].clock = 28800000; in af9015_read_config()
499 state->af9013_config[i].clock = 20480000; in af9015_read_config()
502 state->af9013_config[i].clock = 28000000; in af9015_read_config()
505 state->af9013_config[i].clock = 25000000; in af9015_read_config()
510 state->af9013_config[i].clock); in af9015_read_config()
518 state->af9013_config[i].if_frequency = val << 8; in af9015_read_config()
525 state->af9013_config[i].if_frequency += val; in af9015_read_config()
526 state->af9013_config[i].if_frequency *= 1000; in af9015_read_config()
528 i, state->af9013_config[i].if_frequency); in af9015_read_config()
535 state->mt2060_if1[i] = val << 8; in af9015_read_config()
540 state->mt2060_if1[i] += val; in af9015_read_config()
542 state->mt2060_if1[i]); in af9015_read_config()
558 state->af9013_config[i].spec_inv = 1; in af9015_read_config()
564 state->af9013_config[i].spec_inv = 0; in af9015_read_config()
567 state->af9013_config[i].gpio[1] = AF9013_GPIO_LO; in af9015_read_config()
568 state->af9013_config[i].spec_inv = 1; in af9015_read_config()
577 state->af9013_config[i].tuner = val; in af9015_read_config()
599 state->dual_mode = 0; in af9015_read_config()
602 state->af9013_config[0].if_frequency = 4570000; in af9015_read_config()
622 struct af9015_state *state = d_to_priv(d); in af9015_get_adapter_count() local
623 return state->dual_mode + 1; in af9015_get_adapter_count()
630 struct af9015_state *state = fe_to_priv(fe); in af9015_af9013_set_frontend() local
632 if (mutex_lock_interruptible(&state->fe_mutex)) in af9015_af9013_set_frontend()
635 ret = state->set_frontend[fe_to_adap(fe)->id](fe); in af9015_af9013_set_frontend()
637 mutex_unlock(&state->fe_mutex); in af9015_af9013_set_frontend()
647 struct af9015_state *state = fe_to_priv(fe); in af9015_af9013_read_status() local
649 if (mutex_lock_interruptible(&state->fe_mutex)) in af9015_af9013_read_status()
652 ret = state->read_status[fe_to_adap(fe)->id](fe, status); in af9015_af9013_read_status()
654 mutex_unlock(&state->fe_mutex); in af9015_af9013_read_status()
663 struct af9015_state *state = fe_to_priv(fe); in af9015_af9013_init() local
665 if (mutex_lock_interruptible(&state->fe_mutex)) in af9015_af9013_init()
668 ret = state->init[fe_to_adap(fe)->id](fe); in af9015_af9013_init()
670 mutex_unlock(&state->fe_mutex); in af9015_af9013_init()
679 struct af9015_state *state = fe_to_priv(fe); in af9015_af9013_sleep() local
681 if (mutex_lock_interruptible(&state->fe_mutex)) in af9015_af9013_sleep()
684 ret = state->sleep[fe_to_adap(fe)->id](fe); in af9015_af9013_sleep()
686 mutex_unlock(&state->fe_mutex); in af9015_af9013_sleep()
695 struct af9015_state *state = fe_to_priv(fe); in af9015_tuner_init() local
697 if (mutex_lock_interruptible(&state->fe_mutex)) in af9015_tuner_init()
700 ret = state->tuner_init[fe_to_adap(fe)->id](fe); in af9015_tuner_init()
702 mutex_unlock(&state->fe_mutex); in af9015_tuner_init()
711 struct af9015_state *state = fe_to_priv(fe); in af9015_tuner_sleep() local
713 if (mutex_lock_interruptible(&state->fe_mutex)) in af9015_tuner_sleep()
716 ret = state->tuner_sleep[fe_to_adap(fe)->id](fe); in af9015_tuner_sleep()
718 mutex_unlock(&state->fe_mutex); in af9015_tuner_sleep()
725 struct af9015_state *state = d_to_priv(d); in af9015_copy_firmware() local
733 fw_params[0] = state->firmware_size >> 8; in af9015_copy_firmware()
734 fw_params[1] = state->firmware_size & 0xff; in af9015_copy_firmware()
735 fw_params[2] = state->firmware_checksum >> 8; in af9015_copy_firmware()
736 fw_params[3] = state->firmware_checksum & 0xff; in af9015_copy_firmware()
741 ret = af9015_read_reg_i2c(d, state->af9013_config[1].i2c_addr, in af9015_copy_firmware()
773 ret = af9015_write_reg_i2c(d, state->af9013_config[1].i2c_addr, in af9015_copy_firmware()
784 ret = af9015_read_reg_i2c(d, state->af9013_config[1].i2c_addr, in af9015_copy_firmware()
813 struct af9015_state *state = adap_to_priv(adap); in af9015_af9013_frontend_attach() local
816 state->af9013_config[0].ts_mode = AF9013_TS_USB; in af9015_af9013_frontend_attach()
817 memcpy(state->af9013_config[0].api_version, "\x0\x1\x9\x0", 4); in af9015_af9013_frontend_attach()
818 state->af9013_config[0].gpio[0] = AF9013_GPIO_HI; in af9015_af9013_frontend_attach()
819 state->af9013_config[0].gpio[3] = AF9013_GPIO_TUNER_ON; in af9015_af9013_frontend_attach()
821 state->af9013_config[1].ts_mode = AF9013_TS_SERIAL; in af9015_af9013_frontend_attach()
822 memcpy(state->af9013_config[1].api_version, "\x0\x1\x9\x0", 4); in af9015_af9013_frontend_attach()
823 state->af9013_config[1].gpio[0] = AF9013_GPIO_TUNER_ON; in af9015_af9013_frontend_attach()
824 state->af9013_config[1].gpio[1] = AF9013_GPIO_LO; in af9015_af9013_frontend_attach()
827 if (state->dual_mode) { in af9015_af9013_frontend_attach()
834 state->dual_mode = 0; in af9015_af9013_frontend_attach()
844 &state->af9013_config[adap->id], &adap_to_d(adap)->i2c_adap); in af9015_af9013_frontend_attach()
854 state->set_frontend[adap->id] = in af9015_af9013_frontend_attach()
859 state->read_status[adap->id] = in af9015_af9013_frontend_attach()
864 state->init[adap->id] = adap->fe[0]->ops.init; in af9015_af9013_frontend_attach()
867 state->sleep[adap->id] = adap->fe[0]->ops.sleep; in af9015_af9013_frontend_attach()
940 struct af9015_state *state = d_to_priv(d); in af9015_tuner_attach() local
944 switch (state->af9013_config[adap->id].tuner) { in af9015_tuner_attach()
949 state->mt2060_if1[adap->id]) in af9015_tuner_attach()
998 state->af9013_config[adap->id].tuner); in af9015_tuner_attach()
1003 state->tuner_init[adap->id] = in af9015_tuner_attach()
1009 state->tuner_sleep[adap->id] = in af9015_tuner_attach()
1057 struct af9015_state *state = d_to_priv(d); in af9015_init_endpoint() local
1086 if (state->dual_mode) { in af9015_init_endpoint()
1094 if (state->dual_mode) { in af9015_init_endpoint()
1122 if (state->dual_mode) { in af9015_init_endpoint()
1129 if (state->dual_mode) in af9015_init_endpoint()
1144 struct af9015_state *state = d_to_priv(d); in af9015_init() local
1148 mutex_init(&state->fe_mutex); in af9015_init()
1197 struct af9015_state *state = d_to_priv(d); in af9015_rc_query() local
1213 if ((state->rc_repeat != buf[6] || buf[0]) && in af9015_rc_query()
1214 !memcmp(&buf[12], state->rc_last, 4)) { in af9015_rc_query()
1217 state->rc_repeat = buf[6]; in af9015_rc_query()
1232 memcpy(state->rc_last, &buf[12], 4); in af9015_rc_query()
1236 state->rc_keycode = RC_SCANCODE_NEC(buf[12], in af9015_rc_query()
1240 state->rc_keycode = RC_SCANCODE_NECX(buf[12] << 8 | in af9015_rc_query()
1246 state->rc_keycode = RC_SCANCODE_NEC32(buf[12] << 24 | in af9015_rc_query()
1251 rc_keydown(d->rc_dev, RC_TYPE_NEC, state->rc_keycode, 0); in af9015_rc_query()
1256 state->rc_last[2] = state->rc_last[3]; in af9015_rc_query()
1259 state->rc_repeat = buf[6]; in af9015_rc_query()
1260 state->rc_failed = false; in af9015_rc_query()
1268 if (!state->rc_failed) in af9015_rc_query()
1271 state->rc_failed = true; in af9015_rc_query()
1279 struct af9015_state *state = d_to_priv(d); in af9015_get_rc_config() local
1282 if (state->ir_mode == AF9015_IR_MODE_DISABLED) in af9015_get_rc_config()
1292 rc->map_name = af9015_rc_setup_match(state->eeprom_sum, in af9015_get_rc_config()