Implement retention sleep mode
/arch/arm/mach-msm/board-m2_vzw.c
blob:6879c73bdad14639e06443d0f403669b574b37f0 -> blob:356ab38e2d8f5c9c209c21feac1166f94b719eaa
--- arch/arm/mach-msm/board-m2_vzw.c
+++ 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")