From patchwork Tue Jan 31 22:18:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 51065 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp69409wrn; Tue, 31 Jan 2023 14:34:46 -0800 (PST) X-Google-Smtp-Source: AK7set+lvVsQ6mtRR1IAf2BLN/OoCE/h7LhgX+1HnsvSE5s9MtyMzJ6YL75pxxtiWju0sLgb+s7J X-Received: by 2002:a17:906:a1c5:b0:88b:bf70:2e79 with SMTP id bx5-20020a170906a1c500b0088bbf702e79mr26002ejb.30.1675204485854; Tue, 31 Jan 2023 14:34:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675204485; cv=none; d=google.com; s=arc-20160816; b=DbTL4Y3fr47Ru6FUY0S8Op4qKsHxz/lymEumgwrXq9pNaSpSF03nU0Vo/oDqYrARcC asgtZYaBGEwpkeUjdKgQfJbH78YJM80mM5YLwMJDbqaxmyLairIeV76NOdjHveT274kS 4UCdCU5CfCX2wWSdOoV0ExrgSfZuFcFobAMN1c6Tt8k0WBhKRvnh17S6JqkFyfyc/B5z ywTjVse0PZQZJ77HWU+ZJSMdJIVySxsAShkCeu0cDlLBqgREJS0KYiAJ0j2cSjtcPkUx dkC3gvYVWhXRJ6T/ZdgisexxD1ho6EnY34H0rFVV5nvVepnxrGx6fGi4gWCvC8apLJrE m+ow== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=nDJfgGY2Uq4pkbdaiIQ1ONvu1Aumpm8UVU5btqep3hU=; b=hTyqZKE/cILFefO18CisrGUQkwS6Mes56t0t9pqxxJYuyQAfOev7NjQ3iMRO26Yi3n Z7fzcJTFMheG8LaTUkaVvvoshT7DMpczhw3UTAiPSM7oCjP+s/TYOxiosfbEWLsqMNGX 0nCUAHfnRC5kDhHrJyM5bhbqs7yeGZqLBjgqOXJZ+TyyjUpBNquLybYZQ1kmhpsJGIRW YenTPXabAjYhwgO8212RRs1gniX+JFylGO5NVv4GgxYTm2MlVUg6YP67CqAY4ZbX2obG BqnzAwImVxbxU26ZkjZu8y+XIUINshFY+q9x9AKq0qVkNEP1eia8eD7ew1a7NtM6oFnd xnQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="C//XxpbC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bf10-20020a170906c50a00b0088bf3542ea4si4101569ejb.992.2023.01.31.14.34.22; Tue, 31 Jan 2023 14:34:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="C//XxpbC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229889AbjAaWW6 (ORCPT + 99 others); Tue, 31 Jan 2023 17:22:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbjAaWWz (ORCPT ); Tue, 31 Jan 2023 17:22:55 -0500 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B6DF5AB6A for ; Tue, 31 Jan 2023 14:22:21 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id be8so16568250plb.7 for ; Tue, 31 Jan 2023 14:22:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nDJfgGY2Uq4pkbdaiIQ1ONvu1Aumpm8UVU5btqep3hU=; b=C//XxpbCdZukvZqKglW8c6wuEVing1SDTbUUogS/ymch/qoW0vbXqPjsij+7C39bKM cz2v/jqa/PU4i47Iz53rPk2Vw3mNsCvZevPClswFn03twuQH9OPEeoCTzI0WxPUHRVN+ yilQTQAnqMoG4QmPIPzwSaV9MSqokzOW+hEIU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nDJfgGY2Uq4pkbdaiIQ1ONvu1Aumpm8UVU5btqep3hU=; b=YqHSGgKpIGYB1a1CqL0lqUNXu8Re/co6T0CkTHKPUthIqvualKlznCOsac1z6FHPPd Qx5GK4ZGohWDKoeSGuFwmWpXBJG1bxbaYkQVccDbWKr2hUpSoepS9CC0XrTYQEW5KN13 sTPomlXNcvm2fOKcEKaHSmshAlWv+rpula/WDYeUegUaqBuya50SE66lyueqOo0Dvokw udR+koaUN/WJqSnCONz5B7sTnbcJXIR455X0SOA9LuN3SaJ+HTonmOlZpOQl/FxlpWCw 50i2PW7uEKYeSOQW+bjtULgVobYcFjXXpAWOclJhNMrB/sAfda1Wk+T2lPEauClJtvap Oqxw== X-Gm-Message-State: AO0yUKXoDMGDKJ5n4lbnKEwno7Tsu3efHw7ptjthK0Xr7iciBhbJkp+a QSr01wMP2ZcW3WJjN4qTCbpl9A== X-Received: by 2002:a17:903:138c:b0:192:d625:ecc4 with SMTP id jx12-20020a170903138c00b00192d625ecc4mr495493plb.18.1675203738010; Tue, 31 Jan 2023 14:22:18 -0800 (PST) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:138e:73d3:502:64f]) by smtp.gmail.com with ESMTPSA id d18-20020a170903231200b0019339f3368asm10377471plh.3.2023.01.31.14.22.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Jan 2023 14:22:17 -0800 (PST) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Rob Clark , Abhinav Kumar , Dmitry Baryshkov Cc: Andrzej Hajda , Laurent Pinchart , Sean Paul , Jonas Karlman , Vinod Koul , Robert Foss , linux-arm-msm@vger.kernel.org, Daniel Vetter , David Airlie , freedreno@lists.freedesktop.org, Stephen Boyd , Neil Armstrong , Jernej Skrabec , Dave Stevenson , Douglas Anderson , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 1/3] drm/bridge: tc358762: Set pre_enable_prev_first Date: Tue, 31 Jan 2023 14:18:24 -0800 Message-Id: <20230131141756.RFT.v2.1.I723a3761d57ea60c5dd754c144aed6c3b2ea6f5a@changeid> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756579219007858883?= X-GMAIL-MSGID: =?utf-8?q?1756579219007858883?= Set the "pre_enable_prev_first" as provided by commit 4fb912e5e190 ("drm/bridge: Introduce pre_enable_prev_first to alter bridge init order"). This should allow us to revert commit ec7981e6c614 ("drm/msm/dsi: don't powerup at modeset time for parade-ps8640") and commit 7d8e9a90509f ("drm/msm/dsi: move DSI host powerup to modeset time"). Cc: Dave Stevenson Cc: Dmitry Baryshkov Cc: Abhinav Kumar Signed-off-by: Douglas Anderson Reviewed-by: Dave Stevenson Reviewed-by: Dmitry Baryshkov --- (no changes since v1) drivers/gpu/drm/bridge/tc358762.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c index 0b6a28436885..77f7f7f54757 100644 --- a/drivers/gpu/drm/bridge/tc358762.c +++ b/drivers/gpu/drm/bridge/tc358762.c @@ -229,6 +229,7 @@ static int tc358762_probe(struct mipi_dsi_device *dsi) ctx->bridge.funcs = &tc358762_bridge_funcs; ctx->bridge.type = DRM_MODE_CONNECTOR_DPI; ctx->bridge.of_node = dev->of_node; + ctx->bridge.pre_enable_prev_first = true; drm_bridge_add(&ctx->bridge); From patchwork Tue Jan 31 22:18:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 51064 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp68824wrn; Tue, 31 Jan 2023 14:33:15 -0800 (PST) X-Google-Smtp-Source: AK7set/ZpOOYWUulks2TFPuSNXNTKTA8b868uhpr5idAUgSBrB9eEmePiR8HIyQv4kIHFXCG8/6K X-Received: by 2002:a17:906:4a59:b0:886:ec6e:4c1 with SMTP id a25-20020a1709064a5900b00886ec6e04c1mr11892591ejv.59.1675204394950; Tue, 31 Jan 2023 14:33:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675204394; cv=none; d=google.com; s=arc-20160816; b=rm38wA5tSDDteILV4+4TZMjRVhJKWB5iJGXjvEgRxtvLbz65UwT8oowARaTylYPhRQ sb7bl6qA/Ih0IHmkY4iwXQ2ICrbP8KbPfh6Wn3qyAn+nrYiZdsLP4q1w2/hSuzhGEJjk je4mK0sv9Kn5Y8Lpu5SKIKp+dgmdv/GXAIU44s/+qK+mFUj1su43k4V3OCSBJq6IVdPN v7K7aZruysTm3/ZAJq1wkhO/u+G8zUnBDDVlr/wtr8RRuGk+vlNmKuYZqEZM1aakm3gh yCLbJr1gnFstmVTHOZEqbOShZN3wYPoLUcHMog1T9h6Xc4q4eGGiDN2HpseOH4IE+H3t 73AA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=j5glDXJkyFINglXsI3CpTvLcxwtU2p5GQD+LTvj3ho8=; b=DQE4y3ImiFSgtgBuxE1xxR0KmQPL0Cuaispgp/Ajx1uSZ9R7HQMu1NBFikF2cyshTi ZVSrFHfvufWSUaMuKkec4bEZb46B9TBt8qXc+z9mPP+6x29P8vXdDuNPGA8pKXW4yVek dJY+Mg1jOz1PKG2Sj4TfCbydpxgeHf4AZQ5q7cwyYHFGpgs+7GnhYOJ1OR/W6uEoX/FL q82PVra8jIHO2DEuEZ99PcOZ2bjY01c2rQOOuAwiw3HKP5KH8E28Z5lJMFG3CyM9Tmnz 8bepbixp766Q8vVTD9zBRcLlP4So/cAf+hRrNe9L9Ib0lpwnRyP00pUpZZJXs9DFb6py YubQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=MGYqySJ7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fv38-20020a17090750a600b0087d9362c23dsi1705761ejc.842.2023.01.31.14.32.51; Tue, 31 Jan 2023 14:33:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=MGYqySJ7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231903AbjAaWXB (ORCPT + 99 others); Tue, 31 Jan 2023 17:23:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229991AbjAaWW4 (ORCPT ); Tue, 31 Jan 2023 17:22:56 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBF0E5AA74 for ; Tue, 31 Jan 2023 14:22:21 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id r8so9721735pls.2 for ; Tue, 31 Jan 2023 14:22:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=j5glDXJkyFINglXsI3CpTvLcxwtU2p5GQD+LTvj3ho8=; b=MGYqySJ7a5kOGrLxSVQTPuNDc/2i1t8bijwCZ2YqVvkywI/2SY7K2dp5DEpanE58ou 5CI8vflM9byl63JTOFbRovm/6YmyFXqPx9tiYqmFZa711b972HDbYoaOpZi+myKKl/ih PI4VRMMdTjfoaCIDpIh1gU69YoQ7G4ejpB6rU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j5glDXJkyFINglXsI3CpTvLcxwtU2p5GQD+LTvj3ho8=; b=YEilgFleDjXLt5LJl7sebAxdGYU/CHuYG9eU8g5Lmtm5Ven0DBSHNwbYwzSDf4P35y IJJktg5jqAoaayK1uCoOVpB4njheMyjllOMjgurIY0IGuDEFORk0xqsAu1lRtBrhS6MP HvLbCT3aasEgebNjDsariQwYD+kcwO2w8W9hfuSdkqTR89yaeSzOTx4OYj65bjO8dx5n MK1ptqSd/OHARak2t3gl9Xy9nLO8VrVqFlD6o4aTQzfzo4zClZSinGHoyFu8aYzOYD+a s6Wmy/2TNlo3UKUjRxGoDXvukLtU+B6p/V/DfAN8VQ08YErtDqxfFDx9iZtchltYFJKz WMHQ== X-Gm-Message-State: AO0yUKVcttRHW8w81YsuPaMESuw3i39r+QLfa2Z5VzzQSVmdO6UVH4Pg 9bxm0hTs/toMn8jH07hY3ThLew== X-Received: by 2002:a17:902:f68b:b0:196:8158:fa8c with SMTP id l11-20020a170902f68b00b001968158fa8cmr765818plg.11.1675203739996; Tue, 31 Jan 2023 14:22:19 -0800 (PST) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:138e:73d3:502:64f]) by smtp.gmail.com with ESMTPSA id d18-20020a170903231200b0019339f3368asm10377471plh.3.2023.01.31.14.22.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Jan 2023 14:22:19 -0800 (PST) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Rob Clark , Abhinav Kumar , Dmitry Baryshkov Cc: Andrzej Hajda , Laurent Pinchart , Sean Paul , Jonas Karlman , Vinod Koul , Robert Foss , linux-arm-msm@vger.kernel.org, Daniel Vetter , David Airlie , freedreno@lists.freedesktop.org, Stephen Boyd , Neil Armstrong , Jernej Skrabec , Dave Stevenson , Douglas Anderson , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 2/3] drm/msm/dsi: Stop unconditionally powering up DSI hosts at modeset Date: Tue, 31 Jan 2023 14:18:25 -0800 Message-Id: <20230131141756.RFT.v2.2.I4cfeab9d0e07e98ead23dd0736ab4461e6c69002@changeid> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog In-Reply-To: <20230131141756.RFT.v2.1.I723a3761d57ea60c5dd754c144aed6c3b2ea6f5a@changeid> References: <20230131141756.RFT.v2.1.I723a3761d57ea60c5dd754c144aed6c3b2ea6f5a@changeid> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756579123312847648?= X-GMAIL-MSGID: =?utf-8?q?1756579123312847648?= In commit 7d8e9a90509f ("drm/msm/dsi: move DSI host powerup to modeset time"), we moved powering up DSI hosts to modeset time. This wasn't because it was an elegant design, but there were no better options. That commit actually ended up breaking ps8640, and thus was born commit ec7981e6c614 ("drm/msm/dsi: don't powerup at modeset time for parade-ps8640") as a temporary hack to un-break ps8640 by moving it to the old way of doing things. It turns out that ps8640 _really_ doesn't like its pre_enable() function to be called after dsi_mgr_bridge_power_on(). Specifically (from experimentation, not because I have any inside knowledge), it looks like the assertion of "RST#" in the ps8640 runtime resume handler seems like it's not allowed to happen after dsi_mgr_bridge_power_on() Recently, Dave Stevenson's series landed allowing bridges some control over pre_enable ordering. The meaty commit for our purposes is commit 4fb912e5e190 ("drm/bridge: Introduce pre_enable_prev_first to alter bridge init order"). As documented by that series, if a bridge doesn't set "pre_enable_prev_first" then we should use the old ordering. Now that we have the commit ("drm/bridge: tc358762: Set pre_enable_prev_first") we can go back to the old ordering, which also allows us to remove the ps8640 special case. One last note is that even without reverting commit 7d8e9a90509f ("drm/msm/dsi: move DSI host powerup to modeset time"), if you _just_ revert the ps8640 special case and try it out then it doesn't seem to fail anymore. I spent time bisecting / debugging this and it turns out to be mostly luck, so we still want this patch to make sure it's solid. Specifically the reason it sorta works these days is because we implemented wait_hpd_asserted() in ps8640 now, plus the magic of "pm_runtime" autosuspend. The fact that we have wait_hpd_asserted() implemented means that we actually power the bridge chip up just a wee bit earlier and then the bridge happens to stay on because of autosuspend and thus ends up powered before dsi_mgr_bridge_power_on(). Cc: Dave Stevenson Cc: Dmitry Baryshkov Cc: Abhinav Kumar Signed-off-by: Douglas Anderson Reviewed-by: Abhinav Kumar Reviewed-by: Dmitry Baryshkov --- Changes in v2: - Don't fold dsi_mgr_bridge_power_on() back into dsi_mgr_bridge_pre_enable() drivers/gpu/drm/msm/dsi/dsi_manager.c | 38 +-------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 1bbac72dad35..2197a54b9b96 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -34,32 +34,6 @@ 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]; @@ -265,12 +239,6 @@ static void dsi_mgr_bridge_power_on(struct drm_bridge *bridge) int ret; DBG("id=%d", id); - if (!msm_dsi_device_connected(msm_dsi)) - return; - - /* Do nothing with the host if it is slave-DSI in case of bonded DSI */ - if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id)) - return; ret = dsi_mgr_phy_enable(id, phy_shared_timings); if (ret) @@ -327,8 +295,7 @@ 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); + dsi_mgr_bridge_power_on(bridge); ret = msm_dsi_host_enable(host); if (ret) { @@ -438,9 +405,6 @@ static void dsi_mgr_bridge_mode_set(struct drm_bridge *bridge, msm_dsi_host_set_display_mode(host, adjusted_mode); if (is_bonded_dsi && other_dsi) msm_dsi_host_set_display_mode(other_dsi->host, adjusted_mode); - - if (dsi_mgr_power_on_early(bridge)) - dsi_mgr_bridge_power_on(bridge); } static enum drm_mode_status dsi_mgr_bridge_mode_valid(struct drm_bridge *bridge, From patchwork Tue Jan 31 22:18:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 51063 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp67273wrn; Tue, 31 Jan 2023 14:29:54 -0800 (PST) X-Google-Smtp-Source: AK7set/ePO7biJ0MCAXz0YofNW9yPDGSZoTliL+Vqb9+Zmjg6QClRxIGZTK8MRSbIZ2kHk15lBDH X-Received: by 2002:a05:6402:278c:b0:49e:eb5:ed05 with SMTP id b12-20020a056402278c00b0049e0eb5ed05mr7044871ede.9.1675204194253; Tue, 31 Jan 2023 14:29:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675204194; cv=none; d=google.com; s=arc-20160816; b=PW5hVZpbsNFTGazuvXlLOoN63k6CwqF0ABnXgB6oJ4oA6VwQh3V86a1eVnE49j2FBl TpYXRbWXKpoc2sTd1WqRnW98uQu5x6YNrHO5ww3mvFgKPUeSGha332sFlJcAPItzXIsu w4dxwXe3x7WAD6u6PEVjFEm9OIgnvwHkSlErfn5BoM6GSJ0uaJJRYRNoZ8qybaaDiKue 3dC8rvdnu5SzbMN1FtmhU0nBi1OffV21RqumElQYVvPL41lAkuqB/RSI/L48WmB06OVI coOJ6jQzqcL0rhSAFtBHmocYJr/Z0KVeoTgC0EzBrOnMB+K8QUuDTcuzn3VliZ3OPquO OEvA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rXDYbKDbTfFR4g/Nh4bZjHD3KmThZ7Sh2niPtOlScU0=; b=bcWnDbsNPfgSUXaZ6/tjkkz8nn2RhS1PbGtJ1O8NZDyo4aJ5BxffRAnAd04k1khDa1 Fxt4nz+AuYcjHWHOgAl1QmeBpzfrAlycJasBqvAGCcTbDzj905Lwu/sAYjQvQCEV/rjv aUZLHnI+F3yeebrmcRyPxJADFBcdDQm9n7MJPcO29pK/7OcV/m7pGfB7/O5f5232ZXqJ Equ7dxXApc0Dhfs31itwyOzIpX8RZM4v2YX07zP6F0Gftvny0gCrFoCaDQpNAVj4uJNO amIiQIPTwAHxP6Lp9iYhj2jZrOg6fLa9HYZBBxT4Gya1q+QBoy2mDhpWMi0OggUChuU5 aSrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CbHl3tEq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f14-20020a056402150e00b004a26baf1484si3341073edw.285.2023.01.31.14.29.29; Tue, 31 Jan 2023 14:29:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CbHl3tEq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231977AbjAaWXE (ORCPT + 99 others); Tue, 31 Jan 2023 17:23:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231891AbjAaWW7 (ORCPT ); Tue, 31 Jan 2023 17:22:59 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6AA6530E1 for ; Tue, 31 Jan 2023 14:22:22 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id v23so16590192plo.1 for ; Tue, 31 Jan 2023 14:22:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rXDYbKDbTfFR4g/Nh4bZjHD3KmThZ7Sh2niPtOlScU0=; b=CbHl3tEqDWlEJUBNu9QPcromD2gQpIqbwlCkQjXXAScaqPJL/MvAW1LggsaGBn4gNL b5n3pTdKMYTrJUhufb291yU3gE0pxFAKrD2N+pY6CCVlDjVyr7AKStrg8h+xoBHaKfVf VpgpdnzQkmCa+/5FPFl2/EymlbNT7QZ0AVRtc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rXDYbKDbTfFR4g/Nh4bZjHD3KmThZ7Sh2niPtOlScU0=; b=wtxusz4HdzhxfLo5kI3SnjN7cRp5AvsWX+Mk/uFYvWQeuk9YSq/CHfKKO11b2VnwQl DMPyhZAOdkJQ+ldg2Kb3LAztylZCbNT7Vm95/748j8NQ/kU5QtQEDzqtEbL97OmtJKrp MA80XXm9a8WePe46hA/5/tTecN3tQSCXQ/W3MJvubfSqPwWryWX6/DoFk43oYP/WcZ8F quF80KP9+nLuOMhNG1ltaRuzDFAxsE7Ep8Aem7EZhGhD2hPn36YPOvpYJ6CZa94aHyZB 07HPfnOoZHf7H7pzzB6a1/dy/5G/n+eKDnm5K/lR1+304oCKFk1A4rpwyA9umSJjfHAC nr1A== X-Gm-Message-State: AO0yUKWWe5I7J+vo+Y7flmyrqSjHKhfCTZ28wMnTscbSJuGztWHljnXv 80bdaC2nVFR9HXed6yNDRpiZVw== X-Received: by 2002:a17:903:2312:b0:196:8cf4:9ca7 with SMTP id d18-20020a170903231200b001968cf49ca7mr684707plh.19.1675203741972; Tue, 31 Jan 2023 14:22:21 -0800 (PST) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:138e:73d3:502:64f]) by smtp.gmail.com with ESMTPSA id d18-20020a170903231200b0019339f3368asm10377471plh.3.2023.01.31.14.22.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Jan 2023 14:22:21 -0800 (PST) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Rob Clark , Abhinav Kumar , Dmitry Baryshkov Cc: Andrzej Hajda , Laurent Pinchart , Sean Paul , Jonas Karlman , Vinod Koul , Robert Foss , linux-arm-msm@vger.kernel.org, Daniel Vetter , David Airlie , freedreno@lists.freedesktop.org, Stephen Boyd , Neil Armstrong , Jernej Skrabec , Dave Stevenson , Douglas Anderson , linux-kernel@vger.kernel.org Subject: [RFT PATCH v2 3/3] drm/msm/dsi: More properly handle errors in regards to dsi_mgr_bridge_power_on() Date: Tue, 31 Jan 2023 14:18:26 -0800 Message-Id: <20230131141756.RFT.v2.3.I3c87b53c4ab61a7d5e05f601a4eb44c7e3809a01@changeid> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog In-Reply-To: <20230131141756.RFT.v2.1.I723a3761d57ea60c5dd754c144aed6c3b2ea6f5a@changeid> References: <20230131141756.RFT.v2.1.I723a3761d57ea60c5dd754c144aed6c3b2ea6f5a@changeid> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756578913177256608?= X-GMAIL-MSGID: =?utf-8?q?1756578913177256608?= In commit 7d8e9a90509f ("drm/msm/dsi: move DSI host powerup to modeset time") the error handling with regards to dsi_mgr_bridge_power_on() got a bit worse. Specifically if we failed to power the bridge on then nothing would really notice. The modeset function couldn't return an error and thus we'd blindly go forward and try to do the pre-enable. In commit ec7981e6c614 ("drm/msm/dsi: don't powerup at modeset time for parade-ps8640") we added a special case to move the powerup back to pre-enable time for ps8640. When we did that, we didn't try to recover the old/better error handling just for ps8640. In the patch ("drm/msm/dsi: Stop unconditionally powering up DSI hosts at modeset") we've now moved the powering up back to exclusively being during pre-enable. That means we can add the better error handling back in, so let's do it. To do so we'll add a new function dsi_mgr_bridge_power_off() that's matches how errors were handled prior to commit 7d8e9a90509f ("drm/msm/dsi: move DSI host powerup to modeset time"). NOTE: Now that we have dsi_mgr_bridge_power_off(), it feels as if we should be calling it in dsi_mgr_bridge_post_disable(). That would make some sense, but doing so would change the current behavior and thus should be a separate patch. Specifically: * dsi_mgr_bridge_post_disable() always calls dsi_mgr_phy_disable() even in the slave-DSI case of bonded DSI. We'd need to add special handling for this if it's truly needed. * dsi_mgr_bridge_post_disable() calls msm_dsi_phy_pll_save_state() midway through the poweroff. * dsi_mgr_bridge_post_disable() has a different order of some of the poweroffs / IRQ disables. For now we'll leave dsi_mgr_bridge_post_disable() alone. Signed-off-by: Douglas Anderson Reviewed-by: Abhinav Kumar Reviewed-by: Dmitry Baryshkov --- Changes in v2: - ("More properly handle errors...") new for v2. drivers/gpu/drm/msm/dsi/dsi_manager.c | 32 ++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 2197a54b9b96..28b8012a21f2 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -228,7 +228,7 @@ static void msm_dsi_manager_set_split_display(u8 id) } } -static void dsi_mgr_bridge_power_on(struct drm_bridge *bridge) +static int dsi_mgr_bridge_power_on(struct drm_bridge *bridge) { int id = dsi_mgr_bridge_get_id(bridge); struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); @@ -268,14 +268,31 @@ static void dsi_mgr_bridge_power_on(struct drm_bridge *bridge) if (is_bonded_dsi && msm_dsi1) msm_dsi_host_enable_irq(msm_dsi1->host); - return; + return 0; host1_on_fail: msm_dsi_host_power_off(host); host_on_fail: dsi_mgr_phy_disable(id); phy_en_fail: - return; + return ret; +} + +static void dsi_mgr_bridge_power_off(struct drm_bridge *bridge) +{ + int id = dsi_mgr_bridge_get_id(bridge); + struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); + struct msm_dsi *msm_dsi1 = dsi_mgr_get_dsi(DSI_1); + struct mipi_dsi_host *host = msm_dsi->host; + bool is_bonded_dsi = IS_BONDED_DSI(); + + msm_dsi_host_disable_irq(host); + if (is_bonded_dsi && msm_dsi1) { + msm_dsi_host_disable_irq(msm_dsi1->host); + msm_dsi_host_power_off(msm_dsi1->host); + } + msm_dsi_host_power_off(host); + dsi_mgr_phy_disable(id); } static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge) @@ -295,7 +312,11 @@ static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge) if (is_bonded_dsi && !IS_MASTER_DSI_LINK(id)) return; - dsi_mgr_bridge_power_on(bridge); + ret = dsi_mgr_bridge_power_on(bridge); + if (ret) { + dev_err(&msm_dsi->pdev->dev, "Power on failed: %d\n", ret); + return; + } ret = msm_dsi_host_enable(host); if (ret) { @@ -316,8 +337,7 @@ static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge) host1_en_fail: msm_dsi_host_disable(host); host_en_fail: - - return; + dsi_mgr_bridge_power_off(bridge); } void msm_dsi_manager_tpg_enable(void)