]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mmc: dw_mmc: Keep vqmmc-supply enable count in balance
authorJonas Karlman <jonas@kwiboo.se>
Wed, 19 Jul 2023 21:21:00 +0000 (21:21 +0000)
committerTom Rini <trini@konsulko.com>
Mon, 14 Aug 2023 13:14:41 +0000 (09:14 -0400)
With the commit 4fcba5d556b4 ("regulator: implement basic reference
counter"), keeping regulator enablement in balance become more important.

Disable vqmmc-supply before signal voltage is changed to keep regulator
enable counter in balance.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
drivers/mmc/dw_mmc.c

index 5085a3b491dac771fc931d171119626a20112a46..400066fa99a29b5cc41cd5818b89a386c27823d9 100644 (file)
@@ -509,6 +509,10 @@ static int dwmci_set_ios(struct mmc *mmc)
        if (mmc->vqmmc_supply) {
                int ret;
 
+               ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply, false);
+               if (ret)
+                       return ret;
+
                if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180)
                        regulator_set_value(mmc->vqmmc_supply, 1800000);
                else