Lines Matching refs:ec_dev
50 static int cros_ec_pkt_xfer_i2c(struct cros_ec_device *ec_dev, in cros_ec_pkt_xfer_i2c() argument
53 struct i2c_client *client = ec_dev->priv; in cros_ec_pkt_xfer_i2c()
73 BUG_ON(packet_len > ec_dev->din_size); in cros_ec_pkt_xfer_i2c()
74 in_buf = ec_dev->din; in cros_ec_pkt_xfer_i2c()
79 BUG_ON(packet_len > ec_dev->dout_size); in cros_ec_pkt_xfer_i2c()
80 out_buf = ec_dev->dout; in cros_ec_pkt_xfer_i2c()
88 ec_dev->dout++; in cros_ec_pkt_xfer_i2c()
89 ret = cros_ec_prepare_tx(ec_dev, msg); in cros_ec_pkt_xfer_i2c()
90 ec_dev->dout--; in cros_ec_pkt_xfer_i2c()
95 dev_dbg(ec_dev->dev, "i2c transfer failed: %d\n", ret); in cros_ec_pkt_xfer_i2c()
98 dev_err(ec_dev->dev, "failed to get response: %d\n", ret); in cros_ec_pkt_xfer_i2c()
112 dev_dbg(ec_dev->dev, "command 0x%02x in progress\n", in cros_ec_pkt_xfer_i2c()
117 dev_dbg(ec_dev->dev, "command 0x%02x returned %d\n", in cros_ec_pkt_xfer_i2c()
135 dev_err(ec_dev->dev, in cros_ec_pkt_xfer_i2c()
143 dev_err(ec_dev->dev, in cros_ec_pkt_xfer_i2c()
164 dev_err(ec_dev->dev, "bad packet checksum\n"); in cros_ec_pkt_xfer_i2c()
178 static int cros_ec_cmd_xfer_i2c(struct cros_ec_device *ec_dev, in cros_ec_cmd_xfer_i2c() argument
181 struct i2c_client *client = ec_dev->priv; in cros_ec_cmd_xfer_i2c()
233 dev_err(ec_dev->dev, "i2c transfer failed: %d\n", ret); in cros_ec_cmd_xfer_i2c()
236 dev_err(ec_dev->dev, "failed to get response: %d\n", ret); in cros_ec_cmd_xfer_i2c()
243 ret = cros_ec_check_result(ec_dev, msg); in cros_ec_cmd_xfer_i2c()
249 dev_err(ec_dev->dev, "packet too long (%d bytes, expected %d)", in cros_ec_cmd_xfer_i2c()
261 dev_dbg(ec_dev->dev, "packet: %*ph, sum = %02x\n", in cros_ec_cmd_xfer_i2c()
264 dev_err(ec_dev->dev, "bad packet checksum\n"); in cros_ec_cmd_xfer_i2c()
283 struct cros_ec_device *ec_dev = NULL; in cros_ec_i2c_probe() local
286 ec_dev = devm_kzalloc(dev, sizeof(*ec_dev), GFP_KERNEL); in cros_ec_i2c_probe()
287 if (!ec_dev) in cros_ec_i2c_probe()
290 i2c_set_clientdata(client, ec_dev); in cros_ec_i2c_probe()
291 ec_dev->dev = dev; in cros_ec_i2c_probe()
292 ec_dev->priv = client; in cros_ec_i2c_probe()
293 ec_dev->irq = client->irq; in cros_ec_i2c_probe()
294 ec_dev->cmd_xfer = cros_ec_cmd_xfer_i2c; in cros_ec_i2c_probe()
295 ec_dev->pkt_xfer = cros_ec_pkt_xfer_i2c; in cros_ec_i2c_probe()
296 ec_dev->phys_name = client->adapter->name; in cros_ec_i2c_probe()
297 ec_dev->din_size = sizeof(struct ec_host_response_i2c) + in cros_ec_i2c_probe()
299 ec_dev->dout_size = sizeof(struct ec_host_request_i2c); in cros_ec_i2c_probe()
301 err = cros_ec_register(ec_dev); in cros_ec_i2c_probe()
312 struct cros_ec_device *ec_dev = i2c_get_clientdata(client); in cros_ec_i2c_remove() local
314 return cros_ec_unregister(ec_dev); in cros_ec_i2c_remove()
320 struct cros_ec_device *ec_dev = to_ec_dev(dev); in cros_ec_i2c_suspend() local
322 return cros_ec_suspend(ec_dev); in cros_ec_i2c_suspend()
327 struct cros_ec_device *ec_dev = to_ec_dev(dev); in cros_ec_i2c_resume() local
329 return cros_ec_resume(ec_dev); in cros_ec_i2c_resume()