Skip to content

Commit

Permalink
drm/vc4_hdmi: Allow hotplug detect to be forced
Browse files Browse the repository at this point in the history
See: https://forum.libreelec.tv/thread/24783-tv-avr-turns-back-on-right-after-turning-them-off

While the kernel provides a :D flag for assuming device is connected,
it doesn't stop this function from being called and generating a cec_phys_addr_invalidate
message when hotplug is deasserted.

That message provokes a flurry of CEC messages which for many users results in the TV
switching back on again and it's very hard to get it to stay switched off.

It seems to only occur with an AVR and TV connected but has been observed across a
number of manufacturers.

The issue started with #4371
and this provides an optional way of getting back the old behaviour

Signed-off-by: Dom Cobley <[email protected]>
  • Loading branch information
popcornmix committed Nov 7, 2022
1 parent 0deefc5 commit 96232dd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/gpu/drm/vc4/vc4_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
#include <linux/component.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/pm_runtime.h>
Expand Down Expand Up @@ -113,6 +115,10 @@

#define HDMI_14_MAX_TMDS_CLK (340 * 1000 * 1000)

/* bit field to force hotplug detection. bit0 = HDMI0 */
static int force_hotplug = 0;
module_param(force_hotplug, int, 0644);

static const char * const output_format_str[] = {
[VC4_HDMI_OUTPUT_RGB] = "RGB",
[VC4_HDMI_OUTPUT_YUV420] = "YUV 4:2:0",
Expand Down Expand Up @@ -454,7 +460,9 @@ static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector,

WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev));

if (vc4_hdmi->hpd_gpio) {
if (force_hotplug & BIT(vc4_hdmi->encoder.type - VC4_ENCODER_TYPE_HDMI0))
status = connector_status_connected;
else if (vc4_hdmi->hpd_gpio) {
if (gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio))
status = connector_status_connected;
} else {
Expand Down

0 comments on commit 96232dd

Please sign in to comment.