From patchwork Thu Sep 21 19:26:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 142996 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5199634vqi; Thu, 21 Sep 2023 16:13:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJfgLemphaIsuQj49F1IkUoiFZMZqyXqawUGNyzKQWDjXJsMBoSnV5cEdifXJwhi/xd6D1 X-Received: by 2002:a81:9297:0:b0:56d:2d82:63dc with SMTP id j145-20020a819297000000b0056d2d8263dcmr6499003ywg.10.1695338035934; Thu, 21 Sep 2023 16:13:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695338035; cv=none; d=google.com; s=arc-20160816; b=Zf4NpmiyXlo77EmwNdMBinTDLJnxYaN9lXFA9dgAJbBlw7cI82IQpP5GNOWxO/IaAI P4pjiK+rjbNddc/6nWNT3byQFcoo3x5BKOmBTZkDHHhUe/5gsMebA3BgVUEjKEv6Dq3H Mvqq8dBaQDv2x1czHr7gNMPCf4s2MW6cyvgOF8C2AGshof+6CKJNNhLn3BK52elu6lnN eShmWazHvwcQh6JGCUERX74plyPLj3zkmRsPWG+bPSN6QUkhiunbV8Ytml8iFv36Guuu LIuT1MAXc3bmI0X7n7AVOcvdGqU47WRrPNh/mxYaXwA1hF4p+8gFfX4zTYHywRrMkJ5t d3Xw== 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=SjE9g39gnCCj7j/VSb42AYR6J5acTdAldxrB9mluCQs=; fh=EKdpOkl3MPhgdEtijZqmzNPkw5d8ymlXDTQ7+vtrW84=; b=Dz2bBWk8Yo2Yc5n3FjrB8yTk93D2BZVY1w2+nGfm87nCzgSw97iedkNOIJzfX2eh6t 4MqMAe9aSyEfQ2W/AKrlXnJgGvA7ZGl5pntHPlasjSKytoEbYVcABAi+I3TMwIMzAT6L C9OZLcQwWKulc34E/ANkIWd0ou630T4y1wysmH8424Y/fMGbTluz/JlV1htr/hm4FEzr y7AzAbrl1iQutpDHV5PMBXC8fgieOra306sV7eHnagcQFgDxXyviG/O9mAe+Xzwyp+FI rgoNE/F45rIqMylXBEQYcX9qsbb1EliSodxU52rDL3puxpTkRLnZzYH2xEmQ+lMifWwd FUIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=UlFhRDpu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id s8-20020a17090aad8800b0026b502223cbsi2578579pjq.10.2023.09.21.16.13.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 16:13:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=UlFhRDpu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id CCC098325D12; Thu, 21 Sep 2023 12:48:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231260AbjIUTsA (ORCPT + 28 others); Thu, 21 Sep 2023 15:48:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230169AbjIUTrk (ORCPT ); Thu, 21 Sep 2023 15:47:40 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99F98EA627 for ; Thu, 21 Sep 2023 12:28:44 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1c09673b006so11154185ad.1 for ; Thu, 21 Sep 2023 12:28:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695324524; x=1695929324; darn=vger.kernel.org; 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=SjE9g39gnCCj7j/VSb42AYR6J5acTdAldxrB9mluCQs=; b=UlFhRDpuDdoVAn1e29otD8iq6yUH4efuvBH5/2VDVbZwhVYDLQOfjPbd5Csa9nefxV ygeWb3u9m0lzH50UQjUpyjseYNrvueJJQSHJecEIWrDZDbP9QIphlRvU2pB2WxBOextk A88/4yMrcFFC0DrrDa1N5AP/nJDnBLs7XKc8A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695324524; x=1695929324; 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=SjE9g39gnCCj7j/VSb42AYR6J5acTdAldxrB9mluCQs=; b=ZiuD5qZ1jahOuUeRszmVZlB9FjSTJR6asSDTYhNley6NlG7/9HCfnhOo390yPV9fXW 3vOxJ3V0d2jdVsbSLdhA/KNazd44luMHDODJ2BfOmxg0W2U/CKPVTNrutsr3z/qX2t7F XwcYVPt2g/FIhoYWM0jHSrxzszt3L6gLXJ4VAgID15aQGJosfnAQ1abPpMQ+VP0jF858 v/jHDPAHKHGs/D6rzNmX3nLeEcFDNVo2ZoG9fm/tBMi6ByUeJ3A2aYWj8dDXfu3bagMZ cPYu44Woepdy1kAwGM3u0gV/DQ7iyVQR7guFTbbdMXnEclOpCfURa43lXY6nlUSuX4Oh y7Wg== X-Gm-Message-State: AOJu0YzqBgufdCufUr0pye7DJnYhYHdwtSTbJVKjJiZZeuIH2acNBrLa xJV5k0RJP0DgsOgR4pP0XlkV3Q== X-Received: by 2002:a17:902:d491:b0:1c3:8230:30d8 with SMTP id c17-20020a170902d49100b001c3823030d8mr7671409plg.38.1695324524060; Thu, 21 Sep 2023 12:28:44 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e6ed:6d49:f262:8041]) by smtp.gmail.com with ESMTPSA id w8-20020a1709029a8800b001b9f032bb3dsm1892875plp.3.2023.09.21.12.28.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:28:42 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , airlied@gmail.com, daniel@ffwll.ch, linux-kernel@vger.kernel.org, patrik.r.jakobsson@gmail.com Subject: [RFT PATCH v2 10/12] drm/gma500: Call drm_helper_force_disable_all() at shutdown/remove time Date: Thu, 21 Sep 2023 12:26:53 -0700 Message-ID: <20230921122641.RFT.v2.10.I1be622999c3b23f28f077fc75bb0319396a216e9@changeid> X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog In-Reply-To: <20230921192749.1542462-1-dianders@chromium.org> References: <20230921192749.1542462-1-dianders@chromium.org> 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,URIBL_BLOCKED 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 21 Sep 2023 12:48:01 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777690776293359640 X-GMAIL-MSGID: 1777690776293359640 Based on grepping through the source code, this driver appears to be missing a call to drm_atomic_helper_shutdown(), or in this case the non-atomic equivalent drm_helper_force_disable_all(), at system shutdown time and at driver remove time. This is important because drm_helper_force_disable_all() will cause panels to get disabled cleanly which may be important for their power sequencing. Future changes will remove any custom powering off in individual panel drivers so the DRM drivers need to start getting this right. The fact that we should call drm_atomic_helper_shutdown(), or in this case the non-atomic equivalent drm_helper_force_disable_all(), in the case of OS shutdown/restart comes straight out of the kernel doc "driver instance overview" in drm_drv.c. Suggested-by: Maxime Ripard Reviewed-by: Maxime Ripard Signed-off-by: Douglas Anderson --- This commit is only compile-time tested. (no changes since v1) drivers/gpu/drm/gma500/psb_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c index 8b64f61ffaf9..a5a399bbe8f5 100644 --- a/drivers/gpu/drm/gma500/psb_drv.c +++ b/drivers/gpu/drm/gma500/psb_drv.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -485,6 +486,12 @@ static void psb_pci_remove(struct pci_dev *pdev) struct drm_device *dev = pci_get_drvdata(pdev); drm_dev_unregister(dev); + drm_helper_force_disable_all(dev); +} + +static void psb_pci_shutdown(struct pci_dev *pdev) +{ + drm_helper_force_disable_all(pci_get_drvdata(pdev)); } static DEFINE_RUNTIME_DEV_PM_OPS(psb_pm_ops, gma_power_suspend, gma_power_resume, NULL); @@ -521,6 +528,7 @@ static struct pci_driver psb_pci_driver = { .id_table = pciidlist, .probe = psb_pci_probe, .remove = psb_pci_remove, + .shutdown = psb_pci_shutdown, .driver.pm = &psb_pm_ops, };