drm/rockchip: hdmi support for rk3328
Subsystems (7)
v2 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.
So patches 1+2 are expected to go through the phy-tree and the rest should go through the drm tree.
changes in v2:
- phy: prevent overflow in tmdsclk calculation as reported by Martin Cerveny
- phy: use unsigned long for all tmdsclk rate uses
- phy: simplify tmds rate calculation
- dropped patch exporting some dw-hdmi phy functions as a similar patch entered drm-misc already
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 | 4 +- 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 | 1209 ++++++++++++++++++++ include/drm/bridge/dw_hdmi.h | 1 + 8 files changed, 1393 insertions(+), 4 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
Heiko Stuebner
maintainerPATCH v2 1/8 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
@@ -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 at 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 at 200a0000 { + compatible = "rockchip,rk3228-dw-hdmi"; + ... + phys = <&hdmi_phy>; + phy-names = "hdmi"; + ... + };
Signature · 1 line
2.15.1
Re: [PATCH v2 1/8] dt-bindings: add binding for Rockchip hdmi phy using an Innosilicon IP
Am Freitag, 16. Februar 2018, 21:41:51 CET schrieb Heiko Stuebner:
Quoted 6 lines
From: Zheng Yang <[email protected]>
The phy is used so far in two Rockchip socs the rk3228 and the rk3328.
Signed-off-by Zheng Yang <[email protected]>Signed-off-by Heiko Stuebner <[email protected]>
Forgot to add that the v1 binding already got a review as
A message that is not in the archive (sent off-list or not yet received): 20180216204158.29839-1-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org
PATCH v2 2/8 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.
---
Patches 1+2 expected to go through the phy-tree
drivers/phy/rockchip/Kconfig | 7 + drivers/phy/rockchip/Makefile | 1 + drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 1209 +++++++++++++++++++++++++ 3 files changed, 1217 insertions(+) create mode 100644 drivers/phy/rockchip/phy-rockchip-inno-hdmi.c
drivers/phy/rockchip/Kconfig +7 -0
@@ -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
@@ -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 +1209 -0
1,209 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
PATCH v2 3/8 drm/bridge: dw-hdmi: allow overriding of phy-type reading
In reply to a message not in the archiveIn 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
@@ -2218,7 +2218,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
@@ -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
Re: [PATCH v2 3/8] drm/bridge: dw-hdmi: allow overriding of phy-type reading
Hi Heiko,
Thank you for the patch.
Quoted 8 lines · On Friday, 16 February 2018 22:41:53 EET Heiko Stuebner wrote:
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_TXtype.So allow the glue driver to force a specific type, like the vendor-phy for these cases.
Signed-off-by Heiko Stuebner <[email protected]>
Quoted 11 lines
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 +++- include/drm/bridge/dw_hdmi.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.cindexf9802399cc0d..50d231626c4d100644
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c static int dw_hdmi_detect_phy(struct dw_hdmi *hdmi) · line 2223
Quoted 7 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3
-1@@ -2218,7 +2218,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 );
No need for parentheses. You could even write this
phy_type = hdmi->plat_data->phy_force_type ?
: hdmi_readb(hdmi, HDMI_CONFIG2_ID);but that's up to you.
What if a driver wants to force the PHY type to DW_HDMI_PHY_DWC_HDMI_TX_PHY ? Or do you expect only the DW_HDMI_PHY_VENDOR_PHY type to be forced ? If so, we could also use a force_vendor_phy boolean field instead of phy_force_type.
Quoted 14 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +0
-0if (phy_type ==DW_HDMI_PHY_VENDOR_PHY ) {/* Vendor PHYs require support from the glue layer. */ include/drm/bridge/dw_hdmi.h +1
-0@@ -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 · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Heiko Stuebner
maintainerRe: [PATCH v2 3/8] drm/bridge: dw-hdmi: allow overriding of phy-type reading
Hi Laurent,
Am Montag, 19. Februar 2018, 17:59:02 CET schrieb Laurent Pinchart:
Quoted 11 lines · On Friday, 16 February 2018 22:41:53 EET Heiko Stuebner wrote:
Quoted 8 lines
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_TXtype.So allow the glue driver to force a specific type, like the vendor-phy for these cases.
Signed-off-by Heiko Stuebner <[email protected]>Tested-by Laurent Pinchart <[email protected]>
thanks for testing :-)
Quoted 21 lines
Quoted 11 lines
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 +++- include/drm/bridge/dw_hdmi.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.cindexf9802399cc0d..50d231626c4d100644drivers/gpu/drm/bridge/synopsys/dw-hdmi.c static int dw_hdmi_detect_phy(struct dw_hdmi *hdmi) · line 2223
Quoted 7 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3
-1@@ -2218,7 +2218,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 );No need for parentheses. You could even write this
Quoted 8 lines
phy_type = hdmi->plat_data->phy_force_type ? : hdmi_readb(hdmi, HDMI_CONFIG2_ID);but that's up to you.
What if a driver wants to force the PHY type to
DW_HDMI_PHY_DWC_HDMI_TX_PHY? Or do you expect only theDW_HDMI_PHY_VENDOR_PHYtype to be forced ? If so, we could also use aforce_vendor_phyboolean field instead ofphy_force_type.
Initially I thought of implicitly overriding the phy-type when the external phy-ops are set, but decided against it because that might break (theoretical) cases where phy-ops may be always set but only used when the ip returns a matching phy-type and thus came to just allow overriding that type reading.
As for limiting to only allow forcing the vendor type, my personal feeling would be to allow glue drivers to just override the type as needed like done in the patch. As can be seen on the rk3328, the dw-hdmi reports one of the regular phys (forgot which one) but instead has a completely separate ip for it, so I'd guess we may very well see implementations that just report a wrong type (no vendor-type).
So I don't see an issue with drivers being allowed to set the type to DW_HDMI_PHY_DWC_HDMI_TX_PHY, because such cases may exist in the future and I'd expect driver authors to somewhat know what they're doing.
But I'm not tied to that, so will go with the majority opinion :-D .
Heiko
Laurent Pinchart
reviewerRe: [PATCH v2 3/8] drm/bridge: dw-hdmi: allow overriding of phy-type reading
Hi Heiko,
Quoted 61 lines · On Monday, 19 February 2018 20:46:46 EET Heiko Stuebner wrote:
Am Montag, 19. Februar 2018, 17:59:02 CET schrieb Laurent Pinchart:
Quoted 11 lines · On Friday, 16 February 2018 22:41:53 EET Heiko Stuebner wrote:
Quoted 8 lines
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_TXtype.So allow the glue driver to force a specific type, like the vendor-phy for these cases.
Signed-off-by Heiko Stuebner <[email protected]>Tested-by Laurent Pinchart <[email protected]>thanks for testing :-)
Quoted 26 lines
Quoted 12 lines
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 +++- include/drm/bridge/dw_hdmi.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.cindexf9802399cc0d..50d231626c4d100644drivers/gpu/drm/bridge/synopsys/dw-hdmi.c static int dw_hdmi_detect_phy(struct dw_hdmi · line 2224
Quoted 8 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3
-1@@ -2218,7 +2218,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 );No need for parentheses. You could even write this
phy_type = hdmi->plat_data->phy_force_type ? : hdmi_readb(hdmi, HDMI_CONFIG2_ID);Quoted 6 lines
but that's up to you.
What if a driver wants to force the PHY type to
DW_HDMI_PHY_DWC_HDMI_TX_PHY? Or do you expect only theDW_HDMI_PHY_VENDOR_PHYtype to be forced ? If so, we could also use aforce_vendor_phyboolean field instead ofphy_force_type.Initially I thought of implicitly overriding the phy-type when the external phy-ops are set, but decided against it because that might break (theoretical) cases where phy-ops may be always set but only used when the ip returns a matching phy-type and thus came to just allow overriding that type reading.
As for limiting to only allow forcing the vendor type, my personal feeling would be to allow glue drivers to just override the type as needed like done in the patch. As can be seen on the rk3328, the dw-hdmi reports one of the regular phys (forgot which one) but instead has a completely separate ip for it, so I'd guess we may very well see implementations that just report a wrong type (no vendor-type).
Quoted 3 lines
So I don't see an issue with drivers being allowed to set the type to
DW_HDMI_PHY_DWC_HDMI_TX_PHY, because such cases may exist in the future and I'd expect driver authors to somewhat know what they're doing.
My point was that DW_HDMI_PHY_DWC_HDMI_TX_PHY == 0, so trying to force DW_HDMI_PHY_DWC_HDMI_TX_PHY through phy_force_type won't work.
Quoted 1 line
But I'm not tied to that, so will go with the majority opinion :-D .
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Heiko Stuebner
maintainerRe: [PATCH v2 3/8] drm/bridge: dw-hdmi: allow overriding of phy-type reading
Hi Laurent,
Am Montag, 19. Februar 2018, 20:06:40 CET schrieb Laurent Pinchart:
Quoted 62 lines · On Monday, 19 February 2018 20:46:46 EET Heiko Stuebner wrote:
Quoted 61 lines
Am Montag, 19. Februar 2018, 17:59:02 CET schrieb Laurent Pinchart:
Quoted 11 lines · On Friday, 16 February 2018 22:41:53 EET Heiko Stuebner wrote:
Quoted 8 lines
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_TXtype.So allow the glue driver to force a specific type, like the vendor-phy for these cases.
Signed-off-by Heiko Stuebner <[email protected]>Tested-by Laurent Pinchart <[email protected]>thanks for testing :-)
Quoted 26 lines
Quoted 12 lines
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 +++- include/drm/bridge/dw_hdmi.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.cindexf9802399cc0d..50d231626c4d100644drivers/gpu/drm/bridge/synopsys/dw-hdmi.c static int dw_hdmi_detect_phy(struct dw_hdmi · line 2224
Quoted 8 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3
-1@@ -2218,7 +2218,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 );No need for parentheses. You could even write this
phy_type = hdmi->plat_data->phy_force_type ? : hdmi_readb(hdmi, HDMI_CONFIG2_ID);Quoted 6 lines
but that's up to you.
What if a driver wants to force the PHY type to
DW_HDMI_PHY_DWC_HDMI_TX_PHY? Or do you expect only theDW_HDMI_PHY_VENDOR_PHYtype to be forced ? If so, we could also use aforce_vendor_phyboolean field instead ofphy_force_type.Initially I thought of implicitly overriding the phy-type when the external phy-ops are set, but decided against it because that might break (theoretical) cases where phy-ops may be always set but only used when the ip returns a matching phy-type and thus came to just allow overriding that type reading.
As for limiting to only allow forcing the vendor type, my personal feeling would be to allow glue drivers to just override the type as needed like done in the patch. As can be seen on the rk3328, the dw-hdmi reports one of the regular phys (forgot which one) but instead has a completely separate ip for it, so I'd guess we may very well see implementations that just report a wrong type (no vendor-type).
Quoted 6 lines
Quoted 3 lines
So I don't see an issue with drivers being allowed to set the type to
DW_HDMI_PHY_DWC_HDMI_TX_PHY, because such cases may exist in the future and I'd expect driver authors to somewhat know what they're doing.My point was that
DW_HDMI_PHY_DWC_HDMI_TX_PHY== 0, so trying to forceDW_HDMI_PHY_DWC_HDMI_TX_PHYthroughphy_force_typewon't work.
Argh, ok now I get it.
So it will need some adaption for that, because allowing everything but DW_HDMI_PHY_DWC_HDMI_TX_PHY would be quite counter-intuitive :-) .
Expecting phy_force_type == -1 for regular reads sounds bad as well, because then every glue driver would need to set that, which currently gets solves automatically when the field is not explicitly set.
So going with your force_vendor_phy idea sounds less intrusive for the time being and until there is an actual case where there is a different internal phy-type necessary?
Laurent Pinchart
reviewerRe: [PATCH v2 3/8] drm/bridge: dw-hdmi: allow overriding of phy-type reading
Hi Heiko,
Quoted 83 lines · On Wednesday, 21 February 2018 20:55:12 EET Heiko Stuebner wrote:
Am Montag, 19. Februar 2018, 20:06:40 CET schrieb Laurent Pinchart:
Quoted 69 lines · On Monday, 19 February 2018 20:46:46 EET Heiko Stuebner wrote:
Quoted 68 lines
Am Montag, 19. Februar 2018, 17:59:02 CET schrieb Laurent Pinchart:
Quoted 6 lines · On Friday, 16 February 2018 22:41:53 EET Heiko Stuebner wrote:
Quoted 5 lines
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 theHDMI20_TXtype.Quoted 7 lines
Quoted 5 lines
So allow the glue driver to force a specific type, like the vendor-phy
for these cases.Signed-off-by Heiko Stuebner <[email protected]>Tested-by Laurent Pinchart <[email protected]>thanks for testing :-)
Quoted 28 lines
Quoted 12 lines
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 +++- include/drm/bridge/dw_hdmi.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.cindexf9802399cc0d..50d231626c4d100644drivers/gpu/drm/bridge/synopsys/dw-hdmi.c static int dw_hdmi_detect_phy(struct dw_hdmi · line 2225
Quoted 9 lines
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3
-1@@ -2218,7 +2218,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 );No need for parentheses. You could even write this
phy_type = hdmi->plat_data->phy_force_type ? : hdmi_readb(hdmi, HDMI_CONFIG2_ID);Quoted 6 lines
but that's up to you.
What if a driver wants to force the PHY type to
DW_HDMI_PHY_DWC_HDMI_TX_PHY? Or do you expect only theDW_HDMI_PHY_VENDOR_PHYtype to be forced ? If so, we could also use aforce_vendor_phyboolean field instead ofphy_force_type.Initially I thought of implicitly overriding the phy-type when the external
phy-ops are set, but decided against it because that might break (theoretical) cases where phy-ops may be always set but only used when the ip returns a matching phy-type and thus came to just allow overriding
that type reading.As for limiting to only allow forcing the vendor type, my personal feeling
would be to allow glue drivers to just override the type as needed like done in the patch. As can be seen on the rk3328, the dw-hdmi reports one of the regular phys (forgot which one) but instead has a completely separate ip for it, so I'd guess we may very well see implementations that just report a wrong type (no vendor-type).Quoted 7 lines
Quoted 4 lines
So I don't see an issue with drivers being allowed to set the type to
DW_HDMI_PHY_DWC_HDMI_TX_PHY, because such cases may exist in the future and I'd expect driver authors to somewhat know what they're doing.My point was that
DW_HDMI_PHY_DWC_HDMI_TX_PHY== 0, so trying to forceDW_HDMI_PHY_DWC_HDMI_TX_PHYthroughphy_force_typewon't work.Argh, ok now I get it.
So it will need some adaption for that, because allowing everything but
DW_HDMI_PHY_DWC_HDMI_TX_PHYwould be quite counter-intuitive :-) .
Quoted 7 lines
Expecting
phy_force_type== -1 for regular reads sounds bad as well, because then every glue driver would need to set that, which currently gets solves automatically when the field is not explicitly set.So going with your
force_vendor_phyidea sounds less intrusive for the time being and until there is an actual case where there is a different internal phy-type necessary?
That's at least what I'd recommend, as I don't see any use case now for overriding the hardware-reported PHY type to a standard PHY type. If we ever end up needing that in the future we will of course support it.
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 4/8 drm/rockchip: dw_hdmi: Allow outputs that don't need output switching
In reply to a message not in the archiveSo 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
@@ -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; };
@@ -253,6 +253,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
Re: [PATCH v2 4/8] drm/rockchip: dw_hdmi: Allow outputs that don't need output switching
Hi Heiko,
Quoted 6 lines · Heiko Stuebner
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.
Nit: s/now/no/ ? (Hooray for grammatically-correct typos which invert the entire meaning of the sentence!)
What are the necessary dependencies for these patches? I tried applying the series on 4.16-rc1 to test, but it failed at patch #6 with some missing context (I tried checking drm-next for where rockchip_hdmi::hdmi might have come from, but didn't see anything obvious)
Thanks,
Robin.
Quoted 29 lines
Signed-off-by Heiko Stuebner <[email protected]>--- 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@@ -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; };@@ -253,6 +253,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;
Heiko Stuebner
maintainerRe: [PATCH v2 4/8] drm/rockchip: dw_hdmi: Allow outputs that don't need output switching
Hi Robin,
Am Montag, 19. Februar 2018, 12:43:11 CET schrieb Robin Murphy:
Quoted 7 lines
Hi Heiko,
Quoted 4 lines · Heiko Stuebner
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.
Quoted 5 lines
Quoted 2 lines
So adapt the register field to simply carry a negative value to signal that now output-switching is necessary.
Nit: s/now/no/ ? (Hooray for grammatically-correct typos which invert the entire meaning of the sentence!)
:-D
Quoted 4 lines
What are the necessary dependencies for these patches? I tried applying the series on 4.16-rc1 to test, but it failed at patch #6 with some missing context (I tried checking drm-next for where
rockchip_hdmi::hdmimight have come from, but didn't see anything obvious)
You'll need the most recent drm-misc changes [0], especially the dw-hdmi changes from Jernej Skrabec that touch similar areas and even included a similar patch to export some general phy functions, which I could drop from my series.
Heiko
PATCH v2 5/8 dt-bindings: allow optional phys in Rockchip dw_hdmi binding
In reply to a message not in the archiveSome 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
@@ -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
Re: [PATCH v2 5/8] dt-bindings: allow optional phys in Rockchip dw_hdmi binding
Quoted 8 lines · Heiko Stuebner
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.
Signed-off-by Heiko Stuebner <[email protected]>--- Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt | 2 ++ 1 file changed, 2 insertions(+)
PATCH v2 6/8 drm/rockchip: dw_hdmi: allow including external phys
In reply to a message not in the archiveSome 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
@@ -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>
@@ -49,6 +50,7 @@ struct rockchip_hdmi {struct clk *vpll_clk;struct clk *grf_clk;struct dw_hdmi *hdmi; +struct phy *phy; };#define to_rockchip_hdmi (x) container_of(x, struct rockchip_hdmi, x)
@@ -377,6 +379,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 · 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
PATCH v2 7/8 drm/rockchip: dw_hdmi: store rockchip_hdmi reference in phy_data object
In reply to a message not in the archiveWhen 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
@@ -343,7 +343,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;
@@ -358,9 +358,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
Re: [PATCH v2 7/8] drm/rockchip: dw_hdmi: store rockchip_hdmi reference in phy_data object
Quoted 3 lines · Heiko Stuebner
When using special phy handling operations we'll often need access to the
rockchip_hdmistruct. As the chip-data that occupies thephy_datapointer initially gets assigned to therockchip_hdmistruct we can not
s/not/now/ (or s/not//) ? Again, this seems to imply the opposite of what the patch actually does ;)
Robin.
Quoted 38 lines
re-use this
phy_datapointer to hold the reference to therockchip_hdmistruct, similar to how meson-hdmi does it for example.Signed-off-by Heiko Stuebner <[email protected]>--- 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@@ -343,7 +343,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;@@ -358,9 +358,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);
PATCH v2 8/8 drm/rockchip: dw_hdmi: add dw-hdmi support for the rk3328
In reply to a message not in the archiveThe 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
@@ -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
Rob Herring
maintainerRe: [PATCH v2 8/8] drm/rockchip: dw_hdmi: add dw-hdmi support for the rk3328
Quoted 15 lines · Heiko Stuebner
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.
Signed-off-by Heiko Stuebner <[email protected]>--- .../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 +0
-0
Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt Required properties: · line 16
Quoted 4 lines
Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt +1
-0@@ -13,6 +13,7 @@ Required properties: - compatible: should be one of the following: "rockchip,rk3288-dw-hdmi" + "rockchip,rk3328-dw-hdmi"
Is Designware (Synopsys) now Innosilicon?
Quoted 3 lines
Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt +0
-0"rockchip,rk3399-dw-hdmi" - reg: See dw_hdmi.txt. - reg-io-width: See dw_hdmi.txt. Shall be 4.
Heiko Stuebner
maintainerRe: [PATCH v2 8/8] drm/rockchip: dw_hdmi: add dw-hdmi support for the rk3328
Hi Rob,
Am Montag, 19. Februar 2018, 21:28:53 CET schrieb Rob Herring:
Quoted 17 lines · Heiko Stuebner
Quoted 16 lines
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.
Signed-off-by Heiko Stuebner <[email protected]>--- .../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 +0
-0@@ -13,6 +13,7 @@ Required properties:
Quoted 5 lines
Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt Required properties: · line 16
Quoted 3 lines
Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt +1
-0- compatible: should be one of the following: "rockchip,rk3288-dw-hdmi" + "rockchip,rk3328-dw-hdmi"Is Designware (Synopsys) now Innosilicon?
Nope :-) .
The rk3328 just combines the Designware dw-hdmi with an (external) hdmi-phy from Innosilicon, where the hdmi-phy otherwise was was integrated into the hdmi ip-block.
Rob Herring
maintainerRe: [PATCH v2 8/8] drm/rockchip: dw_hdmi: add dw-hdmi support for the rk3328
Quoted 26 lines · Heiko Stuebner
Hi Rob,
Am Montag, 19. Februar 2018, 21:28:53 CET schrieb Rob Herring:
Quoted 17 lines · Heiko Stuebner
Quoted 16 lines
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.
Signed-off-by Heiko Stuebner <[email protected]>--- .../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 +0
-0@@ -13,6 +13,7 @@ Required properties:Quoted 5 lines
Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt Required properties: · line 16
Quoted 3 lines
Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt +1
-0- compatible: should be one of the following: "rockchip,rk3288-dw-hdmi" + "rockchip,rk3328-dw-hdmi"Is Designware (Synopsys) now Innosilicon?
Quoted 5 lines
Nope :-) .
The rk3328 just combines the Designware dw-hdmi with an (external) hdmi-phy from Innosilicon, where the hdmi-phy otherwise was was integrated into the hdmi ip-block.
Okay, the commit msg is misleading because it talks about the phy and adding the "compatible for it".
Rob
Quoted 9 lines · Heiko Stuebner
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.
Quoted 7 lines
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.
So patches 1+2 are expected to go through the phy-tree and the rest should go through the drm tree.
For patches 2, 3, 4, 6, 7, 8,
Quoted 34 lines
changes in v2:
- phy: prevent overflow in tmdsclk calculation as reported by Martin Cerveny
- phy: use unsigned long for all tmdsclk rate uses
- phy: simplify tmds rate calculation- dropped patch exporting some dw-hdmi phy functions as a similar patch entered drm-misc already
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 Rockchipdw_hdmibinding drm/rockchip:dw_hdmi: allow including external phys drm/rockchip:dw_hdmi: storerockchip_hdmireference inphy_data
object
drm/rockchip:dw_hdmi: add dw-hdmi support for the rk3328Zheng 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 | 4 +- 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 | 1209 ++++++++++++++++++++ include/drm/bridge/dw_hdmi.h | 1 + 8 files changed, 1393 insertions(+), 4 deletions(-)create mode 100644
Documentation/devicetree/bindings/phy/phy-rockchip-inno-hdmi.txtcreate mode 100644drivers/phy/rockchip/phy-rockchip-inno-hdmi.c