Lines Matching refs:tu

48 	struct testunit_data *tu = container_of(work, struct testunit_data, worker.work);  in i2c_slave_testunit_work()  local
56 switch (tu->regs[TU_REG_CMD]) { in i2c_slave_testunit_work()
58 msg.addr = tu->regs[TU_REG_DATAL]; in i2c_slave_testunit_work()
60 msg.len = tu->regs[TU_REG_DATAH]; in i2c_slave_testunit_work()
67 msgbuf[0] = tu->client->addr; in i2c_slave_testunit_work()
68 msgbuf[1] = tu->regs[TU_REG_DATAL]; in i2c_slave_testunit_work()
69 msgbuf[2] = tu->regs[TU_REG_DATAH]; in i2c_slave_testunit_work()
77 ret = i2c_transfer(tu->client->adapter, &msg, 1); in i2c_slave_testunit_work()
83 dev_err(&tu->client->dev, "CMD%02X failed (%d)\n", tu->regs[TU_REG_CMD], ret); in i2c_slave_testunit_work()
85 clear_bit(TU_FLAG_IN_PROCESS, &tu->flags); in i2c_slave_testunit_work()
91 struct testunit_data *tu = i2c_get_clientdata(client); in i2c_slave_testunit_slave_cb() local
92 bool is_proc_call = tu->reg_idx == 3 && tu->regs[TU_REG_DATAL] == 1 && in i2c_slave_testunit_slave_cb()
93 tu->regs[TU_REG_CMD] == TU_CMD_SMBUS_BLOCK_PROC_CALL; in i2c_slave_testunit_slave_cb()
98 if (test_bit(TU_FLAG_IN_PROCESS, &tu->flags)) in i2c_slave_testunit_slave_cb()
101 if (tu->reg_idx < TU_NUM_REGS) in i2c_slave_testunit_slave_cb()
102 tu->regs[tu->reg_idx] = *val; in i2c_slave_testunit_slave_cb()
106 if (tu->reg_idx <= TU_NUM_REGS) in i2c_slave_testunit_slave_cb()
107 tu->reg_idx++; in i2c_slave_testunit_slave_cb()
110 if (tu->regs[TU_REG_CMD] >= TU_NUM_CMDS) in i2c_slave_testunit_slave_cb()
116 if (tu->reg_idx == TU_NUM_REGS) { in i2c_slave_testunit_slave_cb()
117 set_bit(TU_FLAG_IN_PROCESS, &tu->flags); in i2c_slave_testunit_slave_cb()
118 queue_delayed_work(system_long_wq, &tu->worker, in i2c_slave_testunit_slave_cb()
119 msecs_to_jiffies(10 * tu->regs[TU_REG_DELAY])); in i2c_slave_testunit_slave_cb()
124 memset(tu->regs, 0, TU_NUM_REGS); in i2c_slave_testunit_slave_cb()
125 tu->reg_idx = 0; in i2c_slave_testunit_slave_cb()
129 if (is_proc_call && tu->regs[TU_REG_DATAH]) in i2c_slave_testunit_slave_cb()
130 tu->regs[TU_REG_DATAH]--; in i2c_slave_testunit_slave_cb()
134 *val = is_proc_call ? tu->regs[TU_REG_DATAH] : TU_CUR_VERSION; in i2c_slave_testunit_slave_cb()
143 struct testunit_data *tu; in i2c_slave_testunit_probe() local
145 tu = devm_kzalloc(&client->dev, sizeof(struct testunit_data), GFP_KERNEL); in i2c_slave_testunit_probe()
146 if (!tu) in i2c_slave_testunit_probe()
149 tu->client = client; in i2c_slave_testunit_probe()
150 i2c_set_clientdata(client, tu); in i2c_slave_testunit_probe()
151 INIT_DELAYED_WORK(&tu->worker, i2c_slave_testunit_work); in i2c_slave_testunit_probe()
158 struct testunit_data *tu = i2c_get_clientdata(client); in i2c_slave_testunit_remove() local
160 cancel_delayed_work_sync(&tu->worker); in i2c_slave_testunit_remove()