diff mbox

drm/msm/dsi: Fix regulator API abuse

Message ID 1459364022-28484-1-git-send-email-broonie@kernel.org (mailing list archive)
State New, archived
Headers show

Commit Message

Mark Brown March 30, 2016, 6:53 p.m. UTC
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 shouild just
not bother in the first place.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 12 ------------
 1 file changed, 12 deletions(-)

Comments

Archit Taneja April 29, 2016, 9:49 a.m. UTC | #1
The MSM KMS driver calls regulator_set_voltage to set a fixed voltage in a
few places. This isn't correct API usage as explained in the commit message
of Mark Brown's original patch:

http://www.spinics.net/lists/dri-devel/msg103714.html

This patchset drops all the regultor_set_voltage calls. The first patch
adds some more clean up code to Mark's original patch.

Archit Taneja (3):
  drm/msm/dsi: Fix regulator API abuse
  drm/msm/edp: Drop regulator_set_voltage call
  drm/msm/mdp4: Don't manage DSI PLL regulators in MDP driver

 drivers/gpu/drm/msm/dsi/dsi.h                   |  2 --
 drivers/gpu/drm/msm/dsi/dsi_cfg.c               | 34 ++++++++++++-------------
 drivers/gpu/drm/msm/dsi/dsi_host.c              | 12 ---------
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c           | 13 ----------
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c      |  4 +--
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c      |  4 +--
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c |  2 +-
 drivers/gpu/drm/msm/edp/edp_ctrl.c              | 10 +-------
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c         | 34 -------------------------
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h         |  2 --
 10 files changed, 23 insertions(+), 94 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 4282ec6bbaaf..a3e47ad83eb3 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -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;
 }