r4058 - branches/src/target/kernel/2.6.24.x/patches
werner at sita.openmoko.org
werner at sita.openmoko.org
Wed Feb 13 02:43:50 CET 2008
Author: werner
Date: 2008-02-13 02:43:45 +0100 (Wed, 13 Feb 2008)
New Revision: 4058
Added:
branches/src/target/kernel/2.6.24.x/patches/fix-pcf50606-LOWBAT-kill-init.patch
Modified:
branches/src/target/kernel/2.6.24.x/patches/fix-pcf50633-LOWBAT-kill-init.patch
branches/src/target/kernel/2.6.24.x/patches/series
Log:
fix-pcf50633-LOWBAT-kill-init.patch
fix-pcf50606-LOWBAT-kill-init.patch
[ GTA01 part untested but highly likely to be fine. ]
Until now the driver treats LOWBAT as a fatal crisis and responds
by going postal on init. But the driver didn't think that we can
have adapter or USB power and no battery, which is fine.
This patch reserves the crisis behaviour for when we have no
adapter / USB power and just acknowledges the PMU exception when
we do.
In addition if init doesn't exist yet because we heard about LOWBAT
early in boot -- and we run on battery power only -- then we react
by doing an APM CRITICAL_SUSPEND right away
Signed-off-by: Andy Green <andy at openmoko.com>
---
drivers/i2c/chips/pcf50606.c | 53 ++++++++++++++++++++++++++++++++++++------
1 files changed, 46 insertions(+), 7 deletions(-)
drivers/i2c/chips/pcf50633.c | 56 +++++++++++++++++++++++++++++++++++++-----
1 files changed, 49 insertions(+), 7 deletions(-)
series: added fix-pcf50606-LOWBAT-kill-init.patch, brought back
fix-pcf50633-LOWBAT-kill-init.patch
Added: branches/src/target/kernel/2.6.24.x/patches/fix-pcf50606-LOWBAT-kill-init.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/fix-pcf50606-LOWBAT-kill-init.patch 2008-02-13 01:29:25 UTC (rev 4057)
+++ branches/src/target/kernel/2.6.24.x/patches/fix-pcf50606-LOWBAT-kill-init.patch 2008-02-13 01:43:45 UTC (rev 4058)
@@ -0,0 +1,71 @@
+Index: linux-2.6.24/drivers/i2c/chips/pcf50606.c
+===================================================================
+--- linux-2.6.24.orig/drivers/i2c/chips/pcf50606.c
++++ linux-2.6.24/drivers/i2c/chips/pcf50606.c
+@@ -628,8 +628,20 @@
+ if (pcf->onkey_seconds >=
+ pcf->pdata->onkey_seconds_required) {
+ /* 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)) {
++ kill_proc(1, SIGINT, 1);
++ DEBUGPC("SIGINT(init) ");
++ }
+ /* FIXME: what to do if userspace doesn't
+ * shut down? Do we want to force it? */
+ }
+@@ -723,11 +735,38 @@
+ }
+ /* FIXME: TSCPRES */
+ if (pcfirq[2] & PCF50606_INT3_LOWBAT) {
+- /* 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, PCF50606_REG_OOCS) & PCF50606_OOCS_EXTON) {
++ /*
++ * 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, PCF50606_REG_OOCC1,
+ PCF50606_OOCC1_TOTRST,
Modified: branches/src/target/kernel/2.6.24.x/patches/fix-pcf50633-LOWBAT-kill-init.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/fix-pcf50633-LOWBAT-kill-init.patch 2008-02-13 01:29:25 UTC (rev 4057)
+++ branches/src/target/kernel/2.6.24.x/patches/fix-pcf50633-LOWBAT-kill-init.patch 2008-02-13 01:43:45 UTC (rev 4058)
@@ -2,10 +2,33 @@
===================================================================
--- linux-2.6.24.orig/drivers/i2c/chips/pcf50633.c
+++ linux-2.6.24/drivers/i2c/chips/pcf50633.c
-@@ -637,15 +637,25 @@
+@@ -570,8 +570,20 @@
+ if (pcf->onkey_seconds >=
+ pcf->pdata->onkey_seconds_required) {
+ /* 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? */
+ }
+ }
+@@ -641,11 +653,41 @@
}
- if (int4 & (PCF50633_INT4_LOWBAT|PCF50633_INT4_LOWSYS)) {
+ 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);
@@ -22,16 +45,30 @@
+ } else {
+ /* 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);
++ /*
++ * 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,
-- PCF50633_OOCSHDWN_TOTRST);
-+ PCF50633_OOCSHDWN_TOTRST,
-+ PCF50633_OOCSHDWN_TOTRST);
- }
- if (int4 & PCF50633_INT4_HIGHTMP) {
- /* High temperature */
+ PCF50633_OOCSHDWN_TOTRST,
Modified: branches/src/target/kernel/2.6.24.x/patches/series
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/series 2008-02-13 01:29:25 UTC (rev 4057)
+++ branches/src/target/kernel/2.6.24.x/patches/series 2008-02-13 01:43:45 UTC (rev 4058)
@@ -94,10 +94,9 @@
# bad bug
fix-hwecc-2410.patch
-# this may not be the last word on this issue, but the patch certainly helps
-# backed out temporarily since the patch fails and there's a new version of
-# this just around the corner anyway
-##fix-pcf50633-LOWBAT-kill-init.patch
+# pending further review
+fix-pcf50606-LOWBAT-kill-init.patch
+fix-pcf50633-LOWBAT-kill-init.patch
# temporary work-around. awaiting decision on correct fix from upstream.
gta01-dehang-printk.patch
More information about the commitlog
mailing list