From nobody Mon Dec 8 02:41:23 2025 Received: from CH4PR04CU002.outbound.protection.outlook.com (mail-northcentralusazhn15013047.outbound.protection.outlook.com [52.102.146.47]) (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 8B49A363B96 for ; Thu, 30 Oct 2025 15:16:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.102.146.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761837418; cv=fail; b=r/g8KZauNBQjrUX3/Fygp7o9kMQl55Vg6RoygNJ1Gt5d5rLXy1RcqP4l4idnMJ7/0mDUpAaz2vHBYGi7VUJp+ZKP8KUmVEFgNEOBHBupspLcHCPRDp5wC3CemsfYAkGoZGHRcRxvuh3sWZ6OnDJXJ8gj4k2yyi8sP1e8BFFC0Tk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761837418; c=relaxed/simple; bh=zdVR9Ly+ZxpaqdIx8eQFj2LXDRMjTP360b1vOgJRfBc=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=MOt0QId5n8hX0VGvRNlUzh9IAPN89e8IoWWPkbGlH2Jtrt8YFccFwMkm55cypPygVHe5TGOwEnxy/YpR4VRKcP7ciX+a/bg2lOb+yRmXK5k9uvOGiJRTD5iItkEoB82c3UJJDZCC0pkGGCJyOmMjo9P/A1hnDJTWawsqguSn+T4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=JVO0aF/y; arc=fail smtp.client-ip=52.102.146.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="JVO0aF/y" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=s0Ow5Melmhos8LRZ3+LbwX/zM9oe9YyMoCeKHHxNBnmfnVVKKNFp+eXyZP/k9t7nxk/0zGuoNm+EpDwTfeQKgoSXcRFiW9B2/e2kEiAffdvT1gZKOpuIsaX6+5NKVrQ8Ov3ybYKQJTd6fQ5/eKpP5YML0O4WbJ3r0WIxu/GfOg6mL01DVo0lQpzwITtu1WoNhhRmlZ3BqXJfmpDUd2Fn3UvJrRSgmKPYgQjnrZR8WYZb8UNh/O2gbOSbUOdm71dyGS1Lmbvt0WedEACY1iKmgHCvcH3v4UdDiWpYakQMsRnY/dLBtVI3tZ76Y4Kut4x1pcBAl4oyAN+gvzY7QcZBIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/zjsI4ere3RF6WjIvk42ArA/oNQ/lAfnkcfk8lkkjEM=; b=obQr79ZBvXTaQzqc8aNB5vmE6+JjSNcvC73SkxY9vV1VWSROarz5mF5jV9NGeff2ehi31inRLcuwlpTIpSNh9LJzn/9rz/CyLokl9Ushp1AC0sWVu3oYsQtKlfaLqgvqUvu0PSlx82SwX0SHL6uEXC/xJF+uwHum6p1yvSepc7IMQlTrOiHDuSRfe/HFoI2YzN66F9Te28PGqrJgPwRjDBdOaVA7FNj4rqWJ5LlrZNHmiG7rHv44GiM83R5sqimpxtaNDckhRsdAY6XnmF4Q8+WYI0c7lg3/wao+9l7Hw8vwGcVLMgV0Mz34f4+eYS7T1HmZ1SiWrtVJSbGBfqpMOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 198.47.21.195) smtp.rcpttodomain=oss.qualcomm.com smtp.mailfrom=ti.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=ti.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/zjsI4ere3RF6WjIvk42ArA/oNQ/lAfnkcfk8lkkjEM=; b=JVO0aF/yyHExmGqdJUVPVERVP0pYq4Kmn6opWlNRYcZhIIkj1ddflNZjyo2/girO50FRrD/ff29x2h/VGEp2LlDy+AEoWYtfaXIvRBgCwwzIJbko4E3Vnk7MVfhRBmB6rfpa9FuRQZCIesNeChCeKgHsajIW4TNfHmDBpaq+KJE= Received: from PH7P221CA0067.NAMP221.PROD.OUTLOOK.COM (2603:10b6:510:328::28) by DS7PR10MB5102.namprd10.prod.outlook.com (2603:10b6:5:38c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9253.18; Thu, 30 Oct 2025 15:16:52 +0000 Received: from CO1PEPF000044FA.namprd21.prod.outlook.com (2603:10b6:510:328:cafe::d8) by PH7P221CA0067.outlook.office365.com (2603:10b6:510:328::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9275.15 via Frontend Transport; Thu, 30 Oct 2025 15:16:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 198.47.21.195) smtp.mailfrom=ti.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ti.com; Received-SPF: Pass (protection.outlook.com: domain of ti.com designates 198.47.21.195 as permitted sender) receiver=protection.outlook.com; client-ip=198.47.21.195; helo=flwvzet201.ext.ti.com; pr=C Received: from flwvzet201.ext.ti.com (198.47.21.195) by CO1PEPF000044FA.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9298.0 via Frontend Transport; Thu, 30 Oct 2025 15:16:50 +0000 Received: from DFLE212.ent.ti.com (10.64.6.70) by flwvzet201.ext.ti.com (10.248.192.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Thu, 30 Oct 2025 10:16:37 -0500 Received: from DFLE208.ent.ti.com (10.64.6.66) by DFLE212.ent.ti.com (10.64.6.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Thu, 30 Oct 2025 10:16:37 -0500 Received: from lelvem-mr05.itg.ti.com (10.180.75.9) by DFLE208.ent.ti.com (10.64.6.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20 via Frontend Transport; Thu, 30 Oct 2025 10:16:36 -0500 Received: from localhost (ti.dhcp.ti.com [172.24.233.157] (may be forged)) by lelvem-mr05.itg.ti.com (8.18.1/8.18.1) with ESMTP id 59UFGZs82361018; Thu, 30 Oct 2025 10:16:36 -0500 From: Devarsh Thakkar To: , , , , , , , , , , CC: , , , , , , , , , Subject: [PATCH v4] drm/bridge: sii902x: Fix HDMI detection with DRM_BRIDGE_ATTACH_NO_CONNECTOR Date: Thu, 30 Oct 2025 20:46:35 +0530 Message-ID: <20251030151635.3019864-1-devarsht@ti.com> X-Mailer: git-send-email 2.39.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FA:EE_|DS7PR10MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: 99d5a7e8-1337-4d9b-4c47-08de17c759ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|82310400026|34020700016|36860700013|921020|12100799066; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?LMyS9u6DXZT/S5gW0F4A3M0BhvOVaxgtdhakp+jrOD711xF/CXx9hBLVlMmA?= =?us-ascii?Q?ePxJ1/gcWXf4xwyiDcUnECCJf9lWjNRn+96IAaicrA/QL8v8Mr25tbchCb4S?= =?us-ascii?Q?QuceqHb23zTCW/dNqz0PliiZmghE8/CqBdmrWvRmdddHtTXGAgMDAvV0OaeV?= =?us-ascii?Q?4qcGz6xRdNVII59JWmGM5NglclF4tq3VaRuxTXBh4xY7IcchI/qrmbFrwIMo?= =?us-ascii?Q?8tsgSrrqAaj0tfrz2I7EiimylP8M07HWzWxNzGgLCmVR9tMYpohXkl5TTUhJ?= =?us-ascii?Q?26mvYx6lkUoa8dLIflSNDhQ3PP6CMY+MBB7CZo+FVv0Ftxn/9xUJvRscejDe?= =?us-ascii?Q?3VlvQ2Dg6sZP8AtLYvdm9N5a4e3Tax6WD7AM+j6dt1EA4nSh9DjMTIGw/SKF?= =?us-ascii?Q?FT3xjFk0CJItuHFwA5EHrzFoyStWzkrzDN0xPd6lItjJLZ6xE5mAFqbUNyBT?= =?us-ascii?Q?pSNtUqoVl7WlfuKHPve2sDxNoyrBqD3kpStjPEcVYnNtgR0sYbqPsWGvLEhS?= =?us-ascii?Q?bOqRkaViUPgHtLWllQjiJqIvhxHe7GxKwLX9RcYkNKelvODZ/Qi/ImL+wYXk?= =?us-ascii?Q?jGQM92FCsx8i6jkVds4p37qcfIU6v7nb6B0NfLGdTdShcDxnQopb1Azfkqca?= =?us-ascii?Q?bCPIMsZ65sGQdTmVbK9MccUMScSHuE8cijSrOpAC8ImN+EPNDsVxPSZk+WpV?= =?us-ascii?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= X-Forefront-Antispam-Report: CIP:198.47.21.195;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:flwvzet201.ext.ti.com;PTR:ErrorRetry;CAT:NONE;SFS:(13230040)(7416014)(376014)(1800799024)(82310400026)(34020700016)(36860700013)(921020)(12100799066);DIR:OUT;SFP:1501; X-OriginatorOrg: ti.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2025 15:16:50.5100 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 99d5a7e8-1337-4d9b-4c47-08de17c759ce X-MS-Exchange-CrossTenant-Id: e5b49634-450b-4709-8abb-1e2b19b982b7 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=e5b49634-450b-4709-8abb-1e2b19b982b7;Ip=[198.47.21.195];Helo=[flwvzet201.ext.ti.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044FA.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5102 Content-Type: text/plain; charset="utf-8" The sii902x driver was caching HDMI detection state in a sink_is_hdmi field and checking it in mode_set() to determine whether to set HDMI or DVI output mode. This approach had two problems: 1. With DRM_BRIDGE_ATTACH_NO_CONNECTOR (used by modern display drivers like TIDSS), the bridge's get_modes() is never called. Instead, the drm_bridge_connector helper calls the bridge's edid_read() and updates the connector itself. This meant sink_is_hdmi was never populated, causing the driver to default to DVI mode and breaking HDMI audio. 2. The mode_set() callback doesn't receive atomic state or connector pointer, making it impossible to check connector->display_info.is_hdmi directly at that point. Fix this by moving the HDMI vs DVI decision from mode_set() to atomic_enable(), where we can access the connector via drm_atomic_get_new_connector_for_encoder(). This works for both connector models: - With DRM_BRIDGE_ATTACH_NO_CONNECTOR: Returns the drm_bridge_connector created by the display driver, which has already been updated by the helper's call to drm_edid_connector_update() - Without DRM_BRIDGE_ATTACH_NO_CONNECTOR (legacy): Returns the connector embedded in sii902x struct, which gets updated by the bridge's own get_modes() Fixes: 3de47e1309c2 ("drm/bridge: sii902x: use display info is_hdmi") Signed-off-by: Devarsh Thakkar Reviewed-by: Tomi Valkeinen --- V4: Shift HDMI detection to atomic_enable() and remove sink_is_hdmi caching V3: Use drm_edid_connector_update without edid NULL check V2: Use drm_edid_connector_update to detect HDMI Link to V3: https://lore.kernel.org/all/20251007112309.1103811-1-devarsht@ti.com/ Link to V2: https://lore.kernel.org/all/20251006150714.3144368-1-devarsht@ti.com/ Link to V1: https://lore.kernel.org/all/20251003143642.4072918-1-devarsht@ti.com/ drivers/gpu/drm/bridge/sii902x.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii9= 02x.c index d537b1d036fb..1f0aba28ad1e 100644 --- a/drivers/gpu/drm/bridge/sii902x.c +++ b/drivers/gpu/drm/bridge/sii902x.c @@ -179,7 +179,6 @@ struct sii902x { struct drm_connector connector; struct gpio_desc *reset_gpio; struct i2c_mux_core *i2cmux; - bool sink_is_hdmi; u32 bus_width; =20 /* @@ -315,8 +314,6 @@ static int sii902x_get_modes(struct drm_connector *conn= ector) drm_edid_free(drm_edid); } =20 - sii902x->sink_is_hdmi =3D connector->display_info.is_hdmi; - return num; } =20 @@ -342,9 +339,17 @@ static void sii902x_bridge_atomic_enable(struct drm_br= idge *bridge, struct drm_atomic_state *state) { struct sii902x *sii902x =3D bridge_to_sii902x(bridge); + struct drm_connector *connector; + u8 output_mode =3D SII902X_SYS_CTRL_OUTPUT_DVI; + + connector =3D drm_atomic_get_new_connector_for_encoder(state, bridge->enc= oder); + if (connector && connector->display_info.is_hdmi) + output_mode =3D SII902X_SYS_CTRL_OUTPUT_HDMI; =20 mutex_lock(&sii902x->mutex); =20 + regmap_update_bits(sii902x->regmap, SII902X_SYS_CTRL_DATA, + SII902X_SYS_CTRL_OUTPUT_MODE, output_mode); regmap_update_bits(sii902x->regmap, SII902X_PWR_STATE_CTRL, SII902X_AVI_POWER_STATE_MSK, SII902X_AVI_POWER_STATE_D(0)); @@ -359,16 +364,12 @@ static void sii902x_bridge_mode_set(struct drm_bridge= *bridge, const struct drm_display_mode *adj) { struct sii902x *sii902x =3D bridge_to_sii902x(bridge); - u8 output_mode =3D SII902X_SYS_CTRL_OUTPUT_DVI; struct regmap *regmap =3D sii902x->regmap; u8 buf[HDMI_INFOFRAME_SIZE(AVI)]; struct hdmi_avi_infoframe frame; u16 pixel_clock_10kHz =3D adj->clock / 10; int ret; =20 - if (sii902x->sink_is_hdmi) - output_mode =3D SII902X_SYS_CTRL_OUTPUT_HDMI; - buf[0] =3D pixel_clock_10kHz & 0xff; buf[1] =3D pixel_clock_10kHz >> 8; buf[2] =3D drm_mode_vrefresh(adj); @@ -384,11 +385,6 @@ static void sii902x_bridge_mode_set(struct drm_bridge = *bridge, =20 mutex_lock(&sii902x->mutex); =20 - ret =3D regmap_update_bits(sii902x->regmap, SII902X_SYS_CTRL_DATA, - SII902X_SYS_CTRL_OUTPUT_MODE, output_mode); - if (ret) - goto out; - ret =3D regmap_bulk_write(regmap, SII902X_TPI_VIDEO_DATA, buf, 10); if (ret) goto out; --=20 2.39.1