Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2205317iof; Tue, 7 Jun 2022 23:09:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeBGNvq5EItCXwYp4DuQzz7ZxkYxMUJ/gsO91gqtPXSIDXVjWNaLbwF9Jh39ZgSJtanoFQ X-Received: by 2002:a05:6a00:2311:b0:4e1:52bf:e466 with SMTP id h17-20020a056a00231100b004e152bfe466mr42819889pfh.77.1654668582317; Tue, 07 Jun 2022 23:09:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654668582; cv=none; d=google.com; s=arc-20160816; b=A7kDLV6z0y71QfsjbJBcRJEdI/oQxDXUKwYuf7O62PXDrjvVU26QQlyhzg2RN0cNM0 v2qf1QVzriAWt9LwBZWL68bISrjxcsp/NfRsEXiEshikG8CxrF1oZ2+LzSL8S7cSfIMK ceHiSB81wPoMABkRmEvx+xgZRSWKxXc7MFW+AWZMNQE+T0wh6DODmPwYytgCWOMwMls8 KWMiV1Fk3ibMF1p7jBrXEp6IpX3KEnN1U3lhO6NLzp6pwylmcVXBu+o6+QwBdzHwn0/I 6V6c2/Jl6Bb7V6inpDLilxwtFZWqOBd+fRxlS+y7wylrM/CTVRXqY8AMnhBJzXofhi9C X8uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XEDU0PBA5FdLGuSrfPXXE916vDBqe4BOR4ufPkXUX0s=; b=CQablyH29kSKwzcvLdj5unOw1hBRmbWlura5CQcnQynBWrYVC87vZsNQg1lNfP8DDF NUJaNveHV7aG9yvudotkpzUqGkrQt4aXSbvhO5vDJHKkEAYo59zMbUr09dhsrKlsoi8I +t9D1r8moeDFovoDN10awrmhPUDDN5MlKs0HZl1W/Qp+MlxRS17dO+78ZSFk0M1Aagz6 mkdhVIZZOW0DnEJiVkA0Dvux0KlIy3KtQHVA1x0QX8WOVkRjVYIhoq1unxdFOjO7CKy1 RG8Be3rcwHb7TCMy9eNX7hZrvCRgTm0brhLMBiw8Ww62SX27O4+ihvhXAinVpANEivf0 +HzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YRAi32sJ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s10-20020a170903200a00b00163cd75c04csi3951416pla.281.2022.06.07.23.09.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:09:42 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YRAi32sJ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A40C3279C2D; Tue, 7 Jun 2022 22:32:08 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388357AbiFHBiC (ORCPT + 99 others); Tue, 7 Jun 2022 21:38:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382041AbiFGVqK (ORCPT ); Tue, 7 Jun 2022 17:46:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01F34235B04; Tue, 7 Jun 2022 12:07:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9B57DB823AF; Tue, 7 Jun 2022 19:07:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01950C385A2; Tue, 7 Jun 2022 19:07:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628863; bh=CZ/vaZHm91i3CNrD5PGY++BahAhBDENwnCQ7zpnuHDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YRAi32sJWZi96KFGoCpnAUvSloR6GyILZ82Yph0vXRJZCfI0woYuoeakRS1fg3Wzh MFMTTty5cTs6Yx24CH6fP67KskuooV7FxFgNHw9BhhKn5RVzZD3+Aupy6hpo7xFOad ZES2HaGfT+Sxkk/linYMYJz7/c7DWAVUCQwzC1Ss= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Douglas Anderson , Dmitry Baryshkov , Abhinav Kumar , Rob Clark , Sasha Levin Subject: [PATCH 5.18 483/879] drm/msm/dsi: dont powerup at modeset time for parade-ps8640 Date: Tue, 7 Jun 2022 19:00:01 +0200 Message-Id: <20220607165016.893812695@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Douglas Anderson [ Upstream commit ec7981e6c614254937b37ce0af9eac09901c05c5 ] Commit 7d8e9a90509f ("drm/msm/dsi: move DSI host powerup to modeset time") caused sc7180 Chromebooks that use the parade-ps8640 bridge chip to fail to turn the display back on after it turns off. Unfortunately, it doesn't look easy to fix the parade-ps8640 driver to handle the new power sequence. The Linux driver has almost nothing in it and most of the logic for this bridge chip is in black-box firmware that the bridge chip uses. Also unfortunately, reverting the patch will break "tc358762". The long term solution here is probably Dave Stevenson's series [1] that would give more flexibility. However, that is likely not a quick fix. For the short term, we'll look at the compatible of the next bridge in the chain and go back to the old way for the Parade PS8640 bridge chip. If it's found that other bridge chips also need this workaround then we can add them to the list or consider inverting the condition. However, the hope is that the framework will not take too much longer to land and we won't have to add anything other than ps8640 here. [1] https://lore.kernel.org/r/cover.1646406653.git.dave.stevenson@raspberrypi.com Fixes: 7d8e9a90509f ("drm/msm/dsi: move DSI host powerup to modeset time") Suggested-by: Rob Clark Signed-off-by: Douglas Anderson Reviewed-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar Link: https://lore.kernel.org/r/20220513131504.v5.1.Ia196e35ad985059e77b038a41662faae9e26f411@changeid Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/dsi/dsi_manager.c | 32 ++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 1db93e562fe6..84f3b2ebf1b8 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -34,6 +34,32 @@ static struct msm_dsi_manager msm_dsim_glb; #define IS_SYNC_NEEDED() (msm_dsim_glb.is_sync_needed) #define IS_MASTER_DSI_LINK(id) (msm_dsim_glb.master_dsi_link_id == id) +#ifdef CONFIG_OF +static bool dsi_mgr_power_on_early(struct drm_bridge *bridge) +{ + struct drm_bridge *next_bridge = drm_bridge_get_next_bridge(bridge); + + /* + * If the next bridge in the chain is the Parade ps8640 bridge chip + * then don't power on early since it seems to violate the expectations + * of the firmware that the bridge chip is running. + * + * NOTE: this is expected to be a temporary special case. It's expected + * that we'll eventually have a framework that allows the next level + * bridge to indicate whether it needs us to power on before it or + * after it. When that framework is in place then we'll use it and + * remove this special case. + */ + return !(next_bridge && next_bridge->of_node && + of_device_is_compatible(next_bridge->of_node, "parade,ps8640")); +} +#else +static inline bool dsi_mgr_power_on_early(struct drm_bridge *bridge) +{ + return true; +} +#endif + static inline struct msm_dsi *dsi_mgr_get_dsi(int id) { return msm_dsim_glb.dsi[id]; @@ -389,6 +415,9 @@ static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge) if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id)) return; + if (!dsi_mgr_power_on_early(bridge)) + dsi_mgr_bridge_power_on(bridge); + /* Always call panel functions once, because even for dual panels, * there is only one drm_panel instance. */ @@ -570,7 +599,8 @@ static void dsi_mgr_bridge_mode_set(struct drm_bridge *bridge, if (is_bonded_dsi && other_dsi) msm_dsi_host_set_display_mode(other_dsi->host, adjusted_mode); - dsi_mgr_bridge_power_on(bridge); + if (dsi_mgr_power_on_early(bridge)) + dsi_mgr_bridge_power_on(bridge); } static const struct drm_connector_funcs dsi_mgr_connector_funcs = { -- 2.35.1