From: Dang Huynh <danct12@riseup.net>
To: Anatolij Gustschin <agust@denx.de>,
Simon Glass <sjg@chromium.org>,
Philipp Tomsich <philipp.tomsich@vrull.eu>,
Kever Yang <kever.yang@rock-chips.com>,
Tom Rini <trini@konsulko.com>,
Nicolas Frattaroli <frattaroli.nicolas@gmail.com>,
Jonas Karlman <jonas@kwiboo.se>, Ondrej Jirman <megi@xff.cz>,
Dragan Simic <dsimic@manjaro.org>,
Svyatoslav Ryhel <clamor95@gmail.com>,
Lukasz Majewski <lukma@denx.de>,
Sean Anderson <seanga2@gmail.com>
Cc: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>,
u-boot@lists.denx.de, Piotr Zalewski <pZ010001011111@proton.me>,
Dang Huynh <danct12@riseup.net>
Subject: [PATCH v3 07/12] video: rockchip: vop2: Add video bridge support
Date: Sat, 12 Apr 2025 21:27:09 +0700 [thread overview]
Message-ID: <20250412-vop2-pt2-v3-7-7c796db335e9@riseup.net> (raw)
In-Reply-To: <20250412-vop2-pt2-v3-0-7c796db335e9@riseup.net>
Add support for video bridge to VOP2 so we can use the MIPI DSI
bridge driver that we have.
Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Dang Huynh <danct12@riseup.net>
---
drivers/video/rockchip/rk_vop2.c | 81 +++++++++++++++++++++++++++++-----------
1 file changed, 59 insertions(+), 22 deletions(-)
diff --git a/drivers/video/rockchip/rk_vop2.c b/drivers/video/rockchip/rk_vop2.c
index 3d64c0a32f8e9a6e479b9bc53afa0736118f08e6..01a2ad883923cc9865c85699d2ba2b196e9795f2 100644
--- a/drivers/video/rockchip/rk_vop2.c
+++ b/drivers/video/rockchip/rk_vop2.c
@@ -13,10 +13,12 @@
#include <dm/device_compat.h>
#include <edid.h>
#include <log.h>
+#include <panel.h>
#include <regmap.h>
#include <reset.h>
#include <syscon.h>
#include <video.h>
+#include <video_bridge.h>
#include <asm/global_data.h>
#include <asm/gpio.h>
#include <asm/io.h>
@@ -288,6 +290,7 @@ static int rk_display_init(struct udevice *dev, ulong fbbase, ofnode vp_node)
int vop_id, port_id, win_id;
struct display_timing timing;
struct udevice *disp;
+ struct udevice *bridge;
int ret;
u32 remote_phandle;
struct display_plat *disp_uc_plat;
@@ -354,8 +357,11 @@ static int rk_display_init(struct udevice *dev, ulong fbbase, ofnode vp_node)
return -EINVAL;
}
+ if (IS_ENABLED(CONFIG_VIDEO_BRIDGE))
+ uclass_find_device_by_ofnode(UCLASS_VIDEO_BRIDGE, remote, &bridge);
+
uclass_find_device_by_ofnode(UCLASS_DISPLAY, remote, &disp);
- if (disp)
+ if (disp || bridge)
break;
};
compat = ofnode_get_property(remote, "compatible", NULL);
@@ -393,27 +399,49 @@ static int rk_display_init(struct udevice *dev, ulong fbbase, ofnode vp_node)
return ret;
}
- disp_uc_plat = dev_get_uclass_plat(disp);
- debug("Found device '%s', disp_uc_priv=%p\n", disp->name, disp_uc_plat);
- if (display_in_use(disp)) {
- debug(" - device in use\n");
- return -EBUSY;
- }
+ if (bridge) {
+ /* video bridge detected, probe it */
+ ret = device_probe(bridge);
+ if (ret) {
+ dev_err(dev, "Failed to probe video bridge: %d\n", ret);
+ return ret;
+ }
- disp_uc_plat->source_id = vop_id;
- disp_uc_plat->src_dev = dev;
+ /* Attach the DSI controller and the display to the bridge. */
+ ret = video_bridge_attach(bridge);
+ if (ret) {
+ dev_err(dev, "Failed to attach video bridge: %d\n", ret);
+ return ret;
+ }
- ret = device_probe(disp);
- if (ret) {
- debug("%s: device '%s' display won't probe (ret=%d)\n",
- __func__, dev->name, ret);
- return ret;
- }
+ ret = video_bridge_get_display_timing(bridge, &timing);
+ if (ret) {
+ dev_err(dev, "Failed to read timings: %d\n", ret);
+ return ret;
+ }
+ } else {
+ disp_uc_plat = dev_get_uclass_plat(disp);
+ debug("Found device '%s', disp_uc_priv=%p\n", disp->name, disp_uc_plat);
+ if (display_in_use(disp)) {
+ debug(" - device in use\n");
+ return -EBUSY;
+ }
- ret = display_read_timing(disp, &timing);
- if (ret) {
- debug("%s: Failed to read timings\n", __func__);
- return ret;
+ disp_uc_plat->source_id = vop_id;
+ disp_uc_plat->src_dev = dev;
+
+ ret = device_probe(disp);
+ if (ret) {
+ debug("%s: device '%s' display won't probe (ret=%d)\n",
+ __func__, dev->name, ret);
+ return ret;
+ }
+
+ ret = display_read_timing(disp, &timing);
+ if (ret) {
+ debug("%s: Failed to read timings\n", __func__);
+ return ret;
+ }
}
/* Set clock rate on video port to display timings */
@@ -456,9 +484,18 @@ static int rk_display_init(struct udevice *dev, ulong fbbase, ofnode vp_node)
rkvop2_mode_set(dev, &timing, vop_id, port_id, platdata);
- ret = display_enable(disp, 1 << l2bpp, &timing);
- if (ret)
- return ret;
+ if (bridge) {
+ /* Attach the DSI controller and the display to the bridge. */
+ ret = video_bridge_set_backlight(bridge, 60);
+ if (ret) {
+ dev_err(dev, "Failed to start the video bridge: %d\n", ret);
+ return ret;
+ }
+ } else {
+ ret = display_enable(disp, 1 << l2bpp, &timing);
+ if (ret)
+ return ret;
+ }
uc_priv->xsize = timing.hactive.typ;
uc_priv->ysize = timing.vactive.typ;
--
2.49.0
next prev parent reply other threads:[~2025-04-12 14:32 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-12 14:27 [PATCH v3 00/12] Rockchip VOP2 support Dang Huynh
2025-04-12 14:27 ` [PATCH v3 01/12] video: rockchip: dw-mipi-dsi: Depend on CONFIG_VIDEO_BRIDGE Dang Huynh
2025-04-12 14:27 ` [PATCH v3 02/12] video: rockchip: dw_mipi_dsi: Improve pixel clock calculations Dang Huynh
2025-04-12 14:27 ` [PATCH v3 03/12] video: rockchip: dw_mipi_dsi: Proceed when external PHY is not defined Dang Huynh
2025-04-12 14:27 ` [PATCH v3 04/12] video: rockchip: dw-mipi-dsi: Add get_display_timing support Dang Huynh
2025-04-12 14:27 ` [PATCH v3 05/12] video: Add BOE TH101MB31IG002-28A MIPI-DSI panel Dang Huynh
2025-04-12 14:27 ` [PATCH v3 06/12] video: rockchip: Add VOP2 support Dang Huynh
2025-04-12 14:27 ` Dang Huynh [this message]
2025-04-12 14:27 ` [PATCH v3 08/12] dts: rockchip: rk356x: Prerelocate VOP in U-Boot proper Dang Huynh
2025-04-13 14:33 ` Jonas Karlman
2025-04-15 13:15 ` Dang Huynh
2025-04-12 14:27 ` [PATCH v3 09/12] configs: quartz64: Enable vidconsole Dang Huynh
2025-04-12 14:27 ` [PATCH v3 10/12] video: rockchip: Add HDMI support for RK3568 Dang Huynh
2025-04-13 15:10 ` Jonas Karlman
2025-04-12 14:27 ` [PATCH v3 11/12] configs: pinetab2-rk3566: Enable video and USB keyboard Dang Huynh
2025-04-13 15:26 ` Jonas Karlman
2025-04-15 13:29 ` Dang Huynh
2025-04-15 15:52 ` Jonas Karlman
2025-04-19 4:22 ` Dang Huynh
2025-04-12 14:27 ` [PATCH v3 12/12] clk: rockchip: rk3568: Use assigned VPLL clock when possible Dang Huynh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250412-vop2-pt2-v3-7-7c796db335e9@riseup.net \
--to=danct12@riseup.net \
--cc=agust@denx.de \
--cc=clamor95@gmail.com \
--cc=dsimic@manjaro.org \
--cc=frattaroli.nicolas@gmail.com \
--cc=jonas@kwiboo.se \
--cc=kever.yang@rock-chips.com \
--cc=lukma@denx.de \
--cc=megi@xff.cz \
--cc=pZ010001011111@proton.me \
--cc=philipp.tomsich@vrull.eu \
--cc=seanga2@gmail.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox