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;
83 memcpy(&state->buf[REQ_HDR_LEN], req->data, req->data_len);
92 ret = dvb_usbv2_generic_rw_locked(d, state->buf, wlen,
93 state->buf, rlen);
98 if (rlen && state->buf[1]) {
99 dev_err(&intf->dev, "cmd failed %u\n", state->buf[1]);
106 memcpy(req->data, &state->buf[ACK_HDR_LEN], req->data_len);
116 struct af9015_state *state = d_to_priv(d);
119 if (addr == state->af9013_i2c_addr[0] ||
120 addr == state->af9013_i2c_addr[1])
129 struct af9015_state *state = d_to_priv(d);
132 if (addr == state->af9013_i2c_addr[0] ||
133 addr == state->af9013_i2c_addr[1])
143 struct af9015_state *state = d_to_priv(d);
198 if (msg[0].addr == state->af9013_i2c_addr[0])
216 if (msg[0].addr == state->af9013_i2c_addr[0])
233 if (msg[0].addr == state->af9013_i2c_addr[0]) {
292 struct af9015_state *state = d_to_priv(d);
304 state->firmware_size = firmware->size;
305 state->firmware_checksum = checksum;
341 struct af9015_state *state = d_to_priv(d);
358 state->eeprom_sum *= GOLDEN_RATIO_PRIME_32;
359 state->eeprom_sum += le32_to_cpu(((__le32 *)buf)[i]);
365 dev_dbg(&intf->dev, "eeprom sum %.8x\n", state->eeprom_sum);
374 struct af9015_state *state = d_to_priv(d);
397 state->ir_mode = val;
406 state->dual_mode = val;
407 dev_dbg(&intf->dev, "ts mode %02x\n", state->dual_mode);
409 state->af9013_i2c_addr[0] = AF9015_I2C_DEMOD;
411 if (state->dual_mode) {
418 state->af9013_i2c_addr[1] = val >> 1;
421 for (i = 0; i < state->dual_mode + 1; i++) {
431 state->af9013_pdata[i].clk = 28800000;
434 state->af9013_pdata[i].clk = 20480000;
437 state->af9013_pdata[i].clk = 28000000;
440 state->af9013_pdata[i].clk = 25000000;
444 i, val, state->af9013_pdata[i].clk);
452 state->af9013_pdata[i].if_frequency = val << 8;
459 state->af9013_pdata[i].if_frequency += val;
460 state->af9013_pdata[i].if_frequency *= 1000;
462 i, state->af9013_pdata[i].if_frequency);
469 state->mt2060_if1[i] = val << 8;
474 state->mt2060_if1[i] += val;
476 i, state->mt2060_if1[i]);
492 state->af9013_pdata[i].spec_inv = 1;
498 state->af9013_pdata[i].spec_inv = 0;
501 state->af9013_pdata[i].gpio[1] = AF9013_GPIO_LO;
502 state->af9013_pdata[i].spec_inv = 1;
511 state->af9013_pdata[i].tuner = val;
529 state->dual_mode = 0;
532 state->af9013_pdata[0].if_frequency = 4570000;
555 struct af9015_state *state = d_to_priv(d);
564 if (!state->usb_ts_if_configured[adap_id]) {
582 ret = regmap_bulk_write(state->regmap, reg1, buf, 2);
585 ret = regmap_write(state->regmap, reg2, utmp2);
590 if (state->dual_mode) {
597 ret = regmap_update_bits(state->regmap, 0xd50b, 0x01, utmp1);
600 ret = regmap_update_bits(state->regmap, 0xd520, 0x10, utmp2);
604 state->usb_ts_if_configured[adap_id] = true;
609 ret = regmap_update_bits(state->regmap, 0xdd13, 0x20, 0x00);
612 ret = regmap_update_bits(state->regmap, 0xdd11, 0x20, 0x20);
615 ret = regmap_update_bits(state->regmap, 0xd507, 0x04, 0x00);
620 ret = regmap_update_bits(state->regmap, 0xdd13, 0x40, 0x00);
623 ret = regmap_update_bits(state->regmap, 0xdd11, 0x40, 0x40);
626 ret = regmap_update_bits(state->regmap, 0xd50b, 0x02, 0x00);
631 ret = regmap_update_bits(state->regmap, 0xd507, 0x04, 0x04);
634 ret = regmap_update_bits(state->regmap, 0xdd11, 0x20, 0x00);
637 ret = regmap_update_bits(state->regmap, 0xdd13, 0x20, 0x20);
642 ret = regmap_update_bits(state->regmap, 0xd50b, 0x02, 0x02);
645 ret = regmap_update_bits(state->regmap, 0xdd11, 0x40, 0x00);
648 ret = regmap_update_bits(state->regmap, 0xdd13, 0x40, 0x40);
661 struct af9015_state *state = d_to_priv(d);
663 return state->dual_mode + 1;
670 struct af9015_state *state = fe_to_priv(fe);
672 if (mutex_lock_interruptible(&state->fe_mutex))
675 ret = state->set_frontend[fe_to_adap(fe)->id](fe);
677 mutex_unlock(&state->fe_mutex);
687 struct af9015_state *state = fe_to_priv(fe);
689 if (mutex_lock_interruptible(&state->fe_mutex))
692 ret = state->read_status[fe_to_adap(fe)->id](fe, status);
694 mutex_unlock(&state->fe_mutex);
703 struct af9015_state *state = fe_to_priv(fe);
705 if (mutex_lock_interruptible(&state->fe_mutex))
708 ret = state->init[fe_to_adap(fe)->id](fe);
710 mutex_unlock(&state->fe_mutex);
719 struct af9015_state *state = fe_to_priv(fe);
721 if (mutex_lock_interruptible(&state->fe_mutex))
724 ret = state->sleep[fe_to_adap(fe)->id](fe);
726 mutex_unlock(&state->fe_mutex);
735 struct af9015_state *state = fe_to_priv(fe);
737 if (mutex_lock_interruptible(&state->fe_mutex))
740 ret = state->tuner_init[fe_to_adap(fe)->id](fe);
742 mutex_unlock(&state->fe_mutex);
751 struct af9015_state *state = fe_to_priv(fe);
753 if (mutex_lock_interruptible(&state->fe_mutex))
756 ret = state->tuner_sleep[fe_to_adap(fe)->id](fe);
758 mutex_unlock(&state->fe_mutex);
765 struct af9015_state *state = d_to_priv(d);
774 firmware_info[0] = (state->firmware_size >> 8) & 0xff;
775 firmware_info[1] = (state->firmware_size >> 0) & 0xff;
776 firmware_info[2] = (state->firmware_checksum >> 8) & 0xff;
777 firmware_info[3] = (state->firmware_checksum >> 0) & 0xff;
780 ret = af9015_read_reg_i2c(d, state->af9013_i2c_addr[1], 0x98be, &val);
790 ret = regmap_write(state->regmap, 0xd416, 0x04);
802 ret = regmap_write(state->regmap, 0xd416, 0x14);
807 ret = af9015_write_reg_i2c(d, state->af9013_i2c_addr[1], 0xe205, 0x01);
817 ret = af9015_read_reg_i2c(d, state->af9013_i2c_addr[1],
846 struct af9015_state *state = adap_to_priv(adap);
855 state->af9013_pdata[0].ts_mode = AF9013_TS_MODE_USB;
856 memcpy(state->af9013_pdata[0].api_version, "\x0\x1\x9\x0", 4);
857 state->af9013_pdata[0].gpio[0] = AF9013_GPIO_HI;
858 state->af9013_pdata[0].gpio[3] = AF9013_GPIO_TUNER_ON;
860 state->af9013_pdata[1].ts_mode = AF9013_TS_MODE_SERIAL;
861 state->af9013_pdata[1].ts_output_pin = 7;
862 memcpy(state->af9013_pdata[1].api_version, "\x0\x1\x9\x0", 4);
863 state->af9013_pdata[1].gpio[0] = AF9013_GPIO_TUNER_ON;
864 state->af9013_pdata[1].gpio[1] = AF9013_GPIO_LO;
867 if (state->dual_mode) {
875 state->dual_mode = 0;
886 state->af9013_i2c_addr[adap->id],
887 &state->af9013_pdata[adap->id]);
892 adap->fe[0] = state->af9013_pdata[adap->id].get_dvb_frontend(client);
893 state->demod_i2c_client[adap->id] = client;
903 state->set_frontend[adap->id] = adap->fe[0]->ops.set_frontend;
905 state->read_status[adap->id] = adap->fe[0]->ops.read_status;
907 state->init[adap->id] = adap->fe[0]->ops.init;
909 state->sleep[adap->id] = adap->fe[0]->ops.sleep;
921 struct af9015_state *state = adap_to_priv(adap);
929 client = state->demod_i2c_client[adap->id];
1001 struct af9015_state *state = d_to_priv(d);
1009 client = state->demod_i2c_client[adap->id];
1010 adapter = state->af9013_pdata[adap->id].get_i2c_adapter(client);
1012 switch (state->af9013_pdata[adap->id].tuner) {
1017 state->mt2060_if1[adap->id]) == NULL ? -ENODEV : 0;
1056 state->af9013_pdata[adap->id].tuner);
1061 state->tuner_init[adap->id] =
1067 state->tuner_sleep[adap->id] =
1077 struct af9015_state *state = adap_to_priv(adap);
1078 struct af9013_platform_data *pdata = &state->af9013_pdata[adap->id];
1081 mutex_lock(&state->fe_mutex);
1083 mutex_unlock(&state->fe_mutex);
1091 struct af9015_state *state = adap_to_priv(adap);
1092 struct af9013_platform_data *pdata = &state->af9013_pdata[adap->id];
1095 mutex_lock(&state->fe_mutex);
1097 mutex_unlock(&state->fe_mutex);
1104 struct af9015_state *state = d_to_priv(d);
1110 mutex_init(&state->fe_mutex);
1113 ret = regmap_write(state->regmap, 0x98e9, 0xff);
1155 struct af9015_state *state = d_to_priv(d);
1161 ret = regmap_bulk_read(state->regmap, 0x98d9, buf, sizeof(buf));
1172 if ((state->rc_repeat != buf[6] || buf[0]) &&
1173 !memcmp(&buf[12], state->rc_last, 4)) {
1176 state->rc_repeat = buf[6];
1187 ret = regmap_write(state->regmap, 0x98e9, 0xff);
1192 memcpy(state->rc_last, &buf[12], 4);
1196 state->rc_keycode = RC_SCANCODE_NEC(buf[12],
1201 state->rc_keycode = RC_SCANCODE_NECX(buf[12] << 8 |
1208 state->rc_keycode = RC_SCANCODE_NEC32(buf[12] << 24 |
1214 rc_keydown(d->rc_dev, proto, state->rc_keycode, 0);
1219 state->rc_last[2] = state->rc_last[3];
1222 state->rc_repeat = buf[6];
1223 state->rc_failed = false;
1230 if (!state->rc_failed)
1233 state->rc_failed = true;
1241 struct af9015_state *state = d_to_priv(d);
1244 if (state->ir_mode == AF9015_IR_MODE_DISABLED)
1254 rc->map_name = af9015_rc_setup_match(state->eeprom_sum,
1338 struct af9015_state *state = d_to_priv(d);
1383 state->regmap = regmap_init(&intf->dev, &regmap_bus, d, &regmap_config);
1384 if (IS_ERR(state->regmap)) {
1385 ret = PTR_ERR(state->regmap);
1397 struct af9015_state *state = d_to_priv(d);
1402 regmap_exit(state->regmap);