msm: mdm: use mdelay instead of usleep when resetting modem
The function to reset the external modem can be called from
atomic context so we need to use mdelay instead of usleep.
Change-Id: Ia161ced98764ed3772852f4252215452a1928ff7
Signed-off-by: Joel King <joelking@codeaurora.org>
diff --git a/arch/arm/mach-msm/mdm2.c b/arch/arm/mach-msm/mdm2.c
index f851545..6e7086e 100644
--- a/arch/arm/mach-msm/mdm2.c
+++ b/arch/arm/mach-msm/mdm2.c
@@ -77,6 +77,7 @@
mutex_unlock(&hsic_status_lock);
}
+/* This function can be called from atomic context. */
static void mdm_toggle_soft_reset(struct mdm_modem_drv *mdm_drv)
{
int soft_reset_direction_assert = 0,
@@ -88,11 +89,20 @@
}
gpio_direction_output(mdm_drv->ap2mdm_soft_reset_gpio,
soft_reset_direction_assert);
- usleep_range(5000, 10000);
+ /* Use mdelay because this function can be called from atomic
+ * context.
+ */
+ mdelay(10);
gpio_direction_output(mdm_drv->ap2mdm_soft_reset_gpio,
soft_reset_direction_de_assert);
}
+/* This function can be called from atomic context. */
+static void mdm_atomic_soft_reset(struct mdm_modem_drv *mdm_drv)
+{
+ mdm_toggle_soft_reset(mdm_drv);
+}
+
static void mdm_power_down_common(struct mdm_modem_drv *mdm_drv)
{
int i;
@@ -242,6 +252,7 @@
static struct mdm_ops mdm_cb = {
.power_on_mdm_cb = mdm_power_on_common,
.reset_mdm_cb = mdm_power_on_common,
+ .atomic_reset_mdm_cb = mdm_atomic_soft_reset,
.power_down_mdm_cb = mdm_power_down_common,
.debug_state_changed_cb = debug_state_changed,
.status_cb = mdm_status_changed,