]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
ARM: tegra: usb: add remote wakeup callback
authorNeil Patel <neilp@nvidia.com>
Fri, 11 Oct 2013 18:31:43 +0000 (14:31 -0400)
committerSteve Lin <stlin@nvidia.com>
Tue, 29 Oct 2013 16:12:36 +0000 (09:12 -0700)
Drivers can take actions based on remote wakeup events to prevent a
device or the bus from suspending before the incoming data is handled.

Bug 1362837

Change-Id: I55cf26663cbf00bd2eccc60f18aa95ab5777e604
Signed-off-by: Neil Patel <neilp@nvidia.com>
Reviewed-on: http://git-master/r/289968
(cherry picked from commit 980b0ef762747561fa40b14d3cde33275927b9bb)
Reviewed-on: http://git-master/r/303390
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Steve Lin <stlin@nvidia.com>
drivers/usb/phy/tegra11x_usb_phy.c
include/linux/platform_data/tegra_usb.h

index 82fe8a08df18633c5b19f4fcaf3afb7182a82ee2..0b756afc77b7a01ee1e1cca2f5a7bffce7f6e487 100644 (file)
@@ -1542,9 +1542,11 @@ static void uhsic_phy_restore_end(struct tegra_usb_phy *phy)
        int wait_time_us = FPR_WAIT_TIME_US; /* FPR should be set by this time */
        bool irq_disabled = false;
        struct tegra_usb_pmc_data *pmc = &pmc_data[phy->inst];
+       bool remote_wakeup_detected;
 
        DBG("%s(%d)\n", __func__, __LINE__);
 
+       remote_wakeup_detected = phy->pmc_remote_wakeup;
        /*
         * check whether we wake up from the remote wake detected before putting
         * controller in suspend in usb_phy_bringup_host_controller.
@@ -1610,6 +1612,9 @@ static void uhsic_phy_restore_end(struct tegra_usb_phy *phy)
                pr_err("%s: timeout waiting for USB_USBCMD_RS\n", __func__);
                return;
        }
+       if (remote_wakeup_detected && phy->pdata->ops &&
+                                       phy->pdata->ops->post_remote_wakeup)
+               phy->pdata->ops->post_remote_wakeup();
 }
 
 static int uhsic_rail_enable(struct tegra_usb_phy *phy)
index 64d2765d0b2527cc52785ba17923c1ef365e9ab3..5ef7563810637331ff29a8a0039b651e4a12cbfb 100644 (file)
@@ -87,6 +87,7 @@ struct tegra_usb_phy_platform_ops {
        void (*post_suspend)(void);
        void (*pre_resume)(void);
        void (*post_resume)(void);
+       void (*post_remote_wakeup)(void);
        void (*pre_phy_off)(void);
        void (*post_phy_off)(void);
        void (*pre_phy_on)(void);