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

This commit is contained in:
qctecmdr 2020-10-02 22:58:43 -07:00 • committed by Gerrit - the friendly Code Review server
commit efb8798d6a
3 changed files with 30 additions and 2 deletions

View file

@ -519,6 +519,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)
{
@ -3128,6 +3143,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 = {

View file

@ -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 */

View file

@ -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