-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue: 7" Touchscreen does not start correctly with DSI transactions #2521
Comments
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. |
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:
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. |
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:
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 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 However, 'enable' is not being called and, no packets are visible on the PHY |
Update:
|
I am now 99% certain my problem is that the DSI hardware is not powering up. The lane lines are floating. |
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:
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. |
Hi, I have built a circuit based on Texas SN65DSI83 DSI to LVDS chip however I havent wired yet. Have you tried to use demo function of SN65DSI83? Is it working properly. I am planning to finalize wiring in a week or so. Thanks |
Hi k-quigley Would you by any chance be able to send me a dump of your working flattened devicetree so I can compare with mine? |
Hi Boatbodger, I am using TXS0102DCT for I2C level shifting. The schematic is like below. However I havent tried it yet. I bought 2 chips. Soldering of them was quite hard for me because it was the first time I have soldered something which is 0,5mm pitch. First 2 sides I soldered in horrible way but the other 2 are perfect. I havent wired yet but I believe it wont work, most probably I damaged the bridge chip during soldering. I dont have an ocilator with me currently, I think I will bypass this feature and try to initialize display from RPI. Following weeks I will be travelling, so I dont beleive I can work more. However if I can get result till Friday, I will take the screen with me to focus on kernel driver. If it is possible, can you share the I2C level shifting and protection with more detail? |
@boatbodger please see below the flattened device tree from my Pi3 (Linux raspberrypi 4.15.17-v7+) with the changes enabled to run the Rpi7" display. |
For level shifting, we use an approach similar to this - for BiDirectional level shiters (available as IC's too) |
I am planning to use the Raspberry Pi Model B to power up a MIPI display, TM050JDHG33, which use the driver IC ILI9881C. I would like to seek the opinion of enabling this display from the Raspberry Pi Model B, and can we apply the following work flow for this application? a. Use the kernel v4.20.y code reference, panel-ilitek-ili9881c.c (https://github.com/raspberrypi/linux/blob/rpi-4.20.y/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c ) or panel-raydium-rm68200.c (https://github.com/raspberrypi/linux/blob/rpi-4.20.y/drivers/gpu/drm/panel/panel-raydium-rm68200.c ) as reference and put TM050JDHG33 ili9881 initialization code to newly created driver “panel-tm050jdhg33.c“ b. build the kernel with this driver and update to the system. c. Configure the firmware to load this driver using the MIPI-DSI interface in the “config.txt”, dtoverlay=vc4-kms-v3d Anything else I need to do to enable this driver? Any suggestion? |
Has someone managed to make this work with the 4.19 kernel? I tried porting the DT entries without success. |
Hi tdaniel22, |
|
Hi,
can you tell me how the entry
display0 = "/chosen/framebuffer@3eb79000";
I’m not in-front of my debugging platform… where I have the entire FDT dropped out. If I get time, I’ll dig into it and check.
Did your implementation require vc4 to be used? Is it necessary? (I'm not doing gaming!)
You need the VC4 sub-system to enable the DSI interface. As I understand the HW pipeline – you can’t just enable vc4_dsi so the whole GPU needs to be enabled. I think this is a module – pulled in by the DT… (but I’m not 100% sure)
On my kernel, when vc4 tries to load it throws
[drm:vc4_dsi_bind [vc4]] ERROR Failed to get DMA channel: -19
I'm currently rebuilding the kernel with DMA-API debugging enabled, which may give me some clues, but I'd very much appreciate your comments on the above.
Thanks in advance
I have seen this as a transitional issue – and at most after two reboots this does away. This is an issue which I need to have solved in my application, but I have not had time to find a fix/check later kernels. If you get to the bottom of this one – let me know ☺
I hope this helps…
Regards
kevin
|
That is added automatically by the firmware if it determines that |
Many thanks, Kevin and Phil.
If I use the pi3-disable-bt overlay, the DMA error disappears, but then we just get a couple more EPROBE_DEFER errors, all ultimately resulting in Any hints on how I can further debug this? |
OK - the bind failure was due to a very well hidden error in the device tree (slight mis-placement of one of the two matching port {} statements). |
I've determined that the transfer interrupt timeouts result from trying to set the DSI up directly from my driver, which turns out to be un-necessary (even though that is what panel-raspberrypi-touchscreen.c does). |
Today I sat down and carried out around 30 reboots - a mix of soft (sudo reboot) and hard (pull the power). I have attached a text file with extracts from dmesg output for half of them. The number of -517's varies between zero and four. |
Your symptoms suggest that something is claiming a DMA channel while probing and then failing to free it when the probe fails. After a few iterations it's leaked more channels than you have spare, so something fails. That fact that you get different numbers of -517 (-EPROBE_DEFER) errors supports my theory that device probing order is essentially random. It's a sad fact that these errors are how probing is supposed to work (although the error messages should be suppressed), the idea being that by retrying previously deferred probes after each subsequent driver is loaded you will eventually get to a working system. Unless something is genuinely missing or broken, in which case it will just silently wait forever. Seeing your errors jogged my memory of a suggestion that the bcm2835-sdhost driver had such a leak (it was fixed in other SD card drivers, but the downstream sdhost driver was missed). Indeed there was a leak there that I've just fixed in rpi-4.19.y. If you're up for building your own kernel you can try it out, or wait a day or two and it will be available via rpi-update (insert usual warnings). Building your own may be the quickest route to a solution - if my patch doesn't solve it, add a |
I already have the 4.19.46 source tree up and running, building "my" modules in tree, so would be very happy to try it out. I've just been looking at the source of vc4_dsi.c, and can see that in vc4_dsi_bind(), it goes through collecting various resources (including DMA memory, a dma channel, an interrupt etc. etc.) There are many points where control is returned with the value -EPROBE_DEFER - without "giving them back". I'd be very grateful if you could help me with the 'protocol'/'etiquette' here. Would it be correct within the Linux ethos for me to have a go at "improving" this vc4_dsi code, or is that insulting to the original writer? |
The Linux devs will take patches from anyone, but I suggest you start with a Pull Request here to get some quick, friendly feedback. |
pelwell - Thank you for your encouragement and support I have made a Pull Request (I think - I'm very much a git newbie). |
@boatbodger Sorry I have to admit I'm a bit confused; is this for the official 7" touchscreen or other DSI panels? I am interested in making the official panel work with the vc4-kms-v3d overlay, which I thought was the initial problem described in this issue. |
Hi,
I’ve built the patch in and I’m at 10/10 success rate so far. I have a many more devices available to test, so I’ll have good feedback in a day or two. Initial results look promising ☺
n K
From: Chris Miller [mailto:notifications@github.com]
Sent: 13 June 2019 15:43
To: raspberrypi/linux
Cc: Kevin Quigley; Mention
Subject: Re: [raspberrypi/linux] Issue: 7" Touchscreen does not start correctly with DSI transactions (#2521)
pelwell - Thank you for your encouragement and support I have made a Pull Request (I think - I'm very much a git newbie).
k-quigley - I think 'Fix DMA channel and memory leak in vc4 #3012<#3012>' may help your panel to start up correctly every time. Mine does now.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#2521?email_source=notifications&email_token=ACVKN4GYYAGZJK3ZFLZJJELP2JMHHA5CNFSM4E3VT7N2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXT5PDQ#issuecomment-501733262>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ACVKN4D5GDS2FHLEDUW6JXDP2JMHHANCNFSM4E3VT7NQ>.
|
@tdaniel22 |
@boatbodger Thanks for clarifying. I am currently using the vc4-fkms-v3d overlay with an official panel and it seems to be working fine. I assumed that fkms stands for fake-kms, and that it was a workaround for the non working vc4-kms-v3d overlay. Is my understanding correct, or am I inventing an issue here? For context, I'm mostly interested in reducing boot times of an embedded system, and currently it takes around 5 seconds for the panel to light up on an already optimized buildroot system. I'm not sure whether the kms overlay would improve anything at all in this regard. |
@tdaniel22 I believe the 'f' is short for firmware. IMHO if you're using the official display, using the standard settings - which means everything happens in the firmware - is likely to give you the shortest boot time - we're quite a way off topic here though, with all due respect. |
@k-quigley I've submitted updated my earlier pull request in line with @pelwell's comments. |
@k-quigley I noticed that the display goes out irrecoverably if the screen saver/blanker kicks in. |
Hi,
I have a feeling I know what might be going in here. On the power down, the display driver is probably sending dsi commands down the line to the display module. I have a feeling that these should be interleaved with the video frames. When I looked at this some time ago, the errors occurred when the command were send during the video frame, and not in the blanking period.
In my driver, I implemented some retry mechanism for my brightness controls. If the commands fail, the retry usually picks up the failures and in most cases it works... Some times, it doesn't . What is really needed is some handler which looks out for the end of video frame, and queues the commands for the blanking period. I haven't had time to look into this in depth..
I hope this makes sense :)
..Kevin
On 14 Jun 2019 6:33 p.m., Chris Miller <notifications@github.com> wrote:
@k-quigley<https://github.com/k-quigley> I noticed that the display goes out irrecoverably if the screen saver/blanker kicks in.
A dmesg error of;
vc4_dsi 3f700000.dsi: Timeout waiting for DSI STOP entry: STAT 0x00020800
is reported.
For my usage, that initially wasn't a problem as the screen is meant to be on 24x7.
However, I need portrait mode. The old "display_lcd_rotate=1" does not work for a screen attached in this way (i.e. via the vc4 module), but I can achieve that result by using the xaddr commands.
However, when I do that, as part of the process of applying the transformation, it seems the decoder is disabled. This calls vc4_dsi_ulps(dsi, true), which triggers the DSI STOP error.
Are you also seeing this DSI lock-up after screen saver kicks in?
I can 'fudge' things by commenting out the call to vc4_dsi_ulps for the time being, but that's certainly not the right answer!
IMHO this is a separate issue, and one I'm unlikely to solve without detailed knowledge of the DSI register transactions - which I don't have.
FWIW this error occurred before I started hacking vc4_dsi.c - so I don't think its self-inflicted.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#2521?email_source=notifications&email_token=ACVKN4H4JQKONQZNG4BSMHTP2PIU7A5CNFSM4E3VT7N2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXXOYYI#issuecomment-502197345>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ACVKN4G6FOVFANLO4UVOAE3P2PIU7ANCNFSM4E3VT7NQ>.
|
vc4-fkms-v3d is kernel vc4 v3d driver, but firmware DRM/KMS driver. If the firmware doesn't support your display (which for DSI means the 7" official one), then you won't get anything. DSI (and CSI) do use a variety of signal levels depending on the mode (High Speed, or Low Power) they're in - that is normal operation. I don't recall off-hand the actual voltage levels used, but they'll be in the spec. Using rotation from xrandr generally means using V3D to do the rotation, often as a second pass after it has been composed to memory. Other than stopping and restarting the pipeline, I don't see why it is any different to any other scenario. |
Hi @6by9 - thanks for the useful input. Ideally, I'd rather not use xrandr, but instead, have vc4/kms/v3d come up prepared with the 90 degree rotation. I understand that lcd_rotate and display_rotate are not going to work from config.txt, but do you know if there are other ways to achieve this rotation - e.g. by device-tree overlays when using the vc4-kms-v3d with a panel? |
The main vc4 composition hardware (the HVS) does not support transpose. However there is a dedicated hardware block (called the transposer) that does support it, and writes the output of the HVS back to memory. The vc4-kms-v3d driver does have support for the transposer as a writeback connector, however I don't believe the DRM framework will put the two halves together for you. |
Thank you for that - useful stuff. I will revisit the subject armed with this knowledge when I next have some time. |
What is the latest state here ? Aka if I use 4.19 - which dtb's and options in config.txt do I need to use for the 7inch ? |
Largely obsolete so going to close. Please request a reopen if you think there is anything still to discuss on this thread. 5.10 now has DSI support merged with an overlay for the Pi 7" DSI panel, and a fix for a register issue that meant only 1 and 4 lane modes would work. |
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. anholt@d7fc047)
Enable DSI transactions to startup the panel (e.g. anholt@1d460b1)
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)
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 ?:
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 ;)
The text was updated successfully, but these errors were encountered: