From patchwork Thu Sep 21 19:26:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 143110 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5282071vqi; Thu, 21 Sep 2023 19:48:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEfUaiw72J4su4vIwv53CCBzqpQBmYFJzra4UEZ/GRgiPaOg5gZUwPwL5dglEX03d6AL8Ni X-Received: by 2002:a05:6902:1890:b0:bc9:92c9:7fd1 with SMTP id cj16-20020a056902189000b00bc992c97fd1mr9163323ybb.3.1695350896222; Thu, 21 Sep 2023 19:48:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695350896; cv=none; d=google.com; s=arc-20160816; b=y6EZT2yHyCrVEsZd2frL3EalLoGQ+aAmEkDnGulJlaJely07VE+V3J8sz7Vx9mstmp oz1WYLT49TS5ORJm1Ydz1el1Rz67iufMFprevEUYpoQf0QHnIJbsMvu7g5xw0J9MKpeV iMi9R1HECsVqf8V4TkmzbO+1X5krddBcuAbVztdOh9WdnVGDmJz7CzOyvo29oPCS2H9r SFzpO3P3Vk80BUUwn7Z7f2SgKGtWyKrGQBv8PJrYM2D78FL4/kKQew0AQrHrPEN5Uo/v 5jSmmGE7KM9gWTWxSPs5WqsDdNmycR+9iwml51oE0nfERi+5ia4pKLkDqB/tuLgQXdbe HmQg== 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.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id cf4-20020a056a02084400b00577ed0133d2si2746717pgb.453.2023.09.21.19.48.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 19:48:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; 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.38 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 fry.vger.email (Postfix) with ESMTP id 0BC4E81C50AE; Thu, 21 Sep 2023 12:48:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231316AbjIUTsl (ORCPT + 28 others); Thu, 21 Sep 2023 15:48:41 -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 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Thu, 21 Sep 2023 12:48:50 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777704261388953458 X-GMAIL-MSGID: 1777704261388953458 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),