static void modem_detect(struct work_struct *work) { struct cbp_reset *cbp_rst_ind = NULL; int ret; int level = 0; LOGPRT(LOG_NOTICE, "%s %d .\n",__func__,__LINE__); cbp_rst_ind = container_of(work, struct cbp_reset, reset_work); #ifdef CONFIG_EVDO_DT_VIA_SUPPORT if((cbp_rst_ind->host == NULL)){/*for first detection and ipoh*/ LOGPRT(LOG_NOTICE, "%s %d modem_detect_card.\n",__func__,__LINE__); ret = modem_detect_card(cbp_rst_ind); if (ret){ LOGPRT(LOG_ERR, "%s: modem detect failed.\n", __func__); } } else{/*for device reset*/ level = !!c2k_gpio_get_value(cbp_rst_ind->rst_ind_gpio); if(level == cbp_rst_ind->rst_ind_polar){ LOGPRT(LOG_NOTICE, "%s %d power on sdio host\n", __func__, __LINE__); c2k_wake_host(0); c2k_wake_host(1); } else{ LOGPRT(LOG_NOTICE, "%s %d power off sdio host\n", __func__, __LINE__); //c2k_gpio_direction_output(GPIO_C2K_MDM_PWR_EN, 1); modem_reset_handler(); c2k_wake_host(0); } } #else level = !!c2k_gpio_get_value(cbp_rst_ind->rst_ind_gpio); if(level == cbp_rst_ind->rst_ind_polar){ LOGPRT(LOG_NOTICE, "%s %d power on sdio host\n", __func__, __LINE__); c2k_wake_host(0); c2k_wake_host(1); } else{ LOGPRT(LOG_NOTICE, "%s %d power off sdio host\n", __func__, __LINE__); //c2k_gpio_direction_output(GPIO_C2K_MDM_PWR_EN, 1); modem_reset_handler(); c2k_wake_host(0); } #endif }
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; }
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; }
static void modem_detect_for_excp(struct work_struct *work) { printk("[MODEM SDIO] excp work sched!!!\n"); modem_reset_handler(); c2k_wake_host(0); msleep(1000); c2k_wake_host(1); }