Lines Matching defs:ec
21 #include <linux/platform_data/wilco-ec.h>
49 * @ec: EC device.
53 static bool wilco_ec_response_timed_out(struct wilco_ec_device *ec)
58 if (!(inb(ec->io_command->start) &
108 * @ec: EC device.
112 * Context: ec->mailbox_lock should be held while using this function.
115 static int wilco_ec_transfer(struct wilco_ec_device *ec,
129 outb(EC_MAILBOX_START_COMMAND, ec->io_command->start);
133 dev_dbg(ec->dev, "EC does not respond to this command\n");
138 if (wilco_ec_response_timed_out(ec)) {
139 dev_dbg(ec->dev, "response timed out\n");
144 flag = inb(ec->io_data->start);
146 dev_dbg(ec->dev, "bad response: 0x%02x\n", flag);
151 rs = ec->data_buffer;
156 dev_dbg(ec->dev, "bad packet checksum 0x%02x\n", rs->checksum);
161 dev_dbg(ec->dev, "EC reported failure: 0x%02x\n", rs->result);
166 dev_dbg(ec->dev, "unexpected packet size (%u != %u)\n",
172 dev_dbg(ec->dev, "EC didn't return enough data (%u < %zu)\n",
184 * @ec: EC device.
196 int wilco_ec_mailbox(struct wilco_ec_device *ec, struct wilco_ec_message *msg)
201 dev_dbg(ec->dev, "type=%04x flags=%02x rslen=%zu rqlen=%zu\n",
204 mutex_lock(&ec->mailbox_lock);
206 rq = ec->data_buffer;
209 ret = wilco_ec_transfer(ec, msg, rq);
210 mutex_unlock(&ec->mailbox_lock);