Skip to contentSkip to conversation

drm/msm: HDMI PHY rework for MSM8x94 support

PATCH New Stephane Viau 1 participant 3 messages Jun 19, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover drm/msm: HDMI PHY rework for MSM8x94 support

This it to follow up with my RFC sent a few days ago[1].

Since the RFC got discussed and approved through IRC, here are the actual patches.

Rgds,
Stephane.

[1] http://lists.freedesktop.org/archives/dri-devel/2015-June/084788.html

Stephane Viau (2):
drm/msm/hdmi: remove ->reset() from HDMI PHY
drm/msm: Add support for msm8x94

 drivers/gpu/drm/msm/hdmi/hdmi.c           | 30 ++++++----
 drivers/gpu/drm/msm/hdmi/hdmi.h           |  1 -
 drivers/gpu/drm/msm/hdmi/hdmi_bridge.c    |  8 ++-
 drivers/gpu/drm/msm/hdmi/hdmi_connector.c | 94 +++++++++++++++++++++++++------
 drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c  | 52 -----------------
 drivers/gpu/drm/msm/hdmi/hdmi_phy_8x60.c  | 32 -----------
 drivers/gpu/drm/msm/hdmi/hdmi_phy_8x74.c  | 57 -------------------
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c   | 73 +++++++++++++++++++++++-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c   |  8 ++-
 9 files changed, 179 insertions(+), 176 deletions(-)
Signature · 3 lines
Qualcomm Innovation Center, Inc.

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
#1 lore raw

PATCH 1/2 drm/msm/hdmi: remove ->reset() from HDMI PHY

->reset() currently only accesses HDMI core registers, and yet it is located in hdmi_phy*. Since no PHY registers are being accessed during ->reset(), it would be better to bring that function in hdmi core module where HDMI core registers are usually being accessed.

This will also help for msm8x94 for which no PHY registers accesses are done (->phy_init == NULL) but the HDMI PHY reset from HDMI core still needs to be done.

Note:
SW_RESET_PLL bit is not written in hdmi_phy_8x60_reset(); this write should not affect anything if the corresponding field is not writable.

---
 drivers/gpu/drm/msm/hdmi/hdmi.h           |  1 -
 drivers/gpu/drm/msm/hdmi/hdmi_connector.c | 51 ++++++++++++++++++++++++++-
 drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c  | 52 ----------------------------
 drivers/gpu/drm/msm/hdmi/hdmi_phy_8x60.c  | 32 -----------------
 drivers/gpu/drm/msm/hdmi/hdmi_phy_8x74.c  | 57 -------------------------------
 5 files changed, 50 insertions(+), 143 deletions(-)
drivers/gpu/drm/msm/hdmi/hdmi.h +0 -1
index 68fdfb3..a155c4a 100644
@@ -117,7 +117,6 @@ static inline u32 hdmi_read(struct hdmi *hdmi, u32 reg)
 
 struct hdmi_phy_funcs {
 	void (*destroy)(struct hdmi_phy *phy);
-	void (*reset)(struct hdmi_phy *phy);
 	void (*powerup)(struct hdmi_phy *phy, unsigned long int pixclock);
 	void (*powerdown)(struct hdmi_phy *phy);
 };
drivers/gpu/drm/msm/hdmi/hdmi_connector.c +50 -1

63 lines not on this page · raw message

drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c +0 -52

64 lines not on this page · raw message

drivers/gpu/drm/msm/hdmi/hdmi_phy_8x60.c +0 -32
index 391433c..cb01421 100644
@@ -29,37 +29,6 @@ static void hdmi_phy_8x60_destroy(struct hdmi_phy *phy)
 	kfree(phy_8x60);
 }
 
-static void hdmi_phy_8x60_reset(struct hdmi_phy *phy)
-{
-	struct hdmi_phy_8x60 *phy_8x60 = to_hdmi_phy_8x60(phy);
-	struct hdmi *hdmi = phy_8x60->hdmi;
-	unsigned int val;
-
-	val = hdmi_read(hdmi, REG_HDMI_PHY_CTRL);
-
-	if (val & HDMI_PHY_CTRL_SW_RESET_LOW) {
-		/* pull low */
-		hdmi_write(hdmi, REG_HDMI_PHY_CTRL,
-				val & ~HDMI_PHY_CTRL_SW_RESET);
-	} else {
-		/* pull high */
-		hdmi_write(hdmi, REG_HDMI_PHY_CTRL,
-				val | HDMI_PHY_CTRL_SW_RESET);
-	}
-
-	msleep(100);
-
-	if (val & HDMI_PHY_CTRL_SW_RESET_LOW) {
-		/* pull high */
-		hdmi_write(hdmi, REG_HDMI_PHY_CTRL,
-				val | HDMI_PHY_CTRL_SW_RESET);
-	} else {
-		/* pull low */
-		hdmi_write(hdmi, REG_HDMI_PHY_CTRL,
-				val & ~HDMI_PHY_CTRL_SW_RESET);
-	}
-}
-
 static void hdmi_phy_8x60_powerup(struct hdmi_phy *phy,
 		unsigned long int pixclock)
 {
@@ -182,7 +151,6 @@ static void hdmi_phy_8x60_powerdown(struct hdmi_phy *phy)
 
 static const struct hdmi_phy_funcs hdmi_phy_8x60_funcs = {
 		.destroy = hdmi_phy_8x60_destroy,
-		.reset = hdmi_phy_8x60_reset,
 		.powerup = hdmi_phy_8x60_powerup,
 		.powerdown = hdmi_phy_8x60_powerdown,
 };
drivers/gpu/drm/msm/hdmi/hdmi_phy_8x74.c +0 -57

81 lines not on this page · raw message

Signature · 8 lines
Qualcomm Innovation Center, Inc.

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

PATCH 2/2 drm/msm: Add support for msm8x94

In reply to Stephane Viau

This change adds the MDP and HDMI support for msm8x94. Note that HDMI PHY registers are not being accessed anymore from the driver.

---
 drivers/gpu/drm/msm/hdmi/hdmi.c           | 30 ++++++++-----
 drivers/gpu/drm/msm/hdmi/hdmi_bridge.c    |  8 +++-
 drivers/gpu/drm/msm/hdmi/hdmi_connector.c | 43 +++++++++++-------
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c   | 73 ++++++++++++++++++++++++++++++-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c   |  8 ++--
 5 files changed, 129 insertions(+), 33 deletions(-)
drivers/gpu/drm/msm/hdmi/hdmi.c +20 -10
index 8145362..4d73a69 100644
@@ -89,16 +89,15 @@ static struct hdmi *hdmi_init(struct platform_device *pdev)
 	hdmi->config = config;
 
 	/* not sure about which phy maps to which msm.. probably I miss some */
-	if (config->phy_init)
+	if (config->phy_init) {
 		hdmi->phy = config->phy_init(hdmi);
-	else
-		hdmi->phy = ERR_PTR(-ENXIO);
 
-	if (IS_ERR(hdmi->phy)) {
-		ret = PTR_ERR(hdmi->phy);
-		dev_err(&pdev->dev, "failed to load phy: %d\n", ret);
-		hdmi->phy = NULL;
-		goto fail;
+		if (IS_ERR(hdmi->phy)) {
+			ret = PTR_ERR(hdmi->phy);
+			dev_err(&pdev->dev, "failed to load phy: %d\n", ret);
+			hdmi->phy = NULL;
+			goto fail;
+		}
 	}
 
 	hdmi->mmio = msm_ioremap(pdev, config->mmio_name, "HDMI");
@@ -330,7 +329,19 @@ static struct hdmi_platform_config hdmi_tx_8084_config = {
 		.hpd_freq      = hpd_clk_freq_8x74,
 };
 
+static const char *hpd_reg_names_8x94[] = {};
+
+static struct hdmi_platform_config hdmi_tx_8x94_config = {
+		.phy_init = NULL, /* nothing to do for this HDMI PHY 20nm */
+		HDMI_CFG(pwr_reg, 8x74),
+		HDMI_CFG(hpd_reg, 8x94),
+		HDMI_CFG(pwr_clk, 8x74),
+		HDMI_CFG(hpd_clk, 8x74),
+		.hpd_freq      = hpd_clk_freq_8x74,
+};
+
 static const struct of_device_id dt_match[] = {
+	{ .compatible = "qcom,hdmi-tx-8x94", .data = &hdmi_tx_8x94_config },
 	{ .compatible = "qcom,hdmi-tx-8084", .data = &hdmi_tx_8084_config },
 	{ .compatible = "qcom,hdmi-tx-8074", .data = &hdmi_tx_8074_config },
 	{ .compatible = "qcom,hdmi-tx-8960", .data = &hdmi_tx_8960_config },
@@ -347,8 +358,7 @@ static int get_gpio(struct device *dev, struct device_node *of_node, const char
 		snprintf(name2, sizeof(name2), "%s-gpio", name);
 		gpio = of_get_named_gpio(of_node, name2, 0);
 		if (gpio < 0) {
-			dev_err(dev, "failed to get gpio: %s (%d)\n",
-					name, gpio);
+			DBG("failed to get gpio: %s (%d)", name, gpio);
 			gpio = -1;
 		}
 	}
drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +6 -2
index a7a1d82..00cec41 100644
@@ -100,7 +100,9 @@ static void hdmi_bridge_pre_enable(struct drm_bridge *bridge)
 		hdmi_audio_update(hdmi);
 	}
 
-	phy->funcs->powerup(phy, hdmi->pixclock);
+	if (phy)
+		phy->funcs->powerup(phy, hdmi->pixclock);
+
 	hdmi_set_mode(hdmi, true);
 }
 
@@ -120,7 +122,9 @@ static void hdmi_bridge_post_disable(struct drm_bridge *bridge)
 
 	DBG("power down");
 	hdmi_set_mode(hdmi, false);
-	phy->funcs->powerdown(phy);
+
+	if (phy)
+		phy->funcs->powerdown(phy);
 
 	if (hdmi->power_on) {
 		power_off(bridge);
drivers/gpu/drm/msm/hdmi/hdmi_connector.c +26 -17

71 lines not on this page · raw message

drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c +72 -1

86 lines not on this page · raw message

drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +5 -3
index f6c5896..97226a1 100644
@@ -159,7 +159,8 @@ int mdp5_disable(struct mdp5_kms *mdp5_kms)
 	clk_disable_unprepare(mdp5_kms->ahb_clk);
 	clk_disable_unprepare(mdp5_kms->axi_clk);
 	clk_disable_unprepare(mdp5_kms->core_clk);
-	clk_disable_unprepare(mdp5_kms->lut_clk);
+	if (mdp5_kms->lut_clk)
+		clk_disable_unprepare(mdp5_kms->lut_clk);
 
 	return 0;
 }
@@ -171,7 +172,8 @@ int mdp5_enable(struct mdp5_kms *mdp5_kms)
 	clk_prepare_enable(mdp5_kms->ahb_clk);
 	clk_prepare_enable(mdp5_kms->axi_clk);
 	clk_prepare_enable(mdp5_kms->core_clk);
-	clk_prepare_enable(mdp5_kms->lut_clk);
+	if (mdp5_kms->lut_clk)
+		clk_prepare_enable(mdp5_kms->lut_clk);
 
 	return 0;
 }
@@ -471,7 +473,7 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 		goto fail;
 	ret = get_clk(pdev, &mdp5_kms->lut_clk, "lut_clk");
 	if (ret)
-		goto fail;
+		DBG("failed to get (optional) lut_clk clock");
 	ret = get_clk(pdev, &mdp5_kms->vsync_clk, "vsync_clk");
 	if (ret)
 		goto fail;
Signature · 8 lines
Qualcomm Innovation Center, Inc.

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel