drm/tidss: Fixes data edge sampling on AM62X and AM62A
Subsystems (9)
v2 cover drm/tidss: Fixes data edge sampling on AM62X and AM62A
Currently the driver only configure the data edge sampling partially. AM62X, AM62A and AM62P require it to be configured in two distinct
registers: one in tidss and one in the Control MMR registers.
Introduce a new dt property to link the proper syscon node from the main device registers into the tidss driver.
The series targets to fix the issue for AM62X and AM62A, later will add the changes required for AM62P after DSS support gets upstreamed.
---
Cc: [email protected]
---
Changelog v1->v2:
- Add all devices requiring the fix in cover letter
- Update Fixes tag
- Use "Cc: [email protected]" properly
Link to v1:
https://lore.kernel.org/all/[email protected]/
---
Louis Chauvet (4):
dt-bindings: display: ti,am65x-dss: Add clk property for data edge
synchronization
dt-bindings: mfd: syscon: Add ti,am625-dss-clk-ctrl
arm64: dts: ti: k3-am62-main: Add tidss clk-ctrl property drm/tidss: Fix sampling edge configuration
Swamil Jain (1):
arm64: dts: ti: k3-am62a-main: Add tidss clk-ctrl property
.../bindings/display/ti/ti,am65x-dss.yaml | 6 ++++++ Documentation/devicetree/bindings/mfd/syscon.yaml | 3 ++- arch/arm64/boot/dts/ti/k3-am62-main.dtsi | 6 ++++++ arch/arm64/boot/dts/ti/k3-am62a-main.dtsi | 7 +++++++ drivers/gpu/drm/tidss/tidss_dispc.c | 14 ++++++++++++++ 5 files changed, 35 insertions(+), 1 deletion(-)
PATCH RESEND v2 1/5 dt-bindings: display: ti,am65x-dss: Add clk property for data edge synchronization
From: Louis Chauvet <[email protected]>
The dt-bindings for the display, specifically ti,am65x-dss, need to include a clock property for data edge synchronization. The current implementation does not correctly apply the data edge sampling property.
To address this, synchronization of writes to two different registers is
required: one in the TIDSS IP (which is already described in the tidss node) and one is in the Memory Mapped Control Register Modules.
As the Memory Mapped Control Register Modules is located in a different IP, we need to use a phandle to write values in its registers.
--- .../devicetree/bindings/display/ti/ti,am65x-dss.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +6 -0
@@ -133,6 +133,12 @@ properties: and OLDI_CLK_IO_CTRL registers. This property is needed for OLDI interface to work. + ti,clk-ctrl: + $ref: /schemas/types.yaml#/definitions/phandle + description: + phandle to syscon device node mapping CFG0_CLK_CTRL registers. + This property is needed for proper data sampling edge. + max-memory-bandwidth: $ref: /schemas/types.yaml#/definitions/uint32 description:
Re: [RESEND PATCH v2 1/5] dt-bindings: display: ti,am65x-dss: Add clk property for data edge synchronization
Quoted 4 lines · Swamil Jain
From: Louis Chauvet <[email protected]>
The dt-bindings for the display, specifically ti,am65x-dss, need to include a clock property for data edge synchronization. The current
clock properties are called "clocks". Please rephrase commit msg or use proper clocks to indicate you access here a clock (if that's the case).
Quoted 1 line
implementation does not correctly apply the data edge sampling property.
Where is "data edge sampling property"? I do not see it in this binding.
Quoted 2 lines
To address this, synchronization of writes to two different registers is
How this binding achieves that "synchronization"? What are you even describing here?
Quoted 4 lines
required: one in the TIDSS IP (which is already described in the tidss node) and one is in the Memory Mapped Control Register Modules.
As the Memory Mapped Control Register Modules is located in a different
And now another therm - MMCR...
This commit msg is barely parseable - language is correct but it is a mix of completely wrong terms.
In case you used LLM to write this - don't. Ever.
Quoted 4 lines
IP, we need to use a phandle to write values in its registers.
Fixes ad2ac9dc9426 ("drm/tidss: Add support for AM625 DSS")Fixes 5cc5ea7b6d7b ("drm/tidss: Add support for AM62A7 DSS")
You still did not describe the actual bug being fixed here.
Quoted 1 line
Best regards,
Krzysztof
Re: [RESEND PATCH v2 1/5] dt-bindings: display: ti,am65x-dss: Add clk property for data edge synchronization
Quoted 29 lines · Krzysztof Kozlowski
Quoted 4 lines · Swamil Jain
From: Louis Chauvet <[email protected]>
The dt-bindings for the display, specifically ti,am65x-dss, need to include a clock property for data edge synchronization. The current
clock properties are called "clocks". Please rephrase commit msg or use proper clocks to indicate you access here a clock (if that's the case).
Quoted 1 line
implementation does not correctly apply the data edge sampling property.
Where is "data edge sampling property"? I do not see it in this binding.
Quoted 2 lines
To address this, synchronization of writes to two different registers is
How this binding achieves that "synchronization"? What are you even describing here?
Quoted 4 lines
required: one in the TIDSS IP (which is already described in the tidss node) and one is in the Memory Mapped Control Register Modules.
As the Memory Mapped Control Register Modules is located in a different
And now another therm - MMCR...
This commit msg is barely parseable - language is correct but it is a mix of completely wrong terms.
Quoted 9 lines
In case you used LLM to write this - don't. Ever.
Quoted 4 lines
IP, we need to use a phandle to write values in its registers.
Fixes ad2ac9dc9426 ("drm/tidss: Add support for AM625 DSS")Fixes 5cc5ea7b6d7b ("drm/tidss: Add support for AM62A7 DSS")You still did not describe the actual bug being fixed here.
Actually, NAK, because you ignored entire previous feedback!
Best regards,
Krzysztof
PATCH RESEND v2 2/5 dt-bindings: mfd: syscon: Add ti,am625-dss-clk-ctrl
In reply to Swamil JainFrom: Louis Chauvet <[email protected]>
The dt-bindings for the multi-function device (mfd) syscon need to include ti,am625-dss-clk-ctrl. On AM62X, AM62A and AM62P devicess, the display controller (tidss) has external registers to control certain clock properties. These registers are located in the device configuration registers, so they need to be declared using syscon. They will later be used with a phandle in the tidss node.
--- Documentation/devicetree/bindings/mfd/syscon.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/mfd/syscon.yaml +2 -1
@@ -123,6 +123,7 @@ select: - ti,am62-opp-efuse-table - ti,am62-usb-phy-ctrl - ti,am625-dss-oldi-io-ctrl + - ti,am625-dss-clk-ctrl - ti,am62p-cpsw-mac-efuse - ti,am654-dss-oldi-io-ctrl - ti,j784s4-acspcie-proxy-ctrl
@@ -232,6 +233,7 @@ properties: - ti,am62-opp-efuse-table - ti,am62-usb-phy-ctrl - ti,am625-dss-oldi-io-ctrl + - ti,am625-dss-clk-ctrl - ti,am62p-cpsw-mac-efuse - ti,am654-dss-oldi-io-ctrl - ti,j784s4-acspcie-proxy-ctrl
@@ -260,4 +262,3 @@ examples: compatible = "allwinner,sun8i-h3-system-controller", "syscon"; reg = <0x01c00000 0x1000>; }; -...
Re: [RESEND PATCH v2 2/5] dt-bindings: mfd: syscon: Add ti,am625-dss-clk-ctrl
Quoted 11 lines · Swamil Jain
From: Louis Chauvet <[email protected]>
The dt-bindings for the multi-function device (mfd) syscon need to include ti,am625-dss-clk-ctrl. On AM62X, AM62A and AM62P devicess, the display controller (tidss) has external registers to control certain clock properties. These registers are located in the device configuration registers, so they need to be declared using syscon. They will later be used with a phandle in the tidss node.
Fixes ad2ac9dc9426 ("drm/tidss: Add support for AM625 DSS")Fixes 5cc5ea7b6d7b ("drm/tidss: Add support for AM62A7 DSS")
Adding missing hardware is not a fix. Drop both.
Quoted 1 line
For sure not a stable commit. You just add new hardware.
Quoted 5 lines
Signed-off-by Louis Chauvet <[email protected]>Signed-off-by Swamil Jain <[email protected]>--- Documentation/devicetree/bindings/mfd/syscon.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
With these fixed/dropped:
Best regards,
Krzysztof
Re: [RESEND PATCH v2 2/5] dt-bindings: mfd: syscon: Add ti,am625-dss-clk-ctrl
Quoted 25 lines · Krzysztof Kozlowski
Quoted 11 lines · Swamil Jain
From: Louis Chauvet <[email protected]>
The dt-bindings for the multi-function device (mfd) syscon need to include ti,am625-dss-clk-ctrl. On AM62X, AM62A and AM62P devicess, the display controller (tidss) has external registers to control certain clock properties. These registers are located in the device configuration registers, so they need to be declared using syscon. They will later be used with a phandle in the tidss node.
Fixes ad2ac9dc9426 ("drm/tidss: Add support for AM625 DSS")Fixes 5cc5ea7b6d7b ("drm/tidss: Add support for AM62A7 DSS")Adding missing hardware is not a fix. Drop both.
Quoted 1 line
For sure not a stable commit. You just add new hardware.
Quoted 5 lines
Signed-off-by Louis Chauvet <[email protected]>Signed-off-by Swamil Jain <[email protected]>--- Documentation/devicetree/bindings/mfd/syscon.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 3 lines
With these fixed/dropped:
Un-acked, NAK.
You just ignored previous feedback.
Best regards,
Krzysztof
PATCH RESEND v2 3/5 arm64: dts: ti: k3-am62-main: Add tidss clk-ctrl property
In reply to Swamil JainFrom: Louis Chauvet <[email protected]>
For am62 processors, we need to use the newly created clk-ctrl property to properly handle data edge sampling configuration. Add them in the main device tree.
--- arch/arm64/boot/dts/ti/k3-am62-main.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/ti/k3-am62-main.dtsi +6 -0
@@ -77,6 +77,11 @@ audio_refclk1: clock-controller@82e4 { #clock-cells = <0>; }; + dss_clk_ctrl: dss-clk-ctrl@8300 { + compatible = "ti,am625-dss-clk-ctrl", "syscon"; + reg = <0x8300 0x4>; + }; + dss_oldi_io_ctrl: oldi-io-controller@8600 { compatible = "ti,am625-dss-oldi-io-ctrl", "syscon"; reg = <0x8600 0x200>;
@@ -801,6 +806,7 @@ dss: dss@30200000 { <&k3_clks 186 2>; clock-names = "fck", "vp1", "vp2"; interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>; + ti,clk-ctrl = <&dss_clk_ctrl>; status = "disabled"; oldi-transmitters {
Re: [RESEND PATCH v2 3/5] arm64: dts: ti: k3-am62-main: Add tidss clk-ctrl property
Quoted 19 lines · Swamil Jain
From: Louis Chauvet <[email protected]>
For am62 processors, we need to use the newly created clk-ctrl property to properly handle data edge sampling configuration. Add them in the main device tree.
Fixes ad2ac9dc9426 ("drm/tidss: Add support for AM625 DSS")Signed-off-by Louis Chauvet <[email protected]>Signed-off-by Swamil Jain <[email protected]>--- arch/arm64/boot/dts/ti/k3-am62-main.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm64/boot/dts/ti/k3-am62-main.dtsi +0
-0
arch/arm64/boot/dts/ti/k3-am62-main.dtsi audio_refclk1: clock-controller@82e4 { · line 82
Quoted 6 lines
arch/arm64/boot/dts/ti/k3-am62-main.dtsi +3
-0@@ -77,6 +77,11 @@ audio_refclk1: clock-controller@82e4 { #clock-cells = <0>; }; + dss_clk_ctrl: dss-clk-ctrl@8300 { + compatible = "ti,am625-dss-clk-ctrl", "syscon"; + reg = <0x8300 0x4>;
Same problem as last time. Nothing improved.
NAK
Best regards,
Krzysztof
PATCH RESEND v2 4/5 arm64: dts: ti: k3-am62a-main: Add tidss clk-ctrl property
In reply to Swamil JainFor AM62A, we need to use the newly created clk-ctrl property to properly handle data edge sampling configuration. Add them in main device tree.
--- arch/arm64/boot/dts/ti/k3-am62a-main.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/ti/k3-am62a-main.dtsi +7 -0
@@ -77,6 +77,12 @@ audio_refclk1: clock-controller@82e4 { assigned-clock-parents = <&k3_clks 157 18>; #clock-cells = <0>; }; + + dss_clk_ctrl: dss-clk-ctrl@8300 { + compatible = "ti,am625-dss-clk-ctrl", "syscon"; + reg = <0x8300 0x4>; + }; + }; dmss: bus@48000000 {
@@ -1136,6 +1142,7 @@ dss: dss@30200000 { <&k3_clks 186 2>; clock-names = "fck", "vp1", "vp2"; interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>; + ti,clk-ctrl = <&dss_clk_ctrl>; status = "disabled"; dss_ports: ports {
Re: [RESEND PATCH v2 4/5] arm64: dts: ti: k3-am62a-main: Add tidss clk-ctrl property
Quoted 16 lines · Swamil Jain
For AM62A, we need to use the newly created clk-ctrl property to properly handle data edge sampling configuration. Add them in main device tree.
Fixes 5cc5ea7b6d7b ("drm/tidss: Add support for AM62A7 DSS")Signed-off-by Swamil Jain <[email protected]>--- arch/arm64/boot/dts/ti/k3-am62a-main.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)arch/arm64/boot/dts/ti/k3-am62a-main.dtsi +0
-0
arch/arm64/boot/dts/ti/k3-am62a-main.dtsi audio_refclk1: clock-controller@82e4 { · line 83
Quoted 7 lines
arch/arm64/boot/dts/ti/k3-am62a-main.dtsi +4
-0@@ -77,6 +77,12 @@ audio_refclk1: clock-controller@82e4 { assigned-clock-parents = <&k3_clks 157 18>; #clock-cells = <0>; }; + + dss_clk_ctrl: dss-clk-ctrl@8300 { + compatible = "ti,am625-dss-clk-ctrl", "syscon"; + reg = <0x8300 0x4>;
NAK, you just ignored everything which was said.
Best regards,
Krzysztof
PATCH RESEND v2 5/5 drm/tidss: Fix sampling edge configuration
In reply to Swamil JainFrom: Louis Chauvet <[email protected]>
As stated in the AM62x Technical Reference Manual (SPRUIV7B)[1], the data sampling edge needs to be configured in two distinct registers: one in the TIDSS IP and another in the memory-mapped control register modules. Since the latter is not within the same address range, a phandle to a syscon device is used to access the regmap.
Configure the CTRL_MMR register, as mentioned in the Technical Reference Manual to fix sampling edge.
[1]: https://www.ti.com/lit/ug/spruiv7b/spruiv7b.pdf
--- drivers/gpu/drm/tidss/tidss_dispc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpu/drm/tidss/tidss_dispc.c +14 -0
@@ -500,6 +500,7 @@ struct dispc_device {const struct dispc_features *feat;struct clk *fclk; +struct regmap *clk_ctrl;bool is_enabled;
@@ -1234,6 +1235,11 @@ void dispc_vp_prepare(struct dispc_device *dispc, u32 hw_videoport, mode->crtc_hdisplay - 1) |FIELD_PREP (DISPC_VP_SIZE_SCREEN_VDISPLAY_MASK , mode->crtc_vdisplay - 1)); + +if (dispc->clk_ctrl) { +regmap_update_bits (dispc->clk_ctrl,0 ,0x100 , ipc ?0x100 :0x000 ); +regmap_update_bits (dispc->clk_ctrl,0 ,0x200 , rf ?0x200 :0x000 ); + } }void dispc_vp_enable (struct dispc_device *dispc,u32 hw_videoport)
@@ -3003,6 +3009,14 @@ int dispc_init(struct tidss_device *tidss)dispc_init_errata (dispc); + dispc->clk_ctrl =syscon_regmap_lookup_by_phandle_optional (tidss->dev->of_node, +"ti,clk-ctrl" ); +if (IS_ERR (dispc->clk_ctrl)) { + r =dev_err_probe (dispc->dev,PTR_ERR (dispc->clk_ctrl), +"DISPC: syscon_regmap_lookup_by_phandle failed.\n" ); +return r; + } + dispc->fourccs =devm_kcalloc (dev,ARRAY_SIZE (dispc_color_formats),sizeof (*dispc->fourccs),GFP_KERNEL );if (!dispc->fourccs)
Re: [RESEND PATCH v2 5/5] drm/tidss: Fix sampling edge configuration
drivers/gpu/drm/tidss/tidss_dispc.c int dispc_init(struct tidss_device *tidss) · line 3017
Quoted 12 lines · Swamil Jain
void
dispc_vp_enable(struct dispc_device *dispc, u32 hw_videoport)drivers/gpu/drm/tidss/tidss_dispc.c +6
-0@@ -3003,6 +3009,14 @@ int dispc_init(struct tidss_device *tidss)dispc_init_errata (dispc); + dispc->clk_ctrl =syscon_regmap_lookup_by_phandle_optional (tidss->dev->of_node, +"ti,clk-ctrl" ); +if (IS_ERR (dispc->clk_ctrl)) { + r =dev_err_probe (dispc->dev,PTR_ERR (dispc->clk_ctrl), +"DISPC: syscon_regmap_lookup_by_phandle failed.\n" ); +return r;
NAK. Read previous comments instead of silently ignoring them.
Best regards,
Krzysztof
Re: [RESEND PATCH v2 5/5] drm/tidss: Fix sampling edge configuration
In reply to Swamil JainHello,
We tested this patch and it introduces a regression on our panel.
On our board, a Toshiba TC358768 DPI-to-DSI bridge is connected to the parallel RGB output. The bridge requires data to be driven on the negative edge, and this is also reflected by the ipc variable in dispc_vp_enable(), which is set to 1.
With this patch applied, however, data is driven on the positive edge instead.
According to SPRUIV7C, both MAIN_CTRL_MMR_CFG0_DPI0_CLK_CTRL[8] and DSS_VP1_POL_FREQ[14] IPC should be programmed consistently. However, if we follow the actual bit descriptions, and ignore the sentence saying that the two programmed values should be the same, the data is driven on the requested edge.
From SPRUIV7C (https://www.ti.com/lit/ug/spruiv7b/spruiv7c.pdf):
MAIN_CTRL_MMR_CFG0_DPI0_CLK_CTRL[8] (DPI0_CLK_CTRL_DATA_CLK_INVDIS):
Clock edge select for DPI0 data outputs
Note that this value should be the same as the programmed value of DSS_POL_FREQ[14] IPC.
Reset Source: mod_por_rst_n
0 DATA and DE are driven on the falling edge of clk 1 DATA and DE are driven on the rising edge of clk
DSS_VP1_POL_FREQ[14] (IPC)
Invert pixel clock
To set data to pixel clock relationship, CTRL_MMR_DPI0_CLK_CTRL[8] DPI0_CLK_CTRL_DATA_CLK_INVDIS setting should be the same as the [14] IPC setting.
0 Data is driven on the LCD data lines on the rising-edge of the pixel clock 1 Data is driven on the LCD data lines on the falling-edge of the pixel clock
So, the proposed fix to this patch is:
```diff - regmap_update_bits(dispc->clk_ctrl, 0, 0x100, ipc ? 0x100 : 0x000); + regmap_update_bits(dispc->clk_ctrl, 0, 0x100, ipc ? 0x000 : 0x100); ```
Reverting the patch also makes the Toshiba bridge work correctly again. However, we can confirm that the patch is needed, otherwise only the positive-edge case (our case) works correctly.
In other words, the two registers need to match semantically, not numerically.
Please ignore the previous email I sent:
https://lore.kernel.org/all/[email protected]/
I hadn't seen this more recent thread at the time.
Re: [RESEND PATCH v2 5/5] drm/tidss: Fix sampling edge configuration
Hi Leonardo,
Quoted 42 lines · Leonardo Costa
Hello,
We tested this patch and it introduces a regression on our panel.
On our board, a Toshiba TC358768 DPI-to-DSI bridge is connected to the parallel RGB output. The bridge requires data to be driven on the negative edge, and this is also reflected by the
ipcvariable indispc_vp_enable(), which is set to1.With this patch applied, however, data is driven on the positive edge instead.
According to SPRUIV7C, both
MAIN_CTRL_MMR_CFG0_DPI0_CLK_CTRL[8]andDSS_VP1_POL_FREQ[14] IPCshould be programmed consistently. However, if we follow the actual bit descriptions, and ignore the sentence saying that the two programmed values should be the same, the data is driven on the requested edge.Quoted 1 line
From SPRUIV7C (https://www.ti.com/lit/ug/spruiv7b/spruiv7c.pdf):
MAIN_CTRL_MMR_CFG0_DPI0_CLK_CTRL[8] (
DPI0_CLK_CTRL_DATA_CLK_INVDIS):Clock edge select for DPI0 data outputs
Note that this value should be the same as the programmed value of DSS_POL_FREQ[14] IPC.
Reset Source:
mod_por_rst_n0 DATA and DE are driven on the falling edge of clk 1 DATA and DE are driven on the rising edge of clk
DSS_VP1_POL_FREQ[14] (IPC)
Invert pixel clock
To set data to pixel clock relationship, CTRL_MMR_DPI0_CLK_CTRL[8]
DPI0_CLK_CTRL_DATA_CLK_INVDISsetting should be the same as the [14] IPC setting.0 Data is driven on the LCD data lines on the rising-edge of the pixel clock 1 Data is driven on the LCD data lines on the falling-edge of the pixel clock
Quoted 7 lines
So, the proposed fix to this patch is:
```diff - regmap_update_bits(dispc->clk_ctrl, 0, 0x100, ipc ? 0x100 : 0x000); + regmap_update_bits(dispc->clk_ctrl, 0, 0x100, ipc ? 0x000 : 0x100); ```
Thanks for the suggestion, Tomi is trying to fix this issue, please have
a look: https://lore.kernel.org/all/[email protected]/
Regards,
Swamil.
Quoted 10 lines
Reverting the patch also makes the Toshiba bridge work correctly again. However, we can confirm that the patch is needed, otherwise only the positive-edge case (our case) works correctly.
In other words, the two registers need to match semantically, not numerically.
Please ignore the previous email I sent:
https://lore.kernel.org/all/[email protected]/
I hadn't seen this more recent thread at the time.
PATCH 1/1 drm/bridge: tc358768: Enforce input bus flags via atomic_check
In reply to Swamil JainFrom: Leonardo Costa <[email protected]>
The tc358768 declares static bridge timings requiring pixel data to be sampled on the positive clock edge.
However, the DRM core default propagation simply copies the output-side bus flags, coming from the next bridge, connector or panel, to the input side. If the propagated flags are incompatible with the bridge ones, the data is wrongly sampled, typically resulting in visual artifacts on the panel.
Implement the atomic_check hook, replacing the mutually exclusive mode_fixup, and set the bridge state input bus flags to the ones required by the tc358768. The sync polarity defaulting previously done in mode_fixup is carried over into atomic_check unchanged.
--- drivers/gpu/drm/bridge/tc358768.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/gpu/drm/bridge/tc358768.c +10 -5
@@ -1262,10 +1262,13 @@ tc358768_atomic_get_input_bus_fmts(struct drm_bridge *bridge,return input_fmts; } -static bool tc358768_mode_fixup (struct drm_bridge *bridge, -const struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode) +static int tc358768_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) { +struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode; +/* Default to positive sync */ if (!(adjusted_mode->flags &
@@ -1276,13 +1279,15 @@ static bool tc358768_mode_fixup(struct drm_bridge *bridge, (DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NVSYNC))) adjusted_mode->flags |=DRM_MODE_FLAG_PVSYNC ; -return true; + bridge_state->input_bus_cfg.flags = bridge->timings->input_bus_flags; + +return 0 ; }static const struct drm_bridge_funcs tc358768_bridge_funcs = { .attach = tc358768_bridge_attach, .mode_valid = tc358768_bridge_mode_valid, - .mode_fixup = tc358768_mode_fixup, + .atomic_check = tc358768_bridge_atomic_check, .atomic_pre_enable = tc358768_bridge_atomic_pre_enable, .atomic_enable = tc358768_bridge_atomic_enable, .atomic_disable = tc358768_bridge_atomic_disable,
Re: [PATCH] drm/bridge: tc358768: Enforce input bus flags via atomic_check
Hello,
Quoted 50 lines
The tc358768 declares static bridge timings requiring pixel data to be sampled on the positive clock edge.
However, the DRM core default propagation simply copies the output-side bus flags, coming from the next bridge, connector or panel, to the input side. If the propagated flags are incompatible with the bridge ones, the data is wrongly sampled, typically resulting in visual artifacts on the panel.
Implement the
atomic_checkhook, replacing the mutually exclusivemode_fixup, and set the bridge state input bus flags to the ones required by the tc358768. The sync polarity defaulting previously done inmode_fixupis carried over intoatomic_checkunchanged.Fixes ff1ca6397b1d ("drm/bridge: Add tc358768 driver")Signed-off-by Leonardo Costa <[email protected]>--- drivers/gpu/drm/bridge/tc358768.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)drivers/gpu/drm/bridge/tc358768.c +9
-4@@ -1262,10 +1262,13 @@ tc358768_atomic_get_input_bus_fmts(struct drm_bridge *bridge,return input_fmts; } -static bool tc358768_mode_fixup (struct drm_bridge *bridge, -const struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode) +static int tc358768_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) { +struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode; +/* Default to positive sync */ if (!(adjusted_mode->flags &@@ -1276,13 +1279,15 @@ static bool tc358768_mode_fixup(struct drm_bridge *bridge, (DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NVSYNC))) adjusted_mode->flags |=DRM_MODE_FLAG_PVSYNC ; -return true; + bridge_state->input_bus_cfg.flags = bridge->timings->input_bus_flags; + +return 0 ;
drivers/gpu/drm/bridge/tc358768.c static bool tc358768_mode_fixup(struct drm_bridge *bridge, · line 1293
Quoted 10 lines
drivers/gpu/drm/bridge/tc358768.c +1
-1}static const struct drm_bridge_funcs tc358768_bridge_funcs = { .attach = tc358768_bridge_attach, .mode_valid = tc358768_bridge_mode_valid, - .mode_fixup = tc358768_mode_fixup, + .atomic_check = tc358768_bridge_atomic_check, .atomic_pre_enable = tc358768_bridge_atomic_pre_enable, .atomic_enable = tc358768_bridge_atomic_enable, .atomic_disable = tc358768_bridge_atomic_disable,
Please ignore this, as it was not meant to be sent in reply to the thread above. That was an accident.