Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2405058rdb; Thu, 21 Sep 2023 19:00:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEBUAV7eBoMmaInUoOeAQrQvgcGKQXz5KFHaZm+l9kFj7XsEn65cqvR2WTd/MHok0gcPl0w X-Received: by 2002:a17:902:e744:b0:1c0:bf60:ba82 with SMTP id p4-20020a170902e74400b001c0bf60ba82mr7023124plf.5.1695348038698; Thu, 21 Sep 2023 19:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695348038; cv=none; d=google.com; s=arc-20160816; b=t/daru00GAAbc4EigZ+C9y5dt98oQ3Tz81GeLLYti084UyrPAtPL4r3xCLREdPuROn ymzHB07IvP0+5GonNIePa8mZjI8Owr+TtTWAbNt9A17SYV8rZOuoHNkLvpGnXOm4xMUa zqDEOLs5OW+wbLUHFMWM2MKsAERM7x9XAceEkgO0Xnmt+2HssH309qoAVWqp9lbSkZYK ea/B9H0bnPw2tlUD3SK3vtsQThcnq2FVxEgPd0lFSqmRyi/a/B61f0+0yM7b/xDFFasJ toZk5R6WLW0kNbEWtjYTehDuZ+q0vaJHbLMxecL4AUxBRP7WABx42Al+GXfL03yXhUHc /5aw== 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=6yWq/C0tGEFLQw6PZcuzFNMM1hDy2t48whBia8F49Jg=; fh=8QRJ4FQn02FtHGCZFNwNBtZ5NUg+fEu+YhROfW8MK9c=; b=zXb9PsB/b9P0PQLVYv9YctbV09/c+maQga2XkXZOnQwF1o/QMagsCPlPV/UpiYC9KD KSZmUsz4tmYbYBibtLcvaps7Kv28fGvOENLWPfjxbvsHPTpixPWMQoEVxi46BylSxdWs EUTvMudFdcbi3ZVqnJ0IL9aTYT5IMviHLOk0BUVwN5Y6HZWgAkF8tNeUjh002bCTysGr QofjmU9jSa4+mohN/NPb05MrweAWT47kvO3fQyL+UBsxHreIsbiYSnLJjKe23Z6j6e2R ewyh5dW9yfh6SlN9qC8oxFUrZj/YdS9EBQkgop3A9Mjs25dtTDX+BgFi/OVeEAHKm7uo 5i6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hxwGXiYb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id lq13-20020a170903144d00b001b9fb1a0465si2514948plb.385.2023.09.21.19.00.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 19:00:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hxwGXiYb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 D0D3F8326586; Thu, 21 Sep 2023 12:48:38 -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 S231296AbjIUTsk (ORCPT + 99 others); Thu, 21 Sep 2023 15:48:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231237AbjIUTs3 (ORCPT ); Thu, 21 Sep 2023 15:48:29 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8E2C59E3 for ; Thu, 21 Sep 2023 12:28:49 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1c5c91bec75so11092595ad.3 for ; Thu, 21 Sep 2023 12:28:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695324529; x=1695929329; 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=6yWq/C0tGEFLQw6PZcuzFNMM1hDy2t48whBia8F49Jg=; b=hxwGXiYb4PM04EE74siGDJwQX0yEZrnJ1g7ZxEaC1XmHA8FSHr5IWWQuQ3KyIueDBO 1xH8dUw35rP3xosg/qTRmsRnVEO792m61KxNhpyRukmmOrRA/PQ2wZrE26LMV96yuWTU 3B1UBS9/LlKbvQtWtt0zP96Tulxt9Pw+F/Xmw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695324529; x=1695929329; 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=6yWq/C0tGEFLQw6PZcuzFNMM1hDy2t48whBia8F49Jg=; b=tN4kaHaPifyD+qzebcItmahfru9kfRh6uS2p1CabeTSS1m64jgXgMthGqlGaIGG8/Z 7KrGEBEK8XNgQkxUEszpcpFmauPjiAAdzl8oWNxHwozvAzlsKs08vPBeyhPDgxeky95/ l3D5z1nbQ3AD+EoaQTvDM2yf4lRYuy0CmlFIh3VKbX0q9HPnvWQEwlQMAa9mQmW5IsRH fKD16tsYdsZxvHOCzNt6+wpEjVjR5fCRObb+VsFaRQOXMdYtgE3ZWtHbcvofW8CIK0L0 1ivbwRfv3mHiYrCF6nuOQmsFR3x7pY6eNpvZHgFMf9iV1PM1O25cLX/8ictdGNwuTZ0o 8xdQ== X-Gm-Message-State: AOJu0YzxwF6//cMHy4BgQRJDFD2feHfSI+EsQI9fdbfp/ZHHyJX20GZ2 +4LH9yUtXpxKeAn41PHFYKryFw== X-Received: by 2002:a17:902:c409:b0:1c4:4a4d:cda with SMTP id k9-20020a170902c40900b001c44a4d0cdamr7404355plk.15.1695324528913; Thu, 21 Sep 2023 12:28:48 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:28:47 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Geert Uytterhoeven , airlied@gmail.com, biju.das.jz@bp.renesas.com, daniel@ffwll.ch, kieran.bingham+renesas@ideasonboard.com, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, paul@crapouillou.net, sam@ravnborg.org, tzimmermann@suse.de Subject: [RFT PATCH v2 12/12] drm/renesas/shmobile: Call drm_helper_force_disable_all() at shutdown/remove time Date: Thu, 21 Sep 2023 12:26:55 -0700 Message-ID: <20230921122641.RFT.v2.12.Iaf638a1d4c8b3c307a6192efabb4cbb06b195f15@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 Content-Transfer-Encoding: 8bit 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_BLOCKED,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:39 -0700 (PDT) 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 Cc: Geert Uytterhoeven Signed-off-by: Douglas Anderson --- This commit is only compile-time tested. As Geert pointed out in response to v1 [1], this patch conflicts with the patches doing atomic conversion [2]. Since those patches don't appear to be landed yet, I'm simply reposting v1. If those patches land, I'm more than happy to re-post this one. I'm also more than happy if someone wants to incorporate these changes into a different patch. [1] https://lore.kernel.org/r/CAMuHMdWOB7d-KE3F7aeZvVimNuy_U30uk=PND7=tWmPzCd7_eg@mail.gmail.com [2] https://lore.kernel.org/dri-devel/fd7a6702490bd431f314d6591551bb39e77e3304.1692178020.git.geert+renesas@glider.be/ Changes in v2: - Rebased and resolved conflicts. drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c index e5db4e0095ba..8c4c9d17a79e 100644 --- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c +++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -179,10 +180,18 @@ static void shmob_drm_remove(struct platform_device *pdev) drm_dev_unregister(ddev); drm_kms_helper_poll_fini(ddev); + drm_helper_force_disable_all(ddev); free_irq(sdev->irq, ddev); drm_dev_put(ddev); } +static void shmob_drm_shutdown(struct platform_device *pdev) +{ + struct shmob_drm_device *sdev = platform_get_drvdata(pdev); + + drm_helper_force_disable_all(sdev->ddev); +} + static int shmob_drm_probe(struct platform_device *pdev) { struct shmob_drm_platform_data *pdata = pdev->dev.platform_data; @@ -287,6 +296,7 @@ static int shmob_drm_probe(struct platform_device *pdev) static struct platform_driver shmob_drm_platform_driver = { .probe = shmob_drm_probe, .remove_new = shmob_drm_remove, + .shutdown = shmob_drm_shutdown, .driver = { .name = "shmob-drm", .pm = pm_sleep_ptr(&shmob_drm_pm_ops), -- 2.42.0.515.g380fc7ccd1-goog