On Thu Sep 10 11:26:06 2026 +0200, Hans Verkuil wrote:
> 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 <[email protected]>
Patch committed.
Thanks,
Hans Verkuil
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 +-
drivers/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 9d21c55aba19..2de743d8ca21 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2451,7 +2451,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 7fe394da0e6a..df6601d6d2b6 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 a5a3afae219d..25f9e61a7b03 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 87a908426940..d9cd0563d50b 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 bbc8e3ff5175..30dfd8a7b42b 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 14c29ed2254b..7ec25ab235b6 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);
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]