Lines Matching refs:ec_dev

65 static int cros_ec_cmd_xfer_rpmsg(struct cros_ec_device *ec_dev,  in cros_ec_cmd_xfer_rpmsg()  argument
79 static int cros_ec_pkt_xfer_rpmsg(struct cros_ec_device *ec_dev, in cros_ec_pkt_xfer_rpmsg() argument
82 struct cros_ec_rpmsg *ec_rpmsg = ec_dev->priv; in cros_ec_pkt_xfer_rpmsg()
91 len = cros_ec_prepare_tx(ec_dev, ec_msg); in cros_ec_pkt_xfer_rpmsg()
94 dev_dbg(ec_dev->dev, "prepared, len=%d\n", len); in cros_ec_pkt_xfer_rpmsg()
97 ret = rpmsg_send(ec_rpmsg->ept, ec_dev->dout, len); in cros_ec_pkt_xfer_rpmsg()
99 dev_err(ec_dev->dev, "rpmsg send failed\n"); in cros_ec_pkt_xfer_rpmsg()
106 dev_err(ec_dev->dev, "rpmsg send timeout\n"); in cros_ec_pkt_xfer_rpmsg()
111 response = (struct ec_host_response *)ec_dev->din; in cros_ec_pkt_xfer_rpmsg()
114 ret = cros_ec_check_result(ec_dev, ec_msg); in cros_ec_pkt_xfer_rpmsg()
119 dev_err(ec_dev->dev, "packet too long (%d bytes, expected %d)", in cros_ec_pkt_xfer_rpmsg()
126 memcpy(ec_msg->data, ec_dev->din + sizeof(*response), in cros_ec_pkt_xfer_rpmsg()
131 sum += ec_dev->din[i]; in cros_ec_pkt_xfer_rpmsg()
134 dev_err(ec_dev->dev, "bad packet checksum, calculated %x\n", in cros_ec_pkt_xfer_rpmsg()
161 struct cros_ec_device *ec_dev = dev_get_drvdata(&rpdev->dev); in cros_ec_rpmsg_callback() local
162 struct cros_ec_rpmsg *ec_rpmsg = ec_dev->priv; in cros_ec_rpmsg_callback()
166 dev_warn(ec_dev->dev, "rpmsg received empty response"); in cros_ec_rpmsg_callback()
173 if (len > ec_dev->din_size) { in cros_ec_rpmsg_callback()
174 dev_warn(ec_dev->dev, in cros_ec_rpmsg_callback()
176 len, ec_dev->din_size); in cros_ec_rpmsg_callback()
177 len = ec_dev->din_size; in cros_ec_rpmsg_callback()
180 memcpy(ec_dev->din, resp->data, len); in cros_ec_rpmsg_callback()
192 dev_warn(ec_dev->dev, "rpmsg received invalid type = %d", in cros_ec_rpmsg_callback()
216 struct cros_ec_device *ec_dev; in cros_ec_rpmsg_probe() local
219 ec_dev = devm_kzalloc(dev, sizeof(*ec_dev), GFP_KERNEL); in cros_ec_rpmsg_probe()
220 if (!ec_dev) in cros_ec_rpmsg_probe()
227 ec_dev->dev = dev; in cros_ec_rpmsg_probe()
228 ec_dev->priv = ec_rpmsg; in cros_ec_rpmsg_probe()
229 ec_dev->cmd_xfer = cros_ec_cmd_xfer_rpmsg; in cros_ec_rpmsg_probe()
230 ec_dev->pkt_xfer = cros_ec_pkt_xfer_rpmsg; in cros_ec_rpmsg_probe()
231 ec_dev->phys_name = dev_name(&rpdev->dev); in cros_ec_rpmsg_probe()
232 ec_dev->din_size = sizeof(struct ec_host_response) + in cros_ec_rpmsg_probe()
234 ec_dev->dout_size = sizeof(struct ec_host_request); in cros_ec_rpmsg_probe()
235 dev_set_drvdata(dev, ec_dev); in cros_ec_rpmsg_probe()
246 ret = cros_ec_register(ec_dev); in cros_ec_rpmsg_probe()
263 struct cros_ec_device *ec_dev = dev_get_drvdata(&rpdev->dev); in cros_ec_rpmsg_remove() local
264 struct cros_ec_rpmsg *ec_rpmsg = ec_dev->priv; in cros_ec_rpmsg_remove()
266 cros_ec_unregister(ec_dev); in cros_ec_rpmsg_remove()
274 struct cros_ec_device *ec_dev = dev_get_drvdata(dev); in cros_ec_rpmsg_suspend() local
276 return cros_ec_suspend(ec_dev); in cros_ec_rpmsg_suspend()
281 struct cros_ec_device *ec_dev = dev_get_drvdata(dev); in cros_ec_rpmsg_resume() local
283 return cros_ec_resume(ec_dev); in cros_ec_rpmsg_resume()