diff options
author | Alex Elder | 2014-10-16 13:35:38 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2014-10-17 18:14:11 +0200 |
commit | ed8800dc376edd7aa10815fb9df83a66c7557031 (patch) | |
tree | 77f6235d3a0bb340af1850c19635e7ea046ff480 /drivers/staging/greybus/operation.c | |
parent | greybus: kill old cport handlers (diff) | |
download | kernel-qcow2-linux-ed8800dc376edd7aa10815fb9df83a66c7557031.tar.gz kernel-qcow2-linux-ed8800dc376edd7aa10815fb9df83a66c7557031.tar.xz kernel-qcow2-linux-ed8800dc376edd7aa10815fb9df83a66c7557031.zip |
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: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'drivers/staging/greybus/operation.c')
-rw-r--r-- | drivers/staging/greybus/operation.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index 7753bf748e2c..a49d92957c6b 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -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, |