-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add Support for the Geekworm MZP280 DPI Display #4853
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
Conversation
Add support for MEDIA_BUS_FMT_RGB565_1X24_CPADHI. This format is used by the Geekworm MZP280 panel which interfaces with the Raspberry Pi. Signed-off-by: Chris Morgan <[email protected]>
Add the MEDIA_BUS_FMT_RGB565_1X24_CPADHI format used by the Geekworm MZP280 panel for the Raspberry Pi. Signed-off-by: Chris Morgan <[email protected]>
Add support for the VC4 DPI driver to utilize DPI mode 3. This is defined here as xxxRRRRRxxGGGGGGxxxBBBBB: https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#parallel-display-interface-dpi This mode is required to use the Geekworm MZP280 DPI display. Signed-off-by: Chris Morgan <[email protected]> Reviewed-by: Dave Stevenson <[email protected]>
Add vendor prefix for Geekworm (https://geekworm.com). Signed-off-by: Chris Morgan <[email protected]>
The Geekworm MZP280 panel is a 480x640 (portrait) panel with a capacitive touch interface and a 40 pin header meant to interface directly with the Raspberry Pi. The screen is 2.8 inches diagonally, and there appear to be at least 4 distinct versions all with the same panel timings. Timings were derived from drivers posted on the github located here: https://github.com/tianyoujian/MZDPI/tree/master/vga Additional details about this panel family can be found here: https://wiki.geekworm.com/2.8_inch_Touch_Screen_for_Pi_zero Signed-off-by: Chris Morgan <[email protected]>
Add support for the Geekworm MZP280 Panel Signed-off-by: Chris Morgan <[email protected]> Acked-by: Maxime Ripard <[email protected]>
6by9
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. A few minor comments on the overlay.
| fragment@2 { | ||
| target = <&gpio>; | ||
| __overlay__ { | ||
| dpi_16bit_cpadhi_gpio0: dpi_16bit_cpadhi_gpio0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how I missed that, but thank you. I can remove this node then at least when I resubmit.
| fragment@3 { | ||
| target = <&spi0>; | ||
| __overlay__ { | ||
| pinctrl-0 = <&spi0_pins>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like an unrelated change as SPI is disabled by default so there should be no conflict. If someone does try enabling SPI, then it is right for the kernel to complain.
It also introduces overlay loading issues, as the overlay enabling SPI may be placed after this one, and it may reinstate the CS pins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would you advise I do? For this screen to work with the touchscreen I need SPI0 enabled, but I need the CS pins assigned to ALT2.
| @@ -0,0 +1,70 @@ | |||
| /* | |||
| * vc4-kms-dpi-at056tn53v1-overlay.dts | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overlay name hasn't been updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dammit. Thanks, I'll fix.
arch/arm/boot/dts/overlays/README
Outdated
| Params: <None> | ||
|
|
||
|
|
||
| Name: vc4-kms-dpi-geekworm-mzp280 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was looking at this yesterday. Having independent overlays for each and every display is going to become cumbersome. Adding overrides to vc4-kms-dpi-generic (or create one new one of vc4-kms-dpi for defined panels) would be more manageable.
vc4-kms-dpi-at056tn53v1 can be merged into -generic quite easily.
More complex displays (eg the Pimoroni HyperPixels that need spi-gpio for initialisation, and have touch controllers to configure too) would need to remain as separate overlays.
I wonder what @pelwell 's view is on that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm all for avoiding unnecessary duplication - whether that's by adding specialisations to the -generic case or by adding a -specific version for that purpose (name TBD) doesn't matter much, but the latter is marginally more appealing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll be happy to remove this request if we can do it in a generic way. Honestly the only 2 (3) things that prevent it from working with the generic overlay today are:
-
There is no bus format defined. That can however be accomplished with 2 of the patches in this series and doesn't require the overlay at all to do. If this is the route you want to take I can resubmit this pull request with just the bus format changes to the VC4 driver and to the media headers.
-
I need to enable SPI0 but keep the SPI0 CS pins in ALT2 mode for the touchscreen to work. If I don't enable SPI0 there is no touchscreen, but if I don't keep the CS pins in ALT2 mode I get a horrible blue tint.
3-ish) This is kind of optional, but I should/could add a rotation property to the DPI generic overlay. The panel I'm submitting for in question is by default in a portrait orientation and is almost always rotated 270 degrees when used.
Let me know what you want me to do and I'll resubmit. Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
panel-simple.c got extended to take a
bus-formatproperty to allow the format to be specified when using thepanel-dpicompatible.
You've gone to the effort of getting a compatible merged upstream (congrats!), so you may as well use it, and that defines the bus format anyway. I'm fine with that. You need the patches adding that RGB565 mode to vc4_dpi.c anyway. -
Enabling SPI isn't done in this overlay, so changing chip selects shouldn't really be done in this overlay either. Which touch controller is it using? Is there an existing overlay for it that needs to be extended?
-
I'm all for additional params if they make sense.
-
I've had a quick chat with pelwell. Where we will be going will be a
vc4-kms-dpi-paneloverlay which takes an override to enable different defined panels (eg yours, and at056tn53v1).
vc4-kms-dpi-genericwill exist for providing a generic external timing/configuration.
Both will include a newvc4-kms-dpi.dtsiwhich will define the base panel, dpi, and probably backlight properties.
It may take a day or so for me to find time to make the above changes. If you want to resubmit before those changes, then if you create the vc4-kms-dpi-panel-overlay.dts file with your panel as the only override, then we can do the shuffling of fragments around the place. If we merge your panel as vc4-kms-dpi-geekworm-mzp280, then it becomes an overhead that has to be carried forward to avoid breaking someone's system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, I'll wait for your update before I revise what I'm doing. I'm in no big hurry and the stuff I pushed upstream is still under review. Again, the biggest piece I need is the bus format definition. Without it I either have to use the fkms overlay or recompile my kernel; while with the proper bus format definition I only need a device tree overlay.
The touch controller is using the ads7846 overlay. SPI is enabled in that overlay but it looks like there's no SPI pinctrl overrides done in it. (I'm using "dtoverlay=ads7846,penirq=27,swapxy=1,xmin=200,xmax=3850,ymin=200,ymax=3850" in my config.txt). Again it's not so much that I'm changing the chip selects so much as completely disabling them and repurposing the pins to ALT2. While I see overlays that change the chip select pins (such as spi0-1cs-overlay.dts) I don't see an overlay that enables SPI0 but disables the SPI0 CS pins. Any thoughts on how to support that (and thus support this panel)?
| target = <&spi0>; | ||
| __overlay__ { | ||
| pinctrl-0 = <&spi0_pins>; | ||
| /delete-property/ cs-gpios; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this doesn't do what you think - overlays can't delete properties or nodes.
|
How is SPI0 supposed to function without chip selects? I'm not sure that's going to be possible now that hardware chip-select support has effectively been removed. |
|
Presumably it's hard coded as 0? I honestly don't know. edit: After looking at my GPIO configuration, I can't seem to find any pin that currently works as a CS anyway. Thank you. |
|
#4860 is the basic change I was thinking of, however it does still need verifying. |
|
I can test it out. What do we do about the SPI0 though for this one? Could I just override the SPI0 CS GPIO to a nonsense value like 255? |
|
There is a recognised way to run SPI without using a chip select, but it seems to rely on passing the SPI_NO_CS flag with the transfer. What does this overlay do for you (I named it spi0-0cs): |
|
There is another way - using the |
|
Using spi0-0cs and removing the SPI stuff from the geekworm overlay causes the panel to work better than it ever did (no flashing or discoloration during boot). :-) |
|
Cool. Here's the gpio_fsm version anyway, should you be interested: |
|
gpio_fsm also works fine. Not as good as the 0cs one (gpio_fsm blinks during boot-up whereas the other one leaves the screen up the whole time), but it's no big deal at all and for all I know some sort of order-of-operations thing I need to solve myself. |
Can this be made to set an override on the pinctrl-0 value for the DPI node? Also if I'm reading it, is it only allowing you to override part of the compatible string on the vc4-kms-dpi-panel overlay? (meaning I could replace the at056tn53v1 part but not the innolux part) Thank you. |
The overrides section enables other fragments from earlier in the file. I've just updated it so that it includes an override for the Adafruit Kippah with 7inch panel as well. So If your panel simply needs a compatible and DPI mode setting, then it follows the same pattern. I'll let Phil comment on the PR as in theory we can set the compatible directly from the override without a fragment. You could then have (if I've got it right), |
|
Okay, tested vc4-kms-dpi-panel-overlay by adding the following: I then added the following to my config.txt after removing all the other "geekworm" related stuff. It seems to work just fine for me (albeit without rotation). edit: Once the vc4-kms-dpi-panel-overlay stuff is done if you want I can rebase this patch. Also, I can add rotation support. Note that at least in my experience rotation support generates some dmesg warnings currently. |
|
I'll add the rotation option to my PR and test. It should be possible to make your fragment to set the default, and then we can have a generic override (probably wants to go in vc4-kms-dpi.dtsi) to allow user configuration of any panel using panel-simple. The two WARNS are a little concerning as they imply a locking or sequencing issue. It looks like it's |
|
I'll remove the last commit from this pull request then (creating the overlay), and then submit a new pull request for the changes to the vc4-kms-dpi-panel-overlay.dts file. Will this pull be acceptable without the last commit? Thank you. |
Ohh I've noticed it, I just haven't had time to debug it yet (thank you for doing this). I know at least the Odroid Go Advance on the 5.17 kernel gets this warning, and I've seen additional devices on the Allwinner A64 get this as well. |
|
I'm good with that. |
I'm waiting for Maxime to look at #4862, and he'll then hopefully upstream it for me (I like having a mainline dev on hand to deal with upstream! It also means that he does the review to reduce any holdups) |
Done, I removed the overlay and will add that to the new generic one that just got merged. |
kernel: Patching lan78xx for SOF_TIMESTAMPING_TX_SOFTWARE support See: raspberrypi/linux#4856 kernel: i2c: bcm2835: Make clock-stretch timeout configurable See: raspberrypi/linux#4855 kernel: drm/vc4: Add DRM 210101010 RGB formats for hvs5. See: raspberrypi/linux#4859 kernel: vc4-kms-dpi overlay updates See: raspberrypi/linux#4860 kernel: Add Support for the Geekworm MZP280 DPI Display See: raspberrypi/linux#4853 kernel: DRM: Clean up handling of panel orientation See: raspberrypi/linux#4862 kernel: Add support for the MAX30102 heart rate and blood oxygen sensor See: raspberrypi/linux#4535 firmware: mmal: Add mapping for IL OMX_IndexParamBrcmEnableIJGTableScaling param See: raspberrypi/linux#4669 userland: Handle overlay parameters embedded in overlay_map.dtb See: raspberrypi/linux#4860
kernel: Patching lan78xx for SOF_TIMESTAMPING_TX_SOFTWARE support See: raspberrypi/linux#4856 kernel: i2c: bcm2835: Make clock-stretch timeout configurable See: raspberrypi/linux#4855 kernel: drm/vc4: Add DRM 210101010 RGB formats for hvs5. See: raspberrypi/linux#4859 kernel: vc4-kms-dpi overlay updates See: raspberrypi/linux#4860 kernel: Add Support for the Geekworm MZP280 DPI Display See: raspberrypi/linux#4853 kernel: DRM: Clean up handling of panel orientation See: raspberrypi/linux#4862 kernel: Add support for the MAX30102 heart rate and blood oxygen sensor See: raspberrypi/linux#4535 firmware: mmal: Add mapping for IL OMX_IndexParamBrcmEnableIJGTableScaling param See: raspberrypi/linux#4669 userland: Handle overlay parameters embedded in overlay_map.dtb See: raspberrypi/linux#4860
Please pull this request for the Raspberry Pi kernel. I'm working with Upstream for a corresponding patch to the mainline kernel as well.
https://lists.freedesktop.org/archives/dri-devel/2022-January/338550.html