diff options
author | Mirko Vogt <mirko@openwrt.org> | 2008-12-12 00:02:36 +0000 |
---|---|---|
committer | Mirko Vogt <mirko@openwrt.org> | 2008-12-12 00:02:36 +0000 |
commit | 845092569c227454f28d77e647d386ab7cc1419f (patch) | |
tree | efab142ef89b35ce42e8a79e028eff15be362af8 /target/linux/s3c24xx/patches/0058-fix-pcf50633-LOWBAT-kill-init.patch.patch | |
parent | d565bb20de4a9dec01f2f4c0f62be55eb61435a9 (diff) | |
download | master-187ad058-845092569c227454f28d77e647d386ab7cc1419f.tar.gz master-187ad058-845092569c227454f28d77e647d386ab7cc1419f.tar.bz2 master-187ad058-845092569c227454f28d77e647d386ab7cc1419f.zip |
add support for target 3c24xx (more known as Openmoko GTA02 "Freerunner") and merge it with the openmoko-target and the work Michael Buesch <mb> did
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@13609 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/s3c24xx/patches/0058-fix-pcf50633-LOWBAT-kill-init.patch.patch')
-rwxr-xr-x | target/linux/s3c24xx/patches/0058-fix-pcf50633-LOWBAT-kill-init.patch.patch | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/target/linux/s3c24xx/patches/0058-fix-pcf50633-LOWBAT-kill-init.patch.patch b/target/linux/s3c24xx/patches/0058-fix-pcf50633-LOWBAT-kill-init.patch.patch new file mode 100755 index 0000000000..429a8c7dd9 --- /dev/null +++ b/target/linux/s3c24xx/patches/0058-fix-pcf50633-LOWBAT-kill-init.patch.patch @@ -0,0 +1,86 @@ +From 6d3172ba9f1b4a650c8fdb3b6e11dc71852fe6d1 Mon Sep 17 00:00:00 2001 +From: mokopatches <mokopatches@openmoko.org> +Date: Fri, 25 Jul 2008 22:21:25 +0100 +Subject: [PATCH] fix-pcf50633-LOWBAT-kill-init.patch + +--- + drivers/i2c/chips/pcf50633.c | 56 ++++++++++++++++++++++++++++++++++++----- + 1 files changed, 49 insertions(+), 7 deletions(-) + +diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c +index 0cf5e53..fc1262e 100644 +--- a/drivers/i2c/chips/pcf50633.c ++++ b/drivers/i2c/chips/pcf50633.c +@@ -690,8 +690,20 @@ static void pcf50633_work(struct work_struct *work) + if (pcf->onkey_seconds >= + pcf->pdata->onkey_seconds_sig_init) { + /* Ask init to do 'ctrlaltdel' */ +- DEBUGPC("SIGINT(init) "); +- kill_proc(1, SIGINT, 1); ++ /* ++ * currently Linux reacts badly to issuing a ++ * signal to PID #1 before init is started. ++ * What happens is that the next kernel thread ++ * to start, which is the JFFS2 Garbage ++ * collector in our case, gets the signal ++ * instead and proceeds to fail to fork -- ++ * which is very bad. Therefore we confirm ++ * PID #1 exists before issuing the signal ++ */ ++ if (find_task_by_pid(1)) { ++ DEBUGPC("SIGINT(init) "); ++ kill_proc(1, SIGINT, 1); ++ } + /* FIXME: what if userspace doesn't shut down? */ + } + if (pcf->onkey_seconds >= +@@ -790,11 +802,41 @@ static void pcf50633_work(struct work_struct *work) + } + + if (pcfirq[3] & (PCF50633_INT4_LOWBAT|PCF50633_INT4_LOWSYS)) { +- /* Really low battery voltage, we have 8 seconds left */ +- DEBUGPC("LOWBAT "); +- apm_queue_event(APM_LOW_BATTERY); +- DEBUGPC("SIGPWR(init) "); +- kill_proc(1, SIGPWR, 1); ++ if ((__reg_read(pcf, PCF50633_REG_MBCS1) & ++ (PCF50633_MBCS1_USBPRES | PCF50633_MBCS1_USBOK)) == ++ (PCF50633_MBCS1_USBPRES | PCF50633_MBCS1_USBOK)) { ++ /* ++ * hey no need to freak out, we have some kind of ++ * valid charger power ++ */ ++ DEBUGPC("(NO)BAT "); ++ } else { ++ /* Really low battery voltage, we have 8 seconds left */ ++ DEBUGPC("LOWBAT "); ++ /* ++ * currently Linux reacts badly to issuing a signal to ++ * PID #1 before init is started. What happens is that ++ * the next kernel thread to start, which is the JFFS2 ++ * Garbage collector in our case, gets the signal ++ * instead and proceeds to fail to fork -- which is ++ * very bad. Therefore we confirm PID #1 exists ++ * before issuing SPIGPWR ++ */ ++ if (find_task_by_pid(1)) { ++ apm_queue_event(APM_LOW_BATTERY); ++ DEBUGPC("SIGPWR(init) "); ++ kill_proc(1, SIGPWR, 1); ++ } else ++ /* ++ * well, our situation is like this: we do not ++ * have any external power, we have a low ++ * battery and since PID #1 doesn't exist yet, ++ * we are early in the boot, likely before ++ * rootfs mount. We should just call it a day ++ */ ++ apm_queue_event(APM_CRITICAL_SUSPEND); ++ } ++ + /* Tell PMU we are taking care of this */ + reg_set_bit_mask(pcf, PCF50633_REG_OOCSHDWN, + PCF50633_OOCSHDWN_TOTRST, +-- +1.5.6.3 + |