/*
 * RESET2_N worker
 */
static void xmd_boot_reset2_work (struct work_struct *work)
{
	int val;

	val = gpio_get_value(b->boot_platform_data->reset2_gpio);
	pr_info("XMD: RESET2_N transition: %d, on_off_gpio: %d;\n", val,gpio_get_value(b->boot_platform_data->on_off_gpio) );
	if( 1==val ) {
            set_xmd_ack_cp_ready( XMD_STATE_POWER );
            gpio_set_value(b->boot_platform_data->on_off_gpio, 0);
            xmd_omap_mux_init_signal(b->boot_platform_data->on_off_safe_pinmux);
            pr_info("XMD: %s. RESET2_N rising edge: modem PMU on at %u ms, clear on_off_gpio to %d;\n",
                            __func__,jiffies_to_msecs(jiffies),gpio_get_value(b->boot_platform_data->on_off_gpio) );
	    xmd_change_notify_event(XMD_STATE_POWER);
	} else {
            set_xmd_ack_cp_ready( XMD_STATE_OFF );
            pr_info("XMD: %s. RESET2_N falling edge: MODEM ABNORMAL POWER OFF!!!;\n", __func__ );
            /* modem abnormal power off handing */
            if (cp_shutdown_get() == false){
                notify_mdm_off_to_pm();
                pr_info("notify modem hardware shutdown to PM");
            }
            xmd_change_notify_event(XMD_STATE_OFF);
	}

	return;
}
Exemplo n.º 2
0
static void xmm_power_reset_work(struct work_struct *work)
{
	/* TODO: add pm func here */
	if (cp_shutdown_get() == false){
		notify_mdm_off_to_pm();
		pr_info("notify modem hardware shutdown to PM");
	}
	int i = 0;
	while(i++ < MAX_MODEM_RESET_CHECK_TIMES) {
		msleep(10);
		if (gpio_get_value(GPIO_RESET_IND) == 1) {
			pr_notice("xmm_power: modem software reset\n");
			break;
		}
	}

	if (i >= MAX_MODEM_RESET_CHECK_TIMES)
		pr_notice("xmm_power: modem hardware reset\n");

	xmm_change_notify_event(XMM_STATE_OFF);
}