From patchwork Wed Jul 22 09:11:46 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicolas Frattaroli X-Patchwork-Id: 309 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mxe881.netcup.net (Postfix) with ESMTPS id A6A0C1C0BC1 for ; Wed, 22 Jul 2026 11:27:57 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=collabora.com; spf=pass (sender IP is 104.64.211.4) smtp.mailfrom=linux-sunxi+bounces-24583-noreply=patchwork.local@lists.linux.dev smtp.helo=sin.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 104.64.211.4 as permitted sender) client-ip=104.64.211.4; envelope-from=linux-sunxi+bounces-24583-noreply=patchwork.local@lists.linux.dev; helo=sin.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sin.lore.kernel.org (Postfix) with ESMTP id ACAAB3058662 for ; Wed, 22 Jul 2026 09:13:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3B0A48094A; Wed, 22 Jul 2026 09:12:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b="ihIwcVvE" X-Original-To: linux-sunxi@lists.linux.dev Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (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 F327F480341 for ; Wed, 22 Jul 2026 09:12:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784711574; cv=pass; b=BM4SFXMLeBEzkQiFngkopP3xL1o0lbLTVPmytCRleVAP7J9KyVC5y9LkTexemOvIp//z/XDs7bAKS7MHZOVTTKhWh6mq331ydhrE21HPoxmXGlPEe5xJZcjPBEA6HZCIkLGBv+nklcFwLFgje8rEVcZ0TJct0eDd491qRfRyoGY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784711574; c=relaxed/simple; bh=4VW4BSnF9vM1jQ0rERfU6CfKNgpPVDh2vD0MM8n52jA=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=pozJ/U97YG9zZ3BBqEw3wnj0/bqvDvQ+9Ht06HPzjYJkOk58WgQSEForvtB8a5HGnkJLvWSCaO+TsK6mKvgcWW8GY0XVQj/6IenapLTkX5MUTdv9SUeGaeaEl4ZPEcTA1M8jd2Dby4ip60vlfOXOKGC1CUqUVrUikAIsNPN0zbw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b=ihIwcVvE; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com ARC-Seal: i=1; a=rsa-sha256; t=1784711531; cv=none; d=zohomail.com; s=zohoarc; b=QBanPf5sfMjuNVL+LNPXpbNTTsrVtmsz6BtBsxIFBxklXoHihhzgAHP2gCbhpIHRsGDtuINiwmk1M6sXZ9L8nl8QNgc9Dp/Y0fzVUlMozHCKpm8elmNUOcr6s+457u9RJ3gugVv/DipD65lEggklVxGdpUPoURx1rn6P2jPL14I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784711531; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=mKhIR4Ek3ICMYJEFEVH0hFZdQnpuziqGCYr67mB6Fzc=; b=Qeqztj0KyhYSK7kbkB+uYNUGgee9KSa9xrNd7Bts0vGHyCiVPJq/vuoh8PROwvZ/L9FkMGs9afOpGEI1GNqIiG6lfzLn286+mlEZCL+ZSo5w4tzbfJC0VwUS2V4/t7Pbmliqm5gIXgjf78Wn7Hy4hDxlv+bvnfj6UsHwKX/ii/0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=nicolas.frattaroli@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1784711530; s=zohomail; d=collabora.com; i=nicolas.frattaroli@collabora.com; h=From:From:Subject:Subject:Date:Date:Message-Id:Message-Id:MIME-Version:Content-Type:Content-Transfer-Encoding:To:To:Cc:Cc:Reply-To; bh=mKhIR4Ek3ICMYJEFEVH0hFZdQnpuziqGCYr67mB6Fzc=; b=ihIwcVvEg5PSCHk2IhIp3oFYGUk1DZXH6eiQUifHbJLak6INsVmmCF2PDglXa0zr pQbsCg0qGrF4KdeG/zIG0pRB5P0arirKiK8DjL0dcqsDAKtqmzKNG0hAa6qELdAiI9D MUeeb3YshLGdK8ZOjiM/NiFI8wqOfejn9IC/Jn3o= Received: by mx.zohomail.com with SMTPS id 1784711528684463.52529575154904; Wed, 22 Jul 2026 02:12:08 -0700 (PDT) From: Nicolas Frattaroli Subject: [PATCH v8 0/5] Add SCDC information to connector debugfs Date: Wed, 22 Jul 2026 11:11:46 +0200 Message-Id: <20260722-scdc-link-health-v8-0-cd1dacbb85d9@collabora.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAAAAAAAC/23QzU7DMAwH8FeZciYQ57PdifdAHJzEpYFu3dquA k17d9Ju0ibIKbJi//yXz2ykIdHItpszG2hOY+r3uaieNiy0uP8gnmKumRTSCg2KjyEG3qX9F28 Ju6nlVa3yF6hY28Dy2GGgJn2v5Nv7tR5P/pPCtDi3joGOp7xrurYxjyPx0O92adpu4rDjUzq83 F62IG0ap374WWPOsM7cEpn/iWbgglfkFFBVETbiNfRdh74f8DkvWcFZ3hEjRQGRGTEA2EAVotW +hKhHxBYQtSA1adSIhBFKiH5EXAHRGbFSEmqB0Ji6hJg7kq9SQExGAMApLzCoSCXEPiAABcQuS ZRwlTNovSki7o44WUJcRmoZG/AWo2nCX+RyufwCRmV4X5cCAAA= X-Change-ID: 20260413-scdc-link-health-89326013d96c To: Jani Nikula , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Daniel Stone , Hans Verkuil , Chen-Yu Tsai , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Nicolas Frattaroli , Dmitry Baryshkov X-Mailer: b4 0.15.2 X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [-2.16 / 15.00]; BAYES_HAM(-5.50)[100.00%]; RBL_SENDERSCORE(2.00)[104.64.211.4:from]; SUSPICIOUS_RECIPS(1.50)[]; MAILLIST(-0.15)[generic]; MIME_GOOD(-0.10)[text/plain]; BAD_REP_POLICIES(0.10)[]; HAS_LIST_UNSUB(-0.01)[]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=2]; PRECEDENCE_BULK(0.00)[]; TAGGED_RCPT(0.00)[cisco]; DBL_BLOCKED_OPENRESOLVER(0.00)[sin.lore.kernel.org:rdns,sin.lore.kernel.org:helo]; FROM_HAS_DN(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_TWELVE(0.00)[27]; FORGED_SENDER_MAILLIST(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; FROM_NEQ_ENVFROM(0.00)[nicolas.frattaroli@collabora.com,linux-sunxi@lists.linux.dev]; DMARC_POLICY_ALLOW(0.00)[collabora.com,none]; FREEMAIL_TO(0.00)[linux.intel.com,kernel.org,suse.de,gmail.com,ffwll.ch,intel.com,linaro.org,ideasonboard.com,kwiboo.se,bootlin.com,fooishbar.org,sholland.org,raspberrypi.com,igalia.com]; DKIM_TRACE(0.00)[collabora.com:+]; R_SPF_ALLOW(0.00)[+ip4:104.64.211.4]; R_DKIM_ALLOW(0.00)[collabora.com:s=zohomail]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:63949, ipnet:104.64.192.0/19, country:SG]; MIME_TRACE(0.00)[0:+]; TAGGED_FROM(0.00)[bounces-24583-noreply=patchwork.local]; MID_RHS_MATCH_FROM(0.00)[]; TO_DN_SOME(0.00)[] X-Rspamd-Queue-Id: A6A0C1C0BC1 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= HDMI uses the DDC I2C bus for communicating various bits of link status out of band with the actual HDMI video signal. This information can be useful for debugging issues like questionable cables sabotaged by feline teeth, Enthusiast Grade cables made of cow fencing wire, and other such problems that ruin one's media viewing plans. Consequently, this series exposes various bits of pertinent information from the SCDC protocol in an HDMI connector's debugfs. To continually poll the link status, userspace can poll the debugfs file. --- Changes in v8: - Acquire mode_config mutex in an interruptible way during scdc_status_show to avoid racing connector state - Remove scdc_debugfs_priv, use connector as debugfs entry priv instead - Allocate and free state in scdc_status_show, since it doesn't need to persist across debugfs reads - Check for NULL ddc in drm_scdc_read_state in the unlikely event an EDID with the SCDC flag was forced on a connector with no DDC - Note: drm_connector_get() is omitted from drm_scdc_debugfs_init because drm_scdc_debugfs_init is called on connector construction and the debugfs is removed on connector destruction. Adding a redundant reference increase here would necessitate introducing a destruction callback to mirror the debugfs_init connector op for the sole purpose of decreasing the counter again. - Link to v7: https://patch.msgid.link/20260721-scdc-link-health-v7-0-92df1b6ad5fc@collabora.com Changes in v7: - Move HDMI debugfs registration to new state helper, fix up all users (sun4i, vc4, bridge) - Register scdc debugfs in new hdmi debugfs helper - Link to v6: https://patch.msgid.link/20260611-scdc-link-health-v6-0-6307875a6b5e@collabora.com Changes in v6: - Fix off-by-one error in drm_scdc_read_state - Link to v5: https://patch.msgid.link/20260604-scdc-link-health-v5-0-11173b0ac3de@collabora.com Changes in v5: - Read all SCDC data regardless of update flags - Dump SCDC data as hex before the human-readable output. It's separated with "\n----------------\n\n". - No longer write 0 to read-only registers - Add Reed-Solomon Corrections counter parsing - Parsing has been kept. A desire was expressed to get this data without any external userspace tooling, and the kernel will need to parse it eventually anyway to set the link status. - Functions have been made static as of right now, since external users may do another pass over the function signatures anyway. - Link to v4: https://patch.msgid.link/20260527-scdc-link-health-v4-0-622ea40a1f59@collabora.com Changes in v4: - Don't use C struct bitfields for parsing status flags. Switch to bitwise AND for boolean flags, and FIELD_GET for multi-bit values. - Drop the superfluous !! and parens - Drop the __pure attributes on static functions - Initialise stack local arrays with {}, not { 0 }. - I've kept the print macros and %-30s format. Reason being that I don't want to repeat the format specifier and str_yes_no(foo) a bunch, and I like the %-30s format because it means all values are aligned with the value of the longest field, which is 30 chars long. - Link to v3: https://patch.msgid.link/20260526-scdc-link-health-v3-0-59e4a4aaead1@collabora.com Changes in v3: - Add patch to change return type of drm_scdc_read/write. - Rework error counter reading to duplicate less code. - Also check lane 3 counter valid flag when reading its error counter. - Use memset to clear buf for error counters, rather than doing it in the loop. - Make read_error_counters not accept 0 as num_lanes; fix it up in the caller instead. - Link to v2: https://patch.msgid.link/20260520-scdc-link-health-v2-0-511af18cd64b@collabora.com Changes in v2: - Add HDMI 2.1 SCDC status reporting - Link to v1: https://patch.msgid.link/20260415-scdc-link-health-v1-0-8e731e88eaf0@collabora.com To: Jani Nikula To: Maarten Lankhorst To: Maxime Ripard To: Thomas Zimmermann To: David Airlie To: Simona Vetter To: Andrzej Hajda To: Neil Armstrong To: Robert Foss To: Laurent Pinchart To: Jonas Karlman To: Jernej Skrabec To: Luca Ceresoli To: Daniel Stone To: Hans Verkuil To: Chen-Yu Tsai To: Samuel Holland To: Dave Stevenson To: MaĆ­ra Canal To: Raspberry Pi Kernel Maintenance Cc: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org Cc: kernel@collabora.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-sunxi@lists.linux.dev Signed-off-by: Nicolas Frattaroli --- Nicolas Frattaroli (5): drm/scdc-helper: Don't use ssize_t return type for scdc_read/write drm/scdc-helper: Add scdc_status debugfs entry drm/scdc-helper: Implement parsing and printing HDMI 2.1 fields drm/debugfs: Move HDMI debugfs registration to state helper drm/display: hdmi-state-helper: Init SCDC debugfs for HDMI drivers/gpu/drm/display/drm_bridge_connector.c | 3 + drivers/gpu/drm/display/drm_hdmi_state_helper.c | 156 +++++++++++++ drivers/gpu/drm/display/drm_scdc_helper.c | 287 +++++++++++++++++++++++- drivers/gpu/drm/drm_debugfs.c | 157 ------------- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 1 + drivers/gpu/drm/vc4/vc4_hdmi.c | 1 + include/drm/display/drm_hdmi_state_helper.h | 3 + include/drm/display/drm_scdc.h | 21 +- include/drm/display/drm_scdc_helper.h | 103 ++++++++- 9 files changed, 566 insertions(+), 166 deletions(-) --- base-commit: 9766e5bd48f44e1f249f60fdf8dfd1f0aaf22e6b change-id: 20260413-scdc-link-health-89326013d96c Best regards, -- Nicolas Frattaroli