Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: David Lin <dtwlin@google.com>
Signed-off-by: Axel Haslam <haslam_axel@projectara.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Alex Elder <elder@linaro.org>

authored by

David Lin and committed by
Alex Elder
c0e72f6a af5dc7f8

+13
+13
drivers/staging/greybus/i2c.c
··· 176 176 if (!operation) 177 177 return -ENOMEM; 178 178 179 + ret = gbphy_runtime_get_sync(gb_i2c_dev->gbphy_dev); 180 + if (ret) 181 + goto exit_operation_put; 182 + 179 183 ret = gb_operation_request_send_sync(operation); 180 184 if (!ret) { 181 185 struct gb_i2c_transfer_response *response; ··· 191 187 dev_err(dev, "transfer operation failed (%d)\n", ret); 192 188 } 193 189 190 + gbphy_runtime_put_autosuspend(gb_i2c_dev->gbphy_dev); 191 + 192 + exit_operation_put: 194 193 gb_operation_put(operation); 195 194 196 195 return ret; ··· 297 290 if (ret) 298 291 goto exit_connection_disable; 299 292 293 + gbphy_runtime_put_autosuspend(gbphy_dev); 300 294 return 0; 301 295 302 296 exit_connection_disable: ··· 314 306 { 315 307 struct gb_i2c_device *gb_i2c_dev = gb_gbphy_get_data(gbphy_dev); 316 308 struct gb_connection *connection = gb_i2c_dev->connection; 309 + int ret; 310 + 311 + ret = gbphy_runtime_get_sync(gbphy_dev); 312 + if (ret) 313 + gbphy_runtime_get_noresume(gbphy_dev); 317 314 318 315 i2c_del_adapter(&gb_i2c_dev->adapter); 319 316 gb_connection_disable(connection);