video: dw_hdmi: Support Vendor PHY
Subsystems (8)
v2 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 v2:
- Use proper cfg function for meson
- Add VOP cleanup code.
- Add DCLK get rate
Linux VOP/HDMI out issues seems resolved with explicit VOP cleanup.
V1:
https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
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 | 48 +- drivers/video/meson/meson_dw_hdmi.c | 11 +- drivers/video/rockchip/Makefile | 2 + drivers/video/rockchip/rk3328_hdmi.c | 131 +++ drivers/video/rockchip/rk3328_vop.c | 83 ++ drivers/video/rockchip/rk3399_hdmi.c | 8 +- drivers/video/rockchip/rk_hdmi.c | 12 +- 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 | 19 +- include/configs/evb_rk3328.h | 5 + include/configs/rk3328_common.h | 1 + include/dw_hdmi.h | 17 +- 23 files changed, 1393 insertions(+), 39 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
PATCH v2 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 v2:
- none
drivers/video/rockchip/rk_hdmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/video/rockchip/rk_hdmi.c +3 -3
@@ -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
PATCH v2 2/17 video: dw_hdmi: Add Vendor PHY handling
In reply to Jagan TekiFrom: 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 v2:
- fix meson cfg
drivers/video/dw_hdmi.c | 29 +++++++++++++++++++++++++++- drivers/video/meson/meson_dw_hdmi.c | 11 ++++++++++- drivers/video/rockchip/rk3399_hdmi.c | 8 +++++++- drivers/video/rockchip/rk_hdmi.c | 2 +- drivers/video/sunxi/sunxi_dw_hdmi.c | 11 ++++++++++- include/dw_hdmi.h | 14 +++++++++++++- 6 files changed, 69 insertions(+), 6 deletions(-)
drivers/video/dw_hdmi.c +28 -1
@@ -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,37 @@ 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, +}; + +static void dw_hdmi_detect_phy (struct dw_hdmi *hdmi) +{ +if (!hdmi->data) +return ; + +/* hook Synopsys PHYs ops */ +if (!hdmi->data->phy_force_vendor) { + hdmi->ops = &dw_hdmi_synopsys_phy_ops; +return ; + } + +/* Vendor HDMI PHYs must assign phy_ops in plat_data */ +if (!hdmi->data->phy_ops) { +printf ("Unsupported Vendor HDMI phy_ops\n" ); +return ; + } + +/* hook Vendor HDMI PHYs ops */ + hdmi->ops = hdmi->data->phy_ops; +} +void dw_hdmi_init (struct dw_hdmi *hdmi) {uint ih_mute; +dw_hdmi_detect_phy (hdmi); +/* * boot up defaults are: * hdmi_ih_mute = 0x03 (disabled)
drivers/video/meson/meson_dw_hdmi.c +10 -1
@@ -375,6 +375,15 @@ 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 const struct dw_hdmi_plat_data dw_hdmi_meson_plat_data = { + .phy_force_vendor = true, + .phy_ops = &dw_hdmi_meson_phy_ops, +}; +static int meson_dw_hdmi_probe (struct udevice *dev) {struct meson_dw_hdmi *priv =dev_get_priv (dev);
@@ -397,7 +406,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.data = &dw_hdmi_meson_plat_data;if (meson_hdmi_is_compatible (priv,HDMI_COMPATIBLE_G12A )) priv->hdmi.reg_io_width =1 ;else {
drivers/video/rockchip/rk3399_hdmi.c +7 -1
@@ -64,8 +64,14 @@ static const struct dm_display_ops rk3399_hdmi_ops = { .enable = rk3399_hdmi_enable, }; +static const struct dw_hdmi_plat_data rk3399_hdmi_drv_data = { +}; +static const struct udevice_id rk3399_hdmi_ids[] = { - { .compatible ="rockchip,rk3399-dw-hdmi" }, + { + .compatible ="rockchip,rk3399-dw-hdmi" , + .data = (ulong)&rk3399_hdmi_drv_data + }, { } };
drivers/video/rockchip/rk_hdmi.c +1 -1
@@ -83,6 +83,7 @@ int rk_hdmi_of_to_plat(struct udevice *dev)struct rk_hdmi_priv *priv =dev_get_priv (dev);struct dw_hdmi *hdmi = &priv->hdmi; + hdmi->data = (const struct dw_hdmi_plat_data *)dev_get_driver_data (dev); hdmi->ioaddr = (ulong )dev_read_addr (dev); hdmi->mpll_cfg = rockchip_mpll_cfg; hdmi->phy_cfg = rockchip_phy_config;
@@ -90,7 +91,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 +10 -1
@@ -369,6 +369,15 @@ 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 const struct dw_hdmi_plat_data dw_hdmi_sunxi_plat_data = { + .phy_force_vendor = true, + .phy_ops = &dw_hdmi_sunxi_phy_ops, +}; +static int sunxi_dw_hdmi_of_to_plat (struct udevice *dev) {struct sunxi_dw_hdmi_priv *priv =dev_get_priv (dev);
@@ -379,7 +388,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->data = &dw_hdmi_sunxi_plat_data; ret =reset_get_bulk (dev, &priv->resets);if (ret)
include/dw_hdmi.h +13 -1
@@ -534,6 +534,17 @@ 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_plat_data { +bool phy_force_vendor; +const struct dw_hdmi_phy_ops *phy_ops; +}; +struct dw_hdmi {ulong ioaddr;const struct hdmi_mpll_config *mpll_cfg;
@@ -543,8 +554,9 @@ struct dw_hdmi {u8 reg_io_width;struct hdmi_data_info hdmi_data;struct udevice *ddc_bus; +const struct dw_hdmi_phy_ops *ops; +const struct dw_hdmi_plat_data *data; -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
Neil Armstrong
maintainerRe: [PATCH v2 02/17] video: dw_hdmi: Add Vendor PHY handling
Quoted 49 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.
Signed-off-by Jagan Teki <[email protected]>---
Changes for v2:
- fix meson cfgdrivers/video/dw_hdmi.c | 29 +++++++++++++++++++++++++++- drivers/video/meson/meson_dw_hdmi.c | 11 ++++++++++- drivers/video/rockchip/rk3399_hdmi.c | 8 +++++++- drivers/video/rockchip/rk_hdmi.c | 2 +- drivers/video/sunxi/sunxi_dw_hdmi.c | 11 ++++++++++- include/dw_hdmi.h | 14 +++++++++++++- 6 files changed, 69 insertions(+), 6 deletions(-)drivers/video/dw_hdmi.c +14
-1@@ -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,37 @@ 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, +}; + +static void dw_hdmi_detect_phy (struct dw_hdmi *hdmi) +{ +if (!hdmi->data) +return ; + +/* hook Synopsys PHYs ops */ +if (!hdmi->data->phy_force_vendor) { + hdmi->ops = &dw_hdmi_synopsys_phy_ops; +return ;
drivers/video/dw_hdmi.c int dw_hdmi_enable(struct dw_hdmi *hdmi, const struct display_timing *edid) · line 1034
Quoted 10 lines
drivers/video/dw_hdmi.c +10
-0+ } + +/* Vendor HDMI PHYs must assign phy_ops in plat_data */ +if (!hdmi->data->phy_ops) { +printf ("Unsupported Vendor HDMI phy_ops\n" ); +return ; + } + +/* hook Vendor HDMI PHYs ops */ + hdmi->ops = hdmi->data->phy_ops;
Sorry but I still don't understand why you need phy_force_vendor & phy_ops, this code clearly fails if you have phy_force_vendor=true && phy_ops=NULL, so drop phy_force_vendor and simply use phy_ops if != NULL, and since it's the only element of dw_hdmi_plat_data, drop dw_hdmi_plat_data and pass dw_hdmi_phy_ops directly in the dw_hdmi struct.
So in dw_hdmi_detect_phy(), if hdmi->ops is NULL, set it to dw_hdmi_synopsys_phy_ops.
Neil
Quoted 142 lines
drivers/video/dw_hdmi.c +4
-0+} +void dw_hdmi_init (struct dw_hdmi *hdmi) {uint ih_mute; +dw_hdmi_detect_phy (hdmi); +/* * boot up defaults are: * hdmi_ih_mute = 0x03 (disabled) drivers/video/meson/meson_dw_hdmi.c +10
-1@@ -375,6 +375,15 @@ 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 const struct dw_hdmi_plat_data dw_hdmi_meson_plat_data = { + .phy_force_vendor = true, + .phy_ops = &dw_hdmi_meson_phy_ops, +}; +static int meson_dw_hdmi_probe (struct udevice *dev) {struct meson_dw_hdmi *priv =dev_get_priv (dev);@@ -397,7 +406,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.data = &dw_hdmi_meson_plat_data;if (meson_hdmi_is_compatible (priv,HDMI_COMPATIBLE_G12A )) priv->hdmi.reg_io_width =1 ;else {drivers/video/rockchip/rk3399_hdmi.c +7
-1@@ -64,8 +64,14 @@ static const struct dm_display_ops rk3399_hdmi_ops = { .enable = rk3399_hdmi_enable, }; +static const struct dw_hdmi_plat_data rk3399_hdmi_drv_data = { +}; +static const struct udevice_id rk3399_hdmi_ids[] = { - { .compatible ="rockchip,rk3399-dw-hdmi" }, + { + .compatible ="rockchip,rk3399-dw-hdmi" , + .data = (ulong)&rk3399_hdmi_drv_data + }, { } };drivers/video/rockchip/rk_hdmi.c +1
-1@@ -83,6 +83,7 @@ int rk_hdmi_of_to_plat(struct udevice *dev)struct rk_hdmi_priv *priv =dev_get_priv (dev);struct dw_hdmi *hdmi = &priv->hdmi; + hdmi->data = (const struct dw_hdmi_plat_data *)dev_get_driver_data (dev); hdmi->ioaddr = (ulong )dev_read_addr (dev); hdmi->mpll_cfg = rockchip_mpll_cfg; hdmi->phy_cfg = rockchip_phy_config;@@ -90,7 +91,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 +10
-1@@ -369,6 +369,15 @@ 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 const struct dw_hdmi_plat_data dw_hdmi_sunxi_plat_data = { + .phy_force_vendor = true, + .phy_ops = &dw_hdmi_sunxi_phy_ops, +}; +static int sunxi_dw_hdmi_of_to_plat (struct udevice *dev) {struct sunxi_dw_hdmi_priv *priv =dev_get_priv (dev);@@ -379,7 +388,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->data = &dw_hdmi_sunxi_plat_data; ret =reset_get_bulk (dev, &priv->resets);if (ret)include/dw_hdmi.h +13
-1@@ -534,6 +534,17 @@ 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_plat_data { +bool phy_force_vendor; +const struct dw_hdmi_phy_ops *phy_ops; +}; +struct dw_hdmi {ulong ioaddr;const struct hdmi_mpll_config *mpll_cfg;@@ -543,8 +554,9 @@ struct dw_hdmi {u8 reg_io_width;struct hdmi_data_info hdmi_data;struct udevice *ddc_bus; +const struct dw_hdmi_phy_ops *ops; +const struct dw_hdmi_plat_data *data; -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); };
Re: [PATCH v2 02/17] video: dw_hdmi: Add Vendor PHY handling
Quoted 68 lines · Neil Armstrong
Quoted 49 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.
Signed-off-by Jagan Teki <[email protected]>---
Changes for v2:
- fix meson cfgdrivers/video/dw_hdmi.c | 29 +++++++++++++++++++++++++++- drivers/video/meson/meson_dw_hdmi.c | 11 ++++++++++- drivers/video/rockchip/rk3399_hdmi.c | 8 +++++++- drivers/video/rockchip/rk_hdmi.c | 2 +- drivers/video/sunxi/sunxi_dw_hdmi.c | 11 ++++++++++- include/dw_hdmi.h | 14 +++++++++++++- 6 files changed, 69 insertions(+), 6 deletions(-)drivers/video/dw_hdmi.c +14
-1@@ -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,37 @@ 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, +}; + +static void dw_hdmi_detect_phy (struct dw_hdmi *hdmi) +{ +if (!hdmi->data) +return ; + +/* hook Synopsys PHYs ops */ +if (!hdmi->data->phy_force_vendor) { + hdmi->ops = &dw_hdmi_synopsys_phy_ops; +return ;drivers/video/dw_hdmi.c int dw_hdmi_enable(struct dw_hdmi *hdmi, const struct display_timing *edid) · line 1034
Quoted 10 lines
drivers/video/dw_hdmi.c +10
-0+ } + +/* Vendor HDMI PHYs must assign phy_ops in plat_data */ +if (!hdmi->data->phy_ops) { +printf ("Unsupported Vendor HDMI phy_ops\n" ); +return ; + } + +/* hook Vendor HDMI PHYs ops */ + hdmi->ops = hdmi->data->phy_ops;Sorry but I still don't understand why you need
phy_force_vendor&phy_ops, this code clearly fails if you have phy_force_vendor=true && phy_ops=NULL, so dropphy_force_vendorand simply usephy_opsif != NULL, and since it's the only element ofdw_hdmi_plat_data, dropdw_hdmi_plat_dataand passdw_hdmi_phy_opsdirectly in thedw_hdmistruct.
Quoted 1 line
So in
dw_hdmi_detect_phy(), ifhdmi->opsis NULL, set it todw_hdmi_synopsys_phy_ops.
Let me elaborate more.
DW HDMI IP must have phy ops. It never be NULL. Either it uses
1. Internal PHY via DW called them Synopsys PHYs ops - for example, rk3399
2. Vendor PHY via vendor phy meson, sunxi, rk3328
For case 1) phy_force_vendor is false so it uses dw_hdmi_synopsys_phy_ops For case 2) phy_force_vendor is true so it uses dw_hdmi_plat_data phy ops
dw_hdmi_detect_phy assigns internal phy ops first and then vendor phy ops based on phy_force_vendor flag.
If we remove dw_hdmi_plat_data how can we assign or differentiate two types of phy ops hooks? can you explain?
Thanks,
Jagan.
Re: [PATCH v2 02/17] video: dw_hdmi: Add Vendor PHY handling
Hi Neil,
Quoted 79 lines · Jagan Teki
Quoted 68 lines · Neil Armstrong
Quoted 49 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.
Signed-off-by Jagan Teki <[email protected]>---
Changes for v2:
- fix meson cfgdrivers/video/dw_hdmi.c | 29 +++++++++++++++++++++++++++- drivers/video/meson/meson_dw_hdmi.c | 11 ++++++++++- drivers/video/rockchip/rk3399_hdmi.c | 8 +++++++- drivers/video/rockchip/rk_hdmi.c | 2 +- drivers/video/sunxi/sunxi_dw_hdmi.c | 11 ++++++++++- include/dw_hdmi.h | 14 +++++++++++++- 6 files changed, 69 insertions(+), 6 deletions(-)drivers/video/dw_hdmi.c +14
-1@@ -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,37 @@ 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, +}; + +static void dw_hdmi_detect_phy (struct dw_hdmi *hdmi) +{ +if (!hdmi->data) +return ; + +/* hook Synopsys PHYs ops */ +if (!hdmi->data->phy_force_vendor) { + hdmi->ops = &dw_hdmi_synopsys_phy_ops; +return ;drivers/video/dw_hdmi.c int dw_hdmi_enable(struct dw_hdmi *hdmi, const struct display_timing *edid) · line 1034
Quoted 10 lines
drivers/video/dw_hdmi.c +10
-0+ } + +/* Vendor HDMI PHYs must assign phy_ops in plat_data */ +if (!hdmi->data->phy_ops) { +printf ("Unsupported Vendor HDMI phy_ops\n" ); +return ; + } + +/* hook Vendor HDMI PHYs ops */ + hdmi->ops = hdmi->data->phy_ops;Sorry but I still don't understand why you need
phy_force_vendor&phy_ops, this code clearly fails if you have phy_force_vendor=true && phy_ops=NULL, so dropphy_force_vendorand simply usephy_opsif != NULL, and since it's the only element ofdw_hdmi_plat_data, dropdw_hdmi_plat_dataand passdw_hdmi_phy_opsdirectly in thedw_hdmistruct.Quoted 1 line
So in
dw_hdmi_detect_phy(), ifhdmi->opsis NULL, set it todw_hdmi_synopsys_phy_ops.Let me elaborate more.
DW HDMI IP must have phy ops. It never be NULL. Either it uses
1. Internal PHY via DW called them Synopsys PHYs ops - for example, rk3399
2. Vendor PHY via vendor phy meson, sunxi, rk3328
Quoted 8 lines
For case 1)
phy_force_vendoris false so it usesdw_hdmi_synopsys_phy_opsFor case 2)phy_force_vendoris true so it usesdw_hdmi_plat_dataphy ops
dw_hdmi_detect_phyassigns internal phy ops first and then vendor phy ops based onphy_force_vendorflag.If we remove
dw_hdmi_plat_datahow can we assign or differentiate two types of phy ops hooks? can you explain?
Let me know if you have any comments on this. I'm sending V3 would probably hit in MW.
Thanks,
Jagan.
[email protected]
maintainerRe: [PATCH v2 02/17] video: dw_hdmi: Add Vendor PHY handling
Quoted 85 lines · Jagan Teki
Hi Neil,
Quoted 82 lines · Jagan Teki
Quoted 68 lines · Neil Armstrong
Quoted 49 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.
Signed-off-by Jagan Teki <[email protected]>---
Changes for v2:
- fix meson cfgdrivers/video/dw_hdmi.c | 29 +++++++++++++++++++++++++++- drivers/video/meson/meson_dw_hdmi.c | 11 ++++++++++- drivers/video/rockchip/rk3399_hdmi.c | 8 +++++++- drivers/video/rockchip/rk_hdmi.c | 2 +- drivers/video/sunxi/sunxi_dw_hdmi.c | 11 ++++++++++- include/dw_hdmi.h | 14 +++++++++++++- 6 files changed, 69 insertions(+), 6 deletions(-)drivers/video/dw_hdmi.c +14
-1@@ -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,37 @@ 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, +}; + +static void dw_hdmi_detect_phy (struct dw_hdmi *hdmi) +{ +if (!hdmi->data) +return ; + +/* hook Synopsys PHYs ops */ +if (!hdmi->data->phy_force_vendor) { + hdmi->ops = &dw_hdmi_synopsys_phy_ops; +return ;drivers/video/dw_hdmi.c int dw_hdmi_enable(struct dw_hdmi *hdmi, const struct display_timing *edid) · line 1034
Quoted 10 lines
drivers/video/dw_hdmi.c +10
-0+ } + +/* Vendor HDMI PHYs must assign phy_ops in plat_data */ +if (!hdmi->data->phy_ops) { +printf ("Unsupported Vendor HDMI phy_ops\n" ); +return ; + } + +/* hook Vendor HDMI PHYs ops */ + hdmi->ops = hdmi->data->phy_ops;Sorry but I still don't understand why you need
phy_force_vendor&phy_ops, this code clearly fails if you have phy_force_vendor=true && phy_ops=NULL, so dropphy_force_vendorand simply usephy_opsif != NULL, and since it's the only element ofdw_hdmi_plat_data, dropdw_hdmi_plat_dataand passdw_hdmi_phy_opsdirectly in thedw_hdmistruct.Quoted 1 line
So in
dw_hdmi_detect_phy(), ifhdmi->opsis NULL, set it todw_hdmi_synopsys_phy_ops.Let me elaborate more.
DW HDMI IP must have phy ops. It never be NULL. Either it uses
1. Internal PHY via DW called them Synopsys PHYs ops - for example, rk3399
2. Vendor PHY via vendor phy meson, sunxi, rk3328For case 1)
phy_force_vendoris false so it usesdw_hdmi_synopsys_phy_opsFor case 2)phy_force_vendoris true so it usesdw_hdmi_plat_dataphy ops
Quoted 8 lines
Quoted 5 lines
dw_hdmi_detect_phyassigns internal phy ops first and then vendor phy ops based onphy_force_vendorflag.If we remove
dw_hdmi_plat_datahow can we assign or differentiate two types of phy ops hooks? can you explain?Let me know if you have any comments on this. I'm sending V3 would probably hit in MW.
Sure, I understand your point, but there's a limited number of users and it can be greatly simplified, no need to keep the current structure, there's no external users of the driver.
Just set hdmi->ops with the vendor phy ops from the glue driver if needed, or let it to NULL if the platform uses the synopsys PHY, it's as simple as that. If hdmi->ops is NULL it would be replaced with dw_hdmi_synopsys_phy_ops in the dw_hdmi_detect_phy() function.
Neil
Quoted 3 lines
Thanks,
Jagan.
PATCH v2 3/17 video: dw_hdmi: Extend the HPD detection
In reply to Jagan TekiFrom: 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 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
@@ -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
@@ -115,11 +115,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
@@ -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
@@ -568,5 +568,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
PATCH v2 4/17 video: dw_hdmi: Add read_hpd hook
In reply to Jagan TekiFrom: Jagan Teki <[email protected]>
Add support for DW HDMI Read HPD status.
---
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
@@ -946,6 +946,9 @@ int dw_hdmi_detect_hpd(struct dw_hdmi *hdmi)return -ENODEV ; } +if (hdmi->ops->read_hpd) + hdmi->ops->read_hpd (hdmi, true); +return 0 ; }
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_plat_data {
Signature · 1 line
2.25.1
PATCH v2 5/17 video: dw_hdmi: Add setup_hpd hook
In reply to Jagan TekiFrom: Jagan Teki <[email protected]>
Add support for DW HDMI Setup HPD status.
---
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
@@ -1080,4 +1080,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->setup_hpd) + hdmi->ops->setup_hpd (hdmi); }
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_plat_data {
Signature · 1 line
2.25.1
PATCH v2 6/17 video: rockchip: vop: Simplify rkvop_enable
In reply to Jagan TekiFrom: 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 v2:
- none
drivers/video/rockchip/rk_vop.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/video/rockchip/rk_vop.c +4 -4
@@ -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
PATCH v2 7/17 video: rockchip: vop: Add win offset support
In reply to Jagan TekiFrom: 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 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
@@ -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 ), - ®s->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), - ®s->win0_dsp_st); + &win_regs->win0_dsp_st);writel (V_DSP_WIDTH (hactive -1 ) |V_DSP_HEIGHT (vactive -1 ), - ®s->win0_dsp_info); + &win_regs->win0_dsp_info); -clrsetbits_le32 (®s->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), ®s->win0_vir); +writel (V_RGB565_VIRWIDTH (hactive), &win_regs->win0_vir);break ;case 24 : rgb_mode =RGB888 ; -writel (V_RGB888_VIRWIDTH (hactive), ®s->win0_vir); +writel (V_RGB888_VIRWIDTH (hactive), &win_regs->win0_vir);break ;case 32 :default : rgb_mode =ARGB8888 ; -writel (V_ARGB888_VIRWIDTH (hactive), ®s->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 (®s->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, ®s->win0_yrgb_mst); +writel (fbbase, &win_regs->win0_yrgb_mst);writel (0x01 , ®s->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
@@ -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
PATCH v2 8/17 video: rockchip: vop: Add dsp offset support
In reply to Jagan TekiFrom: 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 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
@@ -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), - ®s->dsp_htotal_hs_end); + &dsp_regs->dsp_htotal_hs_end);writel (V_HEAP (hsync_len + hback_porch + hactive) |V_HASP (hsync_len + hback_porch), - ®s->dsp_hact_st_end); + &dsp_regs->dsp_hact_st_end);writel (V_VSYNC (vsync_len) |V_VERPRD (vsync_len + vback_porch + vactive + vfront_porch), - ®s->dsp_vtotal_vs_end); + &dsp_regs->dsp_vtotal_vs_end);writel (V_VAEP (vsync_len + vback_porch + vactive)|V_VASP (vsync_len + vback_porch), - ®s->dsp_vact_st_end); + &dsp_regs->dsp_vact_st_end);writel (V_HEAP (hsync_len + hback_porch + hactive) |V_HASP (hsync_len + hback_porch), - ®s->post_dsp_hact_info); + &dsp_regs->post_dsp_hact_info);writel (V_VAEP (vsync_len + vback_porch + vactive)|V_VASP (vsync_len + vback_porch), - ®s->post_dsp_vact_info); + &dsp_regs->post_dsp_vact_info);writel (0x01 , ®s->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
@@ -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
PATCH v2 9/17 clk: rockchip: rk3328: Add VOP clk support
In reply to Jagan TekiFrom: Jagan Teki <[email protected]>
VOP get and set clock would needed for VOP drivers.
Add support for it.
---
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
@@ -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
PATCH v2 10/17 clk: rk3328: Add get hdmiphy clock
In reply to Jagan TekiFrom: Jagan Teki <[email protected]>
Add support to get the hdmiphy clock for RK3328 PCLK_HDMIPHY.
---
Changes for v2:
- none
drivers/clk/rockchip/clk_rk3328.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/clk/rockchip/clk_rk3328.c +17 -0
@@ -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
PATCH v2 11/17 phy: rockchip: Add Rockchip INNO HDMI PHY driver
In reply to Jagan TekiFrom: Jagan Teki <[email protected]>
Add Rockchip INNO HDMI PHY driver for RK3328.
Reference from linux-next phy-rockchip-inno-hdmi driver.
---
Changes for 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
@@ -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
@@ -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
PATCH v2 12/17 video: rockchip: Add rk3328 hdmi support
In reply to Jagan TekiFrom: Jagan Teki <[email protected]>
Add Rockchip RK3328 HDMI Out driver.
---
Changes for v2:
- none
drivers/video/rockchip/Makefile | 1 + drivers/video/rockchip/rk3328_hdmi.c | 131 +++++++++++++++++++++++++++ drivers/video/rockchip/rk_hdmi.h | 3 + 3 files changed, 135 insertions(+) create mode 100644 drivers/video/rockchip/rk3328_hdmi.c
drivers/video/rockchip/Makefile +1 -0
@@ -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 +131 -0
131 lines not on this page · raw message
drivers/video/rockchip/rk_hdmi.h +3 -0
@@ -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
PATCH v2 13/17 video: rockchip: Add rk3328 vop support
In reply to Jagan TekiFrom: 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 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
@@ -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
Re:[PATCH v2 13/17] video: rockchip: Add rk3328 vop support
Hi Jaqan:
Quoted 91 lines · 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 0Signed-off-by Jagan Teki <[email protected]>---
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.cdrivers/video/rockchip/Makefile +0
-0@@ -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.odrivers/video/rockchip/rk3328_vop.c new file +43
-0@@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (c) 2023 Edgeble AI Technologies Pvt. Ltd. +*/ + +#include <dm.h> +#include <video.h> +#include <asm/io.h> +#include "rk_vop.h" + +DECLARE_GLOBAL_DATA_PTR ; + +static void rk3328_set_pin_polarity (struct udevice *dev, +enum vop_modes mode,u32 polarity) +{ +struct rk_vop_priv *priv =dev_get_priv (dev); +struct rk3288_vop *regs = priv->regs; + +switch (mode) { +case VOP_MODE_HDMI : +clrsetbits_le32 (®s->dsp_ctrl1, +M_RK3399_DSP_HDMI_POL , +V_RK3399_DSP_HDMI_POL (polarity)); +break ; +default : +debug ("%s: unsupported output mode %x\n" , __func__, mode); + } +} + +static int rk3328_vop_probe (struct udevice *dev) +{ +/* Before relocation we don't need to do anything */ +if (!(gd->flags &GD_FLG_RELOC )) +return 0 ; + +return rk_vop_probe (dev); +} + +static int rk3328_vop_remove (struct udevice *dev) +{ +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;
drivers/video/rockchip/rk3328_vop.c line 53
Quoted 10 lines
drivers/video/rockchip/rk3328_vop.c new file +10
-0+ +/* write reset values */ +writel (0xef013f , &win_regs->win0_act_info); +writel (0xef013f , &win_regs->win0_dsp_info); +writel (0xa000a , &win_regs->win0_dsp_st); +writel (0x0 , &win_regs->win0_yrgb_mst); +writel (0x01 , ®s->reg_cfg_done); + +return 0 ; +}
I think this just workaround Linux iommu page fault by luck。
The reset value(what you called it is)your write just let win0 read a 320x240 rectangular from address 0 and display it at next frame(maybe 16ms later if your current display is run at 60HZ)。
1. we don't know what content is at address 0, so you will see something strange on your monitor.
2. there is no guarantee that address 0 is really readable(maybe a security memory space, or maybe it is not a valid address), this may cause another issue that not easy to detect。
Quoted 32 lines
drivers/video/rockchip/rk3328_vop.c new file +30
-0+ +struct rkvop_driverdata rk3328_driverdata = { + .dsp_offset =0x490 , + .win_offset =0xd0 , + .features =VOP_FEATURE_OUTPUT_10BIT , + .set_pin_polarity = rk3328_set_pin_polarity, +}; + +static const struct udevice_id rk3328_vop_ids[] = { + { + .compatible ="rockchip,rk3328-vop" , + .data = (ulong)&rk3328_driverdata + }, + {/* sentile */ } +}; + +static const struct video_ops rk3328_vop_ops = { +}; + +U_BOOT_DRIVER (rk3328_vop) = { + .name ="rk3328_vop" , + .id =UCLASS_VIDEO , + .of_match = rk3328_vop_ids, + .ops = &rk3328_vop_ops, + .bind = rk_vop_bind, + .probe = rk3328_vop_probe, + .remove = rk3328_vop_remove, + .priv_auto =sizeof (struct rk_vop_priv ), + .flags =DM_FLAG_PRE_RELOC |DM_FLAG_OS_PREPARE , +};Signature · 1 line
2.25.1
Re: [PATCH v2 13/17] video: rockchip: Add rk3328 vop support
Hi Andy,
Quoted 112 lines · Andy Yan
Hi Jaqan:
Quoted 91 lines · 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 0Signed-off-by Jagan Teki <[email protected]>---
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.cdrivers/video/rockchip/Makefile +0
-0@@ -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.odrivers/video/rockchip/rk3328_vop.c new file +43
-0@@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (c) 2023 Edgeble AI Technologies Pvt. Ltd. +*/ + +#include <dm.h> +#include <video.h> +#include <asm/io.h> +#include "rk_vop.h" + +DECLARE_GLOBAL_DATA_PTR ; + +static void rk3328_set_pin_polarity (struct udevice *dev, +enum vop_modes mode,u32 polarity) +{ +struct rk_vop_priv *priv =dev_get_priv (dev); +struct rk3288_vop *regs = priv->regs; + +switch (mode) { +case VOP_MODE_HDMI : +clrsetbits_le32 (®s->dsp_ctrl1, +M_RK3399_DSP_HDMI_POL , +V_RK3399_DSP_HDMI_POL (polarity)); +break ; +default : +debug ("%s: unsupported output mode %x\n" , __func__, mode); + } +} + +static int rk3328_vop_probe (struct udevice *dev) +{ +/* Before relocation we don't need to do anything */ +if (!(gd->flags &GD_FLG_RELOC )) +return 0 ; + +return rk_vop_probe (dev); +} + +static int rk3328_vop_remove (struct udevice *dev) +{ +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;drivers/video/rockchip/rk3328_vop.c line 53
Quoted 10 lines
drivers/video/rockchip/rk3328_vop.c new file +10
-0+ +/* write reset values */ +writel (0xef013f , &win_regs->win0_act_info); +writel (0xef013f , &win_regs->win0_dsp_info); +writel (0xa000a , &win_regs->win0_dsp_st); +writel (0x0 , &win_regs->win0_yrgb_mst); +writel (0x01 , ®s->reg_cfg_done); + +return 0 ; +}I think this just workaround Linux iommu page fault by luck。
The reset value(what you called it is)your write just let win0 read a 320x240 rectangular from address 0 and display it at next frame(maybe 16ms later if your current display is run at 60HZ)。
Quoted 3 lines
1. we don't know what content is at address 0, so you will see something strange on your monitor.
2. there is no guarantee that address 0 is really readable(maybe a security memory space, or maybe it is not a valid address), this may cause another issue that not easy to detect。
Okay. Can you suggest any proper way to clean up VOP? All these reset values are referred to as per the TRM and read before enabling the video.
Thanks,
Jagan.
Re:Re: [PATCH v2 13/17] video: rockchip: Add rk3328 vop support
Hi Jaqan,
Quoted 115 lines · 在 2023-12-19 15:42:26,"Jagan Teki" <[email protected]> 写道:
Hi Andy,
Quoted 112 lines · Andy Yan
Hi Jaqan:
Quoted 91 lines · 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 0Signed-off-by Jagan Teki <[email protected]>---
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.cdrivers/video/rockchip/Makefile +0
-0@@ -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.odrivers/video/rockchip/rk3328_vop.c new file +43
-0@@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (c) 2023 Edgeble AI Technologies Pvt. Ltd. +*/ + +#include <dm.h> +#include <video.h> +#include <asm/io.h> +#include "rk_vop.h" + +DECLARE_GLOBAL_DATA_PTR ; + +static void rk3328_set_pin_polarity (struct udevice *dev, +enum vop_modes mode,u32 polarity) +{ +struct rk_vop_priv *priv =dev_get_priv (dev); +struct rk3288_vop *regs = priv->regs; + +switch (mode) { +case VOP_MODE_HDMI : +clrsetbits_le32 (®s->dsp_ctrl1, +M_RK3399_DSP_HDMI_POL , +V_RK3399_DSP_HDMI_POL (polarity)); +break ; +default : +debug ("%s: unsupported output mode %x\n" , __func__, mode); + } +} + +static int rk3328_vop_probe (struct udevice *dev) +{ +/* Before relocation we don't need to do anything */ +if (!(gd->flags &GD_FLG_RELOC )) +return 0 ; + +return rk_vop_probe (dev); +} + +static int rk3328_vop_remove (struct udevice *dev) +{ +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;drivers/video/rockchip/rk3328_vop.c line 53
Quoted 10 lines
drivers/video/rockchip/rk3328_vop.c new file +10
-0+ +/* write reset values */ +writel (0xef013f , &win_regs->win0_act_info); +writel (0xef013f , &win_regs->win0_dsp_info); +writel (0xa000a , &win_regs->win0_dsp_st); +writel (0x0 , &win_regs->win0_yrgb_mst); +writel (0x01 , ®s->reg_cfg_done); + +return 0 ; +}I think this just workaround Linux iommu page fault by luck。
The reset value(what you called it is)your write just let win0 read a 320x240 rectangular from address 0 and display it at next frame(maybe 16ms later if your current display is run at 60HZ)。
Quoted 8 lines
Quoted 3 lines
1. we don't know what content is at address 0, so you will see something strange on your monitor.
2. there is no guarantee that address 0 is really readable(maybe a security memory space, or maybe it is not a valid address), this may cause another issue that not easy to detect。Okay. Can you suggest any proper way to clean up VOP? All these reset values are referred to as per the TRM and read before enabling the
video.
Maybe write 0 to the windows enable bit, disable this window。 But this is a little rude,I wonder if the mainline has a way to handleoff bootloader framebuffer to linux kernel drm system seamless。
[0] is also what Robin mention is V1, maybe a better direction.
[0]https://lore.kernel.org/all/[email protected]/
Quoted 3 lines
Thanks,
Jagan.
Re: Re: [PATCH v2 13/17] video: rockchip: Add rk3328 vop support
Hi Andy,
Quoted 127 lines · Andy Yan
Hi Jaqan,
Quoted 121 lines · 在 2023-12-19 15:42:26,"Jagan Teki" <[email protected]> 写道:
Hi Andy,
Quoted 112 lines · Andy Yan
Hi Jaqan:
Quoted 91 lines · 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 0Signed-off-by Jagan Teki <[email protected]>---
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.cdrivers/video/rockchip/Makefile +0
-0@@ -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.odrivers/video/rockchip/rk3328_vop.c new file +43
-0@@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (c) 2023 Edgeble AI Technologies Pvt. Ltd. +*/ + +#include <dm.h> +#include <video.h> +#include <asm/io.h> +#include "rk_vop.h" + +DECLARE_GLOBAL_DATA_PTR ; + +static void rk3328_set_pin_polarity (struct udevice *dev, +enum vop_modes mode,u32 polarity) +{ +struct rk_vop_priv *priv =dev_get_priv (dev); +struct rk3288_vop *regs = priv->regs; + +switch (mode) { +case VOP_MODE_HDMI : +clrsetbits_le32 (®s->dsp_ctrl1, +M_RK3399_DSP_HDMI_POL , +V_RK3399_DSP_HDMI_POL (polarity)); +break ; +default : +debug ("%s: unsupported output mode %x\n" , __func__, mode); + } +} + +static int rk3328_vop_probe (struct udevice *dev) +{ +/* Before relocation we don't need to do anything */ +if (!(gd->flags &GD_FLG_RELOC )) +return 0 ; + +return rk_vop_probe (dev); +} + +static int rk3328_vop_remove (struct udevice *dev) +{ +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;drivers/video/rockchip/rk3328_vop.c line 53
Quoted 10 lines
drivers/video/rockchip/rk3328_vop.c new file +10
-0+ +/* write reset values */ +writel (0xef013f , &win_regs->win0_act_info); +writel (0xef013f , &win_regs->win0_dsp_info); +writel (0xa000a , &win_regs->win0_dsp_st); +writel (0x0 , &win_regs->win0_yrgb_mst); +writel (0x01 , ®s->reg_cfg_done); + +return 0 ; +}I think this just workaround Linux iommu page fault by luck。
The reset value(what you called it is)your write just let win0 read a 320x240 rectangular from address 0 and display it at next frame(maybe 16ms later if your current display is run at 60HZ)。Quoted 3 lines
1. we don't know what content is at address 0, so you will see something strange on your monitor.
2. there is no guarantee that address 0 is really readable(maybe a security memory space, or maybe it is not a valid address), this may cause another issue that not easy to detect。Okay. Can you suggest any proper way to clean up VOP? All these reset values are referred to as per the TRM and read before enabling the
Quoted 6 lines
Quoted 1 line
video.
Maybe write 0 to the windows enable bit, disable this window。 But this is a little rude,I wonder if the mainline has a way to handleoff bootloader framebuffer to linux kernel drm system seamless。
I don't think any sort of handoff procedure in U-Boot - Anatolij any comments on this?
I did see some nxp platform drivers turn off the DE during handoff. So disabling WIN0 is the only option that I'm thinking of as of now.
Quoted 5 lines
[0] is also what Robin mention is V1, maybe a better direction.
Yes, it looks like a proper solution to check but it requires some iommu re-work to handle iommu-address.
Jagan.
PATCH v2 14/17 ARM: dts: rk3328: Enable VOP for bootph-all
In reply to Jagan TekiModel: 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 v2:
- none
arch/arm/dts/rk3328-u-boot.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/dts/rk3328-u-boot.dtsi +4 -0
@@ -68,3 +68,7 @@ &spi0 { bootph-all; }; + +&vop { + bootph-all; +};
Signature · 1 line
2.25.1
PATCH v2 15/17 rockchip: Enable preconsole for rk3328
In reply to Jagan TekiEnable and set the start address of pre-console buffer for RK3328.
---
Changes for 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
@@ -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
@@ -208,7 +208,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
PATCH v2 16/17 configs: evb-rk3328: Enable vidconsole for rk3328
In reply to Jagan TekiEnable video console for Rockchip RK3328.
---
Changes for 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
@@ -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
@@ -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
PATCH v2 17/17 configs: Enable HDMI Out for ROC-RK3328-CC
In reply to Jagan TekiU-Boot 2024.01-rc4-00053-gb9f7cafdd9-dirty (Dec 11 2023 - 13:18:15 +0530)
Model: Firefly roc-rk3328-cc DRAM: 1 GiB (effective 1022 MiB) 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
tmdsclock = 148500000; chipversion = 1
In: serial Out: vidconsole Err: 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 v2:
- none
configs/roc-cc-rk3328_defconfig | 5 +++++ 1 file changed, 5 insertions(+)
configs/roc-cc-rk3328_defconfig +5 -0
@@ -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