diff mbox series

media: tc358743: ignore video while HPD is low

Message ID de582d1f-700b-4d95-bd48-196413116455@xs4all.nl (mailing list archive)
State New
Headers show
Series media: tc358743: ignore video while HPD is low | expand

Commit Message

Hans Verkuil April 1, 2025, 9:54 a.m. UTC
If the HPD is low (happens if there is no EDID or the
EDID is being updated), then return -ENOLINK in
tc358743_get_detected_timings() instead of detecting video.

This avoids userspace thinking that it can start streaming when
the HPD is low.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Tested-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/media/i2c/tc358743.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Maxime Ripard April 1, 2025, 11:10 a.m. UTC | #1
On Tue, Apr 01, 2025 at 11:54:17AM +0200, Hans Verkuil wrote:
> If the HPD is low (happens if there is no EDID or the
> EDID is being updated), then return -ENOLINK in
> tc358743_get_detected_timings() instead of detecting video.
> 
> This avoids userspace thinking that it can start streaming when
> the HPD is low.
> 
> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
> Tested-by: Maxime Ripard <mripard@kernel.org>

Thanks for submitting it. It might be worth adding a Link: tag to the
initial discussion?

Maxime
Hans Verkuil April 1, 2025, 12:02 p.m. UTC | #2
On 01/04/2025 13:10, Maxime Ripard wrote:
> On Tue, Apr 01, 2025 at 11:54:17AM +0200, Hans Verkuil wrote:
>> If the HPD is low (happens if there is no EDID or the
>> EDID is being updated), then return -ENOLINK in
>> tc358743_get_detected_timings() instead of detecting video.
>>
>> This avoids userspace thinking that it can start streaming when
>> the HPD is low.
>>
>> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
>> Tested-by: Maxime Ripard <mripard@kernel.org>
> 
> Thanks for submitting it. It might be worth adding a Link: tag to the
> initial discussion?
> 
> Maxime

Good idea:

Link: https://lore.kernel.org/linux-media/20240628-stoic-bettong-of-fortitude-e25611@houat/

Regards,

	Hans
diff mbox series

Patch

diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index c50d4e85dfd1..44060f108277 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -313,6 +313,10 @@  static int tc358743_get_detected_timings(struct v4l2_subdev *sd,

 	memset(timings, 0, sizeof(struct v4l2_dv_timings));

+	/* if HPD is low, ignore any video */
+	if (!(i2c_rd8(sd, HPD_CTL) & MASK_HPD_OUT0))
+		return -ENOLINK;
+
 	if (no_signal(sd)) {
 		v4l2_dbg(1, debug, sd, "%s: no valid signal\n", __func__);
 		return -ENOLINK;