Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp937260pxb; Wed, 3 Mar 2021 21:45:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/M0kymq0wgUtBK7nzQ/Gx3JrFy7e4+pi0jAIsZy/RAESaSW1GT2W4aCobraRKy/X4EqqQ X-Received: by 2002:a50:8524:: with SMTP id 33mr2589151edr.110.1614836728028; Wed, 03 Mar 2021 21:45:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614836728; cv=none; d=google.com; s=arc-20160816; b=0yLGZwYaI84oaDAubcV1kkPb73VsKAKi/P6U6LwWndpQxBkncm8q+gcwnM5V+waBA7 zZjRqTBxXzph2vk8uCHeVkf+uc3yeJG9SO6nO3ROTo/922IiGYRJ9En+zk8HS5oddcY8 8HhRMWYDsmAZj9kIcyimQICPtWcEZR6SdNt3YZiDiK7yg96i18Rb06fXG4dauULwmVs6 Zx5KtvehZN5ztbCS4gMt5lPxSqS6O/BC05+wPwDOA0fBnVm6sRFqPApDL0sdrKUTrK9h +2R6XMemtTUgK39xm43t0vcjKhq/TmsEi5HIf1jbh0WVPwE9BMTZFuGRL0pEBgTFclwu U/ew== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=elM1zjwBJSQBpl/quKbnHA4lgGWxjH0JrhX/IRautFw=; b=l3fa9Ezkh/DP33YGcm5/LrXK6yHAbQV3+j0h3mLLx4CuQOasKaBABv8NrM86kOTlNa iIpdGUersBm/IGJOp2UvYor7uv5Sp807Mgms0yDED8hrBou2CoGRN4Fk4bcMNw3s2RHj 5X6BUEsrZvuwOAG4zvgU8cH2mQu4Ak2uZq6AWAwotIuK6PP4790ErDv80fUHyB1cBjQR bgdrMp2Sp+7hDUGldzYzJ04p++XBzZylqI+2yTY4s+kvL1Ca3mxAJoTJMKyFBP4fZI56 LXhAzbeB1LVYx80wYnU54Up/oPFUrI1feLccer99Gtz/Jhy6ChE1DZrkswV1FcvI1TNB /WNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=S8q0CflZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t19si15944497ejd.179.2021.03.03.21.45.05; Wed, 03 Mar 2021 21:45:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=S8q0CflZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1577473AbhCBGWs (ORCPT + 99 others); Tue, 2 Mar 2021 01:22:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1576031AbhCBEXR (ORCPT ); Mon, 1 Mar 2021 23:23:17 -0500 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59EA4C06178C for ; Mon, 1 Mar 2021 20:22:37 -0800 (PST) Received: by mail-pg1-x533.google.com with SMTP id e6so13031399pgk.5 for ; Mon, 01 Mar 2021 20:22:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=elM1zjwBJSQBpl/quKbnHA4lgGWxjH0JrhX/IRautFw=; b=S8q0CflZIm2643Put3EV+hTcBCMksy/5FECh9eMjvyTxpSxSO3I6AudhkrPLxaQZ+d 0NkVPHj1lrpcxhhtnG+mlRAdzVGRLlgoGkCw5axRNij2VFwev2LEc2u89ZITrKrR6sGW J+F4KZKuQA012ZdPKaI6YaC9eE2JU9o4JEsRJKrOFiXEtHpa/og80HFKcFAR48jnykmK HnkYTXdJFdvSkoogh6saIA+CifU8TnZbn5jPY/kaD4UeYjecReNUvHeGN9AnnGofScRc pZ0axVwDG6sSaz3pTuoJl/qrSxUeA9O76+xvvIZbO2TpkCtlbTT18ZPC5hK7tI8+pNRm IfoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=elM1zjwBJSQBpl/quKbnHA4lgGWxjH0JrhX/IRautFw=; b=g/oNK8m6QAPveMZdzLn3hPO1+em+EGZznAGmkpCH1sk+Dx7h0lrat1RxwJEVY59qBv o7kyGlJNByxyqbUw/TdcTtHuCrZjZTgJHFn2cgxLzCevIIDPPO9JQ9oGjbZdcoNx2GLH 2NCOvcIVNJ+uuEWojYc+bNjKxZDf8v4zBRHKZMvj+SwWXLMIAAReVUJTM9BJGuwtd90T 9/+5Mhj4Ltxt/ciDjHhOZReobZ33mvMGn6ojuB9HpQU1buIyrW7Dv2Ikw3jd2VPmXPaV 6rBSqse7bnFMZdQubn/7oYl34SiRL5lCYWBdxHCT5mMDz431eqJQWOxPq3jELLgC1vfj TQTg== X-Gm-Message-State: AOAM533V5S2NmjyDigosgf0ujpDLrM/STKpaT8s2QbBdZxWKxHjLQ0gK ybFFmifcPD1bLcPZiwYVpVM= X-Received: by 2002:a62:16c9:0:b029:1ed:df04:8fcf with SMTP id 192-20020a6216c90000b02901eddf048fcfmr18408932pfw.63.1614658956954; Mon, 01 Mar 2021 20:22:36 -0800 (PST) Received: from localhost.localdomain (80.251.221.29.16clouds.com. [80.251.221.29]) by smtp.gmail.com with ESMTPSA id b14sm1134534pji.14.2021.03.01.20.22.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Mar 2021 20:22:36 -0800 (PST) From: Artem Lapkin X-Google-Original-From: Artem Lapkin To: narmstrong@baylibre.com Cc: khilman@baylibre.com, jbrunet@baylibre.com, martin.blumenstingl@googlemail.com, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, christianshewitt@gmail.com, art@khadas.com, nick@khadas.com, gouwa@khadas.com Subject: [PATCH] drm: meson_drv add shutdown function Date: Tue, 2 Mar 2021 12:22:02 +0800 Message-Id: <20210302042202.3728113-1-art@khadas.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Problem: random stucks on reboot stage about 1/20 stuck/reboots // debug kernel log [ 4.496660] reboot: kernel restart prepare CMD:(null) [ 4.498114] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin [ 4.503949] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU... ...STUCK... Solution: add shutdown function to meson_drm driver // debug kernel log [ 5.231896] reboot: kernel restart prepare CMD:(null) [ 5.246135] [drm:meson_drv_shutdown] ... [ 5.259271] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown begin [ 5.274688] meson_ee_pwrc c883c000.system-controller:power-controller: shutdown domain 0:VPU... [ 5.338331] reboot: Restarting system [ 5.358293] psci: PSCI_0_2_FN_SYSTEM_RESET reboot_mode:0 cmd:(null) bl31 reboot reason: 0xd bl31 reboot reason: 0x0 system cmd 1. ...REBOOT... Tested: on VIM1 VIM2 VIM3 VIM3L khadas sbcs - 1000+ successful reboots and Odroid boards, WeTek Play2 (GXBB) Tested-by: Christian Hewitt Signed-off-by: Artem Lapkin --- drivers/gpu/drm/meson/meson_drv.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 42c5d3246..693bb1293 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -482,6 +482,16 @@ static int meson_probe_remote(struct platform_device *pdev, return count; } +static void meson_drv_shutdown(struct platform_device *pdev) +{ + struct meson_drm *priv = dev_get_drvdata(&pdev->dev); + struct drm_device *drm = priv->drm; + + DRM_DEBUG_DRIVER("\n"); + drm_kms_helper_poll_fini(drm); + drm_atomic_helper_shutdown(drm); +} + static int meson_drv_probe(struct platform_device *pdev) { struct component_match *match = NULL; @@ -553,6 +563,7 @@ static const struct dev_pm_ops meson_drv_pm_ops = { static struct platform_driver meson_drm_platform_driver = { .probe = meson_drv_probe, + .shutdown = meson_drv_shutdown, .driver = { .name = "meson-drm", .of_match_table = dt_match, -- 2.25.1