[PATCH] introduce-panic-blink-led-not-using-userspace-omfg.patch

Andy Green andy at openmoko.com
Wed Jun 18 12:53:03 CEST 2008


A panic is silent on GTA02, it would be good if we got a little hint
if we are crashing (eg, in suspend / resume) from a panic instead of
a deadlock, etc.  On a normal PC i8042 blinks the keyboard lights if
we panic, this patch causes AUX to flash at 5Hz in event of a panic.

Tested by giving kernel fake root= that didn't exist.

Signed-off-by: Andy Green <andy at openmoko.com>
---

 arch/arm/mach-s3c2440/mach-gta02.c |   30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index 2c44bc1..27917da 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -331,6 +331,27 @@ FIQ_HANDLER_ENTRY(256, 512)
 FIQ_HANDLER_END()
 
 
+/*
+ * this gets called every 1ms when we paniced.
+ */
+
+static long gta02_panic_blink(long count)
+{
+	long delay = 0;
+	static long last_blink;
+	static char led;
+
+	if (count - last_blink < 100) /* 200ms period, fast blink */
+		return 0;
+
+	led ^= 1;
+	s3c2410_gpio_cfgpin(GTA02_GPIO_AUX_LED, S3C2410_GPIO_OUTPUT);
+	neo1973_gpb_setpin(GTA02_GPIO_AUX_LED, led);
+
+	last_blink = count;
+	return delay;
+}
+
 
 /**
  * returns PCB revision information in b9,b8 and b2,b1,b0
@@ -878,9 +899,9 @@ static struct s3c2410_udc_mach_info gta02_udc_cfg = {
 };
 
 static struct s3c2410_ts_mach_info gta02_ts_cfg = {
-	.delay = 10000,
-	.presc = 65,
-	.oversampling_shift = 5,
+	.delay = 20000,
+	.presc = 50000000 / 2500000, /* PCLK / 2.5MHz */
+	.oversampling_shift = 0, /* averaging, 2^n samples */
 };
 
 /* SPI: LCM control interface attached to Glamo3362 */
@@ -1483,6 +1504,9 @@ static void __init gta02_machine_init(void)
 {
 	int rc;
 
+	/* set the panic callback to make AUX blink fast */
+	panic_blink = gta02_panic_blink;
+
 	switch (system_rev) {
 	case GTA02v6_SYSTEM_REV:
 		/* we need push-pull interrupt from motion sensors */





More information about the openmoko-kernel mailing list