T113 TCON Top tinting troubleshooting
Subsystems (5)
Hello,
On the T113 (and most likely the D1) sometimes the RGB LCD output has strange artifacts such as:
- A blue tint
- A mostly opaque green tint
- A red tint
- A pink tint
The actual tint seems to differ between boards or chips, and has some probability of showing up that can range from 50% to 90%.
After a week or so of troubleshooting I've managed to figure out what's happening here, and I'm not too sure how to fix it.
It appears that the TCON Top on this chip can't mux both mixers to a shared output. The R40 (and H6?) allows this and prioritizes the DE0 when muxing, but on the T113 it seems to cause graphical artifacts. Disabling DE1 in the device tree can help but doesn't solve the problem entirely.
Here's a change that tests this behaviour, it sets DE1 to output to TVE0. DE0 then outputs to LCD0 as usual. I would appreciate if anyone with this issue can test the above workaround on their boards.
There was a previous discussion here:
https://groups.google.com/g/linux-sunxi/c/HxDBpY5HbbQ/m/mX2O2OYlCwAJ
---8<--- CUT HERE ---8<---
drivers/gpu/drm/sun4i/sun8i_tcon_top.c +1 -1
@@ -179,7 +179,7 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master,* At least on H6, some registers have some bits set by default * which may cause issues. Clear them here. */ -writel (0 , regs +TCON_TOP_PORT_SEL_REG ); +writel (0x20 , regs +TCON_TOP_PORT_SEL_REG );writel (0 , regs +TCON_TOP_GATE_SRC_REG );/*
---8<--- CUT HERE ---8<---
The sunxi display code works around this issue by ensuring DE0 and DE1 never map to the same output: If you have DE0 set to TVE0 and DE1 set to LCD0, then tell it to set DE0 to LCD0, it will silently swap TVE0 on to DE1.
I'm probably going to send a patch that copies this behaviour as it should just work, but I'd be interested to see if there's anything I'm missing.
John.
A message that is not in the archive (sent off-list or not yet received): CALP2yXcUrCdzyqQx7RQUup3QjfbH4VnMVCPFVXNmmd08GJkKMQ@mail.gmail.com
Quoted 9 lines · Jakob L
Hi John,
good find! This seems to fix it on my DSI implementation. Every of the recent boots resulted in a pink tint (usually it was green for me, or blue) Booted 10 times - no tint.
So this patch is good, but probably has to be implemented as a quirk?
Jakob
Hi Jakob,
I'm not sure if this needs to be a quirk: There's not really a reason to set both DEs to the same output. My thinking right now is to error in this situation.
However I think we have to somehow track which DEs have been set so we can pretend they start unset. For example:
DE0: (Unset, LCD0) DE1: (Unset, TVE0)
Setting DE0 to LCD0 should work, then setting DE1 to LCD0 should fail. Setting DE0 to LCD0 should work, then setting DE0 to TVE0 should work. Setting DE0 to TVE0 should work, then setting DE1 to TVE0 should fail.
The mechanism here for setting a DE I think would go like this:
1. Check the opposite DE's value
2. If it is duplicate and set, error
3. If it is duplicate and unset, change the opposite DE's value
4. Set the DE
5. Mark it as set
Step three requires finding an unused DE value, this could be done by inverting the bits of the new DE. Alternatively we could do what Allwinner does and start with both DEs at different values and the move instead the current DE value to the opposite DE to avoid conflicts.
'Set' here may make more sense as 'used'.
I'm good at mentally over-engineering things, so if you can think of a better solution please tell me.
John.
A message that is not in the archive (sent off-list or not yet received): CAMBcuYNG6n1_yc0-5MSFoh2xCfh3-tHG7VcQq5vY65RKSq39RA@mail.gmail.com
Hi,
Quoted 13 lines · Kirby Nankivell
Tested this on a MangoPI-MQ-R with a RGB lcd and can confirm that this fix removes the green tint I experienced.
Disabling the mixer1 in DTS entirely also works.
I suspect on the basis that the Mixer/TCON-TOP topology is identical to the R40 but does not seem to experience this issue, that is a silicon errata specific to the T113/D1s as far as we currently know.
However, there is no functional reason from a drm perspective to require more than one mixer tied to one output via tcon-top - unless someone has a good argument here?
Quoted 5 lines
in my opinion:
1) implement this as a quirk on the t113 and fix mixer0 > rgb/dsi and mixer1 > tv0
2) make this a global default for the sun8i tcon top driver where only one mixer is initialised against an output (which would also impact the R40)
The only reason I caught this issue was because I implemented LCD output in U-Boot and saw it looked a little better- I thought the tint was the backlight. Had you not contacted me and had it not affected the person I'm doing work for I would not have bothered looking in to this.
It's entirely possible that the other supported devices have this issue, or that future ones will and nobody will notice.
Going with a preventative approach here by fixing it for all potential devices and relying on the behaviour the sunxi code assumes rather than the datasheet says seems like the best approach to me.
John.
Hi John,
i am pretty sure other devices don't have this. At least i have never seen it on V3s, A20, A33, H3, A64 with RGB, HDMI, LVDS, or Mipi. This was the first - and on MIPI its pretty bad, to a point where its not usable.
With the allwinner u-boot from BSP i had not experience that tint - but i assumed it to be somewhere in the wrong Mipi packager or DMA setup.
Since i am not very experience with mainline contributions i am not sure what is the best approach. While i agree that ideally its done right on all sunxi devices, the risk of breaking something without need should be avoided?
All the best
Jakob
Am Sa., 29. Juni 2024 um 23:01 Uhr schrieb John Watts <[email protected]>:
Quoted 35 lines
Hi,
Quoted 13 lines · Kirby Nankivell
Tested this on a MangoPI-MQ-R with a RGB lcd and can confirm that this fix removes the green tint I experienced.
Disabling the mixer1 in DTS entirely also works.
I suspect on the basis that the Mixer/TCON-TOP topology is identical to the R40 but does not seem to experience this issue, that is a silicon errata specific to the T113/D1s as far as we currently know.
However, there is no functional reason from a drm perspective to require more than one mixer tied to one output via tcon-top - unless someone has a good argument here?
Quoted 5 lines
in my opinion:
1) implement this as a quirk on the t113 and fix mixer0 > rgb/dsi and mixer1 > tv0
2) make this a global default for the sun8i tcon top driver where only one mixer is initialised against an output (which would also impact the R40)The only reason I caught this issue was because I implemented LCD output in U-Boot and saw it looked a little better- I thought the tint was the backlight. Had you not contacted me and had it not affected the person I'm doing work for I would not have bothered looking in to this.
It's entirely possible that the other supported devices have this issue, or that future ones will and nobody will notice.Going with a preventative approach here by fixing it for all potential devices and relying on the behaviour the sunxi code assumes rather than the datasheet says seems like the best approach to me.
John.