Writing zero to /sys/devices/platform/serial8250.<uart>/sleep_timeout
will disable the timeout feature and prevent UART clocks from being
disabled.

Signed-off-by: Kevin Hilman <khil...@deeprootsystems.com>
---
 arch/arm/mach-omap2/serial.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 0762165..c9059fd 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -235,7 +235,10 @@ static void omap_uart_block_sleep(struct omap_uart_state 
*uart)
 
        omap_uart_smart_idle_enable(uart, 0);
        uart->can_sleep = 0;
-       mod_timer(&uart->timer, jiffies + uart->timeout);
+       if (uart->timeout)
+               mod_timer(&uart->timer, jiffies + uart->timeout);
+       else
+               del_timer(&uart->timer);
 }
 
 static void omap_uart_allow_sleep(struct omap_uart_state *uart)
@@ -465,8 +468,14 @@ static ssize_t sleep_timeout_store(struct kobject *kobj,
                return -EINVAL;
        }
        sleep_timeout = value * HZ;
-       list_for_each_entry(uart, &uart_list, node)
+       list_for_each_entry(uart, &uart_list, node) {
                uart->timeout = sleep_timeout;
+               if (uart->timeout)
+                       mod_timer(&uart->timer, jiffies + uart->timeout);
+               else
+                       /* A zero value means disable timeout feature */
+                       omap_uart_block_sleep(uart);
+       }
        return n;
 }
 
-- 
1.6.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to