Skip to content

HDMI Interrupt-Based Hotplug for Devices with a GPIO #4327

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

Open
wants to merge 4 commits into
base: rpi-5.10.y
Choose a base branch
from

Conversation

mripard
Copy link
Contributor

@mripard mripard commented May 6, 2021

Hi,
I'm pushing a draft PR here since Dave reported that the bank1 interrupts were apparently not working on the Pi2B, in PR #4313

The code here works on the Pi3B+, so it might be helpful to someone.

@mripard mripard force-pushed the rpi/5.10-hotplug-irq-gpio branch 2 times, most recently from 5a513e7 to 2d17cf0 Compare May 6, 2021 16:00
mripard added 4 commits May 10, 2021 12:29
It appears that the interrupts for all the banks but the first one are
not working properly. Disable them for now.

Signed-off-by: Maxime Ripard <[email protected]>
If the of_get_named_gpio_flags call fails in vc4_hdmi_bind, we jump to
the err_unprepare_hsm label. That label will then call
pm_runtime_disable and put_device on the DDC device.

We just retrieved the DDC device, so the latter is definitely justified.
However at that point we still haven't called pm_runtime_enable, so the
call to pm_runtime_disable is not supposed to be there.

Fixes: 10ee275 ("drm/vc4: prepare for CEC support")
Signed-off-by: Maxime Ripard <[email protected]>
The new gpiod interface takes care of parsing the GPIO flags and to
return the logical value when accessing an active-low GPIO, so switching
to it simplifies a lot the driver.

Signed-off-by: Maxime Ripard <[email protected]>
The HPD GPIO can be used on some RPi (2B, 3B+). However, and while it
works fine on the 3B+, it looks like on the 2B irq over gpios doesn't
work yet.

Signed-off-by: Maxime Ripard <[email protected]>
@mripard mripard force-pushed the rpi/5.10-hotplug-irq-gpio branch from 2d17cf0 to 14167a2 Compare May 10, 2021 10:59
@mripard
Copy link
Contributor Author

mripard commented May 10, 2021

I just pushed a change that disables the interrupts-based hotplug on devices using a GPIO on a bank other than bank 0 (like the Pi2B). I don't have a Pi2B so I couldn't test on that hardware, but hacking a bit on the Pi3B+ looks like it should be working there.

@mripard mripard marked this pull request as ready for review May 10, 2021 11:07
@6by9
Copy link
Contributor

6by9 commented May 24, 2021

I'm happy with the patches, although I don't see why only bank 0 interrupts work. Or is that more to keep general GPIO interrupt handling working? That's got potential fall-out on the Compute Module 1&3 (not 4) where Bank 1 GPIOs are available for general use.

My concerns were that the firmware appears to be using the edge detection part of the interrupt block, even if it doesn't enable the actual interrupt and install an ISR.

This PR will make HPD work on those platforms with HPD on the GPIO expander (via polling), but I think I need to look at the firmware to make it drop all HPD stuff should KMS be enabled.

@mripard
Copy link
Contributor Author

mripard commented May 24, 2021

The first patch was meant to prevent using the interrupt based hotplug on the devices that have a GPIO on bank > 0 since you reported it as broken. After this patch, as far as I know, the Pi with a GPIO Expander or a GPIO on bank 1 would use polling, and the one with a dedicated interrupt line (Pi4, CM4?) or a GPIO on the bank 0 (Pi3B+) would use interrupts

It's true that the side effect is that any driver using an interrupt handler would now get an error, but the way I understood it is that they were always broken anyway. If it's the firmware interfering, then we shouldn't merge this patch indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants