Beispiel #1
0
static int sdhci_s3c_suspend(struct platform_device *dev, pm_message_t pm)
{
	struct sdhci_host *host = platform_get_drvdata(dev);
	struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;

	sdhci_suspend_host(host, pm);

	if(pdata && pdata->cfg_ext_cd){
		free_irq(pdata->ext_cd, sdhci_priv(host));
	}
	return 0;
}
static int sdhci_s3c_suspend(struct platform_device *dev, pm_message_t pm)
{
	struct sdhci_host *host = platform_get_drvdata(dev);

	sdhci_suspend_host(host, pm);

#ifdef CONFIG_MACH_MIDAS_01_BD
	/* turn vdd_tflash off */
	sdhci_s3c_vtf_on_off(0);
#endif
	return 0;
}
Beispiel #3
0
static int sdhci_pxav3_suspend(struct device *dev)
{
	int ret;
	struct sdhci_host *host = dev_get_drvdata(dev);

	pm_runtime_get_sync(dev);
	ret = sdhci_suspend_host(host);
	pm_runtime_mark_last_busy(dev);
	pm_runtime_put_autosuspend(dev);

	return ret;
}
Beispiel #4
0
static int sdhci_s3c_suspend(struct platform_device *dev, pm_message_t pm)
{
	struct sdhci_host *host = platform_get_drvdata(dev);

	struct mmc_host *mmc = host->mmc;

	if (mmc->card && (mmc->card->type == MMC_TYPE_SDIO))
		mmc->pm_flags |= MMC_PM_KEEP_POWER;

	sdhci_suspend_host(host, pm);
	return 0;
}
static int sdhci_suspend(struct device *dev)
{
    struct sdhci_host *host = dev_get_drvdata(dev);
    struct spear_sdhci *sdhci = dev_get_platdata(dev);
    int ret;

    ret = sdhci_suspend_host(host);
    if (!ret)
        clk_disable(sdhci->clk);

    return ret;
}
static int sdhci_pltfm_suspend(struct device *device)
{
	struct sdio_dev *dev =
		platform_get_drvdata(to_platform_device(device));
	struct sdhci_host *host = dev->host;
	int ret = 0;

	if (!sdhci_pltfm_rpm_enabled(dev)) {
		ret = sdhci_pltfm_clk_enable(dev, 1);
		if (ret) {
			dev_err(dev->dev,
				"Failed to enable clock during suspend\n");
			return -EAGAIN;
		}
	}

	host->mmc->pm_flags |= host->mmc->pm_caps;

	ret = sdhci_suspend_host(host);
	if (ret) {
		dev_err(dev->dev, "Unable to suspend sdhci host err=%d\n",
			ret);
		return ret;
	}

	if (sdhci_pltfm_rpm_enabled(dev)) {
		/*
		 * Note that we havent done a get_sync. The
		 * pm core takes care of that.
		 */
		pm_runtime_put_sync_suspend(dev->dev);
	} else {
		ret = sdhci_pltfm_clk_enable(dev, 0);
		if (ret) {
			dev_err(dev->dev,
				"Failed to disable clock during suspend\n");
			/* Not really a big error to cry and return */
		}
	}

	if(dev->devtype == SDIO_DEV_TYPE_SDMMC)
	{
		printk(KERN_ERR "mmc regulator off.. delay 50ms added\n");
		mdelay(50);// this is Samsung internal specification.
	}

	dev->suspended = 1;
	return 0;
}
Beispiel #7
0
static int sdhci_sirf_suspend(struct device *dev)
{
	struct sdhci_host *host = dev_get_drvdata(dev);
	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
	struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host);
	int ret;

	ret = sdhci_suspend_host(host);
	if (ret)
		return ret;

	clk_disable(priv->clk);

	return 0;
}
static int tegra_sdhci_suspend(struct platform_device *pdev, pm_message_t state)
{
	struct tegra_sdhci_host *host = platform_get_drvdata(pdev);
	struct mmc_host *mmc = host->sdhci->mmc;
	int ret;

	if (host->plat->mmc_data.built_in)
	        mmc->pm_flags |= MMC_PM_KEEP_POWER;

	ret = sdhci_suspend_host(host->sdhci, state);
	if (ret)
		pr_err("%s: failed, error = %d\n", __func__, ret);

	tegra_sdhci_enable_clock(host, 0);
	return ret;
}
Beispiel #9
0
static int sdhci_sirf_suspend(struct device *dev)
{
	struct sdhci_host *host = dev_get_drvdata(dev);
	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
	int ret;

	if (host->tuning_mode != SDHCI_TUNING_MODE_3)
		mmc_retune_needed(host->mmc);

	ret = sdhci_suspend_host(host);
	if (ret)
		return ret;

	clk_disable(pltfm_host->clk);

	return 0;
}
Beispiel #10
0
static int tegra_sdhci_suspend(struct platform_device *pdev, pm_message_t state)
{
	struct tegra_sdhci_host *host = platform_get_drvdata(pdev);
	int ret = 0;

	MMC_printk("%s:+", mmc_hostname(host->sdhci->mmc));

       if ((host->card_always_on && is_card_sdio(host->sdhci->mmc->card)) || is_card_mmc(host->sdhci->mmc->card)){
		int div = 0;
		u16 clk;
		unsigned int clock = 100000;

		if (device_may_wakeup(&pdev->dev)) {
		        enable_irq_wake(host->sdhci->irq);
		}

		/* save interrupt status before suspending */
		host->sdhci_ints = sdhci_readl(host->sdhci, SDHCI_INT_ENABLE);

		/* reduce host controller clk and card clk to 100 KHz */
		tegra_sdhci_set_clock(host->sdhci, clock);
		sdhci_writew(host->sdhci, 0, SDHCI_CLOCK_CONTROL);

		if (host->sdhci->max_clk > clock) {
			div =  1 << (fls(host->sdhci->max_clk / clock) - 2);
			if (div > 128)
				div = 128;
		}

		clk = div << SDHCI_DIVIDER_SHIFT;
		clk |= SDHCI_CLOCK_INT_EN | SDHCI_CLOCK_CARD_EN;
		sdhci_writew(host->sdhci, clk, SDHCI_CLOCK_CONTROL);
              printk("tegra_sdhci_suspend: skip %s suspend(always on)!\n",is_card_mmc(host->sdhci->mmc->card)?"eMMC":"SDIO");
		return ret;
	}


	ret = sdhci_suspend_host(host->sdhci, state);
	if (ret)
		pr_err("%s: failed, error = %d\n", __func__, ret);

	tegra_sdhci_enable_clock(host, 0);

	MMC_printk("%s:-", mmc_hostname(host->sdhci->mmc));
	return ret;
}
static int sdhci_s3c_suspend(struct platform_device *dev, pm_message_t pm)
{
	struct sdhci_host *host = platform_get_drvdata(dev);
	struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;

	struct mmc_host *mmc = host->mmc;

	if (mmc->card && (mmc->card->type == MMC_TYPE_SDIO))
		mmc->pm_flags |= MMC_PM_KEEP_POWER;

	sdhci_suspend_host(host, pm);

	if(pdata && pdata->cfg_ext_cd){
		free_irq(pdata->ext_cd, sdhci_priv(host));
	}
	return 0;
}
/**
 * xsdhcips_suspend - Suspend method for the driver
 * @dev:	Address of the device structure
 * Returns 0 on success and error value on error
 *
 * Put the device in a low power state.
 */
static int xsdhcips_suspend(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct sdhci_host *host = platform_get_drvdata(pdev);
	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
	struct xsdhcips *xsdhcips = pltfm_host->priv;
	int ret;

	ret = sdhci_suspend_host(host);
	if (ret)
		return ret;

	clk_disable(xsdhcips->devclk);
	clk_disable(xsdhcips->aperclk);

	return 0;
}
static int sdhci_pltfm_suspend(struct device *dev)
{
	struct sdhci_host *host = dev_get_drvdata(dev);
	int ret;

	ret = sdhci_suspend_host(host);
	if (ret) {
		dev_err(dev, "suspend failed, error = %d\n", ret);
		return ret;
	}

	if (host->ops && host->ops->suspend)
		ret = host->ops->suspend(host);
	if (ret) {
		dev_err(dev, "suspend hook failed, error = %d\n", ret);
		sdhci_resume_host(host);
	}

	return ret;
}
Beispiel #14
0
static int sdhci_pltfm_suspend(struct platform_device *dev, pm_message_t state)
{
	struct sdhci_host *host = platform_get_drvdata(dev);
	int ret;

	ret = sdhci_suspend_host(host, state);
	if (ret) {
		dev_err(&dev->dev, "suspend failed, error = %d\n", ret);
		return ret;
	}

	if (host->ops && host->ops->suspend)
		ret = host->ops->suspend(host, state);
	if (ret) {
		dev_err(&dev->dev, "suspend hook failed, error = %d\n", ret);
		sdhci_resume_host(host);
	}

	return ret;
}
Beispiel #15
0
static int sdhci_s3c_suspend(struct platform_device *dev, pm_message_t pm)
{
	struct sdhci_host *host = platform_get_drvdata(dev);

	/* add by cym 20130328 */
#if MMC2_SKIP_SUSPEND
    /* mmc2 is s3c_device_hsmmc3 */
    if (2 == host->mmc->index) {
        printk(KERN_INFO "skip %s for %s dev->id(%d)\n", __func__, mmc_hostname(host->mmc), dev->id);
        return 0;
    }
    else {
        printk(KERN_INFO "%s for %s dev->id(%d)\n", __func__, mmc_hostname(host->mmc), dev->id);
    }
#endif
	/* end add */

	sdhci_suspend_host(host, pm);
	return 0;
}
Beispiel #16
0
static int sdhci_pm_suspend(struct device *dev) {
    int				 retval = 0;
    struct platform_device	*pdev	= container_of(dev, struct platform_device, dev);
    struct sdhci_host		*host	= platform_get_drvdata(pdev);
    printk("%s: %s enter\n", mmc_hostname(host->mmc), __func__);
    if(is_wifi_slot(host))
      {
        printk("[WLAN] suspend read REG_AP_CLK_AP_AHB_CFG is %x\n",__raw_readl(REG_AP_CLK_AP_AHB_CFG));
	dhd_mmc_suspend = 1;
	printk("[WLAN] %s,dhd_mmc_suspend=%d\n",__func__,dhd_mmc_suspend);
      }
#ifdef CONFIG_PM_RUNTIME
    if(pm_runtime_enabled(dev))
        retval = pm_runtime_get_sync(dev);
#endif
    if(retval >= 0) {
            retval = sdhci_suspend_host(host, PMSG_SUSPEND);
            if(!retval) {
                unsigned long flags;
#ifdef CONFIG_MMC_HOST_WAKEUP_SUPPORTED
                if (pdev->id == 1)
                    sdhci_host_wakeup_set(host);
#endif
                spin_lock_irqsave(&host->lock, flags);
                if(host->ops->set_clock)
                    host->ops->set_clock(host, 0);
                spin_unlock_irqrestore(&host->lock, flags);
            } else {
#ifdef CONFIG_PM_RUNTIME
                if(pm_runtime_enabled(dev))
                    pm_runtime_put_autosuspend(dev);
#endif
            }
    }

    printk("%s: %s leave retval %d\n", mmc_hostname(host->mmc), __func__, retval);
    return retval;
}
Beispiel #17
0
static int sdhci_s3c_suspend(struct device *dev)
{
	struct sdhci_host *host = dev_get_drvdata(dev);

	return sdhci_suspend_host(host);
}
Beispiel #18
0
static int sdhci_acpi_suspend(struct device *dev)
{
	struct sdhci_acpi_host *c = dev_get_drvdata(dev);

	return sdhci_suspend_host(c->host);
}
Beispiel #19
0
static int sdhci_s3c_suspend(struct platform_device *dev, pm_message_t pm)
{
	struct sdhci_host *host = platform_get_drvdata(dev);

	return sdhci_suspend_host(host, pm);
}
Beispiel #20
0
int sdhci_pltfm_suspend(struct platform_device *dev, pm_message_t state)
{
	struct sdhci_host *host = platform_get_drvdata(dev);

	return sdhci_suspend_host(host, state);
}
static int sdhci_pltfm_suspend(struct platform_device *pdev, pm_message_t state)
{
	struct sdio_dev *dev = platform_get_drvdata(pdev);
	struct sdhci_host *host = dev->host;

	if (dev->devtype == SDIO_DEV_TYPE_WIFI) {
		host->mmc->pm_flags |= host->mmc->pm_caps;
		printk(KERN_DEBUG "%s: pm_flags=0x%08x\n",
			__FUNCTION__, host->mmc->pm_flags);
		sdhci_suspend_host(host, state);
	}
#if 0
	if (dev->devtype == SDIO_DEV_TYPE_SDMMC && dev->cd_gpio >= 0)
		free_irq(gpio_to_irq(dev->cd_gpio), dev);
#endif

	flush_work_sync(&host->wait_erase_work);
	/*
	 * If the device type is WIFI, and WiFi is enabled,
	 * turn off the clock since currently
	 * the WIFI driver does not support turning on/off the
	 * clock dynamicly.
	 */
	if (dev->devtype == SDIO_DEV_TYPE_WIFI && sdhci_test_sdio_enabled(dev))
		sdhci_pltfm_clk_enable(host, 0);
	
	/*
	 *   Move Dynamic Power Management State machine to OFF state to
	 *   ensure the SD card regulators are turned-off during suspend.
	 *
	 * State Machine:
	 *
	 *   ENABLED -> DISABLED ->  OFF
	 *     ^___________|          |
	 *     |______________________|
	 *
	 *  Delayed workqueue host->mmc->disable (mmc_host_deeper_disable) is
	 *  scheduled twice:
	 *  mmc_host_lazy_disable queues host->mmc->disable for 100ms delay
	 *  1st Entry(after 100ms):  work function(mmc_host_deeper_disable)
	 *  moves the DPM state: ENABLED -> DISABLED [lazy disable] and
	 *  and queues the workqueue host->mmc->disable again for 8s delay
	 *
	 * 2nd Entry(after 8s): work function(mmc_host_deeper_disable) moves
	 * the DPM state: DISABLED ->  OFF [deeper disable] this time to
	 * turn-off the SD card/IO regulators.
	 *
	 * We need to call flush_delayed_work_sync twice to ensure the SD card
	 * DPM is moved to OFF state.
	 *
	 */
	flush_delayed_work_sync(&host->mmc->disable);
	flush_delayed_work_sync(&host->mmc->disable);

	dev->suspended = 1;
	if(dev->devtype == SDIO_DEV_TYPE_SDMMC)
	{
		mdelay(STABLE_TIME_BEFORE_SUSPEND_MS);
	}

	return 0;
}