OSDN Git Service

msm_serial_hs: Change GPIO config sequence during runtime resume/suspend
authorMukesh Kumar Savaliya <msavaliy@codeaurora.org>
Sun, 12 Mar 2017 07:19:31 +0000 (12:49 +0530)
committerGerrit - the friendly Code Review server <code-review@localhost>
Thu, 30 Mar 2017 11:41:49 +0000 (04:41 -0700)
In runtime resume scenarios we first enable the HW resources, clocks and
then set the gpio to UART functionalities. When GPIOS are changing the
state RX line samples as zero resulting in RX Break detection. This stops
data coming from BT SOC sending to the BT host causing failures.

Modify the GPIO config sequence such that GPIO functionalities changed
only when resources like Clocks are OFF.

Change-Id: Iaf3b7c7a66dd83fc631e4a779a804ef98836e00b
Signed-off-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
drivers/tty/serial/msm_serial_hs.c

index cc616d6..830ef92 100644 (file)
@@ -3155,6 +3155,11 @@ static void msm_hs_pm_suspend(struct device *dev)
        mutex_lock(&msm_uport->mtx);
 
        client_count = atomic_read(&msm_uport->client_count);
+       msm_uport->pm_state = MSM_HS_PM_SUSPENDED;
+       msm_hs_resource_off(msm_uport);
+       obs_manage_irq(msm_uport, false);
+       msm_hs_clk_bus_unvote(msm_uport);
+
        /* For OBS, don't use wakeup interrupt, set gpio to suspended state */
        if (msm_uport->obs) {
                ret = pinctrl_select_state(msm_uport->pinctrl,
@@ -3164,10 +3169,6 @@ static void msm_hs_pm_suspend(struct device *dev)
                                __func__);
        }
 
-       msm_uport->pm_state = MSM_HS_PM_SUSPENDED;
-       msm_hs_resource_off(msm_uport);
-       obs_manage_irq(msm_uport, false);
-       msm_hs_clk_bus_unvote(msm_uport);
        if (!atomic_read(&msm_uport->client_req_state))
                enable_wakeup_interrupt(msm_uport);
        LOG_USR_MSG(msm_uport->ipc_msm_hs_pwr_ctxt,
@@ -3198,6 +3199,16 @@ static int msm_hs_pm_resume(struct device *dev)
                goto exit_pm_resume;
        if (!atomic_read(&msm_uport->client_req_state))
                disable_wakeup_interrupt(msm_uport);
+
+       /* For OBS, don't use wakeup interrupt, set gpio to active state */
+       if (msm_uport->obs) {
+               ret = pinctrl_select_state(msm_uport->pinctrl,
+                               msm_uport->gpio_state_active);
+               if (ret)
+                       MSM_HS_ERR("%s():Error selecting active state",
+                                __func__);
+       }
+
        ret = msm_hs_clk_bus_vote(msm_uport);
        if (ret) {
                MSM_HS_ERR("%s:Failed clock vote %d\n", __func__, ret);
@@ -3208,15 +3219,6 @@ static int msm_hs_pm_resume(struct device *dev)
        msm_uport->pm_state = MSM_HS_PM_ACTIVE;
        msm_hs_resource_on(msm_uport);
 
-       /* For OBS, don't use wakeup interrupt, set gpio to active state */
-       if (msm_uport->obs) {
-               ret = pinctrl_select_state(msm_uport->pinctrl,
-                       msm_uport->gpio_state_active);
-               if (ret)
-                       MSM_HS_ERR("%s():Error selecting active state",
-                               __func__);
-       }
-
        LOG_USR_MSG(msm_uport->ipc_msm_hs_pwr_ctxt,
                "%s:PM State:Active client_count %d\n", __func__, client_count);
 exit_pm_resume: