diff options
author | Arve Hjønnevåg <arve@android.com> | 2009-06-16 17:48:21 -0400 |
---|---|---|
committer | Daniel Walker <dwalker@codeaurora.org> | 2010-05-12 12:15:07 -0400 |
commit | ec9d3d14ffa9454e6d51e5dd1889d6e9e0be5198 (patch) | |
tree | db2b3bde28805d86ce618e3c04e0bbf7abb0119d /arch/arm | |
parent | 283794100d2b1c1645b2949273aa4be29929812d (diff) |
[ARM] msm: Add 8k power collapse support to smd
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Daniel Walker <dwalker@codeaurora.org>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-msm/smd.c | 57 | ||||
-rw-r--r-- | arch/arm/mach-msm/smd_private.h | 24 |
2 files changed, 57 insertions, 24 deletions
diff --git a/arch/arm/mach-msm/smd.c b/arch/arm/mach-msm/smd.c index e33fd029fa37..b5f8957725de 100644 --- a/arch/arm/mach-msm/smd.c +++ b/arch/arm/mach-msm/smd.c | |||
@@ -1038,39 +1038,43 @@ uint32_t smsm_get_state(enum smsm_state_item item) | |||
1038 | return rv; | 1038 | return rv; |
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | #ifdef CONFIG_ARCH_MSM_SCORPION | ||
1042 | |||
1041 | int smsm_set_sleep_duration(uint32_t delay) | 1043 | int smsm_set_sleep_duration(uint32_t delay) |
1042 | { | 1044 | { |
1043 | uint32_t *ptr; | 1045 | struct msm_dem_slave_data *ptr = smem_alloc(SMEM_APPS_DEM_SLAVE_DATA, |
1044 | 1046 | sizeof(*ptr)); | |
1045 | ptr = smem_alloc(SMEM_SMSM_SLEEP_DELAY, sizeof(*ptr)); | ||
1046 | if (ptr == NULL) { | 1047 | if (ptr == NULL) { |
1047 | pr_err("smsm_set_sleep_duration <SM NO SLEEP_DELAY>\n"); | 1048 | pr_err("smsm_set_sleep_duration <SM NO APPS_DEM_SLAVE_DATA>\n"); |
1048 | return -EIO; | 1049 | return -EIO; |
1049 | } | 1050 | } |
1050 | if (msm_smd_debug_mask & MSM_SMSM_DEBUG) | 1051 | if (msm_smd_debug_mask & MSM_SMSM_DEBUG) |
1051 | pr_info("smsm_set_sleep_duration %d -> %d\n", | 1052 | pr_info("smsm_set_sleep_duration %d -> %d\n", |
1052 | *ptr, delay); | 1053 | ptr->sleep_time, delay); |
1053 | *ptr = delay; | 1054 | ptr->sleep_time = delay; |
1054 | return 0; | 1055 | return 0; |
1055 | } | 1056 | } |
1056 | 1057 | ||
1057 | int smsm_set_interrupt_info(struct smsm_interrupt_info *info) | 1058 | #else |
1059 | |||
1060 | int smsm_set_sleep_duration(uint32_t delay) | ||
1058 | { | 1061 | { |
1059 | struct smsm_interrupt_info *ptr; | 1062 | uint32_t *ptr; |
1060 | 1063 | ||
1061 | ptr = smem_alloc(SMEM_SMSM_INT_INFO, sizeof(*ptr)); | 1064 | ptr = smem_alloc(SMEM_SMSM_SLEEP_DELAY, sizeof(*ptr)); |
1062 | if (ptr == NULL) { | 1065 | if (ptr == NULL) { |
1063 | pr_err("smsm_set_sleep_duration <SM NO INT_INFO>\n"); | 1066 | pr_err("smsm_set_sleep_duration <SM NO SLEEP_DELAY>\n"); |
1064 | return -EIO; | 1067 | return -EIO; |
1065 | } | 1068 | } |
1066 | if (msm_smd_debug_mask & MSM_SMSM_DEBUG) | 1069 | if (msm_smd_debug_mask & MSM_SMSM_DEBUG) |
1067 | pr_info("smsm_set_interrupt_info %x %x -> %x %x\n", | 1070 | pr_info("smsm_set_sleep_duration %d -> %d\n", |
1068 | ptr->aArm_en_mask, ptr->aArm_interrupts_pending, | 1071 | *ptr, delay); |
1069 | info->aArm_en_mask, info->aArm_interrupts_pending); | 1072 | *ptr = delay; |
1070 | *ptr = *info; | ||
1071 | return 0; | 1073 | return 0; |
1072 | } | 1074 | } |
1073 | 1075 | ||
1076 | #endif | ||
1077 | |||
1074 | #define MAX_NUM_SLEEP_CLIENTS 64 | 1078 | #define MAX_NUM_SLEEP_CLIENTS 64 |
1075 | #define MAX_SLEEP_NAME_LEN 8 | 1079 | #define MAX_SLEEP_NAME_LEN 8 |
1076 | 1080 | ||
@@ -1115,12 +1119,13 @@ void smsm_print_sleep_info(void) | |||
1115 | if (ptr) | 1119 | if (ptr) |
1116 | pr_info("SMEM_SLEEP_POWER_COLLAPSE_DISABLED: %x\n", *ptr); | 1120 | pr_info("SMEM_SLEEP_POWER_COLLAPSE_DISABLED: %x\n", *ptr); |
1117 | 1121 | ||
1122 | #ifndef CONFIG_ARCH_MSM_SCORPION | ||
1118 | int_info = smem_alloc(SMEM_SMSM_INT_INFO, sizeof(*int_info)); | 1123 | int_info = smem_alloc(SMEM_SMSM_INT_INFO, sizeof(*int_info)); |
1119 | if (int_info) | 1124 | if (int_info) |
1120 | pr_info("SMEM_SMSM_INT_INFO %x %x %x\n", | 1125 | pr_info("SMEM_SMSM_INT_INFO %x %x %x\n", |
1121 | int_info->aArm_en_mask, | 1126 | int_info->interrupt_mask, |
1122 | int_info->aArm_interrupts_pending, | 1127 | int_info->pending_interrupts, |
1123 | int_info->aArm_wakeup_reason); | 1128 | int_info->wakeup_reason); |
1124 | 1129 | ||
1125 | gpio = smem_alloc(SMEM_GPIO_INT, sizeof(*gpio)); | 1130 | gpio = smem_alloc(SMEM_GPIO_INT, sizeof(*gpio)); |
1126 | if (gpio) { | 1131 | if (gpio) { |
@@ -1135,7 +1140,8 @@ void smsm_print_sleep_info(void) | |||
1135 | i, gpio->num_fired[i], gpio->fired[i][0], | 1140 | i, gpio->num_fired[i], gpio->fired[i][0], |
1136 | gpio->fired[i][1]); | 1141 | gpio->fired[i][1]); |
1137 | } | 1142 | } |
1138 | 1143 | #else | |
1144 | #endif | ||
1139 | spin_unlock_irqrestore(&smem_lock, flags); | 1145 | spin_unlock_irqrestore(&smem_lock, flags); |
1140 | } | 1146 | } |
1141 | 1147 | ||
@@ -1180,7 +1186,10 @@ int smd_core_init(void) | |||
1180 | 1186 | ||
1181 | /* indicate that we're up and running */ | 1187 | /* indicate that we're up and running */ |
1182 | smsm_change_state(SMSM_STATE_APPS, | 1188 | smsm_change_state(SMSM_STATE_APPS, |
1183 | ~0, SMSM_INIT | SMSM_SMDINIT | SMSM_RPCINIT); | 1189 | ~0, SMSM_INIT | SMSM_SMDINIT | SMSM_RPCINIT | SMSM_RUN); |
1190 | #ifdef CONFIG_ARCH_MSM_SCORPION | ||
1191 | smsm_change_state(SMSM_STATE_APPS_DEM, ~0, 0); | ||
1192 | #endif | ||
1184 | 1193 | ||
1185 | pr_info("smd_core_init() done\n"); | 1194 | pr_info("smd_core_init() done\n"); |
1186 | 1195 | ||
@@ -1232,7 +1241,15 @@ static int debug_read_stat(char *buf, int max) | |||
1232 | i += scnprintf(buf + i, max - i, "smsm: a9: %08x a11: %08x\n", | 1241 | i += scnprintf(buf + i, max - i, "smsm: a9: %08x a11: %08x\n", |
1233 | raw_smsm_get_state(SMSM_STATE_MODEM), | 1242 | raw_smsm_get_state(SMSM_STATE_MODEM), |
1234 | raw_smsm_get_state(SMSM_STATE_APPS)); | 1243 | raw_smsm_get_state(SMSM_STATE_APPS)); |
1235 | 1244 | #ifdef CONFIG_ARCH_MSM_SCORPION | |
1245 | i += scnprintf(buf + i, max - i, "smsm dem: apps: %08x modem: %08x " | ||
1246 | "qdsp6: %08x power: %08x time: %08x\n", | ||
1247 | raw_smsm_get_state(SMSM_STATE_APPS_DEM), | ||
1248 | raw_smsm_get_state(SMSM_STATE_MODEM_DEM), | ||
1249 | raw_smsm_get_state(SMSM_STATE_QDSP6_DEM), | ||
1250 | raw_smsm_get_state(SMSM_STATE_POWER_MASTER_DEM), | ||
1251 | raw_smsm_get_state(SMSM_STATE_TIME_MASTER_DEM)); | ||
1252 | #endif | ||
1236 | if (msg) { | 1253 | if (msg) { |
1237 | msg[SZ_DIAG_ERR_MSG - 1] = 0; | 1254 | msg[SZ_DIAG_ERR_MSG - 1] = 0; |
1238 | i += scnprintf(buf + i, max - i, "diag: '%s'\n", msg); | 1255 | i += scnprintf(buf + i, max - i, "diag: '%s'\n", msg); |
diff --git a/arch/arm/mach-msm/smd_private.h b/arch/arm/mach-msm/smd_private.h index 35e08359bbdb..71f9612d5f50 100644 --- a/arch/arm/mach-msm/smd_private.h +++ b/arch/arm/mach-msm/smd_private.h | |||
@@ -61,12 +61,29 @@ struct smem_shared | |||
61 | #define SMSM_V1_SIZE (sizeof(unsigned) * 8) | 61 | #define SMSM_V1_SIZE (sizeof(unsigned) * 8) |
62 | #define SMSM_V2_SIZE (sizeof(unsigned) * 4) | 62 | #define SMSM_V2_SIZE (sizeof(unsigned) * 4) |
63 | 63 | ||
64 | #ifndef CONFIG_ARCH_MSM_SCORPION | ||
64 | struct smsm_interrupt_info | 65 | struct smsm_interrupt_info |
65 | { | 66 | { |
66 | uint32_t aArm_en_mask; | 67 | uint32_t interrupt_mask; |
67 | uint32_t aArm_interrupts_pending; | 68 | uint32_t pending_interrupts; |
68 | uint32_t aArm_wakeup_reason; | 69 | uint32_t wakeup_reason; |
70 | }; | ||
71 | #else | ||
72 | #define DEM_MAX_PORT_NAME_LEN (20) | ||
73 | struct msm_dem_slave_data { | ||
74 | uint32_t sleep_time; | ||
75 | uint32_t interrupt_mask; | ||
76 | uint32_t resources_used; | ||
77 | uint32_t reserved1; | ||
78 | |||
79 | uint32_t wakeup_reason; | ||
80 | uint32_t pending_interrupts; | ||
81 | uint32_t rpc_prog; | ||
82 | uint32_t rpc_proc; | ||
83 | char smd_port_name[DEM_MAX_PORT_NAME_LEN]; | ||
84 | uint32_t reserved2; | ||
69 | }; | 85 | }; |
86 | #endif | ||
70 | 87 | ||
71 | #define SZ_DIAG_ERR_MSG 0xC8 | 88 | #define SZ_DIAG_ERR_MSG 0xC8 |
72 | #define ID_DIAG_ERR_MSG SMEM_DIAG_ERR_MESSAGE | 89 | #define ID_DIAG_ERR_MSG SMEM_DIAG_ERR_MESSAGE |
@@ -131,7 +148,6 @@ void *smem_alloc(unsigned id, unsigned size); | |||
131 | int smsm_change_state(enum smsm_state_item item, uint32_t clear_mask, uint32_t set_mask); | 148 | int smsm_change_state(enum smsm_state_item item, uint32_t clear_mask, uint32_t set_mask); |
132 | uint32_t smsm_get_state(enum smsm_state_item item); | 149 | uint32_t smsm_get_state(enum smsm_state_item item); |
133 | int smsm_set_sleep_duration(uint32_t delay); | 150 | int smsm_set_sleep_duration(uint32_t delay); |
134 | int smsm_set_interrupt_info(struct smsm_interrupt_info *info); | ||
135 | void smsm_print_sleep_info(void); | 151 | void smsm_print_sleep_info(void); |
136 | 152 | ||
137 | #define SMEM_NUM_SMD_CHANNELS 64 | 153 | #define SMEM_NUM_SMD_CHANNELS 64 |