Issue: 7" Touchscreen does not start correctly with DSI transactions
Observed on: https://github.com/raspberrypi/linux/tree/rpi-4.15.y Issue also seen with earlier kernels.
Issue is not present on 4.09.x branch.
Tested with Rpi3 and Rpi 7" Touchscreen panel Tested with 4.15.17 from: https://github.com/raspberrypi/linux/
Raising here - to see if this behaviour is observed by others and/or someone can shed any light as to what's broken on the later kernels The DSI transaction patch is required (see below) to force 7" panel to initialze using DSI and not I2C. I2C support is a quirk of this specific panel
A working vc4_dsi is needed to be able to support initialization of other display devices on the 15way DSI connector.
Steps to reproduce: Enable raspberrypi touchscreen driver in devicetree (e.g. https://github.com/anholt/linux/commit/d7fc047316747d3ed4824c69cc34839adbeedc7d) Enable DSI transactions to startup the panel (e.g. https://github.com/anholt/linux/commit/1d460b1367d46f1b745771576d1cbd0d24698d4f)
Build kernel and apply to stock raspbian image.
Configure the firmware to not load support for LCD's and touch panels: Configure the devicetree to load the open source drivers: (make the following changes to /boot/config.txt)
dtoverlay=vc4-kms-v3d
ignore_lcd=1
Expected result 7" panel should be initialized using DSI commands sent using DSI1 on the 15way display connector 7" panel should show correctly display image frames.
Actual result: Panel is not started correctly. Often the device is initialized with random vertical lines. We see that the panel does get probed and in a version we have with extended vc4_dsi logging -> we see that the dsi sub-systems appear to be configured with the same settings (DSI1_CTL, DSI1_PHY, DSI1_PHY_AFEC0, etc) as a working device
dmesg is littered with errors:
[drm:vc4_dsi_host_transfer [vc4]] *ERROR* DSI transfer failed, resetting: -110
Relevant parts of dmesg ?:
[ 0.000000] Linux version 4.15.17-v7+ (ec2-user@ip-172-31-3-70) (gcc version 4.7.1 20120402 (prerelease) (crosstool-NG 1.15.2)) #7 SMP Wed Apr 18 18:56:41 UTC 2018
[ 0.090320] raspberrypi-firmware soc:firmware: Attached to firmware from 2018-04-16 18:16
[ 3.624797] vc4_hdmi 3f902000.hdmi: vc4-hdmi-hifi <-> 3f902000.hdmi mapping ok
[ 3.647006] vc4-drm soc:gpu: bound 3f902000.hdmi (ops vc4_hdmi_ops [vc4])
[ 3.648643] vc4-drm soc:gpu: bound 3f806000.vec (ops vc4_vec_ops [vc4])
[ 3.684381] vc4-drm soc:gpu: failed to bind 3f700000.dsi (ops vc4_dsi_ops [vc4]): -517
[ 3.687102] vc4-drm soc:gpu: master bind failed: -517
[ 3.923917] vc4_hdmi 3f902000.hdmi: vc4-hdmi-hifi <-> 3f902000.hdmi mapping ok
[ 3.930640] vc4-drm soc:gpu: bound 3f902000.hdmi (ops vc4_hdmi_ops [vc4])
[ 3.930877] vc4-drm soc:gpu: bound 3f806000.vec (ops vc4_vec_ops [vc4])
[ 3.936229] vc4-drm soc:gpu: bound 3f700000.dsi (ops vc4_dsi_ops [vc4])
[ 3.936381] vc4-drm soc:gpu: bound 3f400000.hvs (ops vc4_hvs_ops [vc4])
[ 3.936683] vc4-drm soc:gpu: bound 3f206000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 3.936913] vc4-drm soc:gpu: bound 3f207000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 3.937165] vc4-drm soc:gpu: bound 3f807000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 3.958831] vc4-drm soc:gpu: bound 3fc00000.v3d (ops vc4_v3d_ops [vc4])
[ 3.960315] [drm] Initialized vc4 0.0.0 20140616 for soc:gpu on minor 0
[ 5.031745] vc4_dsi 3f700000.dsi: transfer interrupt wait timeout
[ 5.031755] vc4_dsi 3f700000.dsi: instat: 0x00000000
[ 5.031868] [drm:vc4_dsi_host_transfer [vc4]] *ERROR* DSI transfer failed, resetting: -110
[ 6.071732] vc4_dsi 3f700000.dsi: transfer interrupt wait timeout
[ 6.071742] vc4_dsi 3f700000.dsi: instat: 0x00000000
[ 6.071822] [drm:vc4_dsi_host_transfer [vc4]] *ERROR* DSI transfer failed, resetting: -110
[ 7.111729] vc4_dsi 3f700000.dsi: transfer interrupt wait timeout
[ 7.111737] vc4_dsi 3f700000.dsi: instat: 0x00000000
[ 7.111817] [drm:vc4_dsi_host_transfer [vc4]] *ERROR* DSI transfer failed, resetting: -110
[ 8.151737] vc4_dsi 3f700000.dsi: transfer interrupt wait timeout
[ 8.151747] vc4_dsi 3f700000.dsi: instat: 0x00000000
[ 8.151825] [drm:vc4_dsi_host_transfer [vc4]] *ERROR* DSI transfer failed, resetting: -110
[ 9.191730] vc4_dsi 3f700000.dsi: transfer interrupt wait timeout
[ 9.191738] vc4_dsi 3f700000.dsi: instat: 0x00000000
[ 9.191818] [drm:vc4_dsi_host_transfer [vc4]] *ERROR* DSI transfer failed, resetting: -110
[ 10.231732] vc4_dsi 3f700000.dsi: transfer interrupt wait timeout
[ 10.231741] vc4_dsi 3f700000.dsi: instat: 0x00000000
[ 10.231819] [drm:vc4_dsi_host_transfer [vc4]] *ERROR* DSI transfer failed, resetting: -110
[ 11.271730] vc4_dsi 3f700000.dsi: transfer interrupt wait timeout
[ 11.271738] vc4_dsi 3f700000.dsi: instat: 0x00000000
[ 11.271816] [drm:vc4_dsi_host_transfer [vc4]] *ERROR* DSI transfer failed, resetting: -110
[ 12.311727] vc4_dsi 3f700000.dsi: transfer interrupt wait timeout
[ 12.311735] vc4_dsi 3f700000.dsi: instat: 0x00000000
[ 12.311816] [drm:vc4_dsi_host_transfer [vc4]] *ERROR* DSI transfer failed, resetting: -110
[ 13.351736] vc4_dsi 3f700000.dsi: transfer interrupt wait timeout
[ 13.351746] vc4_dsi 3f700000.dsi: instat: 0x00000000
[ 13.351835] [drm:vc4_dsi_host_transfer [vc4]] *ERROR* DSI transfer failed, resetting: -110
[ 14.551728] vc4_dsi 3f700000.dsi: transfer interrupt wait timeout
[ 14.551736] vc4_dsi 3f700000.dsi: instat: 0x00000000
[ 14.551817] [drm:vc4_dsi_host_transfer [vc4]] *ERROR* DSI transfer failed, resetting: -110
[ 15.591729] vc4_dsi 3f700000.dsi: transfer interrupt wait timeout
[ 15.591737] vc4_dsi 3f700000.dsi: instat: 0x00000000
[ 15.591817] [drm:vc4_dsi_host_transfer [vc4]] *ERROR* DSI transfer failed, resetting: -110
Other information:
If we do not set: "ignore_lcd=1" ; then the firmware appears to initialize the panel and the vc4_dsi sub-system.
With this, the open source drivers try to setup the panel, but the DSI transactions fail (presumably - due to firmware taking interrupts, etc from vc4)
The kernel will continue to establish the video sub-system and the display works.
I suspect that there is a downstream resource which is not being configured/started for the vc4_dsi sub-system to work properly.
We've done what investigation we can to debug this - but have run out of ideas ;)
I suspect this needs to be reporting on Eric Anholt's github tracker for vc4 kms - this is not something we currently deal with here.
Thanks for the comment. I've been in touch with @anholt about this issue. He checked on his upstream kernel version and the panel seems to be functioning ok. On the rpi kernel it's not.
If I need to raise it somewhere else -> happy to do so.
Hmmm. Not sure then. Whilst I often deal with the panel stuff, I don't use the kms driver at all, I'm all at the VC4 firmware level.
I dug into this a little more.... perhaps your knowledge of vc4_dsi and the firmware drivers might help us isolate what's going on. I enabled some extra vc4 register logs around the DSI writes. Here's the vc4 status before we write:
[ 12.301971] [drm] 0x0000 (DSI1_CTRL): 0x00002801 [ 12.301975] [drm] 0x0038 (DSI1_STAT): 0x00000000 [ 12.301980] [drm] 0x003c (DSI1_HSTX_TO_CNT): 0x00000000 [ 12.301985] [drm] 0x0040 (DSI1_LPRX_TO_CNT): 0x00ffffff [ 12.301990] [drm] 0x0044 (DSI1_TA_TO_CNT): 0x000186a0 [ 12.301994] [drm] 0x0048 (DSI1_PR_TO_CNT): 0x000186a0 [ 12.301999] [drm] 0x0028 (DSI1_DISP0_CTRL): 0x0003101d [ 12.302004] [drm] 0x002c (DSI1_DISP1_CTRL): 0x00000005 [ 12.302008] [drm] 0x0030 (DSI1_INT_STAT): 0x00000000 [ 12.302013] [drm] 0x0034 (DSI1_INT_EN): 0x00003fc0 [ 12.302018] [drm] 0x004c (DSI1_PHYC): 0x00550001 [ 12.302022] [drm] 0x0050 (DSI1_HS_CLT0): 0x04201028 [ 12.302027] [drm] 0x0054 (DSI1_HS_CLT1): 0x00008070 [ 12.302032] [drm] 0x0058 (DSI1_HS_CLT2): 0x000f4240 [ 12.302036] [drm] 0x005c (DSI1_HS_DLT3): 0x01a0e030 [ 12.302041] [drm] 0x0060 (DSI1_HS_DLT4): 0x00008040 [ 12.302046] [drm] 0x0064 (DSI1_HS_DLT5): 0x004c4b40 [ 12.302051] [drm] 0x0068 (DSI1_HS_DLT6): 0x1e061806 [ 12.302055] [drm] 0x006c (DSI1_HS_DLT7): 0x000186a0 [ 12.302060] [drm] 0x0070 (DSI1_PHY_AFEC0): 0xdb6c0777 [ 12.302065] [drm] 0x0074 (DSI1_PHY_AFEC1): 0x00000000 [ 12.302070] [drm] 0x008c (DSI1_ID): 0x00647369 [ 12.302074] [drm] 0x0088 (DSI1_PHY_FIFO_STAT): 0x00020002 [ 12.302079] [drm] 0x0078 (DSI1_TST_SEL): 0x00000000 [ 12.302083] [drm] 0x007c (DSI1_TST_MON): 0x00000000 [ 12.302088] [drm] 0x0080 (DSI1_PHY_TST1): 0x00647369 [ 12.302093] [drm] 0x0084 (DSI1_PHY_TST2): 0x00647369
When we make the write -> the DSI1_PHY_FIFO_STAT moves from 0x00020002 to 0x00020060
I don't have the traces to hand, but on 4.9.60 I was sure that around the write, I saw a corresponding change of state to DSI1_STAT (indicating that the HW block is doing something).
In the later versions -> this doesn't seem to happen. It's like some downstream or dependent HW is maybe not correctly configured, OR vc4_dsi is not properly enabled. Any ideas ?
Hmm, nothing jumping out - I'd have to dig in to the DSI driver code on the VC4 to see how it compares. - from a DSI screen driver POV I just called the DSI driver and it does 'the right things'. I'll take a look.
Something a bit odd - in the trace above the DSI1_PHY_FIFO_STAT register appears to be 0x88, however, according to the code I have, that's actually the DSI1 ID register, which is a RO register containing 0x64736931.
I'll need to cross reference against the kms driver or wherever this DSI driver is - to save time, do you know where the github for it is?
Colleague just mentioned that there are known missing DT entries in this PR that you should probably merge in. Might help, might not, still doesn't explain why that STAT register appears to be wrong.
https://github.com/raspberrypi/linux/pull/2374
Ah, its possible my docs are out of date and an extra register was added after the docs were finalised. No idea what that register does, but might not be an issue. So please try the PR referenced above to see if that fixes the problem.
Hi - the commit you mention here: #2374 is equivalent to the patch I listed above as the prerequisite:
Enable raspberrypi touchscreen driver in devicetree (e.g. anholt/linux@1d460b1) https://github.com/anholt/linux/commit/d7fc047316747d3ed4824c69cc34839adbeedc7d
This patch sets-up the needed I2C channels and triggers DT to load the 7" panel driver. We need that on top of the current "stock" 4.15 kernel so that the driver gets loaded.
For the kernel version which these logs came from The VCS_DSI driver is here: https://github.com/raspberrypi/linux/blob/rpi-4.15.y/drivers/gpu/drm/vc4/vc4_dsi.c The panel driver is here: https://github.com/raspberrypi/linux/blob/rpi-4.15.y/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
Please note: The panel driver has a patch (referenced at the top of the issue) to enable DSI transactions for the initialization: anholt/linux@1d460b1
I've got some time this week to look into this. Is there anything else I can do to help, try, etc. Just let me know.
Has anyone else been able to reproduce this ?
Can you compare the two kernel trees (Anholt, Pi) for any obvious differences in this area?
@JamesH65 , sorry for the delay. I'm not in a position where I can get Eric's kernel to build and run in my environment... (kernel config issues, etc)... So it's difficult for me to check. I've done a visual comparison on the key areas -> but nothing springs out.
I would like to be able to verify that the DSI hardware is correctly powered ? Since the internal state machines don't seem to change when you write to the module, I'm wondering if there is a power or clock issue burred somewhere (like the power for the DSI block is not enabled). Is there anyway I can check this from the firmware ?
Ok - I got to the bottom of the issue. A mix of devicetree changes against miss-matched configs (bcm2709_defconfig vs bcm2835_defconfig) needed to enable this properly. I have a patch set - which enables DeviceTree for the VC4 DSI encoder and provides a separate overlay to enable the 7" panel, based on 4.15.17 kernel version. I suspect any later kernels will need the same DT support added.
I only verified this in RPI 3 ModelB, with the 7" RPI panel.
Patch is attached here - for ease:
0001-Update-devicetree-to-enable-7-touchscreen-Panel.patch.txt
@k-quigley Did you send this in as a Pull Request on our kernel tree? It will be more easily dealt with there.
Enabling the DSI in the overlay in the current tree means that the DRM driver will fail to probe if the DSI panel is not present.
I'm trying to bring up the Texas SN65DSI83 DSI to LVDS bridge chip from an R-Pi 3B, and I think I 'm nearl there - with very many thanks to anholt and quigley I've made panel-texas-sn65dsi83.c (based on panel-raspberrypi-touchscreen.c) and got the DT more or less right. config.txt has ignore_lcd=1 and disable_touchscreen=1 Probe is being called, and the i2c bus is working (reading chip ID correctly, confirmed on a logic analyser), drm_panel_add() appears successful - dmesg | grep texas gives: [ 10.217844] panel-texas-sn65dsi83 3f700000.dsi.0: Entering probe [ 10.217852] panel-texas-sn65dsi83 3f700000.dsi.0: About to get i2c [ 10.217899] panel-texas-sn65dsi83 3f700000.dsi.0: About to read bridge chip [ 10.218543] panel-texas-sn65dsi83 3f700000.dsi.0: Bridge chip I2C probed OK. [ 10.218553] panel-texas-sn65dsi83 3f700000.dsi.0: About to dsi_attach [ 10.218583] driver: 'panel-texas-sn65dsi83': driver_bound: bound to device '3f700000.dsi.0' [ 10.218681] bus: 'mipi-dsi': really_probe: bound device 3f700000.dsi.0 to driver panel-texas-sn65dsi83
However, 'enable' is not being called and, no packets are visible on the PHY Can one of you help me work out what I need to do to 'enable' PHY activity? I bet it is something obvious...
Update:
- I now realise 'enable' not not being called mainly means the bridge chip won't get set up - I can fix that later.
- Looking in dmesg in more detail I see the device attempts to bind, but then fails: [ 10.187673] bus: 'mipi-dsi': really_probe: bound device 3f700000.dsi.0 to driver panel-texas-sn65dsi83 [ 10.187779] vc4-drm soc:gpu: bound 3f700000.dsi (ops vc4_dsi_ops [vc4]) [ 10.187857] vc4-drm soc:gpu: binding vc4_dsi (ops vc4_dsi_ops [vc4]) [ 10.187941] vc4-drm soc:gpu: failed to bind vc4_dsi (ops vc4_dsi_ops [vc4]): -19 [ 10.187961] device: '3f700000.dsi.0': device_unregister [ 10.188016] bus: 'mipi-dsi': remove device 3f700000.dsi.0 [ 10.189162] device: 'MAI': device_unregister [ 10.232090] vc4-drm soc:gpu: master bind failed: -19 [ 10.232136] vc4-drm: probe of soc:gpu rejects match -19 Which I think looks like a device-tree error - but I have to confess to being a bit confused by interplay between vc4, dsi, and the mutually pointing endpoints between the i2c stuff and the dsi stuff. Is there a post somewhere which would help me get my thinking clear on this? I have taken the liberty of attaching my device tree in case some kind soul can help! dt_from_fs.txt
I am now 99% certain my problem is that the DSI hardware is not powering up. The lane lines are floating. Hardware is good, in that if I connect an 'official' display, it comes on. Have you got any tips on debugging the power enabling side of the devicetree entries? I have very carefully added the changes K Quigley has so kindly provided, but guess I'm still missing something.
I encountered a similar issue. I worked out that the DSI HW wasn’t “active” since after a write to the control registers, nothing seemed to change. The device-tree was missing the entries which triggered the DSI logical blocks to be powered. Maybe the patchset I did – didn’t cover all the RPI HW/chipset possibilities ?
Here is the part of the patch which does this:
diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi
index e36c392a2b8f..17ad89b5b57f 100644
--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi
+++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi
@@ -101,8 +101,10 @@
&dsi0 {
power-domains = <&power RPI_POWER_DOMAIN_DSI0>;
+ status = "okay";
};
&dsi1 {
power-domains = <&power RPI_POWER_DOMAIN_DSI1>;
+ status = "okay";
};
The display sub-system on the project we’re working on -> is on my list to come back to this week. I’ll post an update with my progress
Hope this helps.