/** * struct ec_i2c_device - Driver data for I2C tunnel * * @dev: Device node * @adap: I2C adapter * @ec: Pointer to EC device * @remote_bus: The EC bus number we tunnel to on the other side. * @request_buf: Buffer for transmitting data; we expect most transfers to fit. * @response_buf: Buffer for receiving data; we expect most transfers to fit.
*/
/** * ec_i2c_count_message - Count bytes needed for ec_i2c_construct_message * * @i2c_msgs: The i2c messages to read * @num: The number of i2c messages. * * Returns the number of bytes the messages will take up.
*/ staticint ec_i2c_count_message(conststruct i2c_msg i2c_msgs[], int num)
{ int i; int size;
size = sizeof(struct ec_params_i2c_passthru);
size += num * sizeof(struct ec_params_i2c_passthru_msg); for (i = 0; i < num; i++) if (!(i2c_msgs[i].flags & I2C_M_RD))
size += i2c_msgs[i].len;
return size;
}
/** * ec_i2c_construct_message - construct a message to go to the EC * * This function effectively stuffs the standard i2c_msg format of Linux into * a format that the EC understands. * * @buf: The buffer to fill. We assume that the buffer is big enough. * @i2c_msgs: The i2c messages to read. * @num: The number of i2c messages. * @bus_num: The remote bus number we want to talk to. * * Returns 0 or a negative error number.
*/ staticint ec_i2c_construct_message(u8 *buf, conststruct i2c_msg i2c_msgs[], int num, u16 bus_num)
{ struct ec_params_i2c_passthru *params;
u8 *out_data; int i;
/** * ec_i2c_count_response - Count bytes needed for ec_i2c_parse_response * * @i2c_msgs: The i2c messages to fill up. * @num: The number of i2c messages expected. * * Returns the number of response bytes expeced.
*/ staticint ec_i2c_count_response(struct i2c_msg i2c_msgs[], int num)
{ int size; int i;
size = sizeof(struct ec_response_i2c_passthru); for (i = 0; i < num; i++) if (i2c_msgs[i].flags & I2C_M_RD)
size += i2c_msgs[i].len;
return size;
}
/** * ec_i2c_parse_response - Parse a response from the EC * * We'll take the EC's response and copy it back into msgs. * * @buf: The buffer to parse. * @i2c_msgs: The i2c messages to fill up. * @num: The number of i2c messages; will be modified to include the actual * number received. * * Returns 0 or a negative error number.
*/ staticint ec_i2c_parse_response(const u8 *buf, struct i2c_msg i2c_msgs[], int *num)
{ conststruct ec_response_i2c_passthru *resp; const u8 *in_data; int i;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.