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

Commit f594c15b authored by Sarthak Garg's avatar Sarthak Garg Committed by Gerrit - the friendly Code Review server
Browse files

host: sdhci-msm: implement get_current_limit() host op



This is needed to get the current capabilities of vdd
regulator that is not managed by SDHCI driver.

Change-Id: I2a7f2981043185b51e268bf30c4ab9135991c6ee
Signed-off-by: default avatarSarthak Garg <sartgarg@codeaurora.org>
parent e445c189
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -512,6 +512,21 @@ static unsigned int msm_get_clock_rate_for_bus_mode(struct sdhci_host *host,
	return clock;
}

#if defined(CONFIG_SDC_QTI)
static unsigned int sdhci_msm_get_current_limit(struct sdhci_host *host)
{
	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
	struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
	struct sdhci_msm_vreg_data *curr_slot = msm_host->vreg_data;
	u32 max_curr = 0;

	if (curr_slot && curr_slot->vdd_data)
		max_curr = curr_slot->vdd_data->hpm_uA;

	return max_curr;
}
#endif

static void msm_set_clock_rate_for_bus_mode(struct sdhci_host *host,
					    unsigned int clock)
{
@@ -3060,6 +3075,9 @@ static const struct sdhci_ops sdhci_msm_ops = {
	.write_w = sdhci_msm_writew,
	.write_b = sdhci_msm_writeb,
	.irq	= sdhci_msm_cqe_irq,
#if defined(CONFIG_SDC_QTI)
	.get_current_limit = sdhci_msm_get_current_limit,
#endif
};

static const struct sdhci_pltfm_data sdhci_msm_pdata = {
+9 −2
Original line number Diff line number Diff line
@@ -4286,8 +4286,15 @@ int sdhci_setup_host(struct sdhci_host *host)
	 * value.
	 */
	max_current_caps = sdhci_readl(host, SDHCI_MAX_CURRENT);
	if (!max_current_caps && !IS_ERR(mmc->supply.vmmc)) {
		int curr = regulator_get_current_limit(mmc->supply.vmmc);
	if (!max_current_caps) {
		u32 curr = 0;

		if (!IS_ERR(mmc->supply.vmmc))
			curr = regulator_get_current_limit(mmc->supply.vmmc);
#if defined(CONFIG_SDC_QTI)
		else if (host->ops->get_current_limit)
			curr = host->ops->get_current_limit(host);
#endif
		if (curr > 0) {

			/* convert to SDHCI_MAX_CURRENT format */
+3 −0
Original line number Diff line number Diff line
@@ -658,6 +658,9 @@ struct sdhci_ops {
				   dma_addr_t addr, int len, unsigned int cmd);
	void	(*request_done)(struct sdhci_host *host,
				struct mmc_request *mrq);
	#if defined(CONFIG_SDC_QTI)
	unsigned int    (*get_current_limit)(struct sdhci_host *host);
	#endif
};

#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS