Lines Matching defs:tu
47 struct testunit_data *tu = container_of(work, struct testunit_data, worker.work);
55 switch (tu->regs[TU_REG_CMD]) {
57 msg.addr = tu->regs[TU_REG_DATAL];
59 msg.len = tu->regs[TU_REG_DATAH];
66 msgbuf[0] = tu->client->addr;
67 msgbuf[1] = tu->regs[TU_REG_DATAL];
68 msgbuf[2] = tu->regs[TU_REG_DATAH];
76 ret = i2c_transfer(tu->client->adapter, &msg, 1);
82 dev_err(&tu->client->dev, "CMD%02X failed (%d)\n", tu->regs[TU_REG_CMD], ret);
84 clear_bit(TU_FLAG_IN_PROCESS, &tu->flags);
90 struct testunit_data *tu = i2c_get_clientdata(client);
95 if (test_bit(TU_FLAG_IN_PROCESS, &tu->flags))
98 if (tu->reg_idx < TU_NUM_REGS)
99 tu->regs[tu->reg_idx] = *val;
103 if (tu->reg_idx <= TU_NUM_REGS)
104 tu->reg_idx++;
107 if (tu->regs[TU_REG_CMD] >= TU_NUM_CMDS)
113 if (tu->reg_idx == TU_NUM_REGS) {
114 set_bit(TU_FLAG_IN_PROCESS, &tu->flags);
115 queue_delayed_work(system_long_wq, &tu->worker,
116 msecs_to_jiffies(10 * tu->regs[TU_REG_DELAY]));
121 tu->reg_idx = 0;
135 struct testunit_data *tu;
137 tu = devm_kzalloc(&client->dev, sizeof(struct testunit_data), GFP_KERNEL);
138 if (!tu)
141 tu->client = client;
142 i2c_set_clientdata(client, tu);
143 INIT_DELAYED_WORK(&tu->worker, i2c_slave_testunit_work);
150 struct testunit_data *tu = i2c_get_clientdata(client);
152 cancel_delayed_work_sync(&tu->worker);