drm/msm/dsi: Fix regulator API abuse
authorArchit Taneja <architt@codeaurora.org>
Fri, 29 Apr 2016 09:49:35 +0000 (15:19 +0530)
committerRob Clark <robdclark@gmail.com>
Sun, 8 May 2016 14:22:17 +0000 (10:22 -0400)
The voltage changing code in this driver is broken and should be
removed.  The driver sets a single, exact voltage on probe.  Unless
there is a very good reason for this (which should be documented in
comments) constraints like this need to be set via the machine
constraints, voltage setting in a driver is expected to be used in cases
where the voltage varies at runtime.

In addition client drivers should almost never be calling
regulator_can_set_voltage(), if the device needs to set a voltage it
needs to set the voltage and the regulator core will handle the case
where the regulator is fixed voltage.  If the driver simply skips
setting the voltage if it doesn't have permission then it should just
not bother in the first place.

Originally authored by Mark Brown <broonie@kernel.org>

Remove the min/max voltage data entries per SoC managed by the driver.
These aren't needed as we don't try to set voltages any more. Mention in
comments the voltages that each regulator expects.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
drivers/gpu/drm/msm/dsi/dsi.h
drivers/gpu/drm/msm/dsi/dsi_cfg.c
drivers/gpu/drm/msm/dsi/dsi_host.c
drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c
drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c

index 749fbb28ec3d1fbeaaee12b39ebe031f3760a1f4..03f115f532c240a82f199efefdb0af6996ded09c 100644 (file)
@@ -41,8 +41,6 @@ enum msm_dsi_phy_type {
 /* Regulators for DSI devices */
 struct dsi_reg_entry {
        char name[32];
-       int min_voltage;
-       int max_voltage;
        int enable_load;
        int disable_load;
 };
index e58e9b91b34d341baf9ed9e348f20c42e44aeb0f..93c1ee094eac867074c3da9be5b38970703c657f 100644 (file)
@@ -22,9 +22,9 @@ static const struct msm_dsi_config apq8064_dsi_cfg = {
        .reg_cfg = {
                .num = 3,
                .regs = {
-                       {"vdda", 1200000, 1200000, 100000, 100},
-                       {"avdd", 3000000, 3000000, 110000, 100},
-                       {"vddio", 1800000, 1800000, 100000, 100},
+                       {"vdda", 100000, 100},  /* 1.2 V */
+                       {"avdd", 10000, 100},   /* 3.0 V */
+                       {"vddio", 100000, 100}, /* 1.8 V */
                },
        },
        .bus_clk_names = dsi_v2_bus_clk_names,
@@ -40,10 +40,10 @@ static const struct msm_dsi_config msm8974_apq8084_dsi_cfg = {
        .reg_cfg = {
                .num = 4,
                .regs = {
-                       {"gdsc", -1, -1, -1, -1},
-                       {"vdd", 3000000, 3000000, 150000, 100},
-                       {"vdda", 1200000, 1200000, 100000, 100},
-                       {"vddio", 1800000, 1800000, 100000, 100},
+                       {"gdsc", -1, -1},
+                       {"vdd", 150000, 100},   /* 3.0 V */
+                       {"vdda", 100000, 100},  /* 1.2 V */
+                       {"vddio", 100000, 100}, /* 1.8 V */
                },
        },
        .bus_clk_names = dsi_6g_bus_clk_names,
@@ -59,9 +59,9 @@ static const struct msm_dsi_config msm8916_dsi_cfg = {
        .reg_cfg = {
                .num = 3,
                .regs = {
-                       {"gdsc", -1, -1, -1, -1},
-                       {"vdda", 1200000, 1200000, 100000, 100},
-                       {"vddio", 1800000, 1800000, 100000, 100},
+                       {"gdsc", -1, -1},
+                       {"vdda", 100000, 100},  /* 1.2 V */
+                       {"vddio", 100000, 100}, /* 1.8 V */
                },
        },
        .bus_clk_names = dsi_8916_bus_clk_names,
@@ -73,13 +73,13 @@ static const struct msm_dsi_config msm8994_dsi_cfg = {
        .reg_cfg = {
                .num = 7,
                .regs = {
-                       {"gdsc", -1, -1, -1, -1},
-                       {"vdda", 1250000, 1250000, 100000, 100},
-                       {"vddio", 1800000, 1800000, 100000, 100},
-                       {"vcca", 1000000, 1000000, 10000, 100},
-                       {"vdd", 1800000, 1800000, 100000, 100},
-                       {"lab_reg", -1, -1, -1, -1},
-                       {"ibb_reg", -1, -1, -1, -1},
+                       {"gdsc", -1, -1},
+                       {"vdda", 100000, 100},  /* 1.25 V */
+                       {"vddio", 100000, 100}, /* 1.8 V */
+                       {"vcca", 10000, 100},   /* 1.0 V */
+                       {"vdd", 100000, 100},   /* 1.8 V */
+                       {"lab_reg", -1, -1},
+                       {"ibb_reg", -1, -1},
                },
        },
        .bus_clk_names = dsi_6g_bus_clk_names,
index 4282ec6bbaafd2937e0d8bf2dca91908d23737da..a3e47ad83eb398f1e1c803eb86d0c2a8b13885d5 100644 (file)
@@ -325,18 +325,6 @@ static int dsi_regulator_init(struct msm_dsi_host *msm_host)
                return ret;
        }
 
-       for (i = 0; i < num; i++) {
-               if (regulator_can_change_voltage(s[i].consumer)) {
-                       ret = regulator_set_voltage(s[i].consumer,
-                               regs[i].min_voltage, regs[i].max_voltage);
-                       if (ret < 0) {
-                               pr_err("regulator %d set voltage failed, %d\n",
-                                       i, ret);
-                               return ret;
-                       }
-               }
-       }
-
        return 0;
 }
 
index 91a95fb04a4a00394874e0ef2825ead71e2d74d4..e2f42d8ea29412e415577f33367d9494bd726ab0 100644 (file)
@@ -177,19 +177,6 @@ static int dsi_phy_regulator_init(struct msm_dsi_phy *phy)
                return ret;
        }
 
-       for (i = 0; i < num; i++) {
-               if (regulator_can_change_voltage(s[i].consumer)) {
-                       ret = regulator_set_voltage(s[i].consumer,
-                               regs[i].min_voltage, regs[i].max_voltage);
-                       if (ret < 0) {
-                               dev_err(dev,
-                                       "regulator %d set voltage failed, %d\n",
-                                       i, ret);
-                               return ret;
-                       }
-               }
-       }
-
        return 0;
 }
 
index 2e9ba118d50ac0899519aa6163d9551ea9decdd5..f4bc11af849a5ea23272c7f5e64ec58f70900815 100644 (file)
@@ -138,8 +138,8 @@ const struct msm_dsi_phy_cfg dsi_phy_20nm_cfgs = {
        .reg_cfg = {
                .num = 2,
                .regs = {
-                       {"vddio", 1800000, 1800000, 100000, 100},
-                       {"vcca", 1000000, 1000000, 10000, 100},
+                       {"vddio", 100000, 100}, /* 1.8 V */
+                       {"vcca", 10000, 100},   /* 1.0 V */
                },
        },
        .ops = {
index edf74110ced7bd1ec15a96f96114681006b6cb43..96d1852af41868a79d0eceeffa66e44eb34e9f5f 100644 (file)
@@ -138,7 +138,7 @@ const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_cfgs = {
        .reg_cfg = {
                .num = 1,
                .regs = {
-                       {"vddio", 1800000, 1800000, 100000, 100},
+                       {"vddio", 100000, 100},
                },
        },
        .ops = {
@@ -153,7 +153,7 @@ const struct msm_dsi_phy_cfg dsi_phy_28nm_lp_cfgs = {
        .reg_cfg = {
                .num = 1,
                .regs = {
-                       {"vddio", 1800000, 1800000, 100000, 100},
+                       {"vddio", 100000, 100}, /* 1.8 V */
                },
        },
        .ops = {
index 197b039ca1f1ce085542dd9186c5259155dc6048..213355a3e767a54d19498679cae2bb908992d7da 100644 (file)
@@ -185,7 +185,7 @@ const struct msm_dsi_phy_cfg dsi_phy_28nm_8960_cfgs = {
        .reg_cfg = {
                .num = 1,
                .regs = {
-                       {"vddio", 1800000, 1800000, 100000, 100},
+                       {"vddio", 100000, 100}, /* 1.8 V */
                },
        },
        .ops = {