Skip to contentSkip to conversation

video: dw_hdmi: Support Vendor PHY

PATCH In review Jagan Teki 4 participants 27 messages Jan 17, 2024 – Apr 20, 2024

Subsystems (8)
lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

v3 cover video: dw_hdmi: Support Vendor PHY

From: Jagan Teki <[email protected]>

Unlike RK3399, Sunxi/Meson DW HDMI the new Rockchip SoC Rk3328 would support external vendor PHY with DW HDMI chip.

Support this vendor PHY by adding new platform PHY ops via DW HDMI driver and call the respective generic phy from platform driver code.

This series tested in RK3328 with 1080p (1920x1080) resolution.

Patch 0001/0005: Support Vendor PHY
Patch 0006/0008: VOP extension for win, dsp offsets
Patch 0009/0010: RK3328 VOP, HDMI clocks
Patch 0011:      Rockchip Inno HDMI PHY
Patch 0012:      RK3328 HDMI driver
Patch 0013:      RK3328 VOP driver
Patch 0014/0017: Enable HDMI Out for RK3328

Changes for v3:
- updated phy_ops logic
- tested in BPI-M64
- updated handoff logic for rk3328

Changes for v2:
- Use proper cfg function for meson
- Add VOP cleanup code.
- Add DCLK get rate

Linux VOP/HDMI out issues seems resolved with explicit WIN0 disable.

Any inputs?
Jagan.

Jagan Teki (17):
video: rockchip: hdmi: Detect hpd after controller init
video: dw_hdmi: Add Vendor PHY handling
video: dw_hdmi: Extend the HPD detection
video: dw_hdmi: Add read_hpd hook
video: dw_hdmi: Add setup_hpd hook
video: rockchip: vop: Simplify rkvop_enable
video: rockchip: vop: Add win offset support
video: rockchip: vop: Add dsp offset support
clk: rockchip: rk3328: Add VOP clk support
clk: rk3328: Add get hdmiphy clock
phy: rockchip: Add Rockchip INNO HDMI PHY driver
video: rockchip: Add rk3328 hdmi support
video: rockchip: Add rk3328 vop support
ARM: dts: rk3328: Enable VOP for bootph-all
rockchip: Enable preconsole for rk3328
configs: evb-rk3328: Enable vidconsole for rk3328
configs: Enable HDMI Out for ROC-RK3328-CC

 arch/arm/dts/rk3328-u-boot.dtsi               |   4 +
 .../include/asm/arch-rockchip/cru_rk3328.h    |  34 +
 arch/arm/mach-rockchip/Kconfig                |   1 +
 common/Kconfig                                |   2 +-
 configs/roc-cc-rk3328_defconfig               |   5 +
 drivers/clk/rockchip/clk_rk3328.c             | 105 ++-
 drivers/phy/rockchip/Kconfig                  |   7 +
 drivers/phy/rockchip/Makefile                 |   1 +
 drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 885 ++++++++++++++++++
 drivers/video/dw_hdmi.c                       |  29 +-
 drivers/video/meson/meson_dw_hdmi.c           |   6 +-
 drivers/video/rockchip/Makefile               |   2 +
 drivers/video/rockchip/rk3328_hdmi.c          | 126 +++
 drivers/video/rockchip/rk3328_vop.c           |  83 ++
 drivers/video/rockchip/rk_hdmi.c              |  11 +-
 drivers/video/rockchip/rk_hdmi.h              |   3 +
 drivers/video/rockchip/rk_vop.c               |  44 +-
 drivers/video/rockchip/rk_vop.h               |   4 +
 drivers/video/sunxi/sunxi_dw_hdmi.c           |  14 +-
 include/configs/evb_rk3328.h                  |   5 +
 include/configs/rk3328_common.h               |   1 +
 include/dw_hdmi.h                             |  11 +-
 22 files changed, 1345 insertions(+), 38 deletions(-)
 create mode 100644 drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
 create mode 100644 drivers/video/rockchip/rk3328_hdmi.c
 create mode 100644 drivers/video/rockchip/rk3328_vop.c
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v3 1/17 video: rockchip: hdmi: Detect hpd after controller init

From: Jagan Teki <[email protected]>

HDP is a hardware connector event, so detect the same once the controller and attached PHY initialization are done.

---
Changes for v3, v2:
- none

 drivers/video/rockchip/rk_hdmi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/video/rockchip/rk_hdmi.c +3 -3
index 8dcd4d5964..b75a174489 100644
@@ -112,14 +112,14 @@ int rk_hdmi_probe(struct udevice *dev)
 	struct dw_hdmi *hdmi = &priv->hdmi;
 	int ret;
 
+	dw_hdmi_init(hdmi);
+	dw_hdmi_phy_init(hdmi);
+
 	ret = dw_hdmi_phy_wait_for_hpd(hdmi);
 	if (ret < 0) {
 		debug("hdmi can not get hpd signal\n");
 		return -1;
 	}
 
-	dw_hdmi_init(hdmi);
-	dw_hdmi_phy_init(hdmi);
-
 	return 0;
 }
Signature · 1 line
2.25.1
author
#2 lore raw

PATCH v3 2/17 video: dw_hdmi: Add Vendor PHY handling

In reply to Jagan Teki

From: Jagan Teki <[email protected]>

DW HDMI support Vendor PHY like Rockchip RK3328 Inno HDMI PHY.

Extend the vendor phy handling by adding platform phy hooks.

---
Changes for v3:
- drop data
- assign ops directly
Changes for v2:
- fix meson cfg

 drivers/video/dw_hdmi.c             | 10 +++++++++-
 drivers/video/meson/meson_dw_hdmi.c |  6 +++++-
 drivers/video/rockchip/rk_hdmi.c    |  1 -
 drivers/video/sunxi/sunxi_dw_hdmi.c |  6 +++++-
 include/dw_hdmi.h                   |  8 +++++++-
 5 files changed, 26 insertions(+), 5 deletions(-)
drivers/video/dw_hdmi.c +9 -1
index c4fbb18294..4914ba6146 100644
@@ -988,7 +988,7 @@ int dw_hdmi_enable(struct dw_hdmi *hdmi, const struct display_timing *edid)
 
 	hdmi_av_composer(hdmi, edid);
 
-	ret = hdmi->phy_set(hdmi, edid->pixelclock.typ);
+	ret = hdmi->ops->phy_set(hdmi, edid->pixelclock.typ);
 	if (ret)
 		return ret;
 
@@ -1009,10 +1009,18 @@ int dw_hdmi_enable(struct dw_hdmi *hdmi, const struct display_timing *edid)
 	return 0;
 }
 
+static const struct dw_hdmi_phy_ops dw_hdmi_synopsys_phy_ops = {
+	.phy_set = dw_hdmi_phy_cfg,
+};
+
 void dw_hdmi_init(struct dw_hdmi *hdmi)
 {
 	uint ih_mute;
 
+	/* hook Synopsys PHYs ops */
+	if (!hdmi->ops)
+		hdmi->ops = &dw_hdmi_synopsys_phy_ops;
+
 	/*
 	 * boot up defaults are:
 	 * hdmi_ih_mute   = 0x03 (disabled)
drivers/video/meson/meson_dw_hdmi.c +5 -1
index 5db01904b5..259af1b457 100644
@@ -375,6 +375,10 @@ static int meson_dw_hdmi_wait_hpd(struct dw_hdmi *hdmi)
 	return -ETIMEDOUT;
 }
 
+static const struct dw_hdmi_phy_ops dw_hdmi_meson_phy_ops = {
+	.phy_set = meson_dw_hdmi_phy_init,
+};
+
 static int meson_dw_hdmi_probe(struct udevice *dev)
 {
 	struct meson_dw_hdmi *priv = dev_get_priv(dev);
@@ -397,7 +401,7 @@ static int meson_dw_hdmi_probe(struct udevice *dev)
 
 	priv->hdmi.hdmi_data.enc_out_bus_format = MEDIA_BUS_FMT_RGB888_1X24;
 	priv->hdmi.hdmi_data.enc_in_bus_format = MEDIA_BUS_FMT_YUV8_1X24;
-	priv->hdmi.phy_set = meson_dw_hdmi_phy_init;
+	priv->hdmi.ops = &dw_hdmi_meson_phy_ops;
 	if (meson_hdmi_is_compatible(priv, HDMI_COMPATIBLE_G12A))
 		priv->hdmi.reg_io_width = 1;
 	else {
drivers/video/rockchip/rk_hdmi.c +0 -1
index b75a174489..d5b5a529d2 100644
@@ -90,7 +90,6 @@ int rk_hdmi_of_to_plat(struct udevice *dev)
 	/* hdmi->i2c_clk_{high,low} are set up by the SoC driver */
 
 	hdmi->reg_io_width = 4;
-	hdmi->phy_set = dw_hdmi_phy_cfg;
 
 	priv->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
 
drivers/video/sunxi/sunxi_dw_hdmi.c +5 -1
index 0324a050d0..986e69d66b 100644
@@ -369,6 +369,10 @@ static int sunxi_dw_hdmi_probe(struct udevice *dev)
 	return 0;
 }
 
+static const struct dw_hdmi_phy_ops dw_hdmi_sunxi_phy_ops = {
+	.phy_set = sunxi_dw_hdmi_phy_cfg,
+};
+
 static int sunxi_dw_hdmi_of_to_plat(struct udevice *dev)
 {
 	struct sunxi_dw_hdmi_priv *priv = dev_get_priv(dev);
@@ -379,7 +383,7 @@ static int sunxi_dw_hdmi_of_to_plat(struct udevice *dev)
 	hdmi->i2c_clk_high = 0xd8;
 	hdmi->i2c_clk_low = 0xfe;
 	hdmi->reg_io_width = 1;
-	hdmi->phy_set = sunxi_dw_hdmi_phy_cfg;
+	hdmi->ops = &dw_hdmi_sunxi_phy_ops;
 
 	ret = reset_get_bulk(dev, &priv->resets);
 	if (ret)
include/dw_hdmi.h +7 -1
index 8acae3839f..17bdd2dbf9 100644
@@ -534,6 +534,12 @@ struct hdmi_data_info {
 	struct hdmi_vmode video_mode;
 };
 
+struct dw_hdmi;
+
+struct dw_hdmi_phy_ops {
+	int (*phy_set)(struct dw_hdmi *hdmi, uint mpixelclock);
+};
+
 struct dw_hdmi {
 	ulong ioaddr;
 	const struct hdmi_mpll_config *mpll_cfg;
@@ -543,8 +549,8 @@ struct dw_hdmi {
 	u8 reg_io_width;
 	struct hdmi_data_info hdmi_data;
 	struct udevice *ddc_bus;
+	const struct dw_hdmi_phy_ops *ops;
 
-	int (*phy_set)(struct dw_hdmi *hdmi, uint mpixelclock);
 	void (*write_reg)(struct dw_hdmi *hdmi, u8 val, int offset);
 	u8 (*read_reg)(struct dw_hdmi *hdmi, int offset);
 };
Signature · 1 line
2.25.1
maintainer Reviewed-by on v3 2/17
#3 lore raw

Re: [PATCH v3 02/17] video: dw_hdmi: Add Vendor PHY handling

Quoted 131 lines · Jagan Teki

From: Jagan Teki <[email protected]>

DW HDMI support Vendor PHY like Rockchip RK3328 Inno HDMI PHY.

Extend the vendor phy handling by adding platform phy hooks.

---
Changes for v3:
- drop data
- assign ops directly
Changes for v2:
- fix meson cfg

  drivers/video/dw_hdmi.c             | 10 +++++++++-
  drivers/video/meson/meson_dw_hdmi.c |  6 +++++-
  drivers/video/rockchip/rk_hdmi.c    |  1 -
  drivers/video/sunxi/sunxi_dw_hdmi.c |  6 +++++-
  include/dw_hdmi.h                   |  8 +++++++-
  5 files changed, 26 insertions(+), 5 deletions(-)
drivers/video/dw_hdmi.c +9 -1
index c4fbb18294..4914ba6146 100644
@@ -988,7 +988,7 @@ int dw_hdmi_enable(struct dw_hdmi *hdmi, const struct display_timing *edid)
 
  	hdmi_av_composer(hdmi, edid);
 
-	ret = hdmi->phy_set(hdmi, edid->pixelclock.typ);
+	ret = hdmi->ops->phy_set(hdmi, edid->pixelclock.typ);
  	if (ret)
  		return ret;
 
@@ -1009,10 +1009,18 @@ int dw_hdmi_enable(struct dw_hdmi *hdmi, const struct display_timing *edid)
  	return 0;
  }
 
+static const struct dw_hdmi_phy_ops dw_hdmi_synopsys_phy_ops = {
+	.phy_set = dw_hdmi_phy_cfg,
+};
+
  void dw_hdmi_init(struct dw_hdmi *hdmi)
  {
  	uint ih_mute;
 
+	/* hook Synopsys PHYs ops */
+	if (!hdmi->ops)
+		hdmi->ops = &dw_hdmi_synopsys_phy_ops;
+
  	/*
  	 * boot up defaults are:
  	 * hdmi_ih_mute   = 0x03 (disabled)
drivers/video/meson/meson_dw_hdmi.c +5 -1
index 5db01904b5..259af1b457 100644
@@ -375,6 +375,10 @@ static int meson_dw_hdmi_wait_hpd(struct dw_hdmi *hdmi)
  	return -ETIMEDOUT;
  }
 
+static const struct dw_hdmi_phy_ops dw_hdmi_meson_phy_ops = {
+	.phy_set = meson_dw_hdmi_phy_init,
+};
+
  static int meson_dw_hdmi_probe(struct udevice *dev)
  {
  	struct meson_dw_hdmi *priv = dev_get_priv(dev);
@@ -397,7 +401,7 @@ static int meson_dw_hdmi_probe(struct udevice *dev)
 
  	priv->hdmi.hdmi_data.enc_out_bus_format = MEDIA_BUS_FMT_RGB888_1X24;
  	priv->hdmi.hdmi_data.enc_in_bus_format = MEDIA_BUS_FMT_YUV8_1X24;
-	priv->hdmi.phy_set = meson_dw_hdmi_phy_init;
+	priv->hdmi.ops = &dw_hdmi_meson_phy_ops;
  	if (meson_hdmi_is_compatible(priv, HDMI_COMPATIBLE_G12A))
  		priv->hdmi.reg_io_width = 1;
  	else {
drivers/video/rockchip/rk_hdmi.c +0 -1
index b75a174489..d5b5a529d2 100644
@@ -90,7 +90,6 @@ int rk_hdmi_of_to_plat(struct udevice *dev)
  	/* hdmi->i2c_clk_{high,low} are set up by the SoC driver */
 
  	hdmi->reg_io_width = 4;
-	hdmi->phy_set = dw_hdmi_phy_cfg;
 
  	priv->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
 
drivers/video/sunxi/sunxi_dw_hdmi.c +5 -1
index 0324a050d0..986e69d66b 100644
@@ -369,6 +369,10 @@ static int sunxi_dw_hdmi_probe(struct udevice *dev)
  	return 0;
  }
 
+static const struct dw_hdmi_phy_ops dw_hdmi_sunxi_phy_ops = {
+	.phy_set = sunxi_dw_hdmi_phy_cfg,
+};
+
  static int sunxi_dw_hdmi_of_to_plat(struct udevice *dev)
  {
  	struct sunxi_dw_hdmi_priv *priv = dev_get_priv(dev);
@@ -379,7 +383,7 @@ static int sunxi_dw_hdmi_of_to_plat(struct udevice *dev)
  	hdmi->i2c_clk_high = 0xd8;
  	hdmi->i2c_clk_low = 0xfe;
  	hdmi->reg_io_width = 1;
-	hdmi->phy_set = sunxi_dw_hdmi_phy_cfg;
+	hdmi->ops = &dw_hdmi_sunxi_phy_ops;
 
  	ret = reset_get_bulk(dev, &priv->resets);
  	if (ret)
include/dw_hdmi.h +6 -0
index 8acae3839f..17bdd2dbf9 100644
@@ -534,6 +534,12 @@ struct hdmi_data_info {
  	struct hdmi_vmode video_mode;
  };
 
+struct dw_hdmi;
+
+struct dw_hdmi_phy_ops {
+	int (*phy_set)(struct dw_hdmi *hdmi, uint mpixelclock);
+};
+
  struct dw_hdmi {
  	ulong ioaddr;
  	const struct hdmi_mpll_config *mpll_cfg;

include/dw_hdmi.h struct dw_hdmi { · line 556

Quoted 9 lines
include/dw_hdmi.h +1 -1
@@ -543,8 +549,8 @@ struct dw_hdmi {
  	u8 reg_io_width;
  	struct hdmi_data_info hdmi_data;
  	struct udevice *ddc_bus;
+	const struct dw_hdmi_phy_ops *ops;
 
-	int (*phy_set)(struct dw_hdmi *hdmi, uint mpixelclock);
  	void (*write_reg)(struct dw_hdmi *hdmi, u8 val, int offset);
  	u8 (*read_reg)(struct dw_hdmi *hdmi, int offset);
  };

That's much better!
Thanks!

author
#4 lore raw

PATCH v3 3/17 video: dw_hdmi: Extend the HPD detection

In reply to Jagan Teki

From: Jagan Teki <[email protected]>

HPD detection on some DW HDMIdesigned SoC's would need to read and setup the HPD status explicitly.

So, extend the HPD detection code by adding the dw_hdmi_detect_hpd function and move the default detection code caller there.

The new read and setup hdp will integrate the same function in later patches.

---
Changes for v3, v2:
- none

 drivers/video/dw_hdmi.c             | 13 +++++++++++++
 drivers/video/rockchip/rk_hdmi.c    |  8 +++-----
 drivers/video/sunxi/sunxi_dw_hdmi.c |  8 +++-----
 include/dw_hdmi.h                   |  1 +
 4 files changed, 20 insertions(+), 10 deletions(-)
drivers/video/dw_hdmi.c +13 -0
index 4914ba6146..3a3b9b7a21 100644
@@ -936,6 +936,19 @@ int dw_hdmi_phy_wait_for_hpd(struct dw_hdmi *hdmi)
 	return -1;
 }
 
+int dw_hdmi_detect_hpd(struct dw_hdmi *hdmi)
+{
+	int ret;
+
+	ret = dw_hdmi_phy_wait_for_hpd(hdmi);
+	if (ret < 0) {
+		debug("hdmi can not get hpd signal\n");
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
 void dw_hdmi_phy_init(struct dw_hdmi *hdmi)
 {
 	/* enable phy i2cm done irq */
drivers/video/rockchip/rk_hdmi.c +3 -5
index d5b5a529d2..16f6303513 100644
@@ -114,11 +114,9 @@ int rk_hdmi_probe(struct udevice *dev)
 	dw_hdmi_init(hdmi);
 	dw_hdmi_phy_init(hdmi);
 
-	ret = dw_hdmi_phy_wait_for_hpd(hdmi);
-	if (ret < 0) {
-		debug("hdmi can not get hpd signal\n");
-		return -1;
-	}
+	ret = dw_hdmi_detect_hpd(hdmi);
+	if (ret < 0)
+		return ret;
 
 	return 0;
 }
drivers/video/sunxi/sunxi_dw_hdmi.c +3 -5
index 986e69d66b..a5e8d39e98 100644
@@ -358,11 +358,9 @@ static int sunxi_dw_hdmi_probe(struct udevice *dev)
 
 	sunxi_dw_hdmi_phy_init(&priv->hdmi);
 
-	ret = dw_hdmi_phy_wait_for_hpd(&priv->hdmi);
-	if (ret < 0) {
-		debug("hdmi can not get hpd signal\n");
-		return -1;
-	}
+	ret = dw_hdmi_detect_hpd(&priv->hdmi);
+	if (ret < 0)
+		return ret;
 
 	dw_hdmi_init(&priv->hdmi);
 
include/dw_hdmi.h +1 -0
index 17bdd2dbf9..ba2ce5ea7f 100644
@@ -562,5 +562,6 @@ void dw_hdmi_phy_init(struct dw_hdmi *hdmi);
 int dw_hdmi_enable(struct dw_hdmi *hdmi, const struct display_timing *edid);
 int dw_hdmi_read_edid(struct dw_hdmi *hdmi, u8 *buf, int buf_size);
 void dw_hdmi_init(struct dw_hdmi *hdmi);
+int dw_hdmi_detect_hpd(struct dw_hdmi *hdmi);
 
 #endif
Signature · 1 line
2.25.1
maintainer Reviewed-by on v3 3/17
#5 lore raw

Re: [PATCH v3 03/17] video: dw_hdmi: Extend the HPD detection

Quoted 89 lines · Jagan Teki

From: Jagan Teki <[email protected]>

HPD detection on some DW HDMIdesigned SoC's would need to read and setup the HPD status explicitly.

So, extend the HPD detection code by adding the dw_hdmi_detect_hpd function and move the default detection code caller there.

The new read and setup hdp will integrate the same function in later patches.

---
Changes for v3, v2:
- none

  drivers/video/dw_hdmi.c             | 13 +++++++++++++
  drivers/video/rockchip/rk_hdmi.c    |  8 +++-----
  drivers/video/sunxi/sunxi_dw_hdmi.c |  8 +++-----
  include/dw_hdmi.h                   |  1 +
  4 files changed, 20 insertions(+), 10 deletions(-)
drivers/video/dw_hdmi.c +13 -0
index 4914ba6146..3a3b9b7a21 100644
@@ -936,6 +936,19 @@ int dw_hdmi_phy_wait_for_hpd(struct dw_hdmi *hdmi)
  	return -1;
  }
 
+int dw_hdmi_detect_hpd(struct dw_hdmi *hdmi)
+{
+	int ret;
+
+	ret = dw_hdmi_phy_wait_for_hpd(hdmi);
+	if (ret < 0) {
+		debug("hdmi can not get hpd signal\n");
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
  void dw_hdmi_phy_init(struct dw_hdmi *hdmi)
  {
  	/* enable phy i2cm done irq */
drivers/video/rockchip/rk_hdmi.c +3 -5
index d5b5a529d2..16f6303513 100644
@@ -114,11 +114,9 @@ int rk_hdmi_probe(struct udevice *dev)
  	dw_hdmi_init(hdmi);
  	dw_hdmi_phy_init(hdmi);
 
-	ret = dw_hdmi_phy_wait_for_hpd(hdmi);
-	if (ret < 0) {
-		debug("hdmi can not get hpd signal\n");
-		return -1;
-	}
+	ret = dw_hdmi_detect_hpd(hdmi);
+	if (ret < 0)
+		return ret;
 
  	return 0;
  }
drivers/video/sunxi/sunxi_dw_hdmi.c +3 -5
index 986e69d66b..a5e8d39e98 100644
@@ -358,11 +358,9 @@ static int sunxi_dw_hdmi_probe(struct udevice *dev)
 
  	sunxi_dw_hdmi_phy_init(&priv->hdmi);
 
-	ret = dw_hdmi_phy_wait_for_hpd(&priv->hdmi);
-	if (ret < 0) {
-		debug("hdmi can not get hpd signal\n");
-		return -1;
-	}
+	ret = dw_hdmi_detect_hpd(&priv->hdmi);
+	if (ret < 0)
+		return ret;
 
  	dw_hdmi_init(&priv->hdmi);
 
include/dw_hdmi.h +0 -0
index 17bdd2dbf9..ba2ce5ea7f 100644

include/dw_hdmi.h void dw_hdmi_phy_init(struct dw_hdmi *hdmi); · line 567

Quoted 6 lines
include/dw_hdmi.h +1 -0
@@ -562,5 +562,6 @@ void dw_hdmi_phy_init(struct dw_hdmi *hdmi);
  int dw_hdmi_enable(struct dw_hdmi *hdmi, const struct display_timing *edid);
  int dw_hdmi_read_edid(struct dw_hdmi *hdmi, u8 *buf, int buf_size);
  void dw_hdmi_init(struct dw_hdmi *hdmi);
+int dw_hdmi_detect_hpd(struct dw_hdmi *hdmi);
 
  #endif
author
#6 lore raw

PATCH v3 4/17 video: dw_hdmi: Add read_hpd hook

In reply to Jagan Teki

From: Jagan Teki <[email protected]>

Add support for DW HDMI Read HPD status.

---
Changes for v3:
- check hdmi->ops
Changes for v2:
- none

 drivers/video/dw_hdmi.c | 3 +++
 include/dw_hdmi.h       | 1 +
 2 files changed, 4 insertions(+)
drivers/video/dw_hdmi.c +3 -0
index 3a3b9b7a21..989b7ab2db 100644
@@ -946,6 +946,9 @@ int dw_hdmi_detect_hpd(struct dw_hdmi *hdmi)
 		return -ENODEV;
 	}
 
+	if (hdmi->ops && hdmi->ops->read_hpd)
+		hdmi->ops->read_hpd(hdmi, true);
+
 	return 0;
 }
 
include/dw_hdmi.h +1 -0
index ba2ce5ea7f..a1f0e64507 100644
@@ -538,6 +538,7 @@ struct dw_hdmi;
 
 struct dw_hdmi_phy_ops {
 	int (*phy_set)(struct dw_hdmi *hdmi, uint mpixelclock);
+	void (*read_hpd)(struct dw_hdmi *hdmi, bool hdp_status);
 };
 
 struct dw_hdmi {
Signature · 1 line
2.25.1
maintainer Reviewed-by on v3 4/17
#7 lore raw

Re: [PATCH v3 04/17] video: dw_hdmi: Add read_hpd hook

Quoted 34 lines · Jagan Teki

From: Jagan Teki <[email protected]>

Add support for DW HDMI Read HPD status.

---
Changes for v3:
- check hdmi->ops
Changes for v2:
- none

  drivers/video/dw_hdmi.c | 3 +++
  include/dw_hdmi.h       | 1 +
  2 files changed, 4 insertions(+)
drivers/video/dw_hdmi.c +3 -0
index 3a3b9b7a21..989b7ab2db 100644
@@ -946,6 +946,9 @@ int dw_hdmi_detect_hpd(struct dw_hdmi *hdmi)
  		return -ENODEV;
  	}
 
+	if (hdmi->ops && hdmi->ops->read_hpd)
+		hdmi->ops->read_hpd(hdmi, true);
+
  	return 0;
  }
 
include/dw_hdmi.h +0 -0
index ba2ce5ea7f..a1f0e64507 100644

include/dw_hdmi.h struct dw_hdmi; · line 544

Quoted 7 lines
include/dw_hdmi.h +1 -0
@@ -538,6 +538,7 @@ struct dw_hdmi;
 
  struct dw_hdmi_phy_ops {
  	int (*phy_set)(struct dw_hdmi *hdmi, uint mpixelclock);
+	void (*read_hpd)(struct dw_hdmi *hdmi, bool hdp_status);
  };
 
  struct dw_hdmi {
author
#8 lore raw

PATCH v3 5/17 video: dw_hdmi: Add setup_hpd hook

In reply to Jagan Teki

From: Jagan Teki <[email protected]>

Add support for DW HDMI Setup HPD status.

---
Changes for v3:
- check hdmi->ops
Changes for v2:
- none

 drivers/video/dw_hdmi.c | 3 +++
 include/dw_hdmi.h       | 1 +
 2 files changed, 4 insertions(+)
drivers/video/dw_hdmi.c +3 -0
index 989b7ab2db..ab4811cfc7 100644
@@ -1061,4 +1061,7 @@ void dw_hdmi_init(struct dw_hdmi *hdmi)
 
 	/* enable i2c client nack % arbitration error irq */
 	hdmi_write(hdmi, ~0x44, HDMI_I2CM_CTLINT);
+
+	if (hdmi->ops && hdmi->ops->setup_hpd)
+		hdmi->ops->setup_hpd(hdmi);
 }
include/dw_hdmi.h +1 -0
index a1f0e64507..f4d66edace 100644
@@ -539,6 +539,7 @@ struct dw_hdmi;
 struct dw_hdmi_phy_ops {
 	int (*phy_set)(struct dw_hdmi *hdmi, uint mpixelclock);
 	void (*read_hpd)(struct dw_hdmi *hdmi, bool hdp_status);
+	void (*setup_hpd)(struct dw_hdmi *hdmi);
 };
 
 struct dw_hdmi {
Signature · 1 line
2.25.1
maintainer Reviewed-by on v3 5/17
#9 lore raw

Re: [PATCH v3 05/17] video: dw_hdmi: Add setup_hpd hook

Quoted 32 lines · Jagan Teki

From: Jagan Teki <[email protected]>

Add support for DW HDMI Setup HPD status.

---
Changes for v3:
- check hdmi->ops
Changes for v2:
- none

  drivers/video/dw_hdmi.c | 3 +++
  include/dw_hdmi.h       | 1 +
  2 files changed, 4 insertions(+)
drivers/video/dw_hdmi.c +3 -0
index 989b7ab2db..ab4811cfc7 100644
@@ -1061,4 +1061,7 @@ void dw_hdmi_init(struct dw_hdmi *hdmi)
 
  	/* enable i2c client nack % arbitration error irq */
  	hdmi_write(hdmi, ~0x44, HDMI_I2CM_CTLINT);
+
+	if (hdmi->ops && hdmi->ops->setup_hpd)
+		hdmi->ops->setup_hpd(hdmi);
  }
include/dw_hdmi.h +0 -0
index a1f0e64507..f4d66edace 100644

include/dw_hdmi.h struct dw_hdmi; · line 545

Quoted 7 lines
include/dw_hdmi.h +1 -0
@@ -539,6 +539,7 @@ struct dw_hdmi;
  struct dw_hdmi_phy_ops {
  	int (*phy_set)(struct dw_hdmi *hdmi, uint mpixelclock);
  	void (*read_hpd)(struct dw_hdmi *hdmi, bool hdp_status);
+	void (*setup_hpd)(struct dw_hdmi *hdmi);
  };
 
  struct dw_hdmi {
author
#10 lore raw

PATCH v3 6/17 video: rockchip: vop: Simplify rkvop_enable

In reply to Jagan Teki

From: Jagan Teki <[email protected]>

Get the regs from priv pointer instead of passing it an argument.

This would simplify the code and better readability.

---
Changes for v3, v2:
- none

 drivers/video/rockchip/rk_vop.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/video/rockchip/rk_vop.c +4 -4
index c514e2a0e4..158ba7cbf6 100644
@@ -39,11 +39,13 @@ enum vop_pol {
 	DCLK_INVERT    = 3
 };
 
-static void rkvop_enable(struct udevice *dev, struct rk3288_vop *regs, ulong fbbase,
+static void rkvop_enable(struct udevice *dev, ulong fbbase,
 			 int fb_bits_per_pixel,
 			 const struct display_timing *edid,
 			 struct reset_ctl *dclk_rst)
 {
+	struct rk_vop_priv *priv = dev_get_priv(dev);
+	struct rk3288_vop *regs = priv->regs;
 	u32 lb_mode;
 	u32 rgb_mode;
 	u32 hactive = edid->hactive.typ;
@@ -243,9 +245,7 @@ static void rkvop_mode_set(struct udevice *dev,
 static int rk_display_init(struct udevice *dev, ulong fbbase, ofnode ep_node)
 {
 	struct video_priv *uc_priv = dev_get_uclass_priv(dev);
-	struct rk_vop_priv *priv = dev_get_priv(dev);
 	int vop_id, remote_vop_id;
-	struct rk3288_vop *regs = priv->regs;
 	struct display_timing timing;
 	struct udevice *disp;
 	int ret;
@@ -380,7 +380,7 @@ static int rk_display_init(struct udevice *dev, ulong fbbase, ofnode ep_node)
 		return ret;
 	}
 
-	rkvop_enable(dev, regs, fbbase, 1 << l2bpp, &timing, &dclk_rst);
+	rkvop_enable(dev, fbbase, 1 << l2bpp, &timing, &dclk_rst);
 
 	ret = display_enable(disp, 1 << l2bpp, &timing);
 	if (ret)
Signature · 1 line
2.25.1
author
#11 lore raw

PATCH v3 7/17 video: rockchip: vop: Add win offset support

In reply to Jagan Teki

From: Jagan Teki <[email protected]>

Unlike RK3399, RK3288 the Newer Rockchip SoC's like RK3328 have different offsets for win registers.

Group the win register set via win_regs pointers so that win_offset would point the win_regs to access for any changes in the offset value.

---
Changes for v3, v2:
- none

 drivers/video/rockchip/rk_vop.c | 22 +++++++++++++---------
 drivers/video/rockchip/rk_vop.h |  2 ++
 2 files changed, 15 insertions(+), 9 deletions(-)
drivers/video/rockchip/rk_vop.c +13 -9
index 158ba7cbf6..b719a4e4ea 100644
@@ -46,6 +46,7 @@ static void rkvop_enable(struct udevice *dev, ulong fbbase,
 {
 	struct rk_vop_priv *priv = dev_get_priv(dev);
 	struct rk3288_vop *regs = priv->regs;
+	struct rk3288_vop *win_regs = priv->regs + priv->win_offset;
 	u32 lb_mode;
 	u32 rgb_mode;
 	u32 hactive = edid->hactive.typ;
@@ -53,32 +54,32 @@ static void rkvop_enable(struct udevice *dev, ulong fbbase,
 	int ret;
 
 	writel(V_ACT_WIDTH(hactive - 1) | V_ACT_HEIGHT(vactive - 1),
-	       &regs->win0_act_info);
+	       &win_regs->win0_act_info);
 
 	writel(V_DSP_XST(edid->hsync_len.typ + edid->hback_porch.typ) |
 	       V_DSP_YST(edid->vsync_len.typ + edid->vback_porch.typ),
-	       &regs->win0_dsp_st);
+	       &win_regs->win0_dsp_st);
 
 	writel(V_DSP_WIDTH(hactive - 1) |
 		V_DSP_HEIGHT(vactive - 1),
-		&regs->win0_dsp_info);
+		&win_regs->win0_dsp_info);
 
-	clrsetbits_le32(&regs->win0_color_key, M_WIN0_KEY_EN | M_WIN0_KEY_COLOR,
+	clrsetbits_le32(&win_regs->win0_color_key, M_WIN0_KEY_EN | M_WIN0_KEY_COLOR,
 			V_WIN0_KEY_EN(0) | V_WIN0_KEY_COLOR(0));
 
 	switch (fb_bits_per_pixel) {
 	case 16:
 		rgb_mode = RGB565;
-		writel(V_RGB565_VIRWIDTH(hactive), &regs->win0_vir);
+		writel(V_RGB565_VIRWIDTH(hactive), &win_regs->win0_vir);
 		break;
 	case 24:
 		rgb_mode = RGB888;
-		writel(V_RGB888_VIRWIDTH(hactive), &regs->win0_vir);
+		writel(V_RGB888_VIRWIDTH(hactive), &win_regs->win0_vir);
 		break;
 	case 32:
 	default:
 		rgb_mode = ARGB8888;
-		writel(V_ARGB888_VIRWIDTH(hactive), &regs->win0_vir);
+		writel(V_ARGB888_VIRWIDTH(hactive), &win_regs->win0_vir);
 		break;
 	}
 
@@ -91,12 +92,12 @@ static void rkvop_enable(struct udevice *dev, ulong fbbase,
 	else
 		lb_mode = LB_RGB_1280X8;
 
-	clrsetbits_le32(&regs->win0_ctrl0,
+	clrsetbits_le32(&win_regs->win0_ctrl0,
 			M_WIN0_LB_MODE | M_WIN0_DATA_FMT | M_WIN0_EN,
 			V_WIN0_LB_MODE(lb_mode) | V_WIN0_DATA_FMT(rgb_mode) |
 			V_WIN0_EN(1));
 
-	writel(fbbase, &regs->win0_yrgb_mst);
+	writel(fbbase, &win_regs->win0_yrgb_mst);
 	writel(0x01, &regs->reg_cfg_done); /* enable reg config */
 
 	ret = reset_assert(dclk_rst);
@@ -415,6 +416,8 @@ int rk_vop_probe(struct udevice *dev)
 {
 	struct video_uc_plat *plat = dev_get_uclass_plat(dev);
 	struct rk_vop_priv *priv = dev_get_priv(dev);
+	struct rkvop_driverdata *ops =
+		(struct rkvop_driverdata *)dev_get_driver_data(dev);
 	int ret = 0;
 	ofnode port, node;
 	struct reset_ctl ahb_rst;
@@ -448,6 +451,7 @@ int rk_vop_probe(struct udevice *dev)
 #endif
 
 	priv->regs = dev_read_addr_ptr(dev);
+	priv->win_offset = ops->win_offset;
 
 	/*
 	 * Try all the ports until we find one that works. In practice this
drivers/video/rockchip/rk_vop.h +2 -0
index 0528fb23f5..909f5602e5 100644
@@ -11,6 +11,7 @@
 struct rk_vop_priv {
 	void *grf;
 	void *regs;
+	int win_offset;
 };
 
 enum vop_features {
@@ -18,6 +19,7 @@ enum vop_features {
 };
 
 struct rkvop_driverdata {
+	int win_offset;
 	/* configuration */
 	u32 features;
 	/* block-specific setters/getters */
Signature · 1 line
2.25.1
author
#12 lore raw

PATCH v3 8/17 video: rockchip: vop: Add dsp offset support

In reply to Jagan Teki

From: Jagan Teki <[email protected]>

Unlike RK3399, RK3288 the Newer Rockchip SoC's like RK3328 have different offsets for dsp registers.

Group the dsp register set via dsp_regs pointers so that dsp_offset would point the dsp_regs to access for any changes in the offset value.

---
Changes for v3, v2:
- none

 drivers/video/rockchip/rk_vop.c | 14 ++++++++------
 drivers/video/rockchip/rk_vop.h |  2 ++
 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/video/rockchip/rk_vop.c +8 -6
index b719a4e4ea..acc02e5d7c 100644
@@ -165,6 +165,7 @@ static void rkvop_mode_set(struct udevice *dev,
 {
 	struct rk_vop_priv *priv = dev_get_priv(dev);
 	struct rk3288_vop *regs = priv->regs;
+	struct rk3288_vop *dsp_regs = priv->regs + priv->dsp_offset;
 	struct rkvop_driverdata *data =
 		(struct rkvop_driverdata *)dev_get_driver_data(dev);
 
@@ -198,27 +199,27 @@ static void rkvop_mode_set(struct udevice *dev,
 
 	writel(V_HSYNC(hsync_len) |
 	       V_HORPRD(hsync_len + hback_porch + hactive + hfront_porch),
-			&regs->dsp_htotal_hs_end);
+			&dsp_regs->dsp_htotal_hs_end);
 
 	writel(V_HEAP(hsync_len + hback_porch + hactive) |
 	       V_HASP(hsync_len + hback_porch),
-	       &regs->dsp_hact_st_end);
+	       &dsp_regs->dsp_hact_st_end);
 
 	writel(V_VSYNC(vsync_len) |
 	       V_VERPRD(vsync_len + vback_porch + vactive + vfront_porch),
-	       &regs->dsp_vtotal_vs_end);
+	       &dsp_regs->dsp_vtotal_vs_end);
 
 	writel(V_VAEP(vsync_len + vback_porch + vactive)|
 	       V_VASP(vsync_len + vback_porch),
-	       &regs->dsp_vact_st_end);
+	       &dsp_regs->dsp_vact_st_end);
 
 	writel(V_HEAP(hsync_len + hback_porch + hactive) |
 	       V_HASP(hsync_len + hback_porch),
-	       &regs->post_dsp_hact_info);
+	       &dsp_regs->post_dsp_hact_info);
 
 	writel(V_VAEP(vsync_len + vback_porch + vactive)|
 	       V_VASP(vsync_len + vback_porch),
-	       &regs->post_dsp_vact_info);
+	       &dsp_regs->post_dsp_vact_info);
 
 	writel(0x01, &regs->reg_cfg_done); /* enable reg config */
 }
@@ -452,6 +453,7 @@ int rk_vop_probe(struct udevice *dev)
 
 	priv->regs = dev_read_addr_ptr(dev);
 	priv->win_offset = ops->win_offset;
+	priv->dsp_offset = ops->dsp_offset;
 
 	/*
 	 * Try all the ports until we find one that works. In practice this
drivers/video/rockchip/rk_vop.h +2 -0
index 909f5602e5..eba68d87c4 100644
@@ -12,6 +12,7 @@ struct rk_vop_priv {
 	void *grf;
 	void *regs;
 	int win_offset;
+	int dsp_offset;
 };
 
 enum vop_features {
@@ -20,6 +21,7 @@ enum vop_features {
 
 struct rkvop_driverdata {
 	int win_offset;
+	int dsp_offset;
 	/* configuration */
 	u32 features;
 	/* block-specific setters/getters */
Signature · 1 line
2.25.1
author
#13 lore raw

PATCH v3 9/17 clk: rockchip: rk3328: Add VOP clk support

In reply to Jagan Teki

From: Jagan Teki <[email protected]>

VOP get and set clock would needed for VOP drivers.

Add support for it.

---
Changes for v3:
- none
Changes for v2:
- Add DCLK get rate

 .../include/asm/arch-rockchip/cru_rk3328.h    | 34 +++++++
 drivers/clk/rockchip/clk_rk3328.c             | 88 ++++++++++++++++++-
 2 files changed, 120 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-rockchip/cru_rk3328.h +34 -0
index 226744d67d..4ad1d33e05 100644
@@ -62,6 +62,40 @@ check_member(rk3328_cru, sdmmc_ext_con[1], 0x39c);
 enum apll_frequencies {
 	APLL_816_MHZ,
 	APLL_600_MHZ,
+
+	/* CRU_CLK_SEL37_CON */
+	ACLK_VIO_PLL_SEL_CPLL		= 0,
+	ACLK_VIO_PLL_SEL_GPLL		= 1,
+	ACLK_VIO_PLL_SEL_HDMIPHY	= 2,
+	ACLK_VIO_PLL_SEL_USB480M	= 3,
+	ACLK_VIO_PLL_SEL_SHIFT		= 6,
+	ACLK_VIO_PLL_SEL_MASK		= 3 << ACLK_VIO_PLL_SEL_SHIFT,
+	ACLK_VIO_DIV_CON_SHIFT		= 0,
+	ACLK_VIO_DIV_CON_MASK		= 0x1f << ACLK_VIO_DIV_CON_SHIFT,
+	HCLK_VIO_DIV_CON_SHIFT		= 8,
+	HCLK_VIO_DIV_CON_MASK		= 0x1f << HCLK_VIO_DIV_CON_SHIFT,
+
+	/* CRU_CLK_SEL39_CON */
+	ACLK_VOP_PLL_SEL_CPLL		= 0,
+	ACLK_VOP_PLL_SEL_GPLL		= 1,
+	ACLK_VOP_PLL_SEL_HDMIPHY	= 2,
+	ACLK_VOP_PLL_SEL_USB480M	= 3,
+	ACLK_VOP_PLL_SEL_SHIFT		= 6,
+	ACLK_VOP_PLL_SEL_MASK		= 3 << ACLK_VOP_PLL_SEL_SHIFT,
+	ACLK_VOP_DIV_CON_SHIFT		= 0,
+	ACLK_VOP_DIV_CON_MASK		= 0x1f << ACLK_VOP_DIV_CON_SHIFT,
+
+	/* CRU_CLK_SEL40_CON */
+	DCLK_LCDC_PLL_SEL_GPLL		= 0,
+	DCLK_LCDC_PLL_SEL_CPLL		= 1,
+	DCLK_LCDC_PLL_SEL_SHIFT		= 0,
+	DCLK_LCDC_PLL_SEL_MASK		= 1 << DCLK_LCDC_PLL_SEL_SHIFT,
+	DCLK_LCDC_SEL_HDMIPHY		= 0,
+	DCLK_LCDC_SEL_PLL		= 1,
+	DCLK_LCDC_SEL_SHIFT		= 1,
+	DCLK_LCDC_SEL_MASK		= 1 << DCLK_LCDC_SEL_SHIFT,
+	DCLK_LCDC_DIV_CON_SHIFT		= 8,
+	DCLK_LCDC_DIV_CON_MASK		= 0xFf << DCLK_LCDC_DIV_CON_SHIFT,
 };
 
 void rk3328_configure_cpu(struct rk3328_cru *cru,
drivers/clk/rockchip/clk_rk3328.c +86 -2

110 lines not on this page · raw message

Signature · 1 line
2.25.1
author
#14 lore raw

PATCH v3 10/17 clk: rk3328: Add get hdmiphy clock

In reply to Jagan Teki

From: Jagan Teki <[email protected]>

Add support to get the hdmiphy clock for RK3328 PCLK_HDMIPHY.

---
Changes for v3, v2:
- none

 drivers/clk/rockchip/clk_rk3328.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/clk/rockchip/clk_rk3328.c +17 -0
index ee7edb9d10..5bb9238abb 100644
@@ -179,6 +179,10 @@ enum {
 	CLK_I2C3_DIV_CON_SHIFT		= 8,
 	CLK_I2C2_PLL_SEL_SHIFT		= 7,
 	CLK_I2C2_DIV_CON_SHIFT		= 0,
+
+	/* CLKSEL_CON40 */
+	CLK_HDMIPHY_DIV_CON_SHIFT	= 3,
+	CLK_HDMIPHY_DIV_CON_MASK	= 0x7 << CLK_HDMIPHY_DIV_CON_SHIFT,
 };
 
 #define VCO_MAX_KHZ	(3200 * (MHz / KHz))
@@ -661,6 +665,16 @@ static ulong rk3328_vop_set_clk(struct rk3328_clk_priv *priv,
 }
 #endif
 
+static ulong rk3328_hdmiphy_get_clk(struct rk3328_cru *cru)
+{
+	u32 div, con;
+
+	con = readl(&cru->clksel_con[40]);
+	div = (con & CLK_HDMIPHY_DIV_CON_MASK) >> CLK_HDMIPHY_DIV_CON_SHIFT;
+
+	return DIV_TO_RATE(GPLL_HZ, div);
+}
+
 static ulong rk3328_clk_get_rate(struct clk *clk)
 {
 	struct rk3328_clk_priv *priv = dev_get_priv(clk->dev);
@@ -690,6 +704,9 @@ static ulong rk3328_clk_get_rate(struct clk *clk)
 	case SCLK_SPI:
 		rate = rk3328_spi_get_clk(priv->cru);
 		break;
+	case PCLK_HDMIPHY:
+		rate = rk3328_hdmiphy_get_clk(priv->cru);
+		break;
 	default:
 		return -ENOENT;
 	}
Signature · 1 line
2.25.1
author
#15 lore raw

PATCH v3 11/17 phy: rockchip: Add Rockchip INNO HDMI PHY driver

In reply to Jagan Teki

From: Jagan Teki <[email protected]>

Add Rockchip INNO HDMI PHY driver for RK3328.

Reference from linux-next phy-rockchip-inno-hdmi driver.

---
Changes for v3, v2:
- none

 drivers/phy/rockchip/Kconfig                  |   7 +
 drivers/phy/rockchip/Makefile                 |   1 +
 drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 885 ++++++++++++++++++
 3 files changed, 893 insertions(+)
 create mode 100644 drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
drivers/phy/rockchip/Kconfig +7 -0
index 0247d93ab4..80128335d5 100644
@@ -12,6 +12,13 @@ config PHY_ROCKCHIP_INNO_DSIDPHY
 	help
 	  Support for Rockchip MIPI DPHY with Innosilicon IP block.
 
+config PHY_ROCKCHIP_INNO_HDMI
+	bool "Rockchip INNO HDMI PHY Driver"
+	depends on ARCH_ROCKCHIP
+	select PHY
+	help
+	  Enable this to support the Rockchip Innosilicon HDMI PHY.
+
 config PHY_ROCKCHIP_INNO_USB2
 	bool "Rockchip INNO USB2PHY Driver"
 	depends on ARCH_ROCKCHIP
drivers/phy/rockchip/Makefile +1 -0
index 7fdbd10797..0420017425 100644
@@ -3,6 +3,7 @@
 # Copyright (C) 2020 Amarula Solutions(India)
 #
 
+obj-$(CONFIG_PHY_ROCKCHIP_INNO_HDMI)	+= phy-rockchip-inno-hdmi.o
 obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2)	+= phy-rockchip-inno-usb2.o
 obj-$(CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY) += phy-rockchip-naneng-combphy.o
 obj-$(CONFIG_PHY_ROCKCHIP_PCIE)		+= phy-rockchip-pcie.o
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c new file +885 -0

885 lines not on this page · raw message

Signature · 1 line
2.25.1
author
#16 lore raw

PATCH v3 12/17 video: rockchip: Add rk3328 hdmi support

In reply to Jagan Teki

From: Jagan Teki <[email protected]>

Add Rockchip RK3328 HDMI Out driver.

---
Changes for v3:
- drop data
Changes for v2:
- none

 drivers/video/rockchip/Makefile      |   1 +
 drivers/video/rockchip/rk3328_hdmi.c | 126 +++++++++++++++++++++++++++
 drivers/video/rockchip/rk_hdmi.h     |   3 +
 3 files changed, 130 insertions(+)
 create mode 100644 drivers/video/rockchip/rk3328_hdmi.c
drivers/video/rockchip/Makefile +1 -0
index 8128289cc8..4991303c73 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399_vop.o
 obj-$(CONFIG_DISPLAY_ROCKCHIP_EDP) += rk_edp.o
 obj-$(CONFIG_DISPLAY_ROCKCHIP_LVDS) += rk_lvds.o
 obj-hdmi-$(CONFIG_ROCKCHIP_RK3288) += rk3288_hdmi.o
+obj-hdmi-$(CONFIG_ROCKCHIP_RK3328) += rk3328_hdmi.o
 obj-hdmi-$(CONFIG_ROCKCHIP_RK3399) += rk3399_hdmi.o
 obj-$(CONFIG_DISPLAY_ROCKCHIP_HDMI) += rk_hdmi.o $(obj-hdmi-y)
 obj-mipi-$(CONFIG_ROCKCHIP_RK3288) += rk3288_mipi.o
drivers/video/rockchip/rk3328_hdmi.c new file +126 -0

126 lines not on this page · raw message

drivers/video/rockchip/rk_hdmi.h +3 -0
index 200dbaea74..dcfba3d3d7 100644
@@ -6,6 +6,8 @@
 #ifndef __RK_HDMI_H__
 #define __RK_HDMI_H__
 
+#include <generic-phy.h>
+
 struct rkhdmi_driverdata {
 	/* configuration */
 	u8 i2c_clk_high;
@@ -19,6 +21,7 @@ struct rkhdmi_driverdata {
 
 struct rk_hdmi_priv {
 	struct dw_hdmi hdmi;
+	struct phy phy;
 	void *grf;
 };
 
Signature · 1 line
2.25.1
author
#17 lore raw

PATCH v3 13/17 video: rockchip: Add rk3328 vop support

In reply to Jagan Teki

From: Jagan Teki <[email protected]>

Add support for Rockchip RK3328 VOP.

Require VOP cleanup before handoff to Linux by writing reset values to WIN registers. Without this Linux VOP trigger page fault as below

[    0.752016] Loading compiled-in X.509 certificates
[    0.787796] inno_hdmi_phy_rk3328_clk_recalc_rate: parent 24000000
[    0.788391] inno-hdmi-phy ff430000.phy: inno_hdmi_phy_rk3328_clk_recalc_rate rate 148500000 vco 148500000
[    0.798353] rockchip-drm display-subsystem: bound ff370000.vop (ops vop_component_ops)
[    0.799403] dwhdmi-rockchip ff3c0000.hdmi: supply avdd-0v9 not found, using dummy regulator
[    0.800288] rk_iommu ff373f00.iommu: Enable stall request timed out, status: 0x00004b
[    0.801131] dwhdmi-rockchip ff3c0000.hdmi: supply avdd-1v8 not found, using dummy regulator
[    0.802056] rk_iommu ff373f00.iommu: Disable paging request timed out, status: 0x00004b
[    0.803233] dwhdmi-rockchip ff3c0000.hdmi: Detected HDMI TX controller v2.11a with HDCP (inno_dw_hdmi_phy2)
[    0.805355] dwhdmi-rockchip ff3c0000.hdmi: registered DesignWare HDMI I2C bus driver
[    0.808769] rockchip-drm display-subsystem: bound ff3c0000.hdmi (ops dw_hdmi_rockchip_ops)
[    0.810869] [drm] Initialized rockchip 1.0.0 20140818 for display-subsystem on minor 0

---
Changes for v3:
- Add WIN0 disable at remove
Changes for v2:
- Add VOP cleanup
- Update commit

 drivers/video/rockchip/Makefile     |  1 +
 drivers/video/rockchip/rk3328_vop.c | 83 +++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+)
 create mode 100644 drivers/video/rockchip/rk3328_vop.c
drivers/video/rockchip/Makefile +1 -0
index 4991303c73..f55beceebf 100644
@@ -6,6 +6,7 @@
 ifdef CONFIG_VIDEO_ROCKCHIP
 obj-y += rk_vop.o
 obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288_vop.o
+obj-$(CONFIG_ROCKCHIP_RK3328) += rk3328_vop.o
 obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399_vop.o
 obj-$(CONFIG_DISPLAY_ROCKCHIP_EDP) += rk_edp.o
 obj-$(CONFIG_DISPLAY_ROCKCHIP_LVDS) += rk_lvds.o
drivers/video/rockchip/rk3328_vop.c new file +83 -0

83 lines not on this page · raw message

Signature · 1 line
2.25.1
author
#18 lore raw

PATCH v3 14/17 ARM: dts: rk3328: Enable VOP for bootph-all

In reply to Jagan Teki

Model: Firefly roc-rk3328-cc
DRAM: 1 GiB (effective 1022 MiB)
Video device 'vop@ff370000' cannot allocate frame buffer memory -ensure the device is set up before relocation Error binding driver 'rockchip_rk3328_vop': -28
Some drivers failed to bind
initcall sequence 000000003ffcd5e8 failed at call 000000000021a5c4 (err=-28)
### ERROR ### Please RESET the board ###

---
Changes for v3, v2:
- none

 arch/arm/dts/rk3328-u-boot.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/rk3328-u-boot.dtsi +4 -0
index a9f2536de2..5258fec566 100644
@@ -68,3 +68,7 @@
 &spi0 {
 	bootph-all;
 };
+
+&vop {
+	bootph-all;
+};
Signature · 1 line
2.25.1
#19 lore raw

Re: [PATCH v3 14/17] ARM: dts: rk3328: Enable VOP for bootph-all

Hi Jagan,

Quoted 21 lines · Jagan Teki

Model: Firefly roc-rk3328-cc
DRAM: 1 GiB (effective 1022 MiB)
Video device 'vop@ff370000' cannot allocate frame buffer memory -ensure the device is set up before relocation Error binding driver 'rockchip_rk3328_vop': -28
Some drivers failed to bind
initcall sequence 000000003ffcd5e8 failed at call 000000000021a5c4 (err=-28)
### ERROR ### Please RESET the board ###

---
Changes for v3, v2:
- none

 arch/arm/dts/rk3328-u-boot.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/rk3328-u-boot.dtsi +0 -0
index a9f2536de2..5258fec566 100644

arch/arm/dts/rk3328-u-boot.dtsi line 73

Quoted 6 lines
arch/arm/dts/rk3328-u-boot.dtsi +3 -0
@@ -68,3 +68,7 @@
 &spi0 {
 	bootph-all;
 };
+
+&vop {
+	bootph-all;

bootph-some-ram is better, TPL or SPL does not need or use the vop node.

I am working on a cleanup series for rk3399 and that series will include a change from bootph-all to bootph-some-ram of vop nodes on rk3399.

Regards,
Jonas

Quoted 1 line
arch/arm/dts/rk3328-u-boot.dtsi +1 -0
+};
author
#20 lore raw

Re: [PATCH v3 14/17] ARM: dts: rk3328: Enable VOP for bootph-all

Hi Jonas,

Quoted 34 lines · Jonas Karlman

Hi Jagan,

Quoted 21 lines · Jagan Teki

Model: Firefly roc-rk3328-cc
DRAM: 1 GiB (effective 1022 MiB)
Video device 'vop@ff370000' cannot allocate frame buffer memory -ensure the device is set up before relocation Error binding driver 'rockchip_rk3328_vop': -28
Some drivers failed to bind
initcall sequence 000000003ffcd5e8 failed at call 000000000021a5c4 (err=-28)
### ERROR ### Please RESET the board ###

---
Changes for v3, v2:
- none

 arch/arm/dts/rk3328-u-boot.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/rk3328-u-boot.dtsi +0 -0
index a9f2536de2..5258fec566 100644

arch/arm/dts/rk3328-u-boot.dtsi line 73

Quoted 6 lines
arch/arm/dts/rk3328-u-boot.dtsi +3 -0
@@ -68,3 +68,7 @@
 &spi0 {
      bootph-all;
 };
+
+&vop {
+     bootph-all;

bootph-some-ram is better, TPL or SPL does not need or use the vop node.

Quoted 2 lines

I am working on a cleanup series for rk3399 and that series will include a change from bootph-all to bootph-some-ram of vop nodes on rk3399.

Sure, we can even update the same later as these were in the ML from months ago. I will mark them as well.

Jagan.

author
#21 lore raw

PATCH v3 15/17 rockchip: Enable preconsole for rk3328

In reply to Jagan Teki

Enable and set the start address of pre-console buffer for RK3328.

---
Changes for v3, v2:
- none

 arch/arm/mach-rockchip/Kconfig | 1 +
 common/Kconfig                 | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/Kconfig +1 -0
index b577a911e7..60f403fe74 100644
@@ -179,6 +179,7 @@ config ROCKCHIP_RK3328
 	select SUPPORT_TPL
 	select TPL
 	select TPL_NEEDS_SEPARATE_STACK if TPL
+	imply PRE_CONSOLE_BUFFER
 	imply ROCKCHIP_COMMON_BOARD
 	imply ROCKCHIP_SDRAM_COMMON
 	imply SPL_ROCKCHIP_COMMON_BOARD
common/Kconfig +1 -1
index 0283701f1d..5e3070e925 100644
@@ -231,7 +231,7 @@ config PRE_CON_BUF_ADDR
 	default 0x2f000000 if ARCH_SUNXI && MACH_SUN9I
 	default 0x4f000000 if ARCH_SUNXI && !MACH_SUN9I
 	default 0x0f000000 if ROCKCHIP_RK3288
-	default 0x0f200000 if ROCKCHIP_RK3399
+	default 0x0f200000 if ROCKCHIP_RK3399 || ROCKCHIP_RK3328
 	help
 	  This sets the start address of the pre-console buffer. This must
 	  be in available memory and is accessed before relocation and
Signature · 1 line
2.25.1
author
#22 lore raw

PATCH v3 16/17 configs: evb-rk3328: Enable vidconsole for rk3328

In reply to Jagan Teki

Enable video console for Rockchip RK3328.

---
Changes for v3, v2:
- none

 include/configs/evb_rk3328.h    | 5 +++++
 include/configs/rk3328_common.h | 1 +
 2 files changed, 6 insertions(+)
include/configs/evb_rk3328.h +5 -0
index d10e5b1d2e..c985080f7b 100644
@@ -6,6 +6,11 @@
 #ifndef __EVB_RK3328_H
 #define __EVB_RK3328_H
 
+#define ROCKCHIP_DEVICE_SETTINGS \
+		"stdin=serial,usbkbd\0" \
+		"stdout=serial,vidconsole\0" \
+		"stderr=serial,vidconsole\0"
+
 #include <configs/rk3328_common.h>
 
 #endif
include/configs/rk3328_common.h +1 -0
index e920ec7e5d..2c40674b22 100644
@@ -26,6 +26,7 @@
 	ENV_MEM_LAYOUT_SETTINGS \
 	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
 	"partitions=" PARTS_DEFAULT \
+	ROCKCHIP_DEVICE_SETTINGS \
 	"boot_targets=" BOOT_TARGETS "\0"
 
 #endif
Signature · 1 line
2.25.1
author
#23 lore raw

PATCH v3 17/17 configs: Enable HDMI Out for ROC-RK3328-CC

In reply to Jagan Teki

U-Boot 2024.01-00901-g75d07e0e6e-dirty (Jan 17 2024 - 12:50:56 +0530)

Model: Firefly roc-rk3328-cc
DRAM:  4 GiB
PMIC:  RK8050 (on=0x40, off=0x00)
Core:  236 devices, 26 uclasses, devicetree: separate
MMC:   mmc@ff500000: 1, mmc@ff520000: 0

Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:    serial,usbkbd
Out:   serial,vidconsole
Err:   serial,vidconsole
Model: Firefly roc-rk3328-cc
Net:   eth0: ethernet@ff540000
Hit any key to stop autoboot:  0
=> dm tree
 Class     Index  Probed  Driver                Name
-----------------------------------------------------------
 root          0  [ + ]   root_driver           root_driver
 firmware      0  [   ]   psci                  |-- psci
 clk           0  [ + ]   fixed_clock           |-- xin24m
 syscon        0  [ + ]   rockchip_rk3328_grf   |-- syscon@ff100000
 serial        0  [ + ]   ns16550_serial        |-- serial@ff130000
 i2c           0  [ + ]   rockchip_rk3066_i2c   |-- i2c@ff160000
 pmic          0  [ + ]   rockchip_rk805        |   `-- pmic@18
 sysreset      0  [   ]   rk8xx_sysreset        |       |-- rk8xx_sysreset
 regulator     0  [ + ]   rk8xx_buck            |       |-- DCDC_REG1
 regulator     1  [ + ]   rk8xx_buck            |       |-- DCDC_REG2
 regulator     2  [ + ]   rk8xx_buck            |       |-- DCDC_REG3
 regulator     3  [ + ]   rk8xx_buck            |       |-- DCDC_REG4
 regulator     4  [ + ]   rk8xx_ldo             |       |-- LDO_REG1
 regulator     5  [ + ]   rk8xx_ldo             |       |-- LDO_REG2
 regulator     6  [ + ]   rk8xx_ldo             |       `-- LDO_REG3
 video         0  [ + ]   rk3328_vop            |-- vop@ff370000
 vidconsole    0  [ + ]   vidconsole0           |   `-- [email protected]
 display       0  [ + ]   rk3328_hdmi_rockchip  |-- hdmi@ff3c0000
 phy           0  [ + ]   inno_hdmi_phy         |-- phy@ff430000
 clk           1  [ + ]   rockchip_rk3328_cru   |-- clock-controller@ff440000
 sysreset      1  [   ]   rockchip_sysreset     |   |-- sysreset
 reset         0  [ + ]   rockchip_reset        |   `-- reset

---
Changes for v3, v2:
- none

 configs/roc-cc-rk3328_defconfig | 5 +++++
 1 file changed, 5 insertions(+)
configs/roc-cc-rk3328_defconfig +5 -0
index 4ac3c9403b..4eef9016dc 100644
@@ -79,6 +79,7 @@ CONFIG_PHY_REALTEK=y
 CONFIG_PHY_GIGE=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_HDMI=y
 CONFIG_PHY_ROCKCHIP_INNO_USB2=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
@@ -114,6 +115,10 @@ CONFIG_USB_DWC3=y
 CONFIG_USB_DWC3_GENERIC=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DWC2_OTG=y
+CONFIG_VIDEO=y
+CONFIG_DISPLAY=y
+CONFIG_VIDEO_ROCKCHIP=y
+CONFIG_DISPLAY_ROCKCHIP_HDMI=y
 CONFIG_SPL_TINY_MEMSET=y
 CONFIG_TPL_TINY_MEMSET=y
 CONFIG_ERRNO_STR=y
Signature · 1 line
2.25.1
author
#24 lore raw
In reply to Jagan Teki

Hi Anatolij,

Quoted 44 lines · Jagan Teki

From: Jagan Teki <[email protected]>

Unlike RK3399, Sunxi/Meson DW HDMI the new Rockchip SoC Rk3328 would support external vendor PHY with DW HDMI chip.

Support this vendor PHY by adding new platform PHY ops via DW HDMI driver and call the respective generic phy from platform driver code.

This series tested in RK3328 with 1080p (1920x1080) resolution.

Patch 0001/0005: Support Vendor PHY
Patch 0006/0008: VOP extension for win, dsp offsets
Patch 0009/0010: RK3328 VOP, HDMI clocks
Patch 0011:      Rockchip Inno HDMI PHY
Patch 0012:      RK3328 HDMI driver
Patch 0013:      RK3328 VOP driver
Patch 0014/0017: Enable HDMI Out for RK3328

Changes for v3:
- updated phy_ops logic
- tested in BPI-M64
- updated handoff logic for rk3328

Changes for v2:
- Use proper cfg function for meson
- Add VOP cleanup code.
- Add DCLK get rate

Linux VOP/HDMI out issues seems resolved with explicit WIN0 disable.

Any inputs?
Jagan.

Jagan Teki (17):
video: rockchip: hdmi: Detect hpd after controller init
video: dw_hdmi: Add Vendor PHY handling
video: dw_hdmi: Extend the HPD detection
video: dw_hdmi: Add read_hpd hook
video: dw_hdmi: Add setup_hpd hook
video: rockchip: vop: Simplify rkvop_enable
video: rockchip: vop: Add win offset support
video: rockchip: vop: Add dsp offset support
clk: rockchip: rk3328: Add VOP clk support

Quoted 8 lines

clk: rk3328: Add get hdmiphy clock
phy: rockchip: Add Rockchip INNO HDMI PHY driver
video: rockchip: Add rk3328 hdmi support
video: rockchip: Add rk3328 vop support
ARM: dts: rk3328: Enable VOP for bootph-all
rockchip: Enable preconsole for rk3328
configs: evb-rk3328: Enable vidconsole for rk3328
configs: Enable HDMI Out for ROC-RK3328-CC

Any comments on this? Or is it okay if I send a PR for this?

Jagan.

author
#25 lore raw

Hi Anatolij,

Quoted 57 lines · Jagan Teki

Hi Anatolij,

Quoted 44 lines · Jagan Teki

From: Jagan Teki <[email protected]>

Unlike RK3399, Sunxi/Meson DW HDMI the new Rockchip SoC Rk3328 would support external vendor PHY with DW HDMI chip.

Support this vendor PHY by adding new platform PHY ops via DW HDMI driver and call the respective generic phy from platform driver code.

This series tested in RK3328 with 1080p (1920x1080) resolution.

Patch 0001/0005: Support Vendor PHY
Patch 0006/0008: VOP extension for win, dsp offsets
Patch 0009/0010: RK3328 VOP, HDMI clocks
Patch 0011:      Rockchip Inno HDMI PHY
Patch 0012:      RK3328 HDMI driver
Patch 0013:      RK3328 VOP driver
Patch 0014/0017: Enable HDMI Out for RK3328

Changes for v3:
- updated phy_ops logic
- tested in BPI-M64
- updated handoff logic for rk3328

Changes for v2:
- Use proper cfg function for meson
- Add VOP cleanup code.
- Add DCLK get rate

Linux VOP/HDMI out issues seems resolved with explicit WIN0 disable.

Any inputs?
Jagan.

Jagan Teki (17):
video: rockchip: hdmi: Detect hpd after controller init
video: dw_hdmi: Add Vendor PHY handling
video: dw_hdmi: Extend the HPD detection
video: dw_hdmi: Add read_hpd hook
video: dw_hdmi: Add setup_hpd hook
video: rockchip: vop: Simplify rkvop_enable
video: rockchip: vop: Add win offset support
video: rockchip: vop: Add dsp offset support
clk: rockchip: rk3328: Add VOP clk support

Quoted 8 lines

clk: rk3328: Add get hdmiphy clock
phy: rockchip: Add Rockchip INNO HDMI PHY driver
video: rockchip: Add rk3328 hdmi support
video: rockchip: Add rk3328 vop support
ARM: dts: rk3328: Enable VOP for bootph-all
rockchip: Enable preconsole for rk3328
configs: evb-rk3328: Enable vidconsole for rk3328
configs: Enable HDMI Out for ROC-RK3328-CC

Quoted 1 line

Any comments on this? Or is it okay if I send a PR for this?

Any update?

Jagan.

#26 lore raw

On Thu, 14 Mar 2024 14:55:32 +0530
Jagan Teki [email protected] wrote:
...

Quoted 19 lines
Quoted 19 lines
Quoted 18 lines

Jagan Teki (17):
video: rockchip: hdmi: Detect hpd after controller init
video: dw_hdmi: Add Vendor PHY handling
video: dw_hdmi: Extend the HPD detection
video: dw_hdmi: Add read_hpd hook
video: dw_hdmi: Add setup_hpd hook
video: rockchip: vop: Simplify rkvop_enable
video: rockchip: vop: Add win offset support
video: rockchip: vop: Add dsp offset support
clk: rockchip: rk3328: Add VOP clk support
clk: rk3328: Add get hdmiphy clock
phy: rockchip: Add Rockchip INNO HDMI PHY driver
video: rockchip: Add rk3328 hdmi support
video: rockchip: Add rk3328 vop support
ARM: dts: rk3328: Enable VOP for bootph-all
rockchip: Enable preconsole for rk3328
configs: evb-rk3328: Enable vidconsole for rk3328
configs: Enable HDMI Out for ROC-RK3328-CC

Quoted 3 lines
Quoted 1 line

Any comments on this? Or is it okay if I send a PR for this?

Any update?

Series applied to u-boot-video.

--
Anatolij