int mdm6600_init_modemctl_device(struct modem_ctl *mc, struct modem_data *pdata) { int ret; struct platform_device *pdev; mc->gpio_cp_on = pdata->gpio_cp_on; mc->gpio_cp_reset = pdata->gpio_cp_reset; mc->gpio_pda_active = pdata->gpio_pda_active; mc->gpio_phone_active = pdata->gpio_phone_active; mc->gpio_cp_reset_msm = pdata->gpio_cp_reset_msm; mc->gpio_boot_sw_sel = pdata->gpio_boot_sw_sel; mc->vbus_on = pdata->vbus_on; mc->vbus_off = pdata->vbus_off; mc->irq_phone_active = pdata->irq_phone_active; if (!mc->irq_phone_active) { mif_err("%s: ERR! get irq_phone_active fail\n", mc->name); return -1; } pr_info("[MODEM_IF] <%s> PHONE_ACTIVE IRQ# = %d\n", __func__, mc->irq_phone_active); mdm6600_get_ops(mc); ret = request_irq(mc->irq_phone_active, phone_active_irq_handler, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "phone_active", mc); if (ret) { pr_err("[MODEM_IF] %s: failed to request_irq:%d\n", __func__, ret); goto err_request_irq; } ret = enable_irq_wake(mc->irq_phone_active); if (ret) { pr_err("[MODEM_IF] %s: failed to enable_irq_wake:%d\n", __func__, ret); goto err_set_wake_irq; } return ret; err_set_wake_irq: free_irq(mc->irq_phone_active, mc); err_request_irq: return ret; }
int mdm6600_init_modemctl_device(struct modem_ctl *mc, struct modem_data *pdata) { int ret = 0; struct platform_device *pdev; #if defined(CONFIG_MACH_GRANDE) int irq_ipc_host_wakeup = 0; #endif mc->gpio_cp_on = pdata->gpio_cp_on; mc->gpio_reset_req_n = pdata->gpio_reset_req_n; mc->gpio_cp_reset = pdata->gpio_cp_reset; mc->gpio_pda_active = pdata->gpio_pda_active; mc->gpio_phone_active = pdata->gpio_phone_active; mc->gpio_cp_dump_int = pdata->gpio_cp_dump_int; mc->gpio_flm_uart_sel = pdata->gpio_flm_uart_sel; #if defined(CONFIG_MACH_M0_CTC) mc->gpio_flm_uart_sel_rev06 = pdata->gpio_flm_uart_sel_rev06; #endif mc->gpio_cp_warm_reset = pdata->gpio_cp_warm_reset; mc->gpio_sim_detect = pdata->gpio_sim_detect; #if defined(CONFIG_MACH_GRANDE) mc->gpio_host_wakeup = pdata->gpio_host_wakeup; #endif gpio_set_value(mc->gpio_cp_reset, 0); gpio_set_value(mc->gpio_cp_on, 0); pdev = to_platform_device(mc->dev); mc->irq_phone_active = platform_get_irq_byname(pdev, "cp_active_irq"); pr_info("[MSM] <%s> PHONE_ACTIVE IRQ# = %d\n", __func__, mc->irq_phone_active); mdm6600_get_ops(mc); ret = request_irq(mc->irq_phone_active, phone_active_irq_handler, IRQF_TRIGGER_HIGH, "msm_active", mc); if (ret) { pr_err("[MSM] <%s> failed to request_irq IRQ# %d (err=%d)\n", __func__, mc->irq_phone_active, ret); return ret; } ret = enable_irq_wake(mc->irq_phone_active); if (ret) { pr_err("[MSM] %s: failed to enable_irq_wake IRQ# %d (err=%d)\n", __func__, mc->irq_phone_active, ret); free_irq(mc->irq_phone_active, mc); return ret; } #if defined(CONFIG_SIM_DETECT) #if defined(CONFIG_MACH_GRANDE) INIT_DELAYED_WORK(&mc->sim_det_dwork, sim_detect_work); #endif mc->irq_sim_detect = platform_get_irq_byname(pdev, "sim_irq"); pr_info("[MSM] <%s> SIM_DECTCT IRQ# = %d\n", __func__, mc->irq_sim_detect); if (mc->irq_sim_detect) { ret = request_irq(mc->irq_sim_detect, sim_detect_irq_handler, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "msm_sim_detect", mc); if (ret) { mif_err("[MSM] failed to request_irq: %d\n", ret); mc->sim_state.online = false; mc->sim_state.changed = false; return ret; } ret = enable_irq_wake(mc->irq_sim_detect); if (ret) { mif_err("[MSM] failed to enable_irq_wake: %d\n", ret); free_irq(mc->irq_sim_detect, mc); mc->sim_state.online = false; mc->sim_state.changed = false; return ret; } /* initialize sim_state => insert: gpio=0, remove: gpio=1 */ mc->sim_state.online = !gpio_get_value(mc->gpio_sim_detect); } #endif #if defined(CONFIG_MACH_GRANDE) /* Register ipc_host_waitup irq */ wake_lock_init(&mc->host_wake_lock, WAKE_LOCK_SUSPEND, "msm_ipc_host_wake"); pr_info("[MSM] <%s> IPC_HOST_WAKEUP IRQ# = %d\n", __func__, mc->gpio_host_wakeup); if (mc->gpio_host_wakeup) { irq_ipc_host_wakeup = gpio_to_irq(mc->gpio_host_wakeup); ret = request_threaded_irq(irq_ipc_host_wakeup, NULL, host_wakeup_irq_handler, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "msm_ipc_host_wakeup", mc); if (ret) { mif_err("[MSM] Failed to request_threaded_irq : %d\n", irq_ipc_host_wakeup); return ret; } ret = enable_irq_wake(irq_ipc_host_wakeup); if (ret) { mif_err("[MSM] Failed to request_threaded_irq : %d\n", irq_ipc_host_wakeup); return ret; } } #endif return ret; }
int mdm6600_init_modemctl_device(struct modem_ctl *mc, struct modem_data *pdata) { int ret = 0; struct platform_device *pdev; mc->gpio_cp_on = pdata->gpio_cp_on; mc->gpio_reset_req_n = pdata->gpio_reset_req_n; mc->gpio_cp_reset = pdata->gpio_cp_reset; mc->gpio_pda_active = pdata->gpio_pda_active; mc->gpio_phone_active = pdata->gpio_phone_active; mc->gpio_cp_dump_int = pdata->gpio_cp_dump_int; mc->gpio_flm_uart_sel = pdata->gpio_flm_uart_sel; #if defined(CONFIG_MACH_M0_CTC) mc->gpio_flm_uart_sel_rev06 = pdata->gpio_flm_uart_sel_rev06; #endif mc->gpio_cp_warm_reset = pdata->gpio_cp_warm_reset; mc->gpio_sim_detect = pdata->gpio_sim_detect; #if defined(CONFIG_LINK_DEVICE_PLD) mc->gpio_fpga_cs_n = pdata->gpio_fpga2_cs_n; #endif gpio_set_value(mc->gpio_cp_reset, 0); gpio_set_value(mc->gpio_cp_on, 0); mc->irq_phone_active = pdata->irq_phone_active; if (!mc->irq_phone_active) { mif_err("%s: ERR! get irq_phone_active fail\n", mc->name); return -1; } pr_info("[MSM] <%s> PHONE_ACTIVE IRQ# = %d\n", __func__, mc->irq_phone_active); mdm6600_get_ops(mc); ret = request_irq(mc->irq_phone_active, phone_active_irq_handler, IRQF_TRIGGER_HIGH, "msm_active", mc); if (ret) { pr_err("[MSM] <%s> failed to request_irq IRQ# %d (err=%d)\n", __func__, mc->irq_phone_active, ret); return ret; } ret = enable_irq_wake(mc->irq_phone_active); if (ret) { pr_err("[MSM] %s: failed to enable_irq_wake IRQ# %d (err=%d)\n", __func__, mc->irq_phone_active, ret); free_irq(mc->irq_phone_active, mc); return ret; } #if defined(CONFIG_SIM_DETECT) mc->irq_sim_detect = pdata->irq_sim_detect; pr_info("[MSM] <%s> SIM_DECTCT IRQ# = %d\n", __func__, mc->irq_sim_detect); if (mc->irq_sim_detect) { ret = request_irq(mc->irq_sim_detect, sim_detect_irq_handler, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "msm_sim_detect", mc); if (ret) { mif_err("[MSM] failed to request_irq: %d\n", ret); mc->sim_state.online = false; mc->sim_state.changed = false; return ret; } ret = enable_irq_wake(mc->irq_sim_detect); if (ret) { mif_err("[MSM] failed to enable_irq_wake: %d\n", ret); free_irq(mc->irq_sim_detect, mc); mc->sim_state.online = false; mc->sim_state.changed = false; return ret; } /* initialize sim_state => insert: gpio=0, remove: gpio=1 */ mc->sim_state.online = !gpio_get_value(mc->gpio_sim_detect); } #endif return ret; }