If you dig up the dmesg, "nand_resume called for a chip which is not in suspended state" is one of the most often seen message that appears on Milestone's 2.6.32.9-g11068ed kernel.
One of the related patch: http://patchwork.ozlabs.org/patch/53773/
We can also see this changed from Razr:
Milestone:drivers/mtd/nand/omap2.c@1132:
static struct platform_driver omap_nand_driver = {
.probe = omap_nand_probe,
.remove = omap_nand_remove,
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
},
.suspend = omap_nand_suspend,
.resume = omap_nand_resume,
};
Razr:drivers/mtd/nand/omap2.c@1088:
static struct platform_driver omap_nand_driver = {
.probe = omap_nand_probe,
.remove = omap_nand_remove,
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
},
};
Also, the drivers/mtd/mtdcore.c:mtd_cls_suspend has been called from drivers/base/power/main.c:device_suspend:dpm_suspend:...kernel/power/suspend.c:suspend_devices_and_enter.
Lets see what will happen if removing both omap_nand_suspend and omap_nand_resume from omap2.c.
When a device goes into suspend mode, only certain IRQs can wakeup the phone. Such as the hard buttons, bp and the clocks. I will review the various cause of wakes that you can find from Milestone.
1. "PM: Resume timer in %d secs (%d ticks at %d ticks/sec.)\n"
Code flow:
pm34xx.c:omap2_pm_wakeup_on_timer():omap3_pm_suspend()
wakeup-timer.c:wakeup_timer_suspend():get_nearest_wakeup_timer_ktime()
The timer source of this clock is omap GP Timer. During suspend, the time to wakeup is specified by wakeup-timer.c. The earliest expire time will be returned from get_nearest_wakeup_time_ktime(). The processes below are using /dev/wakeup_timer to schedule wakeup events:
/system/bin/gkisystem
/system/bin/brcm_guci_drv -config /system/etc/gpsconfig.xml
By experiment, disabling this wakeup has no negative impact yet.
2. "wakeup wake lock: alarm"
This is in fact a general wakeup message whenever the system is woke up by a clock.The cause of it could be the GP Timer set by (1) above, or others that I will investigate below.
Code flow:
wakelock.c:wake_lock_internal():wake_lock_timeout():alarm-dev.c:alarm_triggered():alarm.c:alarm_timer_triggered()
hrtimer.c:__run_hrtimer():hrtimer_interrupt()
Dump stack from alarm_timer_triggered() when waking:
<6>[109487.879425] Successfully put all powerdomains to target state
<6>[109487.879943] nosync:_c9:341 stack
<4>[109487.880187] [<c0035b24>] (unwind_backtrace+0x0/0xd8) from [<bf00e2e0>] (_c9+0x2c/0x4c [nosyncm])
<4>[109487.880432] [<bf00e2e0>] (_c9+0x2c/0x4c [nosyncm]) from [<c00753e0>] (__run_hrtimer+0x6c/0xc4)
<4>[109487.880615] [<c00753e0>] (__run_hrtimer+0x6c/0xc4) from [<c007575c>] (hrtimer_interrupt+0x1b4/0x248)
<4>[109487.880767] [<c007575c>] (hrtimer_interrupt+0x1b4/0x248) from [<c003af18>] (omap2_gp_timer_interrupt+0x20/0x2c)
<4>[109487.880950] [<c003af18>] (omap2_gp_timer_interrupt+0x20/0x2c) from [<c0090518>] (handle_IRQ_event+0x34/0xf4)
<4>[109487.881134] [<c0090518>] (handle_IRQ_event+0x34/0xf4) from [<c00924b0>] (handle_level_irq+0xd4/0x178)
<4>[109487.881286] [<c00924b0>] (handle_level_irq+0xd4/0x178) from [<c0030068>] (asm_do_IRQ+0x68/0x84)
<4>[109487.881439] [<c0030068>] (asm_do_IRQ+0x68/0x84) from [<c0030ac4>] (__irq_svc+0x44/0xa8)
<4>[109487.881530] Exception stack(0xcec23e90 to 0xcec23ed8)
<4>[109487.881622] 3e80: c04ff768 00000000 cec23f00 ffffffff
<4>[109487.881744] 3ea0: ced7c6c0 cec23f00 00000000 c055b404 cec23f94 ced7c6f4 00000000 ced7c6f0
<4>[109487.881866] 3ec0: 00000000 cec23ed8 c0076b94 c0076b24 60000113 ffffffff
<4>[109487.882019] [<c0030ac4>] (__irq_svc+0x44/0xa8) from [<c0076b24>] (__blocking_notifier_call_chain+0x0/0x5c)
<4>[109487.882202] [<c0076b24>] (__blocking_notifier_call_chain+0x0/0x5c) from [<c0280d6c>] (handle_update+0x0/0x8)
<6>[109487.882324] alarm_timer_triggered type 1 at 1329163876832672090
<6>[109487.882476] call alarm, type 1, func alarm_triggered+0x0/0xe0, 1329163740000000000 (s 1329163740000000000)
<6>[109487.882568] alarm_triggered type 1
<6>[109487.882629] wakeup wake lock: alarm
3. The tick device
Tick Device: mode: 1
Per CPU device: 0
Clock Event Device: gp timer
max_delta_ns: 2147483647
min_delta_ns: 91553
mult: 140737
shift: 32
mode: 3
next_event: 46427023437500 nsecs
set_next_event: omap2_gp_timer_set_next_event
set_mode: omap2_gp_timer_set_mode
event_handler: hrtimer_interrupt
The tick device is the clock event device having the best rating. On Milestone, there are two clock event devices: "32KHz Timer" and "gp timer".