From: Ziggy Date: Sun, 17 Feb 2013 19:39:41 +0000 (-0500) Subject: Implement retention sleep mode X-Git-Url: https://projects.ziggy471.com/git/gitweb.cgi?p=ziggy471-sgs3-jb.git;a=commitdiff;h=0e00e9859c1ab03a3293617ded506846948c8eb2 Implement retention sleep mode Code cleanup Disable msm-dcvs Signed-off-by: Ziggy --- --- a/arch/arm/mach-msm/board-8960.c +++ b/arch/arm/mach-msm/board-8960.c @@ -1485,24 +1485,52 @@ static struct platform_device android_us }; static uint8_t spm_wfi_cmd_sequence[] __initdata = { - 0x03, 0x0f, + 0x03, 0x0f, +}; + +static uint8_t spm_retention_cmd_sequence[] __initdata = { + 0x00, 0x05, 0x03, 0x0D, + 0x0B, 0x00, 0x0f, }; static uint8_t spm_power_collapse_without_rpm[] __initdata = { - 0x00, 0x24, 0x54, 0x10, - 0x09, 0x03, 0x01, - 0x10, 0x54, 0x30, 0x0C, - 0x24, 0x30, 0x0f, + 0x00, 0x24, 0x54, 0x10, + 0x09, 0x03, 0x01, + 0x10, 0x54, 0x30, 0x0C, + 0x24, 0x30, 0x0f, }; static uint8_t spm_power_collapse_with_rpm[] __initdata = { - 0x00, 0x24, 0x54, 0x10, - 0x09, 0x07, 0x01, 0x0B, - 0x10, 0x54, 0x30, 0x0C, - 0x24, 0x30, 0x0f, + 0x00, 0x24, 0x54, 0x10, + 0x09, 0x07, 0x01, 0x0B, + 0x10, 0x54, 0x30, 0x0C, + 0x24, 0x30, 0x0f, +}; + +static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = { + [0] = { + .mode = MSM_SPM_MODE_CLOCK_GATING, + .notify_rpm = false, + .cmd = spm_wfi_cmd_sequence, + }, + [1] = { + .mode = MSM_SPM_MODE_POWER_RETENTION, + .notify_rpm = false, + .cmd = spm_retention_cmd_sequence, + }, + [2] = { + .mode = MSM_SPM_MODE_POWER_COLLAPSE, + .notify_rpm = false, + .cmd = spm_power_collapse_without_rpm, + }, + [3] = { + .mode = MSM_SPM_MODE_POWER_COLLAPSE, + .notify_rpm = true, + .cmd = spm_power_collapse_with_rpm, + }, }; -static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = { +static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = { [0] = { .mode = MSM_SPM_MODE_CLOCK_GATING, .notify_rpm = false, @@ -1533,8 +1561,8 @@ static struct msm_spm_platform_data msm_ .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, .vctl_timeout_us = 50, - .num_modes = ARRAY_SIZE(msm_spm_seq_list), - .modes = msm_spm_seq_list, + .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list), + .modes = msm_spm_boot_cpu_seq_list, }, [1] = { .reg_base_addr = MSM_SAW1_BASE, @@ -1548,8 +1576,8 @@ static struct msm_spm_platform_data msm_ .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, .vctl_timeout_us = 50, - .num_modes = ARRAY_SIZE(msm_spm_seq_list), - .modes = msm_spm_seq_list, + .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list), + .modes = msm_spm_nonboot_cpu_seq_list, }, }; @@ -2125,12 +2153,12 @@ static struct platform_device *common_de &msm_slim_ctrl, &msm_device_wcnss_wlan, #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ - defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) + defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) &qcrypto_device, #endif #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ - defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) + defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) &qcedev_device, #endif #ifdef CONFIG_MSM_ROTATOR @@ -2317,7 +2345,7 @@ static void __init msm8960_gfx_init(void uint32_t soc_platform_version = socinfo_get_version(); if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) { struct kgsl_device_platform_data *kgsl_3d0_pdata = - msm_kgsl_3d0.dev.platform_data; + msm_kgsl_3d0.dev.platform_data; kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000; kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000; } @@ -2327,11 +2355,23 @@ static struct msm_cpuidle_state msm_csta {0, 0, "C0", "WFI", MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, - {0, 1, "C2", "POWER_COLLAPSE", + {0, 1, "C1", "RETENTION", + MSM_PM_SLEEP_MODE_RETENTION}, + + {0, 2, "C2", "STANDALONE_POWER_COLLAPSE", + MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE}, + + {0, 3, "C3", "POWER_COLLAPSE", MSM_PM_SLEEP_MODE_POWER_COLLAPSE}, {1, 0, "C0", "WFI", MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, + + {1, 1, "C1", "RETENTION", + MSM_PM_SLEEP_MODE_RETENTION}, + + {1, 2, "C2", "STANDALONE_POWER_COLLAPSE", + MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE}, }; static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = { @@ -2342,6 +2382,20 @@ static struct msm_pm_platform_data msm_p .suspend_enabled = 0, }, + [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { + .idle_supported = 1, + .suspend_supported = 1, + .idle_enabled = 0, + .suspend_enabled = 0, + }, + + [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_RETENTION)] = { + .idle_supported = 1, + .suspend_supported = 1, + .idle_enabled = 0, + .suspend_enabled = 0, + }, + [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { .idle_supported = 1, .suspend_supported = 1, @@ -2356,6 +2410,20 @@ static struct msm_pm_platform_data msm_p .suspend_enabled = 0, }, + [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { + .idle_supported = 1, + .suspend_supported = 1, + .idle_enabled = 0, + .suspend_enabled = 0, + }, + + [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_RETENTION)] = { + .idle_supported = 1, + .suspend_supported = 1, + .idle_enabled = 0, + .suspend_enabled = 0, + }, + [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { .idle_supported = 1, .suspend_supported = 0, @@ -2369,55 +2437,63 @@ static struct msm_rpmrs_level msm_rpmrs_ MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT, MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), true, - 100, 650, 801, 200, + 1, 784, 180000, 100, }, { - MSM_PM_SLEEP_MODE_POWER_COLLAPSE, - MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE), - false, - 8500, 51, 1122000, 8500, + MSM_PM_SLEEP_MODE_RETENTION, + MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), + true, + 415, 715, 340827, 475, + }, + + { + MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE, + MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), + true, + 1300, 228, 1200000, 2000, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, - MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE), + MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE), false, - 9000, 51, 1130300, 9000, + 2000, 138, 1208400, 3200, }, + { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH), false, - 10000, 51, 1130300, 10000, + 6000, 119, 1850300, 9000, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE), false, - 12000, 14, 2205900, 12000, + 9200, 68, 2839200, 16400, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE), false, - 18000, 12, 2364250, 18000, + 10300, 63, 3128000, 18200, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH), false, - 23500, 10, 2667000, 23500, + 18000, 10, 4602600, 27000, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW), false, - 29700, 5, 2867000, 30000, + 20000, 2, 5752000, 32000, }, }; @@ -2709,7 +2785,7 @@ static void __init msm8960_cdp_init(void msm_tsens_early_init(&msm_tsens_pdata); BUG_ON(msm_rpm_init(&msm_rpm_data)); BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels, - ARRAY_SIZE(msm_rpmrs_levels))); + ARRAY_SIZE(msm_rpmrs_levels))); regulator_suppress_info_printing(); if (msm_xo_init()) --- a/arch/arm/mach-msm/board-m2_att-gpiomux.c +++ b/arch/arm/mach-msm/board-m2_att-gpiomux.c @@ -103,21 +103,6 @@ static struct gpiomux_setting cdc_mclk = .pull = GPIOMUX_PULL_NONE, }; -static struct gpiomux_setting audio_auxpcm[] = { - /* Suspended state */ - { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_2MA, - .pull = GPIOMUX_PULL_DOWN, - }, - /* Active state */ - { - .func = GPIOMUX_FUNC_1, - .drv = GPIOMUX_DRV_2MA, - .pull = GPIOMUX_PULL_NONE, - }, -}; - #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) static struct gpiomux_setting gpio_eth_config = { .pull = GPIOMUX_PULL_NONE, @@ -126,12 +111,6 @@ static struct gpiomux_setting gpio_eth_c }; #endif -static struct gpiomux_setting slimbus = { - .func = GPIOMUX_FUNC_1, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_KEEPER, -}; - static struct gpiomux_setting gpio_key_active_cfg = { .func = GPIOMUX_FUNC_GPIO, .drv = GPIOMUX_DRV_8MA, @@ -227,12 +206,6 @@ static struct gpiomux_setting mdm2ap_err .pull = GPIOMUX_PULL_DOWN, }; -static struct gpiomux_setting ap2mdm_kpdpwr_n_cfg = { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_NONE, -}; - static struct gpiomux_setting mdp_vsync_suspend_cfg = { .func = GPIOMUX_FUNC_GPIO, .drv = GPIOMUX_DRV_2MA, @@ -270,34 +243,6 @@ static struct gpiomux_setting hdmi_activ .pull = GPIOMUX_PULL_DOWN, .dir = GPIOMUX_IN, }; - -static struct gpiomux_setting hdmi_active_4_cfg = { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_2MA, - .pull = GPIOMUX_PULL_UP, - .dir = GPIOMUX_OUT_HIGH, -}; -#endif -#if defined(CONFIG_VIDEO_MHL_V1) || defined(CONFIG_VIDEO_MHL_V2) -static struct gpiomux_setting mhl_suspend_cfg = { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_2MA, - .pull = GPIOMUX_PULL_DOWN, -}; - -static struct gpiomux_setting mhl_active_1_cfg = { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_2MA, - .pull = GPIOMUX_PULL_DOWN, - .dir = GPIOMUX_OUT_LOW, -}; - -static struct gpiomux_setting mhl_active_2_cfg = { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_2MA, - .pull = GPIOMUX_PULL_NONE, -}; - #endif #ifdef CONFIG_USB_SWITCH_FSA9485 @@ -554,21 +499,6 @@ static struct msm_gpiomux_config msm8960 }, }; -static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = { - { - .gpio = 60, /* slimbus data */ - .settings = { - [GPIOMUX_SUSPENDED] = &slimbus, - }, - }, - { - .gpio = 61, /* slimbus clk */ - .settings = { - [GPIOMUX_SUSPENDED] = &slimbus, - }, - }, -}; - static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = { { .gpio = 59, @@ -641,12 +571,6 @@ static struct gpiomux_setting cdc_i2s_tx .pull = GPIOMUX_PULL_NONE, }; -static struct gpiomux_setting cdc_i2s_tx_d1 = { - .func = GPIOMUX_FUNC_1, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_NONE, -}; - static struct gpiomux_setting cdc_i2s_tx_ws = { .func = GPIOMUX_FUNC_1, .drv = GPIOMUX_DRV_8MA, @@ -682,37 +606,6 @@ static struct msm_gpiomux_config msm8960 }; -static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = { - { - .gpio = 63, - .settings = { - [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], - [GPIOMUX_ACTIVE] = &audio_auxpcm[1], - }, - }, - { - .gpio = 64, - .settings = { - [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], - [GPIOMUX_ACTIVE] = &audio_auxpcm[1], - }, - }, - { - .gpio = 65, - .settings = { - [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], - [GPIOMUX_ACTIVE] = &audio_auxpcm[1], - }, - }, - { - .gpio = 66, - .settings = { - [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], - [GPIOMUX_ACTIVE] = &audio_auxpcm[1], - }, - }, -}; - static struct msm_gpiomux_config wcnss_5wire_interface[] = { { .gpio = 84, @@ -914,47 +807,6 @@ static struct msm_gpiomux_config msm8960 }, }; #endif -#if defined(CONFIG_VIDEO_MHL_V1) || defined(CONFIG_VIDEO_MHL_V2) -static struct msm_gpiomux_config msm8960_mhl_configs[] __initdata = { - { - .gpio = GPIO_MHL_EN, - .settings = { - [GPIOMUX_ACTIVE] = &mhl_active_1_cfg, - [GPIOMUX_SUSPENDED] = &mhl_suspend_cfg, - }, - }, - { - .gpio = GPIO_MHL_RST, - .settings = { - [GPIOMUX_ACTIVE] = &mhl_active_1_cfg, - [GPIOMUX_SUSPENDED] = &mhl_suspend_cfg, - }, - }, - { - .gpio = GPIO_MHL_WAKE_UP, - .settings = { - [GPIOMUX_SUSPENDED] = &mhl_suspend_cfg, - }, - }, - { - .gpio = GPIO_MHL_SDA, - .settings = { - [GPIOMUX_ACTIVE] = &mhl_active_2_cfg, - [GPIOMUX_SUSPENDED] = &mhl_suspend_cfg, - }, - }, - { - .gpio = GPIO_MHL_SCL, - .settings = { - [GPIOMUX_ACTIVE] = &mhl_active_2_cfg, - [GPIOMUX_SUSPENDED] = &mhl_suspend_cfg, - }, - }, - - - -}; -#endif #ifdef CONFIG_I2C --- a/arch/arm/mach-msm/board-m2_att.c +++ b/arch/arm/mach-msm/board-m2_att.c @@ -172,6 +172,9 @@ #include #endif +#ifdef CONFIG_KEXEC_HARDBOOT +#include +#endif #ifdef CONFIG_TOUCHSCREEN_MMS144 struct tsp_callbacks *charger_callbacks; struct tsp_callbacks { @@ -293,28 +296,6 @@ struct sx150x_platform_data msm8960_sx15 #endif -static struct gpiomux_setting sec_ts_ldo_act_cfg = { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_UP, -}; - -static struct gpiomux_setting sec_ts_ldo_sus_cfg = { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_DOWN, -}; - -static struct msm_gpiomux_config msm8960_sec_ts_configs[] = { - { /* TS LDO EN */ - .gpio = 10, - .settings = { - [GPIOMUX_ACTIVE] = &sec_ts_ldo_act_cfg, - [GPIOMUX_SUSPENDED] = &sec_ts_ldo_sus_cfg, - }, - }, -}; - #define MSM_PMEM_ADSP_SIZE 0x9600000 /* 150 Mbytes */ #define MSM_PMEM_ADSP_SIZE_FOR_2GB 0xA500000 /* 165 Mbytes */ #define MSM_PMEM_AUDIO_SIZE 0x160000 /* 1.375 Mbytes */ @@ -787,7 +768,7 @@ static void __init reserve_ion_memory(vo if (!strcmp(heap->name, "mm") && (mb->start >= 0xc0000000)) { printk(KERN_ERR "heap->name %s, mb->start %lx\n", - heap->name, mb->start); + heap->name, (unsigned long)mb->start); heap->size = MSM_PMEM_ADSP_SIZE_FOR_2GB; } @@ -1029,6 +1010,25 @@ static int __init ext_display_setup(char } early_param("ext_display", ext_display_setup); +/* Exclude the last 4 kB to preserve the kexec hardboot page. */ +#ifdef CONFIG_ANDROID_RAM_CONSOLE +#define RAM_CONSOLE_START 0xfff00000 +#define RAM_CONSOLE_SIZE (SZ_1M-SZ_4K) + +static struct resource ram_console_resource[] = { + { + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device ram_console_device = { + .name = "ram_console", + .id = -1, + .num_resources = ARRAY_SIZE(ram_console_resource), + .resource = ram_console_resource, +}; +#endif + unsigned int address = 0xea000000; unsigned int size = 0x100000; @@ -1054,6 +1054,17 @@ static void __init msm8960_reserve(void) ret = memblock_remove(address, size); BUG_ON(ret); } + +#ifdef CONFIG_ANDROID_RAM_CONSOLE + if (memblock_remove(RAM_CONSOLE_START, RAM_CONSOLE_SIZE) == 0) { + ram_console_resource[0].start = RAM_CONSOLE_START; + ram_console_resource[0].end = RAM_CONSOLE_START+RAM_CONSOLE_SIZE-1; + } +#endif + +#ifdef CONFIG_KEXEC_HARDBOOT + memblock_remove(KEXEC_HB_PAGE_ADDR, SZ_4K); +#endif } static int msm8960_change_memory_power(u64 start, u64 size, @@ -1541,7 +1552,7 @@ int msm8960_get_cable_type(void) } if (i == 10) { pr_err("%s: fail to get battery ps\n", __func__); - return; + return ret; } #endif @@ -1825,6 +1836,7 @@ static int is_smb347_inok_using(void) return 0; } + #ifdef CONFIG_WIRELESS_CHARGING static void smb347_wireless_cb(void) { @@ -1923,12 +1935,14 @@ void max17040_hw_init(void) static int max17040_low_batt_cb(void) { - pr_err("%s: Low battery alert\n", __func__); - #ifdef CONFIG_BATTERY_SEC struct power_supply *psy = power_supply_get_by_name("battery"); union power_supply_propval value; +#endif + + pr_err("%s: Low battery alert\n", __func__); +#ifdef CONFIG_BATTERY_SEC if (!psy) { pr_err("%s: fail to get battery ps\n", __func__); return -ENODEV; @@ -2046,7 +2060,9 @@ static struct i2c_board_info opt_i2c_bor #endif }; +#if defined(CONFIG_OPTICAL_GP2A) || defined(CONFIG_OPTICAL_GP2AP020A00F) static void gp2a_led_onoff(int); +#endif #if defined(CONFIG_OPTICAL_GP2A) static struct opt_gp2a_platform_data opt_gp2a_data = { @@ -2645,11 +2661,6 @@ static struct i2c_gpio_platform_data a2 .udelay = 1, }; -static struct platform_device a2220_i2c_gpio_device = { - .name = "i2c-gpio", - .id = MSM_A2220_I2C_BUS_ID, - .dev.platform_data = &a2220_i2c_gpio_data, -}; #endif #ifdef CONFIG_WCD9310_CODEC @@ -3150,9 +3161,6 @@ static struct msm_spi_platform_data msm8 .max_clock_speed = 48000000, /*15060000,*/ }; #endif -static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = { - .max_clock_speed = 15060000, -}; #ifdef CONFIG_USB_MSM_OTG_72K static struct msm_otg_platform_data msm_otg_pdata; @@ -3435,24 +3443,52 @@ static struct platform_device android_us }; static uint8_t spm_wfi_cmd_sequence[] __initdata = { - 0x03, 0x0f, + 0x03, 0x0f, +}; + +static uint8_t spm_retention_cmd_sequence[] __initdata = { + 0x00, 0x05, 0x03, 0x0D, + 0x0B, 0x00, 0x0f, }; static uint8_t spm_power_collapse_without_rpm[] __initdata = { - 0x00, 0x24, 0x54, 0x10, - 0x09, 0x03, 0x01, - 0x10, 0x54, 0x30, 0x0C, - 0x24, 0x30, 0x0f, + 0x00, 0x24, 0x54, 0x10, + 0x09, 0x03, 0x01, + 0x10, 0x54, 0x30, 0x0C, + 0x24, 0x30, 0x0f, }; static uint8_t spm_power_collapse_with_rpm[] __initdata = { - 0x00, 0x24, 0x54, 0x10, - 0x09, 0x07, 0x01, 0x0B, - 0x10, 0x54, 0x30, 0x0C, - 0x24, 0x30, 0x0f, + 0x00, 0x24, 0x54, 0x10, + 0x09, 0x07, 0x01, 0x0B, + 0x10, 0x54, 0x30, 0x0C, + 0x24, 0x30, 0x0f, }; -static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = { +static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = { + [0] = { + .mode = MSM_SPM_MODE_CLOCK_GATING, + .notify_rpm = false, + .cmd = spm_wfi_cmd_sequence, + }, + [1] = { + .mode = MSM_SPM_MODE_POWER_RETENTION, + .notify_rpm = false, + .cmd = spm_retention_cmd_sequence, + }, + [2] = { + .mode = MSM_SPM_MODE_POWER_COLLAPSE, + .notify_rpm = false, + .cmd = spm_power_collapse_without_rpm, + }, + [3] = { + .mode = MSM_SPM_MODE_POWER_COLLAPSE, + .notify_rpm = true, + .cmd = spm_power_collapse_with_rpm, + }, +}; + +static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = { [0] = { .mode = MSM_SPM_MODE_CLOCK_GATING, .notify_rpm = false, @@ -3479,12 +3515,12 @@ static struct msm_spm_platform_data msm_ .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, #endif .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, - .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204, - .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, - .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, + .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004, + .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C, + .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C, .vctl_timeout_us = 50, - .num_modes = ARRAY_SIZE(msm_spm_seq_list), - .modes = msm_spm_seq_list, + .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list), + .modes = msm_spm_boot_cpu_seq_list, }, [1] = { .reg_base_addr = MSM_SAW1_BASE, @@ -3498,8 +3534,8 @@ static struct msm_spm_platform_data msm_ .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, .vctl_timeout_us = 50, - .num_modes = ARRAY_SIZE(msm_spm_seq_list), - .modes = msm_spm_seq_list, + .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list), + .modes = msm_spm_nonboot_cpu_seq_list, }, }; @@ -3786,10 +3822,30 @@ static void mxt_init_hw_liquid(void) __func__, GPIO_MXT_TS_LDO_EN); goto err_ldo_gpio_req; } +#if !defined(CONFIG_WIRELESS_CHARGING) + rc = gpio_request(GPIO_MXT_TS_RESET, "mxt_reset_gpio"); + if (rc) { + pr_err("%s: unable to request mxt_reset gpio [%d]\n", + __func__, GPIO_MXT_TS_RESET); + goto err_ldo_gpio_set_dir; + } + + rc = gpio_direction_output(GPIO_MXT_TS_RESET, 1); + if (rc) { + pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n", + __func__, GPIO_MXT_TS_RESET); + goto err_reset_gpio_req; + } +#endif return; +#if !defined(CONFIG_WIRELESS_CHARGING) +err_reset_gpio_req: + gpio_free(GPIO_MXT_TS_RESET); err_ldo_gpio_set_dir: gpio_set_value(GPIO_MXT_TS_LDO_EN, 0); +#endif + err_ldo_gpio_req: gpio_free(GPIO_MXT_TS_LDO_EN); err_irq_gpio_req: @@ -3798,11 +3854,11 @@ err_irq_gpio_req: static struct mxt_platform_data mxt_platform_data = { .config = mxt_config_data, - .config_length = ARRAY_SIZE(mxt_config_data), + .config_length = ARRAY_SIZE(mxt_config_data), .x_size = 1365, .y_size = 767, .irqflags = IRQF_TRIGGER_FALLING, - .i2c_pull_up = true, + .i2c_pull_up = true, }; static struct i2c_board_info mxt_device_info[] __initdata = { @@ -3897,6 +3953,13 @@ static struct msm_rpm_platform_data msm_ .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008, .msm_apps_ipc_rpm_val = 4, }; + +static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = { + .base_addr = MSM_ACC0_BASE + 0x08, + .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE, + .mask = 1UL << 13, +}; + #ifndef CONFIG_S5C73M3 static struct ks8851_pdata spi_eth_pdata = { .irq_gpio = KS8851_IRQ_GPIO, @@ -3923,12 +3986,6 @@ static struct spi_board_info spi_board_i }; #endif -static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = { - .base_addr = MSM_ACC0_BASE + 0x08, - .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE, - .mask = 1UL << 13, -}; - static struct platform_device msm_device_saw_core0 = { .name = "saw-regulator", .id = 0, @@ -3974,14 +4031,6 @@ static struct platform_device msm8960_de }, }; -static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = { - .name = GPIO_REGULATOR_DEV_NAME, - .id = 91, - .dev = { - .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2], - }, -}; - static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = { .name = GPIO_REGULATOR_DEV_NAME, .id = PM8921_GPIO_PM_TO_SYS(17), @@ -4301,7 +4350,6 @@ static struct platform_device *common_de &msm_cache_dump_device, #endif &msm8960_cpu_idle_device, - &msm8960_msm_gov_device, }; static struct platform_device *m2_att_devices[] __initdata = { @@ -4383,16 +4431,19 @@ static struct platform_device *m2_att_de #if defined(CONFIG_OPTICAL_GP2A) || defined(CONFIG_OPTICAL_GP2AP020A00F) \ || defined(CONFIG_SENSORS_CM36651) &opt_i2c_gpio_device, -#endif #if defined(CONFIG_OPTICAL_GP2A) || defined(CONFIG_OPTICAL_GP2AP020A00F) &opt_gp2a, #endif +#endif #ifdef CONFIG_BT_BCM4334 &bcm4334_bluetooth_device, #endif #ifdef CONFIG_VIBETONZ &vibetonz_device, #endif /* CONFIG_VIBETONZ */ +#ifdef CONFIG_ANDROID_RAM_CONSOLE + &ram_console_device, +#endif }; static void __init msm8960_i2c_init(void) @@ -4436,18 +4487,31 @@ static struct msm_cpuidle_state msm_csta {0, 0, "C0", "WFI", MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, - {0, 1, "C2", "POWER_COLLAPSE", + {0, 1, "C1", "RETENTION", + MSM_PM_SLEEP_MODE_RETENTION}, + + {0, 2, "C2", "POWER_COLLAPSE", MSM_PM_SLEEP_MODE_POWER_COLLAPSE}, {1, 0, "C0", "WFI", MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, + + {1, 1, "C1", "RETENTION", + MSM_PM_SLEEP_MODE_RETENTION}, }; static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = { [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { .idle_supported = 1, .suspend_supported = 1, - .idle_enabled = 0, + .idle_enabled = 1, + .suspend_enabled = 1, + }, + + [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_RETENTION)] = { + .idle_supported = 1, + .suspend_supported = 0, + .idle_enabled = 1, .suspend_enabled = 0, }, @@ -4462,7 +4526,14 @@ static struct msm_pm_platform_data msm_p .idle_supported = 0, .suspend_supported = 1, .idle_enabled = 0, - .suspend_enabled = 0, + .suspend_enabled = 1, + }, + + [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_RETENTION)] = { + .idle_supported = 1, + .suspend_supported = 1, + .idle_enabled = 1, + .suspend_enabled = 1, }, [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { @@ -4478,55 +4549,56 @@ static struct msm_rpmrs_level msm_rpmrs_ MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT, MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), true, - 100, 650, 801, 200, + 1, 550, 180000, 100, }, { - MSM_PM_SLEEP_MODE_POWER_COLLAPSE, - MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE), - false, - 8500, 51, 1122000, 8500, + MSM_PM_SLEEP_MODE_RETENTION, + MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), + true, + 415, 450, 340827, 475, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, - MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE), + MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE), false, - 9000, 51, 1130300, 9000, + 2000, 138, 1208400, 3200, }, + { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH), false, - 10000, 51, 1130300, 10000, + 6000, 119, 1850300, 9000, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE), false, - 12000, 14, 2205900, 12000, + 9200, 68, 2839200, 16400, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE), false, - 18000, 12, 2364250, 18000, + 10300, 63, 3128000, 18200, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH), false, - 23500, 10, 2667000, 23500, + 18000, 10, 4602600, 27000, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW), false, - 29700, 5, 2867000, 30000, + 20000, 2, 5752000, 32000, }, }; @@ -5040,7 +5112,7 @@ static struct pm_gpio ear_micbiase = { .output_value = 0, }; -static int secjack_gpio_init() +static int secjack_gpio_init(void) { int rc; @@ -5081,19 +5153,19 @@ static int secjack_gpio_init() } #endif -void main_mic_bias_init() +void main_mic_bias_init(void) { int ret; ret = gpio_request(GPIO_MAIN_MIC_BIAS, "LDO_BIAS"); if (ret) { pr_err("%s: ldo bias gpio %d request" "failed\n", __func__, GPIO_MAIN_MIC_BIAS); - return ret; + return; } gpio_direction_output(GPIO_MAIN_MIC_BIAS, 0); } -static int configure_codec_lineout_gpio() +static int configure_codec_lineout_gpio(void) { int ret; struct pm_gpio param = { @@ -5119,7 +5191,7 @@ static int configure_codec_lineout_gpio( return 0; } -static int tabla_codec_ldo_en_init() +static int tabla_codec_ldo_en_init(void) { int ret; @@ -5130,8 +5202,9 @@ static int tabla_codec_ldo_en_init() "failed\n", __func__, PM8921_GPIO_PM_TO_SYS(gpio_rev(LINEOUT_EN))); return ret; - } - gpio_direction_output(PM8921_GPIO_PM_TO_SYS(gpio_rev(LINEOUT_EN)), 0); + } else + gpio_direction_output(PM8921_GPIO_PM_TO_SYS( + gpio_rev(LINEOUT_EN)), 0); return 0; } @@ -5155,8 +5228,8 @@ static void __init samsung_m2_att_init(v regulator_suppress_info_printing(); if (msm_xo_init()) pr_err("Failed to initialize XO votes\n"); - platform_device_register(&msm8960_device_rpm_regulator); - msm_clock_init(&msm8960_clock_init_data); + platform_device_register(&msm8960_device_rpm_regulator); + msm_clock_init(&msm8960_clock_init_data); if (machine_is_msm8960_liquid()) msm_otg_pdata.mhl_enable = true; msm8960_device_otg.dev.platform_data = &msm_otg_pdata; @@ -5275,6 +5348,7 @@ static void __init samsung_m2_att_init(v if (PLATFORM_IS_CHARM25()) platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices)); + msm_pm_set_tz_retention_flag(1); } MACHINE_START(M2_ATT, "SAMSUNG M2_ATT") --- a/arch/arm/mach-msm/board-m2_spr-gpiomux.c +++ b/arch/arm/mach-msm/board-m2_spr-gpiomux.c @@ -103,21 +103,6 @@ static struct gpiomux_setting cdc_mclk = .pull = GPIOMUX_PULL_NONE, }; -static struct gpiomux_setting audio_auxpcm[] = { - /* Suspended state */ - { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_2MA, - .pull = GPIOMUX_PULL_DOWN, - }, - /* Active state */ - { - .func = GPIOMUX_FUNC_1, - .drv = GPIOMUX_DRV_2MA, - .pull = GPIOMUX_PULL_NONE, - }, -}; - #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) static struct gpiomux_setting gpio_eth_config = { .pull = GPIOMUX_PULL_NONE, @@ -126,12 +111,6 @@ static struct gpiomux_setting gpio_eth_c }; #endif -static struct gpiomux_setting slimbus = { - .func = GPIOMUX_FUNC_1, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_KEEPER, -}; - static struct gpiomux_setting gpio_key_active_cfg = { .func = GPIOMUX_FUNC_GPIO, .drv = GPIOMUX_DRV_8MA, @@ -263,20 +242,6 @@ static struct gpiomux_setting hdmi_activ .drv = GPIOMUX_DRV_2MA, .pull = GPIOMUX_PULL_DOWN, }; - -static struct gpiomux_setting hdmi_active_3_cfg = { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_2MA, - .pull = GPIOMUX_PULL_DOWN, - .dir = GPIOMUX_IN, -}; - -static struct gpiomux_setting hdmi_active_4_cfg = { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_2MA, - .pull = GPIOMUX_PULL_UP, - .dir = GPIOMUX_OUT_HIGH, -}; #endif #if defined(CONFIG_VIDEO_MHL_V1) || defined(CONFIG_VIDEO_MHL_V2) @@ -293,12 +258,6 @@ static struct gpiomux_setting mhl_active .dir = GPIOMUX_OUT_LOW, }; -static struct gpiomux_setting mhl_active_2_cfg = { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_2MA, - .pull = GPIOMUX_PULL_NONE, -}; - #endif #ifdef CONFIG_USB_SWITCH_FSA9485 @@ -552,21 +511,6 @@ static struct msm_gpiomux_config msm8960 }, }; -static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = { - { - .gpio = 60, /* slimbus data */ - .settings = { - [GPIOMUX_SUSPENDED] = &slimbus, - }, - }, - { - .gpio = 61, /* slimbus clk */ - .settings = { - [GPIOMUX_SUSPENDED] = &slimbus, - }, - }, -}; - static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = { { .gpio = 59, @@ -639,12 +583,6 @@ static struct gpiomux_setting cdc_i2s_tx .pull = GPIOMUX_PULL_NONE, }; -static struct gpiomux_setting cdc_i2s_tx_d1 = { - .func = GPIOMUX_FUNC_1, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_NONE, -}; - static struct gpiomux_setting cdc_i2s_tx_ws = { .func = GPIOMUX_FUNC_1, .drv = GPIOMUX_DRV_8MA, @@ -679,38 +617,6 @@ static struct msm_gpiomux_config msm8960 }; - -static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = { - { - .gpio = 63, - .settings = { - [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], - [GPIOMUX_ACTIVE] = &audio_auxpcm[1], - }, - }, - { - .gpio = 64, - .settings = { - [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], - [GPIOMUX_ACTIVE] = &audio_auxpcm[1], - }, - }, - { - .gpio = 65, - .settings = { - [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], - [GPIOMUX_ACTIVE] = &audio_auxpcm[1], - }, - }, - { - .gpio = 66, - .settings = { - [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], - [GPIOMUX_ACTIVE] = &audio_auxpcm[1], - }, - }, -}; - static struct msm_gpiomux_config wcnss_5wire_interface[] = { { .gpio = 84, --- a/arch/arm/mach-msm/board-m2_spr.c +++ b/arch/arm/mach-msm/board-m2_spr.c @@ -296,28 +296,6 @@ struct sx150x_platform_data msm8960_sx15 #endif -static struct gpiomux_setting sec_ts_ldo_act_cfg = { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_UP, -}; - -static struct gpiomux_setting sec_ts_ldo_sus_cfg = { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_DOWN, -}; - -static struct msm_gpiomux_config msm8960_sec_ts_configs[] = { - { /* TS LDO EN */ - .gpio = 10, - .settings = { - [GPIOMUX_ACTIVE] = &sec_ts_ldo_act_cfg, - [GPIOMUX_SUSPENDED] = &sec_ts_ldo_sus_cfg, - }, - }, -}; - #define MSM_PMEM_ADSP_SIZE 0x9600000 /* 150 Mbytes */ #define MSM_PMEM_ADSP_SIZE_FOR_2GB 0xA500000 /* 165 Mbytes */ #define MSM_PMEM_AUDIO_SIZE 0x160000 /* 1.375 Mbytes */ @@ -790,7 +768,7 @@ static void __init reserve_ion_memory(vo if (!strcmp(heap->name, "mm") && (mb->start >= 0xc0000000)) { printk(KERN_ERR "heap->name %s, mb->start %lx\n", - heap->name, mb->start); + heap->name, (unsigned long)mb->start); heap->size = MSM_PMEM_ADSP_SIZE_FOR_2GB; } @@ -1573,7 +1551,7 @@ int msm8960_get_cable_type(void) } if (i == 10) { pr_err("%s: fail to get battery ps\n", __func__); - return; + return ret; } #endif @@ -1709,20 +1687,20 @@ static void sii9234_hw_onoff(bool onoff) GPIO_CFG_PULL_UP, GPIO_CFG_2MA), 1); mhl_l12 = regulator_get(NULL, "8921_l12"); rc = regulator_set_voltage(mhl_l12, 1200000, 1200000); - if (rc) - pr_err("error setting voltage\n"); - rc = regulator_enable(mhl_l12); - if (rc) - pr_err("error enabling regulator\n"); - usleep(1*1000); + if (rc) + pr_err("error setting voltage\n"); + rc = regulator_enable(mhl_l12); + if (rc) + pr_err("error enabling regulator\n"); + usleep(1*1000); gpio_direction_output(GPIO_MHL_EN, 1); } else { gpio_direction_output(GPIO_MHL_EN, 0); if (mhl_l12) { rc = regulator_disable(mhl_l12); - if (rc) - pr_err("error disabling regulator\n"); - } + if (rc) + pr_err("error disabling regulator\n"); + } usleep_range(10000, 20000); @@ -1946,12 +1924,14 @@ void max17040_hw_init(void) static int max17040_low_batt_cb(void) { - pr_err("%s: Low battery alert\n", __func__); - #ifdef CONFIG_BATTERY_SEC struct power_supply *psy = power_supply_get_by_name("battery"); union power_supply_propval value; +#endif + + pr_err("%s: Low battery alert\n", __func__); +#ifdef CONFIG_BATTERY_SEC if (!psy) { pr_err("%s: fail to get battery ps\n", __func__); return -ENODEV; @@ -2069,7 +2049,9 @@ static struct i2c_board_info opt_i2c_bor #endif }; +#if defined(CONFIG_OPTICAL_GP2A) || defined(CONFIG_OPTICAL_GP2AP020A00F) static void gp2a_led_onoff(int); +#endif #if defined(CONFIG_OPTICAL_GP2A) static struct opt_gp2a_platform_data opt_gp2a_data = { @@ -2426,7 +2408,7 @@ static int __init sensor_device_init(voi if (system_rev < BOARD_REV06) { gpio_tlmm_config(GPIO_CFG(mag_rst, 0, - GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA), 1); + GPIO_CFG_OUTPUT, GPIO_CFG_PULL_UP, GPIO_CFG_2MA), 1); } else { mag_rst = PM8921_GPIO_PM_TO_SYS(mag_rst); pm8xxx_gpio_config(mag_rst, &mag_rst_cfg); @@ -2597,7 +2579,6 @@ static void cm36651_led_onoff(int onoff) if (rc) pr_err("%s: error reg_8921_leda setting ret=%d\n", __func__, rc); - return; } if (onoff) { @@ -2678,11 +2659,6 @@ static struct i2c_gpio_platform_data a2 .udelay = 1, }; -static struct platform_device a2220_i2c_gpio_device = { - .name = "i2c-gpio", - .id = MSM_A2220_I2C_BUS_ID, - .dev.platform_data = &a2220_i2c_gpio_data, -}; static struct gpiomux_setting a2220_gsbi_config = { .func = GPIOMUX_FUNC_GPIO, .drv = GPIOMUX_DRV_8MA, @@ -2800,7 +2776,6 @@ static struct slim_device msm_slim_tabla .platform_data = &tabla_platform_data, }, }; -static u8 tabla20_e_addr[6] = {0, 0, 0x60, 0, 0x17, 2}; static struct tabla_pdata tabla20_platform_data = { .slimbus_slave_device = { @@ -3201,9 +3176,6 @@ static struct msm_spi_platform_data msm8 .max_clock_speed = 48000000, /*15060000,*/ }; #endif -static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = { - .max_clock_speed = 15060000, -}; #ifdef CONFIG_USB_MSM_OTG_72K static struct msm_otg_platform_data msm_otg_pdata; @@ -3486,24 +3458,52 @@ static struct platform_device android_us }; static uint8_t spm_wfi_cmd_sequence[] __initdata = { - 0x03, 0x0f, + 0x03, 0x0f, +}; + +static uint8_t spm_retention_cmd_sequence[] __initdata = { + 0x00, 0x05, 0x03, 0x0D, + 0x0B, 0x00, 0x0f, }; static uint8_t spm_power_collapse_without_rpm[] __initdata = { - 0x00, 0x24, 0x54, 0x10, - 0x09, 0x03, 0x01, - 0x10, 0x54, 0x30, 0x0C, - 0x24, 0x30, 0x0f, + 0x00, 0x24, 0x54, 0x10, + 0x09, 0x03, 0x01, + 0x10, 0x54, 0x30, 0x0C, + 0x24, 0x30, 0x0f, }; static uint8_t spm_power_collapse_with_rpm[] __initdata = { - 0x00, 0x24, 0x54, 0x10, - 0x09, 0x07, 0x01, 0x0B, - 0x10, 0x54, 0x30, 0x0C, - 0x24, 0x30, 0x0f, + 0x00, 0x24, 0x54, 0x10, + 0x09, 0x07, 0x01, 0x0B, + 0x10, 0x54, 0x30, 0x0C, + 0x24, 0x30, 0x0f, +}; + +static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = { + [0] = { + .mode = MSM_SPM_MODE_CLOCK_GATING, + .notify_rpm = false, + .cmd = spm_wfi_cmd_sequence, + }, + [1] = { + .mode = MSM_SPM_MODE_POWER_RETENTION, + .notify_rpm = false, + .cmd = spm_retention_cmd_sequence, + }, + [2] = { + .mode = MSM_SPM_MODE_POWER_COLLAPSE, + .notify_rpm = false, + .cmd = spm_power_collapse_without_rpm, + }, + [3] = { + .mode = MSM_SPM_MODE_POWER_COLLAPSE, + .notify_rpm = true, + .cmd = spm_power_collapse_with_rpm, + }, }; -static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = { +static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = { [0] = { .mode = MSM_SPM_MODE_CLOCK_GATING, .notify_rpm = false, @@ -3530,12 +3530,12 @@ static struct msm_spm_platform_data msm_ .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, #endif .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, - .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204, - .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, - .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, + .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004, + .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C, + .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C, .vctl_timeout_us = 50, - .num_modes = ARRAY_SIZE(msm_spm_seq_list), - .modes = msm_spm_seq_list, + .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list), + .modes = msm_spm_boot_cpu_seq_list, }, [1] = { .reg_base_addr = MSM_SAW1_BASE, @@ -3549,8 +3549,8 @@ static struct msm_spm_platform_data msm_ .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, .vctl_timeout_us = 50, - .num_modes = ARRAY_SIZE(msm_spm_seq_list), - .modes = msm_spm_seq_list, + .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list), + .modes = msm_spm_nonboot_cpu_seq_list, }, }; @@ -3837,10 +3837,30 @@ static void mxt_init_hw_liquid(void) __func__, GPIO_MXT_TS_LDO_EN); goto err_ldo_gpio_req; } +#if !defined(CONFIG_WIRELESS_CHARGING) + rc = gpio_request(GPIO_MXT_TS_RESET, "mxt_reset_gpio"); + if (rc) { + pr_err("%s: unable to request mxt_reset gpio [%d]\n", + __func__, GPIO_MXT_TS_RESET); + goto err_ldo_gpio_set_dir; + } + + rc = gpio_direction_output(GPIO_MXT_TS_RESET, 1); + if (rc) { + pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n", + __func__, GPIO_MXT_TS_RESET); + goto err_reset_gpio_req; + } +#endif return; +#if !defined(CONFIG_WIRELESS_CHARGING) +err_reset_gpio_req: + gpio_free(GPIO_MXT_TS_RESET); err_ldo_gpio_set_dir: gpio_set_value(GPIO_MXT_TS_LDO_EN, 0); +#endif + err_ldo_gpio_req: gpio_free(GPIO_MXT_TS_LDO_EN); err_irq_gpio_req: @@ -3849,7 +3869,7 @@ err_irq_gpio_req: static struct mxt_platform_data mxt_platform_data = { .config = mxt_config_data, - .config_length = ARRAY_SIZE(mxt_config_data), + .config_length = ARRAY_SIZE(mxt_config_data), .x_line = 26, .y_line = 42, .x_size = 767, @@ -3953,6 +3973,13 @@ static struct msm_rpm_platform_data msm_ .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008, .msm_apps_ipc_rpm_val = 4, }; + +static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = { + .base_addr = MSM_ACC0_BASE + 0x08, + .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE, + .mask = 1UL << 13, +}; + #ifndef CONFIG_S5C73M3 static struct ks8851_pdata spi_eth_pdata = { .irq_gpio = KS8851_IRQ_GPIO, @@ -3979,12 +4006,6 @@ static struct spi_board_info spi_board_i }; #endif -static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = { - .base_addr = MSM_ACC0_BASE + 0x08, - .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE, - .mask = 1UL << 13, -}; - static struct platform_device msm_device_saw_core0 = { .name = "saw-regulator", .id = 0, @@ -4030,14 +4051,6 @@ static struct platform_device msm8960_de }, }; -static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = { - .name = GPIO_REGULATOR_DEV_NAME, - .id = 91, - .dev = { - .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2], - }, -}; - static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = { .name = GPIO_REGULATOR_DEV_NAME, .id = PM8921_GPIO_PM_TO_SYS(17), @@ -4357,7 +4370,6 @@ static struct platform_device *common_de &msm_cache_dump_device, #endif &msm8960_cpu_idle_device, - &msm8960_msm_gov_device, }; static struct platform_device *m2_spr_devices[] __initdata = { @@ -4495,18 +4507,31 @@ static struct msm_cpuidle_state msm_csta {0, 0, "C0", "WFI", MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, - {0, 1, "C2", "POWER_COLLAPSE", + {0, 1, "C1", "RETENTION", + MSM_PM_SLEEP_MODE_RETENTION}, + + {0, 2, "C2", "POWER_COLLAPSE", MSM_PM_SLEEP_MODE_POWER_COLLAPSE}, {1, 0, "C0", "WFI", MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, + + {1, 1, "C1", "RETENTION", + MSM_PM_SLEEP_MODE_RETENTION}, }; static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = { [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { .idle_supported = 1, .suspend_supported = 1, - .idle_enabled = 0, + .idle_enabled = 1, + .suspend_enabled = 1, + }, + + [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_RETENTION)] = { + .idle_supported = 1, + .suspend_supported = 0, + .idle_enabled = 1, .suspend_enabled = 0, }, @@ -4521,7 +4546,14 @@ static struct msm_pm_platform_data msm_p .idle_supported = 0, .suspend_supported = 1, .idle_enabled = 0, - .suspend_enabled = 0, + .suspend_enabled = 1, + }, + + [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_RETENTION)] = { + .idle_supported = 1, + .suspend_supported = 1, + .idle_enabled = 1, + .suspend_enabled = 1, }, [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { @@ -4537,55 +4569,56 @@ static struct msm_rpmrs_level msm_rpmrs_ MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT, MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), true, - 100, 650, 801, 200, + 1, 550, 180000, 100, }, { - MSM_PM_SLEEP_MODE_POWER_COLLAPSE, - MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE), - false, - 8500, 51, 1122000, 8500, + MSM_PM_SLEEP_MODE_RETENTION, + MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), + true, + 415, 450, 340827, 475, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, - MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE), + MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE), false, - 9000, 51, 1130300, 9000, + 2000, 138, 1208400, 3200, }, + { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH), false, - 10000, 51, 1130300, 10000, + 6000, 119, 1850300, 9000, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE), false, - 12000, 14, 2205900, 12000, + 9200, 68, 2839200, 16400, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE), false, - 18000, 12, 2364250, 18000, + 10300, 63, 3128000, 18200, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH), false, - 23500, 10, 2667000, 23500, + 18000, 10, 4602600, 27000, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW), false, - 29700, 5, 2867000, 30000, + 20000, 2, 5752000, 32000, }, }; @@ -5012,6 +5045,7 @@ static void __init gpio_rev_init(void) gpio_keys_button[2].gpio = GPIO_HOME_KEY; gpio_keys_platform_data.nbuttons = ARRAY_SIZE(gpio_keys_button); } + #if defined(CONFIG_SENSORS_CM36651) if (system_rev < BOARD_REV06) cm36651_pdata.irq = gpio_rev(ALS_INT); @@ -5076,7 +5110,7 @@ static struct pm_gpio ear_micbiase = { .output_value = 0, }; -static int secjack_gpio_init() +static int secjack_gpio_init(void) { int rc; @@ -5117,19 +5151,19 @@ static int secjack_gpio_init() } #endif -void main_mic_bias_init() +void main_mic_bias_init(void) { int ret; ret = gpio_request(GPIO_MAIN_MIC_BIAS, "LDO_BIAS"); if (ret) { pr_err("%s: ldo bias gpio %d request" "failed\n", __func__, GPIO_MAIN_MIC_BIAS); - return ret; + return; } gpio_direction_output(GPIO_MAIN_MIC_BIAS, 0); } -static int configure_codec_lineout_gpio() +static int configure_codec_lineout_gpio(void) { int ret; struct pm_gpio param = { @@ -5155,7 +5189,7 @@ static int configure_codec_lineout_gpio( return 0; } -static int tabla_codec_ldo_en_init() +static int tabla_codec_ldo_en_init(void) { int ret; @@ -5166,8 +5200,9 @@ static int tabla_codec_ldo_en_init() "failed\n", __func__, PM8921_GPIO_PM_TO_SYS(gpio_rev(LINEOUT_EN))); return ret; - } - gpio_direction_output(PM8921_GPIO_PM_TO_SYS(gpio_rev(LINEOUT_EN)), 0); + } else + gpio_direction_output(PM8921_GPIO_PM_TO_SYS( + gpio_rev(LINEOUT_EN)), 0); return 0; } @@ -5191,8 +5226,8 @@ static void __init samsung_m2_spr_init(v regulator_suppress_info_printing(); if (msm_xo_init()) pr_err("Failed to initialize XO votes\n"); - platform_device_register(&msm8960_device_rpm_regulator); - msm_clock_init(&msm8960_clock_init_data); + platform_device_register(&msm8960_device_rpm_regulator); + msm_clock_init(&msm8960_clock_init_data); if (machine_is_msm8960_liquid()) msm_otg_pdata.mhl_enable = true; msm8960_device_otg.dev.platform_data = &msm_otg_pdata; @@ -5313,9 +5348,10 @@ static void __init samsung_m2_spr_init(v if (PLATFORM_IS_CHARM25()) platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices)); + msm_pm_set_tz_retention_flag(1); } -MACHINE_START(M2_SPR, "AnThRaXed SAMSUNG M2_SPR") +MACHINE_START(M2_SPR, "SAMSUNG M2_SPR") .map_io = msm8960_map_io, .reserve = msm8960_reserve, .init_irq = msm8960_init_irq, --- a/arch/arm/mach-msm/board-m2_vzw-gpiomux.c +++ b/arch/arm/mach-msm/board-m2_vzw-gpiomux.c @@ -103,21 +103,6 @@ static struct gpiomux_setting cdc_mclk = .pull = GPIOMUX_PULL_NONE, }; -static struct gpiomux_setting audio_auxpcm[] = { - /* Suspended state */ - { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_2MA, - .pull = GPIOMUX_PULL_DOWN, - }, - /* Active state */ - { - .func = GPIOMUX_FUNC_1, - .drv = GPIOMUX_DRV_2MA, - .pull = GPIOMUX_PULL_NONE, - }, -}; - #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) static struct gpiomux_setting gpio_eth_config = { .pull = GPIOMUX_PULL_NONE, @@ -126,12 +111,6 @@ static struct gpiomux_setting gpio_eth_c }; #endif -static struct gpiomux_setting slimbus = { - .func = GPIOMUX_FUNC_1, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_KEEPER, -}; - static struct gpiomux_setting gpio_key_active_cfg = { .func = GPIOMUX_FUNC_GPIO, .drv = GPIOMUX_DRV_8MA, @@ -271,12 +250,6 @@ static struct gpiomux_setting hdmi_activ .dir = GPIOMUX_IN, }; -static struct gpiomux_setting hdmi_active_4_cfg = { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_2MA, - .pull = GPIOMUX_PULL_UP, - .dir = GPIOMUX_OUT_HIGH, -}; #endif #if defined(CONFIG_VIDEO_MHL_V1) || defined(CONFIG_VIDEO_MHL_V2) static struct gpiomux_setting mhl_suspend_cfg = { @@ -292,12 +265,6 @@ static struct gpiomux_setting mhl_active .dir = GPIOMUX_OUT_LOW, }; -static struct gpiomux_setting mhl_active_2_cfg = { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_2MA, - .pull = GPIOMUX_PULL_NONE, -}; - #endif #ifdef CONFIG_USB_SWITCH_FSA9485 @@ -553,21 +520,6 @@ static struct msm_gpiomux_config msm8960 }, }; -static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = { - { - .gpio = 60, /* slimbus data */ - .settings = { - [GPIOMUX_SUSPENDED] = &slimbus, - }, - }, - { - .gpio = 61, /* slimbus clk */ - .settings = { - [GPIOMUX_SUSPENDED] = &slimbus, - }, - }, -}; - static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = { { .gpio = 59, @@ -644,12 +596,6 @@ static struct gpiomux_setting cdc_i2s_tx .pull = GPIOMUX_PULL_NONE, }; -static struct gpiomux_setting cdc_i2s_tx_d1 = { - .func = GPIOMUX_FUNC_1, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_NONE, -}; - static struct gpiomux_setting cdc_i2s_tx_ws = { .func = GPIOMUX_FUNC_1, .drv = GPIOMUX_DRV_8MA, @@ -685,37 +631,6 @@ static struct msm_gpiomux_config msm8960 }; -static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = { - { - .gpio = 63, - .settings = { - [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], - [GPIOMUX_ACTIVE] = &audio_auxpcm[1], - }, - }, - { - .gpio = 64, - .settings = { - [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], - [GPIOMUX_ACTIVE] = &audio_auxpcm[1], - }, - }, - { - .gpio = 65, - .settings = { - [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], - [GPIOMUX_ACTIVE] = &audio_auxpcm[1], - }, - }, - { - .gpio = 66, - .settings = { - [GPIOMUX_SUSPENDED] = &audio_auxpcm[0], - [GPIOMUX_ACTIVE] = &audio_auxpcm[1], - }, - }, -}; - static struct msm_gpiomux_config wcnss_5wire_interface[] = { { .gpio = 84, --- a/arch/arm/mach-msm/board-m2_vzw.c +++ b/arch/arm/mach-msm/board-m2_vzw.c @@ -318,28 +318,6 @@ struct sx150x_platform_data msm8960_sx15 #endif -static struct gpiomux_setting sec_ts_ldo_act_cfg = { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_UP, -}; - -static struct gpiomux_setting sec_ts_ldo_sus_cfg = { - .func = GPIOMUX_FUNC_GPIO, - .drv = GPIOMUX_DRV_8MA, - .pull = GPIOMUX_PULL_DOWN, -}; - -static struct msm_gpiomux_config msm8960_sec_ts_configs[] = { - { /* TS LDO EN */ - .gpio = 10, - .settings = { - [GPIOMUX_ACTIVE] = &sec_ts_ldo_act_cfg, - [GPIOMUX_SUSPENDED] = &sec_ts_ldo_sus_cfg, - }, - }, -}; - #define MSM_PMEM_ADSP_SIZE 0x9600000 /* 150 Mbytes */ #define MSM_PMEM_ADSP_SIZE_FOR_2GB 0xA500000 /* 165 Mbytes */ #define MSM_PMEM_AUDIO_SIZE 0x160000 /* 1.375 Mbytes */ @@ -812,7 +790,7 @@ static void __init reserve_ion_memory(vo if (!strcmp(heap->name, "mm") && (mb->start >= 0xc0000000)) { printk(KERN_ERR "heap->name %s, mb->start %lx\n", - heap->name, mb->start); + heap->name, (unsigned long)mb->start); heap->size = MSM_PMEM_ADSP_SIZE_FOR_2GB; } @@ -1595,7 +1573,7 @@ int msm8960_get_cable_type(void) } if (i == 10) { pr_err("%s: fail to get battery ps\n", __func__); - return; + return ret; } #endif @@ -1986,12 +1964,14 @@ void max17040_hw_init(void) static int max17040_low_batt_cb(void) { - pr_err("%s: Low battery alert\n", __func__); - #ifdef CONFIG_BATTERY_SEC struct power_supply *psy = power_supply_get_by_name("battery"); union power_supply_propval value; +#endif + + pr_err("%s: Low battery alert\n", __func__); +#ifdef CONFIG_BATTERY_SEC if (!psy) { pr_err("%s: fail to get battery ps\n", __func__); return -ENODEV; @@ -2109,7 +2089,9 @@ static struct i2c_board_info opt_i2c_bor #endif }; +#if defined(CONFIG_OPTICAL_GP2A) || defined(CONFIG_OPTICAL_GP2AP020A00F) static void gp2a_led_onoff(int); +#endif #if defined(CONFIG_OPTICAL_GP2A) static struct opt_gp2a_platform_data opt_gp2a_data = { @@ -2725,11 +2707,6 @@ static struct i2c_gpio_platform_data a2 .udelay = 1, }; -static struct platform_device a2220_i2c_gpio_device = { - .name = "i2c-gpio", - .id = MSM_A2220_I2C_BUS_ID, - .dev.platform_data = &a2220_i2c_gpio_data, -}; #endif #ifdef CONFIG_WCD9310_CODEC @@ -2829,7 +2806,6 @@ static struct slim_device msm_slim_tabla .platform_data = &tabla_platform_data, }, }; -static u8 tabla20_e_addr[6] = {0, 0, 0x60, 0, 0x17, 2}; static struct tabla_pdata tabla20_platform_data = { .slimbus_slave_device = { @@ -3230,9 +3206,6 @@ static struct msm_spi_platform_data msm8 .max_clock_speed = 48000000, /*15060000,*/ }; #endif -static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = { - .max_clock_speed = 15060000, -}; #ifdef CONFIG_USB_MSM_OTG_72K static struct msm_otg_platform_data msm_otg_pdata; @@ -3515,24 +3488,52 @@ static struct platform_device android_us }; static uint8_t spm_wfi_cmd_sequence[] __initdata = { - 0x03, 0x0f, + 0x03, 0x0f, +}; + +static uint8_t spm_retention_cmd_sequence[] __initdata = { + 0x00, 0x05, 0x03, 0x0D, + 0x0B, 0x00, 0x0f, }; static uint8_t spm_power_collapse_without_rpm[] __initdata = { - 0x00, 0x24, 0x54, 0x10, - 0x09, 0x03, 0x01, - 0x10, 0x54, 0x30, 0x0C, - 0x24, 0x30, 0x0f, + 0x00, 0x24, 0x54, 0x10, + 0x09, 0x03, 0x01, + 0x10, 0x54, 0x30, 0x0C, + 0x24, 0x30, 0x0f, }; static uint8_t spm_power_collapse_with_rpm[] __initdata = { - 0x00, 0x24, 0x54, 0x10, - 0x09, 0x07, 0x01, 0x0B, - 0x10, 0x54, 0x30, 0x0C, - 0x24, 0x30, 0x0f, + 0x00, 0x24, 0x54, 0x10, + 0x09, 0x07, 0x01, 0x0B, + 0x10, 0x54, 0x30, 0x0C, + 0x24, 0x30, 0x0f, +}; + +static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = { + [0] = { + .mode = MSM_SPM_MODE_CLOCK_GATING, + .notify_rpm = false, + .cmd = spm_wfi_cmd_sequence, + }, + [1] = { + .mode = MSM_SPM_MODE_POWER_RETENTION, + .notify_rpm = false, + .cmd = spm_retention_cmd_sequence, + }, + [2] = { + .mode = MSM_SPM_MODE_POWER_COLLAPSE, + .notify_rpm = false, + .cmd = spm_power_collapse_without_rpm, + }, + [3] = { + .mode = MSM_SPM_MODE_POWER_COLLAPSE, + .notify_rpm = true, + .cmd = spm_power_collapse_with_rpm, + }, }; -static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = { +static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = { [0] = { .mode = MSM_SPM_MODE_CLOCK_GATING, .notify_rpm = false, @@ -3559,12 +3560,12 @@ static struct msm_spm_platform_data msm_ .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, #endif .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, - .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204, - .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, - .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, + .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004, + .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C, + .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C, .vctl_timeout_us = 50, - .num_modes = ARRAY_SIZE(msm_spm_seq_list), - .modes = msm_spm_seq_list, + .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list), + .modes = msm_spm_boot_cpu_seq_list, }, [1] = { .reg_base_addr = MSM_SAW1_BASE, @@ -3578,8 +3579,8 @@ static struct msm_spm_platform_data msm_ .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, .vctl_timeout_us = 50, - .num_modes = ARRAY_SIZE(msm_spm_seq_list), - .modes = msm_spm_seq_list, + .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list), + .modes = msm_spm_nonboot_cpu_seq_list, }, }; @@ -3883,12 +3884,13 @@ static void mxt_init_hw_liquid(void) #endif return; -err_reset_gpio_req: #if !defined(CONFIG_WIRELESS_CHARGING) +err_reset_gpio_req: gpio_free(GPIO_MXT_TS_RESET); -#endif err_ldo_gpio_set_dir: gpio_set_value(GPIO_MXT_TS_LDO_EN, 0); +#endif + err_ldo_gpio_req: gpio_free(GPIO_MXT_TS_LDO_EN); err_irq_gpio_req: @@ -3897,7 +3899,7 @@ err_irq_gpio_req: static struct mxt_platform_data mxt_platform_data = { .config = mxt_config_data, - .config_length = ARRAY_SIZE(mxt_config_data), + .config_length = ARRAY_SIZE(mxt_config_data), .x_line = 26, .y_line = 42, .x_size = 767, @@ -4079,14 +4081,6 @@ static struct platform_device msm8960_de }, }; -static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = { - .name = GPIO_REGULATOR_DEV_NAME, - .id = 91, - .dev = { - .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2], - }, -}; - static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = { .name = GPIO_REGULATOR_DEV_NAME, .id = PM8921_GPIO_PM_TO_SYS(17), @@ -4406,7 +4400,6 @@ static struct platform_device *common_de &msm_cache_dump_device, #endif &msm8960_cpu_idle_device, - &msm8960_msm_gov_device, }; static struct platform_device *m2_vzw_devices[] __initdata = { @@ -4544,18 +4537,31 @@ static struct msm_cpuidle_state msm_csta {0, 0, "C0", "WFI", MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, - {0, 1, "C2", "POWER_COLLAPSE", + {0, 1, "C1", "RETENTION", + MSM_PM_SLEEP_MODE_RETENTION}, + + {0, 2, "C2", "POWER_COLLAPSE", MSM_PM_SLEEP_MODE_POWER_COLLAPSE}, {1, 0, "C0", "WFI", MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, + + {1, 1, "C1", "RETENTION", + MSM_PM_SLEEP_MODE_RETENTION}, }; static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = { [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { .idle_supported = 1, .suspend_supported = 1, - .idle_enabled = 0, + .idle_enabled = 1, + .suspend_enabled = 1, + }, + + [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_RETENTION)] = { + .idle_supported = 1, + .suspend_supported = 0, + .idle_enabled = 1, .suspend_enabled = 0, }, @@ -4570,7 +4576,14 @@ static struct msm_pm_platform_data msm_p .idle_supported = 0, .suspend_supported = 1, .idle_enabled = 0, - .suspend_enabled = 0, + .suspend_enabled = 1, + }, + + [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_RETENTION)] = { + .idle_supported = 1, + .suspend_supported = 1, + .idle_enabled = 1, + .suspend_enabled = 1, }, [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { @@ -4586,55 +4599,56 @@ static struct msm_rpmrs_level msm_rpmrs_ MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT, MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), true, - 100, 650, 801, 200, + 1, 550, 180000, 100, }, { - MSM_PM_SLEEP_MODE_POWER_COLLAPSE, - MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE), - false, - 8500, 51, 1122000, 8500, + MSM_PM_SLEEP_MODE_RETENTION, + MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), + true, + 415, 450, 340827, 475, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, - MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE), + MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE), false, - 9000, 51, 1130300, 9000, + 2000, 138, 1208400, 3200, }, + { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH), false, - 10000, 51, 1130300, 10000, + 6000, 119, 1850300, 9000, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE), false, - 12000, 14, 2205900, 12000, + 9200, 68, 2839200, 16400, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE), false, - 18000, 12, 2364250, 18000, + 10300, 63, 3128000, 18200, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH), false, - 23500, 10, 2667000, 23500, + 18000, 10, 4602600, 27000, }, { MSM_PM_SLEEP_MODE_POWER_COLLAPSE, MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW), false, - 29700, 5, 2867000, 30000, + 20000, 2, 5752000, 32000, }, }; @@ -5124,7 +5138,7 @@ static struct pm_gpio ear_micbiase = { .output_value = 0, }; -static int secjack_gpio_init() +static int secjack_gpio_init(void) { int rc; @@ -5165,19 +5179,19 @@ static int secjack_gpio_init() } #endif -void main_mic_bias_init() +void main_mic_bias_init(void) { int ret; ret = gpio_request(GPIO_MAIN_MIC_BIAS, "LDO_BIAS"); if (ret) { pr_err("%s: ldo bias gpio %d request" "failed\n", __func__, GPIO_MAIN_MIC_BIAS); - return ret; + return; } gpio_direction_output(GPIO_MAIN_MIC_BIAS, 0); } -static int configure_codec_lineout_gpio() +static int configure_codec_lineout_gpio(void) { int ret; struct pm_gpio param = { @@ -5203,7 +5217,7 @@ static int configure_codec_lineout_gpio( return 0; } -static int tabla_codec_ldo_en_init() +static int tabla_codec_ldo_en_init(void) { int ret; @@ -5240,8 +5254,8 @@ static void __init samsung_m2_vzw_init(v regulator_suppress_info_printing(); if (msm_xo_init()) pr_err("Failed to initialize XO votes\n"); - platform_device_register(&msm8960_device_rpm_regulator); - msm_clock_init(&msm8960_clock_init_data); + platform_device_register(&msm8960_device_rpm_regulator); + msm_clock_init(&msm8960_clock_init_data); if (machine_is_msm8960_liquid()) msm_otg_pdata.mhl_enable = true; msm8960_device_otg.dev.platform_data = &msm_otg_pdata; @@ -5361,6 +5375,7 @@ static void __init samsung_m2_vzw_init(v if (PLATFORM_IS_CHARM25()) platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices)); + msm_pm_set_tz_retention_flag(1); } MACHINE_START(M2_VZW, "SAMSUNG M2_VZW") --- a/arch/arm/mach-msm/pm-8x60.c +++ b/arch/arm/mach-msm/pm-8x60.c @@ -26,10 +26,11 @@ #include #include #include -#include #include #include #include +#include +#include #include #include #include @@ -72,11 +73,11 @@ enum { MSM_PM_DEBUG_HOTPLUG = BIT(8), }; -static int msm_pm_debug_mask = 1; +static int msm_pm_debug_mask = 319; module_param_named( debug_mask, msm_pm_debug_mask, int, S_IRUGO | S_IWUSR | S_IWGRP ); - +static int msm_pm_retention_tz_call; /****************************************************************************** * Sleep Modes and Parameters @@ -104,6 +105,9 @@ enum { MSM_PM_MODE_ATTR_NR, }; +#define SCM_L2_RETENTION (0x2) +#define SCM_CMD_TERMINATE_PC (0x2) + static char *msm_pm_mode_attr_labels[MSM_PM_MODE_ATTR_NR] = { [MSM_PM_MODE_ATTR_SUSPEND] = "suspend_enabled", [MSM_PM_MODE_ATTR_IDLE] = "idle_enabled", @@ -127,6 +131,7 @@ struct msm_pm_sysfs_sleep_mode { static char *msm_pm_sleep_mode_labels[MSM_PM_SLEEP_MODE_NR] = { [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = "power_collapse", [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = "wfi", + [MSM_PM_SLEEP_MODE_RETENTION] = "retention", [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE] = "standalone_power_collapse", }; @@ -349,8 +354,9 @@ mode_sysfs_add_exit: #ifdef CONFIG_MSM_IDLE_STATS enum msm_pm_time_stats_id { - MSM_PM_STAT_REQUESTED_IDLE, + MSM_PM_STAT_REQUESTED_IDLE = 0, MSM_PM_STAT_IDLE_WFI, + MSM_PM_STAT_RETENTION, MSM_PM_STAT_IDLE_STANDALONE_POWER_COLLAPSE, MSM_PM_STAT_IDLE_POWER_COLLAPSE, MSM_PM_STAT_SUSPEND, @@ -584,6 +590,22 @@ static void msm_pm_config_hw_before_swfi return; } +/* + * Configure/Restore hardware registers in preparation for Retention. + */ + +static void msm_pm_config_hw_after_retention(void) +{ + int ret; + ret = msm_spm_set_low_power_mode(MSM_SPM_MODE_CLOCK_GATING, false); + WARN_ON(ret); +} + +static void msm_pm_config_hw_before_retention(void) +{ + return; +} + /****************************************************************************** * Suspend Max Sleep Time @@ -645,6 +667,23 @@ static void msm_pm_swfi(void) msm_arch_idle(); } +static void msm_pm_retention(void) +{ + int ret = 0; + + msm_pm_config_hw_before_retention(); + ret = msm_spm_set_low_power_mode(MSM_SPM_MODE_POWER_RETENTION, false); + WARN_ON(ret); + + if (msm_pm_retention_tz_call) + scm_call_atomic1(SCM_SVC_BOOT, SCM_CMD_TERMINATE_PC, + SCM_L2_RETENTION); + else + msm_arch_idle(); + + msm_pm_config_hw_after_retention(); +} + #ifdef CONFIG_CACHE_L2X0 static inline bool msm_pm_l2x0_power_collapse(void) { @@ -763,12 +802,28 @@ static bool msm_pm_power_collapse(bool f collapsed = msm_pm_spm_power_collapse(cpu, from_idle, true); - if (MSM_PM_DEBUG_CLOCK & msm_pm_debug_mask) - pr_info("CPU%u: %s: restore clock rate to %lu\n", - cpu, __func__, saved_acpuclk_rate); - if (acpuclk_set_rate(cpu, saved_acpuclk_rate, SETRATE_PC) < 0) - pr_err("CPU%u: %s: failed to restore clock rate(%lu)\n", - cpu, __func__, saved_acpuclk_rate); + if (cpu_online(cpu)) { + if (MSM_PM_DEBUG_CLOCK & msm_pm_debug_mask) + pr_info("CPU%u: %s: restore clock rate to %lu\n", + cpu, __func__, saved_acpuclk_rate); + if (acpuclk_set_rate(cpu, saved_acpuclk_rate, SETRATE_PC) < 0) + pr_err("CPU%u: %s: failed to restore clock rate(%lu)\n", + cpu, __func__, saved_acpuclk_rate); + } else { + unsigned int gic_dist_enabled; + unsigned int gic_dist_pending; + gic_dist_enabled = readl_relaxed( + MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_CLEAR); + gic_dist_pending = readl_relaxed( + MSM_QGIC_DIST_BASE + GIC_DIST_PENDING_SET); + mb(); + gic_dist_pending &= gic_dist_enabled; + + if (gic_dist_pending) + pr_err("CPU %d interrupted during hotplug.Pending int 0x%x\n", + cpu, gic_dist_pending); + } + avs_reset_delays(avsdscr_setting); msm_pm_config_hw_after_power_up(); @@ -823,19 +878,21 @@ int msm_pm_idle_prepare(struct cpuidle_d switch (mode) { case MSM_PM_SLEEP_MODE_POWER_COLLAPSE: - if (!allow) - break; - if (num_online_cpus() > 1) { allow = false; break; } -#ifdef CONFIG_HAS_WAKELOCK - if (has_wake_lock(WAKE_LOCK_IDLE)) { + /* fall through */ + + case MSM_PM_SLEEP_MODE_RETENTION: + if (!allow) + break; + + if (msm_pm_retention_tz_call && + num_online_cpus() > 1) { allow = false; break; } -#endif /* fall through */ case MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE: @@ -923,6 +980,13 @@ int msm_pm_idle_enter(enum msm_pm_sleep_ #endif break; + case MSM_PM_SLEEP_MODE_RETENTION: + msm_pm_retention(); +#ifdef CONFIG_MSM_IDLE_STATS + exit_stat = MSM_PM_STAT_RETENTION; +#endif + break; + case MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE: msm_pm_power_collapse_standalone(true); #ifdef CONFIG_MSM_IDLE_STATS @@ -971,6 +1035,7 @@ int msm_pm_idle_enter(enum msm_pm_sleep_ time = ktime_to_ns(ktime_get()) - time; #ifdef CONFIG_MSM_IDLE_STATS + msm_pm_add_stat(MSM_PM_STAT_REQUESTED_IDLE, time); msm_pm_add_stat(exit_stat, time); #endif @@ -1021,9 +1086,13 @@ void msm_pm_cpu_enter_lowpower(unsigned per_cpu(msm_pm_last_slp_mode, cpu) = MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE; msm_pm_power_collapse_standalone(false); + } else if (allow[MSM_PM_SLEEP_MODE_RETENTION]) { + per_cpu(msm_pm_last_slp_mode, cpu) + = MSM_PM_SLEEP_MODE_RETENTION; + msm_pm_retention(); } else if (allow[MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT]) { per_cpu(msm_pm_last_slp_mode, cpu) - = MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE; + = MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT; msm_pm_swfi(); } else per_cpu(msm_pm_last_slp_mode, cpu) = MSM_PM_SLEEP_MODE_NR; @@ -1112,10 +1181,11 @@ static int msm_pm_enter(suspend_state_t if ((MSM_PM_DEBUG_SUSPEND & msm_pm_debug_mask) && rs_limits) pr_info("%s: limit %p: pxo %d, l2_cache %d, " - "vdd_mem %d, vdd_dig %d\n", + "vdd_mem %d, vdd_dig %d, power %d\n", __func__, rs_limits, rs_limits->pxo, rs_limits->l2_cache, - rs_limits->vdd_mem, rs_limits->vdd_dig); + rs_limits->vdd_mem, rs_limits->vdd_dig, + rs_limits->power[smp_processor_id()]); if (rs_limits) { ret = msm_rpmrs_enter_sleep( @@ -1147,6 +1217,10 @@ static int msm_pm_enter(suspend_state_t if (MSM_PM_DEBUG_SUSPEND & msm_pm_debug_mask) pr_info("%s: standalone power collapse\n", __func__); msm_pm_power_collapse_standalone(false); + } else if (allow[MSM_PM_SLEEP_MODE_RETENTION]) { + if (MSM_PM_DEBUG_SUSPEND & msm_pm_debug_mask) + pr_info("%s: retention\n", __func__); + msm_pm_retention(); } else if (allow[MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT]) { if (MSM_PM_DEBUG_SUSPEND & msm_pm_debug_mask) pr_info("%s: swfi\n", __func__); @@ -1169,12 +1243,42 @@ static struct platform_suspend_ops msm_p /****************************************************************************** * Initialization routine *****************************************************************************/ +/* + * For speeding up boot time: + * During booting up, disable entering arch_idle() by disable_hlt() + * Enable it after booting up BOOT_LOCK_TIMEOUT sec. +*/ + +#define BOOT_LOCK_TIMEOUT_NORMAL (60 * HZ) + +static void do_expire_boot_lock(struct work_struct *work) +{ + enable_hlt(); + pr_info("Release 'boot-time' no_halt_lock\n"); +} +static DECLARE_DELAYED_WORK(work_expire_boot_lock, do_expire_boot_lock); + +static void __init boot_lock_nohalt(void) +{ + int nohalt_timeout; + + nohalt_timeout = BOOT_LOCK_TIMEOUT_NORMAL; + + disable_hlt(); + schedule_delayed_work(&work_expire_boot_lock, nohalt_timeout); + pr_info("Acquire 'boot-time' no_halt_lock %ds\n", nohalt_timeout / HZ); +} void __init msm_pm_init_sleep_status_data( struct msm_pm_sleep_status_data *data) { msm_pm_slp_sts = data; } +void __init msm_pm_set_tz_retention_flag(unsigned int flag) +{ + msm_pm_retention_tz_call = flag; +} + static int __init msm_pm_init(void) { pgd_t *pc_pgd; @@ -1238,6 +1342,10 @@ static int __init msm_pm_init(void) stats[MSM_PM_STAT_IDLE_WFI].first_bucket_time = CONFIG_MSM_IDLE_STATS_FIRST_BUCKET; + stats[MSM_PM_STAT_RETENTION].name = "retention"; + stats[MSM_PM_STAT_RETENTION].first_bucket_time = + CONFIG_MSM_IDLE_STATS_FIRST_BUCKET; + stats[MSM_PM_STAT_IDLE_STANDALONE_POWER_COLLAPSE].name = "idle-standalone-power-collapse"; stats[MSM_PM_STAT_IDLE_STANDALONE_POWER_COLLAPSE]. @@ -1266,6 +1374,7 @@ static int __init msm_pm_init(void) msm_spm_allow_x_cpu_set_vdd(false); suspend_set_ops(&msm_pm_ops); + boot_lock_nohalt(); msm_cpuidle_init(); return 0; --- a/arch/arm/mach-msm/pm.h +++ b/arch/arm/mach-msm/pm.h @@ -28,14 +28,16 @@ extern void msm_secondary_startup(void); #endif enum msm_pm_sleep_mode { - MSM_PM_SLEEP_MODE_POWER_COLLAPSE_SUSPEND, - MSM_PM_SLEEP_MODE_POWER_COLLAPSE, - MSM_PM_SLEEP_MODE_APPS_SLEEP, - MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT, - MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT, - MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN, - MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE, - MSM_PM_SLEEP_MODE_NR + MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT = 0, + MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT = 1, + MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE = 2, + MSM_PM_SLEEP_MODE_POWER_COLLAPSE = 3, + MSM_PM_SLEEP_MODE_APPS_SLEEP = 4, + MSM_PM_SLEEP_MODE_RETENTION = MSM_PM_SLEEP_MODE_APPS_SLEEP, + MSM_PM_SLEEP_MODE_POWER_COLLAPSE_SUSPEND = 5, + MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN = 6, + MSM_PM_SLEEP_MODE_NR = 7, + MSM_PM_SLEEP_MODE_NOT_SELECTED, }; #define MSM_PM_MODE(cpu, mode_nr) ((cpu) * MSM_PM_SLEEP_MODE_NR + (mode_nr)) @@ -61,6 +63,7 @@ void msm_pm_set_platform_data(struct msm int msm_pm_idle_prepare(struct cpuidle_device *dev); int msm_pm_idle_enter(enum msm_pm_sleep_mode sleep_mode); void msm_pm_cpu_enter_lowpower(unsigned int cpu); +void __init msm_pm_set_tz_retention_flag(unsigned int flag); void __init msm_pm_init_sleep_status_data( struct msm_pm_sleep_status_data *sleep_data); --- a/arch/arm/mach-msm/rpm-regulator.c +++ b/arch/arm/mach-msm/rpm-regulator.c @@ -1300,6 +1300,9 @@ rpm_vreg_init_regulator(const struct rpm mutex_unlock(&vreg->pc_lock); + if (rc) + goto bail; + rdev = regulator_register(rdesc, dev, &(pdata->init_data), vreg); if (IS_ERR(rdev)) { rc = PTR_ERR(rdev); --- a/arch/arm/mach-msm/spm-v2.c +++ b/arch/arm/mach-msm/spm-v2.c @@ -71,6 +71,10 @@ static inline void msm_spm_drv_set_vctl( dev->reg_shadow[MSM_SPM_REG_SAW2_PMIC_DATA_1] &= ~0x3F; dev->reg_shadow[MSM_SPM_REG_SAW2_PMIC_DATA_1] |= (vlevel & 0x3F); + + dev->reg_shadow[MSM_SPM_REG_SAW2_PMIC_DATA_1] &= ~0x3F0000; + dev->reg_shadow[MSM_SPM_REG_SAW2_PMIC_DATA_1] |= + ((vlevel & 0x3F) << 16); } static void msm_spm_drv_flush_shadow(struct msm_spm_driver_data *dev,