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: 11115755 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2076414DB for ; Mon, 26 Aug 2019 22:33:29 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 086B7217F5 for ; Mon, 26 Aug 2019 22:33:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 086B7217F5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.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-Google-Smtp-Source: APXvYqxQTohvm6kcb9t8rthFPIBSnAxjFnCrL2Q0aNrpR23ZX/iHGRJYJCngRNhWSqp52/nZvAdC2Q== 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