drm/bridge: trilinear: add the Sky1 DisplayPort transmitter
Subsystems (4)
PATCH v11 1/5 dt-bindings: display: add CIX Sky1 DisplayPort transmitter
In reply to Luo LiuAdd a binding for the Trilinear DisplayPort transmitter integrated on CIX Sky1. The USB-C and the native DP/eDP transmitters use different RCSU video-adapter register offsets and bit layouts, so each has its own compatible.
The binding describes the full video link: port@0 is the input from the display pipeline, and port@1 is the output towards the display connector, a bridge in front of it, or the USB-C combo PHY that carries the DP lanes to the receptacle. The driver drives the link through phys, gets its connector from drm_bridge_connector_init(), and chains a downstream bridge from port@1 when one is wired.
--- .../bindings/display/cix,sky1-dp.yaml | 133 ++++++++++++++++++ MAINTAINERS | 8 ++ 2 files changed, 141 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/cix,sky1-dp.yaml
Documentation/devicetree/bindings/display/cix,sky1-dp.yaml new file +133 -0
@@ -0,0 +1,133 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) + +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/cix,sky1-dp.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: CIX Sky1 Trilinear DisplayPort Transmitter + +maintainers: + - Luo Liu <[email protected]> + +description: | + Trilinear DisplayPort transmitter on CIX Sky1. The transmitter takes its + video stream from the display pipeline through its input port and drives + the link through a generic PHY. Its output port describes where the DP + lanes go on the board: a display connector, a bridge, or the USB-C combo + PHY that carries them to the receptacle. + + The USB-C transmitters and the native DP/eDP transmitter use different + RCSU video-adapter register offsets and bit layouts, so each has its own + compatible: "cix,sky1-usbdp" for the USB-C transmitters and "cix,sky1-dp" + for the native DP/eDP one. + +properties: + compatible: + enum: + - cix,sky1-usbdp + - cix,sky1-dp + + reg: + items: + - description: DisplayPort transmitter registers. + - description: RCSU video adapter registers used for link setup. + + reg-names: + items: + - const: dp + - const: rcsu + + clocks: + items: + - description: APB clock of the controller. + - description: Video clock of stream 0. + - description: Video clock of stream 1. + + clock-names: + items: + - const: apb + - const: vid0 + - const: vid1 + + interrupts: + maxItems: 1 + + resets: + maxItems: 1 + description: DisplayPort controller reset. + + phys: + maxItems: 1 + description: DisplayPort PHY the controller transmits through. + + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: + Video input from the Mali D71 display pipeline (Komeda) that feeds + this controller. + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: + Output of the controller. It connects to the display connector, to + a bridge in front of one, or to the USB-C combo PHY that carries + the DP lanes to the receptacle. + + required: + - port@0 + - port@1 + +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + - interrupts + - resets + - phys + - ports + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + + dp@14064000 { + compatible = "cix,sky1-usbdp"; + reg = <0x14064000 0x4000>, + <0x14050000 0x400>; + reg-names = "dp", "rcsu"; + clocks = <&dpc0_apb>, <&dpc0_vid0>, <&dpc0_vid1>; + clock-names = "apb", "vid0", "vid1"; + interrupts = <GIC_SPI 332 IRQ_TYPE_LEVEL_HIGH>; + resets = <&dpc0_rst>; + phys = <&usbc0_dp_phy>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + endpoint { + remote-endpoint = <&dpu0_pipe0_out>; + }; + }; + + port@1 { + reg = <1>; + + endpoint { + remote-endpoint = <&dp0_connector_in>; + }; + }; + }; + };
MAINTAINERS +8 -0
@@ -6522,6 +6522,14 @@ M: Satish Kharat <[email protected]> S: Supported F: drivers/infiniband/hw/usnic/ +CIX SKY1 DISPLAYPORT TRANSMITTER DRIVER +M: Luo Liu <[email protected]> +M: Wuyi Shen <[email protected]> +R: CIX Linux Kernel Upstream Group <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/display/cix,sky1-dp.yaml + CLANG CONTEXT ANALYSIS M: Marco Elver <[email protected]> R: Bart Van Assche <[email protected]>
Signature · 1 line
2.25.1
PATCH v11 2/5 drm/bridge: trilinear: add the DPTX hardware layer
In reply to Luo LiuAdd the register and PHY programming for the Trilinear DisplayPort
transmitter: controller reset, host and core enable, AUX transfers through the controller's AUX channel, sink capability parsing from the DPCD, and link training with clock recovery and channel equalization.
The transmitter drives up to four lanes at HBR3 and has two SST sources. The stream setup programs the main stream attributes, the pixel format and the optional VSC SDP per stream. MST is not implemented and is left disabled.
DP_SET_POWER is only accessed on sinks whose DPCD revision implements the register, so a v1.0 sink is not sent a request it cannot answer.
Clock recovery is bounded to the DP 1.4 retry limit of 10, or 80 tries on older sinks, and stops once the sink reports the maximum voltage swing, so an oscillating sink cannot stall training for seconds.
--- MAINTAINERS | 1 + drivers/gpu/drm/bridge/trilinear/dptx_hw.c | 1425 ++++++++++++++++++++ drivers/gpu/drm/bridge/trilinear/dptx_hw.h | 103 ++ 3 files changed, 1529 insertions(+) create mode 100644 drivers/gpu/drm/bridge/trilinear/dptx_hw.c create mode 100644 drivers/gpu/drm/bridge/trilinear/dptx_hw.h
MAINTAINERS +1 -0
@@ -6529,6 +6529,7 @@ R: CIX Linux Kernel Upstream Group <[email protected]> L: [email protected] S: Maintained F: Documentation/devicetree/bindings/display/cix,sky1-dp.yaml +F: drivers/gpu/drm/bridge/trilinear/ CLANG CONTEXT ANALYSIS M: Marco Elver <[email protected]>
drivers/gpu/drm/bridge/trilinear/dptx_hw.c new file +1425 -0
1,425 lines not on this page · raw message
drivers/gpu/drm/bridge/trilinear/dptx_hw.h new file +103 -0
103 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v11 4/5 drm/bridge: trilinear: add the DPTX core and build glue
In reply to Luo LiuAdd the probe path, system sleep handling, hotplug workers and the stream state machine that tie the hardware layer to the DRM bridge, and hook the driver into the DRM bridge Kconfig and Makefile.
A port@1 with a remote endpoint points at a converter bridge in front of the connector, so the probe resolves it for the bridge to chain; a port@1 without one feeds the native DP PHY directly. An endpoint that names the combo PHY from the phys property is not a bridge, so the transmitter stays at the end of the chain there and keeps driving the hotplug replay for that port.
A bridge that detects hotplug on its own reports it through the bridge connector, which broadcasts the result back to every bridge in the chain. The transmitter leaves the HPD operation to such a bridge, so that broadcast cannot queue another hotplug event and start a loop.
Detection is driven by the controller's HPD interrupt. The USB-C transmitters do not route HPD to the controller, so a sink that was plugged in before the bridge was attached raises no event; replay that plug once the common PHY is in DP mode and the AUX channel answers. A connector probe performs the same check, so the state is recovered even when a downstream bridge owns hotplug reporting and the enable callback never reaches the transmitter. The native DP port wires HPD and is reported by the interrupt.
An atomic enable that arrives while the transmitter is suspended is refused instead of powering the host back up behind the sleep callbacks; the host is left for the resume path to bring up again.
The transmitter is torn down from the platform remove callback as well as from devres, so the device link is dropped while the device is still registered; device links are purged during device removal and must not be released afterwards.
--- drivers/gpu/drm/bridge/Kconfig | 2 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/trilinear/Kconfig | 9 + drivers/gpu/drm/bridge/trilinear/Makefile | 4 + drivers/gpu/drm/bridge/trilinear/dptx_core.c | 1076 ++++++++++++++++++ include/drm/bridge/trilinear_dp.h | 10 + 6 files changed, 1102 insertions(+) create mode 100644 drivers/gpu/drm/bridge/trilinear/Kconfig create mode 100644 drivers/gpu/drm/bridge/trilinear/Makefile create mode 100644 drivers/gpu/drm/bridge/trilinear/dptx_core.c
drivers/gpu/drm/bridge/Kconfig +2 -0
@@ -510,4 +510,6 @@ source "drivers/gpu/drm/bridge/imx/Kconfig" source "drivers/gpu/drm/bridge/synopsys/Kconfig" +source "drivers/gpu/drm/bridge/trilinear/Kconfig" + endmenu
drivers/gpu/drm/bridge/Makefile +1 -0
@@ -53,3 +53,4 @@ obj-y += analogix/ obj-y += cadence/ obj-y += imx/ obj-y += synopsys/ +obj-y += trilinear/
drivers/gpu/drm/bridge/trilinear/Kconfig new file +9 -0
@@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config DRM_TRILINEAR_DPTX + tristate + depends on COMMON_CLK && DRM && OF + depends on GENERIC_PHY + select DRM_KMS_HELPER + select DRM_DISPLAY_HELPER + select DRM_DISPLAY_DP_HELPER
drivers/gpu/drm/bridge/trilinear/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only + +trilinear-dptx-y := dptx_core.o dptx_drm.o dptx_hw.o +obj-$(CONFIG_DRM_TRILINEAR_DPTX) += trilinear-dptx.o
drivers/gpu/drm/bridge/trilinear/dptx_core.c new file +1076 -0
1,076 lines not on this page · raw message
include/drm/bridge/trilinear_dp.h +10 -0
@@ -65,6 +65,16 @@ int trilinear_dptx_suspend(struct dptx_dev *dp);*/ int trilinear_dptx_resume (struct dptx_dev *dp); +/** +* trilinear_dptx_remove - tear down a DPTX bridge on driver removal +* @dp: DPTX device returned by trilinear_dptx_probe() +* +* Called from the platform remove callback, before the device is deleted. +* The device link to the display controller is dropped here, since device +* links are purged on removal and cannot be released afterwards. +*/ +void trilinear_dptx_remove (struct dptx_dev *dp); +/** * trilinear_dptx_shutdown - stop a DPTX bridge on system shutdown * @dp: DPTX device returned by trilinear_dptx_probe()
Signature · 1 line
2.25.1
v11 cover drm/bridge: trilinear: add the Sky1 DisplayPort transmitter
Add the Trilinear DisplayPort transmitter as a DRM bridge, with the CIX Sky1 platform glue behind a platform data structure.
The hardware layer, the DRM bridge and the core state machine live in drivers/gpu/drm/bridge/trilinear/, so other SoCs using the same transmitter can share them; the platform registers its own dptx_plat_data through include/drm/bridge/trilinear_dp.h. The transmitter drives up to four lanes at HBR3 and has two SST sources. MST is not implemented and stays disabled.
The USB-C transmitters and the native DP/eDP transmitter use different RCSU video-adapter register offsets and bit layouts, so the binding has one compatible for each. The Sky1 devicetree nodes are not included in this posting.
Scope: DPTX hardware, bridge and bindings only. Komeda (the Sky1 display controller that feeds these bridges) and the board DTS are separate series. Nothing in this posting wires a full display stack.
Tested on a Radxa Orion O6 board; the USB-C DisplayPort output works with the connector created by drm_bridge_connector_init().
Connector handling in this driver:
The bridge is meant to be attached with DRM_BRIDGE_ATTACH_NO_CONNECTOR and drm_bridge_connector_init() creates the connector from the bridge operations. The driver implements the bridge side only and never registers a connector of its own. A bridge wired in front of the connector is chained from port@1.
Changes in v11:
- port@1 is resolved with of_drm_find_and_get_bridge() after the remote endpoint is looked up; an endpoint that names the combo PHY is not a bridge, and the probe defers until a wired bridge registers.
- The HPD operation is left to a downstream bridge that detects hotplug on its own, so the connector broadcast cannot queue another event and start a loop.
- A connector probe performs the same AUX check as the hotplug replay, so a sink plugged in before attach is found even when another bridge owns hotplug reporting and the enable callback never reaches the transmitter.
- Link clock recovery bounds the retry count by the DPCD revision, stops once every lane reports maximum voltage swing, and the power sequences use drm_dp_link_power_up() and drm_dp_link_power_down().
- The color depth comes from the current EDID data of the sink, not the cached value in the atomic connector state.
- YCbCr 4:2:0 is only used when every bridge in the chain allows it, as reported by the connector, even if the sink advertises it.
- atomic_check is skipped when the CRTC is not enabled, so a DPMS-only commit cannot fail for a mode that was already accepted.
- The aux channel is unregistered on detach even when teardown has already started.
- The probe error path clears IRQ_DISABLE_UNLAZY.
Luo Liu (5):
dt-bindings: display: add CIX Sky1 DisplayPort transmitter drm/bridge: trilinear: add the DPTX hardware layer drm/bridge: trilinear: add the DPTX DRM bridge drm/bridge: trilinear: add the DPTX core and build glue drm/cix: add the Sky1 DisplayPort platform glue
.../bindings/display/cix,sky1-dp.yaml | 133 ++ MAINTAINERS | 11 + drivers/gpu/drm/Kconfig | 1 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/bridge/Kconfig | 2 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/trilinear/Kconfig | 9 + drivers/gpu/drm/bridge/trilinear/Makefile | 4 + drivers/gpu/drm/bridge/trilinear/dptx.h | 114 ++ drivers/gpu/drm/bridge/trilinear/dptx_core.c | 1076 +++++++++++++ drivers/gpu/drm/bridge/trilinear/dptx_drm.c | 779 +++++++++ drivers/gpu/drm/bridge/trilinear/dptx_drm.h | 17 + drivers/gpu/drm/bridge/trilinear/dptx_hw.c | 1425 +++++++++++++++++ drivers/gpu/drm/bridge/trilinear/dptx_hw.h | 103 ++ drivers/gpu/drm/cix/Kconfig | 3 + drivers/gpu/drm/cix/Makefile | 3 + drivers/gpu/drm/cix/dptx/Kconfig | 15 + drivers/gpu/drm/cix/dptx/Makefile | 4 + drivers/gpu/drm/cix/dptx/cix_dptx.c | 181 +++ include/drm/bridge/trilinear_dp.h | 84 + 20 files changed, 3966 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/cix,sky1-dp.yaml create mode 100644 drivers/gpu/drm/bridge/trilinear/Kconfig create mode 100644 drivers/gpu/drm/bridge/trilinear/Makefile create mode 100644 drivers/gpu/drm/bridge/trilinear/dptx.h create mode 100644 drivers/gpu/drm/bridge/trilinear/dptx_core.c create mode 100644 drivers/gpu/drm/bridge/trilinear/dptx_drm.c create mode 100644 drivers/gpu/drm/bridge/trilinear/dptx_drm.h create mode 100644 drivers/gpu/drm/bridge/trilinear/dptx_hw.c create mode 100644 drivers/gpu/drm/bridge/trilinear/dptx_hw.h create mode 100644 drivers/gpu/drm/cix/Kconfig create mode 100644 drivers/gpu/drm/cix/Makefile create mode 100644 drivers/gpu/drm/cix/dptx/Kconfig create mode 100644 drivers/gpu/drm/cix/dptx/Makefile create mode 100644 drivers/gpu/drm/cix/dptx/cix_dptx.c create mode 100644 include/drm/bridge/trilinear_dp.h
Signature · 1 line
2.25.1
PATCH v11 5/5 drm/cix: add the Sky1 DisplayPort platform glue
Add the platform driver that maps the Sky1 RCSU video adapter registers and programs the pixel format and pixel-per-clock mode for the Trilinear DisplayPort transmitter.
The DP protocol, link training and the DRM bridge live in the shared Trilinear bridge driver. This glue only fills in the SoC-specific parts through dptx_plat_data, declared in include/drm/bridge/trilinear_dp.h.
The remove callback tears the transmitter down before the device is deleted.
--- MAINTAINERS | 1 + drivers/gpu/drm/Kconfig | 1 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/cix/Kconfig | 3 + drivers/gpu/drm/cix/Makefile | 3 + drivers/gpu/drm/cix/dptx/Kconfig | 15 +++ drivers/gpu/drm/cix/dptx/Makefile | 4 + drivers/gpu/drm/cix/dptx/cix_dptx.c | 181 ++++++++++++++++++++++++++++ 8 files changed, 209 insertions(+) create mode 100644 drivers/gpu/drm/cix/Kconfig create mode 100644 drivers/gpu/drm/cix/Makefile create mode 100644 drivers/gpu/drm/cix/dptx/Kconfig create mode 100644 drivers/gpu/drm/cix/dptx/Makefile create mode 100644 drivers/gpu/drm/cix/dptx/cix_dptx.c
MAINTAINERS +1 -0
@@ -6530,6 +6530,7 @@ L: [email protected] S: Maintained F: Documentation/devicetree/bindings/display/cix,sky1-dp.yaml F: drivers/gpu/drm/bridge/trilinear/ +F: drivers/gpu/drm/cix/ F: include/drm/bridge/trilinear_dp.h CLANG CONTEXT ANALYSIS
drivers/gpu/drm/Kconfig +1 -0
@@ -311,6 +311,7 @@ source "drivers/gpu/drm/aspeed/Kconfig" source "drivers/gpu/drm/ast/Kconfig" source "drivers/gpu/drm/atmel-hlcdc/Kconfig" source "drivers/gpu/drm/bridge/Kconfig" +source "drivers/gpu/drm/cix/Kconfig" source "drivers/gpu/drm/etnaviv/Kconfig" source "drivers/gpu/drm/exynos/Kconfig" source "drivers/gpu/drm/fsl-dcu/Kconfig"
drivers/gpu/drm/Makefile +1 -0
@@ -169,6 +169,7 @@ obj-y += tests/ obj-$(CONFIG_DRM_MIPI_DBI) += drm_mipi_dbi.o obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o obj-y += arm/ +obj-y += cix/ obj-y += clients/ obj-y += display/ obj-$(CONFIG_DRM_TTM) += ttm/
drivers/gpu/drm/cix/Kconfig new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only + +source "drivers/gpu/drm/cix/dptx/Kconfig"
drivers/gpu/drm/cix/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only + +obj-$(CONFIG_DRM_CIX_DP) += dptx/
drivers/gpu/drm/cix/dptx/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config DRM_CIX_DP + tristate "Cix Sky1 DisplayPort platform glue" + depends on ARCH_CIX || COMPILE_TEST + depends on COMMON_CLK && DRM && OF + depends on GENERIC_PHY + select DRM_TRILINEAR_DPTX + help + Platform glue for the Cix Sky1 DisplayPort output. It maps the + SoC video adapter registers and binds the shared Trilinear DPTX + bridge driver. + + To compile this driver as a module, choose M here: the module will + be called cix-dptx.
drivers/gpu/drm/cix/dptx/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only + +cix-dptx-y := cix_dptx.o +obj-$(CONFIG_DRM_CIX_DP) += cix-dptx.o
drivers/gpu/drm/cix/dptx/cix_dptx.c new file +181 -0
181 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v11 3/5 drm/bridge: trilinear: add the DPTX DRM bridge
In reply to Luo LiuAdd the DRM bridge that exposes the transmitter to KMS: connector detection, EDID mode enumeration with a downstream timing fallback, validation of a mode against the sink link capabilities, and the atomic enable and disable paths.
The bridge is meant to be attached with DRM_BRIDGE_ATTACH_NO_CONNECTOR; the connector is created by drm_bridge_connector_init() from the bridge operations, so the driver only implements the bridge side and never creates a connector of its own.
A mode whose horizontal backporch has to be widened is rejected when the adjusted timings no longer fit the mode fields, so malformed timings supplied from userspace cannot wrap around and reach the hardware.
Timings are adjusted and validated whenever the CRTC is enabled, not only while it is actively displaying, so turning the output back on cannot fail for a mode that was already accepted.
The color depth is limited by the current EDID data of the sink, not by the cached value in the atomic connector state, which a commit that only changes the CRTC mode does not refresh after a sink swap.
YCbCr 4:2:0 is only used when every bridge in the chain allows it, as reported by the connector, even if the sink itself advertises it.
The bridge adds a device link to the controller on attach, so the transmitter resumes before the controller's resume commit and is suspended after the controller has stopped issuing commits. The link is created only if the transmitter has not been released. It is dropped on detach under the lock that guards teardown, and a mode set rechecks the released flag after taking the lock, so neither path touches the platform device after it has been removed. The aux channel is unregistered on detach even when teardown has already started, so it cannot keep userspace AUX transfers running against a stale DRM device pointer.
--- MAINTAINERS | 1 + drivers/gpu/drm/bridge/trilinear/dptx.h | 114 +++ drivers/gpu/drm/bridge/trilinear/dptx_drm.c | 779 ++++++++++++++++++++ drivers/gpu/drm/bridge/trilinear/dptx_drm.h | 17 + include/drm/bridge/trilinear_dp.h | 74 ++ 5 files changed, 985 insertions(+) create mode 100644 drivers/gpu/drm/bridge/trilinear/dptx.h create mode 100644 drivers/gpu/drm/bridge/trilinear/dptx_drm.c create mode 100644 drivers/gpu/drm/bridge/trilinear/dptx_drm.h create mode 100644 include/drm/bridge/trilinear_dp.h
MAINTAINERS +1 -0
@@ -6530,6 +6530,7 @@ L: [email protected] S: Maintained F: Documentation/devicetree/bindings/display/cix,sky1-dp.yaml F: drivers/gpu/drm/bridge/trilinear/ +F: include/drm/bridge/trilinear_dp.h CLANG CONTEXT ANALYSIS M: Marco Elver <[email protected]>
drivers/gpu/drm/bridge/trilinear/dptx.h new file +114 -0
114 lines not on this page · raw message
drivers/gpu/drm/bridge/trilinear/dptx_drm.c new file +779 -0
779 lines not on this page · raw message
drivers/gpu/drm/bridge/trilinear/dptx_drm.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* DisplayPort DRM helpers +* +* Copyright 2026 Cix Technology Group Co., Ltd. +*/ + +#ifndef DPTX_DRM_H +#define DPTX_DRM_H + +#include <linux/device.h> + +#include "dptx.h" + +struct dptx_dev *dptx_bridge_alloc (struct device *dev); + +#endif /* DPTX_DRM_H */
include/drm/bridge/trilinear_dp.h new file +74 -0
74 lines not on this page · raw message
Signature · 1 line
2.25.1
[email protected]
AI reviewRe: [PATCH v11 2/5] drm/bridge: trilinear: add the DPTX hardware layer
In reply to Luo LiuThank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] drm/bridge: trilinear: dptx_hw_link_clock_recovery() skips max vswing - [Low] drm/bridge: trilinear…
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [High] drm/bridge: trilinear: dptx_hw_link_clock_recovery() skips max vswing
- [Low] drm/bridge: trilinear: unnecessary single-implementation dptx_hw_ops vtable
- [Low] drm/bridge: trilinear: dptx_hw_stream_misc() omits BT.709 bit in MISC0
--
commit 3a1226e38ee04edc4132811d9716694adb22dd13
Author: Luo Liu <[email protected]>
drm/bridge: trilinear: add the DPTX hardware layer
This commit adds the register and PHY programming layer for the Trilinear DisplayPort transmitter, including AUX transfers, DPCD capability parsing, link training, and per-stream video and VSC SDP setup.
Quoted 5 lines
drivers/gpu/drm/bridge/trilinear/dptx_hw.c new file +0
-0
[ ... ]
Quoted 9 lines
drivers/gpu/drm/bridge/trilinear/dptx_hw.c new file +9
-0+for (i =0 ; i < max_tries; i++) { + ret =dptx_hw_link_vs_emph (hw, phy, lane_cnt); +if (ret) +return ret; + +drm_dp_link_train_clock_recovery_delay (&hw->aux, hw->dpcd); + ret =drm_dp_dpcd_read_link_status (&hw->aux, link_status); +if (ret <0 ) +return ret;
drivers/gpu/drm/bridge/trilinear/dptx_hw.c line 557
Quoted 10 lines
drivers/gpu/drm/bridge/trilinear/dptx_hw.c new file +10
-0+ + train_done =drm_dp_clock_recovery_ok (link_status, lane_cnt); +if (train_done) +break ; + +memcpy (prev, hw->train_setting, lane_cnt); +dptx_hw_link_adjust_train (hw, lane_cnt, link_status); + +if (dptx_hw_link_max_vswing_reached (hw->train_setting, lane_cnt)) +break ;
[Severity: High]
Does dptx_hw_link_clock_recovery() abort before voltage swing level 3 is ever applied?
When the sink requests level 3 on all active lanes, dptx_hw_link_adjust_train() sets DP_TRAIN_MAX_SWING_REACHED in hw->train_setting and the check breaks out before the next iteration's dptx_hw_link_vs_emph() programs it to the PHY and DPCD.
Any link needing maximum voltage swing will therefore fail clock recovery with -EIO and either fail training or downshift unnecessarily. Checking prev (or checking hw->train_setting before dptx_hw_link_adjust_train()) would test level 3 before stopping.
[ ... ]
Quoted 6 lines
drivers/gpu/drm/bridge/trilinear/dptx_hw.c new file +6
-0+static void dptx_hw_stream_misc (struct dp_hw *hw,unsigned int stream_id, +enum dp_pixelformat format,u8 bpc, +bool vsc) +{ +u8 override_bpc; +u8 override =0 ;
drivers/gpu/drm/bridge/trilinear/dptx_hw.c line 939
Quoted 10 lines
drivers/gpu/drm/bridge/trilinear/dptx_hw.c new file +10
-0+u8 misc1 =0 ; +u8 misc0; + +switch (format) { +case DP_PIXELFORMAT_YUV444 : + misc0 =DPTX_STREAM_MISC0_COMP_FORMAT_YCRCB_444 ; +break ; +case DP_PIXELFORMAT_YUV422 : + misc0 =DPTX_STREAM_MISC0_COMP_FORMAT_YCRCB_422 ; +break ;
[Severity: Low]
Should dptx_hw_stream_misc() set MISC0 bit 4 (BT.709) for YCbCr formats when VSC SDP is not used?
DPTX_STREAM_MISC0_COMP_FORMAT_YCRCB_422 (5 << 1) leaves bit 4 cleared, so YCbCr 4:2:2 with DRM_MODE_COLORIMETRY_DEFAULT signals BT.601 in MSA MISC0. That contradicts dptx_hw_vsc_colorimetry(), which treats unspecified YCbCr as BT.709 for VSC SDP, causing a colorimetry mismatch on YCbCr 4:2:2 modes.
Passing colorspace into dptx_hw_stream_misc() and setting BIT(4) for BT.709 would keep MISC0 consistent with the VSC SDP path.
[ ... ]
Quoted 5 lines
drivers/gpu/drm/bridge/trilinear/dptx_hw.h new file +0
-0
[ ... ]
drivers/gpu/drm/bridge/trilinear/dptx_hw.h line 60
Quoted 3 lines
drivers/gpu/drm/bridge/trilinear/dptx_hw.h new file +3
-0+struct dptx_hw_ops { +bool (*hpd_state)(struct dp_hw *hw); +bool (*sink_present)(struct dp_hw *hw);
[Severity: Low]
This isn't a bug, but is the 20-callback struct dptx_hw_ops indirection needed?
There is only a single implementation (dptx_hw_ops in dptx_hw.c, unconditionally assigned in dptx_hw_init()) and struct dp_hw is already exposed in dptx_hw.h. Declaring direct dptx_hw_*() functions in dptx_hw.h would avoid the boilerplate and indirect-call overhead.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
[email protected]
AI reviewRe: [PATCH v11 3/5] drm/bridge: trilinear: add the DPTX DRM bridge
In reply to Luo LiuThank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [High] drm/bridge: lock inversion and late mode_changed in dptx_bridge_atomic_check() - [Medium]…
Thank you for your contribution! Sashiko AI review found 4 potential issues to consider:
- [High] drm/bridge: lock inversion and late mode_changed in dptx_bridge_atomic_check()
- [Medium] drm/bridge: trilinear: dptx_hpd_notify() echo filter bypassed downstream
- [Medium] drm/bridge: trilinear: unlocked display_info read in dptx_bridge_mode_set()
- [Low] drm/bridge: trilinear: dptx_bridge_get_modes() skips clearing stale EDID
--
commit 0fb996722a63499df5034e482ec6a2609d1bce26
Author: Luo Liu <[email protected]>
drm/bridge: trilinear: add the DPTX DRM bridge
This commit adds the DRM bridge layer for the Trilinear DisplayPort transmitter, implementing connector detection, EDID and downstream mode enumeration, mode validation, atomic check, and atomic enable/disable.
Quoted 5 lines
drivers/gpu/drm/bridge/trilinear/dptx_drm.c new file +0
-0
[ ... ]
Quoted 34 lines
drivers/gpu/drm/bridge/trilinear/dptx_drm.c new file +34
-0+static enum drm_connector_status dptx_bridge_detect (struct drm_bridge *bridge, +struct drm_connector *connector) +{ +struct dptx_dev *dp =bridge_to_dp (bridge); +enum drm_connector_status status; + + status = dp->ops->detect_status (dp); +WRITE_ONCE (dp->detect_task, current); + +return status; +} + +static void dptx_hpd_notify (struct dptx_dev *dp, +enum drm_connector_status hpd_state) +{ +if (READ_ONCE (dp->detect_task) == current) { +WRITE_ONCE (dp->detect_task,NULL ); +return ; + } + +if (READ_ONCE (dp->notify_task) == current) { +WRITE_ONCE (dp->notify_task,NULL ); +return ; + } + +if (!dp->oob_hpd) +return ; + +guard (mutex)(&dp->lock); + +if (dp->hpd_stopped || + hpd_state == connector_status_unknown) +return ; +
drivers/gpu/drm/bridge/trilinear/dptx_drm.c line 90
Quoted 10 lines
drivers/gpu/drm/bridge/trilinear/dptx_drm.c new file +10
-0+ dp->force_hpd = hpd_state; + +if (!(dp->state &DPTX_STATE_SUSPENDED )) { +queue_delayed_work (system_freezable_wq, &dp->hpd_event_work,0 ); +if (hpd_state == connector_status_connected) +queue_delayed_work (system_freezable_wq, + &dp->hpd_irq_work, +msecs_to_jiffies (20 )); + } +}
[Severity: Medium]
Can the echo filter in dptx_hpd_notify() be bypassed when a downstream bridge advertises DRM_BRIDGE_OP_DETECT?
drm_bridge_connector_init() assigns bridge_detect to the last bridge in the chain that sets DRM_BRIDGE_OP_DETECT. When dp->oob_hpd is true and a downstream bridge sets DRM_BRIDGE_OP_DETECT, connector probes call that bridge's detect() instead of dptx_bridge_detect(), leaving dp->detect_task NULL, and drm_bridge_connector_hpd_notify() still notifies dp->bridge. Every read-only probe then overwrites dp->force_hpd and queues hpd_event_work (and hpd_irq_work when connected).
In addition, commit "drm/bridge: trilinear: add the DPTX core and build glue" only omits DRM_BRIDGE_OP_HPD on dp->bridge when the immediate dp->next_bridge sets DRM_BRIDGE_OP_DETECT. With an intermediate pass-through bridge (ops == 0) ahead of a downstream detect-only bridge, dp->bridge remains bridge_hpd: drm_bridge_connector_handle_hpd() clears dp->notify_task via drm_bridge_connector_hpd_notify() before calling drm_kms_helper_connector_hotplug_event() -> drm_client_dev_hotplug() -> drm_bridge_connector_detect_ctx(), which re-enters dptx_hpd_notify() and re-queues hpd_event_work with zero delay in an infinite hotplug loop.
[ ... ]
Quoted 17 lines
drivers/gpu/drm/bridge/trilinear/dptx_drm.c new file +17
-0+static int dptx_bridge_get_modes (struct drm_bridge *bridge, +struct drm_connector *connector) +{ +struct dptx_dev *dp =bridge_to_dp (bridge); +const struct drm_edid *edid; +struct drm_display_mode *mode; +int ret; + + scoped_guard(mutex, &dp->lock) { +if (dp->released || + (dp->state &DPTX_STATE_SUSPENDED ) || + !(dp->state &DPTX_STATE_INITIALIZED ) || + !(dp->state &DPTX_STATE_CONNECTED )) +return 0 ; + + edid =drm_edid_read (connector); + }
drivers/gpu/drm/bridge/trilinear/dptx_drm.c line 125
Quoted 10 lines
drivers/gpu/drm/bridge/trilinear/dptx_drm.c new file +10
-0+ +if (edid) { +drm_edid_connector_update (connector, edid); + ret =drm_edid_connector_add_modes (connector); +drm_edid_free (edid); + +return ret; + } + +drm_edid_connector_update (connector,NULL );
[Severity: Low]
Does this early return leave a stale EDID blob and stale connector->display_info fields on the connector?
When a connector is forced on (DRM_FORCE_ON or DRM_FORCE_ON_DIGITAL) after a sink is unplugged, drm_helper_probe_single_connector_modes() skips its disconnected EDID-clearing path and calls get_modes() directly. Returning 0 before drm_edid_connector_update(connector, NULL) leaves the previous sink's bpc, color_formats, and YCbCr 4:2:0 mode masks populated; clearing EDID before returning 0 would match drm_bridge_connector_get_modes_edid().
[ ... ]
Quoted 13 lines
drivers/gpu/drm/bridge/trilinear/dptx_drm.c new file +13
-0+static int dptx_bridge_mode_set (struct dptx_dev *dp, +struct drm_crtc_state *crtc_state, +struct drm_connector_state *conn_state) +{ +struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode; +int color_format; +int link_rate; +int bw_code; +int bpc; +int bpp; +int ret; + + ret = dp->ops->detect (dp);
drivers/gpu/drm/bridge/trilinear/dptx_drm.c line 530
Quoted 10 lines
drivers/gpu/drm/bridge/trilinear/dptx_drm.c new file +10
-0+if (ret) +return ret; + +guard (mutex)(&dp->lock); + +if (dp->released) +return -ENODEV ; + + ret =dptx_pick_config (dp, conn_state, &crtc_state->mode, + adjusted_mode, &color_format, &bpc, &bpp);
[Severity: Medium]
Is there a data race on connector->display_info between dptx_bridge_mode_set() and a concurrent connector probe?
CPU0 (commit_work) CPU1 (DRM_IOCTL_MODE_GETCONNECTOR)
------------------ ----------------------------------
drm_helper_probe_single_connector_modes()
dptx_bridge_get_modes()
/* releases dp->lock */
dptx_bridge_atomic_enable()
dptx_bridge_mode_set()
lock(&dp->lock)
drm_edid_connector_update()
drm_reset_display_info()
info->color_formats = 0;
memset(&info->hdmi, 0, ...);
dptx_pick_config() <-- data race on connector->display_infoFor a non-blocking atomic commit, drm_mode_atomic_ioctl() drops connection_mutex after queuing state->commit_work, so dptx_bridge_mode_set() holds only dp->lock while dptx_bridge_get_modes() calls drm_edid_connector_update() without dp->lock. If dptx_pick_config() runs during drm_reset_display_info() for a mode that needs YCbCr 4:2:0 or 4:2:2, it fails with -EINVAL and dptx_bridge_atomic_enable() aborts, leaving the output blank after the ioctl already succeeded. Storing the format, bpc, and bpp computed in dptx_bridge_atomic_check() in bridge state would avoid reading display_info in atomic_enable.
[ ... ]
Quoted 5 lines
drivers/gpu/drm/bridge/trilinear/dptx_drm.c new file +5
-0+static int dptx_bridge_atomic_check (struct drm_bridge *bridge, +struct drm_bridge_state *bridge_state, +struct drm_crtc_state *crtc_state, +struct drm_connector_state *conn_state) +{
[ ... ]
Quoted 6 lines
drivers/gpu/drm/bridge/trilinear/dptx_drm.c new file +6
-0+if (vsc_supported) { +const struct drm_connector_state *old_conn_state; + + old_conn_state = +drm_atomic_get_old_connector_state (bridge_state->base.state, + conn_state->connector);
drivers/gpu/drm/bridge/trilinear/dptx_drm.c line 604
Quoted 10 lines
drivers/gpu/drm/bridge/trilinear/dptx_drm.c new file +10
-0+if (old_conn_state && + old_conn_state->colorspace != conn_state->colorspace) { + crtc_state->mode_changed = true; + + ret =drm_atomic_add_affected_planes (bridge_state->base.state, + crtc_state->crtc); +if (ret) +return ret; + } + }
[Severity: High]
Can calling drm_atomic_add_affected_planes() from dptx_bridge_atomic_check() cause an ABBA deadlock with encoder->bridge_chain_mutex?
CPU0 CPU1
---- ----lock(&encoder->bridge_chain_mutex)
lock(&plane->mutex)
lock(&plane->mutex)
lock(&encoder->bridge_chain_mutex)*** DEADLOCK ***
CPU0: drm_atomic_bridge_chain_check() -> dptx_bridge_atomic_check()
-> drm_atomic_add_affected_planes() -> drm_atomic_get_plane_state()
CPU1: drm_atomic_helper_check_modeset() -> drm_atomic_add_affected_planes()
-> mode_fixup() -> drm_atomic_bridge_chain_check()drm_atomic_bridge_chain_check() holds the plain mutex encoder->bridge_chain_mutex across dptx_bridge_atomic_check(), whereas drm_atomic_add_affected_planes() acquires plane->mutex (a crtc_ww_class ww_mutex). Because encoder->bridge_chain_mutex is not a ww_mutex, CPU1 cannot back off with -EDEADLK when a colorspace-only atomic commit races with a commit holding plane->mutex.
Setting crtc_state->mode_changed here also happens after mode_fixup() in drm_atomic_helper_check_modeset() has already skipped copying mode into adjusted_mode, so the CRTC's mode_fixup() runs on a stale adjusted_mode.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
[email protected]
AI reviewRe: [PATCH v11 4/5] drm/bridge: trilinear: add the DPTX core and build glue
In reply to Luo LiuThank you for your contribution! Sashiko AI review found 7 potential issues to consider: - [High] drm/bridge: trilinear: dptx_hw_link_clock_recovery() skips max vswing - [Medium] drm/bridge…
Thank you for your contribution! Sashiko AI review found 7 potential issues to consider:
- [High] drm/bridge: trilinear: dptx_hw_link_clock_recovery() skips max vswing
- [Medium] drm/bridge: trilinear: stale phy_dp_tries counter across HPD wait abort
- [Medium] drm/bridge: trilinear: force_hpd not rolled back when connect fails
- [Medium] drm/bridge: trilinear: synchronous AUX stall and double HPD work on resume
- [Medium] drm/bridge: trilinear: port@1 chaining breaks HPD notify and PHY aux-bridge
- [Low] drm/bridge: trilinear: top-of-function __free() NULL init in probe
- [Low] drm/bridge: trilinear: redundant dptx_read_sink_caps() calls on enable
--
commit ebf11715f61cdf2f6b730942cc014262527875ef
Author: Luo Liu <[email protected]>
drm/bridge: trilinear: add the DPTX core and build glue
This commit adds the Trilinear DPTX core state machine, probe path, hotplug workers, and suspend/resume handling, and hooks the driver into the DRM bridge Kconfig and Makefile.
Quoted 6 lines
drivers/gpu/drm/bridge/trilinear/dptx_core.c new file +0
-0@@ -0,0 +1,1076 @@
[ ... ]
Quoted 2 lines
drivers/gpu/drm/bridge/trilinear/dptx_core.c new file +2
-0+static int dptx_train_loop (struct dptx_dev *dp) +{
[ ... ]
drivers/gpu/drm/bridge/trilinear/dptx_core.c line 280
Quoted 3 lines
drivers/gpu/drm/bridge/trilinear/dptx_core.c new file +3
-0+ ret = dp->hw->ops->link_train (dp->hw, dp->phy, + mode->bw_code, + mode->lane_cnt);
[Severity: High]
Does dptx_hw_link_clock_recovery() abort before ever transmitting maximum voltage swing?
In drivers/gpu/drm/bridge/trilinear/dptx_hw.c:dptx_hw_link_clock_recovery() {
...
memcpy(prev, hw->train_setting, lane_cnt);
dptx_hw_link_adjust_train(hw, lane_cnt, link_status);
if (dptx_hw_link_max_vswing_reached(hw->train_setting, lane_cnt))
break;
...
}dptx_hw_link_max_vswing_reached() is called on the newly adjusted hw->train_setting rather than prev. When all active lanes request level-3 voltage swing, the loop breaks out and returns -EIO before the next iteration can apply that level-3 setting to the PHY or write it to DPCD, causing premature link-rate downshifts or blank displays on sinks that need maximum swing.
[ ... ]
Quoted 25 lines
drivers/gpu/drm/bridge/trilinear/dptx_core.c new file +25
-0+static bool dptx_check_oob_sink (struct dptx_dev *dp) +{ +if (!dp->oob_hpd || + dp->force_hpd != connector_status_unknown || +phy_get_mode (dp->phy) !=PHY_MODE_DP || + !dp->hw->ops->sink_present (dp->hw)) +return false; + + dp->force_hpd = connector_status_connected; + +return true; +} + +static int dptx_detect_locked (struct dptx_dev *dp) +{ +if (dp->released) +return -ENODEV ; + +if (dp->state &DPTX_STATE_SUSPENDED ) +return -EBUSY ; + +if (!(dp->state &DPTX_STATE_INITIALIZED )) { +dev_warn_once (dp->dev,"detect with uninitialized host\n" ); +return -ENODEV ; + }
drivers/gpu/drm/bridge/trilinear/dptx_core.c line 555
Quoted 10 lines
drivers/gpu/drm/bridge/trilinear/dptx_core.c new file +10
-0+ +if (!dptx_get_hpd_state (dp)) { +if (!dptx_check_oob_sink (dp)) { +dptx_handle_disconnect (dp); +return -ENODEV ; + } + } + +return dptx_handle_connect (dp); +}
[Severity: Medium]
Can dp->force_hpd remain stuck at connector_status_connected if dptx_handle_connect() fails right after dptx_check_oob_sink() succeeds?
If the sink is unplugged mid-probe or full DPCD capability reads fail, neither dptx_detect_locked() nor dptx_prepare() rolls dp->force_hpd back to connector_status_unknown. Later dptx_detect_locked() calls then see dptx_get_hpd_state(dp) true and skip dptx_handle_disconnect(), keeping dp->force_hpd latched until an external disconnect or suspend.
[ ... ]
Quoted 26 lines
drivers/gpu/drm/bridge/trilinear/dptx_core.c new file +26
-0+static bool dptx_phy_dp_mode_ready (struct dptx_dev *dp) +{ +if (phy_get_mode (dp->phy) ==PHY_MODE_DP ) { + dp->phy_dp_tries =0 ; +return true; + } + +if (dptx_hpd_wait_aborted (dp) || + ++dp->phy_dp_tries >DP_HPD_MAX_TRIES ) { + dp->phy_dp_tries =0 ; +dev_dbg (dp->dev,"PHY did not enter DP mode\n" ); +return false; + } + +queue_delayed_work (system_freezable_wq, &dp->hpd_event_work, +msecs_to_jiffies (100 )); + +return false; +} + +static void dptx_hpd_event_work_func (struct work_struct *work) +{ + struct dptx_dev *dp = container_of(work, struct dptx_dev, + hpd_event_work.work); +enum drm_connector_status status; +bool hpd;
drivers/gpu/drm/bridge/trilinear/dptx_core.c line 626
Quoted 10 lines
drivers/gpu/drm/bridge/trilinear/dptx_core.c new file +10
-0+ + scoped_guard(mutex, &dp->lock) { +if (dptx_hpd_work_aborted (dp)) +return ; + + hpd =dptx_get_hpd_state (dp); + } + +if (hpd && dp->oob_hpd && !dptx_phy_dp_mode_ready (dp)) +return ;
[Severity: Medium]
Can dp->phy_dp_tries carry a stale count into the next hotplug?
dp->phy_dp_tries is only cleared inside dptx_phy_dp_mode_ready(). If HPD drops during a 100 ms retry window (so hpd is false here) or dptx_cancel_hpd_works() cancels the pending work on suspend or detach, dp->phy_dp_tries stays non-zero and later USB-C hotplugs can hit DP_HPD_MAX_TRIES early and abort detection before the PHY enters DP mode.
[ ... ]
Quoted 16 lines
drivers/gpu/drm/bridge/trilinear/dptx_core.c new file +16
-0+static int dptx_pm_complete (struct dptx_dev *dp) +{ +bool replay = false; +int ret; + + scoped_guard(mutex, &dp->lock) { + ret =dptx_host_resume (dp); +if (!ret) + replay = !dp->hpd_stopped && dp->attached; + } + +if (ret) +return ret; + +if (replay) { + dp->ops->replay_deferred_hotplug (dp);
drivers/gpu/drm/bridge/trilinear/dptx_core.c line 781
Quoted 10 lines
drivers/gpu/drm/bridge/trilinear/dptx_core.c new file +10
-0+ + scoped_guard(mutex, &dp->lock) { +if (!dptx_hpd_work_aborted (dp)) +queue_delayed_work (system_freezable_wq, + &dp->hpd_event_work,0 ); + } + } + +return 0 ; +}
[Severity: Medium]
Why call replay_deferred_hotplug() synchronously before unconditionally queuing hpd_event_work?
On an OOB-HPD port in PHY_MODE_DP with no sink answering, dptx_replay_deferred_hotplug() -> dptx_check_oob_sink() runs a 32-retry DPCD read in drm_dp_dpcd_access(), stalling the PM resume thread for up to ~128 ms per port before hpd_event_work repeats the same probe asynchronously. When a sink is present, replay_deferred_hotplug() queues hpd_event_work and drops dp->lock, so if a worker starts it before the second queue_delayed_work(), dptx_hpd_event_work_func() runs twice. Queuing hpd_event_work once after dptx_host_resume() avoids both.
[ ... ]
drivers/gpu/drm/bridge/trilinear/dptx_core.c line 809
Quoted 5 lines
drivers/gpu/drm/bridge/trilinear/dptx_core.c new file +5
-0+if (!dptx_get_hpd_state (dp) && !dptx_check_oob_sink (dp)) +return -ENODEV ; + +return dptx_handle_connect (dp); +}
[Severity: Low]
Does every display enable perform three back-to-back dptx_read_sink_caps() sequences?
dptx_bridge_atomic_enable() calls dp->ops->prepare(dp), then immediately calls dptx_bridge_mode_set() which starts with dp->ops->detect(dp) with no intervening hardware change, and then calls dp->ops->encoder_enable() -> dptx_core_on() which calls dptx_read_sink_caps() a third time. Dropping the redundant detect call in dptx_bridge_mode_set() would avoid extra polled AUX transactions on every modeset and DPMS-on.
[ ... ]
drivers/gpu/drm/bridge/trilinear/dptx_core.c line 960
Quoted 8 lines
drivers/gpu/drm/bridge/trilinear/dptx_core.c new file +8
-0+struct dptx_dev *trilinear_dptx_probe (struct device *dev, +const struct dptx_plat_data *soc_data, +void *priv) +{ +struct dptx_dev *dp; +struct dp_hw *hw; + struct device_node *remote __free(device_node) = NULL; +int ret;
[Severity: Low]
This isn't a bug, but remote is assigned unconditionally at top-level scope below, so it can be defined and initialized in one statement at the of_graph_get_remote_node() call to follow Cleanup API conventions.
[ ... ]
drivers/gpu/drm/bridge/trilinear/dptx_core.c line 1021
Quoted 12 lines
drivers/gpu/drm/bridge/trilinear/dptx_core.c new file +12
-0+ remote =of_graph_get_remote_node (dev->of_node,1 ,0 ); +if (remote && remote != dp->phy->dev.of_node) { + dp->next_bridge =of_drm_find_and_get_bridge (remote); +if (!dp->next_bridge) { +dptx_deinit (dp); +return ERR_PTR (-EPROBE_DEFER ); + } + } + +if (!dp->next_bridge || + !(dp->next_bridge->ops &DRM_BRIDGE_OP_DETECT )) + dp->bridge.ops |=DRM_BRIDGE_OP_HPD ;
[Severity: Medium]
Can chaining a downstream DRM_BRIDGE_OP_HPD bridge silently drop HPD notifications from dptx_hpd_event_work_func()?
Bridges like display-connector (for DP with hpd-gpios) and drm_aux_hpd_bridge set DRM_BRIDGE_OP_HPD without DRM_BRIDGE_OP_DETECT. drm_bridge_connector_init() picks the last bridge with DRM_BRIDGE_OP_HPD as bridge_connector->bridge_hpd and only calls drm_bridge_hpd_enable() on it, leaving dp->bridge.hpd_cb NULL so dptx_notify_hpd() becomes a no-op after delayed PHY DP-mode polling or system resume.
In addition, skipping of_drm_find_and_get_bridge(remote) whenever remote == dp->phy->dev.of_node prevents attaching a PHY-hosted drm_aux_bridge on combo PHYs. That leaves &dp->bridge as the last bridge, so connector->fwnode points to the DPTX node instead of usb-c-connector, causing drm_connector_oob_hotplug_event() from Type-C DP altmode to miss the connector.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
[email protected]
AI reviewRe: [PATCH v11 5/5] drm/cix: add the Sky1 DisplayPort platform glue
In reply to Luo LiuThank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] drm/cix: bridge glue placed in top-level drm/cix/ instead of drm/bridge/ --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] drm/cix: bridge glue placed in top-level drm/cix/ instead of drm/bridge/
--
commit b98a65a444b1910d30b25da63d91eb6747c906fe
Author: Luo Liu <[email protected]>
drm/cix: add the Sky1 DisplayPort platform glue
This commit adds the Sky1 DisplayPort platform glue driver under drivers/gpu/drm/cix/dptx/ to map the RCSU video adapter registers, configure pixel format and pixels-per-clock settings, and bind the shared Trilinear DPTX bridge driver.
Quoted 17 lines
drivers/gpu/drm/Kconfig +1
-0@@ -311,6 +311,7 @@ source "drivers/gpu/drm/aspeed/Kconfig" source "drivers/gpu/drm/ast/Kconfig" source "drivers/gpu/drm/atmel-hlcdc/Kconfig" source "drivers/gpu/drm/bridge/Kconfig" +source "drivers/gpu/drm/cix/Kconfig" source "drivers/gpu/drm/etnaviv/Kconfig" source "drivers/gpu/drm/exynos/Kconfig" source "drivers/gpu/drm/fsl-dcu/Kconfig"drivers/gpu/drm/Makefile +0
-0
drivers/gpu/drm/Makefile obj-y += tests/ · line 175
Quoted 7 lines
drivers/gpu/drm/Makefile +1
-0@@ -169,6 +169,7 @@ obj-y += tests/ obj-$(CONFIG_DRM_MIPI_DBI) += drm_mipi_dbi.o obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o obj-y += arm/ +obj-y += cix/ obj-y += clients/ obj-y += display/ obj-$(CONFIG_DRM_TTM) += ttm/
[Severity: Low]
Should this platform glue live under drivers/gpu/drm/bridge/trilinear/ (or drivers/gpu/drm/bridge/) instead of adding a new top-level drivers/gpu/drm/cix/ directory?
cix_dptx.c only maps Sky1 RCSU registers and calls trilinear_dptx_probe() with no drm_driver of its own. Other standalone SoC bridge glue drivers (such as th1520-dw-hdmi.c and cdns-mhdp8546-j721e.c) live under drivers/gpu/drm/bridge/ and appear in the Display Interface Bridges menu.
Placing it there would avoid the four extra Kconfig/Makefile files under drivers/gpu/drm/cix/ and the unconditional obj-y += cix/ entry. Earlier v10 discussion mentioned sourcing the Kconfig from the bridge menu, but this revision still sources drivers/gpu/drm/cix/Kconfig at the top level.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5