Skip to contentSkip to conversation

dw-hdmi: convert imx hdmi to bridge/dw_hdmi

PATCH In review Andy Yan 6 participants 28 messages Dec 5, 2014 – Jan 7, 2015

Subsystems (7)
lore
Share & tools
lore

Andy Yan

author
#0 lore raw

v18 cover dw-hdmi: convert imx hdmi to bridge/dw_hdmi

We found Freescale imx6 and Rockchip rk3288 and Ingenic JZ4780 (Xburst/MIPS) use the interface compatible Designware HDMI IP, but they also have some lightly differences, such as phy pll configuration, register width(imx hdmi register is one byte, but rk3288 is 4 bytes width and can only be accessed by word), 4K support(imx6 doesn't support 4k, but rk3288 does), and HDMI2.0 support.

To reuse the imx-hdmi driver, we make this patch set:
(1): fix some CodingStyle warning to make checkpatch happy (2): convert imx-hdmi to drm_bridge
(3): split platform specific code
(4): move imx-hdmi to bridge/dw_hdmi
(5): extend dw_hdmi.c to support rk3288 hdmi
(6): add rockchip rk3288 platform specific code dw_hdmi-rockchip.c

Changes in v18:
- remove a multiple blank lines in imx-hdmi.c
- fix a checkpatch warning in imx-hdmi_pltfm.c
- add port bindings
- correct some spelling mistakes in dw_hdmi bindings doc
- correct some spelling mistakes in dw_hdmi-rockchip bindings doc

Changes in v17:
- remove platform device stuff, adviced by Russell King
- remove prompt message of dw_hdmi, adviced by Russel King
- parse resource and irq in platform driver

Changes in v16:
- use the common binding for the clocks
- describe ddc-i2c-bus as optional
- add common clocks bindings
- modify clocks bindings
- descrbie ddc-i2c-bus as optional

Changes in v15:
- add prefix dw_hdmi/DW_HDMI for public used dw_hdmi structs adviced by Philipp Zabel
- remove THIS_MODULE in platform driver
- remove unio of the multi-byte register access, adviced by Philipp Zabel
- remove THIS_MODULE in platform driver

Changes in v14:
- add defer probing, adviced by Philipp Zabel
- remove drm_connector_register, because imx-drm core has registered connector

Changes in v13:
- patch against drm-next
- split platform specific phy configuration
- split phy configuration from patch#4

Changes in v12:
- refactor of_node_put(ddc_node)
- squash patch <convert dw_hdmi to drm_bridge>
- add comment for the depend on patch

Changes in v11:
- squash patch <split some phy configuration to platform driver>

Changes in v10:
- split generic dw_hdmi.c improvements from patch#11 (add rk3288 support)
- add more display mode support mpll configuration for rk3288

Changes in v9:
- move some phy configuration to platform driver

Changes in v8:
- correct some spelling mistake
- modify ddc-i2c-bus and interrupt description
- Add documentation for rockchip dw hdmi

Changes in v7:
- remove unused variables from structure dw_hdmi
- remove a wrong modification
- add copyrights for dw_hdmi-imx.c

Changes in v6:
- rearrange the patch order
- refactor register access without reg_shift

Changes in v5:
- refactor reg-io-width

Changes in v4:
- fix checkpatch CHECK
- defer probe ddc i2c adapter

Changes in v3:
- split multi-register access to one indepent patch

Andy Yan (12):
drm: imx: imx-hdmi: make checkpatch happy
drm: imx: imx-hdmi: return defer if can't get ddc i2c adapter
drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode
drm: imx: imx-hdmi: split phy configuration to platform driver
drm: imx: imx-hdmi: move imx-hdmi to bridge/dw_hdmi
dt-bindings: add document for dw_hdmi
drm: bridge/dw_hdmi: add support for multi-byte register width access
drm: bridge/dw_hdmi: add mode_valid support
drm: bridge/dw_hdmi: clear i2cmphy_stat0 reg in hdmi_phy_wait_i2c_done
drm: bridge/dw_hdmi: add function dw_hdmi_phy_enable_spare
dt-bindings: Add documentation for rockchip dw hdmi
drm: bridge/dw_hdmi: add rockchip rk3288 support

 .../devicetree/bindings/drm/bridge/dw_hdmi.txt     |  50 ++
 .../devicetree/bindings/video/dw_hdmi-rockchip.txt |  46 ++
 drivers/gpu/drm/bridge/Kconfig                     |   5 +
 drivers/gpu/drm/bridge/Makefile                    |   1 +
 .../gpu/drm/{imx/imx-hdmi.c => bridge/dw_hdmi.c}   | 717 ++++++++++-----------
 .../gpu/drm/{imx/imx-hdmi.h => bridge/dw_hdmi.h}   |   4 +-
 drivers/gpu/drm/imx/Kconfig                        |   1 +
 drivers/gpu/drm/imx/Makefile                       |   2 +-
 drivers/gpu/drm/imx/dw_hdmi-imx.c                  | 258 ++++++++
 drivers/gpu/drm/rockchip/Kconfig                   |  10 +
 drivers/gpu/drm/rockchip/Makefile                  |   2 +
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c        | 341 ++++++++++
 include/drm/bridge/dw_hdmi.h                       |  61 ++
 13 files changed, 1111 insertions(+), 387 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
 create mode 100644 Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt
 rename drivers/gpu/drm/{imx/imx-hdmi.c => bridge/dw_hdmi.c} (72%)
 rename drivers/gpu/drm/{imx/imx-hdmi.h => bridge/dw_hdmi.h} (99%)
 create mode 100644 drivers/gpu/drm/imx/dw_hdmi-imx.c
 create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
 create mode 100644 include/drm/bridge/dw_hdmi.h
Signature · 7 lines
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#1 lore raw

PATCH v18 1/12 drm: imx: imx-hdmi: make checkpatch happy

CHECK: Alignment should match open parenthesis
+ if ((hdmi->vic == 10) || (hdmi->vic == 11) ||
+ (hdmi->vic == 12) || (hdmi->vic == 13) ||

CHECK: braces {} should be used on all arms of this statement
+ if (hdmi->hdmi_data.video_mode.mdvi)
[...]
+ else {
[...]

---

Changes in v18: None
Changes in v17: None
Changes in v16: None
Changes in v15: None
Changes in v14: None
Changes in v13:
- patch against drm-next

Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6:
- rearrange the patch order

Changes in v5: None
Changes in v4:
- fix checkpatch CHECK

Changes in v3: None

 drivers/gpu/drm/imx/imx-hdmi.c | 109 ++++++++++++++++++++---------------------
 1 file changed, 52 insertions(+), 57 deletions(-)
drivers/gpu/drm/imx/imx-hdmi.c +52 -57
index aaec6b2..7fd90ae 100644
@@ -163,7 +163,7 @@ static void hdmi_modb(struct imx_hdmi *hdmi, u8 data, u8 mask, unsigned reg)
 }
 
 static void hdmi_mask_writeb(struct imx_hdmi *hdmi, u8 data, unsigned int reg,
-		      u8 shift, u8 mask)
+			     u8 shift, u8 mask)
 {
 	hdmi_modb(hdmi, data << shift, mask, reg);
 }
@@ -327,7 +327,7 @@ static unsigned int hdmi_compute_cts(unsigned int freq, unsigned long pixel_clk,
 }
 
 static void hdmi_set_clk_regenerator(struct imx_hdmi *hdmi,
-	unsigned long pixel_clk)
+				     unsigned long pixel_clk)
 {
 	unsigned int clk_n, clk_cts;
 
@@ -338,7 +338,7 @@ static void hdmi_set_clk_regenerator(struct imx_hdmi *hdmi,
 
 	if (!clk_cts) {
 		dev_dbg(hdmi->dev, "%s: pixel clock not supported: %lu\n",
-			 __func__, pixel_clk);
+			__func__, pixel_clk);
 		return;
 	}
 
@@ -477,13 +477,11 @@ static void imx_hdmi_update_csc_coeffs(struct imx_hdmi *hdmi)
 		u16 coeff_b = (*csc_coeff)[1][i];
 		u16 coeff_c = (*csc_coeff)[2][i];
 
-		hdmi_writeb(hdmi, coeff_a & 0xff,
-			HDMI_CSC_COEF_A1_LSB + i * 2);
+		hdmi_writeb(hdmi, coeff_a & 0xff, HDMI_CSC_COEF_A1_LSB + i * 2);
 		hdmi_writeb(hdmi, coeff_a >> 8, HDMI_CSC_COEF_A1_MSB + i * 2);
 		hdmi_writeb(hdmi, coeff_b & 0xff, HDMI_CSC_COEF_B1_LSB + i * 2);
 		hdmi_writeb(hdmi, coeff_b >> 8, HDMI_CSC_COEF_B1_MSB + i * 2);
-		hdmi_writeb(hdmi, coeff_c & 0xff,
-			HDMI_CSC_COEF_C1_LSB + i * 2);
+		hdmi_writeb(hdmi, coeff_c & 0xff, HDMI_CSC_COEF_C1_LSB + i * 2);
 		hdmi_writeb(hdmi, coeff_c >> 8, HDMI_CSC_COEF_C1_MSB + i * 2);
 	}
 
@@ -535,21 +533,22 @@ static void hdmi_video_packetize(struct imx_hdmi *hdmi)
 	struct hdmi_data_info *hdmi_data = &hdmi->hdmi_data;
 	u8 val, vp_conf;
 
-	if (hdmi_data->enc_out_format == RGB
-		|| hdmi_data->enc_out_format == YCBCR444) {
-		if (!hdmi_data->enc_color_depth)
+	if (hdmi_data->enc_out_format == RGB ||
+	    hdmi_data->enc_out_format == YCBCR444) {
+		if (!hdmi_data->enc_color_depth) {
 			output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_BYPASS;
-		else if (hdmi_data->enc_color_depth == 8) {
+		} else if (hdmi_data->enc_color_depth == 8) {
 			color_depth = 4;
 			output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_BYPASS;
-		} else if (hdmi_data->enc_color_depth == 10)
+		} else if (hdmi_data->enc_color_depth == 10) {
 			color_depth = 5;
-		else if (hdmi_data->enc_color_depth == 12)
+		} else if (hdmi_data->enc_color_depth == 12) {
 			color_depth = 6;
-		else if (hdmi_data->enc_color_depth == 16)
+		} else if (hdmi_data->enc_color_depth == 16) {
 			color_depth = 7;
-		else
+		} else {
 			return;
+		}
 	} else if (hdmi_data->enc_out_format == YCBCR422_8BITS) {
 		if (!hdmi_data->enc_color_depth ||
 		    hdmi_data->enc_color_depth == 8)
@@ -561,8 +560,9 @@ static void hdmi_video_packetize(struct imx_hdmi *hdmi)
 		else
 			return;
 		output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_YCC422;
-	} else
+	} else {
 		return;
+	}
 
 	/* set the packetizer registers */
 	val = ((color_depth << HDMI_VP_PR_CD_COLOR_DEPTH_OFFSET) &
@@ -623,34 +623,34 @@ static void hdmi_video_packetize(struct imx_hdmi *hdmi)
 }
 
 static inline void hdmi_phy_test_clear(struct imx_hdmi *hdmi,
-						unsigned char bit)
+				       unsigned char bit)
 {
 	hdmi_modb(hdmi, bit << HDMI_PHY_TST0_TSTCLR_OFFSET,
 		  HDMI_PHY_TST0_TSTCLR_MASK, HDMI_PHY_TST0);
 }
 
 static inline void hdmi_phy_test_enable(struct imx_hdmi *hdmi,
-						unsigned char bit)
+					unsigned char bit)
 {
 	hdmi_modb(hdmi, bit << HDMI_PHY_TST0_TSTEN_OFFSET,
 		  HDMI_PHY_TST0_TSTEN_MASK, HDMI_PHY_TST0);
 }
 
 static inline void hdmi_phy_test_clock(struct imx_hdmi *hdmi,
-						unsigned char bit)
+				       unsigned char bit)
 {
 	hdmi_modb(hdmi, bit << HDMI_PHY_TST0_TSTCLK_OFFSET,
 		  HDMI_PHY_TST0_TSTCLK_MASK, HDMI_PHY_TST0);
 }
 
 static inline void hdmi_phy_test_din(struct imx_hdmi *hdmi,
-						unsigned char bit)
+				     unsigned char bit)
 {
 	hdmi_writeb(hdmi, bit, HDMI_PHY_TST1);
 }
 
 static inline void hdmi_phy_test_dout(struct imx_hdmi *hdmi,
-						unsigned char bit)
+				      unsigned char bit)
 {
 	hdmi_writeb(hdmi, bit, HDMI_PHY_TST2);
 }
@@ -666,21 +666,21 @@ static bool hdmi_phy_wait_i2c_done(struct imx_hdmi *hdmi, int msec)
 }
 
 static void __hdmi_phy_i2c_write(struct imx_hdmi *hdmi, unsigned short data,
-			      unsigned char addr)
+				 unsigned char addr)
 {
 	hdmi_writeb(hdmi, 0xFF, HDMI_IH_I2CMPHY_STAT0);
 	hdmi_writeb(hdmi, addr, HDMI_PHY_I2CM_ADDRESS_ADDR);
 	hdmi_writeb(hdmi, (unsigned char)(data >> 8),
-		HDMI_PHY_I2CM_DATAO_1_ADDR);
+		    HDMI_PHY_I2CM_DATAO_1_ADDR);
 	hdmi_writeb(hdmi, (unsigned char)(data >> 0),
-		HDMI_PHY_I2CM_DATAO_0_ADDR);
+		    HDMI_PHY_I2CM_DATAO_0_ADDR);
 	hdmi_writeb(hdmi, HDMI_PHY_I2CM_OPERATION_ADDR_WRITE,
-		HDMI_PHY_I2CM_OPERATION_ADDR);
+		    HDMI_PHY_I2CM_OPERATION_ADDR);
 	hdmi_phy_wait_i2c_done(hdmi, 1000);
 }
 
 static int hdmi_phy_i2c_write(struct imx_hdmi *hdmi, unsigned short data,
-				     unsigned char addr)
+			      unsigned char addr)
 {
 	__hdmi_phy_i2c_write(hdmi, data, addr);
 	return 0;
@@ -839,7 +839,7 @@ static int hdmi_phy_configure(struct imx_hdmi *hdmi, unsigned char prep,
 
 	hdmi_phy_test_clear(hdmi, 1);
 	hdmi_writeb(hdmi, HDMI_PHY_I2CM_SLAVE_ADDR_PHY_GEN2,
-			HDMI_PHY_I2CM_SLAVE_ADDR);
+		    HDMI_PHY_I2CM_SLAVE_ADDR);
 	hdmi_phy_test_clear(hdmi, 0);
 
 	/* PLL/MPLL Cfg - always match on final entry */
@@ -857,9 +857,8 @@ static int hdmi_phy_configure(struct imx_hdmi *hdmi, unsigned char prep,
 			break;
 
 	if (i >= ARRAY_SIZE(curr_ctrl)) {
-		dev_err(hdmi->dev,
-				"Pixel clock %d - unsupported by HDMI\n",
-				hdmi->hdmi_data.video_mode.mpixelclock);
+		dev_err(hdmi->dev, "Pixel clock %d - unsupported by HDMI\n",
+			hdmi->hdmi_data.video_mode.mpixelclock);
 		return -EINVAL;
 	}
 
@@ -1223,21 +1222,21 @@ static int imx_hdmi_setup(struct imx_hdmi *hdmi, struct drm_display_mode *mode)
 	}
 
 	if ((hdmi->vic == 6) || (hdmi->vic == 7) ||
-		(hdmi->vic == 21) || (hdmi->vic == 22) ||
-		(hdmi->vic == 2) || (hdmi->vic == 3) ||
-		(hdmi->vic == 17) || (hdmi->vic == 18))
+	    (hdmi->vic == 21) || (hdmi->vic == 22) ||
+	    (hdmi->vic == 2) || (hdmi->vic == 3) ||
+	    (hdmi->vic == 17) || (hdmi->vic == 18))
 		hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_601;
 	else
 		hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_709;
 
 	if ((hdmi->vic == 10) || (hdmi->vic == 11) ||
-		(hdmi->vic == 12) || (hdmi->vic == 13) ||
-		(hdmi->vic == 14) || (hdmi->vic == 15) ||
-		(hdmi->vic == 25) || (hdmi->vic == 26) ||
-		(hdmi->vic == 27) || (hdmi->vic == 28) ||
-		(hdmi->vic == 29) || (hdmi->vic == 30) ||
-		(hdmi->vic == 35) || (hdmi->vic == 36) ||
-		(hdmi->vic == 37) || (hdmi->vic == 38))
+	    (hdmi->vic == 12) || (hdmi->vic == 13) ||
+	    (hdmi->vic == 14) || (hdmi->vic == 15) ||
+	    (hdmi->vic == 25) || (hdmi->vic == 26) ||
+	    (hdmi->vic == 27) || (hdmi->vic == 28) ||
+	    (hdmi->vic == 29) || (hdmi->vic == 30) ||
+	    (hdmi->vic == 35) || (hdmi->vic == 36) ||
+	    (hdmi->vic == 37) || (hdmi->vic == 38))
 		hdmi->hdmi_data.video_mode.mpixelrepetitionoutput = 1;
 	else
 		hdmi->hdmi_data.video_mode.mpixelrepetitionoutput = 0;
@@ -1266,9 +1265,9 @@ static int imx_hdmi_setup(struct imx_hdmi *hdmi, struct drm_display_mode *mode)
 	imx_hdmi_enable_video_path(hdmi);
 
 	/* not for DVI mode */
-	if (hdmi->hdmi_data.video_mode.mdvi)
+	if (hdmi->hdmi_data.video_mode.mdvi) {
 		dev_dbg(hdmi->dev, "%s DVI mode\n", __func__);
-	else {
+	} else {
 		dev_dbg(hdmi->dev, "%s CEA mode\n", __func__);
 
 		/* HDMI Initialization Step E - Configure audio */
@@ -1525,7 +1524,7 @@ static irqreturn_t imx_hdmi_irq(int irq, void *dev_id)
 			dev_dbg(hdmi->dev, "EVENT=plugout\n");
 
 			hdmi_modb(hdmi, HDMI_PHY_HPD, HDMI_PHY_HPD,
-				HDMI_PHY_POL0);
+				  HDMI_PHY_POL0);
 
 			imx_hdmi_poweroff(hdmi);
 		}
@@ -1554,7 +1553,7 @@ static int imx_hdmi_register(struct drm_device *drm, struct imx_hdmi *hdmi)
 			 DRM_MODE_ENCODER_TMDS);
 
 	drm_connector_helper_add(&hdmi->connector,
-			&imx_hdmi_connector_helper_funcs);
+				 &imx_hdmi_connector_helper_funcs);
 	drm_connector_init(drm, &hdmi->connector, &imx_hdmi_connector_funcs,
 			   DRM_MODE_CONNECTOR_HDMIA);
 
@@ -1642,40 +1641,36 @@ static int imx_hdmi_bind(struct device *dev, struct device *master, void *data)
 	hdmi->isfr_clk = devm_clk_get(hdmi->dev, "isfr");
 	if (IS_ERR(hdmi->isfr_clk)) {
 		ret = PTR_ERR(hdmi->isfr_clk);
-		dev_err(hdmi->dev,
-			"Unable to get HDMI isfr clk: %d\n", ret);
+		dev_err(hdmi->dev, "Unable to get HDMI isfr clk: %d\n", ret);
 		return ret;
 	}
 
 	ret = clk_prepare_enable(hdmi->isfr_clk);
 	if (ret) {
-		dev_err(hdmi->dev,
-			"Cannot enable HDMI isfr clock: %d\n", ret);
+		dev_err(hdmi->dev, "Cannot enable HDMI isfr clock: %d\n", ret);
 		return ret;
 	}
 
 	hdmi->iahb_clk = devm_clk_get(hdmi->dev, "iahb");
 	if (IS_ERR(hdmi->iahb_clk)) {
 		ret = PTR_ERR(hdmi->iahb_clk);
-		dev_err(hdmi->dev,
-			"Unable to get HDMI iahb clk: %d\n", ret);
+		dev_err(hdmi->dev, "Unable to get HDMI iahb clk: %d\n", ret);
 		goto err_isfr;
 	}
 
 	ret = clk_prepare_enable(hdmi->iahb_clk);
 	if (ret) {
-		dev_err(hdmi->dev,
-			"Cannot enable HDMI iahb clock: %d\n", ret);
+		dev_err(hdmi->dev, "Cannot enable HDMI iahb clock: %d\n", ret);
 		goto err_isfr;
 	}
 
 	/* Product and revision IDs */
 	dev_info(dev,
-		"Detected HDMI controller 0x%x:0x%x:0x%x:0x%x\n",
-		hdmi_readb(hdmi, HDMI_DESIGN_ID),
-		hdmi_readb(hdmi, HDMI_REVISION_ID),
-		hdmi_readb(hdmi, HDMI_PRODUCT_ID0),
-		hdmi_readb(hdmi, HDMI_PRODUCT_ID1));
+		 "Detected HDMI controller 0x%x:0x%x:0x%x:0x%x\n",
+		 hdmi_readb(hdmi, HDMI_DESIGN_ID),
+		 hdmi_readb(hdmi, HDMI_REVISION_ID),
+		 hdmi_readb(hdmi, HDMI_PRODUCT_ID0),
+		 hdmi_readb(hdmi, HDMI_PRODUCT_ID1));
 
 	initialize_hdmi_ih_mutes(hdmi);
 
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH v18 2/12 drm: imx: imx-hdmi: return defer if can't get ddc i2c adapter

In reply to Andy Yan

drm driver may probe before the i2c bus, so the driver should defer probing until it is available

---

Changes in v18: None
Changes in v17: None
Changes in v16: None
Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12:
- refactor of_node_put(ddc_node)

Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4:
- defer probe ddc i2c adapter

Changes in v3: None

 drivers/gpu/drm/imx/imx-hdmi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/imx/imx-hdmi.c +4 -2
index 7fd90ae..7a54d20 100644
@@ -1611,10 +1611,12 @@ static int imx_hdmi_bind(struct device *dev, struct device *master, void *data)
 	ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
 	if (ddc_node) {
 		hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
-		if (!hdmi->ddc)
+		of_node_put(ddc_node);
+		if (!hdmi->ddc) {
 			dev_dbg(hdmi->dev, "failed to read ddc node\n");
+			return -EPROBE_DEFER;
+		}
 
-		of_node_put(ddc_node);
 	} else {
 		dev_dbg(hdmi->dev, "no ddc property found\n");
 	}
Signature · 1 line
1.9.1
author
#3 lore raw

PATCH v18 3/12 drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode

In reply to Andy Yan

IMX6 and Rockchip RK3288 and JZ4780 (Ingenic Xburst/MIPS) use the interface compatible Designware HDMI IP, but they also have some lightly differences, such as phy pll configuration, register width, 4K support, clk useage, and the crtc mux configuration is also platform specific.

To reuse the imx hdmi driver, convert it to drm_bridge

handle encoder in imx-hdmi_pltfm.c, as most of the encoder operation are platform specific such as crtc select and panel format set

This patch depends on Russell King's patch:
drm: imx: convert imx-drm to use the generic DRM OF helper
http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2014-July/053484.html

---

Changes in v18:
- remove a multiple blank lines in imx-hdmi.c
- fix a checkpatch warning in imx-hdmi_pltfm.c

Changes in v17:
- remove platform device stuff, adviced by Russell King

Changes in v16:
- use the common binding for the clocks

Changes in v15: None
Changes in v14:
- add defer probing, adviced by Philipp Zabel

Changes in v13:
- split platform specific phy configuration

Changes in v12:
- squash patch <convert dw_hdmi to drm_bridge>

Changes in v11:
- squash patch <split some phy configuration to platform driver>

Changes in v10:
- split generic dw_hdmi.c improvements from patch#11 (add rk3288 support)

Changes in v9: None
Changes in v8: None
Changes in v7:
- remove unused variables from structure dw_hdmi
- remove a wrong modification
- add copyrights for dw_hdmi-imx.c

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/imx/Makefile         |   2 +-
 drivers/gpu/drm/imx/imx-hdmi.c       | 258 +++++++++++++----------------------
 drivers/gpu/drm/imx/imx-hdmi.h       |  15 ++
 drivers/gpu/drm/imx/imx-hdmi_pltfm.c | 203 +++++++++++++++++++++++++++
 4 files changed, 315 insertions(+), 163 deletions(-)
 create mode 100644 drivers/gpu/drm/imx/imx-hdmi_pltfm.c
drivers/gpu/drm/imx/Makefile +1 -1
index 582c438..63cf56a 100644
@@ -9,4 +9,4 @@ obj-$(CONFIG_DRM_IMX_LDB) += imx-ldb.o
 
 imx-ipuv3-crtc-objs  := ipuv3-crtc.o ipuv3-plane.o
 obj-$(CONFIG_DRM_IMX_IPUV3)	+= imx-ipuv3-crtc.o
-obj-$(CONFIG_DRM_IMX_HDMI) += imx-hdmi.o
+obj-$(CONFIG_DRM_IMX_HDMI) += imx-hdmi.o imx-hdmi_pltfm.o
drivers/gpu/drm/imx/imx-hdmi.c +96 -162

398 lines not on this page · raw message

drivers/gpu/drm/imx/imx-hdmi.h +15 -0
index 39b6776..86c6c5b 100644
@@ -1029,4 +1029,19 @@ enum {
 	HDMI_A_VIDPOLCFG_HSYNCPOL_ACTIVE_HIGH = 0x2,
 	HDMI_A_VIDPOLCFG_HSYNCPOL_ACTIVE_LOW = 0x0,
 };
+
+enum imx_hdmi_devtype {
+	IMX6Q_HDMI,
+	IMX6DL_HDMI,
+};
+
+struct imx_hdmi_plat_data {
+	enum imx_hdmi_devtype dev_type;
+};
+
+int imx_hdmi_bind(struct device *dev, struct device *master,
+		  void *data, struct drm_encoder *encoder,
+		  struct resource *iores, int irq,
+		  const struct imx_hdmi_plat_data *plat_data);
+void imx_hdmi_unbind(struct device *dev, struct device *master, void *data);
 #endif /* __IMX_HDMI_H__ */
drivers/gpu/drm/imx/imx-hdmi_pltfm.c new file +203 -0

203 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer
#4 lore raw

PATCH 3/12 drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode

From: Andy Yan <[email protected]>

IMX6 and Rockchip RK3288 and JZ4780 (Ingenic Xburst/MIPS) use the interface compatible Designware HDMI IP, but they also have some lightly differences, such as phy pll configuration, register width, 4K support, clk useage, and the crtc mux configuration is also platform specific.

To reuse the imx hdmi driver, convert it to drm_bridge

handle encoder in imx-hdmi_pltfm.c, as most of the encoder operation are platform specific such as crtc select and panel format set

This patch depends on Russell King's patch:
drm: imx: convert imx-drm to use the generic DRM OF helper
http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2014-July/053484.html

---
Changes in v18.1:
- adapt to THIS_MODULE cleanup

Changes in v18:
- remove a multiple blank lines in imx-hdmi.c
- fix a checkpatch warning in imx-hdmi_pltfm.c

Changes in v17:
- remove platform device stuff, adviced by Russell King

Changes in v16:
- use the common binding for the clocks

Changes in v15: None
Changes in v14:
- add defer probing, adviced by Philipp Zabel

Changes in v13:
- split platform specific phy configuration

Changes in v12:
- squash patch <convert dw_hdmi to drm_bridge>

Changes in v11:
- squash patch <split some phy configuration to platform driver>

Changes in v10:
- split generic dw_hdmi.c improvements from patch#11 (add rk3288 support)

Changes in v9: None
Changes in v8: None
Changes in v7:
- remove unused variables from structure dw_hdmi
- remove a wrong modification
- add copyrights for dw_hdmi-imx.c

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/imx/Makefile         |   2 +-
 drivers/gpu/drm/imx/imx-hdmi.c       | 258 +++++++++++++----------------------
 drivers/gpu/drm/imx/imx-hdmi.h       |  15 ++
 drivers/gpu/drm/imx/imx-hdmi_pltfm.c | 203 +++++++++++++++++++++++++++
 4 files changed, 315 insertions(+), 163 deletions(-)
 create mode 100644 drivers/gpu/drm/imx/imx-hdmi_pltfm.c
drivers/gpu/drm/imx/Makefile +1 -1
index 582c438..63cf56a 100644
@@ -9,4 +9,4 @@ obj-$(CONFIG_DRM_IMX_LDB) += imx-ldb.o
 
 imx-ipuv3-crtc-objs  := ipuv3-crtc.o ipuv3-plane.o
 obj-$(CONFIG_DRM_IMX_IPUV3)	+= imx-ipuv3-crtc.o
-obj-$(CONFIG_DRM_IMX_HDMI) += imx-hdmi.o
+obj-$(CONFIG_DRM_IMX_HDMI) += imx-hdmi.o imx-hdmi_pltfm.o
drivers/gpu/drm/imx/imx-hdmi.c +96 -161

397 lines not on this page · raw message

drivers/gpu/drm/imx/imx-hdmi.h +15 -0
index 39b6776..86c6c5b 100644
@@ -1029,4 +1029,19 @@ enum {
 	HDMI_A_VIDPOLCFG_HSYNCPOL_ACTIVE_HIGH = 0x2,
 	HDMI_A_VIDPOLCFG_HSYNCPOL_ACTIVE_LOW = 0x0,
 };
+
+enum imx_hdmi_devtype {
+	IMX6Q_HDMI,
+	IMX6DL_HDMI,
+};
+
+struct imx_hdmi_plat_data {
+	enum imx_hdmi_devtype dev_type;
+};
+
+int imx_hdmi_bind(struct device *dev, struct device *master,
+		  void *data, struct drm_encoder *encoder,
+		  struct resource *iores, int irq,
+		  const struct imx_hdmi_plat_data *plat_data);
+void imx_hdmi_unbind(struct device *dev, struct device *master, void *data);
 #endif /* __IMX_HDMI_H__ */
drivers/gpu/drm/imx/imx-hdmi_pltfm.c new file +203 -0

203 lines not on this page · raw message

Signature · 1 line
1.9.1
#5 lore raw

Re: [PATCH v18.1 03/12] drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode

Quoted 1 line · Heiko Stübner

+static void imx_hdmi_bridge_nope(struct drm_bridge *bridge)

"_nope" ? As in "No"? Or should this be "_nop" for no-operation ?

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
author
#6 lore raw

PATCH v18 4/12 drm: imx: imx-hdmi: split phy configuration to platform driver

In reply to Andy Yan

hdmi phy configuration is platform specific, which can be adusted according to the board to get the best SI

---

Changes in v18: None
Changes in v17: None
Changes in v16: None
Changes in v15: None
Changes in v14: None
Changes in v13:
- split phy configuration from patch#4

Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/imx/imx-hdmi.c       | 85 +++++++-----------------------------
 drivers/gpu/drm/imx/imx-hdmi.h       | 29 ++++++++++++
 drivers/gpu/drm/imx/imx-hdmi_pltfm.c | 57 ++++++++++++++++++++++++
 3 files changed, 101 insertions(+), 70 deletions(-)
drivers/gpu/drm/imx/imx-hdmi.c +15 -70
index d72f82c..409fb4f 100644
@@ -713,76 +713,14 @@ static void imx_hdmi_phy_sel_interface_control(struct imx_hdmi *hdmi, u8 enable)
 			 HDMI_PHY_CONF0_SELDIPIF_MASK);
 }
 
-enum {
-	RES_8,
-	RES_10,
-	RES_12,
-	RES_MAX,
-};
-
-struct mpll_config {
-	unsigned long mpixelclock;
-	struct {
-		u16 cpce;
-		u16 gmp;
-	} res[RES_MAX];
-};
-
-static const struct mpll_config mpll_config[] = {
-	{
-		45250000, {
-			{ 0x01e0, 0x0000 },
-			{ 0x21e1, 0x0000 },
-			{ 0x41e2, 0x0000 }
-		},
-	}, {
-		92500000, {
-			{ 0x0140, 0x0005 },
-			{ 0x2141, 0x0005 },
-			{ 0x4142, 0x0005 },
-		},
-	}, {
-		148500000, {
-			{ 0x00a0, 0x000a },
-			{ 0x20a1, 0x000a },
-			{ 0x40a2, 0x000a },
-		},
-	}, {
-		~0UL, {
-			{ 0x00a0, 0x000a },
-			{ 0x2001, 0x000f },
-			{ 0x4002, 0x000f },
-		},
-	}
-};
-
-struct curr_ctrl {
-	unsigned long mpixelclock;
-	u16 curr[RES_MAX];
-};
-
-static const struct curr_ctrl curr_ctrl[] = {
-	/*	pixelclk     bpp8    bpp10   bpp12 */
-	{
-		 54000000, { 0x091c, 0x091c, 0x06dc },
-	}, {
-		 58400000, { 0x091c, 0x06dc, 0x06dc },
-	}, {
-		 72000000, { 0x06dc, 0x06dc, 0x091c },
-	}, {
-		 74250000, { 0x06dc, 0x0b5c, 0x091c },
-	}, {
-		118800000, { 0x091c, 0x091c, 0x06dc },
-	}, {
-		216000000, { 0x06dc, 0x0b5c, 0x091c },
-	}
-};
-
 static int hdmi_phy_configure(struct imx_hdmi *hdmi, unsigned char prep,
 			      unsigned char res, int cscon)
 {
 	unsigned res_idx, i;
 	u8 val, msec;
+	const struct mpll_config *mpll_config = hdmi->plat_data->mpll_cfg;
+	const struct curr_ctrl   *curr_ctrl = hdmi->plat_data->cur_ctr;
+	const struct sym_term *sym_term =  hdmi->plat_data->sym_term;
 
 	if (prep)
 		return -EINVAL;
@@ -828,7 +766,7 @@ static int hdmi_phy_configure(struct imx_hdmi *hdmi, unsigned char prep,
 	hdmi_phy_test_clear(hdmi, 0);
 
 	/* PLL/MPLL Cfg - always match on final entry */
-	for (i = 0; i < ARRAY_SIZE(mpll_config) - 1; i++)
+	for (i = 0; mpll_config[i].mpixelclock != (~0UL); i++)
 		if (hdmi->hdmi_data.video_mode.mpixelclock <=
 		    mpll_config[i].mpixelclock)
 			break;
@@ -836,12 +774,12 @@ static int hdmi_phy_configure(struct imx_hdmi *hdmi, unsigned char prep,
 	hdmi_phy_i2c_write(hdmi, mpll_config[i].res[res_idx].cpce, 0x06);
 	hdmi_phy_i2c_write(hdmi, mpll_config[i].res[res_idx].gmp, 0x15);
 
-	for (i = 0; i < ARRAY_SIZE(curr_ctrl); i++)
+	for (i = 0; curr_ctrl[i].mpixelclock != (~0UL); i++)
 		if (hdmi->hdmi_data.video_mode.mpixelclock <=
 		    curr_ctrl[i].mpixelclock)
 			break;
 
-	if (i >= ARRAY_SIZE(curr_ctrl)) {
+	if (curr_ctrl[i].mpixelclock == (~0UL)) {
 		dev_err(hdmi->dev, "Pixel clock %d - unsupported by HDMI\n",
 			hdmi->hdmi_data.video_mode.mpixelclock);
 		return -EINVAL;
@@ -852,10 +790,17 @@ static int hdmi_phy_configure(struct imx_hdmi *hdmi, unsigned char prep,
 
 	hdmi_phy_i2c_write(hdmi, 0x0000, 0x13);  /* PLLPHBYCTRL */
 	hdmi_phy_i2c_write(hdmi, 0x0006, 0x17);
+
+	for (i = 0; sym_term[i].mpixelclock != (~0UL); i++)
+		if (hdmi->hdmi_data.video_mode.mpixelclock <=
+		    sym_term[i].mpixelclock)
+			break;
+
 	/* RESISTANCE TERM 133Ohm Cfg */
-	hdmi_phy_i2c_write(hdmi, 0x0005, 0x19);  /* TXTERM */
+	hdmi_phy_i2c_write(hdmi, sym_term[i].term, 0x19);  /* TXTERM */
 	/* PREEMP Cgf 0.00 */
-	hdmi_phy_i2c_write(hdmi, 0x800d, 0x09);  /* CKSYMTXCTRL */
+	hdmi_phy_i2c_write(hdmi, sym_term[i].sym_ctr, 0x09);  /* CKSYMTXCTRL */
+
 	/* TX/CK LVL 10 */
 	hdmi_phy_i2c_write(hdmi, 0x01ad, 0x0E);  /* VLEVCTRL */
 	/* REMOVE CLK TERM */
drivers/gpu/drm/imx/imx-hdmi.h +29 -0
index 86c6c5b..db407f0 100644
@@ -1037,6 +1037,35 @@ enum imx_hdmi_devtype {
 
 struct imx_hdmi_plat_data {
 	enum imx_hdmi_devtype dev_type;
+	const struct mpll_config *mpll_cfg;
+	const struct curr_ctrl *cur_ctr;
+	const struct sym_term *sym_term;
+};
+
+enum {
+	RES_8,
+	RES_10,
+	RES_12,
+	RES_MAX,
+};
+
+struct mpll_config {
+	unsigned long mpixelclock;
+	struct {
+		u16 cpce;
+		u16 gmp;
+	} res[RES_MAX];
+};
+
+struct curr_ctrl {
+	unsigned long mpixelclock;
+	u16 curr[RES_MAX];
+};
+
+struct sym_term {
+	unsigned long mpixelclock;
+	u16 sym_ctr;    /*clock symbol and transmitter control*/
+	u16 term;       /*transmission termination value*/
 };
 
 int imx_hdmi_bind(struct device *dev, struct device *master,
drivers/gpu/drm/imx/imx-hdmi_pltfm.c +57 -0

73 lines not on this page · raw message

Signature · 1 line
1.9.1
#7 lore raw

Re: [PATCH v18 04/12] drm: imx: imx-hdmi: split phy configuration to platform driver

Quoted 1 line · Andy Yan

hdmi phy configuration is platform specific, which can be adusted

Minor typo: adjusted

Signature · 6 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#8 lore raw

PATCH v18 5/12 drm: imx: imx-hdmi: move imx-hdmi to bridge/dw_hdmi

In reply to Andy Yan

the original imx hdmi driver is under drm/imx/,
which depends on imx-drm, so move the imx hdmi
driver out to drm/bridge and rename it to dw_hdmi

---

Changes in v18: None
Changes in v17:
- remove prompt message of dw_hdmi, adviced by Russel King

Changes in v16: None
Changes in v15:
- add prefix dw_hdmi/DW_HDMI for public used dw_hdmi structs adviced by Philipp Zabel
- remove THIS_MODULE in platform driver

Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/Kconfig                     |   5 +
 drivers/gpu/drm/bridge/Makefile                    |   1 +
 .../gpu/drm/{imx/imx-hdmi.c => bridge/dw_hdmi.c}   | 278 +++++++++++----------
 .../gpu/drm/{imx/imx-hdmi.h => bridge/dw_hdmi.h}   |  43 ----
 drivers/gpu/drm/imx/Kconfig                        |   1 +
 drivers/gpu/drm/imx/Makefile                       |   2 +-
 .../drm/imx/{imx-hdmi_pltfm.c => dw_hdmi-imx.c}    | 110 ++++----
 include/drm/bridge/dw_hdmi.h                       |  60 +++++
 8 files changed, 262 insertions(+), 238 deletions(-)
 rename drivers/gpu/drm/{imx/imx-hdmi.c => bridge/dw_hdmi.c} (84%)
 rename drivers/gpu/drm/{imx/imx-hdmi.h => bridge/dw_hdmi.h} (98%)
 rename drivers/gpu/drm/imx/{imx-hdmi_pltfm.c => dw_hdmi-imx.c} (58%)
 create mode 100644 include/drm/bridge/dw_hdmi.h
drivers/gpu/drm/bridge/Kconfig +5 -0
index 884923f..4d822f0 100644
@@ -3,3 +3,8 @@ config DRM_PTN3460
 	depends on DRM
 	select DRM_KMS_HELPER
 	---help---
+
+config DRM_DW_HDMI
+	bool
+	depends on DRM
+	select DRM_KMS_HELPER
drivers/gpu/drm/bridge/Makefile +1 -0
index b4733e1..d8a8cfd 100644
@@ -1,3 +1,4 @@
 ccflags-y := -Iinclude/drm
 
 obj-$(CONFIG_DRM_PTN3460) += ptn3460.o
+obj-$(CONFIG_DRM_DW_HDMI) += dw_hdmi.o
drivers/gpu/drm/bridge/dw_hdmi.c renamed from drivers/gpu/drm/imx/imx-hdmi.c +140 -138

777 lines not on this page · raw message

drivers/gpu/drm/bridge/dw_hdmi.h renamed from drivers/gpu/drm/imx/imx-hdmi.h +0 -43

47 lines not on this page · raw message

drivers/gpu/drm/imx/Kconfig +1 -0
index 82fb758..7070077 100644
@@ -48,6 +48,7 @@ config DRM_IMX_IPUV3
 
 config DRM_IMX_HDMI
 	tristate "Freescale i.MX DRM HDMI"
+	select DRM_DW_HDMI
 	depends on DRM_IMX
 	help
 	  Choose this if you want to use HDMI on i.MX6.
drivers/gpu/drm/imx/Makefile +1 -1
index 63cf56a..f3ecd89 100644
@@ -9,4 +9,4 @@ obj-$(CONFIG_DRM_IMX_LDB) += imx-ldb.o
 
 imx-ipuv3-crtc-objs  := ipuv3-crtc.o ipuv3-plane.o
 obj-$(CONFIG_DRM_IMX_IPUV3)	+= imx-ipuv3-crtc.o
-obj-$(CONFIG_DRM_IMX_HDMI) += imx-hdmi.o imx-hdmi_pltfm.o
+obj-$(CONFIG_DRM_IMX_HDMI) += dw_hdmi-imx.o
drivers/gpu/drm/imx/dw_hdmi-imx.c renamed from drivers/gpu/drm/imx/imx-hdmi_pltfm.c +54 -56

244 lines not on this page · raw message

include/drm/bridge/dw_hdmi.h new file +60 -0

60 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#9 lore raw

PATCH v18 6/12 dt-bindings: add document for dw_hdmi

In reply to Andy Yan

---

Changes in v18:
- add port bindings
- correct some spelling mistakes in dw_hdmi bindings doc

Changes in v17: None
Changes in v16:
- describe ddc-i2c-bus as optional
- add common clocks bindings

Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8:
- correct some spelling mistake
- modify ddc-i2c-bus and interrupt description

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 .../devicetree/bindings/drm/bridge/dw_hdmi.txt     | 50 ++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt new file +50 -0
new file mode 100644
index 0000000..a905c14
@@ -0,0 +1,50 @@
+DesignWare HDMI bridge bindings
+
+Required properties:
+- compatible: platform specific such as:
+   * "snps,dw-hdmi-tx"
+   * "fsl,imx6q-hdmi"
+   * "fsl,imx6dl-hdmi"
+   * "rockchip,rk3288-dw-hdmi"
+- reg: Physical base address and length of the controller's registers.
+- interrupts: The HDMI interrupt number
+- clocks, clock-names : must have the phandles to the HDMI iahb and isfr clocks,
+  as described in Documentation/devicetree/bindings/clock/clock-bindings.txt,
+  the clocks are soc specific, the clock-names should be "iahb", "isfr"
+-port@[X]: SoC specific port nodes with endpoint definitions as defined
+   in Documentation/devicetree/bindings/media/video-interfaces.txt,
+   please refer to the SoC specific binding document:
+    * Documentation/devicetree/bindings/drm/imx/hdmi.txt
+    * Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt
+
+Optional properties
+- reg-io-width: the width of the reg:1,4, default set to 1 if not present
+- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
+- clocks, clock-names: phandle to the HDMI CEC clock, name should be "cec"
+
+Example:
+	hdmi: hdmi@0120000 {
+		compatible = "fsl,imx6q-hdmi";
+		reg = <0x00120000 0x9000>;
+		interrupts = <0 115 0x04>;
+		gpr = <&gpr>;
+		clocks = <&clks 123>, <&clks 124>;
+		clock-names = "iahb", "isfr";
+		ddc-i2c-bus = <&i2c2>;
+
+		port@0 {
+			reg = <0>;
+
+			hdmi_mux_0: endpoint {
+				remote-endpoint = <&ipu1_di0_hdmi>;
+			};
+		};
+
+		port@1 {
+			reg = <1>;
+
+			hdmi_mux_1: endpoint {
+				remote-endpoint = <&ipu1_di1_hdmi>;
+			};
+		};
+	};
Signature · 1 line
1.9.1
#10 lore raw

Re: [PATCH v18 06/12] dt-bindings: add document for dw_hdmi

Am Freitag, den 05.12.2014, 14:27 +0800 schrieb Andy Yan:

Quoted 1 line

This binding is mostly a copy of the existing Documentation/devicetree/bindings/drm/imx/hdmi.txt, but there is a new reg-io-width property to configure the register access bus width and we have added new compatibles "rockchip,rk3288-dw-hdmi" and the common "snps,dw-hdmi-tx". Could we get an Ack for this and patch 11 by the device tree maintainers?

regards
Philipp

Quoted 88 lines

---

Changes in v18:
- add port bindings
- correct some spelling mistakes in dw_hdmi bindings doc

Changes in v17: None
Changes in v16:
- describe ddc-i2c-bus as optional
- add common clocks bindings

Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8:
- correct some spelling mistake
- modify ddc-i2c-bus and interrupt description

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 .../devicetree/bindings/drm/bridge/dw_hdmi.txt     | 50 ++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt new file +50 -0
new file mode 100644
index 0000000..a905c14
@@ -0,0 +1,50 @@
+DesignWare HDMI bridge bindings
+
+Required properties:
+- compatible: platform specific such as:
+   * "snps,dw-hdmi-tx"
+   * "fsl,imx6q-hdmi"
+   * "fsl,imx6dl-hdmi"
+   * "rockchip,rk3288-dw-hdmi"
+- reg: Physical base address and length of the controller's registers.
+- interrupts: The HDMI interrupt number
+- clocks, clock-names : must have the phandles to the HDMI iahb and isfr clocks,
+  as described in Documentation/devicetree/bindings/clock/clock-bindings.txt,
+  the clocks are soc specific, the clock-names should be "iahb", "isfr"
+-port@[X]: SoC specific port nodes with endpoint definitions as defined
+   in Documentation/devicetree/bindings/media/video-interfaces.txt,
+   please refer to the SoC specific binding document:
+    * Documentation/devicetree/bindings/drm/imx/hdmi.txt
+    * Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt
+
+Optional properties
+- reg-io-width: the width of the reg:1,4, default set to 1 if not present
+- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
+- clocks, clock-names: phandle to the HDMI CEC clock, name should be "cec"
+
+Example:
+	hdmi: hdmi@0120000 {
+		compatible = "fsl,imx6q-hdmi";
+		reg = <0x00120000 0x9000>;
+		interrupts = <0 115 0x04>;
+		gpr = <&gpr>;
+		clocks = <&clks 123>, <&clks 124>;
+		clock-names = "iahb", "isfr";
+		ddc-i2c-bus = <&i2c2>;
+
+		port@0 {
+			reg = <0>;
+
+			hdmi_mux_0: endpoint {
+				remote-endpoint = <&ipu1_di0_hdmi>;
+			};
+		};
+
+		port@1 {
+			reg = <1>;
+
+			hdmi_mux_1: endpoint {
+				remote-endpoint = <&ipu1_di1_hdmi>;
+			};
+		};
+	};
author
#11 lore raw

Re: [PATCH v18 06/12] dt-bindings: add document for dw_hdmi

Hi Mark Rutland, Rob Herring, Pawel Moll, Ian Campbell, Kumar Gala:
Would you please give an Ack for this?

Quoted 91 lines · Philipp Zabel

Am Freitag, den 05.12.2014, 14:27 +0800 schrieb Andy Yan:

Quoted 1 line

This binding is mostly a copy of the existing Documentation/devicetree/bindings/drm/imx/hdmi.txt, but there is a new reg-io-width property to configure the register access bus width and we have added new compatibles "rockchip,rk3288-dw-hdmi" and the common "snps,dw-hdmi-tx". Could we get an Ack for this and patch 11 by the device tree maintainers?

regards
Philipp

Quoted 80 lines

---

Changes in v18:
- add port bindings
- correct some spelling mistakes in dw_hdmi bindings doc

Changes in v17: None
Changes in v16:
- describe ddc-i2c-bus as optional
- add common clocks bindings

Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8:
- correct some spelling mistake
- modify ddc-i2c-bus and interrupt description

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

  .../devicetree/bindings/drm/bridge/dw_hdmi.txt     | 50 ++++++++++++++++++++++
  1 file changed, 50 insertions(+)

create mode 100644 Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt

Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt new file +42 -0
new file mode 100644
index 0000000..a905c14
@@ -0,0 +1,50 @@
+DesignWare HDMI bridge bindings
+
+Required properties:
+- compatible: platform specific such as:
+   * "snps,dw-hdmi-tx"
+   * "fsl,imx6q-hdmi"
+   * "fsl,imx6dl-hdmi"
+   * "rockchip,rk3288-dw-hdmi"
+- reg: Physical base address and length of the controller's registers.
+- interrupts: The HDMI interrupt number
+- clocks, clock-names : must have the phandles to the HDMI iahb and isfr clocks,
+  as described in Documentation/devicetree/bindings/clock/clock-bindings.txt,
+  the clocks are soc specific, the clock-names should be "iahb", "isfr"
+-port@[X]: SoC specific port nodes with endpoint definitions as defined
+   in Documentation/devicetree/bindings/media/video-interfaces.txt,
+   please refer to the SoC specific binding document:
+    * Documentation/devicetree/bindings/drm/imx/hdmi.txt
+    * Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt
+
+Optional properties
+- reg-io-width: the width of the reg:1,4, default set to 1 if not present
+- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
+- clocks, clock-names: phandle to the HDMI CEC clock, name should be "cec"
+
+Example:
+	hdmi: hdmi@0120000 {
+		compatible = "fsl,imx6q-hdmi";
+		reg = <0x00120000 0x9000>;
+		interrupts = <0 115 0x04>;
+		gpr = <&gpr>;
+		clocks = <&clks 123>, <&clks 124>;
+		clock-names = "iahb", "isfr";
+		ddc-i2c-bus = <&i2c2>;
+
+		port@0 {
+			reg = <0>;
+
+			hdmi_mux_0: endpoint {
+				remote-endpoint = <&ipu1_di0_hdmi>;
+			};
+		};
+
Quoted 12 lines

Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt line 50

Quoted 8 lines
Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt new file +8 -0
+		port@1 {
+			reg = <1>;
+
+			hdmi_mux_1: endpoint {
+				remote-endpoint = <&ipu1_di1_hdmi>;
+			};
+		};
+	};

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

author
#12 lore raw

PATCH v18 7/12 drm: bridge/dw_hdmi: add support for multi-byte register width access

In reply to Andy Yan

On rockchip rk3288, only word(32-bit) accesses are permitted for hdmi registers. Byte width accesses (writeb, readb) generate an imprecise external abort.

---

Changes in v18: None
Changes in v17: None
Changes in v16: None
Changes in v15:
- remove unio of the multi-byte register access, adviced by Philipp Zabel

Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6:
- refactor register access without reg_shift

Changes in v5:
- refactor reg-io-width

Changes in v4: None
Changes in v3:
- split multi-register access to one indepent patch

 drivers/gpu/drm/bridge/dw_hdmi.c | 44 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/dw_hdmi.c +42 -2
index e0a7bc3..d49861c 100644
@@ -128,18 +128,41 @@ struct dw_hdmi {
 
 	unsigned int sample_rate;
 	int ratio;
+
+	void (*write)(struct dw_hdmi *hdmi, u8 val, int offset);
+	u8 (*read)(struct dw_hdmi *hdmi, int offset);
 };
 
-static inline void hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset)
+static void dw_hdmi_writel(struct dw_hdmi *hdmi, u8 val, int offset)
+{
+	writel(val, hdmi->regs + (offset << 2));
+}
+
+static u8 dw_hdmi_readl(struct dw_hdmi *hdmi, int offset)
+{
+	return readl(hdmi->regs + (offset << 2));
+}
+
+static void dw_hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset)
 {
 	writeb(val, hdmi->regs + offset);
 }
 
-static inline u8 hdmi_readb(struct dw_hdmi *hdmi, int offset)
+static u8 dw_hdmi_readb(struct dw_hdmi *hdmi, int offset)
 {
 	return readb(hdmi->regs + offset);
 }
 
+static inline void hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset)
+{
+	hdmi->write(hdmi, val, offset);
+}
+
+static inline u8 hdmi_readb(struct dw_hdmi *hdmi, int offset)
+{
+	return hdmi->read(hdmi, offset);
+}
+
 static void hdmi_modb(struct dw_hdmi *hdmi, u8 data, u8 mask, unsigned reg)
 {
 	u8 val = hdmi_readb(hdmi, reg) & ~mask;
@@ -1511,6 +1534,7 @@ int dw_hdmi_bind(struct device *dev, struct device *master,
 	struct device_node *ddc_node;
 	struct dw_hdmi *hdmi;
 	int ret;
+	u32 val = 1;
 
 	hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL);
 	if (!hdmi)
@@ -1523,6 +1547,22 @@ int dw_hdmi_bind(struct device *dev, struct device *master,
 	hdmi->ratio = 100;
 	hdmi->encoder = encoder;
 
+	of_property_read_u32(np, "reg-io-width", &val);
+
+	switch (val) {
+	case 4:
+		hdmi->write = dw_hdmi_writel;
+		hdmi->read = dw_hdmi_readl;
+		break;
+	case 1:
+		hdmi->write = dw_hdmi_writeb;
+		hdmi->read = dw_hdmi_readb;
+		break;
+	default:
+		dev_err(dev, "reg-io-width must be 1 or 4\n");
+		return -EINVAL;
+	}
+
 	ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
 	if (ddc_node) {
 		hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
Signature · 1 line
1.9.1
author
#13 lore raw

PATCH v18 8/12 drm: bridge/dw_hdmi: add mode_valid support

In reply to Andy Yan

some platform may not support all the display mode, add mode_valid interface check it

---

Changes in v18: None
Changes in v17: None
Changes in v16: None
Changes in v15: None
Changes in v14:
- remove drm_connector_register, because imx-drm core has registered connector

Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/dw_hdmi.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/bridge/dw_hdmi.c +15 -0
index d49861c..d5bec0c 100644
@@ -1405,6 +1405,20 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector)
 	return 0;
 }
 
+static enum drm_mode_status
+dw_hdmi_connector_mode_valid(struct drm_connector *connector,
+			     struct drm_display_mode *mode)
+{
+	struct dw_hdmi *hdmi = container_of(connector,
+					   struct dw_hdmi, connector);
+	enum drm_mode_status mode_status = MODE_OK;
+
+	if (hdmi->plat_data->mode_valid)
+		mode_status = hdmi->plat_data->mode_valid(connector, mode);
+
+	return mode_status;
+}
+
 static struct drm_encoder *dw_hdmi_connector_best_encoder(struct drm_connector
 							   *connector)
 {
@@ -1429,6 +1443,7 @@ static struct drm_connector_funcs dw_hdmi_connector_funcs = {
 
 static struct drm_connector_helper_funcs dw_hdmi_connector_helper_funcs = {
 	.get_modes = dw_hdmi_connector_get_modes,
+	.mode_valid = dw_hdmi_connector_mode_valid,
 	.best_encoder = dw_hdmi_connector_best_encoder,
 };
 
Signature · 1 line
1.9.1
author
#14 lore raw

PATCH v18 9/12 drm: bridge/dw_hdmi: clear i2cmphy_stat0 reg in hdmi_phy_wait_i2c_done

In reply to Andy Yan

HDMI_IH_I2CMPHY_STAT0 is a clear on write register, which indicates i2cm operation status(i2c transfer done or error), every hdmi phy register configuration must check this register to make sure the configuration has complete. But the indication bit should be cleared after check, otherwise the corresponding bit will hold on forever, this may give a wrong signal for next check.

---

Changes in v18: None
Changes in v17: None
Changes in v16: None
Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/dw_hdmi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/dw_hdmi.c +5 -1
index d5bec0c..2264ec1 100644
@@ -666,11 +666,15 @@ static inline void hdmi_phy_test_dout(struct dw_hdmi *hdmi,
 
 static bool hdmi_phy_wait_i2c_done(struct dw_hdmi *hdmi, int msec)
 {
-	while ((hdmi_readb(hdmi, HDMI_IH_I2CMPHY_STAT0) & 0x3) == 0) {
+	u32 val;
+
+	while ((val = hdmi_readb(hdmi, HDMI_IH_I2CMPHY_STAT0) & 0x3) == 0) {
 		if (msec-- == 0)
 			return false;
 		udelay(1000);
 	}
+	hdmi_writeb(hdmi, val, HDMI_IH_I2CMPHY_STAT0);
+
 	return true;
 }
 
Signature · 1 line
1.9.1
author
#15 lore raw

PATCH v18 10/12 drm: bridge/dw_hdmi: add function dw_hdmi_phy_enable_spare

In reply to Andy Yan

RK3288 HDMI will not work without the spare bit of HDMI_PHY_CONF0 enable

---

Changes in v18: None
Changes in v17: None
Changes in v16: None
Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/dw_hdmi.c | 7 +++++++
 drivers/gpu/drm/bridge/dw_hdmi.h | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/dw_hdmi.c +7 -0
index 2264ec1..cecc46a 100644
@@ -713,6 +713,13 @@ static void dw_hdmi_phy_enable_tmds(struct dw_hdmi *hdmi, u8 enable)
 			 HDMI_PHY_CONF0_ENTMDS_MASK);
 }
 
+static void dw_hdmi_phy_enable_spare(struct dw_hdmi *hdmi, u8 enable)
+{
+	hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0,
+			 HDMI_PHY_CONF0_SPARECTRL_OFFSET,
+			 HDMI_PHY_CONF0_SPARECTRL_MASK);
+}
+
 static void dw_hdmi_phy_gen2_pddq(struct dw_hdmi *hdmi, u8 enable)
 {
 	hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0,
drivers/gpu/drm/bridge/dw_hdmi.h +2 -1
index baa7849..175dbc8 100644
@@ -837,7 +837,8 @@ enum {
 	HDMI_PHY_CONF0_PDZ_OFFSET = 7,
 	HDMI_PHY_CONF0_ENTMDS_MASK = 0x40,
 	HDMI_PHY_CONF0_ENTMDS_OFFSET = 6,
-	HDMI_PHY_CONF0_SPARECTRL = 0x20,
+	HDMI_PHY_CONF0_SPARECTRL_MASK = 0x20,
+	HDMI_PHY_CONF0_SPARECTRL_OFFSET = 5,
 	HDMI_PHY_CONF0_GEN2_PDDQ_MASK = 0x10,
 	HDMI_PHY_CONF0_GEN2_PDDQ_OFFSET = 4,
 	HDMI_PHY_CONF0_GEN2_TXPWRON_MASK = 0x8,
Signature · 1 line
1.9.1
author
#16 lore raw

PATCH v18 11/12 dt-bindings: Add documentation for rockchip dw hdmi

In reply to Andy Yan

---

Changes in v18:
- correct some spelling mistakes in dw_hdmi-rockchip bindings doc

Changes in v17: None
Changes in v16:
- modify clocks bindings
- descrbie ddc-i2c-bus as optional

Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8:
- Add documentation for rockchip dw hdmi

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 .../devicetree/bindings/video/dw_hdmi-rockchip.txt | 46 ++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt
Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt new file +46 -0
new file mode 100644
index 0000000..668091f
@@ -0,0 +1,46 @@
+Rockchip specific extensions to the Synopsys Designware HDMI
+================================
+
+Required properties:
+- compatible: "rockchip,rk3288-dw-hdmi";
+- reg: Physical base address and length of the controller's registers.
+- clocks: phandle to hdmi iahb and isfr clocks.
+- clock-names: should be "iahb" "isfr"
+- rockchip,grf: this soc should set GRF regs to mux vopl/vopb.
+- interrupts: HDMI interrupt number
+- ports: contain a port node with endpoint definitions as defined in
+  Documentation/devicetree/bindings/media/video-interfaces.txt. For
+  vopb,set the reg = <0> and set the reg = <1> for vopl.
+- reg-io-width: the width of the reg:1,4, the value should be 4 on
+  rk3288 platform
+
+Optional properties
+- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
+- clocks, clock-names: phandle to the HDMI CEC clock, name should be "cec"
+
+Example:
+hdmi: hdmi@ff980000 {
+	compatible = "rockchip,rk3288-dw-hdmi";
+	reg = <0xff980000 0x20000>;
+	reg-io-width = <4>;
+	ddc-i2c-bus = <&i2c5>;
+	rockchip,grf = <&grf>;
+	interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
+	clocks = <&cru  PCLK_HDMI_CTRL>, <&cru SCLK_HDMI_HDCP>;
+	clock-names = "iahb", "isfr";
+	status = "disabled";
+	ports {
+		hdmi_in: port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			hdmi_in_vopb: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&vopb_out_hdmi>;
+			};
+			hdmi_in_vopl: endpoint@1 {
+				reg = <1>;
+				remote-endpoint = <&vopl_out_hdmi>;
+			};
+		};
+	};
+};
Signature · 1 line
1.9.1
author
#17 lore raw

PATCH v18 12/12 drm: bridge/dw_hdmi: add rockchip rk3288 support

In reply to Andy Yan

Rockchip RK3288 hdmi is compatible with dw_hdmi

this patch is depend on patch by Mark Yao
drm: rockchip: Add basic drm driver
see https://lkml.org/lkml/2014/12/2/161

---

Changes in v18: None
Changes in v17:
- parse resource and irq in platform driver

Changes in v16: None
Changes in v15:
- remove THIS_MODULE in platform driver

Changes in v14: None
Changes in v13: None
Changes in v12:
- add comment for the depend on patch

Changes in v11: None
Changes in v10:
- add more display mode support mpll configuration for rk3288

Changes in v9:
- move some phy configuration to platform driver

Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/dw_hdmi.c            |   3 +
 drivers/gpu/drm/rockchip/Kconfig            |  10 +
 drivers/gpu/drm/rockchip/Makefile           |   2 +
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 341 ++++++++++++++++++++++++++++
 include/drm/bridge/dw_hdmi.h                |   1 +
 5 files changed, 357 insertions(+)
 create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
drivers/gpu/drm/bridge/dw_hdmi.c +3 -0
index cecc46a..01c95a8 100644
@@ -852,6 +852,9 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, unsigned char prep,
 	dw_hdmi_phy_gen2_txpwron(hdmi, 1);
 	dw_hdmi_phy_gen2_pddq(hdmi, 0);
 
+	if (hdmi->dev_type == RK3288_HDMI)
+		dw_hdmi_phy_enable_spare(hdmi, 1);
+
 	/*Wait for PHY PLL lock */
 	msec = 5;
 	do {
drivers/gpu/drm/rockchip/Kconfig +10 -0
index ca9f085..6ebebe8 100644
@@ -15,3 +15,13 @@ config DRM_ROCKCHIP
 	  management to userspace. This driver does not provide
 	  2D or 3D acceleration; acceleration is performed by other
 	  IP found on the SoC.
+
+config ROCKCHIP_DW_HDMI
+        bool "Rockchip specific extensions for Synopsys DW HDMI"
+        depends on DRM_ROCKCHIP
+        select DRM_DW_HDMI
+        help
+	  This selects support for Rockchip SoC specific extensions
+	  for the Synopsys DesignWare HDMI driver. If you want to
+	  enable HDMI on RK3288 based SoC, you should selet this
+	  option.
drivers/gpu/drm/rockchip/Makefile +2 -0
index 2cb0672..beed7df 100644
@@ -5,4 +5,6 @@
 rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o rockchip_drm_fbdev.o \
 		rockchip_drm_gem.o
 
+rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
+
 obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o rockchip_drm_vop.o
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +341 -0

341 lines not on this page · raw message

include/drm/bridge/dw_hdmi.h +1 -0
index b64e58a..5a4f490 100644
@@ -22,6 +22,7 @@ enum {
 enum dw_hdmi_devtype {
 	IMX6Q_HDMI,
 	IMX6DL_HDMI,
+	RK3288_HDMI,
 };
 
 struct dw_hdmi_mpll_config {
Signature · 1 line
1.9.1
#18 lore raw

Re: [PATCH v18 12/12] drm: bridge/dw_hdmi: add rockchip rk3288 support

Hi Andy,

This driver adds HDMI to rockchip/drm. The fact that rockchip's hdmi uses dw_hdmi is an implementation detail. I do not think that the names used for rk3288-hdmi should include "dw" in them.

See inline for what I mean...

Quoted 64 lines · Andy Yan

Rockchip RK3288 hdmi is compatible with dw_hdmi

this patch is depend on patch by Mark Yao
drm: rockchip: Add basic drm driver
see https://lkml.org/lkml/2014/12/2/161

---

Changes in v18: None
Changes in v17:
- parse resource and irq in platform driver

Changes in v16: None
Changes in v15:
- remove THIS_MODULE in platform driver

Changes in v14: None
Changes in v13: None
Changes in v12:
- add comment for the depend on patch

Changes in v11: None
Changes in v10:
- add more display mode support mpll configuration for rk3288

Changes in v9:
- move some phy configuration to platform driver

Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/dw_hdmi.c            |   3 +
 drivers/gpu/drm/rockchip/Kconfig            |  10 +
 drivers/gpu/drm/rockchip/Makefile           |   2 +
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 341 ++++++++++++++++++++++++++++
 include/drm/bridge/dw_hdmi.h                |   1 +
 5 files changed, 357 insertions(+)
 create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
drivers/gpu/drm/bridge/dw_hdmi.c +3 -0
index cecc46a..01c95a8 100644
@@ -852,6 +852,9 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, unsigned char prep,
        dw_hdmi_phy_gen2_txpwron(hdmi, 1);
        dw_hdmi_phy_gen2_pddq(hdmi, 0);
 
+       if (hdmi->dev_type == RK3288_HDMI)
+               dw_hdmi_phy_enable_spare(hdmi, 1);
+
        /*Wait for PHY PLL lock */
        msec = 5;
        do {
drivers/gpu/drm/rockchip/Kconfig +0 -0
index ca9f085..6ebebe8 100644

drivers/gpu/drm/rockchip/Kconfig config DRM_ROCKCHIP · line 19

Quoted 5 lines
drivers/gpu/drm/rockchip/Kconfig +2 -0
@@ -15,3 +15,13 @@ config DRM_ROCKCHIP
          management to userspace. This driver does not provide
          2D or 3D acceleration; acceleration is performed by other
          IP found on the SoC.
+
+config ROCKCHIP_DW_HDMI

I would rather call this ROCKCHIP_HDMI, since this driver implements the HDMI for Rockchip. The fact that it uses dw_hdmi is an implementation detail.

drivers/gpu/drm/rockchip/Kconfig config DRM_ROCKCHIP · line 27

Quoted 8 lines
drivers/gpu/drm/rockchip/Kconfig +8 -0
+        bool "Rockchip specific extensions for Synopsys DW HDMI"
+        depends on DRM_ROCKCHIP
+        select DRM_DW_HDMI
+        help
+         This selects support for Rockchip SoC specific extensions
+         for the Synopsys DesignWare HDMI driver. If you want to
+         enable HDMI on RK3288 based SoC, you should selet this
+         option.

This could become simply:

Select this option to enable HDMI support for Rockchip SoCs.

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c

Quoted 16 lines
drivers/gpu/drm/rockchip/Makefile +2 -0
index 2cb0672..beed7df 100644
@@ -5,4 +5,6 @@
 rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o rockchip_drm_fbdev.o \
                rockchip_drm_gem.o
 
+rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
+
 obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o rockchip_drm_vop.o
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +0 -0
new file mode 100644
index 0000000..11d54b0

Similarly, I'd rather this file be called drm_rockchip_hdmi.c to be consistent with the rest of the files in drm/rockchip.

Quoted 26 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +25 -0
@@ -0,0 +1,341 @@
+/*
+ * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
+#include <drm/drm_of.h>
+#include <drm/drmP.h>
+#include <drm/drm_crtc_helper.h>
+#include <drm/drm_edid.h>
+#include <drm/drm_encoder_slave.h>
+#include <drm/bridge/dw_hdmi.h>
+
+#include "rockchip_drm_drv.h"
+#include "rockchip_drm_vop.h"
+
+#define GRF_SOC_CON6                    0x025c
+#define HDMI_SEL_VOP_LIT                (1 << 4)

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c line 35

Quoted 10 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +10 -0
+
+struct rockchip_hdmi {
+       struct device *dev;
+       struct regmap *regmap;
+       struct drm_encoder encoder;
+};
+
+#define to_rockchip_hdmi(x)    container_of(x, struct rockchip_hdmi, x)
+
+static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = {

Let's stick to mpll_config. Not much value to abbreviate an abbreviation.

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c line 38

Quoted 3 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +3 -0
+       {
+               27000000, {
+                       { 0x00b3, 0x0000},

space before all of these '}'.

Quoted 110 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +110 -0
+                       { 0x2153, 0x0000},
+                       { 0x40f3, 0x0000}
+               },
+       }, {
+               36000000, {
+                       { 0x00b3, 0x0000},
+                       { 0x2153, 0x0000},
+                       { 0x40f3, 0x0000}
+               },
+       }, {
+               40000000, {
+                       { 0x00b3, 0x0000},
+                       { 0x2153, 0x0000},
+                       { 0x40f3, 0x0000}
+               },
+       }, {
+               54000000, {
+                       { 0x0072, 0x0001},
+                       { 0x2142, 0x0001},
+                       { 0x40a2, 0x0001},
+               },
+       }, {
+               65000000, {
+                       { 0x0072, 0x0001},
+                       { 0x2142, 0x0001},
+                       { 0x40a2, 0x0001},
+               },
+       }, {
+               66000000, {
+                       { 0x013e, 0x0003},
+                       { 0x217e, 0x0002},
+                       { 0x4061, 0x0002}
+               },
+       }, {
+               74250000, {
+                       { 0x0072, 0x0001},
+                       { 0x2145, 0x0002},
+                       { 0x4061, 0x0002}
+               },
+       }, {
+               83500000, {
+                       { 0x0072, 0x0001},
+               },
+       }, {
+               108000000, {
+                       { 0x0051, 0x0002},
+                       { 0x2145, 0x0002},
+                       { 0x4061, 0x0002}
+               },
+       }, {
+               106500000, {
+                       { 0x0051, 0x0002},
+                       { 0x2145, 0x0002},
+                       { 0x4061, 0x0002}
+               },
+       }, {
+               146250000, {
+                       { 0x0051, 0x0002},
+                       { 0x2145, 0x0002},
+                       { 0x4061, 0x0002}
+               },
+       }, {
+               148500000, {
+                       { 0x0051, 0x0003},
+                       { 0x214c, 0x0003},
+                       { 0x4064, 0x0003}
+               },
+       }, {
+               ~0UL, {
+                       { 0x00a0, 0x000a },
+                       { 0x2001, 0x000f },
+                       { 0x4002, 0x000f },
+               },
+       }
+};
+
+static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = {
+       /*      pixelclk    bpp8    bpp10   bpp12 */
+       {
+               40000000,  { 0x0018, 0x0018, 0x0018 },
+       }, {
+               65000000,  { 0x0028, 0x0028, 0x0028 },
+       }, {
+               66000000,  { 0x0038, 0x0038, 0x0038 },
+       }, {
+               74250000,  { 0x0028, 0x0038, 0x0038 },
+       }, {
+               83500000,  { 0x0028, 0x0038, 0x0038 },
+       }, {
+               146250000, { 0x0038, 0x0038, 0x0038 },
+       }, {
+               148500000, { 0x0000, 0x0038, 0x0038 },
+       }, {
+               ~0UL,      { 0x0000, 0x0000, 0x0000},
+       }
+};
+
+static const struct dw_hdmi_sym_term rockchip_sym_term[] = {
+       /*pixelclk   symbol   term*/
+       { 74250000,  0x8009, 0x0004 },
+       { 148500000, 0x8029, 0x0004 },
+       { 297000000, 0x8039, 0x0005 },
+       { ~0UL,      0x0000, 0x0000 }
+};
+
+static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)
+{
+       struct device_node *np = hdmi->dev->of_node;
+
+       hdmi->regmap = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c line 158

Quoted 10 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +10 -0
+       if (IS_ERR(hdmi->regmap)) {
+               dev_err(hdmi->dev, "Unable to get rockchip,grf\n");
+               return PTR_ERR(hdmi->regmap);
+       }
+
+       return 0;
+}
+
+static enum drm_mode_status
+dw_hdmi_rockchip_mode_valid(struct drm_connector *connector,

Similarly, I would rename these function names to start with rockchip_hdmi (or maybe rk_hdmi for brevity).
Especially the ones for the module & driver: (bind/unbind/probe/remove).

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c line 168

Quoted 10 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +10 -0
+                           struct drm_display_mode *mode)
+{
+       const struct dw_hdmi_mpll_config *mpll_cfg = rockchip_mpll_cfg;
+       int pclk = mode->clock * 1000;
+       bool valid = false;
+       int i;
+
+       for (i = 0; mpll_cfg[i].mpixelclock != (~0UL); i++) {
+               if (pclk == mpll_cfg[i].mpixelclock) {
+                       valid = true;

Perhaps you can simplify this a bit:

     for (i = 0; mpll_cfg[i].mpixelclock != (~0UL); i++)
               if (pclk == mpll_cfg[i].mpixelclock)
                  return MODE_OK;
     return MODE_BAD;
Quoted 38 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +38 -0
+}
+
+static struct drm_encoder_funcs dw_hdmi_rockchip_encoder_funcs = {
+       .destroy = drm_encoder_cleanup,
+};
+
+static void dw_hdmi_rockchip_encoder_disable(struct drm_encoder *encoder)
+{
+}
+
+static bool
+dw_hdmi_rockchip_encoder_mode_fixup(struct drm_encoder *encoder,
+                                   const struct drm_display_mode *mode,
+                                   struct drm_display_mode *adj_mode)
+{
+       return true;
+}
+
+static void dw_hdmi_rockchip_encoder_mode_set(struct drm_encoder *encoder,
+                                             struct drm_display_mode *mode,
+                                             struct drm_display_mode *adj_mode)
+{
+}
+
+static void dw_hdmi_rockchip_encoder_commit(struct drm_encoder *encoder)
+{
+       struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder);
+       u32 val;
+       int mux;
+
+       mux = rockchip_drm_encoder_get_mux_id(hdmi->dev->of_node, encoder);
+       if (mux)
+               val = HDMI_SEL_VOP_LIT | (HDMI_SEL_VOP_LIT << 16);
+       else
+               val = HDMI_SEL_VOP_LIT << 16;
+
+       regmap_write(hdmi->regmap, GRF_SOC_CON6, val);
+       dev_dbg(hdmi->dev, "vop %s output to hdmi\n",

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c line 221

Quoted 10 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +10 -0
+               (mux) ? "LIT" : "BIG");
+}
+
+static void dw_hdmi_rockchip_encoder_prepare(struct drm_encoder *encoder)
+{
+       rockchip_drm_crtc_mode_config(encoder->crtc, DRM_MODE_CONNECTOR_HDMIA,
+                                     ROCKCHIP_OUT_MODE_AAAA);
+}
+
+static struct drm_encoder_helper_funcs dw_hdmi_rockchip_encoder_helper_funcs = {

"static const" here and for the other function tables.

Quoted 7 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +7 -0
+       .mode_fixup = dw_hdmi_rockchip_encoder_mode_fixup,
+       .mode_set   = dw_hdmi_rockchip_encoder_mode_set,
+       .prepare    = dw_hdmi_rockchip_encoder_prepare,
+       .commit     = dw_hdmi_rockchip_encoder_commit,
+       .disable    = dw_hdmi_rockchip_encoder_disable,
+};
+

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c line 238

Quoted 10 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +10 -0
+static const struct dw_hdmi_plat_data rockchip_hdmi_drv_data = {
+       .mode_valid = dw_hdmi_rockchip_mode_valid,
+       .mpll_cfg   = rockchip_mpll_cfg,
+       .cur_ctr    = rockchip_cur_ctr,
+       .sym_term   = rockchip_sym_term,
+       .dev_type   = RK3288_HDMI,
+};
+
+static const struct of_device_id dw_hdmi_rockchip_ids[] = {
+       { .compatible = "rockchip,rk3288-dw-hdmi",

.compatible = "rockchip,rk3288-hdmi",

Quoted 37 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +37 -0
+         .data = &rockchip_hdmi_drv_data
+       },
+       {},
+};
+MODULE_DEVICE_TABLE(of, dw_hdmi_rockchip_dt_ids);
+
+static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
+                                void *data)
+{
+       struct platform_device *pdev = to_platform_device(dev);
+       const struct dw_hdmi_plat_data *plat_data;
+       const struct of_device_id *match;
+       struct drm_device *drm = data;
+       struct drm_encoder *encoder;
+       struct rockchip_hdmi *hdmi;
+       struct resource *iores;
+       int irq;
+       int ret;
+
+       if (!pdev->dev.of_node)
+               return -ENODEV;
+
+       hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
+       if (!hdmi)
+               return -ENOMEM;
+
+       match = of_match_node(dw_hdmi_rockchip_ids, pdev->dev.of_node);
+       plat_data = match->data;
+       hdmi->dev = &pdev->dev;
+       encoder = &hdmi->encoder;
+
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0)
+               return irq;
+
+       iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!iores)

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c line 285

Quoted 10 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +10 -0
+               return -ENXIO;
+
+       platform_set_drvdata(pdev, hdmi);
+
+       encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
+       /*
+        * If we failed to find the CRTC(s) which this encoder is
+        * supposed to be connected to, it's because the CRTC has
+        * not been registered yet.  Defer probing, and hope that
+        * the required CRTC is added later.

Nit: it looks like the text lines for this comment could be longer

Quoted 35 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +35 -0
+        */
+       if (encoder->possible_crtcs == 0)
+               return -EPROBE_DEFER;
+
+       ret = rockchip_hdmi_parse_dt(hdmi);
+       if (ret) {
+               dev_err(hdmi->dev, "Unable to parse OF data\n");
+               return ret;
+       }
+
+       drm_encoder_helper_add(encoder, &dw_hdmi_rockchip_encoder_helper_funcs);
+       drm_encoder_init(drm, encoder, &dw_hdmi_rockchip_encoder_funcs,
+                        DRM_MODE_ENCODER_TMDS);
+
+       return dw_hdmi_bind(dev, master, data, encoder, iores, irq, plat_data);
+}
+
+static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master,
+                                   void *data)
+{
+       return dw_hdmi_unbind(dev, master, data);
+}
+
+static const struct component_ops dw_hdmi_rockchip_ops = {
+       .bind   = dw_hdmi_rockchip_bind,
+       .unbind = dw_hdmi_rockchip_unbind,
+};
+
+static int dw_hdmi_rockchip_probe(struct platform_device *pdev)
+{
+       return component_add(&pdev->dev, &dw_hdmi_rockchip_ops);
+}
+
+static int dw_hdmi_rockchip_remove(struct platform_device *pdev)
+{

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c line 330

Quoted 10 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +10 -0
+       component_del(&pdev->dev, &dw_hdmi_rockchip_ops);
+
+       return 0;
+}
+
+static struct platform_driver dw_hdmi_rockchip_pltfm_driver = {
+       .probe  = dw_hdmi_rockchip_probe,
+       .remove = dw_hdmi_rockchip_remove,
+       .driver = {
+               .name = "dwhdmi-rockchip",

"rockchip-hdmi"

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c line 341

Quoted 11 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +11 -0
+               .of_match_table = dw_hdmi_rockchip_ids,
+       },
+};
+
+module_platform_driver(dw_hdmi_rockchip_pltfm_driver);
+
+MODULE_AUTHOR("Andy Yan <[email protected]>");
+MODULE_AUTHOR("Yakir Yang <[email protected]>");
+MODULE_DESCRIPTION("Rockchip Specific DW-HDMI Driver Extension");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:dwhdmi-rockchip");

Why do we need this alias?

Quoted 13 lines
include/drm/bridge/dw_hdmi.h +1 -1
index b64e58a..5a4f490 100644
@@ -22,6 +22,7 @@ enum {
 enum dw_hdmi_devtype {
        IMX6Q_HDMI,
        IMX6DL_HDMI,
+       RK3288_HDMI,
 };
 
 struct dw_hdmi_mpll_config {
--
Quoted 3 lines

1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#19 lore raw

Re: [PATCH v18 12/12] drm: bridge/dw_hdmi: add rockchip rk3288 support

Hi Daniel,

Am Mittwoch, 10. Dezember 2014, 20:36:17 schrieb Daniel Kurtz:

Quoted 5 lines

This driver adds HDMI to rockchip/drm. The fact that rockchip's hdmi uses dw_hdmi is an implementation detail. I do not think that the names used for rk3288-hdmi should include "dw" in them.

See inline for what I mean...

I guess in general this is more a matter of preference.

Past practices suggest that having the dw in the name is a sane solution too, like in dw_mmc-foo (mmc/host), dwmac-foo (net/ethernet/stmicro/stmmac).

And personally I'd keep to this already established naming scheme ... i.e. not hiding the dw heritage.

And also it looks like other involved parties like Philipp and Russell seemed to be ok with the naming through the revisions till now.

[...]

Quoted 6 lines

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c line 158

Quoted 2 lines
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +2 -0
+static enum drm_mode_status
+dw_hdmi_rockchip_mode_valid(struct drm_connector *connector,

Similarly, I would rename these function names to start with rockchip_hdmi (or maybe rk_hdmi for brevity).
Especially the ones for the module & driver: (bind/unbind/probe/remove).

Please keep to one rk <-> rockchip style at least per subsystem. The core drm driver uses rockchip, so the hdmi driver should too (instead of rk).

Heiko

Tested-by Russell King Acked-by Russell King
#20 lore raw

Re: [PATCH v18 12/12] drm: bridge/dw_hdmi: add rockchip rk3288 support

Quoted 8 lines · Heiko Stübner

Past practices suggest that having the dw in the name is a sane solution too, like in dw_mmc-foo (mmc/host), dwmac-foo (net/ethernet/stmicro/stmmac).

And personally I'd keep to this already established naming scheme ... i.e. not hiding the dw heritage.

And also it looks like other involved parties like Philipp and Russell seemed to be ok with the naming through the revisions till now.

I don't have much of a preference when it comes to this. I was disappointed that the original imx-hdmi driver did not use "dw" in its filename, as the documentation clearly stated in several places that it was a designware part, and as we all know, they're a company which sells IP, so their designs are going to crop up in different places.

So I welcome this patch set - and I've also tested it on a SolidRun Hummingboard i2ex along with all my CEC and audio patches, where it seems to be fine. So for the set:

Apart from the two minor items I've pointed out in separate replies:

Thanks.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.
author
#21 lore raw

PATCH v18 12/12 drm: bridge/dw_hdmi: add rockchip rk3288 support

In reply to Andy Yan

Rockchip RK3288 hdmi is compatible with dw_hdmi

---

Changes in v18:
- fix two compile errors when build as module

Changes in v17:
- parse resource and irq in platform driver

Changes in v16: None
Changes in v15:
- remove THIS_MODULE in platform driver

Changes in v14: None
Changes in v13: None
Changes in v12:
- add comment for the depend on patch

Changes in v11: None
Changes in v10:
- add more display mode support mpll configuration for rk3288

Changes in v9:
- move some phy configuration to platform driver

Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/gpu/drm/bridge/dw_hdmi.c            |   3 +
 drivers/gpu/drm/rockchip/Kconfig            |  10 +
 drivers/gpu/drm/rockchip/Makefile           |   2 +
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 341 ++++++++++++++++++++++++++++
 include/drm/bridge/dw_hdmi.h                |   1 +
 5 files changed, 357 insertions(+)
 create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
drivers/gpu/drm/bridge/dw_hdmi.c +3 -0
index cecc46a..01c95a8 100644
@@ -852,6 +852,9 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, unsigned char prep,
 	dw_hdmi_phy_gen2_txpwron(hdmi, 1);
 	dw_hdmi_phy_gen2_pddq(hdmi, 0);
 
+	if (hdmi->dev_type == RK3288_HDMI)
+		dw_hdmi_phy_enable_spare(hdmi, 1);
+
 	/*Wait for PHY PLL lock */
 	msec = 5;
 	do {
drivers/gpu/drm/rockchip/Kconfig +10 -0
index ca9f085..6ebebe8 100644
@@ -15,3 +15,13 @@ config DRM_ROCKCHIP
 	  management to userspace. This driver does not provide
 	  2D or 3D acceleration; acceleration is performed by other
 	  IP found on the SoC.
+
+config ROCKCHIP_DW_HDMI
+        bool "Rockchip specific extensions for Synopsys DW HDMI"
+        depends on DRM_ROCKCHIP
+        select DRM_DW_HDMI
+        help
+	  This selects support for Rockchip SoC specific extensions
+	  for the Synopsys DesignWare HDMI driver. If you want to
+	  enable HDMI on RK3288 based SoC, you should selet this
+	  option.
drivers/gpu/drm/rockchip/Makefile +2 -0
index 2cb0672..f3d8a19 100644
@@ -5,4 +5,6 @@
 rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o rockchip_drm_fbdev.o \
 		rockchip_drm_gem.o
 
+obj-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
+
 obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o rockchip_drm_vop.o
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file +341 -0

341 lines not on this page · raw message

include/drm/bridge/dw_hdmi.h +1 -0
index b64e58a..5a4f490 100644
@@ -22,6 +22,7 @@ enum {
 enum dw_hdmi_devtype {
 	IMX6Q_HDMI,
 	IMX6DL_HDMI,
+	RK3288_HDMI,
 };
 
 struct dw_hdmi_mpll_config {
Signature · 7 lines
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#22 lore raw
In reply to Andy Yan

Hi Andy,

Am Freitag, den 05.12.2014, 14:22 +0800 schrieb Andy Yan:

Quoted 15 lines

We found Freescale imx6 and Rockchip rk3288 and Ingenic JZ4780 (Xburst/MIPS) use the interface compatible Designware HDMI IP, but they also have some lightly differences, such as phy pll configuration, register width(imx hdmi register is one byte, but rk3288 is 4 bytes width and can only be accessed by word), 4K support(imx6 doesn't support 4k, but rk3288 does), and HDMI2.0 support.

To reuse the imx-hdmi driver, we make this patch set:
(1): fix some CodingStyle warning to make checkpatch happy (2): convert imx-hdmi to drm_bridge
(3): split platform specific code
(4): move imx-hdmi to bridge/dw_hdmi
(5): extend dw_hdmi.c to support rk3288 hdmi
(6): add rockchip rk3288 platform specific code dw_hdmi-rockchip.c

Quoted 6 lines

Changes in v18:
- remove a multiple blank lines in imx-hdmi.c
- fix a checkpatch warning in imx-hdmi_pltfm.c
- add port bindings
- correct some spelling mistakes in dw_hdmi bindings doc
- correct some spelling mistakes in dw_hdmi-rockchip bindings doc

[...]

I am happy with the series so far. Pending Acks from the device tree maintainers for the new binding documents, I'd like to apply either the whole of it on top of
git://git.pengutronix.de/git/pza/linux.git imx-drm/next
or take at least the i.MX specific patches (1-5) because of the dependency on the imx-drm OF helper conversion.

regards
Philipp

author
#23 lore raw

Hi Philipp:

Quoted 33 lines · Philipp Zabel

Hi Andy,

Am Freitag, den 05.12.2014, 14:22 +0800 schrieb Andy Yan:

Quoted 15 lines

We found Freescale imx6 and Rockchip rk3288 and Ingenic JZ4780 (Xburst/MIPS) use the interface compatible Designware HDMI IP, but they also have some lightly differences, such as phy pll configuration, register width(imx hdmi register is one byte, but rk3288 is 4 bytes width and can only be accessed by word), 4K support(imx6 doesn't support 4k, but rk3288 does), and HDMI2.0 support.

To reuse the imx-hdmi driver, we make this patch set:
(1): fix some CodingStyle warning to make checkpatch happy (2): convert imx-hdmi to drm_bridge
(3): split platform specific code
(4): move imx-hdmi to bridge/dw_hdmi
(5): extend dw_hdmi.c to support rk3288 hdmi
(6): add rockchip rk3288 platform specific code dw_hdmi-rockchip.c

Quoted 6 lines

Changes in v18:
- remove a multiple blank lines in imx-hdmi.c
- fix a checkpatch warning in imx-hdmi_pltfm.c
- add port bindings
- correct some spelling mistakes in dw_hdmi bindings doc
- correct some spelling mistakes in dw_hdmi-rockchip bindings doc

[...]

I am happy with the series so far. Pending Acks from the device tree maintainers for the new binding documents, I'd like to apply either the whole of it on top of
git://git.pengutronix.de/git/pza/linux.git imx-drm/next
or take at least the i.MX specific patches (1-5) because of the dependency on the imx-drm OF helper conversion.

Quoted 6 lines

regards
Philipp

I am very glad to see you are happy with the patch set, it's would be
very
nice if you can apply all of it.
Thanks very much for you review.

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

maintainer
#24 lore raw

Hi Philipp,

Am Samstag, 6. Dezember 2014, 00:31:46 schrieb Andy Yan:

Quoted 8 lines
Quoted 8 lines

I am happy with the series so far. Pending Acks from the device tree maintainers for the new binding documents, I'd like to apply either the whole of it on top of

git://git.pengutronix.de/git/pza/linux.git imx-drm/next

or take at least the i.MX specific patches (1-5) because of the dependency on the imx-drm OF helper conversion.

do you still want to take this series?

As for the devicetree ACK, there is this (unwritten) rule that if the dt-maintainers do not respond after 3 weeks (and a ping mail to them) it should be considered acked. As this version of the series is sitting on the lists for a month now and nobody complained during the other 17 versions as well, I think we should be on the safe side :-)

There is one slight catch. Patch 3 needs a little modification, as the THIS_MODULE ower of the imx_hdmi got meanwhile cleaned up.

So the patch would need to be modified as shown by the diff at the bottom. I'm not sure if you want Andy to repost the whole series again but I'll just post my fixed variant as reply to the origin v18 of patch 3 for convenience.

Heiko

-------------- 8< ----------------

[PATCH v18 03_12] drm_imx_imx-hdmi_convert imx-hdmi to drm_bridge mode.mbox renamed from [PATCH v18 03_12] drm_imx_imx-hdmi_convert imx-hdmi to drm_bridge mode.mbox.old +1 -2
@@ -511,7 +511,7 @@
  {
  	struct imx_hdmi *hdmi = dev_get_drvdata(dev);
  
-@@ -1723,42 +1682,17 @@ static void imx_hdmi_unbind(struct device *dev, struct device *master,
+@@ -1723,41 +1682,17 @@ static void imx_hdmi_unbind(struct device *dev, struct device *master,
  	hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0);
  
  	hdmi->connector.funcs->destroy(&hdmi->connector);
@@ -544,7 +544,6 @@
 -	.remove = imx_hdmi_platform_remove,
 -	.driver = {
 -		.name = "imx-hdmi",
--		.owner = THIS_MODULE,
 -		.of_match_table = imx_hdmi_dt_ids,
 -	},
 -};
#25 lore raw

Hi Heiko,

Am Dienstag, den 06.01.2015, 12:49 +0100 schrieb Heiko Stübner:

Quoted 12 lines

Hi Philipp,

Am Samstag, 6. Dezember 2014, 00:31:46 schrieb Andy Yan:

Quoted 8 lines
Quoted 8 lines

I am happy with the series so far. Pending Acks from the device tree maintainers for the new binding documents, I'd like to apply either the whole of it on top of

git://git.pengutronix.de/git/pza/linux.git imx-drm/next

or take at least the i.MX specific patches (1-5) because of the dependency on the imx-drm OF helper conversion.

Quoted 7 lines

do you still want to take this series?

As for the devicetree ACK, there is this (unwritten) rule that if the dt-maintainers do not respond after 3 weeks (and a ping mail to them) it should be considered acked. As this version of the series is sitting on the lists for a month now and nobody complained during the other 17 versions as well, I think we should be on the safe side :-)

Alright, let's assume silent approval.

Quoted 7 lines

There is one slight catch. Patch 3 needs a little modification, as the THIS_MODULE ower of the imx_hdmi got meanwhile cleaned up.

So the patch would need to be modified as shown by the diff at the bottom. I'm not sure if you want Andy to repost the whole series again but I'll just post my fixed variant as reply to the origin v18 of patch 3 for convenience.

No need to post this again, I can apply the patches and fix up the remaining issues you and Russell pointed out in the process.

regards
Philipp

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

#26 lore raw
In reply to Andy Yan
Quoted 119 lines · Andy Yan

We found Freescale imx6 and Rockchip rk3288 and Ingenic JZ4780 (Xburst/MIPS) use the interface compatible Designware HDMI IP, but they also have some lightly differences, such as phy pll configuration, register width(imx hdmi register is one byte, but rk3288 is 4 bytes width and can only be accessed by word), 4K support(imx6 doesn't support 4k, but rk3288 does), and HDMI2.0 support.

To reuse the imx-hdmi driver, we make this patch set:
(1): fix some CodingStyle warning to make checkpatch happy (2): convert imx-hdmi to drm_bridge
(3): split platform specific code
(4): move imx-hdmi to bridge/dw_hdmi
(5): extend dw_hdmi.c to support rk3288 hdmi
(6): add rockchip rk3288 platform specific code dw_hdmi-rockchip.c

Changes in v18:
- remove a multiple blank lines in imx-hdmi.c
- fix a checkpatch warning in imx-hdmi_pltfm.c
- add port bindings
- correct some spelling mistakes in dw_hdmi bindings doc
- correct some spelling mistakes in dw_hdmi-rockchip bindings doc

Changes in v17:
- remove platform device stuff, adviced by Russell King
- remove prompt message of dw_hdmi, adviced by Russel King
- parse resource and irq in platform driver

Changes in v16:
- use the common binding for the clocks
- describe ddc-i2c-bus as optional
- add common clocks bindings
- modify clocks bindings
- descrbie ddc-i2c-bus as optional

Changes in v15:
- add prefix dw_hdmi/DW_HDMI for public used dw_hdmi structs adviced by Philipp Zabel
- remove THIS_MODULE in platform driver
- remove unio of the multi-byte register access, adviced by Philipp Zabel
- remove THIS_MODULE in platform driver

Changes in v14:
- add defer probing, adviced by Philipp Zabel
- remove drm_connector_register, because imx-drm core has registered connector

Changes in v13:
- patch against drm-next
- split platform specific phy configuration
- split phy configuration from patch#4

Changes in v12:
- refactor of_node_put(ddc_node)
- squash patch <convert dw_hdmi to drm_bridge>
- add comment for the depend on patch

Changes in v11:
- squash patch <split some phy configuration to platform driver>

Changes in v10:
- split generic dw_hdmi.c improvements from patch#11 (add rk3288 support)
- add more display mode support mpll configuration for rk3288

Changes in v9:
- move some phy configuration to platform driver

Changes in v8:
- correct some spelling mistake
- modify ddc-i2c-bus and interrupt description
- Add documentation for rockchip dw hdmi

Changes in v7:
- remove unused variables from structure dw_hdmi
- remove a wrong modification
- add copyrights for dw_hdmi-imx.c

Changes in v6:
- rearrange the patch order
- refactor register access without reg_shift

Changes in v5:
- refactor reg-io-width

Changes in v4:
- fix checkpatch CHECK
- defer probe ddc i2c adapter

Changes in v3:
- split multi-register access to one indepent patch

Andy Yan (12):
drm: imx: imx-hdmi: make checkpatch happy
drm: imx: imx-hdmi: return defer if can't get ddc i2c adapter
drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode
drm: imx: imx-hdmi: split phy configuration to platform driver
drm: imx: imx-hdmi: move imx-hdmi to bridge/dw_hdmi
dt-bindings: add document for dw_hdmi
drm: bridge/dw_hdmi: add support for multi-byte register width access
drm: bridge/dw_hdmi: add mode_valid support
drm: bridge/dw_hdmi: clear i2cmphy_stat0 reg in hdmi_phy_wait_i2c_done
drm: bridge/dw_hdmi: add function dw_hdmi_phy_enable_spare
dt-bindings: Add documentation for rockchip dw hdmi
drm: bridge/dw_hdmi: add rockchip rk3288 support

  .../devicetree/bindings/drm/bridge/dw_hdmi.txt     |  50 ++
  .../devicetree/bindings/video/dw_hdmi-rockchip.txt |  46 ++
  drivers/gpu/drm/bridge/Kconfig                     |   5 +
  drivers/gpu/drm/bridge/Makefile                    |   1 +
  .../gpu/drm/{imx/imx-hdmi.c => bridge/dw_hdmi.c}   | 717 ++++++++++-----------
  .../gpu/drm/{imx/imx-hdmi.h => bridge/dw_hdmi.h}   |   4 +-
  drivers/gpu/drm/imx/Kconfig                        |   1 +
  drivers/gpu/drm/imx/Makefile                       |   2 +-
  drivers/gpu/drm/imx/dw_hdmi-imx.c                  | 258 ++++++++
  drivers/gpu/drm/rockchip/Kconfig                   |  10 +
  drivers/gpu/drm/rockchip/Makefile                  |   2 +
  drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c        | 341 ++++++++++
  include/drm/bridge/dw_hdmi.h                       |  61 ++
  13 files changed, 1111 insertions(+), 387 deletions(-)
Quoted 8 lines

create mode 100644 Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt create mode 100644 Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt rename drivers/gpu/drm/{imx/imx-hdmi.c => bridge/dw_hdmi.c} (72%) rename drivers/gpu/drm/{imx/imx-hdmi.h => bridge/dw_hdmi.h} (99%) create mode 100644 drivers/gpu/drm/imx/dw_hdmi-imx.c
create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c create mode 100644 include/drm/bridge/dw_hdmi.h

After applying this series, I find there is a build break issue with the allmodconfig configuration for the ARM architecture.
Please fix this.

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c:243:1: error: ‘__mod_of__dw_hdmi_rockchip_dt_ids_device_table’ aliased to undefined symbol ‘dw_hdmi_rockchip_dt_ids’ scripts/Makefile.build:257: recipe for target 'drivers/gpu/drm/rockchip/dw_hdmi-rockchip.o' failed
make[4]: *** [drivers/gpu/drm/rockchip/dw_hdmi-rockchip.o] Error 1
scripts/Makefile.build:402: recipe for target 'drivers/gpu/drm/rockchip' failed
make[3]: *** [drivers/gpu/drm/rockchip] Error 2
scripts/Makefile.build:402: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:402: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:937: recipe for target 'drivers' failed
make: *** [drivers] Error 2

Regards,
Liu Ying

author
#27 lore raw

Hi Liu Ying , Philipp:

Quoted 152 lines · Liu Ying
Quoted 123 lines · Andy Yan

We found Freescale imx6 and Rockchip rk3288 and Ingenic JZ4780 (Xburst/MIPS) use the interface compatible Designware HDMI IP, but they also have some lightly differences, such as phy pll configuration, register width(imx hdmi register is one byte, but rk3288 is 4 bytes width and can only be accessed by word), 4K support(imx6 doesn't support 4k, but rk3288 does), and HDMI2.0 support.

To reuse the imx-hdmi driver, we make this patch set:
(1): fix some CodingStyle warning to make checkpatch happy (2): convert imx-hdmi to drm_bridge
(3): split platform specific code
(4): move imx-hdmi to bridge/dw_hdmi
(5): extend dw_hdmi.c to support rk3288 hdmi
(6): add rockchip rk3288 platform specific code dw_hdmi-rockchip.c

Changes in v18:
- remove a multiple blank lines in imx-hdmi.c
- fix a checkpatch warning in imx-hdmi_pltfm.c
- add port bindings
- correct some spelling mistakes in dw_hdmi bindings doc
- correct some spelling mistakes in dw_hdmi-rockchip bindings doc

Changes in v17:
- remove platform device stuff, adviced by Russell King
- remove prompt message of dw_hdmi, adviced by Russel King
- parse resource and irq in platform driver

Changes in v16:
- use the common binding for the clocks
- describe ddc-i2c-bus as optional
- add common clocks bindings
- modify clocks bindings
- descrbie ddc-i2c-bus as optional

Changes in v15:
- add prefix dw_hdmi/DW_HDMI for public used dw_hdmi structs adviced by Philipp Zabel
- remove THIS_MODULE in platform driver
- remove unio of the multi-byte register access, adviced by Philipp Zabel
- remove THIS_MODULE in platform driver

Changes in v14:
- add defer probing, adviced by Philipp Zabel
- remove drm_connector_register, because imx-drm core has registered connector

Changes in v13:
- patch against drm-next
- split platform specific phy configuration
- split phy configuration from patch#4

Changes in v12:
- refactor of_node_put(ddc_node)
- squash patch <convert dw_hdmi to drm_bridge>
- add comment for the depend on patch

Changes in v11:
- squash patch <split some phy configuration to platform driver>

Changes in v10:
- split generic dw_hdmi.c improvements from patch#11 (add rk3288 support)
- add more display mode support mpll configuration for rk3288

Changes in v9:
- move some phy configuration to platform driver

Changes in v8:
- correct some spelling mistake
- modify ddc-i2c-bus and interrupt description
- Add documentation for rockchip dw hdmi

Changes in v7:
- remove unused variables from structure dw_hdmi
- remove a wrong modification
- add copyrights for dw_hdmi-imx.c

Changes in v6:
- rearrange the patch order
- refactor register access without reg_shift

Changes in v5:
- refactor reg-io-width

Changes in v4:
- fix checkpatch CHECK
- defer probe ddc i2c adapter

Changes in v3:
- split multi-register access to one indepent patch

Andy Yan (12):
drm: imx: imx-hdmi: make checkpatch happy
drm: imx: imx-hdmi: return defer if can't get ddc i2c adapter
drm: imx: imx-hdmi: convert imx-hdmi to drm_bridge mode
drm: imx: imx-hdmi: split phy configuration to platform driver
drm: imx: imx-hdmi: move imx-hdmi to bridge/dw_hdmi
dt-bindings: add document for dw_hdmi
drm: bridge/dw_hdmi: add support for multi-byte register width access
drm: bridge/dw_hdmi: add mode_valid support
drm: bridge/dw_hdmi: clear i2cmphy_stat0 reg in
hdmi_phy_wait_i2c_done
drm: bridge/dw_hdmi: add function dw_hdmi_phy_enable_spare
dt-bindings: Add documentation for rockchip dw hdmi
drm: bridge/dw_hdmi: add rockchip rk3288 support

  .../devicetree/bindings/drm/bridge/dw_hdmi.txt     |  50 ++
  .../devicetree/bindings/video/dw_hdmi-rockchip.txt |  46 ++
  drivers/gpu/drm/bridge/Kconfig                     |   5 +
  drivers/gpu/drm/bridge/Makefile                    |   1 +
  .../gpu/drm/{imx/imx-hdmi.c => bridge/dw_hdmi.c}   | 717 
++++++++++-----------
  .../gpu/drm/{imx/imx-hdmi.h => bridge/dw_hdmi.h}   |   4 +-
  drivers/gpu/drm/imx/Kconfig                        |   1 +
  drivers/gpu/drm/imx/Makefile                       |   2 +-
  drivers/gpu/drm/imx/dw_hdmi-imx.c                  | 258 ++++++++
  drivers/gpu/drm/rockchip/Kconfig                   |  10 +
  drivers/gpu/drm/rockchip/Makefile                  |   2 +
  drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c        | 341 ++++++++++
  include/drm/bridge/dw_hdmi.h                       |  61 ++
  13 files changed, 1111 insertions(+), 387 deletions(-)
Quoted 10 lines

create mode 100644
Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
create mode 100644
Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt
rename drivers/gpu/drm/{imx/imx-hdmi.c => bridge/dw_hdmi.c} (72%) rename drivers/gpu/drm/{imx/imx-hdmi.h => bridge/dw_hdmi.h} (99%) create mode 100644 drivers/gpu/drm/imx/dw_hdmi-imx.c create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c create mode 100644 include/drm/bridge/dw_hdmi.h

After applying this series, I find there is a build break issue with the allmodconfig configuration for the ARM architecture.
Please fix this.

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c:243:1: error: ‘__mod_of__dw_hdmi_rockchip_dt_ids_device_table’ aliased to undefined symbol ‘dw_hdmi_rockchip_dt_ids’ scripts/Makefile.build:257: recipe for target 'drivers/gpu/drm/rockchip/dw_hdmi-rockchip.o' failed
make[4]: *** [drivers/gpu/drm/rockchip/dw_hdmi-rockchip.o] Error 1
scripts/Makefile.build:402: recipe for target 'drivers/gpu/drm/rockchip' failed
make[3]: *** [drivers/gpu/drm/rockchip] Error 2
scripts/Makefile.build:402: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:402: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:937: recipe for target 'drivers' failed
make: *** [drivers] Error 2

Quoted 5 lines

Regards,
Liu Ying

Very sorry for these issue, thank you for pointing out it. I will send [PATCH V18.1 12/12] for a fix.

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel