From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE7E63A1A50 for ; Mon, 11 May 2026 12:48:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778503713; cv=none; b=roOYe6YCts/dub9rvy60/ZenW6vYis2VTSrCTthXpHNAASOB+1XBTIsUTHXngOc3Cll2g1B6mmDpFWdFq+zTuAJVE7n5s37u8gmmNzjSRgEUd5RsbV8LeDpnhsIFPT6EiGfxABtKdj+2080nRjXDYCSsLoKy8Z8btXZBnF5SJKs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778503713; c=relaxed/simple; bh=0zB+bY9Sxz541ZyLz8kUrizTZ1iFzl9wXlNjGAffMi8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=FzQWzNYWaJWXTi2Z+GleCG0LTBwVLqmedbMcT6Ee+dEUsWETF1RMl6i57ajlOhk4pTRwl1MTaoTcqWPb9YmaAJWAvLFO/WcttCsXhPMayizvkMaXrqR+woifeD9Se6q+fqCE8K7+eXkTDp2vBAiSsV0/hi7OC1wC3NBOecla9BY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=F5/wKK9r; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=G9zTHpQq; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="F5/wKK9r"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="G9zTHpQq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778503711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JjDZUYmpDlHK2sR+IRwfTQR+l1l8e3DSAuVEYL5/TPk=; b=F5/wKK9rtw+myE1p8mgWTJgdkZycPydrzWjmMg7FPGA3rbfrAU+JerU+OZlftOesFeBqz+ unwlb+K1GjC4lF3lCRNuLKKV8HJEm7m4fl5smYcf2cWKMFeMnsiBHU2B8Tfj6FVWuSJCYm C9a1qoUH3ow+KewB0M4ymgOXsHUZLZw= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-662-0hws_1h9MvGKa2R3qIQeSw-1; Mon, 11 May 2026 08:48:29 -0400 X-MC-Unique: 0hws_1h9MvGKa2R3qIQeSw-1 X-Mimecast-MFC-AGG-ID: 0hws_1h9MvGKa2R3qIQeSw_1778503708 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-48e5eecd0aaso24362795e9.0 for ; Mon, 11 May 2026 05:48:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1778503708; x=1779108508; darn=vger.kernel.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=JjDZUYmpDlHK2sR+IRwfTQR+l1l8e3DSAuVEYL5/TPk=; b=G9zTHpQq+57q+pCGeoPXSLhLKgbJZ8WY/JSSk/XvmPnvkNJV3uSfGTEkbqRKHV3Yjb r1gCkjG3ypxD78xnePYDqL88J10/Huhr/lBsdikauJFZABYmbmYZ7a/E+GJFfGA2C+6e pR7mE04C2lndBhg/StXnnDKxIdzmPnTwtPp4U8pxahy6ChDxYhjS7OiudPvaG35IDw2D 62S/G7mRvlJh+tQVfecYB/z3Gnq49Ws1Guqysi98T0ZoUr1wMIPTaDpOD6wrIIL79/mO WQQT7C7jvyu8UqmzaeL5d+JUlkXIB3IbixvlEhf05GKTjdsKQD8JGd9dOVdGJbWYm/wP tFWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778503708; x=1779108508; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JjDZUYmpDlHK2sR+IRwfTQR+l1l8e3DSAuVEYL5/TPk=; b=A8nfTzS+zQrScxg24BgLHZ4cli8Nk5EDxvp08AEyAFIt+LO2NE1CtnLEb8QEplqvgo gkTLzWcZuesywXEHkVXgwiUQwiLDLJ7vGgsyqdL88tfVNcU6N82KJxUKk2JkrMm1hnau Pn2a3c5/7/D3mjLn7Z9x+szg/ziQB2kQFA4p9QTVR0kEweL/hyCO+6/6epmoqhhlzzCs HxByWXfgptANvKnLpbO9pWPWsZ4brGPaliaupPx/1HW7qqZolcXxSdAiz1ujTbDA6H7L zSzc82xFtcX+3bYR/yzZ4b4SqkGfzphnp1hKfvPTkujlYIl15xZzagZuX2RNcMiHjF84 8T6A== X-Gm-Message-State: AOJu0YxPngEg6kMmip1FtL5B9WY28qe7lTiCA0/Cd2llLJhqV8hp4k/j t/JzQJkWy+2vqP9RuCbyPi3RzQ7u0L2BChuwLy0+2YlPMtvT0YaTXMpItwsXSVhY4L8HNtS6s+L 3xvDvvjjm6A1Jx7Ks2FnPSrv5ORkXXHmzzH2YLE5K2YP4KLssWlKJOKuhZE+NoL4HiA== X-Gm-Gg: Acq92OFndZ2q538ooi++RcrrDmDdTsIvrWTLIbRFkzr45YqjBOaihyt21/CBvr8UFgz VioYIuActHw0QVJnVCAzWyTzT5nx8eCmH+y50sSwzawh9IIWRnmfRAPpF5z1A+SVahXUfxSpDPj WCyJSbP3UVYebJ+dWdg44Rm6s8wJFH2BMGtTO8c+74+7R/QtGW5PAAWuvoJtKLh8zw2Zm4711T8 bC+8r+Ipbw8q6S77NbOPp/OLfNaAtgjE/g5yeb+ggzoRpq5HTx38rpZqqOpSKWCr8GbWOpTa48y 1Iqpr3t7YSkIy4/8tAwwVUP442aB+kyMKaUJyMfAPA2fvpn/o4qE88+IshA0aR9oje2UCL/c9GQ 0DHGKOndKYrV9Hbk6UzaAACImk2wQRzc3As2fHNTEf20fTessonYK X-Received: by 2002:a05:600c:15d3:b0:488:c80c:c236 with SMTP id 5b1f17b1804b1-48e51e0977fmr221128635e9.5.1778503707564; Mon, 11 May 2026 05:48:27 -0700 (PDT) X-Received: by 2002:a05:600c:15d3:b0:488:c80c:c236 with SMTP id 5b1f17b1804b1-48e51e0977fmr221128315e9.5.1778503706900; Mon, 11 May 2026 05:48:26 -0700 (PDT) Received: from localhost ([195.166.127.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e6fffba5fsm176619115e9.2.2026.05.11.05.48.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2026 05:48:26 -0700 (PDT) From: Javier Martinez Canillas To: Maxime Ripard Cc: linux-kernel@vger.kernel.org, Andrzej Hajda , David Airlie , Jernej Skrabec , Jonas Karlman , Laurent Pinchart , Luca Ceresoli , Maarten Lankhorst , Neil Armstrong , Phong LE , Robert Foss , Simona Vetter , Thomas Zimmermann , dri-devel@lists.freedesktop.org Subject: Re: [PATCH 3/3] drm/bridge: it66121: Select HDMI or DVI mode based on sink type In-Reply-To: <20260511-spiritual-unique-uakari-5ffce7@houat> References: <20260510191459.90769-1-javierm@redhat.com> <20260510191459.90769-4-javierm@redhat.com> <20260511-spiritual-unique-uakari-5ffce7@houat> Date: Mon, 11 May 2026 14:48:24 +0200 Message-ID: <877bpayuw7.fsf@ocarina.mail-host-address-is-not-set> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Maxime Ripard writes: Hello Maxime! > Hi, > > On Sun, May 10, 2026 at 09:14:49PM +0200, Javier Martinez Canillas wrote: >> Currently, the driver assumes that the connector sink type is always HDMI >> and configures the IT66121 bridge appropriately. But configuring in this >> mode and enabling the transmission of AVI infoframe packets can cause DVI >> monitors to fail parsing the video signal. >> >> To prevent this, store the connector display information sink type in the >> bridge atomic state and use it to decide whether the bridge should be set >> in HDMI or DVI mode, and if the AVI infoframes packets should be sent. >> >> Assisted-by: Cursor:claude-4.6-opus >> Signed-off-by: Javier Martinez Canillas >> --- >> >> drivers/gpu/drm/bridge/ite-it66121.c | 68 ++++++++++++++++++---------- >> 1 file changed, 44 insertions(+), 24 deletions(-) >> >> diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c >> index a203c94a27e5..99088277d170 100644 >> --- a/drivers/gpu/drm/bridge/ite-it66121.c >> +++ b/drivers/gpu/drm/bridge/ite-it66121.c >> @@ -322,6 +322,7 @@ static inline struct it66121_ctx *bridge_to_it66121_ctx(struct drm_bridge *bridg >> >> struct it66121_bridge_state { >> struct drm_bridge_state base; >> + bool sink_is_hdmi; >> }; >> >> static inline struct it66121_bridge_state * >> @@ -790,6 +791,14 @@ static int it66121_bridge_check(struct drm_bridge *bridge, >> struct drm_connector_state *conn_state) >> { >> struct it66121_ctx *ctx = bridge_to_it66121_ctx(bridge); >> + struct it66121_bridge_state *state = >> + to_it66121_bridge_state(bridge_state); >> + >> + /* Default to HDMI to preserve legacy behavior. */ >> + state->sink_is_hdmi = true; >> + >> + if (conn_state && conn_state->connector) >> + state->sink_is_hdmi = conn_state->connector->display_info.is_hdmi; > > It's really not clear to me why you need to have that in the bridge > state. What's wrong with using drm_display_info.is_hdmi directly? > I wrongly thought that couldn't get that info from it66121_bridge_mode_set() so I thought about making it a property of the bridge atomic state. But I see now that the connector is already stored in struct it66121_ctx *ctx so the fix indeed becomes even more trivial. > If you really want to rework the driver though, switch to HDMI state > helpers would fix all of it :) > Sure, I will do. But I think that is still worth to land a minimal fix and then do the switch to the HDMI state helpers as a follow up. So what do you think of the following patch? (Note that I dropped the Assisted-by tag this time since v2 has been manually written by me, with no assistance from an LLM). >From 02d4e9d306c22375445f062cb4476395aa68df5f Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 11 May 2026 14:43:17 +0200 Subject: [PATCH v2] drm/bridge: it66121: Select HDMI or DVI mode based on sink type Currently, the driver assumes that the connector sink type is always HDMI, so it configures the bridge in this mode and enables the transmission of AVI infoframe packets. But this can cause problems on DVI monitors that can fail to interpret the video signal and lead to not having display output. Check the connector display information sink type to decide whether DVI or HDMI mode should be set and if the AVI infoframes packets should be sent. Signed-off-by: Javier Martinez Canillas --- Changes in v2: - Don't store the sink type in a per-commit bridge state (Maxime). drivers/gpu/drm/bridge/ite-it66121.c | 67 +++++++++++++++++----------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c index 19a027d75b61..a9c5bab665af 100644 --- a/drivers/gpu/drm/bridge/ite-it66121.c +++ b/drivers/gpu/drm/bridge/ite-it66121.c @@ -182,6 +182,7 @@ #define IT66121_HDMI_MODE_REG 0xC0 #define IT66121_HDMI_MODE_HDMI BIT(0) +#define IT66121_HDMI_MODE_DVI 0 #define IT66121_SYS_STATUS_REG 0x0E #define IT66121_SYS_STATUS_ACTIVE_IRQ BIT(7) @@ -766,41 +767,55 @@ void it66121_bridge_mode_set(struct drm_bridge *bridge, { u8 buf[HDMI_INFOFRAME_SIZE(AVI)]; struct it66121_ctx *ctx = container_of(bridge, struct it66121_ctx, bridge); + struct drm_connector *connector = ctx->connector; int ret; mutex_lock(&ctx->lock); - ret = drm_hdmi_avi_infoframe_from_display_mode(&ctx->hdmi_avi_infoframe, ctx->connector, - adjusted_mode); - if (ret) { - DRM_ERROR("Failed to setup AVI infoframe: %d\n", ret); - goto unlock; - } + if (!connector || connector->display_info.is_hdmi) { + ret = drm_hdmi_avi_infoframe_from_display_mode(&ctx->hdmi_avi_infoframe, + connector, + adjusted_mode); + if (ret) { + DRM_ERROR("Failed to setup AVI infoframe: %d\n", ret); + goto unlock; + } - ret = hdmi_avi_infoframe_pack(&ctx->hdmi_avi_infoframe, buf, sizeof(buf)); - if (ret < 0) { - DRM_ERROR("Failed to pack infoframe: %d\n", ret); - goto unlock; - } + ret = hdmi_avi_infoframe_pack(&ctx->hdmi_avi_infoframe, buf, sizeof(buf)); + if (ret < 0) { + DRM_ERROR("Failed to pack infoframe: %d\n", ret); + goto unlock; + } - /* Write new AVI infoframe packet */ - ret = regmap_bulk_write(ctx->regmap, IT66121_AVIINFO_DB1_REG, - &buf[HDMI_INFOFRAME_HEADER_SIZE], - HDMI_AVI_INFOFRAME_SIZE); - if (ret) - goto unlock; + /* Write new AVI infoframe packet */ + ret = regmap_bulk_write(ctx->regmap, IT66121_AVIINFO_DB1_REG, + &buf[HDMI_INFOFRAME_HEADER_SIZE], + HDMI_AVI_INFOFRAME_SIZE); + if (ret) + goto unlock; - if (regmap_write(ctx->regmap, IT66121_AVIINFO_CSUM_REG, buf[3])) - goto unlock; + if (regmap_write(ctx->regmap, IT66121_AVIINFO_CSUM_REG, buf[3])) + goto unlock; - /* Enable AVI infoframe */ - if (regmap_write(ctx->regmap, IT66121_AVI_INFO_PKT_REG, - IT66121_AVI_INFO_PKT_ON | IT66121_AVI_INFO_PKT_RPT)) - goto unlock; + /* Enable AVI infoframe */ + if (regmap_write(ctx->regmap, IT66121_AVI_INFO_PKT_REG, + IT66121_AVI_INFO_PKT_ON | IT66121_AVI_INFO_PKT_RPT)) + goto unlock; - /* Set TX mode to HDMI */ - if (regmap_write(ctx->regmap, IT66121_HDMI_MODE_REG, IT66121_HDMI_MODE_HDMI)) - goto unlock; + /* Set TX mode to HDMI */ + if (regmap_write(ctx->regmap, IT66121_HDMI_MODE_REG, + IT66121_HDMI_MODE_HDMI)) + goto unlock; + } else { + /* Disable AVI infoframe */ + if (regmap_write(ctx->regmap, IT66121_AVI_INFO_PKT_REG, 0)) + goto unlock; + + /* Set TX mode to DVI */ + if (regmap_write(ctx->regmap, IT66121_HDMI_MODE_REG, + IT66121_HDMI_MODE_DVI)) + goto unlock; + } if ((ctx->id == ID_IT66121 || ctx->id == ID_IT66122) && regmap_write_bits(ctx->regmap, IT66121_CLK_BANK_REG, -- 2.54.0 -- Best regards, Javier Martinez Canillas Core Platforms Red Hat