From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 EC70435674E for ; Sat, 13 Jun 2026 01:30:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781314207; cv=none; b=ILuhFJsQAauOZNORDUmOfBjVNv9LLAdUbgDEfKvWrdquwwEiQ8kDPClMkzEUrhm5vaT2eke1mC4MCodw9NCvzq4dTHGs6bLh2uOucC2ornJL5JO9fz9HGJWsjH0OML+mKzOoJrUVyyIE0Y09CrMGewBHbWKd8IWJfiLCWYfFr7g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781314207; c=relaxed/simple; bh=A0Fhtf7gjqLJuhoBRBiXhWj0GB7XnVMNfK4IpemDFWI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ImxmWG1Cm4x/E6Q3aeRF3FBExLwTwPCPfl9O5axfFv3tWoCegobazdskYK7GfomuYla0eAoEnIqmqjCwT0dTrKJvo8NwF4l3ibEjsfdl2PkoYupn0G3aTRspCmBQKfTzWDpQiy5wvUCtfDlhTMVjkgQAUC0b2Wr5gjuzHG2c7ds= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=oRtcAJW/; arc=none smtp.client-ip=148.251.105.195 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="oRtcAJW/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1781314204; bh=A0Fhtf7gjqLJuhoBRBiXhWj0GB7XnVMNfK4IpemDFWI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=oRtcAJW/8KbnGXk89e/jzIq16DQOsRVAid2oW1M2rMIgNizldVcQu7EEkMJg6vaGH nBqkwPrnVMBUP2SEpHcJrqfX4J1PDNQYzA9i9nFfuEzjDK2oxpsX3peMPkaVLysDfs zl9FHuMbw5RBTkiMKYDsQHotRUDWzftvaPWIPEGiariaCMOe38XdWUAh5yPdZYsXsg Xr5wimHa+J1VX/GbE3AG6a4ZiUxLOZZisillPJIBZk4vyij0qsvnTIrEKETWCI1o1T K9RWaETDo4JbpKzY6C+PxOBdD0Q9bKQVmgP9pEX93QPDmnHFVEcbIytSpWWnr9Zj/H U5XoBLBqVU7oA== 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 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id 30ABF17E03C6; Sat, 13 Jun 2026 03:30:03 +0200 (CEST) Message-ID: <2f5ce8eb-ef47-4238-ad68-ce62981a1845@collabora.com> Date: Sat, 13 Jun 2026 04:30:02 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 04/30] drm/display: scdc_helper: Add HDMI 2.0 scrambling management helpers To: Maxime Ripard Cc: Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Sandy Huang , =?UTF-8?Q?Heiko_St=C3=BCbner?= , Andy Yan , Daniel Stone , Dave Stevenson , =?UTF-8?Q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , kernel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org References: <20260602-dw-hdmi-qp-scramb-v7-0-445eb54ee1ed@collabora.com> <20260602-dw-hdmi-qp-scramb-v7-4-445eb54ee1ed@collabora.com> <20260612-cordial-steadfast-cow-fcaf01@houat> Content-Language: en-US From: Cristian Ciocaltea In-Reply-To: <20260612-cordial-steadfast-cow-fcaf01@houat> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 6/12/26 4:43 PM, Maxime Ripard wrote: > On Tue, Jun 02, 2026 at 01:44:04AM +0300, Cristian Ciocaltea wrote: >> +/** >> + * drm_scdc_start_scrambling - activate scrambling and monitor SCDC status >> + * @connector: connector >> + * >> + * Enables scrambling and high TMDS clock ratio on both source and sink sides. >> + * Additionally, use a delayed work item to monitor the scrambling status on >> + * the sink side and retry the operation, as some displays refuse to set the >> + * scrambling bit right away. >> + * >> + * Returns: >> + * Zero if scrambling is set successfully, an error code otherwise. >> + */ >> +int drm_scdc_start_scrambling(struct drm_connector *connector) >> +{ >> + struct drm_display_info *info = &connector->display_info; >> + struct drm_connector_hdmi *hdmi = &connector->hdmi; >> + int ret; >> + u8 ver; >> + >> + if (!hdmi->scrambler_supported) { >> + drm_scdc_dbg(connector, "Scrambler not supported, bailing.\n"); >> + return -EINVAL; >> + } >> + >> + if (!info->is_hdmi || >> + !info->hdmi.scdc.supported || >> + !info->hdmi.scdc.scrambling.supported) { >> + drm_scdc_dbg(connector, "Sink doesn't support scrambling.\n"); >> + return -EINVAL; >> + } >> + >> + drm_scdc_dbg(connector, "Enabling scrambling\n"); >> + >> + ret = drm_scdc_readb(connector->ddc, SCDC_SINK_VERSION, &ver); >> + if (ret) { >> + drm_scdc_dbg(connector, "Failed to read SCDC_SINK_VERSION: %d\n", ret); >> + return ret; >> + } >> + >> + ret = drm_scdc_writeb(connector->ddc, SCDC_SOURCE_VERSION, >> + min_t(u8, ver, SCDC_MAX_SOURCE_VERSION)); >> + if (ret) { >> + drm_scdc_dbg(connector, "Failed to write SCDC_SOURCE_VERSION: %d\n", ret); >> + return ret; >> + } >> + >> + hdmi->scdc_cb = drm_scdc_monitor_scrambler; >> + WRITE_ONCE(hdmi->scrambler_enabled, true); >> + >> + ret = drm_scdc_try_scrambling_setup(connector); >> + if (!ret) >> + ret = hdmi->funcs->scrambler_enable(connector); >> + >> + if (ret) { >> + WRITE_ONCE(hdmi->scrambler_enabled, false); >> + cancel_delayed_work_sync(&hdmi->scdc_work); >> + hdmi->scdc_cb = NULL; >> + >> + drm_scdc_set_scrambling(connector, false); >> + drm_scdc_set_high_tmds_clock_ratio(connector, false); >> + } >> + >> + return ret; >> +} >> +EXPORT_SYMBOL(drm_scdc_start_scrambling); > > This is also pretty significantly different than what vc4 implemented. I > don't necessarily mind, but claiming that it's functionally equivalent > isn't true. I think it would be a much better strategy to turn the vc4 > code into helpers as is because it's been merged 4 years ago and we know > it's solid. As explained in patch 25, I think there's been a slight misunderstanding of how the CRTC reset logic was actually implemented. > Then, if you want to add additional checks and constraints (like the > SCDC_SINK_VERSION) that's fine, but it should come on top, and with its > own explanation. I'll recheck if there's anything that I might have missed from the original implementation, while moving the additional changes to separate patch(es). Thanks, Cristian