arm: tegra: xmm: change irq handler to irq thread
shawn joo [Mon, 13 Feb 2012 05:30:23 +0000 (14:30 +0900)]
since irq function has printk and long context.
change the handler to irq thread for stable running.

Bug 937413

Signed-off-by: shawn joo <sjoo@nvidia.com>
Reviewed-on: http://git-master/r/83350
(cherry picked from commit 1bf117669ed8b4fdb854074aef26d1a568544616)

Change-Id: Ib760e19903b7e9975a1ac7b8275537c75830764d
Reviewed-on: http://git-master/r/87633
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

arch/arm/mach-tegra/baseband-xmm-power.c
arch/arm/mach-tegra/baseband-xmm-power2.c

index 13a904d..51118f7 100644 (file)
@@ -376,13 +376,14 @@ irqreturn_t baseband_xmm_power_ipc_ap_wake_irq(int irq, void *dev_id)
 {
        int value;
 
-       pr_debug("%s\n", __func__);
+       value = gpio_get_value(baseband_power_driver_data->
+                               modem.xmm.ipc_ap_wake);
+
+       pr_debug("%s g(%d), wake_st(%d)\n", __func__, value, ipc_ap_wake_state);
 
        if (ipc_ap_wake_state < IPC_AP_WAKE_IRQ_READY) {
                pr_err("%s - spurious irq\n", __func__);
        } else if (ipc_ap_wake_state == IPC_AP_WAKE_IRQ_READY) {
-               value = gpio_get_value(baseband_power_driver_data->
-                       modem.xmm.ipc_ap_wake);
                if (!value) {
                        pr_debug("%s - IPC_AP_WAKE_INIT1"
                                " - got falling edge\n",
@@ -397,8 +398,6 @@ irqreturn_t baseband_xmm_power_ipc_ap_wake_irq(int irq, void *dev_id)
                                __func__);
                }
        } else if (ipc_ap_wake_state == IPC_AP_WAKE_INIT1) {
-               value = gpio_get_value(baseband_power_driver_data->
-                       modem.xmm.ipc_ap_wake);
                if (!value) {
                        pr_debug("%s - IPC_AP_WAKE_INIT2"
                                " - wait for rising edge\n",
@@ -413,8 +412,6 @@ irqreturn_t baseband_xmm_power_ipc_ap_wake_irq(int irq, void *dev_id)
                        queue_work(workqueue, &init2_work);
                }
        } else {
-               value = gpio_get_value(baseband_power_driver_data->
-                       modem.xmm.ipc_ap_wake);
                if (!value) {
                        pr_debug("%s - falling\n", __func__);
                        /* [ver < 1130] gpio protocol falling edge */
@@ -827,7 +824,9 @@ static int baseband_xmm_power_driver_probe(struct platform_device *device)
        if (modem_flash && modem_pm) {
                pr_debug("%s: request_irq IPC_AP_WAKE_IRQ\n", __func__);
                ipc_ap_wake_state = IPC_AP_WAKE_UNINIT;
-               err = request_irq(gpio_to_irq(data->modem.xmm.ipc_ap_wake),
+               err = request_threaded_irq(
+                       gpio_to_irq(data->modem.xmm.ipc_ap_wake),
+                       NULL,
                        baseband_xmm_power_ipc_ap_wake_irq,
                        IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
                        "IPC_AP_WAKE_IRQ",
index 77ba073..4295b39 100644 (file)
@@ -73,12 +73,13 @@ static irqreturn_t baseband_xmm_power2_ver_lt_1130_ipc_ap_wake_irq2
        if (!baseband_power2_driver_data)
                return IRQ_HANDLED;
 
+       value = gpio_get_value(baseband_power2_driver_data->
+                   modem.xmm.ipc_ap_wake);
+
        /* IPC_AP_WAKE state machine */
        if (ipc_ap_wake_state < IPC_AP_WAKE_IRQ_READY) {
                pr_err("%s - spurious irq\n", __func__);
        } else if (ipc_ap_wake_state == IPC_AP_WAKE_IRQ_READY) {
-               value = gpio_get_value(baseband_power2_driver_data->
-                       modem.xmm.ipc_ap_wake);
                if (!value) {
                        pr_debug("%s - IPC_AP_WAKE_INIT1"
                                " - got falling edge\n",
@@ -96,8 +97,6 @@ static irqreturn_t baseband_xmm_power2_ver_lt_1130_ipc_ap_wake_irq2
                                __func__);
                }
        } else if (ipc_ap_wake_state == IPC_AP_WAKE_INIT1) {
-               value = gpio_get_value(baseband_power2_driver_data->
-                       modem.xmm.ipc_ap_wake);
                if (!value) {
                        pr_debug("%s - IPC_AP_WAKE_INIT2"
                                " - wait for rising edge\n",
@@ -115,8 +114,6 @@ static irqreturn_t baseband_xmm_power2_ver_lt_1130_ipc_ap_wake_irq2
                                baseband_xmm_power2_work);
                }
        } else {
-               value = gpio_get_value(baseband_power2_driver_data->
-                       modem.xmm.ipc_ap_wake);
                if (!value) {
                        pr_debug("%s - falling\n", __func__);
                        ipc_ap_wake_state = IPC_AP_WAKE_L;
@@ -141,12 +138,13 @@ static irqreturn_t baseband_xmm_power2_ver_ge_1130_ipc_ap_wake_irq2
        if (!baseband_power2_driver_data)
                return IRQ_HANDLED;
 
+       value = gpio_get_value(baseband_power2_driver_data->
+                   modem.xmm.ipc_ap_wake);
+
        /* IPC_AP_WAKE state machine */
        if (ipc_ap_wake_state < IPC_AP_WAKE_IRQ_READY) {
                pr_err("%s - spurious irq\n", __func__);
        } else if (ipc_ap_wake_state == IPC_AP_WAKE_IRQ_READY) {
-               value = gpio_get_value(baseband_power2_driver_data->
-                       modem.xmm.ipc_ap_wake);
                if (!value) {
                        pr_debug("%s - IPC_AP_WAKE_INIT1"
                                " - got falling edge\n",
@@ -164,8 +162,6 @@ static irqreturn_t baseband_xmm_power2_ver_ge_1130_ipc_ap_wake_irq2
                                __func__);
                }
        } else {
-               value = gpio_get_value(baseband_power2_driver_data->
-                       modem.xmm.ipc_ap_wake);
                if (!value) {
                        pr_debug("%s - falling\n", __func__);
                        ipc_ap_wake_state = IPC_AP_WAKE_L;
@@ -476,8 +472,10 @@ static void baseband_xmm_power2_work_func(struct work_struct *work)
                pr_debug("BBXMM_WORK_INIT\n");
                /* request baseband irq(s) */
                ipc_ap_wake_state = IPC_AP_WAKE_UNINIT;
-               err = request_irq(gpio_to_irq(baseband_power2_driver_data
-                       ->modem.xmm.ipc_ap_wake),
+               err = request_threaded_irq(
+                       gpio_to_irq(baseband_power2_driver_data->
+                           modem.xmm.ipc_ap_wake),
+                       NULL,
                        (modem_ver < XMM_MODEM_VER_1130)
                        ? baseband_xmm_power2_ver_lt_1130_ipc_ap_wake_irq2
                        : baseband_xmm_power2_ver_ge_1130_ipc_ap_wake_irq2,