From patchwork Mon Aug 26 22:33:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 172221 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp4965409ily; Mon, 26 Aug 2019 15:33:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzu7UiQ7Tc1li0/dnAcD2K3Wy98BqOATwiUElkuEIQw7SKmWFouMAMZx3WPY9UfO8JutpId X-Received: by 2002:a63:1310:: with SMTP id i16mr18230655pgl.187.1566858809070; Mon, 26 Aug 2019 15:33:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566858809; cv=none; d=google.com; s=arc-20160816; b=P3F6XHHVIliIONtEWqMQjnb4UZTD25RdagX3He8YE7z/scFSb3ok/L09ST3kb0Oh65 Gal1dZyOCfW2JgObX5f+DH/hAQax4oksog7T/6ZrXmHkgxupOJB1Mw93yMqL5CBRb3QH /UKcB9gEtPIk5aY3Pwky1Kg3qnmuHXYmOe/SFULBYxn2Xy/SJjpZBd3uQN5Zhg84weZ6 Pn5DW7nOQjYAohM/lJt1YDkJtpFD/unOgs9xD+TWJ5GNd/7y0n2UuOAdRXMx2BltEGYe 1sAdS2/ONDsPqNb9A9cqmaiW4k19s9KHuserw1ZDt55QjgGGYurozpK+ZMJrsLft29Vm 7wHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=2+9Vqkfxd/m3U2GdxEr14lMnwiaRgHUhs+RDKgtls/M=; b=bEOFwMlkZMgnmuTHjI2hbdrvzS667lfUshMDoazFEuTon7Onz3O+vv5SKm6r/pZbkI BsSgp+fmIMCBlRD5ySQs/XVaLJa92Sk2fXQkos/+NzOcssBDpgtiJMEuLp21tp9Scezi xZcnUMev45M+UWIZcORkxc1kX4ole4KeNTu6wh8TWQY7UBOXn4aXG6GVe2rhe3+27FnC SzZY5LXPQ1yb2hC5HgcURUrStEKEMeUpESXOegmMBAxrsg+OG0qYseka6SJCl8xWqyik dAxLWavbALTrgLPbSwta37/peA7322Mij3kP57VB9jnIuBbN6FK3UCgXWdr6YNx4L+mS O8Qw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id m184si12102800pfb.127.2019.08.26.15.33.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Aug 2019 15:33:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 563306E315; Mon, 26 Aug 2019 22:33:25 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ot1-f66.google.com (mail-ot1-f66.google.com [209.85.210.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7AF6289C98 for ; Mon, 26 Aug 2019 22:33:20 +0000 (UTC) Received: by mail-ot1-f66.google.com with SMTP id b1so16807213otp.6 for ; Mon, 26 Aug 2019 15:33:20 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZXQLljPOJppvUwH5wuivPhE8Q1AsKryxsAzIJcaFlYI=; b=DhE5xmWg20b5+jfS8pg00y7Ou4Iou2ROdSDY48nhmc9yyT5C+klg3QtYoBGZ8IefPT zWOPVxDLP9yqaJyydv/XwyDTW+neC8msUTt5Gfnl6FHJfW9mWnmBNIvulFQe9qdCDlPl 50x+sabQxuAjyLfe1NcQyFfvEWSq+m8x/ZmcHwPSTIFwk7/TJjPQWtOXIYk1oKW0P/ZP BaG69ob1wqvrbXm1XAWApuuktH9LA3ioJmn7y9WUQhA6YMN5kg6atjFszlG8aZR2wIRh g0Wi//sO6s6ZKjioS2z8KmDWaEzMgl1TBcp0mNQA18OPy1/qe8Uoh+HcVzUKgaJdqLDy 1SGQ== X-Gm-Message-State: APjAAAUbcfhbErx2eXa62HmOB1tpLphe8rRlMA+r7RfnGKXmR7LGV4zL Tsg92gmrflS1sD7mTpS34Zg345M= X-Received: by 2002:a05:6830:1e0a:: with SMTP id s10mr16241992otr.252.1566858799501; Mon, 26 Aug 2019 15:33:19 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id e22sm3668959oii.7.2019.08.26.15.33.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2019 15:33:18 -0700 (PDT) From: Rob Herring To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 1/8] drm/panfrost: Rework runtime PM initialization Date: Mon, 26 Aug 2019 17:33:10 -0500 Message-Id: <20190826223317.28509-2-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190826223317.28509-1-robh@kernel.org> References: <20190826223317.28509-1-robh@kernel.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomeu Vizoso , David Airlie , Steven Price , Alyssa Rosenzweig , Robin Murphy Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" There's a few issues with the runtime PM initialization. The documentation states pm_runtime_set_active() should be called before pm_runtime_enable(). The pm_runtime_put_autosuspend() could suspend the GPU before panfrost_perfcnt_init() is called which touches the h/w. The autosuspend delay keeps things from breaking. There's no need explicitly power off the GPU only to wake back up with pm_runtime_get_sync(). Just delaying pm_runtime_enable to the end of probe is sufficient. Lets move all the runtime PM calls into the probe() function so they are all in one place and are done after all initialization. Cc: Tomeu Vizoso Cc: Steven Price Cc: David Airlie Cc: Daniel Vetter Acked-by: Alyssa Rosenzweig Signed-off-by: Rob Herring Reviewed-by: Robin Murphy :robin.murphy@arm.com> Reviewed-by: Steven Price --- v3: - Move autosuspend setup after pm_runtime_enable as only autosuspend changes trigger suspend. - Fix autosuspend delay to 50ms instead of 0. drivers/gpu/drm/panfrost/panfrost_device.c | 9 --------- drivers/gpu/drm/panfrost/panfrost_drv.c | 10 ++++++---- 2 files changed, 6 insertions(+), 13 deletions(-) -- 2.20.1 diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c index 4da71bb56c20..73805210834e 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.c +++ b/drivers/gpu/drm/panfrost/panfrost_device.c @@ -5,7 +5,6 @@ #include #include #include -#include #include #include "panfrost_device.h" @@ -166,14 +165,6 @@ int panfrost_device_init(struct panfrost_device *pfdev) if (err) goto err_out4; - /* runtime PM will wake us up later */ - panfrost_gpu_power_off(pfdev); - - pm_runtime_set_active(pfdev->dev); - pm_runtime_get_sync(pfdev->dev); - pm_runtime_mark_last_busy(pfdev->dev); - pm_runtime_put_autosuspend(pfdev->dev); - err = panfrost_perfcnt_init(pfdev); if (err) goto err_out5; diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c index d74442d71048..bc2ddeb55f5d 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -523,10 +523,6 @@ static int panfrost_probe(struct platform_device *pdev) mutex_init(&pfdev->shrinker_lock); INIT_LIST_HEAD(&pfdev->shrinker_list); - pm_runtime_use_autosuspend(pfdev->dev); - pm_runtime_set_autosuspend_delay(pfdev->dev, 50); /* ~3 frames */ - pm_runtime_enable(pfdev->dev); - err = panfrost_device_init(pfdev); if (err) { if (err != -EPROBE_DEFER) @@ -541,6 +537,12 @@ static int panfrost_probe(struct platform_device *pdev) goto err_out1; } + pm_runtime_set_active(pfdev->dev); + pm_runtime_mark_last_busy(pfdev->dev); + pm_runtime_enable(pfdev->dev); + pm_runtime_set_autosuspend_delay(pfdev->dev, 50); /* ~3 frames */ + pm_runtime_use_autosuspend(pfdev->dev); + /* * Register the DRM device with the core and the connectors with * sysfs