Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 040eb476 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mmc: sdhci: Vote for PM QOS" into msm-4.9

parents 417efa2a c6f48d42
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -162,6 +162,7 @@ struct sdhci_msm_pltfm_data {
	struct sdhci_msm_slot_reg_data *vreg_data;
	bool nonremovable;
	struct sdhci_msm_pin_data *pin_data;
	u32 cpu_dma_latency_us;
};

struct sdhci_msm_host {
@@ -767,6 +768,7 @@ static struct sdhci_msm_pltfm_data *sdhci_msm_populate_pdata(struct device *dev)
	struct sdhci_msm_pltfm_data *pdata = NULL;
	struct device_node *np = dev->of_node;
	u32 bus_width = 0;
	u32 cpu_dma_latency;
	int len, i;

	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
@@ -785,6 +787,10 @@ static struct sdhci_msm_pltfm_data *sdhci_msm_populate_pdata(struct device *dev)
		pdata->mmc_bus_width = 0;
	}

	if (!of_property_read_u32(np, "qcom,cpu-dma-latency-us",
				&cpu_dma_latency))
		pdata->cpu_dma_latency_us = cpu_dma_latency;

	pdata->vreg_data = devm_kzalloc(dev, sizeof(struct
						    sdhci_msm_slot_reg_data),
					GFP_KERNEL);
@@ -1461,6 +1467,8 @@ static int sdhci_msm_probe(struct platform_device *pdev)
	if (msm_host->pdata->nonremovable)
		msm_host->mmc->caps |= MMC_CAP_NONREMOVABLE;

	host->cpu_dma_latency_us = msm_host->pdata->cpu_dma_latency_us;

	ret = sdhci_add_host(host);
	if (ret) {
		dev_err(&pdev->dev, "Add host failed (%d)\n", ret);
+29 −1
Original line number Diff line number Diff line
@@ -1490,6 +1490,26 @@ EXPORT_SYMBOL_GPL(sdhci_set_power);
 *                                                                           *
\*****************************************************************************/

static int sdhci_enable(struct mmc_host *mmc)
{
	struct sdhci_host *host = mmc_priv(mmc);

	if (host->cpu_dma_latency_us)
		pm_qos_update_request(&host->pm_qos_req_dma,
					host->cpu_dma_latency_us);
	return 0;
}

static int sdhci_disable(struct mmc_host *mmc)
{
	struct sdhci_host *host = mmc_priv(mmc);

	if (host->cpu_dma_latency_us)
		pm_qos_update_request(&host->pm_qos_req_dma,
					PM_QOS_DEFAULT_VALUE);
	return 0;
}

static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
{
	struct sdhci_host *host;
@@ -2306,6 +2326,8 @@ static const struct mmc_host_ops sdhci_ops = {
	.select_drive_strength		= sdhci_select_drive_strength,
	.card_event			= sdhci_card_event,
	.card_busy	= sdhci_card_busy,
	.enable		= sdhci_enable,
	.disable	= sdhci_disable,
};

/*****************************************************************************\
@@ -3622,6 +3644,10 @@ int __sdhci_add_host(struct sdhci_host *host)

	mmiowb();

	if (host->cpu_dma_latency_us)
		pm_qos_add_request(&host->pm_qos_req_dma,
				PM_QOS_CPU_DMA_LATENCY, PM_QOS_DEFAULT_VALUE);

	ret = mmc_add_host(mmc);
	if (ret)
		goto unled;
@@ -3693,7 +3719,9 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)

	sdhci_disable_card_detection(host);

	mmc_remove_host(mmc);
	if (host->cpu_dma_latency_us)
		pm_qos_remove_request(&host->pm_qos_req_dma);
	mmc_remove_host(host->mmc);

	sdhci_led_unregister(host);

+4 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <linux/compiler.h>
#include <linux/types.h>
#include <linux/io.h>
#include <linux/pm_qos.h>

#include <linux/mmc/host.h>

@@ -536,6 +537,9 @@ struct sdhci_host {
#define SDHCI_TUNING_MODE_2	1
#define SDHCI_TUNING_MODE_3	2

	unsigned int		cpu_dma_latency_us;
	struct pm_qos_request	pm_qos_req_dma;

	unsigned long private[0] ____cacheline_aligned;
};