From patchwork Mon Oct 24 11:29:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8423 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400528wru; Mon, 24 Oct 2022 04:47:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5POBerIHVeM5DRcOqTeQKNRSS9yegx7BMrtNw4wvv9qYOSnjURBS/3kGBwIWz2TJCSIBAE X-Received: by 2002:a50:ff13:0:b0:43e:76d3:63e1 with SMTP id a19-20020a50ff13000000b0043e76d363e1mr30275266edu.271.1666612038762; Mon, 24 Oct 2022 04:47:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612038; cv=none; d=google.com; s=arc-20160816; b=aJBRk59FrxKr+AicuVxMHwj/PhYPz9kevRwfN1Mj9nkO49n3Hu0pmETjbd/pPRX6tS TqjPMxMg6H8pevDGqzOI4dn0Q/gVdDRAJhyu67xmBonzkdhU/bLU5SEIZWo3kG5hciZR ynGYPZEVYHe6e49V1Fz6PX5x4fKOsgQgS4XSQKUeZ7fi7ktQLDlskGGvxQaaIFqClohX ElCfpb3Nf3IYfnqHvtE4lMb+OTFgxLw1Bq/Bbvy0ipYWJcNMViViHsrwLTm9MmE6BOMk 11Q7rOI8naaCpUZsck4V7/PF0A+8Uv9kZtxIc1ElcnzsJC9qUAOpm0PLldNZ8e1AEYsm SqtA== 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=UgWXfxKnyobJyDcN47zVglgbJWmFRWSj7fGr5/CtvBw=; b=xalyrD+xPasa5ZsfFh1PSKs4LL1sfxT2Hz099Y701ew3f4U/j4PYAHPX0s0lgXUqEZ bddCChf8z2sSh+kCqGCiapaSYY7w4Tv3mFJGnwot9j6XxnIWBxuSUigloTzyi9kR7eRB XqiR5PDa3qIn3Zv6AMB0YQJTQJI+xyuBHW2+jmOlR/NicjCS1qwPJ6e2aa1kW5G8Pl6P 92cqJgej5eowyvyaRuZGwdmM2G5+FWIl8YuF2uM6IGN8ppwEOlPJJUahgw7SrqkzT+35 +VpJL48nPVEzfiYyy8mmMmoWfJV4KRkqBPLQLKh71eVbVe2R7zIgwFj8keNd0ZIgm8wl criA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sg0ViGT+; 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=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s9-20020a508d09000000b004591f959c3bsi24842374eds.427.2022.10.24.04.46.54; Mon, 24 Oct 2022 04:47:18 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=sg0ViGT+; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231603AbiJXLqY (ORCPT + 99 others); Mon, 24 Oct 2022 07:46:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231793AbiJXLoa (ORCPT ); Mon, 24 Oct 2022 07:44:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53837753BD; Mon, 24 Oct 2022 04:42:10 -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 dfw.source.kernel.org (Postfix) with ESMTPS id D2D0661277; Mon, 24 Oct 2022 11:39:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1A19C433D6; Mon, 24 Oct 2022 11:39:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611548; bh=M+QYpG+luzN26Gb8SjLVRiKLJ1L0PZhBIsKY5yLCFg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sg0ViGT+ndehrNB+DKa1uDYThb3J3pqzU1plJOzJB5g9maAVCKYf1Cc4K3+W+2YP2 qjnSyqP0VpNSGoHDHq+pql+sYZBmA4Bcda7djAabQpGi//iudpc/UwOSuooDqOLCZ1 6fyZ19GakLXIrTMA1sWHQ0li0lTzStliHesahuSM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Douglas Anderson , Sasha Levin Subject: [PATCH 4.9 008/159] Revert "drm: bridge: analogix/dp: add panel prepare/unprepare in suspend/resume time" Date: Mon, 24 Oct 2022 13:29:22 +0200 Message-Id: <20221024112949.663627799@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1747569385334688298?= X-GMAIL-MSGID: =?utf-8?q?1747569385334688298?= From: Brian Norris [ Upstream commit cc62d98bd56d45de4531844ca23913a15136c05b ] This reverts commit 211f276ed3d96e964d2d1106a198c7f4a4b3f4c0. For quite some time, core DRM helpers already ensure that any relevant connectors/CRTCs/etc. are disabled, as well as their associated components (e.g., bridges) when suspending the system. Thus, analogix_dp_bridge_{enable,disable}() already get called, which in turn call drm_panel_{prepare,unprepare}(). This makes these drm_panel_*() calls redundant. Besides redundancy, there are a few problems with this handling: (1) drm_panel_{prepare,unprepare}() are *not* reference-counted APIs and are not in general designed to be handled by multiple callers -- although some panel drivers have a coarse 'prepared' flag that mitigates some damage, at least. So at a minimum this is redundant and confusing, but in some cases, this could be actively harmful. (2) The error-handling is a bit non-standard. We ignored errors in suspend(), but handled errors in resume(). And recently, people noticed that the clk handling is unbalanced in error paths, and getting *that* right is not actually trivial, given the current way errors are mostly ignored. (3) In the particular way analogix_dp_{suspend,resume}() get used (e.g., in rockchip_dp_*(), as a late/early callback), we don't necessarily have a proper PM relationship between the DP/bridge device and the panel device. So while the DP bridge gets resumed, the panel's parent device (e.g., platform_device) may still be suspended, and so any prepare() calls may fail. So remove the superfluous, possibly-harmful suspend()/resume() handling of panel state. Fixes: 211f276ed3d9 ("drm: bridge: analogix/dp: add panel prepare/unprepare in suspend/resume time") Link: https://lore.kernel.org/all/Yv2CPBD3Picg%2FgVe@google.com/ Signed-off-by: Brian Norris Reviewed-by: Douglas Anderson Signed-off-by: Douglas Anderson Link: https://patchwork.freedesktop.org/patch/msgid/20220822180729.1.I8ac5abe3a4c1c6fd5c061686c6e883c22f69022c@changeid Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index d1077a342f38..7c683245bdc0 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1463,12 +1463,6 @@ int analogix_dp_suspend(struct device *dev) struct analogix_dp_device *dp = dev_get_drvdata(dev); clk_disable_unprepare(dp->clock); - - if (dp->plat_data->panel) { - if (drm_panel_unprepare(dp->plat_data->panel)) - DRM_ERROR("failed to turnoff the panel\n"); - } - return 0; } EXPORT_SYMBOL_GPL(analogix_dp_suspend); @@ -1484,13 +1478,6 @@ int analogix_dp_resume(struct device *dev) return ret; } - if (dp->plat_data->panel) { - if (drm_panel_prepare(dp->plat_data->panel)) { - DRM_ERROR("failed to setup the panel\n"); - return -EBUSY; - } - } - return 0; } EXPORT_SYMBOL_GPL(analogix_dp_resume);