From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 396E5C61CE2 for ; Tue, 25 Aug 2026 10:26:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OowzZSdopVFqMTUbLeRAwbV+zDsY4spq+S3rT7O7VN0=; b=z9HsBYa+x2Kkl2 rnb9v2cSG4q8FFSFpW24QHtgiGb9FHUPWti7fNwDjEe/aPYEAV2jOdIl9RuD5TEvaavAwa6rNc4nc W2KrVMaBcyDypc+WOpnA0e/HbNiVUrONMY6uSzKtR9HXUCxspQBXgy5KxnLkZYG7PaBc1JYrMlZiP oPwACfUSUdtO8oyzcJQknGizse+zptkJeimw/N61CyRj5FLB1m1MOTA0qCD47RjHa+Zh1eHf5zDWH wVkCLPns26CORQNI/+Mz/kGk4vmwyo4x9vYyMSofVOdn1+0x+vES9t7xgW2HLSLo09C648WI65XD+ /12aIXepBqMt6iHj2Asg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wyoMd-00000000bPW-1rUn; Tue, 25 Aug 2026 10:26:43 +0000 Received: from bali.collaboradmins.com ([148.251.105.195]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wyoMZ-00000000bOe-2VTX; Tue, 25 Aug 2026 10:26:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1787653591; bh=wdwDOSk5hX6BER010tdloX7TyIracwF8Sfqo/V+QHdc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=bTxbJf5fS32zFSecAaSleGRbfLnJKIjWUgmVnz7TLVMEdem/S0w4d6UBoDPhm7sUg mnbrQwdKnlIrP8veP+1xkVGKCZQ/843/WX01n1joRiW7rUcazDBFpTMKVSSQa0cPu8 PJpjvsxkgYEB+mJNjIFPRkHY2SU44/hj+RhStHRgzT/0+NPGiPcByxBQwWC5CDdXnb WZx8cpQTFBQnEgRU8Vy+1yObkV3UmLsFQEEo0xNhsEE0K+Or+DRJAggCo8mQgJ8b91 NMGSVeP6wkjJ0gPx2tqvWqOgtmLZGvxpg4/8ZMacCPZ1/bYYw7dfOaO/J1T2w/pYjE ktV6450DXU1Pw== Received: from [100.64.0.241] (unknown [100.64.0.241]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id E097D17E084E; Tue, 25 Aug 2026 12:26:30 +0200 (CEST) Message-ID: <0e66c987-866a-4166-a850-14e7d03ea69f@collabora.com> Date: Tue, 25 Aug 2026 13:26:30 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v10 22/69] drm/display: hdmi-state-helper: Sync SCDC state on hotplug To: Maxime Ripard Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Samuel Holland , Dave Stevenson , =?UTF-8?Q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Sandy Huang , =?UTF-8?Q?Heiko_St=C3=BCbner?= , Andy Yan , Algea Cao , Daniel Stone , Liu Ying , Phong LE , kernel@collabora.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-rockchip@lists.infradead.org, Maud Spierings , Diederik de Haas References: <20260731-dw-hdmi-qp-scramb-v10-0-294364b2cf15@collabora.com> <20260731-dw-hdmi-qp-scramb-v10-22-294364b2cf15@collabora.com> <20260820-accomplished-curly-bandicoot-cc36ba@houat> <774c38bd-6569-4aff-9fbc-a4e017840a55@collabora.com> <20260825-potoo-of-imaginary-unity-7b0999@penduick> Content-Language: en-US From: Cristian Ciocaltea In-Reply-To: <20260825-potoo-of-imaginary-unity-7b0999@penduick> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260825_032639_816030_F373CD33 X-CRM114-Status: GOOD ( 28.08 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org On 8/25/26 12:25 PM, Maxime Ripard wrote: > On Thu, Aug 20, 2026 at 05:44:08PM +0300, Cristian Ciocaltea wrote: >> On 8/20/26 11:53 AM, Maxime Ripard wrote: >>> On Fri, Jul 31, 2026 at 07:19:29PM +0300, Cristian Ciocaltea wrote: >>>> drm_atomic_helper_connector_hdmi_hotplug() does not currently >>>> synchronize SCDC status on hotplug events, leaving the scrambler state >>>> potentially inconsistent after (re)connect. >>>> >>>> Hook drm_connector_hdmi_sync_scdc() into both the connect and disconnect >>>> paths, replacing the existing TODOs around missing scrambler handling. >>>> >>>> Tested-by: Maud Spierings >>>> Tested-by: Diederik de Haas # NanoPC-T6 LTS, Rock 5B >>>> Signed-off-by: Cristian Ciocaltea >>>> --- >>>> drivers/gpu/drm/display/drm_hdmi_state_helper.c | 23 ++++++++++++++--------- >>>> 1 file changed, 14 insertions(+), 9 deletions(-) >>>> >>>> diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c >>>> index 4a93c279c9a7..3377ea936120 100644 >>>> --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c >>>> +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c >>>> @@ -1205,13 +1205,16 @@ drm_atomic_helper_connector_hdmi_update(struct drm_connector *connector, >>>> enum drm_connector_status status) >>>> { >>>> const struct drm_edid *drm_edid; >>>> + int ret = 0; >>>> >>>> if (status == connector_status_disconnected) { >>>> - // TODO: also handle scramber, HDMI sink disconnected. >>>> - drm_connector_hdmi_audio_plugged_notify(connector, false); >>>> - drm_edid_connector_update(connector, NULL); >>>> - drm_connector_cec_phys_addr_invalidate(connector); >>>> - return 0; >>>> + ret = drm_connector_hdmi_sync_scdc(connector, false, ctx); >>>> + if (ret != -EDEADLK) { >>>> + drm_connector_hdmi_audio_plugged_notify(connector, false); >>>> + drm_edid_connector_update(connector, NULL); >>>> + drm_connector_cec_phys_addr_invalidate(connector); >>>> + } >>> >>> If there's a deadlock, shouldn't we restart the whole sequence there? >> >> In that case we do already propagate -EDEADLK and let the callers >> (drm_helper_probe_detect_ctx(), drm_helper_probe_single_connector_modes()) >> to ensure the sequence is restarted. >> >>> Ie, we should return ret all the time anyway? And if we do that, we >>> should return ret for drm_edid_connector_update() too. >> >> Per .detect_ctx() contract, implementations shall return a drm_connector_status >> value or -EDEADLK only. On the other hand, .force_ctx() accepts any error code, >> but the probe helpers just log it. Hence returning anything else wouldn't >> really have an impact on the functionality. >> >> Returning errors from drm_edid_connector_update() would potentially override >> non-deadlock ones from sync_scdc(). Since both helpers already log their own >> failures, I think it isn't worth the trouble. >> >>> Either way, a comment on why we're doing it this way would be nice. >> >> Indeed. Would the following be too verbose? >> >> /* >> * The SCDC resync may reset the CRTC, which might involve aquiring >> * modeset locks. If that fails, -EDEADLK is reported and the callers >> * passing a non-NULL @ctx drop the locks and restart the sequence >> * - see drm_helper_probe_detect_ctx() and >> * drm_helper_probe_single_connector_modes(). >> * >> * The resync runs first, and the audio and CEC helpers only once the >> * link state has settled: the CRTC reset is a blocking commit, so on >> * success the pipeline is already up again, while on -EDEADLK nothing >> * has been resynced yet and the pending retry redoes everything. This >> * keeps userspace from acting upon a link that is about to be reset. >> * >> * -EDEADLK is the only status gating the helpers below, as it is the >> * sole one guaranteeing a new run. The other failures are merely >> * reported: .force_ctx() accepts any error code and the probe helpers >> * just log it, while .detect_ctx() has to swallow it, being only >> * allowed to return a drm_connector_status value or -EDEADLK. >> * Propagating the status of drm_edid_connector_update() on top would >> * therefore only make it compete with an earlier resync failure over a >> * value that triggers no recovery, the more so as both helpers already >> * log their own errors. >> */ > > You can tell your LLM to be more terse :) That's actually the shortened form :-) > > Something like the following would be enough: > > /* > * detect_ctx can only ever return an status or EDEADLK. Handle deadlocks, and report any !EDEADLK error. > */ > ret = drm_connector_hdmi_sync_scdc(connector, false, ctx); > if (ret) > if (ret == -EDEADLK) { > return ret; > } else { > drm_warn(connector->dev, "ignored error"); > } > > drm_connector_hdmi_audio_plugged_notify(connector, false); > ret = drm_edid_connector_update(connector, NULL); > if (ret) > drm_warn(connector->dev, "ignored error"); > drm_connector_cec_phys_addr_invalidate(connector); Ack. Thanks, Cristian _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip