static void mdm_do_first_power_on(struct mdm_modem_drv *mdm_drv) { int soft_reset_direction = mdm_drv->pdata->soft_reset_inverted ? 0 : 1; if (power_on_count != 1) { pr_err("%s: Calling fn when power_on_count != 1\n", __func__); return; } pr_err("%s: Powering on modem for the first time\n", __func__); mdm_peripheral_disconnect(mdm_drv); /* If the device has a kpd pwr gpio then toggle it. */ if (mdm_drv->ap2mdm_kpdpwr_n_gpio > 0) { /* Pull AP2MDM_KPDPWR gpio high and wait for PS_HOLD to settle, * then pull it back low. */ pr_debug("%s: Pulling AP2MDM_KPDPWR gpio high\n", __func__); gpio_direction_output(mdm_drv->ap2mdm_kpdpwr_n_gpio, 1); msleep(1000); gpio_direction_output(mdm_drv->ap2mdm_kpdpwr_n_gpio, 0); } /* De-assert the soft reset line. */ pr_debug("%s: De-asserting soft reset gpio\n", __func__); gpio_direction_output(mdm_drv->ap2mdm_soft_reset_gpio, soft_reset_direction); mdm_peripheral_connect(mdm_drv); msleep(200); }
static void mdm_hsic_ready_fn(struct work_struct *work) { int value = gpio_get_value(mdm_drv->mdm2ap_hsic_ready_gpio); pr_debug("%s: status:%d\n", __func__, value); //++SSD_RIL: Mars_Lin@20120606: Check 1st status. if ( value == 1 && get_hsic_ready_1st_hi == 0 ) { get_hsic_ready_1st_hi = 1; pr_info("%s: get_hsic_ready_1st_hi = 1\n", __func__); } if ( get_hsic_ready_1st_hi == 0 ) { pr_info("%s: get_hsic_ready_1st_hi == 0\n", __func__); return; } //--SSD_RIL if (value == 0) { #if 0 pr_info("%s: get HSIC low\n", __func__); pr_info("mdm_hsic_ready: unregister:tegra_ehci2_device\n"); mdm_peripheral_disconnect(mdm_drv); pr_info("mdm_hsic_ready: register:tegra_ehci2_device\n"); mdm_peripheral_connect(mdm_drv); //TEGRA_GPIO_PC6 gpio_direction_output(mdm_drv->ap2mdm_wakeup_gpio, 1); tegra_gpio_enable(mdm_drv->ap2mdm_wakeup_gpio); gpio_set_value(mdm_drv->ap2mdm_wakeup_gpio, 1); #endif } }
static void mdm_do_first_power_on(struct mdm_modem_drv *mdm_drv) { int i; int pblrdy; int kpd_direction_assert = 1, kpd_direction_de_assert = 0; if (mdm_drv->pdata->kpd_not_inverted) { kpd_direction_assert = 0; kpd_direction_de_assert = 1; } if (mdm_drv->power_on_count != 1) { pr_err("%s:id %d: Calling fn when power_on_count != 1\n", __func__, mdm_drv->device_id); return; } pr_err("%s:id %d: Powering on modem for the first time\n", __func__, mdm_drv->device_id); mdm_peripheral_disconnect(mdm_drv); /* If this is the first power-up after a panic, the modem may still * be in a power-on state, in which case we need to toggle the gpio * instead of just de-asserting it. No harm done if the modem was * powered down. */ if (!mdm_drv->pdata->no_reset_on_first_powerup) mdm_toggle_soft_reset(mdm_drv); /* If the device has a kpd pwr gpio then toggle it. */ if (GPIO_IS_VALID(mdm_drv->ap2mdm_kpdpwr_n_gpio)) { /* Pull AP2MDM_KPDPWR gpio high and wait for PS_HOLD to settle, * then pull it back low. */ pr_debug("%s:id %d: Pulling AP2MDM_KPDPWR gpio high\n", __func__, mdm_drv->device_id); gpio_direction_output(mdm_drv->ap2mdm_kpdpwr_n_gpio, kpd_direction_assert); msleep(1000); gpio_direction_output(mdm_drv->ap2mdm_kpdpwr_n_gpio, kpd_direction_de_assert); } if (!GPIO_IS_VALID(mdm_drv->mdm2ap_pblrdy)) goto start_mdm_peripheral; for (i = 0; i < MDM_PBLRDY_CNT; i++) { pblrdy = gpio_get_value(mdm_drv->mdm2ap_pblrdy); if (pblrdy) break; usleep_range(5000, 5000); } pr_debug("%s: id %d: pblrdy i:%d\n", __func__, mdm_drv->device_id, i); start_mdm_peripheral: mdm_peripheral_connect(mdm_drv); msleep(200); }
static void mdm_status_changed(struct mdm_modem_drv *mdm_drv, int value) { pr_debug("%s: value:%d\n", __func__, value); if (value && mdm_drv->mdm_ready) {//Sophia:0510-check if MD ready /* msleep(2000); pr_info("mdm_status_changed: unregister:tegra_ehci2_device\n"); mdm_peripheral_disconnect(mdm_drv); pr_info("mdm_status_changed: register:tegra_ehci2_device\n"); mdm_peripheral_connect(mdm_drv); gpio_direction_output(TEGRA_GPIO_PC6, 1); //TEGRA_GPIO_PC6 tegra_gpio_enable(TEGRA_GPIO_PC6); gpio_set_value(TEGRA_GPIO_PC6, 1); */ pr_info("mdm_status_changed: unregister:tegra_ehci2_device\n"); mdm_peripheral_disconnect(mdm_drv); pr_info("mdm_status_changed: register:tegra_ehci2_device\n"); pr_info("mdm_status_changed: +mdm_peripheral_connect\n"); mdm_peripheral_connect(mdm_drv); pr_info("mdm_status_changed: -mdm_peripheral_connect\n"); //TEGRA_GPIO_PC6 gpio_direction_output(mdm_drv->ap2mdm_wakeup_gpio, 1); tegra_gpio_enable(mdm_drv->ap2mdm_wakeup_gpio); gpio_set_value(mdm_drv->ap2mdm_wakeup_gpio, 1); /* HTC added start */ mdm9k_status = 1; /* HTC added end */ } }
static void mdm_do_soft_power_on(struct mdm_modem_drv *mdm_drv) { #ifdef USE_MDM_MODEM int i; int pblrdy; #endif pr_err("%s: id %d: soft resetting mdm modem\n", __func__, mdm_drv->device_id); mdm_peripheral_disconnect(mdm_drv); mdm_toggle_soft_reset(mdm_drv); #ifdef USE_MDM_MODEM if (!GPIO_IS_VALID(MDM_GPIO(MDM2AP_PBLRDY))) goto start_mdm_peripheral; for (i = 0; i < MDM_PBLRDY_CNT; i++) { pblrdy = gpio_get_value(MDM_GPIO(MDM2AP_PBLRDY)); if (pblrdy) break; usleep_range(5000, 5000); } pr_info("%s: id %d: pblrdy i:%d\n", __func__, mdm_drv->device_id, i); start_mdm_peripheral: #endif mdm_peripheral_connect(mdm_drv); msleep(200); }
static void mdm_do_soft_power_on(struct mdm_modem_drv *mdm_drv) { int i; int pblrdy; pr_err("%s: soft resetting mdm modem\n", __func__); mdm_peripheral_disconnect(mdm_drv); mdm_toggle_soft_reset(mdm_drv); if (!GPIO_IS_VALID(mdm_drv->mdm2ap_pblrdy)) goto start_mdm_peripheral; for (i = 0; i < MDM_PBLRDY_CNT; i++) { pblrdy = gpio_get_value(mdm_drv->mdm2ap_pblrdy); if (pblrdy) break; usleep_range(5000, 5000); } pr_debug("%s: i:%d\n", __func__, i); start_mdm_peripheral: mdm_peripheral_connect(mdm_drv); msleep(200); }
static void mdm_status_changed(struct mdm_modem_drv *mdm_drv, int value) { pr_info("%s: MDM2AP_STATUS_GPIO changed to %d\n", __func__, value); if (value) { mdm_peripheral_disconnect(mdm_drv); mdm_peripheral_connect(mdm_drv); gpio_direction_output(mdm_drv->ap2mdm_wakeup_gpio, 1); } }
static void mdm_status_changed(struct mdm_modem_drv *mdm_drv, int value) { pr_debug("%s: value:%d\n", __func__, value); if (value) { mdm_peripheral_disconnect(mdm_drv); mdm_peripheral_connect(mdm_drv); if (GPIO_IS_VALID(mdm_drv->ap2mdm_wakeup_gpio)) gpio_direction_output(mdm_drv->ap2mdm_wakeup_gpio, 1); } }
static void mdm_status_changed(struct mdm_modem_drv *mdm_drv, int value) { pr_debug("%s: value:%d\n", __func__, value); pr_err("%s: ap2mdm_status = %d\n", __func__, gpio_get_value(mdm_drv->ap2mdm_status_gpio)); if (value) { mdm_peripheral_disconnect(mdm_drv); mdm_peripheral_connect(mdm_drv); gpio_direction_output(mdm_drv->ap2mdm_wakeup_gpio, 1); } }
static void power_on_mdm(struct mdm_modem_drv *mdm_drv) { int hsic_ready_timeout_ms = 100; power_on_count++; if (power_on_count == 2) return; mdm_peripheral_disconnect(mdm_drv); gpio_direction_output(mdm_drv->ap2mdm_status_gpio, 0); gpio_direction_output(mdm_drv->ap2mdm_wakeup_gpio, 0); pr_debug("Pulling RESET gpio low\n"); gpio_direction_output(mdm_drv->ap2mdm_pmic_reset_n_gpio, 0); usleep_range(5000, 10000); pr_debug("%s: Pulling RESET gpio high\n", __func__); gpio_direction_output(mdm_drv->ap2mdm_pmic_reset_n_gpio, 1); msleep(40); gpio_direction_output(mdm_drv->ap2mdm_status_gpio, 1); while (!gpio_get_value(mdm_drv->mdm2ap_hsic_ready_gpio) && hsic_ready_timeout_ms>0) { msleep(10); hsic_ready_timeout_ms -= 10; pr_info("%s: waiting for MDM HSIC READY signal.\r\n", __func__); }; if (!gpio_get_value(mdm_drv->mdm2ap_hsic_ready_gpio)) pr_err("%s: MDM HSIC READY timeout!\r\n", __func__); mdm_peripheral_connect(mdm_drv); usleep(1000); if (power_on_count == 1) { if (mdm_drv->ap2mdm_kpdpwr_n_gpio > 0) { pr_debug("%s: Powering on mdm modem\n", __func__); gpio_direction_output(mdm_drv->ap2mdm_kpdpwr_n_gpio, 1); usleep(1000); } } msleep(200); }
static void power_on_mdm(struct mdm_modem_drv *mdm_drv) { power_on_count++; pr_err("%s: power count %d\n", __func__, power_on_count); /* this gpio will be used to indicate apq readiness, * de-assert it now so that it can asserted later */ gpio_direction_output(mdm_drv->ap2mdm_wakeup_gpio, 0); /* The second attempt to power-on the mdm is the first attempt * from user space, but we're already powered on. Ignore this. * Subsequent attempts are from SSR or if something failed, in * which case we must always reset the modem. */ if (power_on_count == 2) return; mdm_peripheral_disconnect(mdm_drv); /* Pull RESET gpio low and wait for it to settle. */ pr_info("Pulling RESET gpio low\n"); gpio_direction_output(mdm_drv->ap2mdm_pmic_reset_n_gpio, 0); usleep_range(5000, 10000); /* Deassert RESET first and wait for ir to settle. */ pr_info("%s: Pulling RESET gpio high\n", __func__); gpio_direction_output(mdm_drv->ap2mdm_pmic_reset_n_gpio, 1); msleep(20); /* Pull PWR gpio high and wait for it to settle, but only * the first time the mdm is powered up. * Some targets do not use ap2mdm_kpdpwr_n_gpio. */ if (power_on_count == 1) { if (mdm_drv->ap2mdm_kpdpwr_n_gpio > 0) { pr_debug("%s: Powering on mdm modem\n", __func__); gpio_direction_output(mdm_drv->ap2mdm_kpdpwr_n_gpio, 1); usleep_range(1000, 1000); } } #ifdef CONFIG_ARCH_EXYNOS gpio_direction_output(mdm_drv->ap2mdm_status_gpio, 1); #endif mdm_peripheral_connect(mdm_drv); msleep(200); }
static void mdm_status_changed(struct mdm_modem_drv *mdm_drv, int value) { if (!mdm_drv->pdata->peripheral_platform_device) return; pr_debug("%s: id %d: value:%d\n", __func__, value, mdm_drv->device_id); if (value) { mdm_peripheral_disconnect(mdm_drv); msleep(100); mdm_peripheral_connect(mdm_drv); if (GPIO_IS_VALID(MDM_GPIO(AP2MDM_WAKEUP))) gpio_direction_output(MDM_GPIO(AP2MDM_WAKEUP), 1); } }
static void mdm_status_changed(struct mdm_modem_drv *mdm_drv, int value) { pr_debug("%s: value:%d\n", __func__, value); if (value) { mdm_peripheral_disconnect(mdm_drv); mdm_peripheral_connect(mdm_drv); if (mdm_drv->ap2mdm_wakeup_gpio > 0) { if (gpio_get_value(mdm_drv->ap2mdm_wakeup_gpio)) { gpio_set_value(mdm_drv->ap2mdm_wakeup_gpio, 0); mdelay(5); } gpio_direction_output(mdm_drv->ap2mdm_wakeup_gpio, 1); } } }
static void mdm_do_soft_power_on(struct mdm_modem_drv *mdm_drv) { int soft_reset_direction = mdm_drv->pdata->soft_reset_inverted ? 0 : 1; /* De-assert the soft reset line. */ pr_err("%s: soft resetting mdm modem\n", __func__); mdm_peripheral_disconnect(mdm_drv); gpio_direction_output(mdm_drv->ap2mdm_soft_reset_gpio, soft_reset_direction == 1 ? 0 : 1); usleep_range(5000, 10000); gpio_direction_output(mdm_drv->ap2mdm_soft_reset_gpio, soft_reset_direction == 1 ? 1 : 0); mdm_peripheral_connect(mdm_drv); msleep(200); }
static void mdm_do_first_power_on(struct mdm_modem_drv *mdm_drv) { #ifdef USE_MDM_MODEM int i; int pblrdy; #endif gpio_direction_output(MDM_GPIO(AP2MDM_SOFT_RESET), 0); gpio_direction_output(MDM_GPIO(AP2MDM_PMIC_PWR_EN), 1); msleep(10); if (mdm_drv->power_on_count != 1) { pr_debug("%s:id %d: Calling fn when power_on_count != 1\n", __func__, mdm_drv->device_id); return; } pr_err("%s \n", __func__); pr_err("%s:id %d: Powering on modem for the first time\n", __func__, mdm_drv->device_id); mdm_peripheral_disconnect(mdm_drv); /* If this is the first power-up after a panic, the modem may still * be in a power-on state, in which case we need to toggle the gpio * instead of just de-asserting it. No harm done if the modem was * powered down. */ if (!mdm_drv->pdata->no_reset_on_first_powerup) mdm_toggle_soft_reset(mdm_drv); /* If the device has a kpd pwr gpio then toggle it. */ if (GPIO_IS_VALID(MDM_GPIO(AP2MDM_KPDPWR))) { // HSLEE qsc en /* Pull AP2MDM_KPDPWR gpio high and wait for PS_HOLD to settle, * then pull it back low. */ pr_err("%s:id %d: Pulling AP2MDM_KPDPWR gpio high\n", __func__, mdm_drv->device_id); gpio_direction_output(MDM_GPIO(AP2MDM_KPDPWR), 1); //gpio_direction_output(MDM_GPIO(AP2MDM_STATUS), 1); msleep(1000); gpio_direction_output(MDM_GPIO(AP2MDM_KPDPWR), 0); }//else gpio_direction_output(MDM_GPIO(AP2MDM_STATUS), 1); msleep(5000); if (!gpio_get_value(MDM_GPIO(MDM2AP_STATUS))) { pr_err("%s: QSC failed. reboot\n", __func__); gpio_direction_output(MDM_GPIO(AP2MDM_STATUS), 0); gpio_direction_output(MDM_GPIO(AP2MDM_PMIC_PWR_EN), 0); msleep(5000); gpio_direction_output(MDM_GPIO(AP2MDM_PMIC_PWR_EN), 1); msleep(10); gpio_direction_output(MDM_GPIO(AP2MDM_KPDPWR), 1); msleep(1000); gpio_direction_output(MDM_GPIO(AP2MDM_KPDPWR), 0); gpio_direction_output(MDM_GPIO(AP2MDM_STATUS), 1); } /* check if qsc is in dload mode */ if (gpio_get_value(MDM_GPIO(MDM2AP_ERRFATAL))) { pr_err("%s: QSC is in dload. reset\n", __func__); gpio_direction_output(MDM_GPIO(AP2MDM_SOFT_RESET), 1); mdelay(10); gpio_direction_output(MDM_GPIO(AP2MDM_SOFT_RESET), 0); } #ifdef USE_MDM_MODEM if (!GPIO_IS_VALID(MDM_GPIO(MDM2AP_PBLRDY))) goto start_mdm_peripheral; for (i = 0; i < MDM_PBLRDY_CNT; i++) { pblrdy = gpio_get_value(MDM_GPIO(MDM2AP_PBLRDY)); if (pblrdy) break; usleep_range(5000, 5000); } pr_info("%s: id %d: pblrdy i:%d\n", __func__, mdm_drv->device_id, i); start_mdm_peripheral: #endif pr_err("%s %d\n", __func__,__LINE__); mdm_peripheral_connect(mdm_drv); msleep(200); }
static void power_on_mdm(struct mdm_modem_drv *mdm_drv) { int mfg_mode; pr_info("+power_on_mdm\n"); mfg_mode = board_mfg_mode(); if (mfg_mode == BOARD_MFG_MODE_OFFMODE_CHARGING) { pr_info("-power_on_mdm: offmode charging\n"); return; } if (first_power_on) { pr_info("+power_on_mdm:add tegra_ehci2_device\n"); platform_device_register(&tegra_ehci2_device); } else { pr_info("+power_on_mdm:mdm_peripheral_disconnect\n"); mdm_peripheral_disconnect(mdm_drv); pr_info("+power_on_mdm:mdm_peripheral_connect\n"); mdm_peripheral_connect(mdm_drv); } //++SSD_RIL: Mars_Lin@20120606: Print related GPIO setting mdm2_dump_mdm_related_gpio( mdm_drv, "Before power on" ); //--SSD_RIL gpio_direction_output(mdm_drv->ap2mdm_wakeup_gpio, 0); tegra_gpio_enable(mdm_drv->ap2mdm_wakeup_gpio); gpio_set_value(mdm_drv->ap2mdm_wakeup_gpio, 0); //++SSD_RIL: Mars_Lin@20120606:Change J0 to TEGRA_PUPD_PULL_DOWN tegra_pinmux_set_pullupdown(gpio_to_pingroup[mdm_drv->mdm2ap_hsic_ready_gpio], TEGRA_PUPD_PULL_DOWN); //--SSD_RIL //++SSD_RIL: Mars_Lin@20120709: Set mdm_ready to 0 before power on mdm mdm_drv->mdm_ready = 0; //--SSD_RIL /* Pull RESET gpio low and wait for it to settle. */ pr_info("%s: Pulling RESET gpio low\n", __func__); gpio_direction_output(mdm_drv->ap2mdm_pmic_reset_n_gpio, 0); //TEGRA_GPIO_PP7 tegra_gpio_enable(mdm_drv->ap2mdm_pmic_reset_n_gpio); gpio_set_value(mdm_drv->ap2mdm_pmic_reset_n_gpio, 0); usleep_range(5000, 10000); /* Deassert RESET first and wait for it to settle. */ pr_info("%s: Pulling RESET gpio high\n", __func__); gpio_direction_output(mdm_drv->ap2mdm_pmic_reset_n_gpio, 1); tegra_gpio_enable(mdm_drv->ap2mdm_pmic_reset_n_gpio); gpio_set_value(mdm_drv->ap2mdm_pmic_reset_n_gpio, 1); msleep(40); //++SSD_RIL:20120705: pull ap2mdm_status GPIO to high gpio_direction_output(mdm_drv->ap2mdm_status_gpio, 1); //--SSD_RIL //++SSD_RIL: Mars_Lin@20120608: enable irq after power on mdm mdm_common_enable_irq(mdm_drv, MDM_MODEM_IRQ_ENABLE); //--SSD_RIL //++SSD_RIL: Mars_Lin@20120606:Change J0 to NO_PULL tegra_pinmux_set_pullupdown(gpio_to_pingroup[mdm_drv->mdm2ap_hsic_ready_gpio], TEGRA_PUPD_NORMAL); //--SSD_RIL msleep(40); /* Pull PWR gpio high and wait for it to settle, but only * the first time the mdm is powered up. * Some targets do not use ap2mdm_kpdpwr_n_gpio. */ if (first_power_on) { if (mdm_drv->ap2mdm_kpdpwr_n_gpio > 0) { int ret2; pr_info("%s: Powering on mdm modem:mdm_drv->ap2mdm_kpdpwr_n_gpio = (%d)\n", __func__,mdm_drv->ap2mdm_kpdpwr_n_gpio); ret2 = gpio_direction_output(mdm_drv->ap2mdm_kpdpwr_n_gpio, 1); if (ret2 < 0) { pr_err("%s: gpio_direction_output failed %d\n", __func__, ret2); gpio_free(mdm_drv->ap2mdm_kpdpwr_n_gpio); return; } tegra_gpio_enable(mdm_drv->ap2mdm_kpdpwr_n_gpio); gpio_set_value(mdm_drv->ap2mdm_kpdpwr_n_gpio, 1); udelay(1000); } first_power_on = 0; } else { //pr_info("+power_on_mdm:mdm_peripheral_connect\n"); //mdm_peripheral_connect(mdm_drv); } msleep(200); pr_info("-power_on_mdm\n"); }
static void power_on_mdm(struct mdm_modem_drv *mdm_drv) { int hsic_ready_timeout_ms = 100; power_on_count++; /* The second attempt to power-on the mdm is the first attempt * from user space, but we're already powered on. Ignore this. * Subsequent attempts are from SSR or if something failed, in * which case we must always reset the modem. */ if (power_on_count == 2) return; mdm_peripheral_disconnect(mdm_drv); /* Leakege might cause abnormal MDM status. Output ap2mdm_status low to avoid leakege. */ gpio_direction_output(mdm_drv->ap2mdm_status_gpio, 0); /* this gpio will be used to indicate apq readiness, * de-assert it now so that it can asserted later */ gpio_direction_output(mdm_drv->ap2mdm_wakeup_gpio, 0); /* Pull RESET gpio low and wait for it to settle. */ pr_debug("Pulling RESET gpio low\n"); gpio_direction_output(mdm_drv->ap2mdm_pmic_reset_n_gpio, 0); usleep_range(5000, 10000); /* Deassert RESET first and wait for it to settle. */ pr_debug("%s: Pulling RESET gpio high\n", __func__); gpio_direction_output(mdm_drv->ap2mdm_pmic_reset_n_gpio, 1); msleep(40); /* re-enable ap2mdm_status after mdm is ready. *According to HW measurement, mdm takes abort 50ms to enter PBL */ gpio_direction_output(mdm_drv->ap2mdm_status_gpio, 1); /* QCT workaround: Keep the host HSIC in reset until the MDM9x15M has come out of reset. QCT has defined GPIO79(HSIC_DEVICE_READY) in the primany boot loader(PBL) to hold the host HSIC reset. HSIC_DEVUCE_READY will go high when the MDM9x15M device has powered up and is ready for HSIC enumeration. */ while (!gpio_get_value(mdm_drv->mdm2ap_hsic_ready_gpio) && hsic_ready_timeout_ms>0) { msleep(10); hsic_ready_timeout_ms -= 10; pr_info("%s: waiting for MDM HSIC READY signal.\r\n", __func__); }; if (!gpio_get_value(mdm_drv->mdm2ap_hsic_ready_gpio)) pr_err("%s: MDM HSIC READY timeout!\r\n", __func__); mdm_peripheral_connect(mdm_drv); usleep(1000); /* Pull PWR gpio high and wait for it to settle, but only * the first time the mdm is powered up. * Some targets do not use ap2mdm_kpdpwr_n_gpio. */ if (power_on_count == 1) { if (mdm_drv->ap2mdm_kpdpwr_n_gpio > 0) { pr_debug("%s: Powering on mdm modem\n", __func__); gpio_direction_output(mdm_drv->ap2mdm_kpdpwr_n_gpio, 1); usleep(1000); } } msleep(200); }
static void mdm_do_first_power_on(struct mdm_modem_drv *mdm_drv) { int i; int pblrdy; if (power_on_count != 1) { pr_err("%s: Calling fn when power_on_count != 1\n", __func__); return; } pr_err("%s: Powering on modem for the first time\n", __func__); gpio_direction_output(mdm_drv->ap2mdm_wakeup_gpio, 0); mdm_peripheral_disconnect(mdm_drv); /* If this is the first power-up after a panic, the modem may still * be in a power-on state, in which case we need to toggle the gpio * instead of just de-asserting it. No harm done if the modem was * powered down. */ mdm_toggle_soft_reset(mdm_drv); /* If the device has a kpd pwr gpio then toggle it. */ if (mdm_drv->ap2mdm_kpdpwr_n_gpio > 0) { /* Pull AP2MDM_KPDPWR gpio high and wait for PS_HOLD to settle, * then pull it back low. */ pr_debug("%s: Pulling AP2MDM_KPDPWR gpio high\n", __func__); gpio_direction_output(mdm_drv->ap2mdm_kpdpwr_n_gpio, 1); msleep(1000); gpio_direction_output(mdm_drv->ap2mdm_kpdpwr_n_gpio, 0); } /* first power charged after 10ms */ usleep_range(10000, 15000); gpio_direction_output(mdm_drv->ap2mdm_status_gpio, 1); #ifdef CONFIG_HSIC_EURONLY_APPLY for (i = 0; i < MDM_PBLRDY_CNT; i++) { pblrdy = gpio_get_value(mdm_drv->mdm2ap_pblrdy); if (pblrdy) break; usleep_range(5000, 5000); } pr_err("%s: i:%d\n", __func__, i); #else if (!mdm_drv->mdm2ap_pblrdy) goto start_mdm_peripheral; for (i = 0; i < MDM_PBLRDY_CNT; i++) { pblrdy = gpio_get_value(mdm_drv->mdm2ap_pblrdy); if (pblrdy) break; usleep_range(5000, 5000); } pr_debug("%s: i:%d\n", __func__, i); #endif start_mdm_peripheral: mdm_peripheral_connect(mdm_drv); msleep(200); }