Skip to contentSkip to conversation

drm/rockchip: hdmi support for rk3328

PATCH Superseded Heiko Stuebner 5 participants 15 messages Feb 5, 2018 – Feb 9, 2018 3 messages not in the archive

Subsystems (7)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover drm/rockchip: hdmi support for rk3328

The rk3228/rk3229 and rk3328 socs started using a new type of hdmi-phy from Innosilicon that resides completely separate from the dw-hdmi block and gets accessed via mmio.

Additionally the rk3328 dw-hdmi does not report the vendor-phy type but a different one instead, so add the possibility to override the phy type when the glue driver knows better than the ip block itself.

I've put both the phy driver and dw-hdmi changes into one series just to showcase how everything comes together, but would of course still expect things to go through the separate phy and drm trees once deemed ready.

Algea Cao (1):
drm/bridge: dw-hdmi: export hotplug functions

Heiko Stuebner (6):
drm/bridge: dw-hdmi: allow overriding of phy-type reading drm/rockchip: dw_hdmi: Allow outputs that don't need output switching
dt-bindings: allow optional phys in Rockchip dw_hdmi binding drm/rockchip: dw_hdmi: allow including external phys drm/rockchip: dw_hdmi: store rockchip_hdmi reference in phy_data
object
drm/rockchip: dw_hdmi: add dw-hdmi support for the rk3328

Zheng Yang (2):
dt-bindings: add binding for Rockchip hdmi phy using an Innosilicon IP
phy: add Rockchip Innosilicon hdmi phy

 .../bindings/display/rockchip/dw_hdmi-rockchip.txt |    3 +
 .../bindings/phy/phy-rockchip-inno-hdmi.txt        |   42 +
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c          |   15 +-
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c        |  130 ++-
 drivers/phy/rockchip/Kconfig                       |    7 +
 drivers/phy/rockchip/Makefile                      |    1 +
 drivers/phy/rockchip/phy-rockchip-inno-hdmi.c      | 1221 ++++++++++++++++++++
 include/drm/bridge/dw_hdmi.h                       |    7 +-
 8 files changed, 1417 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-rockchip-inno-hdmi.txt
 create mode 100644 drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
Signature · 6 lines
2.15.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

A message that is not in the archive (sent off-list or not yet received): 20180205143435.4723-1-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org

#2 lore raw

PATCH 1/9 dt-bindings: add binding for Rockchip hdmi phy using an Innosilicon IP

From: Zheng Yang <[email protected]>

The phy is used so far in two Rockchip socs the rk3228 and the rk3328.

---
 .../bindings/phy/phy-rockchip-inno-hdmi.txt        | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-rockchip-inno-hdmi.txt
Documentation/devicetree/bindings/phy/phy-rockchip-inno-hdmi.txt new file +42 -0
new file mode 100644
index 000000000000..7d36fd8d5d94
@@ -0,0 +1,42 @@
+ROCKCHIP HDMI PHY WITH INNO IP BLOCK
+
+Required properties:
+ - compatible : should be one of the listed compatibles:
+	* "rockchip,rk3228-hdmi-phy",
+	* "rockchip,rk3328-hdmi-phy";
+ - reg : Address and length of the hdmi phy control register set
+ - clocks : phandle + clock specifier for the phy clocks
+ - clock-names : string, clock name, must contain "sysclk" for system
+	  control and register configuration and "refclk" for reference
+	  crystal oscillator clock input to PLL
+ - #clock-cells: should be 0.
+ - clock-output-names : shall be the name for the output clock.
+ - interrupts : phandle + interrupt specified for the hdmiphy interrupt
+ - #phy-cells : must be 0. See ./phy-bindings.txt for details.
+
+Optional properties for rk3328-hdmi-phy:
+ - nvmem-cells = phandle + nvmem specifier for the cpu-version efuse
+ - nvmem-cell-names : "cpu-version" to read the chip version, required
+	  for adjustment to some frequency settings
+
+Example:
+	hdmi_phy: hdmi-phy@12030000 {
+		compatible = "rockchip,rk3228-hdmi-phy";
+		reg = <0x12030000 0x10000>;
+		#phy-cells = <0>;
+		clocks = <&cru PCLK_HDMI_PHY>, <&xin24m>;
+		clock-names = "sysclk", "refclk";
+		#clock-cells = <0>;
+		clock-output-names = "hdmi_phy";
+		status = "disabled";
+	};
+
+Then the PHY can be used in other nodes such as:
+
+	hdmi: hdmi@200a0000 {
+		compatible = "rockchip,rk3228-dw-hdmi";
+		...
+		phys = <&hdmi_phy>;
+		phy-names = "hdmi";
+		...
+	};
Signature · 6 lines
2.15.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

A message that is not in the archive (sent off-list or not yet received): 20180205143435.4723-2-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org

Reviewed-by
#4 lore raw

Re: [PATCH 1/9] dt-bindings: add binding for Rockchip hdmi phy using an Innosilicon IP

Quoted 10 lines · Heiko Stuebner

From: Zheng Yang <[email protected]>

The phy is used so far in two Rockchip socs the rk3228 and the rk3328.

---
 .../bindings/phy/phy-rockchip-inno-hdmi.txt        | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-rockchip-inno-hdmi.txt

--
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

#5 lore raw

PATCH 2/9 phy: add Rockchip Innosilicon hdmi phy

In reply to a message not in the archive

From: Zheng Yang <[email protected]>

Add a driver for the Innosilicon hdmi phy used on rk3228/rk3229 and rk3328 socs from Rockchip.

---
 drivers/phy/rockchip/Kconfig                  |    7 +
 drivers/phy/rockchip/Makefile                 |    1 +
 drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 1221 +++++++++++++++++++++++++
 3 files changed, 1229 insertions(+)
 create mode 100644 drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
drivers/phy/rockchip/Kconfig +7 -0
index f5325b2b679e..41ab78364661 100644
@@ -15,6 +15,13 @@ config PHY_ROCKCHIP_EMMC
 	help
 	  Enable this to support the Rockchip EMMC PHY.
 
+config PHY_ROCKCHIP_INNO_HDMI
+	tristate "Rockchip INNO HDMI PHY Driver"
+	depends on (ARCH_ROCKCHIP || COMPILE_TEST) && OF
+	select GENERIC_PHY
+	help
+	  Enable this to support the Rockchip Innosilicon HDMI PHY.
+
 config PHY_ROCKCHIP_INNO_USB2
 	tristate "Rockchip INNO USB2PHY Driver"
 	depends on (ARCH_ROCKCHIP || COMPILE_TEST) && OF
drivers/phy/rockchip/Makefile +1 -0
index 7f149d989046..fd21cbaf40dd 100644
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_PHY_ROCKCHIP_DP)		+= phy-rockchip-dp.o
 obj-$(CONFIG_PHY_ROCKCHIP_EMMC)		+= phy-rockchip-emmc.o
+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_PCIE)		+= phy-rockchip-pcie.o
 obj-$(CONFIG_PHY_ROCKCHIP_TYPEC)	+= phy-rockchip-typec.o
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c new file +1221 -0

1,221 lines not on this page · raw message

Signature · 6 lines
2.15.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

A message that is not in the archive (sent off-list or not yet received): 20180205143435.4723-3-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org

#7 lore raw

Re: [2/9] phy: add Rockchip Innosilicon hdmi phy

Hello.

Quoted 29 lines · Heiko Stuebner

From: Zheng Yang <[email protected]>

Add a driver for the Innosilicon hdmi phy used on rk3228/rk3229 and rk3328 socs from Rockchip.

---
+++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c

drivers/phy/rockchip/phy-rockchip-inno-hdmi.c new file +20 -0
+static u32 inno_hdmi_phy_get_tmdsclk(struct inno_hdmi_phy *inno, int rate)
+{
+	int bus_width = phy_get_bus_width(inno->phy);
+	u32 tmdsclk;
+
+	switch (bus_width) {
+	case 4:
+		tmdsclk = rate / 2;
+		break;
+	case 5:
+		tmdsclk = rate * 5 / 8;
+		break;
+	case 6:
+		tmdsclk = rate * 3 / 4;
+		break;
+	case 10:
+		tmdsclk = rate * 5 / 4;
+		break;
+	case 12:
+		tmdsclk = rate * 3 / 2;

drivers/phy/rockchip/phy-rockchip-inno-hdmi.c line 436

Quoted 10 lines
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c new file +10 -0
+		break;
+	case 16:
+		tmdsclk = rate * 2;
+		break;
+	default:
+		tmdsclk = rate;
+	}
+
+	return tmdsclk;
+}

Please corrects integer overflow like https://github.com/mcerveny/rockchip-linux/commit/b4bc703f2dca4e5115b22155920d2277671a9f00

M.C>

maintainer
#8 lore raw

Re: [2/9] phy: add Rockchip Innosilicon hdmi phy

Hi Martin,

Am Montag, 5. Februar 2018, 22:32:08 CET schrieb Martin Cerveny:

Quoted 35 lines · Heiko Stuebner
Quoted 34 lines

From: Zheng Yang <[email protected]>

Add a driver for the Innosilicon hdmi phy used on rk3228/rk3229 and rk3328 socs from Rockchip.

---
+++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c

drivers/phy/rockchip/phy-rockchip-inno-hdmi.c new file +25 -0
+static u32 inno_hdmi_phy_get_tmdsclk(struct inno_hdmi_phy *inno, int rate)
+{
+	int bus_width = phy_get_bus_width(inno->phy);
+	u32 tmdsclk;
+
+	switch (bus_width) {
+	case 4:
+		tmdsclk = rate / 2;
+		break;
+	case 5:
+		tmdsclk = rate * 5 / 8;
+		break;
+	case 6:
+		tmdsclk = rate * 3 / 4;
+		break;
+	case 10:
+		tmdsclk = rate * 5 / 4;
+		break;
+	case 12:
+		tmdsclk = rate * 3 / 2;
+		break;
+	case 16:
+		tmdsclk = rate * 2;
+		break;
+	default:
Quoted 8 lines

drivers/phy/rockchip/phy-rockchip-inno-hdmi.c line 436

Quoted 5 lines
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c new file +5 -0
+		tmdsclk = rate;
+	}
+
+	return tmdsclk;
+}

Please corrects integer overflow
like https://github.com/mcerveny/rockchip-linux/commit/b4bc703f2dca4e5115b22155920d2277671a9f00

thanks for finding that possible issue. I've adapted the phy driver in a similar way (using u64 though) and will include that change in the next version.

Thanks
Heiko

#9 lore raw

Re: [2/9] phy: add Rockchip Innosilicon hdmi phy

Quoted 45 lines · Heiko Stuebner

Hi Martin,

Am Montag, 5. Februar 2018, 22:32:08 CET schrieb Martin Cerveny:

Quoted 34 lines · Heiko Stuebner
Quoted 33 lines

From: Zheng Yang <[email protected]>

Add a driver for the Innosilicon hdmi phy used on rk3228/rk3229 and rk3328 socs from Rockchip.

---
+++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c

drivers/phy/rockchip/phy-rockchip-inno-hdmi.c new file +24 -0
+static u32 inno_hdmi_phy_get_tmdsclk(struct inno_hdmi_phy *inno, int rate)
+{
+	int bus_width = phy_get_bus_width(inno->phy);
+	u32 tmdsclk;
+
+	switch (bus_width) {
+	case 4:
+		tmdsclk = rate / 2;
+		break;
+	case 5:
+		tmdsclk = rate * 5 / 8;
+		break;
+	case 6:
+		tmdsclk = rate * 3 / 4;
+		break;
+	case 10:
+		tmdsclk = rate * 5 / 4;
+		break;
+	case 12:
+		tmdsclk = rate * 3 / 2;
+		break;
+	case 16:
+		tmdsclk = rate * 2;
+		break;
Quoted 8 lines

drivers/phy/rockchip/phy-rockchip-inno-hdmi.c line 436

Quoted 6 lines
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c new file +6 -0
+	default:
+		tmdsclk = rate;
+	}
+
+	return tmdsclk;
+}

Please corrects integer overflow
like https://github.com/mcerveny/rockchip-linux/commit/b4bc703f2dca4e5115b22155920d2277671a9f00

Quoted 3 lines

thanks for finding that possible issue. I've adapted the phy driver in a similar way (using u64 though) and will include that change in the next version.

Btw, wouldn't be simpler to just use:
switch (bus_width) {
case 4:
case 5:
case 6:
case 10:
case 12:
case 16:
    return (u64)rate * bus_width / 8;
default:
    return rate;
}

Regards
Andrzej

Quoted 7 lines

Thanks
Heiko

--
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
#10 lore raw

Re: [2/9] phy: add Rockchip Innosilicon hdmi phy

Am Freitag, 9. Februar 2018, 11:06:49 CET schrieb Andrzej Hajda:

Quoted 58 lines · Heiko Stuebner
Quoted 45 lines

Hi Martin,

Am Montag, 5. Februar 2018, 22:32:08 CET schrieb Martin Cerveny:

Quoted 34 lines · Heiko Stuebner
Quoted 33 lines

From: Zheng Yang <[email protected]>

Add a driver for the Innosilicon hdmi phy used on rk3228/rk3229 and rk3328 socs from Rockchip.

---
+++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi.c

drivers/phy/rockchip/phy-rockchip-inno-hdmi.c new file +24 -0
+static u32 inno_hdmi_phy_get_tmdsclk(struct inno_hdmi_phy *inno, int rate)
+{
+	int bus_width = phy_get_bus_width(inno->phy);
+	u32 tmdsclk;
+
+	switch (bus_width) {
+	case 4:
+		tmdsclk = rate / 2;
+		break;
+	case 5:
+		tmdsclk = rate * 5 / 8;
+		break;
+	case 6:
+		tmdsclk = rate * 3 / 4;
+		break;
+	case 10:
+		tmdsclk = rate * 5 / 4;
+		break;
+	case 12:
+		tmdsclk = rate * 3 / 2;
+		break;
+	case 16:
+		tmdsclk = rate * 2;
+		break;
Quoted 8 lines

drivers/phy/rockchip/phy-rockchip-inno-hdmi.c line 436

Quoted 6 lines
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c new file +6 -0
+	default:
+		tmdsclk = rate;
+	}
+
+	return tmdsclk;
+}

Please corrects integer overflow
like https://github.com/mcerveny/rockchip-linux/commit/b4bc703f2dca4e5115b22155920d2277671a9f00

Quoted 3 lines

thanks for finding that possible issue. I've adapted the phy driver in a similar way (using u64 though) and will include that change in the next version.

Btw, wouldn't be simpler to just use:
switch (bus_width) {
case 4:
case 5:
case 6:
case 10:
case 12:
case 16:

Quoted 4 lines
    return (u64)rate * bus_width / 8;
default:
    return rate;
}

you're a genius ;-) .
I must be looking at this code for way to long to not see this relation.

Thanks
Heiko

#11 lore raw

PATCH 3/9 drm/bridge: dw-hdmi: allow overriding of phy-type reading

In reply to a message not in the archive

In some IP implementations the reading of the phy-type may be broken. One example are the Rockchip rk3228 and rk3328 socs that use a separate phy from Innosilicon but still report the HDMI20_TX type.

So allow the glue driver to force a specific type, like the vendor-phy for these cases.

---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 +++-
 include/drm/bridge/dw_hdmi.h              | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3 -1
index a38db40ce990..7255fafce089 100644
@@ -2200,7 +2200,9 @@ static int dw_hdmi_detect_phy(struct dw_hdmi *hdmi)
 	unsigned int i;
 	u8 phy_type;
 
-	phy_type = hdmi_readb(hdmi, HDMI_CONFIG2_ID);
+	phy_type = (hdmi->plat_data->phy_force_type) ?
+				hdmi->plat_data->phy_force_type :
+				hdmi_readb(hdmi, HDMI_CONFIG2_ID);
 
 	if (phy_type == DW_HDMI_PHY_VENDOR_PHY) {
 		/* Vendor PHYs require support from the glue layer. */
include/drm/bridge/dw_hdmi.h +1 -0
index 182f83283e24..c5bc2804b29e 100644
@@ -133,6 +133,7 @@ struct dw_hdmi_plat_data {
 	const struct dw_hdmi_phy_ops *phy_ops;
 	const char *phy_name;
 	void *phy_data;
+	u8 phy_force_type;
 
 	/* Synopsys PHY support */
 	const struct dw_hdmi_mpll_config *mpll_cfg;
Signature · 6 lines
2.15.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
#12 lore raw

PATCH 4/9 drm/bridge: dw-hdmi: export hotplug functions

In reply to a message not in the archive

From: Algea Cao <[email protected]>

External phys may not provide their own hotplug-related routines but instead rely on the dw-hdmi ones. Export these functions so that external hdmi-phys can use them if necessary.

[export all 3 hotplug-related functions]
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 11 +++++++----
 include/drm/bridge/dw_hdmi.h              |  6 +++++-
 2 files changed, 12 insertions(+), 5 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +7 -4
index 7255fafce089..2760e1b51422 100644
@@ -1251,14 +1251,15 @@ static void dw_hdmi_phy_disable(struct dw_hdmi *hdmi, void *data)
 	dw_hdmi_phy_power_off(hdmi);
 }
 
-static enum drm_connector_status dw_hdmi_phy_read_hpd(struct dw_hdmi *hdmi,
-						      void *data)
+enum drm_connector_status dw_hdmi_phy_read_hpd(struct dw_hdmi *hdmi,
+					       void *data)
 {
 	return hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_HPD ?
 		connector_status_connected : connector_status_disconnected;
 }
+EXPORT_SYMBOL_GPL(dw_hdmi_phy_read_hpd);
 
-static void dw_hdmi_phy_update_hpd(struct dw_hdmi *hdmi, void *data,
+void dw_hdmi_phy_update_hpd(struct dw_hdmi *hdmi, void *data,
 				   bool force, bool disabled, bool rxsense)
 {
 	u8 old_mask = hdmi->phy_mask;
@@ -1271,8 +1272,9 @@ static void dw_hdmi_phy_update_hpd(struct dw_hdmi *hdmi, void *data,
 	if (old_mask != hdmi->phy_mask)
 		hdmi_writeb(hdmi, hdmi->phy_mask, HDMI_PHY_MASK0);
 }
+EXPORT_SYMBOL_GPL(dw_hdmi_phy_update_hpd);
 
-static void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data)
+void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data)
 {
 	/*
 	 * Configure the PHY RX SENSE and HPD interrupts polarities and clear
@@ -1291,6 +1293,7 @@ static void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data)
 	hdmi_writeb(hdmi, ~(HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE),
 		    HDMI_IH_MUTE_PHY_STAT0);
 }
+EXPORT_SYMBOL_GPL(dw_hdmi_phy_setup_hpd);
 
 static const struct dw_hdmi_phy_ops dw_hdmi_synopsys_phy_ops = {
 	.init = dw_hdmi_phy_init,
include/drm/bridge/dw_hdmi.h +5 -1
index c5bc2804b29e..d9d7c75b3bfb 100644
@@ -152,7 +152,11 @@ int dw_hdmi_bind(struct platform_device *pdev, struct drm_encoder *encoder,
 		 const struct dw_hdmi_plat_data *plat_data);
 
 void dw_hdmi_setup_rx_sense(struct device *dev, bool hpd, bool rx_sense);
-
+enum drm_connector_status dw_hdmi_phy_read_hpd(struct dw_hdmi *hdmi,
+					       void *data);
+void dw_hdmi_phy_update_hpd(struct dw_hdmi *hdmi, void *data,
+				   bool force, bool disabled, bool rxsense);
+void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data);
 void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate);
 void dw_hdmi_audio_enable(struct dw_hdmi *hdmi);
 void dw_hdmi_audio_disable(struct dw_hdmi *hdmi);
Signature · 6 lines
2.15.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
#13 lore raw

PATCH 5/9 drm/rockchip: dw_hdmi: Allow outputs that don't need output switching

In reply to a message not in the archive

So far we always encountered socs with 2 output crtcs needing the driver to tell the hdmi block which output to connect to. But there also exist socs with only one crtc like the rk3228, rk3328 and rk3368.

So adapt the register field to simply carry a negative value to signal that now output-switching is necessary.

---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +4 -1
index 1eb02a82fd91..304f61bd2eec 100644
@@ -36,7 +36,7 @@
  * @lcdsel_lit: reg value of selecting vop little for HDMI
  */
 struct rockchip_hdmi_chip_data {
-	u32	lcdsel_grf_reg;
+	int	lcdsel_grf_reg;
 	u32	lcdsel_big;
 	u32	lcdsel_lit;
 };
@@ -252,6 +252,9 @@ static void dw_hdmi_rockchip_encoder_enable(struct drm_encoder *encoder)
 	u32 val;
 	int ret;
 
+	if (hdmi->chip_data->lcdsel_grf_reg < 0)
+		return;
+
 	ret = drm_of_encoder_active_endpoint_id(hdmi->dev->of_node, encoder);
 	if (ret)
 		val = hdmi->chip_data->lcdsel_lit;
Signature · 6 lines
2.15.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
#14 lore raw

PATCH 6/9 dt-bindings: allow optional phys in Rockchip dw_hdmi binding

In reply to a message not in the archive

Some newer Rockchip SoCs use an Innosilicon hdmiphy accessed via general mmio, so allow these to be referenced via the regular phy interfaces and therefore add optional phy-related properties to the binding.

---
 Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt +2 -0
index adc94fc3c9f8..937bfb472e1d 100644
@@ -34,6 +34,8 @@ Optional properties
 - clock-names: May contain "cec" as defined in dw_hdmi.txt.
 - clock-names: May contain "grf", power for grf io.
 - clock-names: May contain "vpll", external clock for some hdmi phy.
+- phys: from general PHY binding: the phandle for the PHY device.
+- phy-names: Should be "hdmi" if phys references an external phy.
 
 Example:
 
Signature · 6 lines
2.15.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
#15 lore raw

PATCH 8/9 drm/rockchip: dw_hdmi: store rockchip_hdmi reference in phy_data object

In reply to a message not in the archive

When using special phy handling operations we'll often need access to the rockchip_hdmi struct. As the chip-data that occupies the phy_data pointer initially gets assigned to the rockchip_hdmi struct we can not re-use this phy_data pointer to hold the reference to the rockchip_hdmi struct, similar to how meson-hdmi does it for example.

---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +7 -2
index 512f8556e7c0..5a62328887d5 100644
@@ -342,7 +342,7 @@ 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;
+	struct dw_hdmi_plat_data *plat_data;
 	const struct of_device_id *match;
 	struct drm_device *drm = data;
 	struct drm_encoder *encoder;
@@ -357,9 +357,14 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 		return -ENOMEM;
 
 	match = of_match_node(dw_hdmi_rockchip_dt_ids, pdev->dev.of_node);
-	plat_data = match->data;
+	plat_data = devm_kmemdup(&pdev->dev, match->data,
+					     sizeof(*plat_data), GFP_KERNEL);
+	if (!plat_data)
+		return -ENOMEM;
+
 	hdmi->dev = &pdev->dev;
 	hdmi->chip_data = plat_data->phy_data;
+	plat_data->phy_data = hdmi;
 	encoder = &hdmi->encoder;
 
 	encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
Signature · 6 lines
2.15.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
#16 lore raw

PATCH 9/9 drm/rockchip: dw_hdmi: add dw-hdmi support for the rk3328

In reply to a message not in the archive

The rk3328 uses an external hdmi phy from Innosilicon which uses the generic phy framework for access. Add the necessary data and the compatible for it.

---
 .../bindings/display/rockchip/dw_hdmi-rockchip.txt |   1 +
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c        | 106 +++++++++++++++++++++
 2 files changed, 107 insertions(+)
Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt +1 -0
index 937bfb472e1d..39143424a474 100644
@@ -13,6 +13,7 @@ Required properties:
 
 - compatible: should be one of the following:
 		"rockchip,rk3288-dw-hdmi"
+		"rockchip,rk3328-dw-hdmi"
 		"rockchip,rk3399-dw-hdmi"
 - reg: See dw_hdmi.txt.
 - reg-io-width: See dw_hdmi.txt. Shall be 4.
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +106 -0

130 lines not on this page · raw message

Signature · 6 lines
2.15.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
#17 lore raw

PATCH 7/9 drm/rockchip: dw_hdmi: allow including external phys

In reply to Heiko Stuebner

Some variants of the dw-hdmi on Rockchip socs use a separate phy block accessed via the generic phy framework, so allow them to be included if such a phy reference is found.

---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +10 -0
index 304f61bd2eec..512f8556e7c0 100644
@@ -11,6 +11,7 @@
 #include <linux/mfd/syscon.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/phy/phy.h>
 #include <linux/regmap.h>
 
 #include <drm/drm_of.h>
@@ -48,6 +49,7 @@ struct rockchip_hdmi {
 	const struct rockchip_hdmi_chip_data *chip_data;
 	struct clk *vpll_clk;
 	struct clk *grf_clk;
+	struct phy *phy;
 };
 
 #define to_rockchip_hdmi(x)	container_of(x, struct rockchip_hdmi, x)
@@ -376,6 +378,14 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 		return ret;
 	}
 
+	hdmi->phy = devm_phy_optional_get(dev, "hdmi");
+	if (IS_ERR(hdmi->phy)) {
+		ret = PTR_ERR(hdmi->phy);
+		if (ret != -EPROBE_DEFER)
+			DRM_DEV_ERROR(hdmi->dev, "failed to get phy\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, NULL);
Signature · 1 line
2.15.1