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
DRM/KMS Pimoroni HyperPixel4 driver #4812
Conversation
@6by9 you don't know the extent to which you've just made my day. I haven't had the time and headspace to take the helpful input from the forumites and put it into practise. Thank you! It may be possible to run the touchscreen in polled mode to skirt the GPIO conflict, albeit that would be suboptimal. The GPIO state machine approach seems workable, but I haven't had an opportunity to play with it yet. I'm currently tackling an issue with the touch IC having different default register settings across hardware revisions, which may warrant some form of upstream change to the Goodix GT911 driver. Do you have some idea how a custom SPI init sequence can be supplied to ILI9806E? I've seen various examples of blobs in device tree, plus the notion of "firmware" but I'm not sure what the canonical approach for this might be. I would- I suspect- have ended up writing a driver specific to hyperpixel4 that (erroneously) bakes this init in. |
Polling the touchscreen is the fallback, but with it being a bitbashed I2C that really is suboptimal. I'll see where Phil gets to in looking at gpio-fsm.
Whilst I've scanned the datasheet, I don't know the detail of the modes that can reasonably be expected to be supported by ILI9806 and how that affects the init sequences. Having had a closer look at the HyperPixel4, the compatible string probably ought to be The fact that ILI9806E also appears to support DSI input as well as DPI just confuses matters further, and adds extra potential options for the driver. I'm definitely ignoring that one for now! |
6f90877
to
00de1d0
Compare
Hmm - GitHub isn't letting me update your PR, but there is a rebased version with my (non-gpio-fsm) hacks in https://github.com/pelwell/linux/commits/hyperpixel4. |
I've added you as a collaborator which will probably give you push access. If you could drop the display back into the office when you're next in that would be useful. |
86426ed
to
55e02bd
Compare
Will do. |
a0bf936
to
475f054
Compare
64c0386
to
10e0730
Compare
1f9ccda
to
a6cbb39
Compare
Updated after having cleaned up the driver, merged in Phil's changes, and added the HyperPixel4 Square driver and overlay. So it just leaves the question over how we handle the NONEXCLUSIVE flag and spi-gpio mods. Do we add a DT parameter to enable that? I don't believe there's a way to do it via the existing GPIO flags in there. |
HyperPixel2 Round is going to be trickier as it uses the ST7701S driver chip. There's already a driver for that, but only when connected over DSI (it supports SPI, DSI, and DPI), so the driver needs to be reworked to support multiple interfaces. It's quite possible to extend it (panel-simple already does DSI and non-DSI panels), but it requires more time than I have available now. |
a6cbb39
to
76cc495
Compare
Sorry, last push needed as I hadn't attached the spi_device_id struct, so the kernel complained when loading the driver (even though it worked). |
The way of doing it would be to add another GPIO flag - I haven't traced it through, but it shouldn't be a very invasive change since it is all within the GPIO framework. spi-gpio driver change to return its clock pin to an input would be triggered by a DT parameter. We should probably do the same for the MOSI pin as well to make it less arbitrary. |
OK, I'll look at the required changes when I have some more spare time. HyperPixel 4 Square uses edt5406 (same as the Pi 7" DSI panel), but that driver doesn't do an
That said, I don't see a reason why it doesn't do the gpiod call first, and as we already have the polling fallback in there it's relatively easy to do. |
By the time the probe function is run, the i2c framework has already found the interrupts declaration in the DT node and claimed an interrupt, presented in client->irq. The goodix driver has the parallel irq-gpios declaration because the device overloads the interrupt pin - driving it low at various times for various purposes. I hope that isn't something we have to deal with. |
The good news is that I think adding the NONEXCLUSIVE support to DT is straightforward:
I'm hoping that's it. |
Hmm, are interrupts handled by pinctrl and gpios by gpio? I've done the plumbing, but for Hyperpixel4 Square I get an error thrown by pinctrl due to pin 27 already being used. I'd copied Phil's dt for the touch, and that included pinctrl definitions for the interrupt line on the touch. Indeed I appear to be able to revert all the changes (except GPIO direction in spi-gpio) as long as only one defines the pinctrl node. |
Interrupts are things generated by gpios - pinctrl has no part in it, except to possibly prevent multiple uses of the same pin. You should be able to drop |
76cc495
to
0da4cf0
Compare
ac8875a
to
f6a568c
Compare
Adds an overlays for the Pimoroni HyperPixel4, HyperPixel 4 Square, and HyperPixel 2 Round DPI displays. We have a conflict over the use of GPIO 27 for touch screen interrupt and SPI CLK for configuring the display on the two HyperPixel4 displays. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
f6a568c
to
529eab7
Compare
One last update to add a I've just noticed that it doesn't work quite as well as one might have hoped, but that's a framework thing. Tested with all 3 panels. Video works on all 3. Touch on 4 and 4Square. All happy now? |
See: #4812 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
See: #4812 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
kernel: DRM/KMS Pimoroni HyperPixel4 driver See: raspberrypi/linux#4812 kernel: media: bcm2835-unicam: Handle a repeated frame start with no end See: raspberrypi/linux#4873 kernel: net: phy: lan87xx: Decrease phy polling rate See: raspberrypi/linux#4812
kernel: DRM/KMS Pimoroni HyperPixel4 driver See: raspberrypi/linux#4812 kernel: media: bcm2835-unicam: Handle a repeated frame start with no end See: raspberrypi/linux#4873 kernel: net: phy: lan87xx: Decrease phy polling rate See: raspberrypi/linux#4812
See: raspberrypi#4812 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
See: #4812 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
See: #4812 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
See: #4812 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
See: #4812 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
See: #4812 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
commit cbca16b4881260a6ab4817cee7c537f77dee14d7 from https://github.com/raspberrypi/linux.git rpi-5.15.y See: raspberrypi/linux#4812 Signed-off-by: Phil Elwell <phil@raspberrypi.com> Signed-off-by: Meng Li <Meng.Li@windriver.com>
commit cbca16b4881260a6ab4817cee7c537f77dee14d7 from https://github.com/raspberrypi/linux.git rpi-5.15.y See: raspberrypi/linux#4812 Signed-off-by: Phil Elwell <phil@raspberrypi.com> Signed-off-by: Meng Li <Meng.Li@windriver.com>
See: #4812 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
See: #4812 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
See: #4812 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
See: raspberrypi#4812 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
See: raspberrypi/linux#4812 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
I don't know where to raise this, so in the hope I get some general prodding in the right direction- I have discovered the switch from Pi's homegrown setup to DRM/KMS has some side-effects when dpms kicks in. In short, turning off the DPI signals to the display (in this case HyperPixel 4 Square) for any duration will "upset" the display proportional to that duration. The longer it's left on without a signal, the more extreme flickering and smearing issues will appear when it comes back up. I made some effort to fix this in the driver before I realized that our SPI/MIPI signal is not connected- so it's impossible to sleep or turn off the display (to correspond with power management) and try to combat the flicker. Does anyone know if it's possible to prevent dpms from disabling the DPI signals, preferring instead to keep them running and only affect the backlight? I've looked through the docs for DRM connector and various associated structs and flags, but I haven't managed to turn anything up. Note: This can be "fixed" by disabling dpms "xset -dpms" and just controlling the backlight via Thank you! |
Could you raise this a a new issue on this repo please? It'll get lost against a closed merge request. |
BugLink: https://bugs.launchpad.net/bugs/1960323 See: raspberrypi/linux#4812 Signed-off-by: Phil Elwell <phil@raspberrypi.com> (cherry picked from commit 96ac1050dc7c47c348e048e10f1447458e51d0e2 rpi-5.15.y) Signed-off-by: Juerg Haefliger <juergh@canonical.com>
From https://forums.raspberrypi.com/viewtopic.php?t=324640
This happens to be against rpi-5.15.y as that was the tree I had at the time. It should easily backport to 5.10 should it be needed.
Comments on the register settings could be extended based on https://github.com/pimoroni/hyperpixel4/blob/pi4-i2c-fix/dist/hyperpixel4-init#L57
There is still an outstanding issue on how to handle the shared use of GPIO 27 for both SPI CLK and touch screen interrupt, and it needs a dtbinding too if it should be upstreamed.
@Gadgetoid for info.