From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=159.226.251.21 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795099083; b=Nr00gSLfmk5hRhzEBpuM2XRzU/fCBxqqdqoyw5vhbE78fwzgJGFHSACLa9LM4hbWIxlD MwMWlrLPiytKkL/xlY07ueYOdrUC+CBmFGF6cpsgqQ+OeDv2J2RnyBpktnQ44hAv3pBDg Vi+dI4ciP96yRM91frddgOt89UhIS33ts7JmIXCUmGpc7r3kOW4CzRyLn/ZliwLxHO0OR x95WsuAXRYErKmPGEgvDeUhRh6MTZZYHxJBKaSIJ3QKypVoiVoJZapfXqujn+mla4VUlR ZFf9yB7sa7VEZiapCdT1FFSht0WWCufFxCyx2KnpMKlaQexJgKF8xR5AzBGJczbFzAQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795099083; h=DMARC-Filter:Received:Message-ID:Subject:From:To:Cc:Date:In-Reply-To: References:Content-Type:Content-Transfer-Encoding:User-Agent: MIME-Version:X-CM-TRANSID:X-Coremail-Antispam:X-Originating-IP: X-CM-SenderInfo; bh=5pOvNN6dVO7jOfIJFacXnrobZyz1WMXD/gc64bxgya8=; b=PyuvZ3AEQWY+gtIsl+/DEuWTSn1r89ebOESWlWt7lwviTDkcXsGahod83eTRgzwS/3ks Ok5jThnN6vKN0Ni1bA6Bbs9UGGtMA9gckUtvDMsFUz4maC1MDZglvj8nKzQCBQT01ExOu /uqhW3k6RA5+C8/DrkkTvFTP+N0Ys481w4fVlTMgJdFBrlCTVhXcx4tBksHSAAZccpwGc JvdhX2GvGza7ReoTr/KMv5EjvbuqvOZAU05Rv/GKIG/pxYhOBrX9prruBbJiGyPX+gGlx 5vugowAphXGMLidQhZQv0kgmLPtJ7zYlyqfVO6rhKdeVx5GMTY5GJqgdbZfJ+FoNd5g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=iscas.ac.cn; spf=pass smtp.mailfrom=iscas.ac.cn; arc=none smtp.remote-ip=159.226.251.21 Received: from cstnet.cn (smtp21.cstnet.cn [159.226.251.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60FE1606A320 for ; Thu, 19 Nov 2026 14:38:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 60FE1606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iscas.ac.cn Received: from edelgard.fodlan.icenowy.me (unknown [112.94.102.23]) by APP-01 (Coremail) with SMTP id qwCowAD3HvmnCf9qfRVHAQ--.3665S2; Thu, 19 Nov 2026 22:37:28 +0800 (CST) Message-ID: <74dd76a7dd4fb3e627b22833b19fad70e52bf3e1.camel@iscas.ac.cn> Subject: Re: [PATCH] drm/bridge: dw-mipi-dsi: fix cmd mode transition when disabling From: Icenowy Zheng To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Ondrej Jirman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Date: Thu, 19 Nov 2026 22:37:27 +0800 In-Reply-To: <20261030055806.4102994-1-zhengxingda@iscas.ac.cn> References: <20261030055806.4102994-1-zhengxingda@iscas.ac.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-CM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daVFxhVjvjDU0x ZFpf9x07betCcUUUUU= X-CM-SenderInfo: x2kh0wp0lqwv3d6l2u1dvotugofq/ =E5=9C=A8 2026-10-30=E4=BA=94=E7=9A=84 13:58 +0800=EF=BC=8CIcenowy Zheng=E5= =86=99=E9=81=93=EF=BC=9A > With pre_enable_prev_first flag set, the atomic_post_disable hook of the > next bridge (which should be the DSI panel bridge and calls panel > unprepare hook) is called before the hook of the DSI controller bridge, > which leads to the switch to command mode happening after the panel > unprepare. In this case some panels' unprepare hooks sliently fails > because they expect the DSI controller to be in command mode. >=20 > As the DSI controller atomic_disable hook happens after panel bridge > atomic_disable but before panel bridge atomic_post_disable, it seems to > be a good position for the transition to the command mode. >=20 > Move the mode transition from the atomic_post_disable hook to a newly > created atomic_disable hook. >=20 > Fixes: 05aa61334592 ("drm: bridge: dw-mipi-dsi: Fix enable/disable of DSI= controller") > Signed-off-by: Icenowy Zheng Ping, would anyone take a look at this patch? > --- > Tested on Lichee Console 4A with a pending glue driver for T-Head TH1520 > DW MIPI DSI. This device has a always-powered panel (no switchable > supply and no reset pin), so correct execution of unprepare commands is > critical. >=20 > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 23 ++++++++++++------- > 1 file changed, 15 insertions(+), 8 deletions(-) >=20 > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/= drm/bridge/synopsys/dw-mipi-dsi.c > index 5dd475fcaacf8..49b6228ca69e5 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > @@ -944,14 +944,6 @@ static void dw_mipi_dsi_bridge_post_atomic_disable(s= truct drm_bridge *bridge, > struct dw_mipi_dsi *dsi =3D bridge_to_dsi(bridge); > const struct dw_mipi_dsi_phy_ops *phy_ops =3D dsi->plat_data->phy_ops; > =20 > - /* > - * Switch to command mode before panel-bridge post_disable & > - * panel unprepare. > - * Note: panel-bridge disable & panel disable has been called > - * before by the drm framework. > - */ > - dw_mipi_dsi_set_mode(dsi, 0); > - > if (phy_ops->power_off) > phy_ops->power_off(dsi->plat_data->priv_data); > =20 > @@ -1058,6 +1050,20 @@ static void dw_mipi_dsi_bridge_atomic_enable(struc= t drm_bridge *bridge, > dw_mipi_dsi_set_mode(dsi->slave, MIPI_DSI_MODE_VIDEO); > } > =20 > +static void dw_mipi_dsi_bridge_atomic_disable(struct drm_bridge *bridge, > + struct drm_atomic_commit *state) > +{ > + struct dw_mipi_dsi *dsi =3D bridge_to_dsi(bridge); > + > + /* > + * Switch to command mode before panel-bridge post_disable & > + * panel unprepare. > + * Note: panel-bridge disable & panel disable has been called > + * before by the drm framework. > + */ > + dw_mipi_dsi_set_mode(dsi, 0); Sashiko says that the secondary controller needs to be put into command mode too, is it the case? If it is, I would add it to this hunk (although it's previously not present). Thanks, Icenowy > +} > + > static enum drm_mode_status > dw_mipi_dsi_bridge_mode_valid(struct drm_bridge *bridge, > const struct drm_display_info *info, > @@ -1098,6 +1104,7 @@ static const struct drm_bridge_funcs dw_mipi_dsi_br= idge_funcs =3D { > .atomic_create_state =3D drm_atomic_helper_bridge_create_state, > .atomic_pre_enable =3D dw_mipi_dsi_bridge_atomic_pre_enable, > .atomic_enable =3D dw_mipi_dsi_bridge_atomic_enable, > + .atomic_disable =3D dw_mipi_dsi_bridge_atomic_disable, > .atomic_post_disable =3D dw_mipi_dsi_bridge_post_atomic_disable, > .mode_set =3D dw_mipi_dsi_bridge_mode_set, > .mode_valid =3D dw_mipi_dsi_bridge_mode_valid,