Commit ed8800dc authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman

greybus: add i2c driver

This patch adds the i2c driver, based on the use of Greybus operations
over Greybus connections.  It basically replaces almost all of what
was previously found in "i2c-gb.c".

When gb_connection_device_init(connection) is called, any connection
that talks the GREYBUS_PROTOCOL_I2C is passed to gb_i2c_device_init()
to be initialized.

Initialization involves verifying the code is able to support the
version of the protocol.  For I2C, we then query the functionality
mask, and set the retry count and timeout to default values.

After that, we set up the i2c device and associate it with the
connection.  The i2c_algorithm methods are then implemented
by translating them into Greybus operations.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 98d35ba2
......@@ -202,6 +202,7 @@ int gb_connection_init(struct gb_connection *connection)
{
switch (connection->protocol) {
case GREYBUS_PROTOCOL_I2C:
return gb_i2c_device_init(connection);
case GREYBUS_PROTOCOL_CONTROL:
case GREYBUS_PROTOCOL_AP:
case GREYBUS_PROTOCOL_GPIO:
......
This diff is collapsed.
......@@ -148,13 +148,21 @@ int gb_operation_wait(struct gb_operation *operation)
}
/*
* This handler is used if no operation response messages are ever
* expected for a given protocol.
*/
static void gb_operation_recv_none(struct gb_operation *operation)
{
/* Nothing to do! */
}
typedef void (*gb_operation_recv_handler)(struct gb_operation *operation);
static gb_operation_recv_handler gb_operation_recv_handlers[] = {
[GREYBUS_PROTOCOL_CONTROL] = NULL,
[GREYBUS_PROTOCOL_AP] = NULL,
[GREYBUS_PROTOCOL_GPIO] = NULL,
[GREYBUS_PROTOCOL_I2C] = NULL,
[GREYBUS_PROTOCOL_I2C] = gb_operation_recv_none,
[GREYBUS_PROTOCOL_UART] = NULL,
[GREYBUS_PROTOCOL_HID] = NULL,
[GREYBUS_PROTOCOL_VENDOR] = NULL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment