msm: rpm: Move RPM to CPU0 IRQ handling into RPM driver
RPM driver is probably the right place to handle this interrupt
than pm-8x60 driver. Also, pass the wake up irq as part of
msm_rpm_platform_data instead of calling a separate API from the
boards file.
Change-Id: If42b7b821089de23f216d5b71447833be39789ce
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-8064.c b/arch/arm/mach-msm/board-8064.c
index 36a81b6..edb5cb5 100644
--- a/arch/arm/mach-msm/board-8064.c
+++ b/arch/arm/mach-msm/board-8064.c
@@ -2561,7 +2561,6 @@
acpuclk_init(&acpuclk_8064_soc_data);
msm_spm_l2_init(msm_spm_l2_data);
msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
- msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
msm_pm_data);
BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
diff --git a/arch/arm/mach-msm/board-8930.c b/arch/arm/mach-msm/board-8930.c
index e500632..37085f4 100644
--- a/arch/arm/mach-msm/board-8930.c
+++ b/arch/arm/mach-msm/board-8930.c
@@ -2076,7 +2076,6 @@
slim_register_board_info(msm_slim_devices,
ARRAY_SIZE(msm_slim_devices));
msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
- msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
msm_pm_data);
change_memory_power = &msm8930_change_memory_power;
diff --git a/arch/arm/mach-msm/board-8960.c b/arch/arm/mach-msm/board-8960.c
index 9fa7c0b..94166c4 100644
--- a/arch/arm/mach-msm/board-8960.c
+++ b/arch/arm/mach-msm/board-8960.c
@@ -2847,7 +2847,6 @@
slim_register_board_info(msm_slim_devices,
ARRAY_SIZE(msm_slim_devices));
msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
- msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
msm_pm_data);
BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
@@ -2879,7 +2878,6 @@
slim_register_board_info(msm_slim_devices,
ARRAY_SIZE(msm_slim_devices));
msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
- msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
msm_pm_data);
BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
@@ -2958,7 +2956,6 @@
ARRAY_SIZE(msm_slim_devices));
msm8960_init_dsps();
msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
- msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
msm_pm_data);
change_memory_power = &msm8960_change_memory_power;
diff --git a/arch/arm/mach-msm/board-9615.c b/arch/arm/mach-msm/board-9615.c
index 8a8e575..595b7d5 100644
--- a/arch/arm/mach-msm/board-9615.c
+++ b/arch/arm/mach-msm/board-9615.c
@@ -796,7 +796,6 @@
slim_register_board_info(msm_slim_devices,
ARRAY_SIZE(msm_slim_devices));
msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
- msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
msm_pm_data);
msm_pm_boot_pdata.p_addr = allocate_contiguous_ebi_nomap(SZ_8, SZ_64K);
diff --git a/arch/arm/mach-msm/board-msm8x60.c b/arch/arm/mach-msm/board-msm8x60.c
index 39061a6..3cecfa7 100644
--- a/arch/arm/mach-msm/board-msm8x60.c
+++ b/arch/arm/mach-msm/board-msm8x60.c
@@ -10508,7 +10508,6 @@
#endif
msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
- msm_pm_set_rpm_wakeup_irq(RPM_SCSS_CPU0_WAKE_UP_IRQ);
msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
msm_pm_data);
BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
diff --git a/arch/arm/mach-msm/devices-8064.c b/arch/arm/mach-msm/devices-8064.c
index 092a4f5..5d6a3ae 100644
--- a/arch/arm/mach-msm/devices-8064.c
+++ b/arch/arm/mach-msm/devices-8064.c
@@ -1730,6 +1730,7 @@
},
.irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
.irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
+ .irq_wakeup = RPM_APCC_CPU0_WAKE_UP_IRQ,
.ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
.ipc_rpm_val = 4,
.target_id = {
diff --git a/arch/arm/mach-msm/devices-8930.c b/arch/arm/mach-msm/devices-8930.c
index 583c12d..85e927e 100644
--- a/arch/arm/mach-msm/devices-8930.c
+++ b/arch/arm/mach-msm/devices-8930.c
@@ -40,6 +40,7 @@
},
.irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
.irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
+ .irq_wakeup = RPM_APCC_CPU0_WAKE_UP_IRQ,
.ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
.ipc_rpm_val = 4,
.target_id = {
diff --git a/arch/arm/mach-msm/devices-8960.c b/arch/arm/mach-msm/devices-8960.c
index 63c799e..375aa8d 100644
--- a/arch/arm/mach-msm/devices-8960.c
+++ b/arch/arm/mach-msm/devices-8960.c
@@ -2984,6 +2984,7 @@
},
.irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
.irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
+ .irq_wakeup = RPM_APCC_CPU0_WAKE_UP_IRQ,
.ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
.ipc_rpm_val = 4,
.target_id = {
diff --git a/arch/arm/mach-msm/devices-9615.c b/arch/arm/mach-msm/devices-9615.c
index 3c671ed..60bcdce 100644
--- a/arch/arm/mach-msm/devices-9615.c
+++ b/arch/arm/mach-msm/devices-9615.c
@@ -905,6 +905,7 @@
},
.irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
.irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
+ .irq_wakeup = RPM_APCC_CPU0_WAKE_UP_IRQ,
.ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
.ipc_rpm_val = 4,
.target_id = {
diff --git a/arch/arm/mach-msm/devices-msm8x60.c b/arch/arm/mach-msm/devices-msm8x60.c
index bedd133..608ca27 100644
--- a/arch/arm/mach-msm/devices-msm8x60.c
+++ b/arch/arm/mach-msm/devices-msm8x60.c
@@ -2582,6 +2582,7 @@
},
.irq_ack = RPM_SCSS_CPU0_GP_HIGH_IRQ,
.irq_err = RPM_SCSS_CPU0_GP_LOW_IRQ,
+ .irq_wakeup = RPM_SCSS_CPU0_WAKE_UP_IRQ,
.ipc_rpm_reg = MSM_GCC_BASE + 0x008,
.ipc_rpm_val = 4,
.target_id = {
diff --git a/arch/arm/mach-msm/include/mach/rpm.h b/arch/arm/mach-msm/include/mach/rpm.h
index 140b7c9..98621be 100644
--- a/arch/arm/mach-msm/include/mach/rpm.h
+++ b/arch/arm/mach-msm/include/mach/rpm.h
@@ -883,6 +883,7 @@
void __iomem *reg_base_addrs[MSM_RPM_PAGE_COUNT];
unsigned int irq_ack;
unsigned int irq_err;
+ unsigned int irq_wakeup;
void *ipc_rpm_reg;
unsigned int ipc_rpm_val;
struct msm_rpm_map_data target_id[MSM_RPM_ID_LAST];
diff --git a/arch/arm/mach-msm/pm-8x60.c b/arch/arm/mach-msm/pm-8x60.c
index 6de0660..40ddf8e 100644
--- a/arch/arm/mach-msm/pm-8x60.c
+++ b/arch/arm/mach-msm/pm-8x60.c
@@ -79,7 +79,6 @@
*****************************************************************************/
static struct msm_pm_platform_data *msm_pm_modes;
-static int rpm_cpu0_wakeup_irq;
void __init msm_pm_set_platform_data(
struct msm_pm_platform_data *data, int count)
@@ -88,11 +87,6 @@
msm_pm_modes = data;
}
-void __init msm_pm_set_rpm_wakeup_irq(unsigned int irq)
-{
- rpm_cpu0_wakeup_irq = irq;
-}
-
enum {
MSM_PM_MODE_ATTR_SUSPEND,
MSM_PM_MODE_ATTR_IDLE,
@@ -763,15 +757,6 @@
return collapsed;
}
-static irqreturn_t msm_pm_rpm_wakeup_interrupt(int irq, void *dev_id)
-{
- if (dev_id != &msm_pm_rpm_wakeup_interrupt)
- return IRQ_NONE;
-
- return IRQ_HANDLED;
-}
-
-
/******************************************************************************
* External Idle/Suspend Functions
*****************************************************************************/
@@ -1167,7 +1152,6 @@
#ifdef CONFIG_MSM_IDLE_STATS
struct proc_dir_entry *d_entry;
#endif
- int ret;
/* Page table for cores to come back up safely. */
pc_pgd = pgd_alloc(&init_mm);
@@ -1205,22 +1189,6 @@
clean_caches((unsigned long)&msm_pm_pc_pgd, sizeof(msm_pm_pc_pgd),
virt_to_phys(&msm_pm_pc_pgd));
- ret = request_irq(rpm_cpu0_wakeup_irq,
- msm_pm_rpm_wakeup_interrupt, IRQF_TRIGGER_RISING,
- "pm_drv", msm_pm_rpm_wakeup_interrupt);
- if (ret) {
- pr_err("%s: failed to request irq %u: %d\n",
- __func__, rpm_cpu0_wakeup_irq, ret);
- return ret;
- }
-
- ret = irq_set_irq_wake(rpm_cpu0_wakeup_irq, 1);
- if (ret) {
- pr_err("%s: failed to set wakeup irq %u: %d\n",
- __func__, rpm_cpu0_wakeup_irq, ret);
- return ret;
- }
-
#ifdef CONFIG_MSM_IDLE_STATS
for_each_possible_cpu(cpu) {
struct msm_pm_time_stats *stats =
diff --git a/arch/arm/mach-msm/rpm.c b/arch/arm/mach-msm/rpm.c
index b0fa3d2..44e50dd 100644
--- a/arch/arm/mach-msm/rpm.c
+++ b/arch/arm/mach-msm/rpm.c
@@ -54,7 +54,6 @@
static uint32_t msm_rpm_sel_mask_size;
static struct msm_rpm_platform_data msm_rpm_data;
-
static DEFINE_MUTEX(msm_rpm_mutex);
static DEFINE_SPINLOCK(msm_rpm_lock);
static DEFINE_SPINLOCK(msm_rpm_irq_lock);
@@ -936,9 +935,16 @@
}
}
+static irqreturn_t msm_pm_rpm_wakeup_interrupt(int irq, void *dev_id)
+{
+ if (dev_id != &msm_pm_rpm_wakeup_interrupt)
+ return IRQ_NONE;
+
+ return IRQ_HANDLED;
+}
+
int __init msm_rpm_init(struct msm_rpm_platform_data *data)
{
- unsigned int irq;
int rc;
memcpy(&msm_rpm_data, data, sizeof(struct msm_rpm_platform_data));
@@ -971,21 +977,19 @@
msm_rpm_write(MSM_RPM_PAGE_CTRL,
target_ctrl(MSM_RPM_CTRL_VERSION_BUILD), msm_rpm_data.ver[2]);
- irq = data->irq_ack;
-
- rc = request_irq(irq, msm_rpm_ack_interrupt,
+ rc = request_irq(data->irq_ack, msm_rpm_ack_interrupt,
IRQF_TRIGGER_RISING | IRQF_NO_SUSPEND,
"rpm_drv", msm_rpm_ack_interrupt);
if (rc) {
pr_err("%s: failed to request irq %d: %d\n",
- __func__, irq, rc);
+ __func__, data->irq_ack, rc);
return rc;
}
- rc = irq_set_irq_wake(irq, 1);
+ rc = irq_set_irq_wake(data->irq_ack, 1);
if (rc) {
pr_err("%s: failed to set wakeup irq %u: %d\n",
- __func__, irq, rc);
+ __func__, data->irq_ack, rc);
return rc;
}
@@ -997,6 +1001,22 @@
return rc;
}
+ rc = request_irq(data->irq_wakeup,
+ msm_pm_rpm_wakeup_interrupt, IRQF_TRIGGER_RISING,
+ "pm_drv", msm_pm_rpm_wakeup_interrupt);
+ if (rc) {
+ pr_err("%s: failed to request irq %u: %d\n",
+ __func__, data->irq_wakeup, rc);
+ return rc;
+ }
+
+ rc = irq_set_irq_wake(data->irq_wakeup, 1);
+ if (rc) {
+ pr_err("%s: failed to set wakeup irq %u: %d\n",
+ __func__, data->irq_wakeup, rc);
+ return rc;
+ }
+
msm_rpm_populate_map(data);
return platform_driver_register(&msm_rpm_platform_driver);