Exemple #1
0
static int wl1271_sdio_power_off(struct wl1271 *wl)
{
	struct sdio_func *func = wl_to_func(wl);
	int ret;

        printk("%s: function entered \n", __FUNCTION__);
       //sdio_claim_host(func); 
	sdio_disable_func(func);
	sdio_release_host(func);
#if 1
	/* Runtime PM might be disabled, so power off the card manually */
	ret = mmc_power_save_host(func->card->host);
	if (ret < 0)
        {
            printk("%s: mmc_power_save_host() returned %d\n", __FUNCTION__, ret);
		return ret;
        }

	/* Let runtime PM know the card is powered off */
	return pm_runtime_put_sync(&func->dev);
#else
         //wl1271_setpower(0);

#endif
}
static int mmc_runtime_suspend(struct device *dev)
{
	struct mmc_card *card = mmc_dev_to_card(dev);
	int ret;
	
	DBG("[%s] s\n",__func__);
	ret = mmc_power_save_host(card->host);
	
	DBG("[%s] e\n",__func__);
	/*return mmc_power_save_host(card->host);*/
	return ret;
}
Exemple #3
0
static int wl1271_sdio_power_off(struct wl1271 *wl)
{
	struct sdio_func *func = wl_to_func(wl);
	int ret;

	sdio_disable_func(func);
	sdio_release_host(func);

	/* Runtime PM might be disabled, so power off the card manually */
	ret = mmc_power_save_host(func->card->host);
	if (ret < 0)
		return ret;

	/* Let runtime PM know the card is powered off */
	return pm_runtime_put_sync(&func->dev);
}
int bcmsdh_sdmmc_set_power(int on)
{
	static struct sdio_func *sdio_func;
	struct sdhci_host *host;

	sdio_func = gInstance->func[2];

	host = (struct sdhci_host *)sdio_func->card->host;

	if (on)
		mmc_power_restore_host(sdio_func->card->host);
	else
		mmc_power_save_host(sdio_func->card->host);

	return 0;
}
Exemple #5
0
static int mmc_runtime_suspend(struct device *dev)
{
    struct mmc_card *card = mmc_dev_to_card(dev);

    if (mmc_use_core_runtime_pm(card->host)) {
        /*
         * If idle time bkops is running on the card, let's not get
         * into suspend.
         */
        if (mmc_card_doing_bkops(card) && mmc_card_is_prog_state(card))
            return -EBUSY;
        else
            return 0;
    } else {
        return mmc_power_save_host(card->host);
    }
}
static int wl1251_sdio_set_power(struct wl1251 *wl, bool enable)
{
	int ret = 0;
	struct sdio_func *func = wl_to_func(wl);

	wl1251_enter();
	if (enable) {
		if (wl->set_power)
			wl->set_power(true);

		ret = mmc_power_restore_host(func->card->host);
		if (ret) {
			wl1251_error("failed to restore host power");
			goto out;
		}

		wl1251_debug(DEBUG_PSM, "sdio_claim_host");
		sdio_claim_host(func);
		wl1251_debug(DEBUG_PSM, "sdio_enable_func");
		sdio_enable_func(func);
		wl1251_debug(DEBUG_PSM, "sdio_release_host");
		sdio_release_host(func);
		wl1251_debug(DEBUG_PSM, "sdio_done");
	} else {
		wl1251_debug(DEBUG_PSM, "sdio_claim_host");
		sdio_claim_host(func);
		wl1251_debug(DEBUG_PSM, "sdio_disable_func");
		sdio_disable_func(func);
		wl1251_debug(DEBUG_PSM, "sdio_release_host");
		sdio_release_host(func);
		wl1251_debug(DEBUG_PSM, "power_save_host");
		ret = mmc_power_save_host(func->card->host);
		if (ret) {
			wl1251_error("failed to disable host power");
			goto out;
		}
		wl1251_debug(DEBUG_PSM, "power_save done");

		if (wl->set_power)
			wl->set_power(false);
	}

out:
	wl1251_leave();
	return ret;
}
Exemple #7
0
static int wl1271_sdio_power_off(struct wl1271 *wl)
{
	struct sdio_func *func = wl_to_func(wl);
	int ret;

	sdio_disable_func(func);
	sdio_release_host(func);

	/* Power off the card manually, even if runtime PM is enabled. */
	ret = mmc_power_save_host(func->card->host);
	if (ret < 0)
		return ret;

	/* If enabled, let runtime PM know the card is powered off */
	if (pm_runtime_enabled(&func->dev))
		ret = pm_runtime_put_sync(&func->dev);

	return ret;
}
Exemple #8
0
static int wl12xx_sdio_power_off(struct wl12xx_sdio_glue *glue)
{
	int ret;
	struct sdio_func *func = dev_to_sdio_func(glue->dev);
	struct mmc_card *card = func->card;

	sdio_claim_host(func);
	sdio_disable_func(func);
	sdio_release_host(func);

	/* Power off the card manually in case it wasn't powered off above */
	ret = mmc_power_save_host(card->host);
	if (ret < 0)
		goto out;

	/* Let runtime PM know the card is powered off */
	pm_runtime_put_sync(&card->dev);

out:
	return ret;
}
Exemple #9
0
/**
 *	mmc_wait_for_req - start a request and wait for completion
 *	@host: MMC host to start command
 *	@mrq: MMC request to start
 *
 *	Start a new MMC custom command request for a host, and wait
 *	for the command to complete. Does not attempt to parse the
 *	response.
 */
void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq)
{
	int ret;
	DECLARE_COMPLETION_ONSTACK(complete);

	mrq->done_data = &complete;
	mrq->done = mmc_wait_done;

	mmc_start_request(host, mrq);

	if (!wait_for_completion_timeout(&complete,
		msecs_to_jiffies(10000))) {
		host->ops->dump_regs(host);
		dump_mmc_ios(host);
#ifdef MMC_HOST_DEBUGGING
		extern void dump(void);
		dump();
#endif
		if (host->ops->abort_request) {
			/* Power off */
			ret = mmc_power_save_host(host);
			if (ret)
				pr_err("%s: mmc_power_save_host : error %d\n",
					mmc_hostname(host), ret);

			/* Reset host */
			host->ops->abort_request(host);

			/* Reinitialize the host and card */
			ret = mmc_power_restore_host(host);
			if (ret)
				pr_err("%s: mmc_power_restore_host : error %d\n",
					mmc_hostname(host), ret);
		} else {
			printk(KERN_ERR"[MMC]Timeout Timer Handler Error\n");
		}
	}
}
static int bcmsdh_sdmmc_probe(struct sdio_func *func,
                              const struct sdio_device_id *id)
{
	int ret = 0;
	static struct sdio_func sdio_func_0;
	sd_trace(("bcmsdh_sdmmc: %s Enter\n", __FUNCTION__));
	sd_trace(("sdio_bcmsdh: func->class=%x\n", func->class));
	sd_trace(("sdio_vendor: 0x%04x\n", func->vendor));
	sd_trace(("sdio_device: 0x%04x\n", func->device));
	sd_trace(("Function#: 0x%04x\n", func->num));

	if (func->num == 1) {
		sdio_func_0.num = 0;
		sdio_func_0.card = func->card;
		gInstance->func[0] = &sdio_func_0;
		if(func->device == 0x4) { /* 4318 */
			gInstance->func[2] = NULL;
			sd_trace(("NIC found, calling bcmsdh_probe_bcmdhd...\n"));
			ret = bcmsdh_probe_bcmdhd(&func->dev);
		}
	}

	gInstance->func[func->num] = func;

	if (func->num == 2) {
#ifdef WL_CFG80211
		wl_cfg80211_set_parent_dev(&func->dev);
#endif
		sd_trace(("F2 found, calling bcmsdh_probe_bcmdhd...\n"));
		ret = bcmsdh_probe_bcmdhd(&func->dev);
		if (mmc_power_save_host(func->card->host))
			sd_err(("%s: card power save fail", __FUNCTION__));
	}

	return ret;
}
Exemple #11
0
static int mmc_runtime_suspend(struct device *dev)
{
	struct mmc_card *card = mmc_dev_to_card(dev);

	return mmc_power_save_host(card->host);
}
Exemple #12
0
static int __devinit wl1271_probe(struct sdio_func *func,
				  const struct sdio_device_id *id)
{
	struct ieee80211_hw *hw;
	const struct wl12xx_platform_data *wlan_data;
	struct wl1271 *wl;
	unsigned long irqflags;
	int ret;

	/* We are only able to handle the wlan function */
	if (func->num != 0x02)
		return -ENODEV;

	hw = wl1271_alloc_hw();
	if (IS_ERR(hw))
		return PTR_ERR(hw);

	wl = hw->priv;

	wl->if_priv = func;
	wl->if_ops = &sdio_ops;

	/* Grab access to FN0 for ELP reg. */
	func->card->quirks |= MMC_QUIRK_LENIENT_FN0;

	/* Use block mode for transferring over one block size of data */
	//func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;

	wlan_data = wl12xx_get_platform_data();
	if (IS_ERR(wlan_data)) {
		ret = PTR_ERR(wlan_data);
		wl1271_error("missing wlan platform data: %d", ret);
		goto out_free;
	}

	wl->irq = wlan_data->irq;
	if (wl->ref_clock < 0)
		wl->ref_clock = wlan_data->board_ref_clock;
	if (wl->tcxo_clock < 0)
		wl->tcxo_clock = wlan_data->board_tcxo_clock;
	wl->platform_quirks = wlan_data->platform_quirks;

	if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ)
		irqflags = IRQF_TRIGGER_RISING;
	else
		irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT;

	ret = request_threaded_irq(wl->irq, wl1271_hardirq, wl1271_irq,
				   irqflags,
				   DRIVER_NAME, wl);
	if (ret < 0) {
		wl1271_error("request_irq() failed: %d", ret);
		goto out_free;
	}

	disable_irq(wl->irq);

	sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);

	ret = wl1271_init_ieee80211(wl);
	if (ret)
		goto out_irq;

	ret = wl1271_register_hw(wl);
	if (ret)
		goto out_irq;

	sdio_set_drvdata(func, wl);

	/* Tell PM core that we don't need the card to be powered now */
	pm_runtime_put_noidle(&func->dev);
	mmc_power_save_host(func->card->host);

	return 0;

 out_irq:
	free_irq(wl->irq, wl);

 out_free:
	wl1271_free_hw(wl);

	return ret;
}
Exemple #13
0
/*
 * SDIO bus runtime idle gets precedence over this, but that just calls
 * the generic version.  The generic version will call our version if
 * it exists, so we still get called.  We need to allow it to power us
 * off.
 */
static int wl1271_runtime_idle(struct device *dev)
{
	struct sdio_func *func = dev_to_sdio_func(dev);

	return mmc_power_save_host(func->card->host);
}