From 4c615dcc6a9d910f8f68e4b57889b628e80165d4 Mon Sep 17 00:00:00 2001 From: Axel Haslam Date: Thu, 14 Jul 2016 15:13:00 -0500 Subject: greybus: spi: Add runtime_pm support Add runtime operations to the spi driver so that the module is woken up when an spi transfer is started and put back to sleep when the transfer is done. Testing Done: Let the module enter standby and initiate an spi operation. The operation wakes up the module and succeeds. Signed-off-by: Axel Haslam Signed-off-by: David Lin Reviewed-by: Rui Miguel Silva Signed-off-by: Alex Elder --- drivers/staging/greybus/spi.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'drivers/staging/greybus/spi.c') diff --git a/drivers/staging/greybus/spi.c b/drivers/staging/greybus/spi.c index a82337931c0d..2e6e328bae9e 100644 --- a/drivers/staging/greybus/spi.c +++ b/drivers/staging/greybus/spi.c @@ -35,6 +35,7 @@ static int gb_spi_probe(struct gbphy_device *gbphy_dev, gb_gbphy_set_data(gbphy_dev, connection); + gbphy_runtime_put_autosuspend(gbphy_dev); return 0; exit_connection_disable: @@ -48,6 +49,11 @@ exit_connection_destroy: static void gb_spi_remove(struct gbphy_device *gbphy_dev) { struct gb_connection *connection = gb_gbphy_get_data(gbphy_dev); + int ret; + + ret = gbphy_runtime_get_sync(gbphy_dev); + if (ret) + gbphy_runtime_get_noresume(gbphy_dev); gb_spilib_master_exit(connection); gb_connection_disable(connection); -- cgit v1.2.3-59-g8ed1b