From patchwork Wed Jun 12 22:23:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13695628 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 08941C27C77 for ; Wed, 12 Jun 2024 22:25:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E3B3E10E934; Wed, 12 Jun 2024 22:25:35 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="LBOxyrOC"; dkim-atps=neutral Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by gabe.freedesktop.org (Postfix) with ESMTPS id D443810E933 for ; Wed, 12 Jun 2024 22:24:58 +0000 (UTC) Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-6eab07ae82bso270609a12.3 for ; Wed, 12 Jun 2024 15:24:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1718231098; x=1718835898; darn=lists.freedesktop.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=eCLxsF8rhWGGZr+97E/MrTNjYe+fnMrZ7mNGuOaWySo=; b=LBOxyrOChXWKWl2WidOI0fx+sXFaXiL1ZYn108zAObifZMZmejAMLVixqxM1l8rJAA UL6gf/uomRAoVJnkbR58DJHlFnl23t3Ouk2oIF7K1gybcOGJPAq/RlD4YOznRCYBTgJ3 iyUwiKhMHSSvRBqRAn1tl1V4bWRy0/m49rfSA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718231098; x=1718835898; 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=eCLxsF8rhWGGZr+97E/MrTNjYe+fnMrZ7mNGuOaWySo=; b=AFCOP0Wwq91+aYvKrCuTXpPuh329GFpR6zI5tvdRnO4M6K4Cr+cSbNovCuZRiAXEHY EVfmh9hT53mM93Urygw0z6kCelEwbEsv8lq7Wy/lMdGZDMNYe64eTyRHRrMrcCB3JuvG fAX890aBK4yR7PKLYOTSxNO4C/Ks1HOKMaxVga4dwpfSBx+8tYIjYVX32AYUGENAd/QN t7r69DbvA/VujKr0zL9XW/pRGDqQWXoGWB0mGzKCPu7+884wBJnfg3Vd12ii2VaG+OUf A7Nils0V6VlIt3CvRmNPDeF6ROFoDYF/LPiMkTlV3oiYBESacAiDQY5up5QVhxIUiIIz JHlA== X-Gm-Message-State: AOJu0Yxv4ZWOloH1yfOHoDckqBkJtS3yp8aGxAMFUI0WNNEZqZPVWLL9 FpIMXhcYopONw2Qx2ruN8iLrwCSaZafFVaICdHXIza9RNREyI+RNCuObK0nJ8Mm42MRESyjg1IE = X-Google-Smtp-Source: AGHT+IFXmBDxj4j5xao5roMZtZUT3z8AsYTNgifgJ+RUUK1gO4l9UAxZFVxYo9uWh5aBe2pfsNj1Pg== X-Received: by 2002:a17:903:2307:b0:1f7:1ca3:d0d3 with SMTP id d9443c01a7336-1f83b565d56mr34307215ad.4.1718231097634; Wed, 12 Jun 2024 15:24:57 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:2816:6a42:9074:18cc]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6f30acda9sm87914105ad.198.2024.06.12.15.24.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 15:24:56 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Daniel Vetter , David Airlie , Maarten Lankhorst , Patrik Jakobsson , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [PATCH v2 6/8] drm/gma500: Call drm_helper_force_disable_all() at shutdown/remove time Date: Wed, 12 Jun 2024 15:23:46 -0700 Message-ID: <20240612152336.v2.6.I1be622999c3b23f28f077fc75bb0319396a216e9@changeid> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog In-Reply-To: <20240612222435.3188234-1-dianders@chromium.org> References: <20240612222435.3188234-1-dianders@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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, };