core: ofnode: add of_graph parsing helpers
v3 cover core: ofnode: add of_graph parsing helpers
Add a mostly complete list of ofnode analogs of of_graph parsing helpers.
---
Changes in v3:
- added fallbacks for video bridge functions
Changes in v2:
- added tests
---
Svyatoslav Ryhel (4):
video: bridge-uclass: add get_display_timing ops
video: bridge-uclass: add inline fallbacks of video bridge functions
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 | 54 +++++++++ test/dm/Makefile | 1 + test/dm/video_bridge.c | 67 +++++++++++ 9 files changed, 317 insertions(+) create mode 100644 drivers/video/bridge/lvds-codec.c create mode 100644 test/dm/video_bridge.c
Signature · 1 line
2.43.0
PATCH v3 1/4 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
@@ -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
@@ -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
Re: [PATCH v3 1/4] video: bridge-uclass: add get_display_timing ops
Quoted 5 lines · Svyatoslav Ryhel
Add
get_display_timingops for internal bridges linked to panels that do not support EDID (MIPI-DSI panels for example) or have EDID not routed.
Quoted 7 lines
Signed-off-by Svyatoslav Ryhel <[email protected]>--- drivers/video/bridge/video-bridge-uclass.c | 11 +++++++++++ include/video_bridge.h | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+)
PATCH v3 2/4 video: bridge-uclass: add inline fallbacks of video bridge functions
In reply to Svyatoslav RyhelHide video bridge functions behind config condition and add inline fallbacks to avoid erroring out when using header without config enabled.
--- include/video_bridge.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
include/video_bridge.h +33 -0
@@ -80,6 +80,7 @@ struct video_bridge_ops {#define video_bridge_get_ops (dev) \ ((struct video_bridge_ops *)(dev)->driver->ops) +#if CONFIG_IS_ENABLED (VIDEO_BRIDGE )/** * video_bridge_attach() - attach a video bridge *
@@ -128,5 +129,37 @@ int video_bridge_get_display_timing(struct udevice *dev,* Return: number of bytes read, <=0 for error */ int video_bridge_read_edid (struct udevice *dev,u8 *buf,int buf_size); +#else +static inline int video_bridge_attach (struct udevice *dev) +{ +return -ENOSYS ; +} + +static inline int video_bridge_set_backlight (struct udevice *dev,int percent) +{ +return -ENOSYS ; +} + +static inline int video_bridge_set_active (struct udevice *dev,bool active) +{ +return -ENOSYS ; +} + +static inline int video_bridge_check_attached (struct udevice *dev) +{ +return -ENOSYS ; +} + +static inline int video_bridge_get_display_timing (struct udevice *dev, +struct display_timing *timing) +{ +return -ENOSYS ; +} + +static inline int video_bridge_read_edid (struct udevice *dev,u8 *buf,int buf_size) +{ +return -ENOSYS ; +} +#endif /* CONFIG_VIDEO_BRIDGE */ #endif
Signature · 1 line
2.43.0
Re: [PATCH v3 2/4] video: bridge-uclass: add inline fallbacks of video bridge functions
Quoted 9 lines · Svyatoslav Ryhel
Hide video bridge functions behind config condition and add inline fallbacks to avoid erroring out when using header without config enabled.
Signed-off-by Svyatoslav Ryhel <[email protected]>--- include/video_bridge.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
PATCH v3 3/4 video: bridge: add transparent LVDS de/encoder bridge
In reply to Svyatoslav RyhelAdd 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
@@ -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
@@ -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
Re: [PATCH v3 3/4] video: bridge: add transparent LVDS de/encoder bridge
Quoted 11 lines · Svyatoslav Ryhel
Add a simple and transparent LVDS de/encoder driver with a powerdown gpio and a power supply.
Signed-off-by Svyatoslav Ryhel <[email protected]>--- 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
PATCH v3 4/4 test: dm: add video bridge tests
In reply to Svyatoslav RyhelAdd 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
@@ -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
@@ -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
@@ -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
Re: [PATCH v3 4/4] test: dm: add video bridge tests
Quoted 11 lines · Svyatoslav Ryhel
Add tests for video bridge ops.
Signed-off-by Svyatoslav Ryhel <[email protected]>--- 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