msm: qdsp5: Use IORESOURCE_IRQ to retrieve interrupt macro value
Rename the platform driver to msm_adsp. Add platform device for
ADSP in target specific devices file. Add the interrupt value in
adsp_info structure. Now IRQ resources can be fetched run-time
at probe function. No need to maintain hardcoded macro values
within the driver.
Change-Id: I57e1433c74600aea5d420a73715530d946df67a6
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
diff --git a/arch/arm/mach-msm/qdsp5/adsp.c b/arch/arm/mach-msm/qdsp5/adsp.c
index 1bf2a55..31a54b7 100644
--- a/arch/arm/mach-msm/qdsp5/adsp.c
+++ b/arch/arm/mach-msm/qdsp5/adsp.c
@@ -58,8 +58,6 @@
#include <mach/msm_adsp.h>
#include "adsp.h"
-#define INT_ADSP INT_ADSP_A9_A11
-
static struct adsp_info adsp_info;
static struct msm_rpc_endpoint *rpc_cb_server_client;
static struct msm_adsp_module *adsp_modules;
@@ -1090,7 +1088,7 @@
mutex_lock(&adsp_open_lock);
if (adsp_open_count++ == 0) {
- enable_irq(INT_ADSP);
+ enable_irq(adsp_info.int_adsp);
prevent_suspend();
}
mutex_unlock(&adsp_open_lock);
@@ -1148,7 +1146,7 @@
clk_disable(module->clk);
mutex_lock(&adsp_open_lock);
if (--adsp_open_count == 0) {
- disable_irq(INT_ADSP);
+ disable_irq(adsp_info.int_adsp);
allow_suspend();
MM_DBG("disable interrupt\n");
}
@@ -1177,8 +1175,11 @@
unsigned count;
int rc, i;
- if (pdev->id != (rpc_adsp_rtos_atom_vers & RPC_VERSION_MAJOR_MASK))
- return -EINVAL;
+ adsp_info.int_adsp = platform_get_irq(pdev, 0);
+ if (adsp_info.int_adsp < 0) {
+ MM_ERR("no irq resource?\n");
+ return -ENODEV;
+ }
wake_lock_init(&adsp_wake_lock, WAKE_LOCK_SUSPEND, "adsp");
adsp_info.init_info_ptr = kzalloc(
@@ -1206,11 +1207,11 @@
spin_lock_init(&adsp_write_lock);
mutex_init(&adsp_info.lock);
- rc = request_irq(INT_ADSP, adsp_irq_handler, IRQF_TRIGGER_RISING,
- "adsp", 0);
+ rc = request_irq(adsp_info.int_adsp, adsp_irq_handler,
+ IRQF_TRIGGER_RISING, "adsp", 0);
if (rc < 0)
goto fail_request_irq;
- disable_irq(INT_ADSP);
+ disable_irq(adsp_info.int_adsp);
rpc_cb_server_client = msm_rpc_open();
if (IS_ERR(rpc_cb_server_client)) {
@@ -1262,8 +1263,8 @@
msm_rpc_close(rpc_cb_server_client);
rpc_cb_server_client = NULL;
fail_rpc_open:
- enable_irq(INT_ADSP);
- free_irq(INT_ADSP, 0);
+ enable_irq(adsp_info.int_adsp);
+ free_irq(adsp_info.int_adsp, 0);
fail_request_irq:
kfree(adsp_modules);
kfree(adsp_info.init_info_ptr);
@@ -1392,7 +1393,7 @@
},
};
-static char msm_adsp_driver_name[] = "rs00000000";
+static const char msm_adsp_driver_name[] = "msm_adsp";
#ifdef CONFIG_DEBUG_FS
static const struct file_operations adsp_debug_fops = {
@@ -1431,9 +1432,6 @@
rpc_adsp_rtos_mtoa_vers_comp = 0x00030001;
#endif
- snprintf(msm_adsp_driver_name, sizeof(msm_adsp_driver_name),
- "rs%08x",
- rpc_adsp_rtos_atom_prog);
msm_adsp_driver.driver.name = msm_adsp_driver_name;
rc = platform_driver_register(&msm_adsp_driver);
MM_INFO("%s -- %d\n", msm_adsp_driver_name, rc);
diff --git a/arch/arm/mach-msm/qdsp5/adsp.h b/arch/arm/mach-msm/qdsp5/adsp.h
index 8e5a4f3..0f16111 100644
--- a/arch/arm/mach-msm/qdsp5/adsp.h
+++ b/arch/arm/mach-msm/qdsp5/adsp.h
@@ -118,6 +118,9 @@
wait_queue_head_t init_info_wait;
unsigned init_info_state;
struct mutex lock;
+
+ /* Interrupt value */
+ int int_adsp;
};
#define RPC_ADSP_RTOS_ATOM_NULL_PROC 0