From ec9d3d14ffa9454e6d51e5dd1889d6e9e0be5198 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= Date: Tue, 16 Jun 2009 14:48:21 -0700 Subject: [PATCH] [ARM] msm: Add 8k power collapse support to smd MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Arve Hjønnevåg Signed-off-by: Daniel Walker --- arch/arm/mach-msm/smd.c | 57 +++++++++++++++++++++------------ 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) return rv; } +#ifdef CONFIG_ARCH_MSM_SCORPION + int smsm_set_sleep_duration(uint32_t delay) { - uint32_t *ptr; - - ptr = smem_alloc(SMEM_SMSM_SLEEP_DELAY, sizeof(*ptr)); + struct msm_dem_slave_data *ptr = smem_alloc(SMEM_APPS_DEM_SLAVE_DATA, + sizeof(*ptr)); if (ptr == NULL) { - pr_err("smsm_set_sleep_duration \n"); + pr_err("smsm_set_sleep_duration \n"); return -EIO; } if (msm_smd_debug_mask & MSM_SMSM_DEBUG) pr_info("smsm_set_sleep_duration %d -> %d\n", - *ptr, delay); - *ptr = delay; + ptr->sleep_time, delay); + ptr->sleep_time = delay; return 0; } -int smsm_set_interrupt_info(struct smsm_interrupt_info *info) +#else + +int smsm_set_sleep_duration(uint32_t delay) { - struct smsm_interrupt_info *ptr; + uint32_t *ptr; - ptr = smem_alloc(SMEM_SMSM_INT_INFO, sizeof(*ptr)); + ptr = smem_alloc(SMEM_SMSM_SLEEP_DELAY, sizeof(*ptr)); if (ptr == NULL) { - pr_err("smsm_set_sleep_duration \n"); + pr_err("smsm_set_sleep_duration \n"); return -EIO; } if (msm_smd_debug_mask & MSM_SMSM_DEBUG) - pr_info("smsm_set_interrupt_info %x %x -> %x %x\n", - ptr->aArm_en_mask, ptr->aArm_interrupts_pending, - info->aArm_en_mask, info->aArm_interrupts_pending); - *ptr = *info; + pr_info("smsm_set_sleep_duration %d -> %d\n", + *ptr, delay); + *ptr = delay; return 0; } +#endif + #define MAX_NUM_SLEEP_CLIENTS 64 #define MAX_SLEEP_NAME_LEN 8 @@ -1115,12 +1119,13 @@ void smsm_print_sleep_info(void) if (ptr) pr_info("SMEM_SLEEP_POWER_COLLAPSE_DISABLED: %x\n", *ptr); +#ifndef CONFIG_ARCH_MSM_SCORPION int_info = smem_alloc(SMEM_SMSM_INT_INFO, sizeof(*int_info)); if (int_info) pr_info("SMEM_SMSM_INT_INFO %x %x %x\n", - int_info->aArm_en_mask, - int_info->aArm_interrupts_pending, - int_info->aArm_wakeup_reason); + int_info->interrupt_mask, + int_info->pending_interrupts, + int_info->wakeup_reason); gpio = smem_alloc(SMEM_GPIO_INT, sizeof(*gpio)); if (gpio) { @@ -1135,7 +1140,8 @@ void smsm_print_sleep_info(void) i, gpio->num_fired[i], gpio->fired[i][0], gpio->fired[i][1]); } - +#else +#endif spin_unlock_irqrestore(&smem_lock, flags); } @@ -1180,7 +1186,10 @@ int smd_core_init(void) /* indicate that we're up and running */ smsm_change_state(SMSM_STATE_APPS, - ~0, SMSM_INIT | SMSM_SMDINIT | SMSM_RPCINIT); + ~0, SMSM_INIT | SMSM_SMDINIT | SMSM_RPCINIT | SMSM_RUN); +#ifdef CONFIG_ARCH_MSM_SCORPION + smsm_change_state(SMSM_STATE_APPS_DEM, ~0, 0); +#endif pr_info("smd_core_init() done\n"); @@ -1232,7 +1241,15 @@ static int debug_read_stat(char *buf, int max) i += scnprintf(buf + i, max - i, "smsm: a9: %08x a11: %08x\n", raw_smsm_get_state(SMSM_STATE_MODEM), raw_smsm_get_state(SMSM_STATE_APPS)); - +#ifdef CONFIG_ARCH_MSM_SCORPION + i += scnprintf(buf + i, max - i, "smsm dem: apps: %08x modem: %08x " + "qdsp6: %08x power: %08x time: %08x\n", + raw_smsm_get_state(SMSM_STATE_APPS_DEM), + raw_smsm_get_state(SMSM_STATE_MODEM_DEM), + raw_smsm_get_state(SMSM_STATE_QDSP6_DEM), + raw_smsm_get_state(SMSM_STATE_POWER_MASTER_DEM), + raw_smsm_get_state(SMSM_STATE_TIME_MASTER_DEM)); +#endif if (msg) { msg[SZ_DIAG_ERR_MSG - 1] = 0; 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 #define SMSM_V1_SIZE (sizeof(unsigned) * 8) #define SMSM_V2_SIZE (sizeof(unsigned) * 4) +#ifndef CONFIG_ARCH_MSM_SCORPION struct smsm_interrupt_info { - uint32_t aArm_en_mask; - uint32_t aArm_interrupts_pending; - uint32_t aArm_wakeup_reason; + uint32_t interrupt_mask; + uint32_t pending_interrupts; + uint32_t wakeup_reason; +}; +#else +#define DEM_MAX_PORT_NAME_LEN (20) +struct msm_dem_slave_data { + uint32_t sleep_time; + uint32_t interrupt_mask; + uint32_t resources_used; + uint32_t reserved1; + + uint32_t wakeup_reason; + uint32_t pending_interrupts; + uint32_t rpc_prog; + uint32_t rpc_proc; + char smd_port_name[DEM_MAX_PORT_NAME_LEN]; + uint32_t reserved2; }; +#endif #define SZ_DIAG_ERR_MSG 0xC8 #define ID_DIAG_ERR_MSG SMEM_DIAG_ERR_MESSAGE @@ -131,7 +148,6 @@ void *smem_alloc(unsigned id, unsigned size); int smsm_change_state(enum smsm_state_item item, uint32_t clear_mask, uint32_t set_mask); uint32_t smsm_get_state(enum smsm_state_item item); int smsm_set_sleep_duration(uint32_t delay); -int smsm_set_interrupt_info(struct smsm_interrupt_info *info); void smsm_print_sleep_info(void); #define SMEM_NUM_SMD_CHANNELS 64 -- 2.39.5