void set_hsic_lpa_states(int states)
{
	int val = gpio_get_value(umts_modem_data.gpio_cp_reset);
	struct modemlink_pm_data *pm_data = &umts_link_pm_data;

	mif_trace("\n");

	if (val) {
		switch (states) {
		case STATE_HSIC_LPA_ENTER:
			mif_info("lpa_enter\n");
			/* gpio_link_active == gpio_host_active in C1 */
			gpio_set_value(umts_modem_data.gpio_host_active, 0);
			mif_info("> H-ACT %d\n", 0);
			if (pm_data->hub_standby && pm_data->hub_pm_data)
				pm_data->hub_standby(pm_data->hub_pm_data);
			break;
		case STATE_HSIC_LPA_WAKE:
			mif_info("lpa_wake\n");
			gpio_set_value(umts_modem_data.gpio_host_active, 1);
			mif_info("> H-ACT %d\n", 1);
			break;
		case STATE_HSIC_LPA_PHY_INIT:
			mif_info("lpa_phy_init\n");
			if (!modem_using_hub() && active_ctl.gpio_initialized)
				set_slave_wake();
			break;
		}
	}
}
Ejemplo n.º 2
0
void set_hsic_lpa_states(int states)
{
    int val = gpio_get_value(umts_modem_data.gpio_cp_reset);

    mif_trace("\n");

    if (val) {
        switch (states) {
        case STATE_HSIC_LPA_ENTER:
            gpio_set_value(modem_link_pm_data.gpio_link_active, 0);
            gpio_set_value(umts_modem_data.gpio_pda_active, 0);
            mif_info("enter: active state(%d), pda active(%d)\n",
                     gpio_get_value(
                         modem_link_pm_data.gpio_link_active),
                     gpio_get_value(umts_modem_data.gpio_pda_active)
                    );
            break;
        case STATE_HSIC_LPA_WAKE:
            gpio_set_value(umts_modem_data.gpio_pda_active, 1);
            mif_info("wake: pda active(%d)\n",
                     gpio_get_value(umts_modem_data.gpio_pda_active)
                    );
            break;
        case STATE_HSIC_LPA_PHY_INIT:
            gpio_set_value(umts_modem_data.gpio_pda_active, 1);
            break;
        }
    }
}
Ejemplo n.º 3
0
void set_hsic_lpa_states(int states)
{
	int val = gpio_get_value(umts_modem_data.gpio_cp_reset);

	mif_trace("\n");

	if (val) {
		switch (states) {
		case STATE_HSIC_LPA_ENTER:
			gpio_set_value(modem_link_pm_data.gpio_link_active, 0);
			gpio_set_value(umts_modem_data.gpio_pda_active, 0);
			pr_info(LOG_TAG "set hsic lpa enter: "
				"active state (%d)" ", pda active (%d)\n",
				gpio_get_value(
					modem_link_pm_data.gpio_link_active),
				gpio_get_value(umts_modem_data.gpio_pda_active)
				);
			break;
		case STATE_HSIC_LPA_WAKE:
			gpio_set_value(umts_modem_data.gpio_pda_active, 1);
			pr_info(LOG_TAG "set hsic lpa wake: "
				"pda active (%d)\n",
				gpio_get_value(umts_modem_data.gpio_pda_active)
				);
			break;
		case STATE_HSIC_LPA_PHY_INIT:
			gpio_set_value(umts_modem_data.gpio_pda_active, 1);
			gpio_set_value(modem_link_pm_data.gpio_link_slavewake,
				1);
			pr_info(LOG_TAG "set hsic lpa phy init: "
				"slave wake-up (%d)\n",
				gpio_get_value(
					modem_link_pm_data.gpio_link_slavewake)
				);
			break;
		}
	}
}
static void link_pm_hub_work(struct work_struct *work)
{
	int err, cnt;
	struct link_pm_data *pm_data =
		container_of(work, struct link_pm_data, link_pm_hub.work);

	if (pm_data->hub_status == HUB_STATE_ACTIVE) {
		end_hub_work(pm_data);
		during_hub_resume = 0;
		return;
	}

	if (!pm_data->port_enable) {
		mif_err("mif: hub power func not assinged\n");
		end_hub_work(pm_data);
		return;
	}

	/* If kernel if suspend, wait the ehci resume */
	if (pm_data->dpm_suspending) {
		mif_info("dpm_suspending\n");
		start_hub_work(pm_data, 500);
		return;
	}

	switch (pm_data->hub_status) {
	case HUB_STATE_OFF:
		pm_data->hub_status = HUB_STATE_RESUMMING;
		mif_trace("hub off->on\n");

		/* skip 1st time before first probe */
		if (pm_data->root_hub)
			pm_runtime_get_sync(pm_data->root_hub);

		for (cnt=0;cnt<5;cnt++) {
			err = pm_data->port_enable(2, 1);
			if (err >= 0) {
				mif_err("hub on success\n");
				break;
			}
			mif_err("hub on fail %d th\n", cnt);
			msleep(100);
		}
		if (err < 0) {
			mif_err("hub on fail err=%d\n", err);
			err = pm_data->port_enable(2, 0);
			if (err < 0)
				mif_err("hub off fail err=%d\n", err);
			pm_data->hub_status = HUB_STATE_OFF;
			if (pm_data->root_hub)
				pm_runtime_put_sync(pm_data->root_hub);
			end_hub_work(pm_data);
		} else {
			/* resume root hub */
			start_hub_work(pm_data, 100);
		}
		break;
	case HUB_STATE_RESUMMING:
		if (pm_data->hub_on_retry_cnt++ > 50) {
			pm_data->hub_on_retry_cnt = 0;
			pm_data->hub_status = HUB_STATE_OFF;
			if (pm_data->root_hub)
				pm_runtime_put_sync(pm_data->root_hub);

			mif_err("USB Hub resume fail !!!\n");
			end_hub_work(pm_data);
		} else {
			mif_info("hub resumming: %d\n",
					pm_data->hub_on_retry_cnt);
			start_hub_work(pm_data, 200);
		}
		break;
	}
exit:
	return;
}
static void link_pm_hub_work(struct work_struct *work)
{
	int err;
	struct link_pm_data *pm_data =
		container_of(work, struct link_pm_data, link_pm_hub.work);

	if (pm_data->hub_status == HUB_STATE_ACTIVE)
		return;

	if (!pm_data->port_enable) {
		mif_err("mif: hub power func not assinged\n");
		return;
	}
	wake_lock(&pm_data->hub_lock);

	/* If kernel if suspend, wait the ehci resume */
	if (pm_data->dpm_suspending) {
		mif_info("dpm_suspending\n");
		schedule_delayed_work(&pm_data->link_pm_hub,
						msecs_to_jiffies(500));
		goto exit;
	}

	switch (pm_data->hub_status) {
	case HUB_STATE_OFF:
		pm_data->hub_status = HUB_STATE_RESUMMING;
		mif_trace("hub off->on\n");

		/* skip 1st time before first probe */
		if (pm_data->root_hub)
			pm_runtime_get_sync(pm_data->root_hub);
		err = pm_data->port_enable(2, 1);
		if (err < 0) {
			mif_err("hub on fail err=%d\n", err);
			err = pm_data->port_enable(2, 0);
			if (err < 0)
				mif_err("hub off fail err=%d\n", err);
			pm_data->hub_status = HUB_STATE_OFF;
			if (pm_data->root_hub)
				pm_runtime_put_sync(pm_data->root_hub);
			goto exit;
		}
		/* resume root hub */
		schedule_delayed_work(&pm_data->link_pm_hub,
						msecs_to_jiffies(100));
		break;
	case HUB_STATE_RESUMMING:
		if (pm_data->hub_on_retry_cnt++ > 50) {
			pm_data->hub_on_retry_cnt = 0;
			pm_data->hub_status = HUB_STATE_OFF;
			if (pm_data->root_hub)
				pm_runtime_put_sync(pm_data->root_hub);
		}
		mif_trace("hub resumming\n");
		schedule_delayed_work(&pm_data->link_pm_hub,
						msecs_to_jiffies(200));
		break;
	case HUB_STATE_PREACTIVE:
		pm_data->hub_status = HUB_STATE_ACTIVE;
		mif_trace("hub active\n");
		pm_data->hub_on_retry_cnt = 0;
		wake_unlock(&pm_data->hub_lock);
		complete(&pm_data->hub_active);
		if (pm_data->root_hub)
			pm_runtime_put_sync(pm_data->root_hub);
		break;
	}
exit:
	return;
}