Skip to contentSkip to conversation

video: bridge-uclass: add get_display_timing ops

PATCH In review Svyatoslav Ryhel 2 participants 5 messages Feb 20, 2025 – Feb 23, 2025 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

v2 cover video: bridge-uclass: add get_display_timing ops

Add get_display_timing ops for internal bridges linked to panels that do not support EDID (MIPI-DSI panels for example) or have EDID not routed.

---
Changes in v2
- adjusted get_display_timing description
- added LVDS de/encoder bridge
- added video bridge test
---

Svyatoslav Ryhel (3):
video: bridge-uclass: add get_display_timing ops
video: bridge: add transparent LVDS de/encoder bridge
test: dm: add video bridge tests

 arch/sandbox/dts/test.dts                  |  46 ++++++++
 configs/sandbox_defconfig                  |   2 +
 drivers/video/bridge/Kconfig               |   7 ++
 drivers/video/bridge/Makefile              |   1 +
 drivers/video/bridge/lvds-codec.c          | 128 +++++++++++++++++++++
 drivers/video/bridge/video-bridge-uclass.c |  11 ++
 include/video_bridge.h                     |  21 ++++
 test/dm/Makefile                           |   1 +
 test/dm/video_bridge.c                     |  67 +++++++++++
 9 files changed, 284 insertions(+)
 create mode 100644 drivers/video/bridge/lvds-codec.c
 create mode 100644 test/dm/video_bridge.c
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/3 video: bridge-uclass: add get_display_timing ops

Add get_display_timing ops for internal bridges linked to panels that do not support EDID (MIPI-DSI panels for example) or have EDID not routed.

---
 drivers/video/bridge/video-bridge-uclass.c | 11 +++++++++++
 include/video_bridge.h                     | 21 +++++++++++++++++++++
 2 files changed, 32 insertions(+)
drivers/video/bridge/video-bridge-uclass.c +11 -0
index 2084a2e03ee..1b8aa12b9e8 100644
@@ -33,6 +33,17 @@ int video_bridge_attach(struct udevice *dev)
 	return ops->attach(dev);
 }
 
+int video_bridge_get_display_timing(struct udevice *dev,
+				    struct display_timing *timings)
+{
+	struct video_bridge_ops *ops = video_bridge_get_ops(dev);
+
+	if (!ops->get_display_timing)
+		return -ENOSYS;
+
+	return ops->get_display_timing(dev, timings);
+}
+
 int video_bridge_check_attached(struct udevice *dev)
 {
 	struct video_bridge_priv *uc_priv = dev_get_uclass_priv(dev);
include/video_bridge.h +21 -0
index 3b429eac578..7158deb299a 100644
@@ -53,6 +53,19 @@ struct video_bridge_ops {
 	 */
 	int (*set_backlight)(struct udevice *dev, int percent);
 
+	/**
+	 * get_display_timing() - Get display timings from bridge.
+	 *
+	 * @dev:	Bridge device containing the linked display timings
+	 * @tim:	Place to put timings
+	 * @return 0 if OK, -ve on error
+	 *
+	 * This call it totally optional and useful mainly for integrated
+	 * bridges with fixed output device.
+	 */
+	int (*get_display_timing)(struct udevice *dev,
+				  struct display_timing *timing);
+
 	/**
 	 * read_edid() - Read information from EDID
 	 *
@@ -98,6 +111,14 @@ int video_bridge_set_active(struct udevice *dev, bool active);
  */
 int video_bridge_check_attached(struct udevice *dev);
 
+/**
+ * video_bridge_get_display_timing() - Get display timings from bridge.
+ *
+ * @dev:	Bridge device containing the linked display timings
+ * Return: 0 if OK, -ve on error
+ */
+int video_bridge_get_display_timing(struct udevice *dev,
+				    struct display_timing *timing);
 /**
  * video_bridge_read_edid() - Read information from EDID
  *
Signature · 1 line
2.43.0
Tested-by on v2 1/3
#2 lore raw

Works with Rockchip DW MIPI DSI bridge (drivers/video/rockchip/ dw_mipi_dsi_rockchip.c) after I add ops to the driver.

Quoted 16 lines · UTC Svyatoslav Ryhel

Add get_display_timing ops for internal bridges linked to panels that do not support EDID (MIPI-DSI panels for example) or have EDID not routed.

---
 drivers/video/bridge/video-bridge-uclass.c | 11 +++++++++++
 include/video_bridge.h                     | 21 +++++++++++++++++++++
 2 files changed, 32 insertions(+)
(quoted diff) +0 -0

b/drivers/video/bridge/video-bridge-uclass.c index 2084a2e03ee..1b8aa12b9e8 100644

drivers/video/bridge/video-bridge-uclass.c int video_bridge_attach(struct udevice *dev) · line 37

Quoted 5 lines
drivers/video/bridge/video-bridge-uclass.c +2 -0
@@ -33,6 +33,17 @@ int video_bridge_attach(struct udevice *dev)
 	return ops->attach(dev);
 }
 
+int video_bridge_get_display_timing(struct udevice *dev,
+				    struct display_timing 

*timings)

Quoted 40 lines
drivers/video/bridge/video-bridge-uclass.c +9 -0
+{
+	struct video_bridge_ops *ops = video_bridge_get_ops(dev);
+
+	if (!ops->get_display_timing)
+		return -ENOSYS;
+
+	return ops->get_display_timing(dev, timings);
+}
+
 int video_bridge_check_attached(struct udevice *dev)
 {
 	struct video_bridge_priv *uc_priv = dev_get_uclass_priv(dev);
include/video_bridge.h +13 -0
index 3b429eac578..7158deb299a 100644
@@ -53,6 +53,19 @@ struct video_bridge_ops {
 	 */
 	int (*set_backlight)(struct udevice *dev, int percent);
 
+	/**
+	 * get_display_timing() - Get display timings from bridge.
+	 *
+	 * @dev:	Bridge device containing the linked display timings
+	 * @tim:	Place to put timings
+	 * @return 0 if OK, -ve on error
+	 *
+	 * This call it totally optional and useful mainly for integrated
+	 * bridges with fixed output device.
+	 */
+	int (*get_display_timing)(struct udevice *dev,
+				  struct display_timing *timing);
+
 	/**
 	 * read_edid() - Read information from EDID
 	 *
@@ -98,6 +111,14 @@ int video_bridge_set_active(struct udevice *dev, bool

active); */
int video_bridge_check_attached(struct udevice *dev);

include/video_bridge.h int video_bridge_set_active(struct udevice *dev, bool active);

Quoted 8 lines
include/video_bridge.h +8 -0
+/**
+ * video_bridge_get_display_timing() - Get display timings from bridge.
+ *
+ * @dev:	Bridge device containing the linked display timings
+ * Return: 0 if OK, -ve on error
+ */
+int video_bridge_get_display_timing(struct udevice *dev,
+				    struct display_timing 

*timing);

Quoted 3 lines

/**
* video_bridge_read_edid() - Read information from EDID *

#3 lore raw

PATCH v2 2/3 video: bridge: add transparent LVDS de/encoder bridge

In reply to Svyatoslav Ryhel

Add a simple and transparent LVDS de/encoder driver with a powerdown gpio and a power supply.

---
 drivers/video/bridge/Kconfig      |   7 ++
 drivers/video/bridge/Makefile     |   1 +
 drivers/video/bridge/lvds-codec.c | 128 ++++++++++++++++++++++++++++++
 3 files changed, 136 insertions(+)
 create mode 100644 drivers/video/bridge/lvds-codec.c
drivers/video/bridge/Kconfig +7 -0
index ab917273720..21c5a043e02 100644
@@ -59,3 +59,10 @@ config VIDEO_BRIDGE_TOSHIBA_TC358768
 	help
 	  Toshiba TC358768AXBG/TC358778XBG DSI bridge chip driver.
 	  Found in Asus Transformer Infinity TF700T.
+
+config VIDEO_BRIDGE_LVDS_CODEC
+	bool "Transparent LVDS encoders and decoders support"
+	depends on VIDEO_BRIDGE && PANEL && DM_GPIO
+	help
+	  Support for transparent LVDS encoders and decoders that don't
+	  require any configuration.
drivers/video/bridge/Makefile +1 -0
index 58697e3cbe9..63dc6e62c49 100644
@@ -10,3 +10,4 @@ obj-$(CONFIG_VIDEO_BRIDGE_NXP_PTN3460) += ptn3460.o
 obj-$(CONFIG_VIDEO_BRIDGE_ANALOGIX_ANX6345) += anx6345.o
 obj-$(CONFIG_VIDEO_BRIDGE_SOLOMON_SSD2825) += ssd2825.o
 obj-$(CONFIG_VIDEO_BRIDGE_TOSHIBA_TC358768) += tc358768.o
+obj-$(CONFIG_VIDEO_BRIDGE_LVDS_CODEC) += lvds-codec.o
drivers/video/bridge/lvds-codec.c new file +128 -0

128 lines not on this page · raw message

Signature · 1 line
2.43.0
#4 lore raw

PATCH v2 3/3 test: dm: add video bridge tests

In reply to Svyatoslav Ryhel

Add tests for video bridge ops.

---
 arch/sandbox/dts/test.dts | 46 +++++++++++++++++++++++++++
 configs/sandbox_defconfig |  2 ++
 test/dm/Makefile          |  1 +
 test/dm/video_bridge.c    | 67 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 116 insertions(+)
 create mode 100644 test/dm/video_bridge.c
arch/sandbox/dts/test.dts +46 -0
index 80291958533..52e9ddbf50f 100644
@@ -1047,6 +1047,31 @@
 		};
 	};
 
+	lvds-encoder {
+		compatible = "lvds-encoder";
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+
+				bridge_input: endpoint {
+					/* link to output */
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+
+				bridge_output: endpoint {
+					remote-endpoint = <&panel_input>;
+				};
+			};
+		};
+	};
+
 	wdt-gpio-toggle {
 		gpios = <&gpio_a 8 0>;
 		compatible = "linux,wdt-gpio";
@@ -1402,6 +1427,27 @@
 	panel {
 		compatible = "simple-panel";
 		backlight = <&backlight 0 100>;
+
+		display-timings {
+			timing@0 {
+				/* 1280x800@60Hz */
+				clock-frequency = <68000000>;
+				hactive = <1280>;
+				hfront-porch = <48>;
+				hback-porch = <18>;
+				hsync-len = <30>;
+				vactive = <800>;
+				vfront-porch = <3>;
+				vback-porch = <12>;
+				vsync-len = <5>;
+			};
+		};
+
+		port {
+			panel_input: endpoint {
+				remote-endpoint = <&bridge_output>;
+			};
+		};
 	};
 
 	scsi {
configs/sandbox_defconfig +2 -0
index 7b35ad8a88f..396c58c5658 100644
@@ -328,6 +328,8 @@ CONFIG_USB_ETH_CDC=y
 CONFIG_VIDEO=y
 CONFIG_VIDEO_FONT_SUN12X22=y
 CONFIG_VIDEO_COPY=y
+CONFIG_VIDEO_BRIDGE=y
+CONFIG_VIDEO_BRIDGE_LVDS_CODEC=y
 CONFIG_CONSOLE_ROTATION=y
 CONFIG_CONSOLE_TRUETYPE=y
 CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y
test/dm/Makefile +1 -0
index e44f3d89e77..3afcc26ca57 100644
@@ -63,6 +63,7 @@ obj-$(CONFIG_SOUND) += i2s.o
 obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o
 obj-$(CONFIG_IOMMU) += iommu.o
 obj-$(CONFIG_LED) += led.o
+obj-$(CONFIG_VIDEO_BRIDGE_LVDS_CODEC) += video_bridge.o
 obj-$(CONFIG_DM_MAILBOX) += mailbox.o
 obj-$(CONFIG_DM_MDIO) += mdio.o
 obj-$(CONFIG_DM_MDIO_MUX) += mdio_mux.o
test/dm/video_bridge.c new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
2.43.0