Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp3072802lqo; Tue, 21 May 2024 06:15:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUWaWdjqitFrKgqM9+rzQJ+8Jxd7o19UKo0wFlTQRN7AdHoKURl3TwYvVwRriqetn/W+NY9eEQ6hlFZ+5TEVVaKmjkByiypJQiYWvtbug== X-Google-Smtp-Source: AGHT+IF2qUf4G7UJ8WHxo3n6fXuBtWjFehk4qaF+oEA17aJjswEZ/LTv2FA0PQzuoL2nioFeiwJI X-Received: by 2002:a17:902:d2c9:b0:1f2:f6e7:290d with SMTP id d9443c01a7336-1f2f6e729e7mr110323065ad.10.1716297317813; Tue, 21 May 2024 06:15:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716297317; cv=pass; d=google.com; s=arc-20160816; b=wu2ajE2w8eBamRomQIwlh/QnyuHHTubIPZC9vo6MprU4L4yVY2tDRjpuiWRLZ0zyN9 /pGd93aJYS+UrwC6RMNYyO2Kg9nk+9QVUSD3DYX9uCTIY05mvQdYNiQNfV9s2T67B2r1 N0y5tj52J3vB1dTcO60ZNp7bXeERuenMtTM8LuboaOEapy64hKxF0kL/0TQihfTdVGN4 2tBvmEwAXlgN6J9pMkLP18XUSdfgq89alK2GJAlf3lghR+IJCBpIyTW2vdShtz4UpaSF jS/dtv4hwmK6cA/BBnUku60tfJZFzCaX3WGGOiLzrgEGxqivEh4O9ASabj2ceIPo1R9P ysTQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=RI2zkvOMOuSj7WWD9Aa0RQgbTMK/71BbbEMMC3xKIK8=; fh=qzH5DPZ9NpmUFGw2p0pQdadeI3k6SQ6JaBaXO9Wtmvc=; b=PHwNaNAQ19XcoDtuFowWaHt+eDguvETX0luZshnVP9BmyTiS6qlSP2rWnFbXSONBtH 5evSjqUSUhYRlBgkIFFN9eGonT+k0c6UBwXSc245pb6EjHNN1hGUgdem+Ev5oIjf7tM5 FPY9Dn5VbVnRHP8z87tcbgOATq94AS1qLiff1D0QLf0AqN+dWU9KJhqbsJvUcQPlx0JK /xVhEfpNVaV5d3Werif9y+sdbYxRtrVAaibiGTBXGpMBRLWmJ6u6qnp3PJ3CIjRsP+pf DfvN6vJmt5NanoKvP4v/dTHDpUUa2iT3AUIk7VUWeJ6wLbtHCIXcqPvlovEhmcJPHLEq 0ubg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hCM+jVT2; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-184998-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184998-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0bad7ffdsi40298625ad.142.2024.05.21.06.15.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 06:15:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184998-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hCM+jVT2; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-184998-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184998-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 50BA82834B9 for ; Tue, 21 May 2024 13:15:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04B26770ED; Tue, 21 May 2024 13:15:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hCM+jVT2" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 027641E4AD for ; Tue, 21 May 2024 13:15:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716297309; cv=none; b=QgPqWivWuuo/uGBpZQ6iNtz8TJXaOWLiJVVRleo+Ihrtumosfm0WzA2bDH6uB7qkIZdkSPg/7cjUwJ1ZHbyoKwX0vlO/W0iayPLvI1MxdPbjnCi2s09Bhv3g6msODdvh93/C/7ZNgskNTJx/AQMmLn6KPULjY6uMbSq88Kmy1Vc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716297309; c=relaxed/simple; bh=QI3B4EYlEbIIwWwbPtpuremAcvQV29WJXPwBTfgIJY4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=b7MidII9X6y1CRCm+cke5YCRRtOxPEUItUAPxcKtwythO9Fww5x8mW8Ivs1m4OPQ+tAVCERsSnYcUWvK5kCT2mXMVdI60GI8ZkY2R02B3JX9VI5JsbtXoo7G/i2zfWf8t/mCmOGcPL0Sbaka/ygk4ZJmt0OtOX7C54e1Adtnd+c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hCM+jVT2; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02C68C2BD11; Tue, 21 May 2024 13:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716297308; bh=QI3B4EYlEbIIwWwbPtpuremAcvQV29WJXPwBTfgIJY4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hCM+jVT2fpS7ic5sXNUfre7XEVcgQcrmap8MIT2/lRVyOnGU078F/ftIGV1QFbL43 9kIgrxp1E3W++Y+GHNPRyOpzT1H+L86nvwUnsfYEMJjNM85PXTr1hgOnqcKEs6+fL7 whmVmSja6dv/Pk9tr0H/gVg8/CJpH3hAWRKghRCXRiGv8WiKChGdURIkmqB83Y+JAb WTiDBNTrMDgvP9rvfiKL030y968lamnQ73C5Ke81jQUZNf14Ncfd7LO1iCTHBwGewZ dftY6a7MTyEAjLiz4vjsPpLtGhOR0Lpg3TOfFpikHs0uMwUjldaiRzoEBDu2J0Ravx a5mbxG3Cp7Q/Q== Date: Tue, 21 May 2024 15:15:06 +0200 From: Maxime Ripard To: Aradhya Bhatia Cc: Tomi Valkeinen , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Jyri Sarha , Thomas Zimmermann , David Airlie , Daniel Vetter , DRI Development List , Linux Kernel List , Sam Ravnborg , Thierry Reding , Kieran Bingham , Boris Brezillon , Nishanth Menon , Vignesh Raghavendra , Praneeth Bajjuri , Udit Kumar , Devarsh Thakkar , Jayesh Choudhary , Jai Luthra Subject: Re: [PATCH 6/7] drm/bridge: Introduce early_enable and late disable Message-ID: <20240521-realistic-imposing-lemur-aac3ad@houat> References: <20240511153051.1355825-1-a-bhatia1@ti.com> <20240511153051.1355825-7-a-bhatia1@ti.com> <20240516-bipedal-keen-taipan-eedbe7@penduick> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha384; protocol="application/pgp-signature"; boundary="yt2j545gywcn32mt" Content-Disposition: inline In-Reply-To: --yt2j545gywcn32mt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Thu, May 16, 2024 at 03:10:15PM GMT, Aradhya Bhatia wrote: > >> /** > >> * @pre_enable: > >> * > >> @@ -285,6 +319,26 @@ struct drm_bridge_funcs { > >> */ > >> void (*enable)(struct drm_bridge *bridge); > >> =20 > >> + /** > >> + * @atomic_early_enable: > >> + * > >> + * This callback should enable the bridge. It is called right before > >> + * the preceding element in the display pipe is enabled. If the > >> + * preceding element is a bridge this means it's called before that > >> + * bridge's @atomic_early_enable. If the preceding element is a > >> + * &drm_crtc it's called right before the crtc's > >> + * &drm_crtc_helper_funcs.atomic_enable hook. > >> + * > >> + * The display pipe (i.e. clocks and timing signals) feeding this br= idge > >> + * will not yet be running when this callback is called. The bridge = can > >> + * enable the display link feeding the next bridge in the chain (if > >> + * there is one) when this callback is called. > >> + * > >> + * The @early_enable callback is optional. > >> + */ > >> + void (*atomic_early_enable)(struct drm_bridge *bridge, > >> + struct drm_bridge_state *old_bridge_state); > >> + > >> /** > >> * @atomic_pre_enable: > >> * > >> @@ -361,6 +415,21 @@ struct drm_bridge_funcs { > >> void (*atomic_post_disable)(struct drm_bridge *bridge, > >> struct drm_bridge_state *old_bridge_state); > >> =20 > >> + /** > >> + * @atomic_late_disable: > >> + * > >> + * This callback should disable the bridge. It is called right after= the > >> + * preceding element in the display pipe is disabled. If the precedi= ng > >> + * element is a bridge this means it's called after that bridge's > >> + * @atomic_late_disable. If the preceding element is a &drm_crtc it's > >> + * called right after the crtc's &drm_crtc_helper_funcs.atomic_disab= le > >> + * hook. > >> + * > >> + * The @atomic_late_disable callback is optional. > >> + */ > >> + void (*atomic_late_disable)(struct drm_bridge *bridge, > >> + struct drm_bridge_state *old_bridge_state); > >> + > >=20 > > But more importantly, I don't quite get the use case you're trying to > > solve here. > >=20 > > If I got the rest of your series, the Cadence DSI bridge needs to be > > powered up before its source is started. You can't use atomic_enable or > > atomic_pre_enable because it would start the source before the DSI > > bridge. Is that correct? > >=20 >=20 > That's right. I cannot use bridge_atomic_pre_enable / > bridge_atomic_enable here. But that's because my source is CRTC, which > gets enabled via crtc_atomic_enable. >=20 >=20 > > If it is, then how is it different from what > > drm_atomic_bridge_chain_pre_enable is doing? The assumption there is > > that it starts enabling bridges last to first, to it should be enabled > > before anything starts. > >=20 > > The whole bridge enabling order code starts to be a bit of a mess, so it > > would be great if you could list all the order variations we have > > currently, and why none work for cdns-dsi. > >=20 >=20 > Of course! I can elaborate on the order. >=20 > Without my patches (and given there isn't any bridge setting the > "pre_enable_prev_first" flag) the order of enable for any single display > chain, looks like this - >=20 > crtc_enable > =09 > bridge[n]_pre_enable > --- > bridge[1]_pre_enable >=20 > encoder_enable >=20 > bridge[1]_enable > --- > bridge[n]_enable >=20 > The tidss enables at the crtc_enable level, and hence is the first > entity with stream on. cdns-dsi doesn't stand a chance with > bridge_atmoic_pre_enable / bridge_atmoic_enable hooks. And there is no > bridge call happening before crtc currently. Thanks for filling the blanks :) I assume that since cdns-dsi is a bridge, and it only has a simple encoder implementation, for it to receive some video signal we need to enable the CRTC before the bridge. If so, I think that's the original intent between the bridge pre_enable. The original documentation had: pre_enable: this contains things needed to be done for the bridge before this contains things needed to be done for the bridge before this contains things needed to be done for the bridge before. and the current one has: The display pipe (i.e. clocks and timing signals) feeding this bridge will not yet be running when this callback is called. The bridge must not enable the display link feeding the next bridge in the chain (if there is one) when this callback is called. I would say the CRTC is such a source, even more so now that the encoder is usually transparent, so I think we should instead move the crtc enable call after the bridge pre_enable. Would that work? Maxime --yt2j545gywcn32mt Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iJUEABMJAB0WIQTkHFbLp4ejekA/qfgnX84Zoj2+dgUCZkyeVQAKCRAnX84Zoj2+ dmQTAYD+Ne1ZkY/AFqrz3EHZtn3MxFe0zkhuFwWhGF1cMmY6F1H9YKDjPnYMvc+/ KbA4a1sBfAiT5CVtjjb6RpsGYpaD8isYCkSaUl45XE9kVfLH8NxSyBtvVkQ9gRVl SaJgX5LLXg== =jlQ6 -----END PGP SIGNATURE----- --yt2j545gywcn32mt--