Skip to contentSkip to conversation

dt-bindings: add binding for Rockchip hdmi phy using an Innosilicon IP

PATCH Superseded Heiko Stuebner 3 participants 6 messages Sep 6, 2018 – Sep 7, 2018

Subsystems (3)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Heiko Stuebner

author maintainer
#0 lore raw

PATCH v4 1/2 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.

---
changes in v3:
- describe both refclks supplied to the phy block

 .../bindings/phy/phy-rockchip-inno-hdmi.txt   | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-rockchip-inno-hdmi.txt
Documentation/devicetree/bindings/phy/phy-rockchip-inno-hdmi.txt new file +43 -0
new file mode 100644
index 000000000000..710cccd5ee56
@@ -0,0 +1,43 @@
+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, "refoclk" for crystal-
+	  oscillator reference PLL clock input and "refpclk" for pclk-
+	  based refeference PLL clock input.
+ - #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 at 12030000 {
+		compatible = "rockchip,rk3228-hdmi-phy";
+		reg = <0x12030000 0x10000>;
+		#phy-cells = <0>;
+		clocks = <&cru PCLK_HDMI_PHY>, <&xin24m>, <&cru DCLK_HDMIPHY>;
+		clock-names = "sysclk", "refoclk", "refpclk";
+		#clock-cells = <0>;
+		clock-output-names = "hdmi_phy";
+		status = "disabled";
+	};
+
+Then the PHY can be used in other nodes such as:
+
+	hdmi: hdmi at 200a0000 {
+		compatible = "rockchip,rk3228-dw-hdmi";
+		...
+		phys = <&hdmi_phy>;
+		phy-names = "hdmi";
+		...
+	};
Signature · 1 line
2.17.0
author maintainer
#1 lore raw

PATCH v4 2/2 phy: add Rockchip Innosilicon hdmi phy

From: Zheng Yang <[email protected]>

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

---
changes in v4:
- address Kishon's review comments
- common_clk dependency
- describe the undocumented nature of phy tuning values
- increase sleep range
- return PTR_ERR_OR_ZERO in probe
- drop error handling already done by devm_add_action_or_reset changes in v3:
- included real recalc_rate for rk3228
- claim both refclks and keep the refpclk on
to make rk3328 happy for now
changes in v2:
- prevent overflow in tmdsclk calculation
as reported by Martin Cerveny
- use unsigned long for all tmdsclk rate uses
- simplify tmds rate calculation

 drivers/phy/rockchip/Kconfig                  |    8 +
 drivers/phy/rockchip/Makefile                 |    1 +
 drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 1269 +++++++++++++++++
 3 files changed, 1278 insertions(+)
 create mode 100644 drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
drivers/phy/rockchip/Kconfig +8 -0
index 0e15119ddfc6..990204a46eb6 100644
@@ -15,6 +15,14 @@ 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
+	depends on COMMON_CLK
+	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 +1269 -0

1,269 lines not on this page · raw message

Signature · 1 line
2.17.0
#2 lore raw

PATCH v4 2/2 phy: add Rockchip Innosilicon hdmi phy

Hi Heiko,

Quoted 8 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.

I got a bunch of checkpatch "check" warnings
"Alignment should match open parenthesis". Can you fix resend after fixing those?

Thanks
Kishon

#3 lore raw

PATCH v4 2/2 phy: add Rockchip Innosilicon hdmi phy

In reply to Heiko Stuebner
Quoted 8 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.

That reminds me, I really must dig out that box again and finish figuring out the GPIOs and regulators... :)

[...]

Quoted 7 lines
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c new file +7 -0
+static int inno_hdmi_phy_probe(struct platform_device *pdev)
+{
+	struct inno_hdmi_phy *inno;
+	const struct of_device_id *match;
+	struct phy_provider *phy_provider;
+	struct resource *res;
+	void __iomem *regs;

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

Quoted 10 lines
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c new file +10 -0
+	int ret;
+
+	inno = devm_kzalloc(&pdev->dev, sizeof(*inno), GFP_KERNEL);
+	if (!inno)
+		return -ENOMEM;
+
+	inno->dev = &pdev->dev;
+
+	match = of_match_device(inno->dev->driver->of_match_table, inno->dev);
+	inno->plat_data = (struct inno_hdmi_phy_drv_data *)match->data;

Nit: if there's cause to do another respin anyway, you could simplify this part with of_device_get_match_data().

Robin.

author maintainer
#4 lore raw

PATCH v4 2/2 phy: add Rockchip Innosilicon hdmi phy

Am Freitag, 7. September 2018, 10:58:04 CEST schrieb Robin Murphy:

Quoted 26 lines · Heiko Stuebner
Quoted 8 lines

From: Zheng Yang <[email protected]>

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

That reminds me, I really must dig out that box again and finish figuring out the GPIOs and regulators... :)

[...]

Quoted 12 lines
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c new file +12 -0
+static int inno_hdmi_phy_probe(struct platform_device *pdev)
+{
+	struct inno_hdmi_phy *inno;
+	const struct of_device_id *match;
+	struct phy_provider *phy_provider;
+	struct resource *res;
+	void __iomem *regs;
+	int ret;
+
+	inno = devm_kzalloc(&pdev->dev, sizeof(*inno), GFP_KERNEL);
+	if (!inno)
+		return -ENOMEM;
Quoted 8 lines

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

Quoted 5 lines
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c new file +5 -0
+
+	inno->dev = &pdev->dev;
+
+	match = of_match_device(inno->dev->driver->of_match_table, inno->dev);
+	inno->plat_data = (struct inno_hdmi_phy_drv_data *)match->data;

Nit: if there's cause to do another respin anyway, you could simplify this part with of_device_get_match_data().

done in v6 ... I found your mail directly after sending v5 ;-) .

author maintainer
#5 lore raw

PATCH v4 2/2 phy: add Rockchip Innosilicon hdmi phy

In reply to Robin Murphy

Am Freitag, 7. September 2018, 10:58:04 CEST schrieb Robin Murphy:

Quoted 26 lines · Heiko Stuebner
Quoted 8 lines

From: Zheng Yang <[email protected]>

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

That reminds me, I really must dig out that box again and finish figuring out the GPIOs and regulators... :)

[...]

Quoted 12 lines
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c new file +12 -0
+static int inno_hdmi_phy_probe(struct platform_device *pdev)
+{
+	struct inno_hdmi_phy *inno;
+	const struct of_device_id *match;
+	struct phy_provider *phy_provider;
+	struct resource *res;
+	void __iomem *regs;
+	int ret;
+
+	inno = devm_kzalloc(&pdev->dev, sizeof(*inno), GFP_KERNEL);
+	if (!inno)
+		return -ENOMEM;
Quoted 8 lines

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

Quoted 5 lines
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c new file +5 -0
+
+	inno->dev = &pdev->dev;
+
+	match = of_match_device(inno->dev->driver->of_match_table, inno->dev);
+	inno->plat_data = (struct inno_hdmi_phy_drv_data *)match->data;

Nit: if there's cause to do another respin anyway, you could simplify this part with of_device_get_match_data().

done in v6 ... I found your mail directly after sending v5 ;-) .