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

Commit cba7e83e authored by Sahitya Tummala's avatar Sahitya Tummala Committed by Xiaonian Wang
Browse files

host: sdhci: fix current caps when there is no host->vmmc



When the regulators are not managed by SDHCI host driver (i.e.,
when host->vmmc and host->vmmcq are absent), get the regulator
current capabilities through a new host op get_current_limit().

Change-Id: I097349ad4d2e8ffbafbeb5fe65910894fe909bd6
Signed-off-by: default avatarSahitya Tummala <stummala@codeaurora.org>
Signed-off-by: default avatarSayali Lokhande <sayalil@codeaurora.org>
parent c1e97551
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -4172,10 +4172,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 (curr > 0) {
	if (!max_current_caps) {
		u32 curr = 0;

		if (!IS_ERR(mmc->supply.vmmc))
			curr = regulator_get_current_limit(mmc->supply.vmmc);
		else if (host->ops->get_current_limit)
			curr = host->ops->get_current_limit(host);

		if (curr > 0) {
			/* convert to SDHCI_MAX_CURRENT format */
			curr = curr/1000;  /* convert to mA */
			curr = curr/SDHCI_MAX_CURRENT_MULTIPLIER;
+1 −0
Original line number Diff line number Diff line
@@ -696,6 +696,7 @@ struct sdhci_ops {
	void	(*init)(struct sdhci_host *host);
	void	(*pre_req)(struct sdhci_host *host, struct mmc_request *req);
	void	(*post_req)(struct sdhci_host *host, struct mmc_request *req);
	unsigned int	(*get_current_limit)(struct sdhci_host *host);
};

#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS