summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorSeshendra Gadagottu <sgadagottu@nvidia.com>2011-08-19 19:48:15 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:52:23 -0800
commitf62175e8819c555c730cf023ad3e11551b1563e8 (patch)
treec4bf22abfdd9c139966f43bdccb7bba323f536c8 /arch
parent2f5170d77042f9314fac0692d3e1131559531590 (diff)
arm: tegra: xmm : Wakelock for power management state changes
Used a wakelock to follow L0->L2->L3 state transition for modem power states. Added code for AP initiated L2->L0. BUG 828389 Original-Change-Id: Iad90364d27a0fac204c12880d6aa17a6e032b7d2 Reviewed-on: http://git-master/r/45486 Tested-by: Seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Rebase-Id: R3f9c890584fbf626bac8e36e1fa0561376ffff94
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-tegra/baseband-xmm-power.c46
-rw-r--r--arch/arm/mach-tegra/baseband-xmm-power.h15
2 files changed, 47 insertions, 14 deletions
diff --git a/arch/arm/mach-tegra/baseband-xmm-power.c b/arch/arm/mach-tegra/baseband-xmm-power.c
index f0cd18988e6b..dc8f8191a95d 100644
--- a/arch/arm/mach-tegra/baseband-xmm-power.c
+++ b/arch/arm/mach-tegra/baseband-xmm-power.c
@@ -25,6 +25,7 @@
#include <linux/delay.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
+#include <linux/wakelock.h>
#include <mach/usb_phy.h>
#include "board.h"
#include "devices.h"
@@ -72,24 +73,13 @@ static enum {
IPC_AP_WAKE_H,
} ipc_ap_wake_state;
-static enum {
- BBXMM_PS_UNINIT = 0,
- BBXMM_PS_INIT = 1,
- BBXMM_PS_L0 = 2,
- BBXMM_PS_L0TOL2 = 3,
- BBXMM_PS_L2 = 4,
- BBXMM_PS_L2TOL0 = 5,
- BBXMM_PS_L2TOL3 = 6,
- BBXMM_PS_L3 = 7,
- BBXMM_PS_L3TOL0 = 8,
- BBXMM_PS_LAST = -1,
-} baseband_xmm_powerstate;
-
static struct workqueue_struct *workqueue;
static struct work_struct init1_work;
static struct work_struct init2_work;
+static struct work_struct init3_work;
static struct baseband_power_platform_data *baseband_power_driver_data;
static bool register_hsic_device;
+static struct wake_lock wakelock;
/* static functions */
static int baseband_xmm_power_on(struct platform_device *device);
@@ -216,11 +206,26 @@ static int baseband_xmm_power_off(struct platform_device *device)
return 0;
}
-static void baseband_xmm_set_power_status(unsigned int status)
+void baseband_xmm_set_power_status(unsigned int status)
{
+ switch (status) {
+ case BBXMM_PS_L0:
+ wake_lock(&wakelock);
+ break;
+ case BBXMM_PS_L2:
+ wake_unlock(&wakelock);
+ break;
+ case BBXMM_PS_L2TOL0:
+ /* do this only from L2 state */
+ if (baseband_xmm_powerstate == BBXMM_PS_L2)
+ queue_work(workqueue, &init3_work);
+ default:
+ break;
+ }
baseband_xmm_powerstate = status;
pr_debug("BB XMM POWER STATE = %d\n", status);
}
+EXPORT_SYMBOL_GPL(baseband_xmm_set_power_status);
#if BB_INITIATED_L2_SUSPEND
static irqreturn_t ipc_hsic_sus_req_irq(int irq, void *dev_id)
@@ -354,6 +359,15 @@ static void baseband_xmm_power_init2_work(struct work_struct *work)
}
+/* Do the work for AP initiated L2->L0 */
+static void baseband_xmm_power_init3_work(struct work_struct *work)
+{
+ pr_debug("%s\n", __func__);
+ /* set the slave wakeup request */
+ gpio_set_value(baseband_power_driver_data->
+ modem.xmm.ipc_bb_wake, 1);
+}
+
static int baseband_xmm_power_driver_probe(struct platform_device *device)
{
struct device *dev = &device->dev;
@@ -434,9 +448,12 @@ static int baseband_xmm_power_driver_probe(struct platform_device *device)
return -1;
}
+ wake_lock_init(&wakelock, WAKE_LOCK_SUSPEND, "baseband_xmm_power");
+
baseband_xmm_powerstate = BBXMM_PS_INIT;
INIT_WORK(&init1_work, baseband_xmm_power_init1_work);
INIT_WORK(&init2_work, baseband_xmm_power_init2_work);
+ INIT_WORK(&init3_work, baseband_xmm_power_init3_work);
/* reset / power on sequence */
mdelay(40);
@@ -484,6 +501,7 @@ static int baseband_xmm_power_driver_remove(struct platform_device *device)
ARRAY_SIZE(tegra_baseband_gpios));
device_remove_file(dev, &dev_attr_xmm_onoff);
+ wake_lock_destroy(&wakelock);
/* unregister usb host controller */
platform_device_unregister(baseband_power_driver_data->
diff --git a/arch/arm/mach-tegra/baseband-xmm-power.h b/arch/arm/mach-tegra/baseband-xmm-power.h
index cf6f49b54cfa..8025c9a956ce 100644
--- a/arch/arm/mach-tegra/baseband-xmm-power.h
+++ b/arch/arm/mach-tegra/baseband-xmm-power.h
@@ -44,3 +44,18 @@ struct baseband_power_platform_data {
} xmm;
} modem;
};
+
+static enum {
+ BBXMM_PS_UNINIT = 0,
+ BBXMM_PS_INIT = 1,
+ BBXMM_PS_L0 = 2,
+ BBXMM_PS_L0TOL2 = 3,
+ BBXMM_PS_L2 = 4,
+ BBXMM_PS_L2TOL0 = 5,
+ BBXMM_PS_L2TOL3 = 6,
+ BBXMM_PS_L3 = 7,
+ BBXMM_PS_L3TOL0 = 8,
+ BBXMM_PS_LAST = -1,
+} baseband_xmm_powerstate;
+
+void baseband_xmm_set_power_status(unsigned int status);