aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorAxel Haslam <haslam_axel@projectara.com>2016-07-14 16:13:00 -0400
committerAlex Elder <elder@linaro.org>2016-07-14 17:53:55 -0400
commit22b8708725c20ce57d79e51a7e98628b382420a4 (patch)
tree2a8e5f485d56f23d69d913dca14343f5c7d751ed /drivers/staging
parentc0e72f6af7363de8868e2847450a828f27e96c81 (diff)
greybus: uart: Add runtime pm support
This adds runtime pm support for the uart driver. Testing Done: Using the test daughter board, let the gpb bridge enter standby and do a uart transfer operation. Signed-off-by: Axel Haslam <haslam_axel@projectara.com> Signed-off-by: David Lin <dtwlin@google.com> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/greybus/uart.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
index 6260569b2f25..01aeed1b3a9c 100644
--- a/drivers/staging/greybus/uart.c
+++ b/drivers/staging/greybus/uart.c
@@ -771,6 +771,16 @@ static void gb_tty_dtr_rts(struct tty_port *port, int on)
771 send_control(gb_tty, newctrl); 771 send_control(gb_tty, newctrl);
772} 772}
773 773
774static int gb_tty_port_activate(struct tty_port *port,
775 struct tty_struct *tty)
776{
777 struct gb_tty *gb_tty;
778
779 gb_tty = container_of(port, struct gb_tty, port);
780
781 return gbphy_runtime_get_sync(gb_tty->gbphy_dev);
782}
783
774static void gb_tty_port_shutdown(struct tty_port *port) 784static void gb_tty_port_shutdown(struct tty_port *port)
775{ 785{
776 struct gb_tty *gb_tty; 786 struct gb_tty *gb_tty;
@@ -800,6 +810,8 @@ static void gb_tty_port_shutdown(struct tty_port *port)
800 810
801out: 811out:
802 gb_tty->close_pending = false; 812 gb_tty->close_pending = false;
813
814 gbphy_runtime_put_autosuspend(gb_tty->gbphy_dev);
803} 815}
804 816
805static const struct tty_operations gb_ops = { 817static const struct tty_operations gb_ops = {
@@ -822,6 +834,7 @@ static const struct tty_operations gb_ops = {
822 834
823static struct tty_port_operations gb_port_ops = { 835static struct tty_port_operations gb_port_ops = {
824 .dtr_rts = gb_tty_dtr_rts, 836 .dtr_rts = gb_tty_dtr_rts,
837 .activate = gb_tty_port_activate,
825 .shutdown = gb_tty_port_shutdown, 838 .shutdown = gb_tty_port_shutdown,
826}; 839};
827 840
@@ -922,6 +935,7 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev,
922 goto exit_connection_disable; 935 goto exit_connection_disable;
923 } 936 }
924 937
938 gbphy_runtime_put_autosuspend(gbphy_dev);
925 return 0; 939 return 0;
926 940
927exit_connection_disable: 941exit_connection_disable:
@@ -945,6 +959,11 @@ static void gb_uart_remove(struct gbphy_device *gbphy_dev)
945 struct gb_tty *gb_tty = gb_gbphy_get_data(gbphy_dev); 959 struct gb_tty *gb_tty = gb_gbphy_get_data(gbphy_dev);
946 struct gb_connection *connection = gb_tty->connection; 960 struct gb_connection *connection = gb_tty->connection;
947 struct tty_struct *tty; 961 struct tty_struct *tty;
962 int ret;
963
964 ret = gbphy_runtime_get_sync(gbphy_dev);
965 if (ret)
966 gbphy_runtime_get_noresume(gbphy_dev);
948 967
949 mutex_lock(&gb_tty->mutex); 968 mutex_lock(&gb_tty->mutex);
950 gb_tty->disconnected = true; 969 gb_tty->disconnected = true;