diff --git a/arch/arm/configs/htc_msm_android_defconfig b/arch/arm/configs/htc_msm_android_defconfig index 965b5fa..5cec4ae 100644 --- a/arch/arm/configs/htc_msm_android_defconfig +++ b/arch/arm/configs/htc_msm_android_defconfig @@ -182,6 +182,7 @@ CONFIG_ARCH_MSM=y # # Power management # +CONFIG_ANDROID_POWER=y CONFIG_MSM_AMSS_VERSION=5200 CONFIG_MSM_AMSS_VERSION_WINCE=y CONFIG_MSM_AMSS_VERSION_5200=y @@ -1165,7 +1166,7 @@ CONFIG_ENABLE_MUST_CHECK=y CONFIG_FRAME_WARN=1024 CONFIG_MAGIC_SYSRQ=y # CONFIG_UNUSED_SYMBOLS is not set -CONFIG_DEBUG_FS=y +# CONFIG_DEBUG_FS=y # CONFIG_HEADERS_CHECK is not set CONFIG_DEBUG_KERNEL=y # CONFIG_DEBUG_SHIRQ is not set diff --git a/arch/arm/mach-msm/board-htcraphael-navi.c b/arch/arm/mach-msm/board-htcraphael-navi.c index 3aa00fc..ef0b007 100644 --- a/arch/arm/mach-msm/board-htcraphael-navi.c +++ b/arch/arm/mach-msm/board-htcraphael-navi.c @@ -79,7 +79,7 @@ struct raphnavi_info { }; -// #define RAPHNAVI_DEBUG +//#define RAPHNAVI_DEBUG // #define RAPHNAVI_LID_SWITCH /* drivers/input/keyboard/microp-keypad.c handles this now. */ #define RAPHNAVI_WHEEL REL_Y @@ -535,9 +535,11 @@ static enum hrtimer_restart raphnavi_kp_timer(struct hrtimer *timer) static void navi_suspend(struct early_suspend *h) { int col; - if(!(wake&WAKE_ON_HARD)) - for(col = 0; col < in_navi->info->ncols; col++) + if(!(wake&WAKE_ON_HARD)) { + for(col = 0; col < in_navi->info->ncols; col++) { disable_irq(gpio_to_irq(in_navi->info->cols[col])); + } + } if(wake&WAKE_ON_VOL) enable_irq(gpio_to_irq(in_navi->info->cols[1])); if(!wake&WAKE_ON_TOUCH) @@ -546,8 +548,9 @@ static void navi_suspend(struct early_suspend *h) { static void navi_resume(struct early_suspend *h) { int col; - for(col = 0; col < in_navi->info->ncols; col++) + for(col = 0; col < in_navi->info->ncols; col++) { enable_irq(gpio_to_irq(in_navi->info->cols[col])); + } enable_irq(in_navi->tp_irq); } diff --git a/arch/arm/mach-msm/clock-wince.c b/arch/arm/mach-msm/clock-wince.c index c2f4ba2..db47909 100644 --- a/arch/arm/mach-msm/clock-wince.c +++ b/arch/arm/mach-msm/clock-wince.c @@ -34,7 +34,7 @@ static DEFINE_MUTEX(clocks_mutex); static DEFINE_SPINLOCK(clocks_lock); static LIST_HEAD(clocks); -#if 1 +#if 0 #define D(x...) printk(KERN_DEBUG "clock-wince: " x) #else #define D(x...) do {} while (0) @@ -221,7 +221,7 @@ static int set_mdns_host_clock(uint32_t id, unsigned long freq) if (!params.offset) { - printk(KERN_WARNING "%s: FIXME! Don't know how to set clock %u - no known Md/Ns reg\n", __func__, id); +//# printk(KERN_WARNING "%s: FIXME! Don't know how to set clock %u - no known Md/Ns reg\n", __func__, id); return -ENOTSUPP; } @@ -262,8 +262,8 @@ static int set_mdns_host_clock(uint32_t id, unsigned long freq) writel(readl(MSM_CLK_CTL_BASE) | (1U << params.idx), MSM_CLK_CTL_BASE); if (!found) { - printk(KERN_WARNING "clock-wince: FIXME! set_sdcc_host_clock could not " - "find suitable parameter for freq %lu\n", freq); +//# printk(KERN_WARNING "clock-wince: FIXME! set_sdcc_host_clock could not " +//# "find suitable parameter for freq %lu\n", freq); } // return retval; @@ -366,8 +366,8 @@ static int pc_clk_enable(uint32_t id) writel((readl(MSM_CLK_CTL_BASE + params.offset) &0xfffff000) | params.ns_only, MSM_CLK_CTL_BASE + params.offset); return 0; } - printk(KERN_WARNING "%s: FIXME! enabling a clock that doesn't have an ena bit " - "or ns-only offset: %u\n", __func__, id); +//# printk(KERN_WARNING "%s: FIXME! enabling a clock that doesn't have an ena bit " +//# "or ns-only offset: %u\n", __func__, id); return 0; } @@ -386,8 +386,8 @@ static void pc_clk_disable(uint32_t id) { writel(readl(MSM_CLK_CTL_BASE + params.offset) & 0xfffff000, MSM_CLK_CTL_BASE + params.offset); } else { - printk(KERN_WARNING "%s: FIXME! disabling a clock that doesn't have an " - "ena bit: %u\n", __func__, id); +//# printk(KERN_WARNING "%s: FIXME! disabling a clock that doesn't have an " +//# "ena bit: %u\n", __func__, id); } } @@ -408,7 +408,7 @@ static int pc_clk_set_min_rate(uint32_t id, unsigned long rate) if (id < NR_CLKS) min_clk_rate[id]=rate; else - printk(KERN_WARNING " FIXME! clk_set_min_rate not implemented; %u:%lu NR_CLKS=%d\n", id, rate, NR_CLKS); +//# printk(KERN_WARNING " FIXME! clk_set_min_rate not implemented; %u:%lu NR_CLKS=%d\n", id, rate, NR_CLKS); return 0; } @@ -418,7 +418,7 @@ static int pc_clk_set_max_rate(uint32_t id, unsigned long rate) if (id < NR_CLKS) max_clk_rate[id]=rate; else - printk(KERN_WARNING " FIXME! clk_set_min_rate not implemented; %u:%lu NR_CLKS=%d\n", id, rate, NR_CLKS); +//# printk(KERN_WARNING " FIXME! clk_set_min_rate not implemented; %u:%lu NR_CLKS=%d\n", id, rate, NR_CLKS); return 0; } diff --git a/arch/arm/mach-msm/gpio.c b/arch/arm/mach-msm/gpio.c index 3555147..c12ae3f 100644 --- a/arch/arm/mach-msm/gpio.c +++ b/arch/arm/mach-msm/gpio.c @@ -497,8 +497,10 @@ void msm_gpio_enter_sleep(int from_idle) smem_gpio = smem_alloc(SMEM_GPIO_INT, sizeof(*smem_gpio)); udelay(10); - if (msm_gpio_debug_mask & GPIO_DEBUG_SLEEP) + if (msm_gpio_debug_mask & GPIO_DEBUG_SLEEP) { + printk("gpio at begin of enter_sleep, from_idle is %d\n", from_idle); dumpgpios(); + } if (smem_gpio) { for (i = 0; i < ARRAY_SIZE(smem_gpio->enabled); i++) { smem_gpio->enabled[i] = 0; @@ -544,6 +546,10 @@ void msm_gpio_enter_sleep(int from_idle) } } + if (msm_gpio_debug_mask & GPIO_DEBUG_SLEEP) { + printk("gpio at end of enter_sleep\n"); + dumpgpios(); + } } void msm_gpio_exit_sleep(void) diff --git a/arch/arm/mach-msm/htc_battery_smem.c b/arch/arm/mach-msm/htc_battery_smem.c index f34b358..b538e12 100644 --- a/arch/arm/mach-msm/htc_battery_smem.c +++ b/arch/arm/mach-msm/htc_battery_smem.c @@ -35,7 +35,7 @@ static struct wake_lock vbus_wake_lock; -#define TRACE_BATT 1 +#define TRACE_BATT 0 #if TRACE_BATT #define BATT(x...) printk(KERN_INFO "[BATT] " x) @@ -78,6 +78,9 @@ struct battery_info_reply { u32 full_bat; /* Full capacity of battery (mAh) */ }; +static int l2, l1, t2, t1, v2, v1, c2, c1 = 0; +static unsigned int tolerance = 5; + struct htc_battery_info { int present; unsigned long update_time; @@ -345,7 +348,7 @@ static int battery_table_2[] = { static int htc_get_batt_info(struct battery_info_reply *buffer) { - int i, capacity, v; + int i, capacity, v, dev; int *battery_table; unsigned int dex_test; @@ -411,7 +414,31 @@ static int htc_get_batt_info(struct battery_info_reply *buffer) if(capacity<5) capacity=5; buffer->level = capacity; - + + // store 2 historical values of capacity, voltage and temp + t2 = t1; + t1 = buffer->batt_temp; + v2 = v1; + v1 = buffer->batt_vol; + c2 = c1; + c1 = buffer->batt_current; + l2 = l1; + l1 = buffer->level; + + // print historical values for diag purposes (idea is to see if short-term sinks can be detected) + BATT("Temp hist.: t1=%d t2=%d\n", t1, t2); + BATT("Voltage hist.: v1=%d v2=%d\n", v1, v2); + BATT("Capacity hist.: c1=%d c2=%d\n", c1, c2); + BATT("Level hist.: l1=%d l2=%d\n", l1, l2); + + dev = abs((l1-l2)*100/l1); + if ((l2 != 0) &&( dev > tolerance )) { + BATT("Warning: deviation %d between %d and %d is more than %d pct, returning %d instead of %d\n", dev, l1, l2, tolerance, l2, l1); + buffer->level = l2; + // keep l1 as it is, we expect next value to go up again so it will be skipped too, then + // the next value should be taken into account again + } + if (htc_batt_info.resources->smem_field_size == 4) { BATT("%p: %08x %08x %08x %08x %08x v=%4d c=%3d\n", values_32, values_32[0], values_32[1], values_32[2], values_32[3], values_32[4], diff --git a/arch/arm/mach-msm/include/mach/htc_pwrsink.h b/arch/arm/mach-msm/include/mach/htc_pwrsink.h index d82c212..f6a23e7 100644 --- a/arch/arm/mach-msm/include/mach/htc_pwrsink.h +++ b/arch/arm/mach-msm/include/mach/htc_pwrsink.h @@ -68,7 +68,7 @@ struct pwr_sink_platform_data { #ifndef CONFIG_HTC_PWRSINK static inline int htc_pwrsink_set(pwrsink_id_type id, unsigned percent) { - printk(KERN_DEBUG "%s:STUB!\n", __func__); +//# printk(KERN_DEBUG "%s:STUB!\n", __func__); return 0; } static inline int htc_pwrsink_audio_set(pwrsink_audio_id_type id, diff --git a/arch/arm/mach-msm/pm.c b/arch/arm/mach-msm/pm.c index a2c1921..a6c76c1 100644 --- a/arch/arm/mach-msm/pm.c +++ b/arch/arm/mach-msm/pm.c @@ -279,7 +279,7 @@ static int msm_sleep(int sleep_mode, uint32_t sleep_delay, int from_idle) udelay(50); } else udelay(5); */ - udelay(5); + udelay(50); collapsed = msm_pm_collapse(); if (collapsed) { cpu_init(); diff --git a/drivers/i2c/chips/microp-klt.c b/drivers/i2c/chips/microp-klt.c index 6b9b69d..ce16c3a 100644 --- a/drivers/i2c/chips/microp-klt.c +++ b/drivers/i2c/chips/microp-klt.c @@ -88,8 +88,8 @@ static void micropklt_led_brightness_set(struct led_classdev *led_cdev, buffer[0] = MICROP_KLT_ID_LCD_BRIGHTNESS; buffer[1] = brightness/2 & 0xf0; - printk(KERN_INFO MODULE_NAME ": Setting %s brightness to: 0x%02x\n", - led_cdev->name, buffer[1]); +// printk(KERN_INFO MODULE_NAME ": Setting %s brightness to: 0x%02x\n", +// led_cdev->name, buffer[1]); micropklt_write(client, buffer, 2); msleep(1); } diff --git a/drivers/rtc/rtc-msm7x01a.c b/drivers/rtc/rtc-msm7x01a.c index f594e25..60d863a 100644 --- a/drivers/rtc/rtc-msm7x01a.c +++ b/drivers/rtc/rtc-msm7x01a.c @@ -145,7 +145,7 @@ msmrtc_suspend(struct platform_device *dev, pm_message_t state) dex.cmd = PCOM_READ_RTC; msm_proc_comm_wince(&dex, &secs); - printk("Wake up in %d seconds\n",diff); + printk("Wake up in %d seconds (now is %d, wakeup at %d)\n",diff, secs, secs+diff); dex.cmd = PCOM_SET_ALARM_RTC; dex.has_data = 1; diff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.c index b5bfdcc..880add4 100644 --- a/kernel/power/wakelock.c +++ b/kernel/power/wakelock.c @@ -279,8 +279,16 @@ static void suspend(struct work_struct *work) entry_event_num = current_event_num; sys_sync(); - if (debug_mask & DEBUG_SUSPEND) - pr_info("suspend: enter suspend\n"); + if (debug_mask & DEBUG_SUSPEND) { + struct timespec ts; + struct rtc_time tm; + getnstimeofday(&ts); + rtc_time_to_tm(ts.tv_sec, &tm); + pr_info("suspend: enter suspend" + "(%d-%02d-%02d %02d:%02d:%02d.%09lu UTC)\n", + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec, ts.tv_nsec); + } ret = pm_suspend(requested_suspend_state); if (debug_mask & DEBUG_EXIT_SUSPEND) { struct timespec ts;