mmc: mediatek: Use mmc_regulator_set_vqmmc in start_signal_voltage_switch
authorNicolas Boichat <drinkcat@chromium.org>
Thu, 3 Mar 2016 10:19:45 +0000 (18:19 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Thu, 17 Mar 2016 13:54:36 +0000 (14:54 +0100)
We've introduced a new helper in the MMC core:
mmc_regulator_set_vqmmc().  Let's use this in mtk-sd.  Using this new
helper has some advantages:

    1. We get the mmc_regulator_set_vqmmc() behavior of trying to match
       VQMMC and VMMC when the signal voltage is 3.3V.  This ensures max
       compatibility.

    2. We get rid of a few more warnings when probing unsupported
       voltages.

    3. We get rid of some non-mediatek specific code in mtk-sd.

Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/mtk-sd.c

index 07809f4007be6d3cdfd20f9ba519ec1db9a6071d..b17f30da97dad7628d2efe00ea741a6727d5e41f 100644 (file)
@@ -1021,26 +1021,19 @@ static void msdc_set_buswidth(struct msdc_host *host, u32 width)
 static int msdc_ops_switch_volt(struct mmc_host *mmc, struct mmc_ios *ios)
 {
        struct msdc_host *host = mmc_priv(mmc);
-       int min_uv, max_uv;
        int ret = 0;
 
        if (!IS_ERR(mmc->supply.vqmmc)) {
-               if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) {
-                       min_uv = 3300000;
-                       max_uv = 3300000;
-               } else if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_180) {
-                       min_uv = 1800000;
-                       max_uv = 1800000;
-               } else {
+               if (ios->signal_voltage != MMC_SIGNAL_VOLTAGE_330 &&
+                   ios->signal_voltage != MMC_SIGNAL_VOLTAGE_180) {
                        dev_err(host->dev, "Unsupported signal voltage!\n");
                        return -EINVAL;
                }
 
-               ret = regulator_set_voltage(mmc->supply.vqmmc, min_uv, max_uv);
+               ret = mmc_regulator_set_vqmmc(mmc, ios);
                if (ret) {
-                       dev_dbg(host->dev,
-                                       "Regulator set error %d: %d - %d\n",
-                                       ret, min_uv, max_uv);
+                       dev_dbg(host->dev, "Regulator set error %d (%d)\n",
+                               ret, ios->signal_voltage);
                } else {
                        /* Apply different pinctrl settings for different signal voltage */
                        if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_180)