mmc: dw_mmc: Keep vqmmc-supply enable count in balance 35/318735/4
authorJonas Karlman <jonas@kwiboo.se>
Wed, 19 Jul 2023 21:21:00 +0000 (21:21 +0000)
committerJaehoon Chung <jh80.chung@samsung.com>
Fri, 18 Oct 2024 02:06:21 +0000 (11:06 +0900)
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>
[backport of the commit 01b2917a1973b804338d3edbbd46198c540ba9f5 from mainline]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ibd99b3b236906554c5ed17d5b1564f1fd0fc00fe

drivers/mmc/dw_mmc.c

index c93f0022106db8f025680792212ae2361e9258e5..68bf0a6bb08d4dad12ab9447f1f4aee1e0ca2539 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