All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: linux-arm-kernel@lists.arm.linux.org.uk
Cc: linux-omap@vger.kernel.org, Jouni Hogander <jouni.hogander@nokia.com>
Subject: [PATCH 08/21] OMAP: UART: Add sysfs interface for adjusting UART sleep timeout
Date: Wed,  4 Feb 2009 18:05:54 -0800	[thread overview]
Message-ID: <1233799567-22250-9-git-send-email-khilman@deeprootsystems.com> (raw)
In-Reply-To: <1233799567-22250-8-git-send-email-khilman@deeprootsystems.com>

From: Jouni Hogander <jouni.hogander@nokia.com>

This patch makes it possible to change uart sleep timeout. New sysfs
entry is added (/sys/devices/platform/serial8250.0/sleep_timeout)

Also default timeout is increased to 5 second to make serial console
more usable.

Original patch was written by Tero Kristo some time ago.

Signed-off-by: Jouni Hogander <jouni.hogander@nokia.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
---
 arch/arm/mach-omap2/serial.c |   44 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index cb191d0..29328e1 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -30,7 +30,7 @@
 #include "pm.h"
 #include "prm-regbits-34xx.h"
 
-#define DEFAULT_TIMEOUT (2 * HZ)
+#define DEFAULT_TIMEOUT (5 * HZ)
 
 struct omap_uart_state {
 	int num;
@@ -341,6 +341,8 @@ static irqreturn_t omap_uart_interrupt(int irq, void *dev_id)
 	return IRQ_NONE;
 }
 
+static u32 sleep_timeout = DEFAULT_TIMEOUT;
+
 static void omap_uart_idle_init(struct omap_uart_state *uart)
 {
 	u32 v;
@@ -348,7 +350,7 @@ static void omap_uart_idle_init(struct omap_uart_state *uart)
 	int ret;
 
 	uart->can_sleep = 0;
-	uart->timeout = DEFAULT_TIMEOUT;
+	uart->timeout = sleep_timeout;
 	setup_timer(&uart->timer, omap_uart_idle_timer,
 		    (unsigned long) uart);
 	mod_timer(&uart->timer, jiffies + uart->timeout);
@@ -428,6 +430,33 @@ static void omap_uart_idle_init(struct omap_uart_state *uart)
 	WARN_ON(ret);
 }
 
+static ssize_t sleep_timeout_show(struct kobject *kobj,
+				  struct kobj_attribute *attr,
+				  char *buf)
+{
+	return sprintf(buf, "%u\n", sleep_timeout / HZ);
+}
+
+static ssize_t sleep_timeout_store(struct kobject *kobj,
+				   struct kobj_attribute *attr,
+				   const char *buf, size_t n)
+{
+	struct omap_uart_state *uart;
+	unsigned int value;
+
+	if (sscanf(buf, "%u", &value) != 1) {
+		printk(KERN_ERR "sleep_timeout_store: Invalid value\n");
+		return -EINVAL;
+	}
+	sleep_timeout = value * HZ;
+	list_for_each_entry(uart, &uart_list, node)
+		uart->timeout = sleep_timeout;
+	return n;
+}
+
+static struct kobj_attribute sleep_timeout_attr =
+	__ATTR(sleep_timeout, 0644, sleep_timeout_show, sleep_timeout_store);
+
 #else
 static inline void omap_uart_idle_init(struct omap_uart_state *uart) {}
 #endif /* CONFIG_PM */
@@ -497,6 +526,15 @@ static struct platform_device serial_device = {
 
 static int __init omap_init(void)
 {
-	return platform_device_register(&serial_device);
+	int ret;
+
+	ret = platform_device_register(&serial_device);
+
+#ifdef CONFIG_PM
+	if (!ret)
+		ret = sysfs_create_file(&serial_device.dev.kobj,
+					&sleep_timeout_attr.attr);
+#endif
+	return ret;
 }
 arch_initcall(omap_init);
-- 
1.6.1


  reply	other threads:[~2009-02-05  2:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-05  2:05 [PATCH 00/21] OMAP: update PM infrastructure Kevin Hilman
2009-02-05  2:05 ` [PATCH 01/21] OMAP2/3: PM: push core PM code from linux-omap Kevin Hilman
2009-02-05  2:05   ` [PATCH 02/21] OMAP: Add new function to check wether there is irq pending Kevin Hilman
2009-02-05  2:05     ` [PATCH 03/21] OMAP3: PM: SmartReflex driver integration Kevin Hilman
2009-02-05  2:05       ` [PATCH 04/21] OMAP: Kconfig: move GP timer selection alongside other timer options Kevin Hilman
2009-02-05  2:05         ` [PATCH 05/21] OMAP: dmtimer: enable all timers to be wakeup events Kevin Hilman
2009-02-05  2:05           ` [PATCH 06/21] OMAP3: PM: Add wake-up bit defintiions for CONTROL_PADCONF_X Kevin Hilman
2009-02-05  2:05             ` [PATCH 07/21] OMAP3: PM: UART: disable clocks when idle and off-mode support Kevin Hilman
2009-02-05  2:05               ` Kevin Hilman [this message]
2009-02-05  2:05                 ` [PATCH 09/21] OMAP3: PM: Force IVA2 into idle during bootup Kevin Hilman
2009-02-05  2:05                   ` [PATCH 10/21] OMAP3: PM: Add D2D clocks and auto-idle setup to PRCM init Kevin Hilman
2009-02-05  2:05                     ` [PATCH 11/21] OMAP3: PM: D2D clockdomain supports SW supervised transitions Kevin Hilman
2009-02-05  2:05                       ` [PATCH 12/21] OMAP: PM counter infrastructure Kevin Hilman
2009-02-05  2:05                         ` [PATCH 13/21] OMAP: PM: Hook into PM counters Kevin Hilman
2009-02-05  2:06                           ` [PATCH 14/21] OMAP: PM: Add closures to clkdm_for_each and pwrdm_for_each Kevin Hilman
2009-02-05  2:06                             ` [PATCH 15/21] OMAP: PM: Add pm-debug counters Kevin Hilman
2009-02-05  2:06                               ` [PATCH 16/21] OMAP: PM debug: make powerdomains use PM-debug counters Kevin Hilman
2009-02-05  2:06                                 ` [PATCH 17/21] OMAP: PM debug: do not print out status for meta powerdomains (dpll*) Kevin Hilman
2009-02-05  2:06                                   ` [PATCH 18/21] OMAP: PM debug: Add PRCM register dump support Kevin Hilman
2009-02-05  2:06                                     ` [PATCH 19/21] OMAP: PM: Add definitions for ETK pads and observability registers Kevin Hilman
2009-02-05  2:06                                       ` [PATCH 20/21] OMAP: Debug observability and ETK padconf implementation Kevin Hilman
2009-02-05  2:06                                         ` [PATCH 21/21] OMAP: Add debug observablity (debobs) Kconfig item Kevin Hilman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1233799567-22250-9-git-send-email-khilman@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=jouni.hogander@nokia.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.