From d7aebcc75ca7267877420544b6e3ebf87bfd01e1 Mon Sep 17 00:00:00 2001 From: Mukesh Kumar Savaliya Date: Sun, 12 Mar 2017 12:49:31 +0530 Subject: msm_serial_hs: Change GPIO config sequence during runtime resume/suspend 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 --- drivers/tty/serial/msm_serial_hs.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c index cc616d678d42..830ef92ffe80 100644 --- a/drivers/tty/serial/msm_serial_hs.c +++ b/drivers/tty/serial/msm_serial_hs.c @@ -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: -- cgit v1.2.3