diff --git a/arch/arm/configs/htcleo_defconfig b/arch/arm/configs/htcleo_defconfig index e56979a1..0c19adb2 100644 --- a/arch/arm/configs/htcleo_defconfig +++ b/arch/arm/configs/htcleo_defconfig @@ -244,20 +244,20 @@ CONFIG_HTC_SLEEP_MODE_GPIO_DUMP=y # CONFIG_SMEM_RPC_SERVER_STATE is not set # CONFIG_BUILD_OMA_DM is not set CONFIG_CACHE_FLUSH_RANGE_LIMIT=0x40000 -# CONFIG_MSM7X00A_USE_GP_TIMER is not set -CONFIG_MSM7X00A_USE_DG_TIMER=y -# CONFIG_MSM7X00A_SLEEP_MODE_POWER_COLLAPSE_SUSPEND is not set +CONFIG_MSM7X00A_USE_GP_TIMER=y +# CONFIG_MSM7X00A_USE_DG_TIMER is not set +CONFIG_MSM7X00A_SLEEP_MODE_POWER_COLLAPSE_SUSPEND=y # CONFIG_MSM7X00A_SLEEP_MODE_POWER_COLLAPSE is not set -CONFIG_MSM7X00A_SLEEP_MODE_APPS_SLEEP=y +# CONFIG_MSM7X00A_SLEEP_MODE_APPS_SLEEP is not set # CONFIG_MSM7X00A_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT is not set # CONFIG_MSM7X00A_SLEEP_WAIT_FOR_INTERRUPT is not set -CONFIG_MSM7X00A_SLEEP_MODE=2 +CONFIG_MSM7X00A_SLEEP_MODE=0 # CONFIG_MSM7X00A_IDLE_SLEEP_MODE_POWER_COLLAPSE_SUSPEND is not set -# CONFIG_MSM7X00A_IDLE_SLEEP_MODE_POWER_COLLAPSE is not set -CONFIG_MSM7X00A_IDLE_SLEEP_MODE_APPS_SLEEP=y +CONFIG_MSM7X00A_IDLE_SLEEP_MODE_POWER_COLLAPSE=y +# CONFIG_MSM7X00A_IDLE_SLEEP_MODE_APPS_SLEEP is not set # CONFIG_MSM7X00A_IDLE_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT is not set # CONFIG_MSM7X00A_IDLE_SLEEP_WAIT_FOR_INTERRUPT is not set -CONFIG_MSM7X00A_IDLE_SLEEP_MODE=2 +CONFIG_MSM7X00A_IDLE_SLEEP_MODE=1 CONFIG_MSM7X00A_IDLE_SLEEP_MIN_TIME=50000000 CONFIG_MSM7X00A_IDLE_SPIN_TIME=80000 CONFIG_MSM7X00A_SLEEP_NO_LIMIT=y diff --git a/arch/arm/mach-msm/board-htcleo-panel.c b/arch/arm/mach-msm/board-htcleo-panel.c index 9fc7103a..6eb2cc38 100644 --- a/arch/arm/mach-msm/board-htcleo-panel.c +++ b/arch/arm/mach-msm/board-htcleo-panel.c @@ -953,12 +953,7 @@ int __init htcleo_init_panel(void) } detect_panel_type(); - - gpio_set_value(HTCLEO_GPIO_LCM_RESET, 0); - LCM_DELAY(2); - vreg_disable(vreg_lcd); - gpio_set_value(HTCLEO_GPIO_LCM_POWER, 0); - + ret = platform_device_register(&msm_device_mdp); if (ret != 0) return ret; diff --git a/arch/arm/mach-msm/clock-wince.c b/arch/arm/mach-msm/clock-wince.c index 8d2527c7..a2b601b6 100644 --- a/arch/arm/mach-msm/clock-wince.c +++ b/arch/arm/mach-msm/clock-wince.c @@ -434,6 +434,7 @@ static unsigned long get_mdns_host_clock(uint32_t id) return freq; } +// Cotullaz "new" clock functions static int new_clk_set_rate(uint32_t id, unsigned long rate) { unsigned clk = -1; @@ -559,23 +560,54 @@ static int new_clk_set_rate(uint32_t id, unsigned long rate) clk = 95; break; - /* +// Cotulla: I am too lazy... +#define MHZ(x) ((x) * 1000 * 1000) +#define KHZ(x) ((x) * 1000) + case SDC1_CLK: + if (rate > MHZ(50)) speed = 14; + else if (rate > KHZ(49152)) speed = 13; + else if (rate > MHZ(45)) speed = 12; + else if (rate > MHZ(40)) speed = 11; + else if (rate > MHZ(35)) speed = 10; + else if (rate > MHZ(30)) speed = 9; + else if (rate > MHZ(25)) speed = 8; + else if (rate > MHZ(20)) speed = 7; + else if (rate > MHZ(15)) speed = 6; + else if (rate > MHZ(10)) speed = 5; + else if (rate > MHZ(5)) speed = 4; + else if (rate > KHZ(400))speed = 3; + else if (rate > KHZ(144))speed = 2; + else speed = 1; clk = 66; break; case SDC2_CLK: + if (rate > MHZ(50)) speed = 14; + else if (rate > KHZ(49152)) speed = 13; + else if (rate > MHZ(45)) speed = 12; + else if (rate > MHZ(40)) speed = 11; + else if (rate > MHZ(35)) speed = 10; + else if (rate > MHZ(30)) speed = 9; + else if (rate > MHZ(25)) speed = 8; + else if (rate > MHZ(20)) speed = 7; + else if (rate > MHZ(15)) speed = 6; + else if (rate > MHZ(10)) speed = 5; + else if (rate > MHZ(5)) speed = 4; + else if (rate > KHZ(400))speed = 3; + else if (rate > KHZ(144))speed = 2; + else speed = 1; clk = 67; break; - case SDC3_CLK: - clk = 68; - break; - case SDC4_CLK: - clk = 69; + +#undef MHZ +#undef KHZ + + // both none + case SDC1_PCLK: + case SDC2_PCLK: + return 0; break; - case MDP_CLK: - clk = 9; - break; */ default: return -1; } @@ -641,22 +673,20 @@ static int new_clk_enable(uint32_t id) case MDP_CLK: clk = 9; break; - /* + case SDC1_CLK: clk = 66; break; case SDC2_CLK: clk = 67; break; - case SDC3_CLK: - clk = 68; + case SDC1_PCLK: + clk = 17; break; - case SDC4_CLK: - clk = 69; + case SDC2_PCLK: + clk = 16; break; - -*/ default: return -1; } @@ -723,24 +753,19 @@ static int new_clk_disable(uint32_t id) clk = 9; break; - /* case SDC1_CLK: clk = 66; break; case SDC2_CLK: clk = 67; break; - case SDC3_CLK: - clk = 68; + case SDC1_PCLK: + clk = 17; break; - case SDC4_CLK: - clk = 69; + case SDC2_PCLK: + clk = 16; break; - case MDP_CLK: - clk = 9; - break; -*/ default: return -1; } @@ -752,6 +777,82 @@ static int new_clk_disable(uint32_t id) return 0; } +static long new_clk_get_rate(uint32_t id) +{ + unsigned clk = -1; + unsigned rate; + switch (id) + { + case ICODEC_RX_CLK: + clk = 50; + break; + case ICODEC_TX_CLK: + clk = 52; + break; + case ECODEC_CLK: + clk = 42; + break; + case SDAC_MCLK: + clk = 64; + break; + case IMEM_CLK: + clk = 55; + break; + case GRP_CLK: + clk = 56; + break; + case ADM_CLK: + clk = 19; + break; + + case UART1DM_CLK: + clk = 78; + break; + case UART2DM_CLK: + clk = 80; + break; + + case VFE_AXI_CLK: + clk = 24; + break; + case VFE_MDC_CLK: + clk = 40; + break; + case VFE_CLK: + clk = 41; + break; + case MDC_CLK: + clk = 53; // ?? + break; + + case SPI_CLK: + clk = 95; + break; + + case MDP_CLK: + clk = 9; + break; + + case SDC1_CLK: + clk = 66; + break; + case SDC2_CLK: + clk = 67; + break; + case SDC1_PCLK: + clk = 17; + break; + case SDC2_PCLK: + clk = 16; + break; + + default: + return 0; + } + + msm_proc_comm(PCOM_CLK_REGIME_SEC_MSM_GET_CLK_FREQ_KHZ, &clk, &rate); + return clk*1000; +} static int new_clk_set_flags(uint32_t id, unsigned long flags) { @@ -891,7 +992,10 @@ static unsigned long pc_clk_get_rate(uint32_t id) { unsigned long rate = 0; - switch (id) { + rate = new_clk_get_rate(id); + + if(rate == 0) { + switch (id) { /* known MD/NS clocks, MSM_CLK dump and arm/mach-msm/clock-7x30.c */ case SDC1_CLK: case SDC2_CLK: @@ -919,6 +1023,7 @@ static unsigned long pc_clk_get_rate(uint32_t id) if(debug_mask&DEBUG_UNKNOWN_ID) printk("%s: unknown clock: id=%u\n", __func__, id); rate = 0; + } } return rate; @@ -1179,7 +1284,7 @@ static int __init clock_late_init(void) } mutex_unlock(&clocks_mutex); pr_info("clock_late_init() disabled %d unused clocks\n", count); - + // reset imem config, I guess all devices need this so somewhere here would be good. // it needs to be moved to somewhere else. //writel( 0, MSM_IMEM_BASE ); // IMEM addresses have to ve checked and enabled diff --git a/arch/arm/mach-msm/htc_headset_mgr.c b/arch/arm/mach-msm/htc_headset_mgr.c index 8edc325d..3da40459 100644 --- a/arch/arm/mach-msm/htc_headset_mgr.c +++ b/arch/arm/mach-msm/htc_headset_mgr.c @@ -250,8 +250,9 @@ static void insert_11pin_35mm(int *state) SYS_MSG("Insert USB 3.5mm headset"); set_35mm_hw_state(1); - if (hs_mgr_notifier.mic_status) + if (hs_mgr_notifier.mic_status) { mic = hs_mgr_notifier.mic_status(); + } if (mic == HEADSET_NO_MIC) { /* without microphone */ @@ -279,6 +280,7 @@ static void remove_11pin_35mm(void) static void button_35mm_do_work(struct work_struct *w) { int key; + int pressed; struct button_work *work; work = container_of(w, struct button_work, key_work.work); @@ -291,31 +293,26 @@ static void button_35mm_do_work(struct work_struct *w) } if (hi->key_level_flag) { - switch (hi->key_level_flag) { + pressed = (hi->key_level_flag & 0x80) ? 0:1; + switch (hi->key_level_flag & 0x7f) { case 1: - H2WI("3.5mm RC: Play Pressed"); + H2WI("3.5mm RC: Play(%d)", pressed); key = HS_MGR_KEYCODE_MEDIA; break; case 2: - H2WI("3.5mm RC: BACKWARD Pressed"); + H2WI("3.5mm RC: BACKWARD(%d)", pressed); key = HS_MGR_KEYCODE_BACKWARD; break; case 3: - H2WI("3.5mm RC: FORWARD Pressed"); + H2WI("3.5mm RC: FORWARD(%d)", pressed); key = HS_MGR_KEYCODE_FORWARD; break; default: - H2WI("3.5mm RC: WRONG Button Pressed"); + H2WI("3.5mm RC: WRONG Button Pressed (%d)", hi->key_level_flag); return; } - headset_button_event(1, key); - } else { /* key release */ - if (atomic_read(&hi->btn_state)) - headset_button_event(0, atomic_read(&hi->btn_state)); - else - H2WI("3.5mm RC: WRONG Button Release"); + headset_button_event(pressed, key); } - wake_lock_timeout(&hi->headset_wake_lock, 1.5 * HZ); kfree(work); @@ -424,7 +421,7 @@ static void insert_35mm_do_work(struct work_struct *work) mic1 = mic2 = HEADSET_NO_MIC; if (hs_mgr_notifier.mic_status) { if (hi->ext_35mm_status == HTC_35MM_NO_MIC || - hi->h2w_35mm_status == HTC_35MM_NO_MIC) + hi->h2w_35mm_status == HTC_35MM_NO_MIC) for (i = 0; i < 10; i++) { mic1 = hs_mgr_notifier.mic_status(); msleep(HS_DELAY_MIC_DETECT); diff --git a/arch/arm/mach-msm/pm.c b/arch/arm/mach-msm/pm.c index d652d77b..87661749 100644 --- a/arch/arm/mach-msm/pm.c +++ b/arch/arm/mach-msm/pm.c @@ -47,6 +47,7 @@ #ifdef CONFIG_HAS_WAKELOCK #include #endif +#include "board-htcleo.h" enum { MSM_PM_DEBUG_SUSPEND = 1U << 0, @@ -269,7 +270,10 @@ static int msm_sleep(int sleep_mode, uint32_t sleep_delay, int from_idle) int ret; int rv = -EINTR; bool invalid_inital_state = false; - +#if defined(CONFIG_MACH_HTCLEO) + if(!htcleo_is_nand_boot() && sleep_mode<2) + sleep_mode=2; +#endif if (board_mfg_mode() == 4) /*power test mode*/ gpio_set_diag_gpio_table(board_get_mfg_sleep_gpio_table());