From patchwork Fri Aug 23 02:12:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 172075 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1570ily; Thu, 22 Aug 2019 19:12:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqycnX0dmvNzTVzFjGu7tHMLUlTnsv27WnceviE50qCGDkw8b2CyRyNRCi9W5yAVDk7cqy+Y X-Received: by 2002:a17:90a:e2ca:: with SMTP id fr10mr2868172pjb.72.1566526345819; Thu, 22 Aug 2019 19:12:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566526345; cv=none; d=google.com; s=arc-20160816; b=g4P97Yo+qlvKdY9ns14pUCrcsxJP5Be2+WvdDagGZQjawgS2qfw5x35bXgE/7lerlu xdx+ztSf87hDLmvvdBnA7RfNVYctcCy/fvz/48UH7nnw16mXgz4oZKLlVM1DWRE4uYBX qonzwYOHFiI0/O9728mhyY3zmpxPkIXv/cBJvXuQfdseccoDIvQKfiMBnms843MrZyUd 08i1I2veNTaog6ldkWn1mJ0CXimsetgY2pOzDzovETTNe+Psu7/LcWKXCyEP1uUvX6vv f0yTRi1HuJdITdj+QkzYo9Oektp1BsuSrIZHRSYuvaWdkO0L/wHwHfQJRhvbAIptS1OD Q48A== 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=Szg7dU+xm4QYA9SPmlfr8Ok44itv5wlcv+QgZ442Vj4=; b=M7eFvrVq+xsAzK9Zif3CWgbzHds9PsK8WP6f1TwRq8wUqFPZ1inucvhDlEe/NuuVin JwraXD8V3G2otinqngl+U1SdEDf2K6n2S4ooC56NEsJ/4e383mxP2HU/XNxi0KvQrj9e 62YaiAM1kddG+7ogawSvo5xFRTsQTe6BV61VSYpdzVaCQJCOnoO9ZKlNddZFYuOMafqA lCG0ol3eX2/Lsx26WfeXIwH79x87xzJmkQz4LK6z24v9cY9RwJjEhxywah/aqYoLBF5g wCiQJDozXS+SU1jQKQAF/6z+H+XjvT61QagHs7OdBxkzWwK/hRHDngZH2z3rwZIhHBJ/ vZqg== 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 131.252.210.177 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. [131.252.210.177]) by mx.google.com with ESMTPS id l65si1100287plb.312.2019.08.22.19.12.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Aug 2019 19:12:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 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 680476EB21; Fri, 23 Aug 2019 02:12:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-oi1-f193.google.com (mail-oi1-f193.google.com [209.85.167.193]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0AB856EB21 for ; Fri, 23 Aug 2019 02:12:22 +0000 (UTC) Received: by mail-oi1-f193.google.com with SMTP id a127so5929085oii.2 for ; Thu, 22 Aug 2019 19:12:22 -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=fYbwrgvdXN8jjHtFDjFYgPFUHMXy/bFl85EmNqO4GoA=; b=tye3nwEsNxKHAwaBrGEfxPn74NCiu+2Vb9sHQkrrD8C2sFEMEtWPpwAN1erZvKPi8l jXhNxZWwQfm9LVt6ArqokHV52cNjOBrVcD9d6Pbhm7r++IwgBipPlUUiFSbDV2IsECT4 uNUZY8064PGfBZLFWTpVqUW1aYICUPoHsCu54+Jj4N8mg8deO2nbOHiUiBbjlG69JETT EvK1k5G5HoCGAnRUnqCjmjwidhOg67MBontTblizGgPH+OTd8n9Lz5ULTN7tHbH0BQBs cftlyO91h0A/NAcGLAO10lJ5LbqrIhsgudSNvafOUTf/PsEN4MALh54z2UKgnEGdmrYv xGLQ== X-Gm-Message-State: APjAAAUruB81TjmaYp1+5GP7mhrRiEO17VpwNHrRTFl8KESuwomE1jDp ptSq5LHZBGipvX3+RWpi9sfyMbs= X-Received: by 2002:aca:eb85:: with SMTP id j127mr1554378oih.177.1566526340953; Thu, 22 Aug 2019 19:12:20 -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 c1sm457747oic.31.2019.08.22.19.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2019 19:12:20 -0700 (PDT) From: Rob Herring To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 2/8] drm/panfrost: Rework runtime PM initialization Date: Thu, 22 Aug 2019 21:12:10 -0500 Message-Id: <20190823021216.5862-3-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190823021216.5862-1-robh@kernel.org> References: <20190823021216.5862-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: Maxime Ripard , Tomeu Vizoso , David Airlie , Sean Paul , Steven Price , Boris Brezillon , 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: Alyssa Rosenzweig Cc: David Airlie Cc: Daniel Vetter Signed-off-by: Rob Herring --- v2: new patch drivers/gpu/drm/panfrost/panfrost_device.c | 9 --------- drivers/gpu/drm/panfrost/panfrost_drv.c | 10 ++++++---- 2 files changed, 6 insertions(+), 13 deletions(-) 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..f27e3d6aec12 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_use_autosuspend(pfdev->dev); + pm_runtime_set_autosuspend_delay(pfdev->dev, 0); /* ~3 frames */ + pm_runtime_mark_last_busy(pfdev->dev); + pm_runtime_enable(pfdev->dev); + /* * Register the DRM device with the core and the connectors with * sysfs