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

Commit 042f8bdc authored by Maya Erez's avatar Maya Erez
Browse files

mmc: host: sdhci: allow definition of pm QoS via dts file



Add a new dts entry to define the CPU affinity in order to maintain
the IRQ pm_qos (Quality of Service) for targets that don't have little
cluster and allow setting the pm_qos to the little cluster,
to improve its performance.

Change-Id: Icf6125066d96331392d98a387974e54c96553306
Signed-off-by: default avatarVince Leung <vincentl@codeaurora.org>
Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
parent c6297e1e
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -101,6 +101,19 @@ In the following, <supply> can be vdd (flash core voltage) or vdd-io (I/O voltag
		- pinctrl-names
		- pinctrl-0, pinctrl-1,.. pinctrl-n

        - qcom,cpu-affinity: this is a string that specifies the pm QoS request
	  type. The supported cpu affinity modes are :
	  "all_cores" - PM_QOS_REQ_ALL_CORES is applicable to all CPU cores that
	  are online and this would have a power impact when there are more
	  number of CPUs.
	  "affine_irq" - PM_QOS_REQ_AFFINE_IRQ request type shall update/apply
	  the vote only to that CPU to which this IRQ's affinity is set to.
	  "affine_cores" - PM_QOS_REQ_AFFINE_CORES request type is used for
	  targets that have little cluster and will update/apply the vote to
	  all the cores in the little cluster.
	  The default CPU affinity mode is PM_QOS_REQ_AFFINE_IRQ to maintain
	  backward compatibility.

Example:

	aliases {
+28 −0
Original line number Diff line number Diff line
@@ -311,6 +311,7 @@ struct sdhci_msm_pltfm_data {
	unsigned char sup_clk_cnt;
	int mpm_sdiowakeup_int;
	int sdiowakeup_irq;
	enum pm_qos_req_type cpu_affinity_type;
};

struct sdhci_msm_bus_vote {
@@ -1450,6 +1451,30 @@ out:
	return ret;
}

#ifdef CONFIG_SMP
static void sdhci_msm_populate_affinity_type(struct sdhci_msm_pltfm_data *pdata,
					     struct device_node *np)
{
	const char *cpu_affinity = NULL;

	pdata->cpu_affinity_type = PM_QOS_REQ_AFFINE_IRQ;
	if (!of_property_read_string(np, "qcom,cpu-affinity",
				    &cpu_affinity)) {
		if (!strcmp(cpu_affinity, "all_cores"))
			pdata->cpu_affinity_type = PM_QOS_REQ_ALL_CORES;
		else if (!strcmp(cpu_affinity, "affine_cores"))
			pdata->cpu_affinity_type = PM_QOS_REQ_AFFINE_CORES;
		else if (!strcmp(cpu_affinity, "affine_irq"))
			pdata->cpu_affinity_type = PM_QOS_REQ_AFFINE_IRQ;
	}
}
#else
static void sdhci_msm_populate_affinity_type(struct sdhci_msm_pltfm_data *pdata,
					     struct device_node *np)
{
}
#endif

/* Parse platform data */
static struct sdhci_msm_pltfm_data *sdhci_msm_populate_pdata(struct device *dev)
{
@@ -1562,6 +1587,8 @@ static struct sdhci_msm_pltfm_data *sdhci_msm_populate_pdata(struct device *dev)
	else
		pdata->mpm_sdiowakeup_int = -1;

	sdhci_msm_populate_affinity_type(pdata, np);

	return pdata;
out:
	return NULL;
@@ -3251,6 +3278,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
		msm_host->mmc->caps2 |= MMC_CAP2_NONHOTPLUG;

	host->cpu_dma_latency_us = msm_host->pdata->cpu_dma_latency_us;
	host->pm_qos_req_dma.type = msm_host->pdata->cpu_affinity_type;

	init_completion(&msm_host->pwr_irq_completion);

+7 −3
Original line number Diff line number Diff line
@@ -3401,7 +3401,6 @@ static int sdhci_is_adma2_64bit(struct sdhci_host *host)
#ifdef CONFIG_SMP
static void sdhci_set_pmqos_req_type(struct sdhci_host *host)
{

	/*
	 * The default request type PM_QOS_REQ_ALL_CORES is
	 * applicable to all CPU cores that are online and
@@ -3409,8 +3408,13 @@ static void sdhci_set_pmqos_req_type(struct sdhci_host *host)
	 * number of CPUs. This new PM_QOS_REQ_AFFINE_IRQ request
	 * type shall update/apply the vote only to that CPU to
	 * which this IRQ's affinity is set to.
	 * PM_QOS_REQ_AFFINE_CORES request type is used for targets that have
	 * little cluster and will update/apply the vote to all the cores in
	 * the little cluster.
	 */
	host->pm_qos_req_dma.type = PM_QOS_REQ_AFFINE_IRQ;
	if (host->pm_qos_req_dma.type == PM_QOS_REQ_AFFINE_CORES)
		host->pm_qos_req_dma.cpus_affine.bits[0] = 0x0F;
	else if (host->pm_qos_req_dma.type == PM_QOS_REQ_AFFINE_IRQ)
		host->pm_qos_req_dma.irq = host->irq;
}
#else