Commit c0e72f6a authored by David Lin's avatar David Lin Committed by Alex Elder

greybus: i2c: add runtime pm support

Add runtime pm support to camera i2c bridged phy device class driver

Testing Done:
 - Passed #gb_test.sh -v -t i2c
Signed-off-by: default avatarDavid Lin <dtwlin@google.com>
Signed-off-by: default avatarAxel Haslam <haslam_axel@projectara.com>
Reviewed-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
parent af5dc7f8
...@@ -176,6 +176,10 @@ static int gb_i2c_transfer_operation(struct gb_i2c_device *gb_i2c_dev, ...@@ -176,6 +176,10 @@ static int gb_i2c_transfer_operation(struct gb_i2c_device *gb_i2c_dev,
if (!operation) if (!operation)
return -ENOMEM; return -ENOMEM;
ret = gbphy_runtime_get_sync(gb_i2c_dev->gbphy_dev);
if (ret)
goto exit_operation_put;
ret = gb_operation_request_send_sync(operation); ret = gb_operation_request_send_sync(operation);
if (!ret) { if (!ret) {
struct gb_i2c_transfer_response *response; struct gb_i2c_transfer_response *response;
...@@ -187,6 +191,9 @@ static int gb_i2c_transfer_operation(struct gb_i2c_device *gb_i2c_dev, ...@@ -187,6 +191,9 @@ static int gb_i2c_transfer_operation(struct gb_i2c_device *gb_i2c_dev,
dev_err(dev, "transfer operation failed (%d)\n", ret); dev_err(dev, "transfer operation failed (%d)\n", ret);
} }
gbphy_runtime_put_autosuspend(gb_i2c_dev->gbphy_dev);
exit_operation_put:
gb_operation_put(operation); gb_operation_put(operation);
return ret; return ret;
...@@ -290,6 +297,7 @@ static int gb_i2c_probe(struct gbphy_device *gbphy_dev, ...@@ -290,6 +297,7 @@ static int gb_i2c_probe(struct gbphy_device *gbphy_dev,
if (ret) if (ret)
goto exit_connection_disable; goto exit_connection_disable;
gbphy_runtime_put_autosuspend(gbphy_dev);
return 0; return 0;
exit_connection_disable: exit_connection_disable:
...@@ -306,6 +314,11 @@ static void gb_i2c_remove(struct gbphy_device *gbphy_dev) ...@@ -306,6 +314,11 @@ static void gb_i2c_remove(struct gbphy_device *gbphy_dev)
{ {
struct gb_i2c_device *gb_i2c_dev = gb_gbphy_get_data(gbphy_dev); struct gb_i2c_device *gb_i2c_dev = gb_gbphy_get_data(gbphy_dev);
struct gb_connection *connection = gb_i2c_dev->connection; struct gb_connection *connection = gb_i2c_dev->connection;
int ret;
ret = gbphy_runtime_get_sync(gbphy_dev);
if (ret)
gbphy_runtime_get_noresume(gbphy_dev);
i2c_del_adapter(&gb_i2c_dev->adapter); i2c_del_adapter(&gb_i2c_dev->adapter);
gb_connection_disable(connection); gb_connection_disable(connection);
......
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