Lines Matching defs:i2cr
11 #include "fsi-master-i2cr.h"
137 int fsi_master_i2cr_read(struct fsi_master_i2cr *i2cr, u32 addr, u64 *data)
142 mutex_lock(&i2cr->lock);
144 ret = i2cr_transfer(i2cr->client, command, data);
148 ret = i2cr_check_status(i2cr->client);
152 trace_i2cr_read(i2cr->client, command, data);
155 mutex_unlock(&i2cr->lock);
160 int fsi_master_i2cr_write(struct fsi_master_i2cr *i2cr, u32 addr, u64 data)
168 mutex_lock(&i2cr->lock);
170 ret = i2c_master_send(i2cr->client, (const char *)buf, sizeof(buf));
172 ret = i2cr_check_status(i2cr->client);
174 trace_i2cr_write(i2cr->client, buf[0], data);
176 trace_i2cr_i2c_error(i2cr->client, buf[0], ret);
182 mutex_unlock(&i2cr->lock);
190 struct fsi_master_i2cr *i2cr = container_of(master, struct fsi_master_i2cr, master);
212 ret = fsi_master_i2cr_read(i2cr, I2CR_ADDRESS_CFAM(addr), &data);
229 struct fsi_master_i2cr *i2cr = container_of(master, struct fsi_master_i2cr, master);
247 return fsi_master_i2cr_write(i2cr, I2CR_ADDRESS_CFAM(addr), data);
252 struct fsi_master_i2cr *i2cr = to_fsi_master_i2cr(to_fsi_master(dev));
256 kfree(i2cr);
261 struct fsi_master_i2cr *i2cr;
264 i2cr = kzalloc(sizeof(*i2cr), GFP_KERNEL);
265 if (!i2cr)
269 i2cr->master.idx = client->adapter->nr;
270 dev_set_name(&i2cr->master.dev, "i2cr%d", i2cr->master.idx);
271 i2cr->master.dev.parent = &client->dev;
272 i2cr->master.dev.of_node = of_node_get(dev_of_node(&client->dev));
273 i2cr->master.dev.release = i2cr_release;
275 i2cr->master.n_links = 1;
276 i2cr->master.read = i2cr_read;
277 i2cr->master.write = i2cr_write;
279 mutex_init(&i2cr->lock);
280 i2cr->client = client;
282 ret = fsi_master_register(&i2cr->master);
286 i2c_set_clientdata(client, i2cr);
292 struct fsi_master_i2cr *i2cr = i2c_get_clientdata(client);
294 fsi_master_unregister(&i2cr->master);
298 { .compatible = "ibm,i2cr-fsi-master" },
307 .name = "fsi-master-i2cr",