From: Tony Lindgren <tony@atomide.com>
To: linux-kernel@vger.kernel.org
Cc: David Brownell <dbrownell@users.sourceforge.net>,
Tony Lindgren <tony@atomide.com>
Subject: [PATCH 13/90] ARM: OMAP: /sys/kernel/debug/omap_gpio
Date: Wed, 4 Apr 2007 14:04:52 -0400 [thread overview]
Message-ID: <11757099942493-git-send-email-tony@atomide.com> (raw)
In-Reply-To: <1175709988265-git-send-email-tony@atomide.com>
From: David Brownell <dbrownell@users.sourceforge.net>
Add some GPIO debug support: /sys/kernel/debug/omap_gpio dumps the state
of all GPIOs that have been claimed, including basic IRQ info if relevant.
Tested on 24xx, 16xx.
Includes minor bugfixes: recording IRQ trigger mode (this should probably
be a genirq patch), adding missing space to non-wakeup warning
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
arch/arm/plat-omap/gpio.c | 130 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 129 insertions(+), 1 deletions(-)
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index c6cded5..78ba1d3 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -536,6 +536,10 @@ static int gpio_irq_type(unsigned irq, unsigned type)
bank = get_gpio_bank(gpio);
spin_lock(&bank->lock);
retval = _set_gpio_triggering(bank, get_gpio_index(gpio), type);
+ if (retval == 0) {
+ irq_desc[irq].status &= ~IRQ_TYPE_SENSE_MASK;
+ irq_desc[irq].status |= type;
+ }
spin_unlock(&bank->lock);
return retval;
}
@@ -702,7 +706,7 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
spin_lock(&bank->lock);
if (enable) {
if (bank->non_wakeup_gpios & (1 << gpio)) {
- printk(KERN_ERR "Unable to enable wakeup on"
+ printk(KERN_ERR "Unable to enable wakeup on "
"non-wakeup GPIO%d\n",
(bank - gpio_bank) * 32 + gpio);
spin_unlock(&bank->lock);
@@ -1360,3 +1364,127 @@ EXPORT_SYMBOL(omap_set_gpio_dataout);
EXPORT_SYMBOL(omap_get_gpio_datain);
arch_initcall(omap_gpio_sysinit);
+
+
+#ifdef CONFIG_DEBUG_FS
+
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
+
+static int gpio_is_input(struct gpio_bank *bank, int mask)
+{
+ void __iomem *reg = bank->base;
+
+ switch (bank->method) {
+ case METHOD_MPUIO:
+ reg += OMAP_MPUIO_IO_CNTL;
+ break;
+ case METHOD_GPIO_1510:
+ reg += OMAP1510_GPIO_DIR_CONTROL;
+ break;
+ case METHOD_GPIO_1610:
+ reg += OMAP1610_GPIO_DIRECTION;
+ break;
+ case METHOD_GPIO_730:
+ reg += OMAP730_GPIO_DIR_CONTROL;
+ break;
+ case METHOD_GPIO_24XX:
+ reg += OMAP24XX_GPIO_OE;
+ break;
+ }
+ return __raw_readl(reg) & mask;
+}
+
+
+static int dbg_gpio_show(struct seq_file *s, void *unused)
+{
+ unsigned i, j, gpio;
+
+ for (i = 0, gpio = 0; i < gpio_bank_count; i++) {
+ struct gpio_bank *bank = gpio_bank + i;
+ unsigned bankwidth = 16;
+ u32 mask = 1;
+
+ if (!cpu_is_omap24xx() && bank->method == METHOD_MPUIO)
+ gpio = OMAP_MPUIO(0);
+ else if (cpu_is_omap24xx() || cpu_is_omap730())
+ bankwidth = 32;
+
+ for (j = 0; j < bankwidth; j++, gpio++, mask <<= 1) {
+ unsigned irq, value, is_in, irqstat;
+
+ if (!(bank->reserved_map & mask))
+ continue;
+
+ irq = bank->virtual_irq_start + j;
+ value = omap_get_gpio_datain(gpio);
+ is_in = gpio_is_input(bank, mask);
+
+ if (!cpu_is_omap24xx() && bank->method == METHOD_MPUIO)
+ seq_printf(s, "MPUIO %2d: ", j);
+ else
+ seq_printf(s, "GPIO %3d: ", gpio);
+ seq_printf(s, "%s %s",
+ is_in ? "in " : "out",
+ value ? "hi" : "lo");
+
+ irqstat = irq_desc[irq].status;
+ if (is_in && ((bank->suspend_wakeup & mask)
+ || irqstat & IRQ_TYPE_SENSE_MASK)) {
+ char *trigger = NULL;
+
+ switch (irqstat & IRQ_TYPE_SENSE_MASK) {
+ case IRQ_TYPE_EDGE_FALLING:
+ trigger = "falling";
+ break;
+ case IRQ_TYPE_EDGE_RISING:
+ trigger = "rising";
+ break;
+ case IRQ_TYPE_EDGE_BOTH:
+ trigger = "bothedge";
+ break;
+ case IRQ_TYPE_LEVEL_LOW:
+ trigger = "low";
+ break;
+ case IRQ_TYPE_LEVEL_HIGH:
+ trigger = "high";
+ break;
+ case IRQ_TYPE_NONE:
+ trigger = "(unspecified)";
+ break;
+ }
+ seq_printf(s, ", irq-%d %s%s",
+ irq, trigger,
+ (bank->suspend_wakeup & mask)
+ ? " wakeup" : "");
+ }
+ seq_printf(s, "\n");
+ }
+
+ if (!cpu_is_omap24xx() && bank->method == METHOD_MPUIO) {
+ seq_printf(s, "\n");
+ gpio = 0;
+ }
+ }
+ return 0;
+}
+
+static int dbg_gpio_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, dbg_gpio_show, inode->u.generic_ip/*i_private*/);
+}
+
+static const struct file_operations debug_fops = {
+ .open = dbg_gpio_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
+static int __init omap_gpio_debuginit(void)
+{
+ (void) debugfs_create_file("omap_gpio", S_IRUGO, NULL, NULL, &debug_fops);
+ return 0;
+}
+late_initcall(omap_gpio_debuginit);
+#endif
--
1.4.4.2
next prev parent reply other threads:[~2007-04-04 18:07 UTC|newest]
Thread overview: 160+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-04 18:04 [PATCH 9/90] ARM: OMAP: Palm Tungsten E board update Tony Lindgren
2007-04-04 18:04 ` [PATCH 10/90] ARM: OMAP: Implement workaround for GPIO wakeup bug in OMAP2420 silicon Tony Lindgren
2007-04-04 18:04 ` [PATCH 11/90] ARM: OMAP: Add support for Amstrad Delta keypad Tony Lindgren
2007-04-04 18:04 ` [PATCH 12/90] ARM: OMAP: Fix apollon boot Tony Lindgren
2007-04-04 18:04 ` Tony Lindgren [this message]
2007-04-04 18:04 ` [PATCH 14/90] ARM: OMAP: omap2/memory.c compile fixes Tony Lindgren
2007-04-04 18:04 ` [PATCH 15/90] ARM: OMAP: 24xx pinmux updates Tony Lindgren
2007-04-04 18:04 ` [PATCH 16/90] ARM: OMAP: omap2/gpmc updates Tony Lindgren
2007-04-04 18:04 ` [PATCH 17/90] ARM: OMAP: Enable DSP clocks for McBSP on omap310 Tony Lindgren
2007-04-04 18:04 ` [PATCH 18/90] ARM: OMAP: PalmZ71 support Tony Lindgren
2007-04-04 18:04 ` [PATCH 19/90] ARM: OMAP: Register tsc2102 on Palm Tungsten E Tony Lindgren
2007-04-04 18:04 ` [PATCH 20/90] ARM: OMAP: gpio init section cleanups Tony Lindgren
2007-04-04 18:05 ` [PATCH 21/90] ARM: OMAP: gpio object shrinkage, cleanup Tony Lindgren
2007-04-04 18:05 ` [PATCH 22/90] ARM: OMAP: Fix Amstrad Delta omap-keypad usage Tony Lindgren
2007-04-04 18:05 ` [PATCH 23/90] ARM: OMAP: PalmZ71 extra brace fix Tony Lindgren
2007-04-04 18:05 ` [PATCH 24/90] ARM: OMAP: Fix typo in gpio Tony Lindgren
2007-04-04 18:05 ` [PATCH 25/90] ARM: OMAP: h4 must have blinky leds!! Tony Lindgren
2007-04-04 18:05 ` [PATCH 26/90] ARM: OMAP: abstract debug card setup (smc, leds) Tony Lindgren
2007-04-04 18:05 ` [PATCH 27/90] ARM: OMAP: Add minimal OMAP2430 support Tony Lindgren
2007-04-04 18:05 ` [PATCH 28/90] ARM: OMAP: USB peripheral support on H4 Tony Lindgren
2007-04-04 18:05 ` [PATCH 29/90] ARM: OMAP: Palm Tungsten|T support Tony Lindgren
2007-04-04 18:05 ` [PATCH 30/90] ARM: OMAP: Palm Zire71 minor fixes Tony Lindgren
2007-04-04 18:05 ` [PATCH 31/90] ARM: OMAP: plat-omap changes for 2430 SDP Tony Lindgren
2007-04-04 18:05 ` [PATCH 32/90] ARM: OMAP: Basic support for siemens sx1 Tony Lindgren
2007-04-04 18:05 ` [PATCH 33/90] ARM: OMAP: This patch enables I2C-2 support for 2430 SDP Tony Lindgren
2007-04-04 18:05 ` [PATCH 34/90] ARM: OMAP: Set keypad sense delays for the Palms Tony Lindgren
2007-04-04 18:05 ` [PATCH 35/90] ARM: OMAP: speed up gpio irq handling Tony Lindgren
2007-04-04 18:05 ` [PATCH 36/90] ARM: OMAP: Fix typo in board-h4.h Tony Lindgren
2007-04-04 18:05 ` [PATCH 37/90] ARM: OMAP: MPUIO wake updates Tony Lindgren
2007-04-04 18:05 ` [PATCH 38/90] ARM: OMAP: Sync headers with linux-omap Tony Lindgren
2007-04-04 18:05 ` [PATCH 39/90] ARM: OMAP: Sync core code " Tony Lindgren
2007-04-04 18:05 ` [PATCH 40/90] ARM: OMAP: Sync board specific files " Tony Lindgren
2007-04-04 18:05 ` [PATCH 41/90] ARM: OMAP: Avoid updating system time for sub-jiffy interrupts Tony Lindgren
2007-04-04 18:05 ` [PATCH 42/90] ARM: OMAP: Tabify mux.c Tony Lindgren
2007-04-04 18:05 ` [PATCH 43/90] ARM: OMAP: TUSB EVM init Tony Lindgren
2007-04-04 18:05 ` [PATCH 44/90] ARM: OMAP: Add mailbox support for IVA Tony Lindgren
2007-04-04 18:05 ` [PATCH 45/90] ARM: OMAP: Update omap h2 defconfig Tony Lindgren
2007-04-04 18:05 ` [PATCH 46/90] ARM: OMAP: Add omap osk defconfig Tony Lindgren
2007-04-04 18:05 ` [PATCH 47/90] ARM: OMAP: Fix gpmc header Tony Lindgren
2007-04-04 18:05 ` [PATCH 48/90] ARM: OMAP: I2C-1 init fix for 2430 Tony Lindgren
2007-04-04 18:05 ` [PATCH 49/90] ARM: OMAP: update board 2430 file for TWL PIH interrupts Tony Lindgren
2007-04-04 18:05 ` [PATCH 50/90] ARM: OMAP: board-sdp2430.c Remove unnecessary #includes Tony Lindgren
2007-04-04 18:05 ` [PATCH 51/90] ARM: OMAP: osk+mistral backlight, power, board specific Tony Lindgren
2007-04-04 18:05 ` [PATCH 52/90] ARM: OMAP: cleanup apollon board Tony Lindgren
2007-04-04 18:05 ` [PATCH 53/90] ARM: OMAP: Fix warning in timer32k.c Tony Lindgren
2007-04-04 18:05 ` [PATCH 54/90] ARM: OMAP: Update timer32k.c to compile Tony Lindgren
2007-04-04 18:05 ` [PATCH 55/90] ARM: OMAP: H3 workqueue fixes Tony Lindgren
2007-04-04 18:05 ` [PATCH 56/90] ARM: OMAP: Make board-palmz71 compile again Tony Lindgren
2007-04-04 18:05 ` [PATCH 57/90] ARM: OMAP: omap camera builds again; Mistral init and mux Tony Lindgren
2007-04-04 18:05 ` [PATCH 58/90] ARM: OMAP: musb_hdrc: tusb dma patch, minor Tony Lindgren
2007-04-04 18:05 ` [PATCH 59/90] ARM: OMAP: Mostly cosmetic to sync up with linux-omap tree Tony Lindgren
2007-04-04 18:05 ` [PATCH 60/90] ARM: OMAP: Merge gpmc changes from N800 tree Tony Lindgren
2007-04-04 18:05 ` [PATCH 61/90] ARM: OMAP: Merge driver headers " Tony Lindgren
2007-04-04 18:05 ` [PATCH 62/90] ARM: OMAP: Merge board specific files " Tony Lindgren
2007-04-04 18:05 ` [PATCH 63/90] ARM: OMAP: Merge PM code " Tony Lindgren
2007-04-04 18:05 ` [PATCH 64/90] ARM: OMAP: Fix warning in pm.c Tony Lindgren
2007-04-04 18:05 ` [PATCH 65/90] ARM: OMAP: Convert interrupt flags SA_* to IRQF_* Tony Lindgren
2007-04-04 18:05 ` [PATCH 66/90] ARM: OMAP: Sync framebuffer headers with N800 tree Tony Lindgren
2007-04-04 18:05 ` [PATCH 67/90] ARM: OMAP: Replace mach-omap/omap2 with mach-omap2 Tony Lindgren
2007-04-04 18:05 ` [PATCH 68/90] ARM: OMAP: FB sync with N800 tree (support for dynamic SRAM allocations) Tony Lindgren
2007-04-04 18:05 ` [PATCH 69/90] ARM: OMAP: add SoSSI clock Tony Lindgren
2007-04-04 18:05 ` [PATCH 70/90] ARM: OMAP: add SoSSI clock (call propagate_rate for childrens) Tony Lindgren
2007-04-04 18:05 ` [PATCH 71/90] ARM: OMAP: add SoSSI clock (remove manual checking of SoSSI state from idle) Tony Lindgren
2007-04-04 18:05 ` [PATCH 72/90] ARM: OMAP: N770: add missing LCD, LCD controller, touchscreen device registration Tony Lindgren
2007-04-04 18:05 ` [PATCH 73/90] ARM: OMAP: Add onennand board specific support for N800 Tony Lindgren
2007-04-04 18:05 ` [PATCH 74/90] ARM: OMAP: N800: Update board-specific audio support Tony Lindgren
2007-04-04 18:05 ` [PATCH 75/90] ARM: OMAP: 243x: Add mappings for SDRC and SMS Tony Lindgren
2007-04-04 18:05 ` [PATCH 76/90] ARM: OMAP: Device init for OMAP24xx Enhanced Audio Controller Tony Lindgren
2007-04-04 18:05 ` [PATCH 77/90] ARM: OMAP: Add apollon gpio keys using gpio-keys input Tony Lindgren
2007-04-04 18:05 ` [PATCH 78/90] ARM: OMAP: TSC2101: add platform init / registration to board files Tony Lindgren
2007-04-04 18:05 ` [PATCH 79/90] ARM: OMAP: fix H4 dependencies again Tony Lindgren
2007-04-04 18:05 ` [PATCH 80/90] ARM: OMAP: partial LED fixes Tony Lindgren
2007-04-04 18:06 ` [PATCH 81/90] ARM: OMAP: omap2/pm.c build fix Tony Lindgren
2007-04-04 18:06 ` [PATCH 82/90] ARM: OMAP: restore CONFIG_GENERIC_TIME Tony Lindgren
2007-04-04 18:06 ` [PATCH 83/90] ARM: OMAP: Fix GCC-reported compile time bug Tony Lindgren
2007-04-04 18:06 ` [PATCH 84/90] ARM: OMAP: Update changed TSC2301 config names in N800 board files Tony Lindgren
2007-04-04 18:06 ` [PATCH 85/90] ARM: OMAP: Fix PRCM base register usage for 243x Tony Lindgren
2007-04-04 18:06 ` [PATCH 86/90] ARM: OMAP: fix OMAP1 dmtimer build warning Tony Lindgren
2007-04-04 18:06 ` [PATCH 87/90] ARM: OMAP: fix OMAP1 mpuio suspend/resume oops Tony Lindgren
2007-04-04 18:06 ` [PATCH 88/90] ARM: OMAP: OSK led fixes Tony Lindgren
2007-04-04 18:06 ` [PATCH 89/90] ARM: OMAP: Activate MPU retention code in omap2/pm.c Tony Lindgren
2007-04-04 18:06 ` [PATCH 90/90] ARM: OMAP: H2 lcd updates for SPI framework Tony Lindgren
2007-04-05 6:10 ` [PATCH 84/90] ARM: OMAP: Update changed TSC2301 config names in N800 board files Jarkko Nikula
2007-04-05 15:47 ` Tony Lindgren
2007-04-04 20:39 ` [PATCH 73/90] ARM: OMAP: Add onennand board specific support for N800 Randy Dunlap
2007-04-05 15:30 ` Tony Lindgren
2007-04-04 20:52 ` [PATCH 68/90] ARM: OMAP: FB sync with N800 tree (support for dynamic SRAM allocations) Randy Dunlap
2007-04-05 15:39 ` Tony Lindgren
2007-04-05 15:18 ` [PATCH 64/90] ARM: OMAP: Fix warning in pm.c Tony Lindgren
2007-04-04 21:51 ` [PATCH 63/90] ARM: OMAP: Merge PM code from N800 tree Randy Dunlap
2007-04-05 18:20 ` Tony Lindgren
2007-04-04 21:18 ` [PATCH 62/90] ARM: OMAP: Merge board specific files " Randy Dunlap
2007-04-05 19:48 ` Tony Lindgren
2007-04-05 14:43 ` [PATCH 60/90] ARM: OMAP: Merge gpmc changes " Tony Lindgren
2007-04-05 15:17 ` [PATCH 56/90] ARM: OMAP: Make board-palmz71 compile again Tony Lindgren
2007-04-05 15:17 ` [PATCH 55/90] ARM: OMAP: H3 workqueue fixes Tony Lindgren
2007-04-04 19:14 ` [PATCH 53/90] ARM: OMAP: Fix warning in timer32k.c Randy Dunlap
2007-04-05 15:15 ` Tony Lindgren
2007-04-04 19:12 ` [PATCH 51/90] ARM: OMAP: osk+mistral backlight, power, board specific Randy Dunlap
2007-04-05 15:28 ` Tony Lindgren
2007-04-04 18:44 ` [PATCH 43/90] ARM: OMAP: TUSB EVM init Randy Dunlap
2007-04-05 14:42 ` Tony Lindgren
2007-04-06 12:09 ` [PATCH 29/90] ARM: OMAP: Palm Tungsten|T support Pavel Machek
2007-04-08 12:07 ` Russell King
2007-04-08 12:12 ` Pavel Machek
2007-04-08 12:31 ` Dagfinn Ilmari Mannsåker
2007-04-08 13:58 ` Russell King
2007-04-08 14:40 ` Russell King
2007-04-09 11:13 ` Pavel Machek
2007-04-06 12:07 ` [PATCH 28/90] ARM: OMAP: USB peripheral support on H4 Pavel Machek
2007-04-09 21:42 ` Tony Lindgren
2007-04-04 19:00 ` [PATCH 25/90] ARM: OMAP: h4 must have blinky leds!! Randy Dunlap
2007-04-04 19:13 ` David Brownell
2007-04-04 19:22 ` Randy Dunlap
2007-04-04 20:06 ` Jan Engelhardt
2007-04-04 20:42 ` Dmitry Torokhov
2007-04-04 20:51 ` David Brownell
2007-04-04 21:26 ` Randy Dunlap
2007-04-05 2:15 ` Jan Engelhardt
2007-04-05 4:18 ` Randy Dunlap
2007-04-05 18:19 ` David Brownell
2007-04-05 18:29 ` Randy Dunlap
2007-04-05 20:35 ` Jan Engelhardt
2007-04-06 17:29 ` coding style for long conditions (WAS: Re: [PATCH 25/90] ... blinky leds!!) David Brownell
2007-04-06 19:03 ` Stefan Richter
2007-04-06 21:05 ` David Brownell
2007-04-06 21:37 ` Jeremy Fitzhardinge
2007-04-06 21:54 ` David Brownell
2007-04-06 21:38 ` coding style for long conditions Roland Dreier
2007-04-06 21:50 ` Zan Lynx
2007-04-06 22:05 ` David Brownell
2007-04-06 22:07 ` Jan Engelhardt
2007-04-06 22:43 ` David Brownell
2007-04-09 15:45 ` Scott Preece
2007-04-06 21:40 ` coding style for long conditions (WAS: Re: [PATCH 25/90] ... blinky leds!!) Randy Dunlap
2007-04-06 21:46 ` Stefan Richter
2007-04-06 21:53 ` Jan Engelhardt
2007-04-07 0:16 ` Krzysztof Halasa
2007-04-06 22:17 ` Thomas Gleixner
2007-04-06 22:57 ` David Brownell
2007-04-06 23:21 ` Thomas Gleixner
2007-04-06 23:34 ` David Brownell
2007-04-07 8:01 ` coding style for long conditions Junio C Hamano
2007-04-09 15:14 ` David Brownell
2007-04-08 6:19 ` coding style for long conditions (WAS: Re: [PATCH 25/90] ... blinky leds!!) Dmitry Torokhov
2007-04-08 13:24 ` Scott Preece
2007-04-06 19:16 ` Jan Engelhardt
2007-04-06 20:57 ` David Brownell
2007-04-06 22:04 ` Jan Engelhardt
2007-04-06 22:40 ` David Brownell
2007-04-06 23:50 ` Jan Engelhardt
2007-04-04 20:47 ` [PATCH 25/90] ARM: OMAP: h4 must have blinky leds!! Dmitry Torokhov
2007-04-04 20:59 ` David Brownell
2007-04-04 18:29 ` [PATCH 18/90] ARM: OMAP: PalmZ71 support Randy Dunlap
2007-04-05 14:14 ` Tony Lindgren
2007-04-04 18:41 ` [PATCH 12/90] ARM: OMAP: Fix apollon boot Randy Dunlap
2007-04-05 14:24 ` Tony Lindgren
2007-04-04 20:57 ` [PATCH 11/90] ARM: OMAP: Add support for Amstrad Delta keypad Dmitry Torokhov
2007-04-04 22:05 ` Jonathan McDowell
2007-04-05 2:45 ` Dmitry Torokhov
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=11757099942493-git-send-email-tony@atomide.com \
--to=tony@atomide.com \
--cc=dbrownell@users.sourceforge.net \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome