static int cbp_pm_event(struct notifier_block *notifier, unsigned long pm_event, void *unused)
{
	struct cbp_platform_data *cdata = &cbp_data;
	unsigned long flags;
	
	LOGPRT(LOG_NOTICE,"%s pm_event=%ld\n",__FUNCTION__,pm_event);
	switch(pm_event) {
	case PM_HIBERNATION_PREPARE:
		// This event is recieved when system is preparing to hibernation.
		// i.e., IPO-H power off in kernel space, where user/kernel space processes are not freezed yet.
		return NOTIFY_DONE;
	case PM_RESTORE_PREPARE:
		// This event is recieved before system is preparing to restore,
		// i.e., IPO-H power on, where kernel is on the way to late_initcall() in normal boot.
		return NOTIFY_DONE;
	case PM_POST_HIBERNATION:
		// This event is recieved, after system is restored, and user/kernel processes are unfreezed and can operate on.
		if (cdata->modem){
			LOGPRT(LOG_INFO,  "%s: set md off.\n", __func__);
			spin_lock_irqsave(&cdata->modem->status_lock, flags);
			cdata->modem->status = MD_OFF;
			spin_unlock_irqrestore(&cdata->modem->status_lock, flags);
		}
		LOGPRT(LOG_NOTICE,"[%s] ipoh occured\n", __FUNCTION__);
		modem_reset_handler();
		c2k_platform_restore_first_init();
		LOGPRT(LOG_NOTICE,  "%s %d power off sdio host\n", __func__, __LINE__);
		c2k_wake_host(0);
		LOGPRT(LOG_NOTICE,  "%s %d notify user space ipoh\n", __func__, __LINE__);
		modem_ipoh_indication_usr();
		return NOTIFY_DONE;
	}
	return NOTIFY_OK;
}
Example #2
0
static int cbp_pm_event(struct notifier_block *notifier, unsigned long pm_event, void *unused)
{
   LOGPRT(LOG_NOTICE,"%s pm_event=%d\n",__FUNCTION__,pm_event);
   switch(pm_event) {
   case PM_HIBERNATION_PREPARE:
       // This event is recieved when system is preparing to hibernation.
       // i.e., IPO-H power off in kernel space, where user/kernel space processes are not freezed yet.
       return NOTIFY_DONE;
   case PM_RESTORE_PREPARE:
       // This event is recieved before system is preparing to restore,
       // i.e., IPO-H power on, where kernel is on the way to late_initcall() in normal boot.
       return NOTIFY_DONE;
   case PM_POST_HIBERNATION:
       // This event is recieved, after system is restored, and user/kernel processes are unfreezed and can operate on.
       cbp_power_state = 0;
       LOGPRT(LOG_NOTICE,"[%s] ipoh occured\n", __FUNCTION__);
       modem_reset_handler();
       LOGPRT(LOG_NOTICE,  "%s %d power off sdio host\n", __func__, __LINE__);
       oem_wake_host(0);
       LOGPRT(LOG_NOTICE,  "%s %d notify user space ipoh\n", __func__, __LINE__);
       modem_ipoh_indication_usr();
       return NOTIFY_DONE;
   }
   return NOTIFY_OK;
}