Lines Matching refs:state

21 	struct af9015_state *state = d_to_priv(d);
28 state->buf[0] = req->cmd;
29 state->buf[1] = state->seq++;
30 state->buf[2] = req->i2c_addr << 1;
31 state->buf[3] = req->addr >> 8;
32 state->buf[4] = req->addr & 0xff;
33 state->buf[5] = req->mbox;
34 state->buf[6] = req->addr_len;
35 state->buf[7] = req->data_len;
45 state->buf[2] |= 0x01; /* set I2C direction */
48 state->buf[0] = READ_WRITE_I2C;
53 state->buf[0] = WRITE_VIRTUAL_MEMORY;
82 memcpy(&state->buf[REQ_HDR_LEN], req->data, req->data_len);
91 ret = dvb_usbv2_generic_rw_locked(d, state->buf, wlen,
92 state->buf, rlen);
97 if (rlen && state->buf[1]) {
98 dev_err(&intf->dev, "cmd failed %u\n", state->buf[1]);
105 memcpy(req->data, &state->buf[ACK_HDR_LEN], req->data_len);
115 struct af9015_state *state = d_to_priv(d);
118 if (addr == state->af9013_i2c_addr[0] ||
119 addr == state->af9013_i2c_addr[1])
128 struct af9015_state *state = d_to_priv(d);
131 if (addr == state->af9013_i2c_addr[0] ||
132 addr == state->af9013_i2c_addr[1])
142 struct af9015_state *state = d_to_priv(d);
197 if (msg[0].addr == state->af9013_i2c_addr[0])
215 if (msg[0].addr == state->af9013_i2c_addr[0])
232 if (msg[0].addr == state->af9013_i2c_addr[0]) {
291 struct af9015_state *state = d_to_priv(d);
303 state->firmware_size = firmware->size;
304 state->firmware_checksum = checksum;
340 struct af9015_state *state = d_to_priv(d);
357 state->eeprom_sum *= GOLDEN_RATIO_PRIME_32;
358 state->eeprom_sum += le32_to_cpu(((__le32 *)buf)[i]);
364 dev_dbg(&intf->dev, "eeprom sum %.8x\n", state->eeprom_sum);
373 struct af9015_state *state = d_to_priv(d);
396 state->ir_mode = val;
405 state->dual_mode = val;
406 dev_dbg(&intf->dev, "ts mode %02x\n", state->dual_mode);
408 state->af9013_i2c_addr[0] = AF9015_I2C_DEMOD;
410 if (state->dual_mode) {
417 state->af9013_i2c_addr[1] = val >> 1;
420 for (i = 0; i < state->dual_mode + 1; i++) {
430 state->af9013_pdata[i].clk = 28800000;
433 state->af9013_pdata[i].clk = 20480000;
436 state->af9013_pdata[i].clk = 28000000;
439 state->af9013_pdata[i].clk = 25000000;
443 i, val, state->af9013_pdata[i].clk);
451 state->af9013_pdata[i].if_frequency = val << 8;
458 state->af9013_pdata[i].if_frequency += val;
459 state->af9013_pdata[i].if_frequency *= 1000;
461 i, state->af9013_pdata[i].if_frequency);
468 state->mt2060_if1[i] = val << 8;
473 state->mt2060_if1[i] += val;
475 i, state->mt2060_if1[i]);
491 state->af9013_pdata[i].spec_inv = 1;
497 state->af9013_pdata[i].spec_inv = 0;
500 state->af9013_pdata[i].gpio[1] = AF9013_GPIO_LO;
501 state->af9013_pdata[i].spec_inv = 1;
510 state->af9013_pdata[i].tuner = val;
528 state->dual_mode = 0;
531 state->af9013_pdata[0].if_frequency = 4570000;
554 struct af9015_state *state = d_to_priv(d);
563 if (!state->usb_ts_if_configured[adap_id]) {
581 ret = regmap_bulk_write(state->regmap, reg1, buf, 2);
584 ret = regmap_write(state->regmap, reg2, utmp2);
589 if (state->dual_mode) {
596 ret = regmap_update_bits(state->regmap, 0xd50b, 0x01, utmp1);
599 ret = regmap_update_bits(state->regmap, 0xd520, 0x10, utmp2);
603 state->usb_ts_if_configured[adap_id] = true;
608 ret = regmap_update_bits(state->regmap, 0xdd13, 0x20, 0x00);
611 ret = regmap_update_bits(state->regmap, 0xdd11, 0x20, 0x20);
614 ret = regmap_update_bits(state->regmap, 0xd507, 0x04, 0x00);
619 ret = regmap_update_bits(state->regmap, 0xdd13, 0x40, 0x00);
622 ret = regmap_update_bits(state->regmap, 0xdd11, 0x40, 0x40);
625 ret = regmap_update_bits(state->regmap, 0xd50b, 0x02, 0x00);
630 ret = regmap_update_bits(state->regmap, 0xd507, 0x04, 0x04);
633 ret = regmap_update_bits(state->regmap, 0xdd11, 0x20, 0x00);
636 ret = regmap_update_bits(state->regmap, 0xdd13, 0x20, 0x20);
641 ret = regmap_update_bits(state->regmap, 0xd50b, 0x02, 0x02);
644 ret = regmap_update_bits(state->regmap, 0xdd11, 0x40, 0x00);
647 ret = regmap_update_bits(state->regmap, 0xdd13, 0x40, 0x40);
660 struct af9015_state *state = d_to_priv(d);
662 return state->dual_mode + 1;
669 struct af9015_state *state = fe_to_priv(fe);
671 if (mutex_lock_interruptible(&state->fe_mutex))
674 ret = state->set_frontend[fe_to_adap(fe)->id](fe);
676 mutex_unlock(&state->fe_mutex);
686 struct af9015_state *state = fe_to_priv(fe);
688 if (mutex_lock_interruptible(&state->fe_mutex))
691 ret = state->read_status[fe_to_adap(fe)->id](fe, status);
693 mutex_unlock(&state->fe_mutex);
702 struct af9015_state *state = fe_to_priv(fe);
704 if (mutex_lock_interruptible(&state->fe_mutex))
707 ret = state->init[fe_to_adap(fe)->id](fe);
709 mutex_unlock(&state->fe_mutex);
718 struct af9015_state *state = fe_to_priv(fe);
720 if (mutex_lock_interruptible(&state->fe_mutex))
723 ret = state->sleep[fe_to_adap(fe)->id](fe);
725 mutex_unlock(&state->fe_mutex);
734 struct af9015_state *state = fe_to_priv(fe);
736 if (mutex_lock_interruptible(&state->fe_mutex))
739 ret = state->tuner_init[fe_to_adap(fe)->id](fe);
741 mutex_unlock(&state->fe_mutex);
750 struct af9015_state *state = fe_to_priv(fe);
752 if (mutex_lock_interruptible(&state->fe_mutex))
755 ret = state->tuner_sleep[fe_to_adap(fe)->id](fe);
757 mutex_unlock(&state->fe_mutex);
764 struct af9015_state *state = d_to_priv(d);
773 firmware_info[0] = (state->firmware_size >> 8) & 0xff;
774 firmware_info[1] = (state->firmware_size >> 0) & 0xff;
775 firmware_info[2] = (state->firmware_checksum >> 8) & 0xff;
776 firmware_info[3] = (state->firmware_checksum >> 0) & 0xff;
779 ret = af9015_read_reg_i2c(d, state->af9013_i2c_addr[1], 0x98be, &val);
789 ret = regmap_write(state->regmap, 0xd416, 0x04);
801 ret = regmap_write(state->regmap, 0xd416, 0x14);
806 ret = af9015_write_reg_i2c(d, state->af9013_i2c_addr[1], 0xe205, 0x01);
816 ret = af9015_read_reg_i2c(d, state->af9013_i2c_addr[1],
845 struct af9015_state *state = adap_to_priv(adap);
854 state->af9013_pdata[0].ts_mode = AF9013_TS_MODE_USB;
855 memcpy(state->af9013_pdata[0].api_version, "\x0\x1\x9\x0", 4);
856 state->af9013_pdata[0].gpio[0] = AF9013_GPIO_HI;
857 state->af9013_pdata[0].gpio[3] = AF9013_GPIO_TUNER_ON;
859 state->af9013_pdata[1].ts_mode = AF9013_TS_MODE_SERIAL;
860 state->af9013_pdata[1].ts_output_pin = 7;
861 memcpy(state->af9013_pdata[1].api_version, "\x0\x1\x9\x0", 4);
862 state->af9013_pdata[1].gpio[0] = AF9013_GPIO_TUNER_ON;
863 state->af9013_pdata[1].gpio[1] = AF9013_GPIO_LO;
866 if (state->dual_mode) {
874 state->dual_mode = 0;
885 state->af9013_i2c_addr[adap->id],
886 &state->af9013_pdata[adap->id]);
891 adap->fe[0] = state->af9013_pdata[adap->id].get_dvb_frontend(client);
892 state->demod_i2c_client[adap->id] = client;
902 state->set_frontend[adap->id] = adap->fe[0]->ops.set_frontend;
904 state->read_status[adap->id] = adap->fe[0]->ops.read_status;
906 state->init[adap->id] = adap->fe[0]->ops.init;
908 state->sleep[adap->id] = adap->fe[0]->ops.sleep;
920 struct af9015_state *state = adap_to_priv(adap);
928 client = state->demod_i2c_client[adap->id];
1000 struct af9015_state *state = d_to_priv(d);
1008 client = state->demod_i2c_client[adap->id];
1009 adapter = state->af9013_pdata[adap->id].get_i2c_adapter(client);
1011 switch (state->af9013_pdata[adap->id].tuner) {
1016 state->mt2060_if1[adap->id]) == NULL ? -ENODEV : 0;
1055 state->af9013_pdata[adap->id].tuner);
1060 state->tuner_init[adap->id] =
1066 state->tuner_sleep[adap->id] =
1076 struct af9015_state *state = adap_to_priv(adap);
1077 struct af9013_platform_data *pdata = &state->af9013_pdata[adap->id];
1080 mutex_lock(&state->fe_mutex);
1082 mutex_unlock(&state->fe_mutex);
1090 struct af9015_state *state = adap_to_priv(adap);
1091 struct af9013_platform_data *pdata = &state->af9013_pdata[adap->id];
1094 mutex_lock(&state->fe_mutex);
1096 mutex_unlock(&state->fe_mutex);
1103 struct af9015_state *state = d_to_priv(d);
1109 mutex_init(&state->fe_mutex);
1112 ret = regmap_write(state->regmap, 0x98e9, 0xff);
1154 struct af9015_state *state = d_to_priv(d);
1160 ret = regmap_bulk_read(state->regmap, 0x98d9, buf, sizeof(buf));
1171 if ((state->rc_repeat != buf[6] || buf[0]) &&
1172 !memcmp(&buf[12], state->rc_last, 4)) {
1175 state->rc_repeat = buf[6];
1186 ret = regmap_write(state->regmap, 0x98e9, 0xff);
1191 memcpy(state->rc_last, &buf[12], 4);
1195 state->rc_keycode = RC_SCANCODE_NEC(buf[12],
1200 state->rc_keycode = RC_SCANCODE_NECX(buf[12] << 8 |
1207 state->rc_keycode = RC_SCANCODE_NEC32(buf[12] << 24 |
1213 rc_keydown(d->rc_dev, proto, state->rc_keycode, 0);
1218 state->rc_last[2] = state->rc_last[3];
1221 state->rc_repeat = buf[6];
1222 state->rc_failed = false;
1229 if (!state->rc_failed)
1232 state->rc_failed = true;
1240 struct af9015_state *state = d_to_priv(d);
1243 if (state->ir_mode == AF9015_IR_MODE_DISABLED)
1253 rc->map_name = af9015_rc_setup_match(state->eeprom_sum,
1337 struct af9015_state *state = d_to_priv(d);
1382 state->regmap = regmap_init(&intf->dev, &regmap_bus, d, &regmap_config);
1383 if (IS_ERR(state->regmap)) {
1384 ret = PTR_ERR(state->regmap);
1396 struct af9015_state *state = d_to_priv(d);
1401 regmap_exit(state->regmap);