msm: mdm: change where ssr_count is decremented
In fusion targets with more than one external modem, where
the modems are restarted together, ssr_count keeps track of
how many modems are still left to be completely restarted so
that any new SSR requests would be rejected until all modems
are restarted. Ssr_count should be decremented when the SSR
module sends the SUBSYS_AFTER_POWERUP notification instead of
during the powerup callback in order to be in sync with the
state of the SSR module.
Change-Id: I196f4937d929c54f475d251632f111404a2b3bf1
Signed-off-by: Joel King <joelking@codeaurora.org>
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
diff --git a/arch/arm/mach-msm/mdm_common.c b/arch/arm/mach-msm/mdm_common.c
index a96ec9d..7e5278a 100644
--- a/arch/arm/mach-msm/mdm_common.c
+++ b/arch/arm/mach-msm/mdm_common.c
@@ -98,6 +98,7 @@
struct work_struct sfr_reason_work;
struct notifier_block mdm_panic_blk;
+ struct notifier_block ssr_notifier_blk;
int ssr_started_internally;
};
@@ -567,6 +568,24 @@
return 0;
}
+static int ssr_notifier_cb(struct notifier_block *this,
+ unsigned long code,
+ void *data)
+{
+ struct mdm_device *mdev =
+ container_of(this, struct mdm_device, ssr_notifier_blk);
+
+ switch (code) {
+ case SUBSYS_AFTER_POWERUP:
+ mdm_ssr_completed(mdev);
+ break;
+ default:
+ break;
+ }
+
+ return NOTIFY_DONE;
+}
+
static int mdm_panic_prep(struct notifier_block *this,
unsigned long event, void *ptr)
{
@@ -690,7 +709,6 @@
mdm_ops->power_on_mdm_cb(mdm_drv);
mdm_drv->boot_type = CHARM_NORMAL_BOOT;
- mdm_ssr_completed(mdev);
complete(&mdev->mdm_needs_reload);
if (!wait_for_completion_timeout(&mdev->mdm_boot,
msecs_to_jiffies(MDM_BOOT_TIMEOUT))) {
@@ -996,6 +1014,11 @@
ret = PTR_ERR(mdev->mdm_subsys_dev);
goto fatal_err;
}
+ memset((void *)&mdev->ssr_notifier_blk, 0,
+ sizeof(struct notifier_block));
+ mdev->ssr_notifier_blk.notifier_call = ssr_notifier_cb;
+ subsys_notif_register_notifier(mdev->subsys_name,
+ &mdev->ssr_notifier_blk);
/* ERR_FATAL irq. */
irq = MSM_GPIO_TO_INT(mdm_drv->mdm2ap_errfatal_gpio);