Merge "msm_serial_hs: Manage wake unlock delay"
diff --git a/Documentation/devicetree/bindings/tty/serial/msm_serial_hs.txt b/Documentation/devicetree/bindings/tty/serial/msm_serial_hs.txt
index 762d40f..031be45 100644
--- a/Documentation/devicetree/bindings/tty/serial/msm_serial_hs.txt
+++ b/Documentation/devicetree/bindings/tty/serial/msm_serial_hs.txt
@@ -64,6 +64,9 @@
receiving interrupt with UART RX GPIO IRQ line (i.e. above wakeup_irq property),
HSUART driver injects provided character with property rx_to_inject.
- qcom, rx-char-to-inject : The character to be inserted on wakeup.
+- qcom, no-suspend-delay : This decides system to go to suspend immediately
+or not
+
- Refer to "Documentation/devicetree/bindings/arm/msm/msm_bus.txt" for
below optional properties:
- qcom,msm_bus,name
diff --git a/arch/arm/mach-msm/include/mach/msm_serial_hs.h b/arch/arm/mach-msm/include/mach/msm_serial_hs.h
index e6b677e..edc85ba 100644
--- a/arch/arm/mach-msm/include/mach/msm_serial_hs.h
+++ b/arch/arm/mach-msm/include/mach/msm_serial_hs.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2008 Google, Inc.
- * Copyright (C) 2010-2013, The Linux Foundation. All rights reserved.
+ * Copyright (C) 2010-2014, The Linux Foundation. All rights reserved.
* Author: Nick Pelly <npelly@google.com>
*
* This software is licensed under the terms of the GNU General Public
@@ -32,6 +32,8 @@
* @uart_rfr_gpio: GPIO number for UART RFR Line.
* @bam_tx_ep_pipe_index : BAM TX Endpoint Pipe Index for HSUART
* @bam_tx_ep_pipe_index : BAM RX Endpoint Pipe Index for HSUART
+ * @no_suspend_delay : Flag used to make system go to suspend
+ * immediately or not
*/
struct msm_serial_hs_platform_data {
int wakeup_irq; /* wakeup irq */
@@ -46,6 +48,7 @@
int uart_rfr_gpio;
unsigned bam_tx_ep_pipe_index;
unsigned bam_rx_ep_pipe_index;
+ bool no_suspend_delay;
};
unsigned int msm_hs_tx_empty(struct uart_port *uport);
diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c
index a6c60ce..c79482b 100644
--- a/drivers/tty/serial/msm_serial_hs.c
+++ b/drivers/tty/serial/msm_serial_hs.c
@@ -1343,15 +1343,22 @@
{
struct msm_hs_port *msm_uport = container_of(w, struct msm_hs_port,
disconnect_rx_endpoint);
+ struct uart_port *uport = &msm_uport->uport;
struct msm_hs_rx *rx = &msm_uport->rx;
struct sps_pipe *sps_pipe_handle = rx->prod.pipe_handle;
+ struct platform_device *pdev = to_platform_device(uport->dev);
+ const struct msm_serial_hs_platform_data *pdata =
+ pdev->dev.platform_data;
int ret = 0;
ret = sps_rx_disconnect(sps_pipe_handle);
if (ret)
MSM_HS_ERR("%s(): sps_disconnect failed\n", __func__);
-
- wake_lock_timeout(&msm_uport->rx.wake_lock, HZ / 2);
+ if (pdata->no_suspend_delay)
+ wake_unlock(&msm_uport->rx.wake_lock);
+ else
+ wake_lock_timeout(&msm_uport->rx.wake_lock,
+ HZ / 2);
msm_uport->rx.flush = FLUSH_SHUTDOWN;
MSM_HS_DBG("%s: Calling Completion\n", __func__);
wake_up(&msm_uport->bam_disconnect_wait);
@@ -1631,6 +1638,8 @@
struct msm_hs_rx *rx;
struct sps_pipe *sps_pipe_handle;
u32 sps_flags = SPS_IOVEC_FLAG_INT;
+ struct platform_device *pdev;
+ const struct msm_serial_hs_platform_data *pdata;
msm_uport = container_of((struct tasklet_struct *)tlet_ptr,
struct msm_hs_port, rx.tlet);
@@ -1638,6 +1647,8 @@
tty = uport->state->port.tty;
notify = &msm_uport->notify;
rx = &msm_uport->rx;
+ pdev = to_platform_device(uport->dev);
+ pdata = pdev->dev.platform_data;
msm_uport->rx.rx_cmd_queued = false;
msm_uport->rx.rx_cmd_exec = false;
@@ -1751,8 +1762,12 @@
, msecs_to_jiffies(RETRY_TIMEOUT));
}
/* release wakelock in 500ms, not immediately, because higher layers
- * don't always take wakelocks when they should */
- wake_lock_timeout(&msm_uport->rx.wake_lock, HZ / 2);
+ * don't always take wakelocks when they should
+ */
+ if (pdata->no_suspend_delay)
+ wake_unlock(&msm_uport->rx.wake_lock);
+ else
+ wake_lock_timeout(&msm_uport->rx.wake_lock, HZ / 2);
/* tty_flip_buffer_push() might call msm_hs_start(), so unlock */
spin_unlock_irqrestore(&uport->lock, flags);
if (flush < FLUSH_DATA_INVALID)
@@ -2963,6 +2978,9 @@
if (pdata->uart_rfr_gpio < 0)
MSM_HS_DBG("uart_rfr_gpio is not available\n");
+ pdata->no_suspend_delay = of_property_read_bool(node,
+ "qcom,no-suspend-delay");
+
pdata->inject_rx_on_wakeup = of_property_read_bool(node,
"qcom,inject-rx-on-wakeup");