Пример #1
0
static void phy_ready(void)
{
	int modemstate = bb_getpowerstate();

	if (dlevel & DLEVEL_PM)
		pr_info("%s.\n", __func__);

	switch (modemstate) {
	case BBSTATE_UNKNOWN:
		/* Wait for CP to indicate ready - by driving USB_CWR high. */
		if (gpio_wait_timeout(bb_sdata.gpio_cwr, 1, 10) != 0) {
			pr_info("%s: Timeout 4 modem ready. Maybe 1st enum ?\n",
							 __func__);
			/* For first enumeration don't drive AWR high */
			break;
		}

		/* Signal AP ready - Drive USB_AWR high. */
		pr_info("%s : Driving AWR high.\n", __func__);
		bb_set_awr(1);
		break;
	default:
		pr_err("%s: Error. Unexp modemstate %x. Should be %d.\n",
				__func__, modemstate, BBSTATE_UNKNOWN);
		break;
	}
}
static int m7400_enum_handshake(void)
{
	int retval = 0;

	/* Wait for CP to indicate ready - by driving USB_CWR high. */
	if (gpio_wait_timeout(gpio_cwr, 1, 10) != 0) {
			pr_info("%s: Error: timeout waiting for modem resume.\n",
							__func__);
			retval = -1;
	}

	/* Signal AP ready - Drive USB_AWR high. */
	gpio_set_value(gpio_awr, 1);

	return retval;
}
static int m7400_apup_handshake(bool checkresponse)
{
	int retval = 0;

	/* Signal AP ready - Drive USB_AWR high. */
	gpio_set_value(gpio_awr, 1);

	if (checkresponse) {
		/* Wait for CP ack - by driving USB_CWR high. */
		if (gpio_wait_timeout(gpio_cwr, 1, 10) != 0) {
			pr_info("%s: Error: timeout waiting for modem ack.\n",
							__func__);
			retval = -1;
		}
	}
	return retval;
}
Пример #4
0
static int apup_handshake(bool checkresponse)
{
	int retval = 0;

	/* Signal AP ready - Drive USB_AWR high. */
	bb_set_awr(1);

	if (checkresponse) {
		/* Wait for CP ack - by driving USB_CWR high. */
		if (gpio_wait_timeout(bb_sdata.gpio_cwr, 1,
					WAKE_TIMEOUT_MS) != 0) {
			pr_err("%s: Error: Timeout waiting for modem ack.\n",
							__func__);
			retval = -1;
		}
	}
	return retval;
}
Пример #5
0
static void m7400_l2_resume(void)
{
    /* Gets called for two cases :
    	a) L2 resume.
    	b) bus resume phase of L3 resume. */
    if (modem_status == BBSTATE_L0)
        return;

    /* Pre bus resume: Drive ARR high. */
    gpio_set_value(gpio_arr, 1);

    /* If host initiated resume - Wait for CP ack (CWR goes high). */
    /* If device initiated resume - CWR will be already high. */
    if (gpio_wait_timeout(gpio_cwr, 1, 10) != 0) {
        pr_info("%s: Error: timeout waiting for modem ack.\n",
                __func__);
        return;
    }
    modem_status = BBSTATE_L0;
}