* [PATCH] media: i2c/platform: add V4L2_SET_EDID_HPD_LOW_JIFFIES define
@ 2026-09-10 9:26 Hans Verkuil
0 siblings, 0 replies; only message in thread
From: Hans Verkuil @ 2026-09-10 9:26 UTC (permalink / raw)
To: Linux Media Mailing List
Cc: Tim Harvey, Hermes Wu, Dmitry Osipenko, kernel@collabora.com
HDMI receivers need to pull the HPD pin low for at least 100 ms to
indicate that a new EDID is available. In practice, HZ / 7 is a good
value for that as this gives enough slack for video sources to detect
this situation. Due to clock frequency differences and imprecise
video source implementations using exactly 100 ms (or even a bit more)
may still cause this to be missed by the video source.
Over many years HZ / 7 (143 ms) has proven to be a good safe value
for this.
Add a new #define to v4l2-dv-timings.h and modify the various drivers
that do this to use this define. Most already used HZ / 7, but some
were a bit longer.
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
---
drivers/media/i2c/adv7604.c | 2 +-
drivers/media/i2c/adv7842.c | 10 ++++++----
drivers/media/i2c/it6625.c | 2 +-
drivers/media/i2c/tc358743.c | 2 +-
drivers/media/i2c/tda1997x.c | 2 +-
.../media/platform/synopsys/hdmirx/snps_hdmirx.c | 4 ++--
include/media/v4l2-dv-timings.h | 14 ++++++++++++++
7 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 231edd3797ab..2a169d379ee4 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2449,7 +2449,7 @@ static int adv76xx_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
cec_s_phys_addr(state->cec_adap, parent_pa, false);
/* enable hotplug after 143 ms */
- schedule_delayed_work(&state->delayed_work_enable_hotplug, HZ / 7);
+ schedule_delayed_work(&state->delayed_work_enable_hotplug, V4L2_SET_EDID_HPD_LOW_JIFFIES);
return 0;
}
diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 3cfae89ce944..5e5bb78a85bc 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -747,8 +747,9 @@ static int edid_write_vga_segment(struct v4l2_subdev *sd)
return -EIO;
}
- /* enable hotplug after 200 ms */
- schedule_delayed_work(&state->delayed_work_enable_hotplug, HZ / 5);
+ /* enable hotplug after 143 ms */
+ schedule_delayed_work(&state->delayed_work_enable_hotplug,
+ V4L2_SET_EDID_HPD_LOW_JIFFIES);
return 0;
}
@@ -830,8 +831,9 @@ static int edid_write_hdmi_segment(struct v4l2_subdev *sd, u8 port)
}
cec_s_phys_addr(state->cec_adap, parent_pa, false);
- /* enable hotplug after 200 ms */
- schedule_delayed_work(&state->delayed_work_enable_hotplug, HZ / 5);
+ /* enable hotplug after 143 ms */
+ schedule_delayed_work(&state->delayed_work_enable_hotplug,
+ V4L2_SET_EDID_HPD_LOW_JIFFIES);
return 0;
}
diff --git a/drivers/media/i2c/it6625.c b/drivers/media/i2c/it6625.c
index da17e5d5ce9e..0565fe900bc9 100644
--- a/drivers/media/i2c/it6625.c
+++ b/drivers/media/i2c/it6625.c
@@ -760,7 +760,7 @@ static void it6625_disable_hpd(struct it6625 *it6625)
static void it6625_enable_hpd(struct it6625 *it6625)
{
- schedule_delayed_work(&it6625->hpd_delayed_work, HZ / 7);
+ schedule_delayed_work(&it6625->hpd_delayed_work, V4L2_SET_EDID_HPD_LOW_JIFFIES);
}
static void it6625_hpd_delayed_work(struct work_struct *work)
diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index ce75812cbf72..6a29bab24bd8 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -453,7 +453,7 @@ static void tc358743_enable_edid(struct v4l2_subdev *sd)
/* Enable hotplug after 143 ms. DDC access to EDID is also enabled when
* hotplug is enabled. See register DDC_CTL */
- schedule_delayed_work(&state->delayed_work_enable_hotplug, HZ / 7);
+ schedule_delayed_work(&state->delayed_work_enable_hotplug, V4L2_SET_EDID_HPD_LOW_JIFFIES);
tc358743_enable_interrupts(sd, true);
tc358743_s_ctrl_detect_tx_5v(sd);
diff --git a/drivers/media/i2c/tda1997x.c b/drivers/media/i2c/tda1997x.c
index afa1d6f34c9c..e8176b29fae4 100644
--- a/drivers/media/i2c/tda1997x.c
+++ b/drivers/media/i2c/tda1997x.c
@@ -590,7 +590,7 @@ static void tda1997x_enable_edid(struct v4l2_subdev *sd)
v4l2_dbg(1, debug, sd, "%s\n", __func__);
/* Enable hotplug after 143ms */
- schedule_delayed_work(&state->delayed_work_enable_hpd, HZ / 7);
+ schedule_delayed_work(&state->delayed_work_enable_hpd, V4L2_SET_EDID_HPD_LOW_JIFFIES);
}
/* -----------------------------------------------------------------------------
diff --git a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
index 978bc91d3257..66191ddfbe78 100644
--- a/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
+++ b/drivers/media/platform/synopsys/hdmirx/snps_hdmirx.c
@@ -515,9 +515,9 @@ static void hdmirx_hpd_ctrl(struct snps_hdmirx_dev *hdmirx_dev, bool en)
hdmirx_writel(hdmirx_dev, CORE_CONFIG,
hdmirx_dev->hpd_trigger_level_high ? en : !en);
- /* 100ms delay as per HDMI spec + extra 50ms to cover internal delay */
+ /* 100ms delay as per HDMI spec + extra 43ms to cover internal delay */
if (!en)
- msleep(100 + 50);
+ msleep(jiffies_to_msecs(V4L2_SET_EDID_HPD_LOW_JIFFIES));
}
static void hdmirx_write_edid_data(struct snps_hdmirx_dev *hdmirx_dev,
diff --git a/include/media/v4l2-dv-timings.h b/include/media/v4l2-dv-timings.h
index 2b42e5d81f9e..de5ef825a6c6 100644
--- a/include/media/v4l2-dv-timings.h
+++ b/include/media/v4l2-dv-timings.h
@@ -252,6 +252,20 @@ v4l2_hdmi_rx_colorimetry(const struct hdmi_avi_infoframe *avi,
const struct hdmi_vendor_infoframe *hdmi,
unsigned int height);
+/*
+ * The time in milliseconds that the HPD should be pulled low when writing
+ * a new EDID. This will tell the HDMI source that the EDID was changed and
+ * that it has to be re-read.
+ *
+ * The source is supposed to re-read the EDID if the HPD is low for more than
+ * 100 ms, but in practice the sink should pull it low for a bit longer due
+ * to clock differences and imprecise video source implementations.
+ *
+ * Practice has shown that setting the delay to HZ / 7 (approx 143 ms) works
+ * well.
+ */
+#define V4L2_SET_EDID_HPD_LOW_JIFFIES (HZ / 7)
+
unsigned int v4l2_num_edid_blocks(const u8 *edid, unsigned int max_blocks);
u16 v4l2_get_edid_phys_addr(const u8 *edid, unsigned int size,
unsigned int *offset);
--
2.53.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-10 9:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-10 9:26 [PATCH] media: i2c/platform: add V4L2_SET_EDID_HPD_LOW_JIFFIES define Hans Verkuil
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.