From patchwork Fri Jul 10 09:53:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= X-Patchwork-Id: 11661575 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 43EFE913 for ; Tue, 14 Jul 2020 07:02:28 +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 20518221ED for ; Tue, 14 Jul 2020 07:02:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="apjndRlz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 20518221ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 0830A6E8E6; Tue, 14 Jul 2020 07:02:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id E88FC6EBBD for ; Fri, 10 Jul 2020 09:54:14 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id q15so5471302wmj.2 for ; Fri, 10 Jul 2020 02:54:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WimOihJEoGFrQflh5MG/QpMyDue9zSaiyBZVUVInhdA=; b=apjndRlzBADzjx/tKuL/n6DCF1QhTME/JWIr6K5Qr5g2IRZGeLMo/t/MyBZdlS4Wv7 k5bf8mqevDciEgy3gqH2+aIkTYToN0Zy1EZxDhoBehAtKeI+1tgSgDLhN7+/ne4RbQMk nxMUmPsxsj19A86Y1Jx+mlVe3Gs5ZYfyYGWBMdubz+qz+moVhkUKvftySUIQHimrukhE +aVrPiZYuvS5yHfxTERpS4FDfJUCshHX1JhRkOxz5K9hfiAbzgZpu6uNa3rSJHVUC9jU js5CnMsPWyGmIwH7i7TB16ow/aTQ6jsyl6DplG+JVru9fzexAymN2Hv0CciWGaQx/q70 UooA== 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=WimOihJEoGFrQflh5MG/QpMyDue9zSaiyBZVUVInhdA=; b=YKxSEn1wF5F5b/odPICmhG0dLfnYY71iO1jt8oeBPhkqWHEsFuzGOxHCdyHApN3cJL 15ubDWNirWk+hfPZQso5kh9RxXx36ho6QsfiKCIG/dDZbflk328yzfKev679Mqvl+IXU XaOb5gEY5XE6hYsze/3Q/Jd2SeOMx/6pMHsbBSi7wiXad9viFC+2WPcFHxgrpAODQRgM mdWatDQ2JW1N7c8epmjM+6lslM8m2a9+OHc30Y4jn1jYls5YovdF8pXFJ/nmSkGhH8g0 zY92aGdDrO+DG5KaHt7YqVcGBEZMLsnbnVeAXocOJm/IWBTPz63+OPqbJTlEEEvxwFUu nVFw== X-Gm-Message-State: AOAM530uQFV5ZubMEBBr7AGVvjBJ9KNTmU/5uYUyPFJnl7QIWugZs/Ho U+hM/Ic7B8UOAJO5DcPP6us= X-Google-Smtp-Source: ABdhPJxxIn8oYAxTV1peSwC8T66wTnW21RfMcb22cRnGtDFyLhEPQ7Ua941ytDhox3rI2N/NIlkm0A== X-Received: by 2002:a1c:48:: with SMTP id 69mr4576752wma.32.1594374853553; Fri, 10 Jul 2020 02:54:13 -0700 (PDT) Received: from clement-Latitude-7490.numericable.fr (213-245-241-245.rev.numericable.fr. [213.245.241.245]) by smtp.gmail.com with ESMTPSA id u23sm10176092wru.94.2020.07.10.02.54.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:54:12 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Viresh Kumar , Nishanth Menon , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v5 01/14] drm/panfrost: avoid static declaration Date: Fri, 10 Jul 2020 11:53:56 +0200 Message-Id: <20200710095409.407087-2-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710095409.407087-1-peron.clem@gmail.com> References: <20200710095409.407087-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 14 Jul 2020 07:02:08 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This declaration can be avoided so change it. Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 38 ++++++++++----------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 413987038fbf..1b560b903ea6 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -14,7 +14,24 @@ #include "panfrost_gpu.h" #include "panfrost_regs.h" -static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev); +static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev) +{ + ktime_t now; + ktime_t last; + + if (!pfdev->devfreq.devfreq) + return; + + now = ktime_get(); + last = pfdev->devfreq.time_last_update; + + if (atomic_read(&pfdev->devfreq.busy_count) > 0) + pfdev->devfreq.busy_time += ktime_sub(now, last); + else + pfdev->devfreq.idle_time += ktime_sub(now, last); + + pfdev->devfreq.time_last_update = now; +} static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, u32 flags) @@ -139,25 +156,6 @@ void panfrost_devfreq_suspend(struct panfrost_device *pfdev) devfreq_suspend_device(pfdev->devfreq.devfreq); } -static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev) -{ - ktime_t now; - ktime_t last; - - if (!pfdev->devfreq.devfreq) - return; - - now = ktime_get(); - last = pfdev->devfreq.time_last_update; - - if (atomic_read(&pfdev->devfreq.busy_count) > 0) - pfdev->devfreq.busy_time += ktime_sub(now, last); - else - pfdev->devfreq.idle_time += ktime_sub(now, last); - - pfdev->devfreq.time_last_update = now; -} - void panfrost_devfreq_record_busy(struct panfrost_device *pfdev) { panfrost_devfreq_update_utilization(pfdev); From patchwork Fri Jul 10 09:53:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= X-Patchwork-Id: 11661591 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 906E413B6 for ; Tue, 14 Jul 2020 07:02:47 +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 6AEE5221F5 for ; Tue, 14 Jul 2020 07:02:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E6ZLdbzE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6AEE5221F5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 EB1FC6E8E1; Tue, 14 Jul 2020 07:02:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 219926EBBD for ; Fri, 10 Jul 2020 09:54:16 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id q5so5297340wru.6 for ; Fri, 10 Jul 2020 02:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ciy3HDqvKk5PARaiKZGCtCw2SjWa+ryFuI+p7pTDJCM=; b=E6ZLdbzEcVMkO+y+P9AnK26+CL9Gii7HowUb0y8r871JmlAOtpsmlg4q3u3RWYvJBz Q952Bfv3QVNsjwHmqNLgsp0zBkj/wAEIswxRb8szToMHEwMJWEzSajuvPrXMjyJAbC6l 2jhisYIBYvelO7bWNmvBhf75KQTxFa2xP0baS4elXjau8Ju9MImntLZJSB4NtvUl7XOf 24nTmYHNG2sC4aQdoUoz6vm9kKytPw1+Fd2FzGw9VqE/1MyypSXx7wWSs8KmbAn+FA23 IzXT2tJKkvkNf8SpWQqlClpjMum4AoHDeFGTbeEsMjqDu3BwqocRat4DXYPd2kHZjbUt nplg== 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=ciy3HDqvKk5PARaiKZGCtCw2SjWa+ryFuI+p7pTDJCM=; b=CpNTRjZURvejQYlx85ygiXZLFTZkwqKQ4uORD+RGo0cYfHo082kGtk6LMngm7yRY68 Aqg99/QO5r3B/pp3BR+JFxQvNnsMRFfoU346WSOFYsZO7BqWSJCnu08IlVxx6EIYJ4Ql xR9uv4uaT9Zfd3P9arT/5vlFWymLQZu1lizeWeITvIGgsX4kggtmSRJ6qNaHoDxyodE/ qafwKz9XJ3RwZdMI07YHQuYJ31cJh017LMe9JA3dcjVRo5NLsU87Uacw97bj8QogDvJK iwUCVJFtXbfrB7//e8HFBrZ1QFiOOkTbC/s8ybyzkXekx6iIqSlIWe92JE+dRqe5glQ8 PHqA== X-Gm-Message-State: AOAM533xK5AalP16DMZ+bMJ5ypM6gPz3YXSg5l8xuAQZSyiUevAUe8RS Wxl+iz7ExaRlAreFijoFS+A= X-Google-Smtp-Source: ABdhPJxydbxqntuMQsGKoGZGdLY0/lHB7ypQPuA+b6q6L1xs17oMsk0rnQUbeamN86SZTzmI5d1HCw== X-Received: by 2002:a5d:4682:: with SMTP id u2mr65977070wrq.407.1594374854728; Fri, 10 Jul 2020 02:54:14 -0700 (PDT) Received: from clement-Latitude-7490.numericable.fr (213-245-241-245.rev.numericable.fr. [213.245.241.245]) by smtp.gmail.com with ESMTPSA id u23sm10176092wru.94.2020.07.10.02.54.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:54:13 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Viresh Kumar , Nishanth Menon , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v5 02/14] drm/panfrost: clean headers in devfreq Date: Fri, 10 Jul 2020 11:53:57 +0200 Message-Id: <20200710095409.407087-3-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710095409.407087-1-peron.clem@gmail.com> References: <20200710095409.407087-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 14 Jul 2020 07:02:08 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Don't include not required headers and sort them. Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 1b560b903ea6..df7b71da9a84 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -1,18 +1,14 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright 2019 Collabora ltd. */ + +#include #include #include #include #include -#include -#include #include "panfrost_device.h" #include "panfrost_devfreq.h" -#include "panfrost_features.h" -#include "panfrost_issues.h" -#include "panfrost_gpu.h" -#include "panfrost_regs.h" static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev) { From patchwork Fri Jul 10 09:53:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= X-Patchwork-Id: 11661573 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 A25F313B6 for ; Tue, 14 Jul 2020 07:02:24 +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 8036C221ED for ; Tue, 14 Jul 2020 07:02:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="m7n1kBQL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8036C221ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 9489F6E8E3; Tue, 14 Jul 2020 07:02:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6ED796EBC4 for ; Fri, 10 Jul 2020 09:54:17 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id z15so5284066wrl.8 for ; Fri, 10 Jul 2020 02:54:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5wIuyTvTvTJehZ+ep4u+btSK7FBgl8Se97pFISO/LVI=; b=m7n1kBQLnqX0x0Z7KrLWKLon0R/jEGObo3tJKl/M3JR8hO1NFX9rnFsRRlyfAAL8S8 oIoC/bpgVvUID7qcVpfqmSRRV7vmDDdxUXOvRk1H+06seBYGR9oWV2dHbJ9IgbBzuDpR RVQ50jVglHfhFUgO6+tLYVwru6EAE00YPLHGiPfoXMgHq7WvkFhywyPKZ1ORe6OD9hpx 2vtXnnxt4ulVkxs+SRpQMCwiebfSV4SxEolRJvg1pJrQO7FIHJDDZuXjU3sGX/doQnRr 6EuD6+r+zLFPvRsQd3TvDNyJPC9VR2bU3cQgUm29daIpKMfANgXSW1Qv4L5QZXhO5Ql6 nCcA== 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=5wIuyTvTvTJehZ+ep4u+btSK7FBgl8Se97pFISO/LVI=; b=dgl3rMrRJSqlLxdhx0auUEt+32N6T+v9HZMipDkAIwpUW6roniYOe3HTWukbFCr/pn 24RVjxo8NgHsqD4AP8AR5itPpIrKzoj2MCWNIhTyTgCFiatssJBTZl/qSa6ZAGGahaco CfjdsKgQi7eNAXvdqpYAOFJxLgWS3fJdQeMpHrov2mzFA0MEsWY94R05Cgp17LHEM1DA nl1wxk50hyI6FAWmR36IOMz4FHjVCoZFu4JeGLtvJJBbnJkxkyYz1r3QLWezTibcZoe8 89A4fmY7q44n2zlmGvylwukqnusN0GSUhJyL0FcZIeMIR2OOrwd83rZNav/YJt3zBDVE p/mg== X-Gm-Message-State: AOAM531oetoWKCwzmhTJ7u27ElQbKXrCqF/xqn/8C7k+EmJynt0lVws8 AdXzmdNAP86y3kVEAGyucRjtll21Uzw= X-Google-Smtp-Source: ABdhPJyLvYZYbHbkm5E8+fZ5ImyFxvJCgcZRFEN/DyaV7WIJ2KvUwkLKLlR8oyebgiUcvxC2Od5cVQ== X-Received: by 2002:a5d:5490:: with SMTP id h16mr71801657wrv.394.1594374855952; Fri, 10 Jul 2020 02:54:15 -0700 (PDT) Received: from clement-Latitude-7490.numericable.fr (213-245-241-245.rev.numericable.fr. [213.245.241.245]) by smtp.gmail.com with ESMTPSA id u23sm10176092wru.94.2020.07.10.02.54.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:54:15 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Viresh Kumar , Nishanth Menon , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v5 03/14] drm/panfrost: don't use pfdevfreq.busy_count to know if hw is idle Date: Fri, 10 Jul 2020 11:53:58 +0200 Message-Id: <20200710095409.407087-4-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710095409.407087-1-peron.clem@gmail.com> References: <20200710095409.407087-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 14 Jul 2020 07:02:08 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This use devfreq variable that will be lock with spinlock in future patches. We should either introduce a function to access this one but as devfreq is optional let's just remove it. Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_job.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c index 360146f6f3d9..4c13dbae68fb 100644 --- a/drivers/gpu/drm/panfrost/panfrost_job.c +++ b/drivers/gpu/drm/panfrost/panfrost_job.c @@ -581,10 +581,6 @@ int panfrost_job_is_idle(struct panfrost_device *pfdev) struct panfrost_job_slot *js = pfdev->js; int i; - /* Check whether the hardware is idle */ - if (atomic_read(&pfdev->devfreq.busy_count)) - return false; - for (i = 0; i < NUM_JOB_SLOTS; i++) { /* If there are any jobs in the HW queue, we're not idle */ if (atomic_read(&js->queue[i].sched.hw_rq_count)) From patchwork Fri Jul 10 09:53:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= X-Patchwork-Id: 11661793 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 5A2341510 for ; Tue, 14 Jul 2020 07:05:50 +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 388062223D for ; Tue, 14 Jul 2020 07:05:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ar+6oXf1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 388062223D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 0A6F86E91E; Tue, 14 Jul 2020 07:02:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id D13D86EBC4 for ; Fri, 10 Jul 2020 09:54:18 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id b6so5269076wrs.11 for ; Fri, 10 Jul 2020 02:54:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ngr1MbQwueeaYTa8ChmQkHurcGLT1b9uPlyxXFW7Hh0=; b=ar+6oXf1NJFY5JT8W98ohclx6/pDCt+gRezjT6ETcYjhV4DPRIM7tpzsstutovKE9z o7piD4jStasGaw7puQGWY6imNYFYunsAITxnZCaEZZoYrCwEbPoP6PUs6Sn9i7bBSm0U LXDkmRaL4ZWk3PGRn3DL250gIPfaa4KMhtEHADLRxHwxnho7OIDGAJ9OOchuragZnvko t2wuJDN1YIp14qR1LMI5XbQc6+DVfFP++zv8mtu7+1IaE+8Y7COyN9va8K8yy+p8VrL/ lHSDe6FhAPuokTrlSxrHjyffZs7a3JzFR+2xMmz0EOE+LfpCi/Ggm54PzPC/wmGbgt6u sBWg== 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=ngr1MbQwueeaYTa8ChmQkHurcGLT1b9uPlyxXFW7Hh0=; b=g7hdUHxx7ACWL3bqjIImiJ9VYjJw0j+gJuvr4OY2feYNYGhAZt8s19cZs6TcMpSnMm G8xbbwkyR76EnoGzh7GyM5aZOVGVAl3OAokdbbtUtaEdWbtvhhDh5/Qel5qAYd1p7WWX jywm/a5QH4+oyOe2Wy4TPfmc6dJA06i5jP4GQNkrAFxTCrfeAiDACxn+3DdzQPjBATR9 /tmSrXL1bEHrE3UmUu4URN3qksxMZ2uYC/hW7bZqmu9fDkaW2Kuj/yexhvd/kl5IN8+t x30752WSLbxxD1q//MIkF/2nFUohOzhzjDk4OHWItdCyNQYxtqqR3pZ9sBKk5lJXtI9K yLgg== X-Gm-Message-State: AOAM5324AazKxNe8VOImhztRJI1OKqkgDqlwJzpayVGVfY0+1Iz9BEgV xgLpFu8eDjrm8MxkDY5p0FRhGTk/s/k= X-Google-Smtp-Source: ABdhPJy2iM7V2EqKfX+qXJKDRKyJrNC+nGrYOlEvfELXQZDLHsFWEYt8mQpUwVVsDDnDshMgqP4lIg== X-Received: by 2002:adf:a4cf:: with SMTP id h15mr67233491wrb.229.1594374857276; Fri, 10 Jul 2020 02:54:17 -0700 (PDT) Received: from clement-Latitude-7490.numericable.fr (213-245-241-245.rev.numericable.fr. [213.245.241.245]) by smtp.gmail.com with ESMTPSA id u23sm10176092wru.94.2020.07.10.02.54.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:54:16 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Viresh Kumar , Nishanth Menon , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v5 04/14] drm/panfrost: introduce panfrost_devfreq struct Date: Fri, 10 Jul 2020 11:53:59 +0200 Message-Id: <20200710095409.407087-5-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710095409.407087-1-peron.clem@gmail.com> References: <20200710095409.407087-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 14 Jul 2020 07:02:08 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Introduce a proper panfrost_devfreq to deal with devfreq variables. Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 76 ++++++++++++--------- drivers/gpu/drm/panfrost/panfrost_devfreq.h | 20 +++++- drivers/gpu/drm/panfrost/panfrost_device.h | 11 +-- drivers/gpu/drm/panfrost/panfrost_job.c | 6 +- 4 files changed, 66 insertions(+), 47 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index df7b71da9a84..962550363391 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -10,23 +10,23 @@ #include "panfrost_device.h" #include "panfrost_devfreq.h" -static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev) +static void panfrost_devfreq_update_utilization(struct panfrost_devfreq *pfdevfreq) { ktime_t now; ktime_t last; - if (!pfdev->devfreq.devfreq) + if (!pfdevfreq->devfreq) return; now = ktime_get(); - last = pfdev->devfreq.time_last_update; + last = pfdevfreq->time_last_update; - if (atomic_read(&pfdev->devfreq.busy_count) > 0) - pfdev->devfreq.busy_time += ktime_sub(now, last); + if (atomic_read(&pfdevfreq->busy_count) > 0) + pfdevfreq->busy_time += ktime_sub(now, last); else - pfdev->devfreq.idle_time += ktime_sub(now, last); + pfdevfreq->idle_time += ktime_sub(now, last); - pfdev->devfreq.time_last_update = now; + pfdevfreq->time_last_update = now; } static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, @@ -47,30 +47,31 @@ static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, return 0; } -static void panfrost_devfreq_reset(struct panfrost_device *pfdev) +static void panfrost_devfreq_reset(struct panfrost_devfreq *pfdevfreq) { - pfdev->devfreq.busy_time = 0; - pfdev->devfreq.idle_time = 0; - pfdev->devfreq.time_last_update = ktime_get(); + pfdevfreq->busy_time = 0; + pfdevfreq->idle_time = 0; + pfdevfreq->time_last_update = ktime_get(); } static int panfrost_devfreq_get_dev_status(struct device *dev, struct devfreq_dev_status *status) { struct panfrost_device *pfdev = dev_get_drvdata(dev); + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; - panfrost_devfreq_update_utilization(pfdev); + panfrost_devfreq_update_utilization(pfdevfreq); status->current_frequency = clk_get_rate(pfdev->clock); - status->total_time = ktime_to_ns(ktime_add(pfdev->devfreq.busy_time, - pfdev->devfreq.idle_time)); + status->total_time = ktime_to_ns(ktime_add(pfdevfreq->busy_time, + pfdevfreq->idle_time)); - status->busy_time = ktime_to_ns(pfdev->devfreq.busy_time); + status->busy_time = ktime_to_ns(pfdevfreq->busy_time); - panfrost_devfreq_reset(pfdev); + panfrost_devfreq_reset(pfdevfreq); - dev_dbg(pfdev->dev, "busy %lu total %lu %lu %% freq %lu MHz\n", status->busy_time, - status->total_time, + dev_dbg(pfdev->dev, "busy %lu total %lu %lu %% freq %lu MHz\n", + status->busy_time, status->total_time, status->busy_time / (status->total_time / 100), status->current_frequency / 1000 / 1000); @@ -91,6 +92,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) struct device *dev = &pfdev->pdev->dev; struct devfreq *devfreq; struct thermal_cooling_device *cooling; + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; ret = dev_pm_opp_of_add_table(dev); if (ret == -ENODEV) /* Optional, continue without devfreq */ @@ -98,7 +100,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) else if (ret) return ret; - panfrost_devfreq_reset(pfdev); + panfrost_devfreq_reset(pfdevfreq); cur_freq = clk_get_rate(pfdev->clock); @@ -116,53 +118,59 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) dev_pm_opp_of_remove_table(dev); return PTR_ERR(devfreq); } - pfdev->devfreq.devfreq = devfreq; + pfdevfreq->devfreq = devfreq; cooling = of_devfreq_cooling_register(dev->of_node, devfreq); if (IS_ERR(cooling)) DRM_DEV_INFO(dev, "Failed to register cooling device\n"); else - pfdev->devfreq.cooling = cooling; + pfdevfreq->cooling = cooling; return 0; } void panfrost_devfreq_fini(struct panfrost_device *pfdev) { - if (pfdev->devfreq.cooling) - devfreq_cooling_unregister(pfdev->devfreq.cooling); + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + + if (pfdevfreq->cooling) + devfreq_cooling_unregister(pfdevfreq->cooling); dev_pm_opp_of_remove_table(&pfdev->pdev->dev); } void panfrost_devfreq_resume(struct panfrost_device *pfdev) { - if (!pfdev->devfreq.devfreq) + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + + if (!pfdevfreq->devfreq) return; - panfrost_devfreq_reset(pfdev); + panfrost_devfreq_reset(pfdevfreq); - devfreq_resume_device(pfdev->devfreq.devfreq); + devfreq_resume_device(pfdevfreq->devfreq); } void panfrost_devfreq_suspend(struct panfrost_device *pfdev) { - if (!pfdev->devfreq.devfreq) + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + + if (!pfdevfreq->devfreq) return; - devfreq_suspend_device(pfdev->devfreq.devfreq); + devfreq_suspend_device(pfdevfreq->devfreq); } -void panfrost_devfreq_record_busy(struct panfrost_device *pfdev) +void panfrost_devfreq_record_busy(struct panfrost_devfreq *pfdevfreq) { - panfrost_devfreq_update_utilization(pfdev); - atomic_inc(&pfdev->devfreq.busy_count); + panfrost_devfreq_update_utilization(pfdevfreq); + atomic_inc(&pfdevfreq->busy_count); } -void panfrost_devfreq_record_idle(struct panfrost_device *pfdev) +void panfrost_devfreq_record_idle(struct panfrost_devfreq *pfdevfreq) { int count; - panfrost_devfreq_update_utilization(pfdev); - count = atomic_dec_if_positive(&pfdev->devfreq.busy_count); + panfrost_devfreq_update_utilization(pfdevfreq); + count = atomic_dec_if_positive(&pfdevfreq->busy_count); WARN_ON(count < 0); } diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h index 0611beffc8d0..0697f8d5aa34 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h @@ -4,13 +4,29 @@ #ifndef __PANFROST_DEVFREQ_H__ #define __PANFROST_DEVFREQ_H__ +#include + +struct devfreq; +struct thermal_cooling_device; + +struct panfrost_device; + +struct panfrost_devfreq { + struct devfreq *devfreq; + struct thermal_cooling_device *cooling; + ktime_t busy_time; + ktime_t idle_time; + ktime_t time_last_update; + atomic_t busy_count; +}; + int panfrost_devfreq_init(struct panfrost_device *pfdev); void panfrost_devfreq_fini(struct panfrost_device *pfdev); void panfrost_devfreq_resume(struct panfrost_device *pfdev); void panfrost_devfreq_suspend(struct panfrost_device *pfdev); -void panfrost_devfreq_record_busy(struct panfrost_device *pfdev); -void panfrost_devfreq_record_idle(struct panfrost_device *pfdev); +void panfrost_devfreq_record_busy(struct panfrost_devfreq *devfreq); +void panfrost_devfreq_record_idle(struct panfrost_devfreq *devfreq); #endif /* __PANFROST_DEVFREQ_H__ */ diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h index c30c719a8059..2efa59c9d1c5 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.h +++ b/drivers/gpu/drm/panfrost/panfrost_device.h @@ -13,6 +13,8 @@ #include #include +#include "panfrost_devfreq.h" + struct panfrost_device; struct panfrost_mmu; struct panfrost_job_slot; @@ -107,14 +109,7 @@ struct panfrost_device { struct list_head shrinker_list; struct shrinker shrinker; - struct { - struct devfreq *devfreq; - struct thermal_cooling_device *cooling; - ktime_t busy_time; - ktime_t idle_time; - ktime_t time_last_update; - atomic_t busy_count; - } devfreq; + struct panfrost_devfreq pfdevfreq; }; struct panfrost_mmu { diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c index 4c13dbae68fb..30e7b7196dab 100644 --- a/drivers/gpu/drm/panfrost/panfrost_job.c +++ b/drivers/gpu/drm/panfrost/panfrost_job.c @@ -145,7 +145,7 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) u64 jc_head = job->jc; int ret; - panfrost_devfreq_record_busy(pfdev); + panfrost_devfreq_record_busy(&pfdev->pfdevfreq); ret = pm_runtime_get_sync(pfdev->dev); if (ret < 0) @@ -410,7 +410,7 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job) for (i = 0; i < NUM_JOB_SLOTS; i++) { if (pfdev->jobs[i]) { pm_runtime_put_noidle(pfdev->dev); - panfrost_devfreq_record_idle(pfdev); + panfrost_devfreq_record_idle(&pfdev->pfdevfreq); pfdev->jobs[i] = NULL; } } @@ -478,7 +478,7 @@ static irqreturn_t panfrost_job_irq_handler(int irq, void *data) pfdev->jobs[j] = NULL; panfrost_mmu_as_put(pfdev, &job->file_priv->mmu); - panfrost_devfreq_record_idle(pfdev); + panfrost_devfreq_record_idle(&pfdev->pfdevfreq); dma_fence_signal_locked(job->done_fence); pm_runtime_put_autosuspend(pfdev->dev); From patchwork Fri Jul 10 09:54:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= X-Patchwork-Id: 11661703 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 1D5BC913 for ; Tue, 14 Jul 2020 07:04:30 +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 EF3C822205 for ; Tue, 14 Jul 2020 07:04:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g2Sw/HtR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EF3C822205 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 5268D6E90D; Tue, 14 Jul 2020 07:02:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 12E9D6EBC5 for ; Fri, 10 Jul 2020 09:54:20 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id k6so5306932wrn.3 for ; Fri, 10 Jul 2020 02:54:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ztEfvDOenwmzhW91KrXpwCBICtYWbElja0rQb72V3Pc=; b=g2Sw/HtRWWNJ5encQ3nPzyJELqRZMCj5wm71m7O+SPkz1nmaO46NZsXat+Z8/XgW/L igZoeYAytqCjnVdz96EzvYEsJ7IsKnmxHZrqTYW2wQv+XEylqdz5q5jGeJpZ7hrNYYTF in5i4GW03rPLwBd80LItpC6LwoR3/Ta+osSktb5bjR2B+rKz15l+GkmrLZjtoL76QWWZ issqIjbbSocExDwwcamif8oOvMpYu+VhDW1ur+D0QUpXdEXnDAxATZHqB9ApguNsnVAq ieYgqcl0SZPKv9vlR+xVgokJAi5QJzwucw7NIXJ8i21XTB8YayKstmwxIqUH3JAjxdF1 kBMQ== 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=ztEfvDOenwmzhW91KrXpwCBICtYWbElja0rQb72V3Pc=; b=cc/clfMlJmdPFRwLQBiIWnEFUz5ArrkwPyocWEd4EIVFV3HNqJO09dtNeUvHzc/pK3 hqTLpLtHhMTG77MVoxYFofMseF7m89Su8IaqwxB5qndNp1NyddRcd00bK2GW3WKCIDJO NCXtngE68f8be0tJlWbQi6DFJ5BrFIXbcVqf7mlfDHdHkWATkJZO3SjDcVg5lBYnkPsb wf8ayTEKl2d+CsZDKzoLZqneYemo+rHFLXvMQPH11pJ8/QDqYKRnmNeqOeodbW62NrN9 S6aZpiZvC8+VpDxDLsNpWqvEsMnzYc0KnPUZavoM5z74QHjKRTrFizHmncOr7XY7Obix pc7w== X-Gm-Message-State: AOAM533C1WirNFOGYGdfc2jS6DU7duwbA9IbmZSe5//hiABKBrhg/l// i5jE86K+953QJw7uhS+OpIw= X-Google-Smtp-Source: ABdhPJwzCuVZOhYt/qbcLHI1t2KZzcXMm7lxjQOjcyDF+zp22T7tp6c5A+pU+XH8wU1rId7MRkLtcw== X-Received: by 2002:adf:f60c:: with SMTP id t12mr72601276wrp.198.1594374858621; Fri, 10 Jul 2020 02:54:18 -0700 (PDT) Received: from clement-Latitude-7490.numericable.fr (213-245-241-245.rev.numericable.fr. [213.245.241.245]) by smtp.gmail.com with ESMTPSA id u23sm10176092wru.94.2020.07.10.02.54.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:54:17 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Viresh Kumar , Nishanth Menon , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v5 05/14] drm/panfrost: use spinlock instead of atomic Date: Fri, 10 Jul 2020 11:54:00 +0200 Message-Id: <20200710095409.407087-6-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710095409.407087-1-peron.clem@gmail.com> References: <20200710095409.407087-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 14 Jul 2020 07:02:08 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Convert busy_count to a simple int protected by spinlock. Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 43 +++++++++++++++------ drivers/gpu/drm/panfrost/panfrost_devfreq.h | 9 ++++- 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 962550363391..78753cfb59fb 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -12,16 +12,12 @@ static void panfrost_devfreq_update_utilization(struct panfrost_devfreq *pfdevfreq) { - ktime_t now; - ktime_t last; - - if (!pfdevfreq->devfreq) - return; + ktime_t now, last; now = ktime_get(); last = pfdevfreq->time_last_update; - if (atomic_read(&pfdevfreq->busy_count) > 0) + if (pfdevfreq->busy_count > 0) pfdevfreq->busy_time += ktime_sub(now, last); else pfdevfreq->idle_time += ktime_sub(now, last); @@ -59,10 +55,14 @@ static int panfrost_devfreq_get_dev_status(struct device *dev, { struct panfrost_device *pfdev = dev_get_drvdata(dev); struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + unsigned long irqflags; + + status->current_frequency = clk_get_rate(pfdev->clock); + + spin_lock_irqsave(&pfdevfreq->lock, irqflags); panfrost_devfreq_update_utilization(pfdevfreq); - status->current_frequency = clk_get_rate(pfdev->clock); status->total_time = ktime_to_ns(ktime_add(pfdevfreq->busy_time, pfdevfreq->idle_time)); @@ -70,6 +70,8 @@ static int panfrost_devfreq_get_dev_status(struct device *dev, panfrost_devfreq_reset(pfdevfreq); + spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); + dev_dbg(pfdev->dev, "busy %lu total %lu %lu %% freq %lu MHz\n", status->busy_time, status->total_time, status->busy_time / (status->total_time / 100), @@ -100,6 +102,8 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) else if (ret) return ret; + spin_lock_init(&pfdevfreq->lock); + panfrost_devfreq_reset(pfdevfreq); cur_freq = clk_get_rate(pfdev->clock); @@ -162,15 +166,32 @@ void panfrost_devfreq_suspend(struct panfrost_device *pfdev) void panfrost_devfreq_record_busy(struct panfrost_devfreq *pfdevfreq) { + unsigned long irqflags; + + if (!pfdevfreq->devfreq) + return; + + spin_lock_irqsave(&pfdevfreq->lock, irqflags); + panfrost_devfreq_update_utilization(pfdevfreq); - atomic_inc(&pfdevfreq->busy_count); + + pfdevfreq->busy_count++; + + spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); } void panfrost_devfreq_record_idle(struct panfrost_devfreq *pfdevfreq) { - int count; + unsigned long irqflags; + + if (!pfdevfreq->devfreq) + return; + + spin_lock_irqsave(&pfdevfreq->lock, irqflags); panfrost_devfreq_update_utilization(pfdevfreq); - count = atomic_dec_if_positive(&pfdevfreq->busy_count); - WARN_ON(count < 0); + + WARN_ON(--pfdevfreq->busy_count < 0); + + spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); } diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h index 0697f8d5aa34..3392df1020be 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h @@ -4,6 +4,7 @@ #ifndef __PANFROST_DEVFREQ_H__ #define __PANFROST_DEVFREQ_H__ +#include #include struct devfreq; @@ -14,10 +15,16 @@ struct panfrost_device; struct panfrost_devfreq { struct devfreq *devfreq; struct thermal_cooling_device *cooling; + ktime_t busy_time; ktime_t idle_time; ktime_t time_last_update; - atomic_t busy_count; + int busy_count; + /* + * Protect busy_time, idle_time, time_last_update and busy_count + * because these can be updated concurrently between multiple jobs. + */ + spinlock_t lock; }; int panfrost_devfreq_init(struct panfrost_device *pfdev); From patchwork Fri Jul 10 09:54:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= X-Patchwork-Id: 11661717 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 4AAE6913 for ; Tue, 14 Jul 2020 07:04:39 +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 28C93221ED for ; Tue, 14 Jul 2020 07:04:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Im6Suh16" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28C93221ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 879736E91B; Tue, 14 Jul 2020 07:02:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4232C6EBC9 for ; Fri, 10 Jul 2020 09:54:21 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id s10so5251127wrw.12 for ; Fri, 10 Jul 2020 02:54:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eRj3Oh7sZBJWwDgWc3ORgJ0pvlwZ3+3t0oGyKYtF1AQ=; b=Im6Suh16bQ2MS5TJOMucwbdu6U9wvq+xgLNrYoFfcoVq7/iXihIQK7xz4OeMTq1yEY Y2Jb6qiShiKgEAWVnvQgJD+r9GD3GuEfmdsRN5eyiIFn4rxVwzm7v9B6Aps1QW9j/7pq DPBnt/27mcdEV52w9SSO8Q7XP3DHtBGnPZdM7pmSLH8ZDO3JEmmzWgrzP9GDz3ycTC3D sI8QB4WRB1gzyHyoEMfUJUUyIcZzatie/O8ak0g4s3Y5wGqilVtTtzMqAsj6Tr3r17x1 K7CkhhKxRtR3nz0d5i/MYwETl9BYISlXQ5PN7Y3PMi57F/XWFcmChjLkei1G76qZI03Q J+5Q== 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=eRj3Oh7sZBJWwDgWc3ORgJ0pvlwZ3+3t0oGyKYtF1AQ=; b=ZR50dRr9HiPEIXdcRNSr99Cc5EFAaZ+uoVtR2+o2bESysroJZTpSapmX3mo15rynBj f/SCWnNYtwKxJky4ikLZ2Zlo1oUOx9pM/DK/zlUCF8fbebQCFmhSUIg+NG3San2QJG+D jn70lmKQ7o1zRVhgTtV7X0YCGn8A1K0LqbiI1Zc4UiYKZChTx2KRuI2sO2M+ZOG1ntfr NTFhdG846tl0AvUWVcvyx5ysv+FiYGdbyRA5toGKfb1qqMwL+V2gIvxscL4Dmre6KAYV bhXNsxpVfKrAU9kmsT9qDFZ7ng2+7xybOS2X2G2hXxHfD6P659VNQEUeUCR8FX5t6305 EikA== X-Gm-Message-State: AOAM533yGbIfPReTnCHtzFAR63BoCAdrSRppRlShbUws1DZvxtu+EzKG NtLPpoD4TNmxsP673dFK8nI= X-Google-Smtp-Source: ABdhPJyXzvFI7d7NTJ+w+ZGJgkN9gq9YherfY1UqQYjqPDfYCF7nqh1nM4JnluRsCLaSSoXy3/Jd5w== X-Received: by 2002:a5d:6ac1:: with SMTP id u1mr65723403wrw.123.1594374859817; Fri, 10 Jul 2020 02:54:19 -0700 (PDT) Received: from clement-Latitude-7490.numericable.fr (213-245-241-245.rev.numericable.fr. [213.245.241.245]) by smtp.gmail.com with ESMTPSA id u23sm10176092wru.94.2020.07.10.02.54.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:54:19 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Viresh Kumar , Nishanth Menon , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v5 06/14] drm/panfrost: properly handle error in probe Date: Fri, 10 Jul 2020 11:54:01 +0200 Message-Id: <20200710095409.407087-7-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710095409.407087-1-peron.clem@gmail.com> References: <20200710095409.407087-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 14 Jul 2020 07:02:08 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Introduce a boolean to know if opp table has been added. With this, we can call panfrost_devfreq_fini() in case of error and release what has been initialised. Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 25 ++++++++++++++++----- drivers/gpu/drm/panfrost/panfrost_devfreq.h | 1 + 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 78753cfb59fb..d9007f44b772 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -101,6 +101,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) return 0; else if (ret) return ret; + pfdevfreq->opp_of_table_added = true; spin_lock_init(&pfdevfreq->lock); @@ -109,8 +110,10 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) cur_freq = clk_get_rate(pfdev->clock); opp = devfreq_recommended_opp(dev, &cur_freq, 0); - if (IS_ERR(opp)) - return PTR_ERR(opp); + if (IS_ERR(opp)) { + ret = PTR_ERR(opp); + goto err_fini; + } panfrost_devfreq_profile.initial_freq = cur_freq; dev_pm_opp_put(opp); @@ -119,8 +122,8 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) DEVFREQ_GOV_SIMPLE_ONDEMAND, NULL); if (IS_ERR(devfreq)) { DRM_DEV_ERROR(dev, "Couldn't initialize GPU devfreq\n"); - dev_pm_opp_of_remove_table(dev); - return PTR_ERR(devfreq); + ret = PTR_ERR(devfreq); + goto err_fini; } pfdevfreq->devfreq = devfreq; @@ -131,15 +134,25 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) pfdevfreq->cooling = cooling; return 0; + +err_fini: + panfrost_devfreq_fini(pfdev); + return ret; } void panfrost_devfreq_fini(struct panfrost_device *pfdev) { struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; - if (pfdevfreq->cooling) + if (pfdevfreq->cooling) { devfreq_cooling_unregister(pfdevfreq->cooling); - dev_pm_opp_of_remove_table(&pfdev->pdev->dev); + pfdevfreq->cooling = NULL; + } + + if (pfdevfreq->opp_of_table_added) { + dev_pm_opp_of_remove_table(&pfdev->pdev->dev); + pfdevfreq->opp_of_table_added = false; + } } void panfrost_devfreq_resume(struct panfrost_device *pfdev) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h index 3392df1020be..210269944687 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h @@ -15,6 +15,7 @@ struct panfrost_device; struct panfrost_devfreq { struct devfreq *devfreq; struct thermal_cooling_device *cooling; + bool opp_of_table_added; ktime_t busy_time; ktime_t idle_time; From patchwork Fri Jul 10 09:54:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= X-Patchwork-Id: 11661599 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 7CE1313B6 for ; Tue, 14 Jul 2020 07:03:02 +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 5B088221F2 for ; Tue, 14 Jul 2020 07:03:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dJnJPqdZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5B088221F2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 A037A6E8EA; Tue, 14 Jul 2020 07:02:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 594836EBC9 for ; Fri, 10 Jul 2020 09:54:22 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id z15so5284333wrl.8 for ; Fri, 10 Jul 2020 02:54:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xXA70POHCV2GWsHX4CvRyqRrbTFQBlpDYTBkU8Vpd/0=; b=dJnJPqdZjOa/bpCkQx4pDHa7OyMgG38PvRdxaKjwpbA1DGpoKxrwXgAjwYoRqid1yP 03QmhQQu6TJVUj1mjhjyc7b4dBIANAt2Vt7si9SXIg+2JyNgaysXPcKt7DSucR5iX4PN 6nxEQLafz2nkkDgJGEd3cP6q7TAfzmpf0GV+wtbk8UuRrTKHzg4NJtoZiz8R/eRFiKTQ yn7vwVsQaQ7+7CQeyPk/nlqHJLSxDas7WFVvZoao2ayTL3C7huFnzBmc49yXSCugyMBF r9LE3JNRR3z6RkZW4hKxzSG6eodFXDbiQv59/z+Yd/WX4sXz8NA3bhE4BaEVsBLz7nOh JUfw== 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=xXA70POHCV2GWsHX4CvRyqRrbTFQBlpDYTBkU8Vpd/0=; b=KGRKQknlpOtXlkWqAjDplANWxMV3wa7Sl1esmcfg6tpF93yvWM1XhGzEtw+4BjWI/e V0MRvTMbv8wdUggkRq8EyvCX0nb3xBWc9VvoCpLfL3idNVL/Gzvm0J2AVO9RGvhvBygL rb7tYHyM0lHhS040LUYb2GlIKJNTIgTegoS0+nzat2XcGJWiWOKeusCu/Wi0YTmTTUeY oapLDwsbXfOcEFfiksqx2DxQ2y9UzmP6EdSToE2A9MhyOnAbLBKqHGjQPFWuq4+uOCAK DXLlDh74iMBfN4bjGucNkRv+UCiABocpIqSUh28mAmIPElx3MP87eunZnwTpT+lZBMW2 sj7A== X-Gm-Message-State: AOAM530zLoSIJGMQxsHC3AfMgHaBikGES8rVkC+tgSxFgLR9IVkRoXA2 OR1rlDvItyj9OUUBbl7YqKs= X-Google-Smtp-Source: ABdhPJyxMtH1m8JCcPY59Kapmk4/ptiy3b6zjq6ct3rJ+VI1rdg7CGIPVONJ6HVDnNbOYJSFMUKB5w== X-Received: by 2002:adf:f34f:: with SMTP id e15mr68195427wrp.415.1594374860909; Fri, 10 Jul 2020 02:54:20 -0700 (PDT) Received: from clement-Latitude-7490.numericable.fr (213-245-241-245.rev.numericable.fr. [213.245.241.245]) by smtp.gmail.com with ESMTPSA id u23sm10176092wru.94.2020.07.10.02.54.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:54:20 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Viresh Kumar , Nishanth Menon , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v5 07/14] drm/panfrost: rename error labels in device_init Date: Fri, 10 Jul 2020 11:54:02 +0200 Message-Id: <20200710095409.407087-8-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710095409.407087-1-peron.clem@gmail.com> References: <20200710095409.407087-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 14 Jul 2020 07:02:08 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Rename goto labels in device_init it will be easier to maintain. Reviewed-by: Alyssa Rosenzweig Reviewed-by: Steven Price Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_device.c | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c index b172087eee6a..9f89984f652a 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.c +++ b/drivers/gpu/drm/panfrost/panfrost_device.c @@ -216,56 +216,56 @@ int panfrost_device_init(struct panfrost_device *pfdev) err = panfrost_regulator_init(pfdev); if (err) - goto err_out0; + goto out_clk; err = panfrost_reset_init(pfdev); if (err) { dev_err(pfdev->dev, "reset init failed %d\n", err); - goto err_out1; + goto out_regulator; } err = panfrost_pm_domain_init(pfdev); if (err) - goto err_out2; + goto out_reset; res = platform_get_resource(pfdev->pdev, IORESOURCE_MEM, 0); pfdev->iomem = devm_ioremap_resource(pfdev->dev, res); if (IS_ERR(pfdev->iomem)) { dev_err(pfdev->dev, "failed to ioremap iomem\n"); err = PTR_ERR(pfdev->iomem); - goto err_out3; + goto out_pm_domain; } err = panfrost_gpu_init(pfdev); if (err) - goto err_out3; + goto out_pm_domain; err = panfrost_mmu_init(pfdev); if (err) - goto err_out4; + goto out_gpu; err = panfrost_job_init(pfdev); if (err) - goto err_out5; + goto out_mmu; err = panfrost_perfcnt_init(pfdev); if (err) - goto err_out6; + goto out_job; return 0; -err_out6: +out_job: panfrost_job_fini(pfdev); -err_out5: +out_mmu: panfrost_mmu_fini(pfdev); -err_out4: +out_gpu: panfrost_gpu_fini(pfdev); -err_out3: +out_pm_domain: panfrost_pm_domain_fini(pfdev); -err_out2: +out_reset: panfrost_reset_fini(pfdev); -err_out1: +out_regulator: panfrost_regulator_fini(pfdev); -err_out0: +out_clk: panfrost_clk_fini(pfdev); return err; } From patchwork Fri Jul 10 09:54:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= X-Patchwork-Id: 11661581 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 81191913 for ; Tue, 14 Jul 2020 07:02:38 +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 5DCBD221ED for ; Tue, 14 Jul 2020 07:02:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d+kb02Ps" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5DCBD221ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 970A86E8E2; Tue, 14 Jul 2020 07:02:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 93EF06EBCB for ; Fri, 10 Jul 2020 09:54:23 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id f18so5319663wrs.0 for ; Fri, 10 Jul 2020 02:54:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=auC0/ER2X305Zg2uDQUhIlsyo4FCeU1u6x9Bb8O7OFY=; b=d+kb02PsRK1wEqOMLgu8attRnWWaL626kc+prWU5IhFYrQ/TJQvGleGCsUD9cLkMgx fyjUvJ541cdmfvAJoLBpQpkqlZtye9AGub+0mlLLxbHUq2dpaw0KOvn8sGUsUk6XH1zo ibZDWKJWV84vg3cMGtmve5OTerQsspf6xk8dVcKYaiqXrKs8GfAPQx0VzZAWsAr0Qfu/ xUI+0poBiO8anix0nuf0dbKwxB6OpQcEVjas/MlKObpFBEzbSuHJgSnmO0zyPnAZVghI mBsP4rBS6g+PUO3+LrCMwL8Iw4L2CfS33/gXQ2SBA/X7g2Su1OKTDK/oSbh/rSc0X0Qh /7rg== 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=auC0/ER2X305Zg2uDQUhIlsyo4FCeU1u6x9Bb8O7OFY=; b=mJzKKGyoaILSS6aSViLRgrJ19W+t7ZjOFm2Dvk0Hfw4RFJCqTyQsmE9r88VR7l+uHn X7yU1x2JZfF+IiCeX0SPCN/pNDBB8pd2fXPKA1tPLaeft/QTWhLJbzw7EJiMSvPUQjyN ntnCyt4YVtVxpUOAfoIopoUFqkb5oEWF+UtzAk1pLoid2tHwQCD3QXtDQ1es0sLdPFh3 WpT9jyJmiWSz0pGE5diHeJZuWNismfZJHWd3drdzH/ljylKfzl6Wlurq318r2Rq9xexg ZnG6MVefALv8ZrsOxpsraEjiX4MJu9bSM0ulwAC/1X2GoOqnK9mIMIdn2Yi515icaSNR 5Zkg== X-Gm-Message-State: AOAM532qQU3cH1iDyc7WJMIG+jW8PXEz3uoH5bGWowLR8pUvEg3MkcJu DptWipWmPH4Ih1udXd23J3A= X-Google-Smtp-Source: ABdhPJw+EuxYSIsmpRLmuSRr3Lj4oqNHvTDxWHVCBqx8/LiOwYZntGd4inCKn+UupXPZvgs2nWPjvg== X-Received: by 2002:a5d:4fce:: with SMTP id h14mr66786532wrw.199.1594374862113; Fri, 10 Jul 2020 02:54:22 -0700 (PDT) Received: from clement-Latitude-7490.numericable.fr (213-245-241-245.rev.numericable.fr. [213.245.241.245]) by smtp.gmail.com with ESMTPSA id u23sm10176092wru.94.2020.07.10.02.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:54:21 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Viresh Kumar , Nishanth Menon , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v5 08/14] drm/panfrost: move devfreq_init()/fini() in device Date: Fri, 10 Jul 2020 11:54:03 +0200 Message-Id: <20200710095409.407087-9-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710095409.407087-1-peron.clem@gmail.com> References: <20200710095409.407087-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 14 Jul 2020 07:02:08 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Later we will introduce devfreq probing regulator if they are present. As regulator should be probe only one time we need to get this logic in the device_init(). panfrost_device is already taking care of devfreq_resume() and devfreq_suspend(), so it's not totally illogic to move the devfreq_init() and devfreq_fini() here. Reviewed-by: Alyssa Rosenzweig Reviewed-by: Steven Price Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_device.c | 12 +++++++++++- drivers/gpu/drm/panfrost/panfrost_drv.c | 15 ++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c index 9f89984f652a..36b5c8fea3eb 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.c +++ b/drivers/gpu/drm/panfrost/panfrost_device.c @@ -214,9 +214,16 @@ int panfrost_device_init(struct panfrost_device *pfdev) return err; } + err = panfrost_devfreq_init(pfdev); + if (err) { + if (err != -EPROBE_DEFER) + dev_err(pfdev->dev, "devfreq init failed %d\n", err); + goto out_clk; + } + err = panfrost_regulator_init(pfdev); if (err) - goto out_clk; + goto out_devfreq; err = panfrost_reset_init(pfdev); if (err) { @@ -265,6 +272,8 @@ int panfrost_device_init(struct panfrost_device *pfdev) panfrost_reset_fini(pfdev); out_regulator: panfrost_regulator_fini(pfdev); +out_devfreq: + panfrost_devfreq_fini(pfdev); out_clk: panfrost_clk_fini(pfdev); return err; @@ -278,6 +287,7 @@ void panfrost_device_fini(struct panfrost_device *pfdev) panfrost_gpu_fini(pfdev); panfrost_pm_domain_fini(pfdev); panfrost_reset_fini(pfdev); + panfrost_devfreq_fini(pfdev); panfrost_regulator_fini(pfdev); panfrost_clk_fini(pfdev); } diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c index ada51df9a7a3..170d6dbab217 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -14,7 +14,6 @@ #include #include "panfrost_device.h" -#include "panfrost_devfreq.h" #include "panfrost_gem.h" #include "panfrost_mmu.h" #include "panfrost_job.h" @@ -606,13 +605,6 @@ static int panfrost_probe(struct platform_device *pdev) goto err_out0; } - err = panfrost_devfreq_init(pfdev); - if (err) { - if (err != -EPROBE_DEFER) - dev_err(&pdev->dev, "Fatal error during devfreq init\n"); - goto err_out1; - } - pm_runtime_set_active(pfdev->dev); pm_runtime_mark_last_busy(pfdev->dev); pm_runtime_enable(pfdev->dev); @@ -625,16 +617,14 @@ static int panfrost_probe(struct platform_device *pdev) */ err = drm_dev_register(ddev, 0); if (err < 0) - goto err_out2; + goto err_out1; panfrost_gem_shrinker_init(ddev); return 0; -err_out2: - pm_runtime_disable(pfdev->dev); - panfrost_devfreq_fini(pfdev); err_out1: + pm_runtime_disable(pfdev->dev); panfrost_device_fini(pfdev); err_out0: drm_dev_put(ddev); @@ -650,7 +640,6 @@ static int panfrost_remove(struct platform_device *pdev) panfrost_gem_shrinker_cleanup(ddev); pm_runtime_get_sync(pfdev->dev); - panfrost_devfreq_fini(pfdev); panfrost_device_fini(pfdev); pm_runtime_put_sync_suspend(pfdev->dev); pm_runtime_disable(pfdev->dev); From patchwork Fri Jul 10 09:54:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= X-Patchwork-Id: 11661641 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 6DF8314DD for ; Tue, 14 Jul 2020 07:04:02 +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 4C56F221ED for ; Tue, 14 Jul 2020 07:04:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ScK5azBr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C56F221ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 5E8E66E912; Tue, 14 Jul 2020 07:02:48 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id B37B16EBCB for ; Fri, 10 Jul 2020 09:54:24 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id l17so5489235wmj.0 for ; Fri, 10 Jul 2020 02:54:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3tTFXJtD9L8qTfEaoTtaeOWc2S10eVfC890weGUL+Pw=; b=ScK5azBryMJ/fZmLR11Ditdr3WuUpS8LnBIs1+loUpjd5Fp9a/AflpCcoDzqAdhyLc jDSb2ZZDzxg6ujyKzlXJg+Nun8NHC1IJX5+Fox8khn49MLqzxluyMPQjQCbeMkVCqylv fMyYrGXofvNowV1XY8bmh94B68mIme3dV1dADOTc2V0blDNehTetaLlhtVg/Lz48YAPl sDyOtlJ5Xr0Ti4ZMmt47dOISytUbGVjnn2XXS8xvsEA7mMJPnEI8i9WPbt5yRYBnBW4J Gz9wAkNndLUUvci/aTJ9FSsaTtoMfbz34pVpDrnahoz+dAT+YDNrYpCZ02rXQ5ty/qXj l69g== 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=3tTFXJtD9L8qTfEaoTtaeOWc2S10eVfC890weGUL+Pw=; b=mhfKaVYlmm8jRlz1WoH4idXI+NKg40vHMLJwiEua6k8sR4mdTjG3bx1fU3xsB9e9Ve Z9snlHcR4B5jY0fxPI0h9bydMe2TRngtEa7BuqFqLAafWTzZScUyJDCsgoeWBralM5bd U1W0irM0fwHvzpeN4J4OhqZXH/nNjWWbNo0kuxcBzxIaa/ezKSKVxDfcZiJmd4tCX9DQ yW8CAserFCIxEmy5AZtsYoSaOSg/CkGP8FTUVhPwvZfGrTHIx4bKarzbI0ohVDyYj1xk FeW9HgvaTL8LelQvPwpd45iZGO5xw/rm/XjEhGcqtSHp6U8dXsER2gOi1FmcJqUgcKic pYoA== X-Gm-Message-State: AOAM532KZgO5vYBATedw6LuJDTe8hqdVAcqO/V8W1UFAdnP3R751UO4N w2bzqLoGRLT8W5u/fQEJTtU= X-Google-Smtp-Source: ABdhPJykRhDx9PTf1S9u8YjJU2g+0xvNNgPIYzZDNU1sWHxXWU0rZO3DfzeKhjOLlLhCNzywJJe2tQ== X-Received: by 2002:a1c:4804:: with SMTP id v4mr4347015wma.139.1594374863260; Fri, 10 Jul 2020 02:54:23 -0700 (PDT) Received: from clement-Latitude-7490.numericable.fr (213-245-241-245.rev.numericable.fr. [213.245.241.245]) by smtp.gmail.com with ESMTPSA id u23sm10176092wru.94.2020.07.10.02.54.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:54:22 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Viresh Kumar , Nishanth Menon , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v5 09/14] drm/panfrost: dynamically alloc regulators Date: Fri, 10 Jul 2020 11:54:04 +0200 Message-Id: <20200710095409.407087-10-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710095409.407087-1-peron.clem@gmail.com> References: <20200710095409.407087-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 14 Jul 2020 07:02:08 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We will later introduce regulators managed by OPP. Only alloc regulators when it's needed. This also help use to release the regulators only when they are allocated. Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_device.c | 14 +++++++++----- drivers/gpu/drm/panfrost/panfrost_device.h | 3 +-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c index 36b5c8fea3eb..f1474b961def 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.c +++ b/drivers/gpu/drm/panfrost/panfrost_device.c @@ -90,9 +90,11 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev) { int ret, i; - if (WARN(pfdev->comp->num_supplies > ARRAY_SIZE(pfdev->regulators), - "Too many supplies in compatible structure.\n")) - return -EINVAL; + pfdev->regulators = devm_kcalloc(pfdev->dev, pfdev->comp->num_supplies, + sizeof(*pfdev->regulators), + GFP_KERNEL); + if (!pfdev->regulators) + return -ENOMEM; for (i = 0; i < pfdev->comp->num_supplies; i++) pfdev->regulators[i].supply = pfdev->comp->supply_names[i]; @@ -119,8 +121,10 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev) static void panfrost_regulator_fini(struct panfrost_device *pfdev) { - regulator_bulk_disable(pfdev->comp->num_supplies, - pfdev->regulators); + if (!pfdev->regulators) + return; + + regulator_bulk_disable(pfdev->comp->num_supplies, pfdev->regulators); } static void panfrost_pm_domain_fini(struct panfrost_device *pfdev) diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h index 2efa59c9d1c5..953f7536a773 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.h +++ b/drivers/gpu/drm/panfrost/panfrost_device.h @@ -22,7 +22,6 @@ struct panfrost_job; struct panfrost_perfcnt; #define NUM_JOB_SLOTS 3 -#define MAX_REGULATORS 2 #define MAX_PM_DOMAINS 3 struct panfrost_features { @@ -81,7 +80,7 @@ struct panfrost_device { void __iomem *iomem; struct clk *clock; struct clk *bus_clock; - struct regulator_bulk_data regulators[MAX_REGULATORS]; + struct regulator_bulk_data *regulators; struct reset_control *rstc; /* pm_domains for devices with more than one. */ struct device *pm_domain_devs[MAX_PM_DOMAINS]; From patchwork Fri Jul 10 09:54:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= X-Patchwork-Id: 11661637 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 F19DA13B6 for ; Tue, 14 Jul 2020 07:03:57 +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 CFC9F221ED for ; Tue, 14 Jul 2020 07:03:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g1hRnstX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CFC9F221ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 43AAE6E928; Tue, 14 Jul 2020 07:02:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id DD7BB6EBBD for ; Fri, 10 Jul 2020 09:54:25 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id r12so5255467wrj.13 for ; Fri, 10 Jul 2020 02:54:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VsZBAmiYMMWM033wa5CbybhLIp9AyDubE3t8XcgJYF0=; b=g1hRnstX0KAA0TEe9/LBKmiZM8SnwW3Ceq5pVmpcs25HNQO/3ej99pCNvyqYt9j5W5 BnHtTUV4a1UfYIyJsWlI1RLY8+VpUPLjtPl2uW6kJkIvtDHbhX9we55hF2s/L/Z4HXni cQO7MKG5cElwT9GZwHwXfN/Nb8J5wAxPUQETl+cch+0S21SCwPdhap5mlUIVsxtYy7Kd ElmKMGeF8ksXT6wqm8XYeFdDcmY0dCIddPbp1c8KGYL7Jn8nSHIFC4X6DVY9u4cL1Hdg vuPlOE5x+8bb+GbiZMd+KCj3AWPIB+uLaVucHL2BtlDErsyejLy+WJwI8sbM6TvYv32p Hm/Q== 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=VsZBAmiYMMWM033wa5CbybhLIp9AyDubE3t8XcgJYF0=; b=QqJ681NwfxwOgByHYg7AoBW3xakxaiZtzgCY2qaoY2RRoWLhW6MYn59cXVVa++4lkd F4hU9Fob3808MbbDJlOOLwVIuyQZbnyD+rLma7gVe3SLBIl4EvHrs5OBNFhvFI5z26S/ YZ6C7S2InneDJ7WlAJVBPOS7UqofJ20Sr5RPh//bZyc3umoqovau5LM7onG7xVvsKD9F WoflW9UBcxWE4RsEhO9B5Fv1YW57TzY3Ocll4HkJAMtqj25C7LD3KYRpLJ+nzx1v5ht6 jTEHFqd7GfCNMKvH1xHA2X4bNeNhM2WNz8zO+VMd9SiBmkiipQXYxWf6kJjt7hSn8fC1 YOcQ== X-Gm-Message-State: AOAM533bt6VR6FWUsqINsZmspXA3TZfFeeCbVA4djfB6GqfAeVQAfRZp sQrEeiywqi82rKOw/uTWMuQ= X-Google-Smtp-Source: ABdhPJz9k8Or14CAxaDV8DN7nBAuiwb7jAMVEFo51CP2oS1LoNtXzRoWio14pCQ9P+FFEcgAgM5v6A== X-Received: by 2002:adf:e811:: with SMTP id o17mr71819931wrm.53.1594374864451; Fri, 10 Jul 2020 02:54:24 -0700 (PDT) Received: from clement-Latitude-7490.numericable.fr (213-245-241-245.rev.numericable.fr. [213.245.241.245]) by smtp.gmail.com with ESMTPSA id u23sm10176092wru.94.2020.07.10.02.54.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:54:23 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Viresh Kumar , Nishanth Menon , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v5 10/14] drm/panfrost: add regulators to devfreq Date: Fri, 10 Jul 2020 11:54:05 +0200 Message-Id: <20200710095409.407087-11-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710095409.407087-1-peron.clem@gmail.com> References: <20200710095409.407087-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 14 Jul 2020 07:02:08 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Some OPP tables specify voltage for each frequency. Devfreq can handle these regulators but they should be get only 1 time to avoid issue and know who is in charge. If OPP table is probe don't init regulator. Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 29 ++++++++++++++++++--- drivers/gpu/drm/panfrost/panfrost_devfreq.h | 2 ++ drivers/gpu/drm/panfrost/panfrost_device.c | 9 ++++--- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index d9007f44b772..8ab025d0035f 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -93,14 +93,30 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) unsigned long cur_freq; struct device *dev = &pfdev->pdev->dev; struct devfreq *devfreq; + struct opp_table *opp_table; struct thermal_cooling_device *cooling; struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + opp_table = dev_pm_opp_set_regulators(dev, pfdev->comp->supply_names, + pfdev->comp->num_supplies); + if (IS_ERR(opp_table)) { + ret = PTR_ERR(opp_table); + /* Continue if the optional regulator is missing */ + if (ret != -ENODEV) { + DRM_DEV_ERROR(dev, "Couldn't set OPP regulators\n"); + goto err_fini; + } + } else { + pfdevfreq->regulators_opp_table = opp_table; + } + ret = dev_pm_opp_of_add_table(dev); - if (ret == -ENODEV) /* Optional, continue without devfreq */ - return 0; - else if (ret) - return ret; + if (ret) { + /* Optional, continue without devfreq */ + if (ret == -ENODEV) + ret = 0; + goto err_fini; + } pfdevfreq->opp_of_table_added = true; spin_lock_init(&pfdevfreq->lock); @@ -153,6 +169,11 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev) dev_pm_opp_of_remove_table(&pfdev->pdev->dev); pfdevfreq->opp_of_table_added = false; } + + if (pfdevfreq->regulators_opp_table) { + dev_pm_opp_put_regulators(pfdevfreq->regulators_opp_table); + pfdevfreq->regulators_opp_table = NULL; + } } void panfrost_devfreq_resume(struct panfrost_device *pfdev) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h index 210269944687..db6ea48e21f9 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h @@ -8,12 +8,14 @@ #include struct devfreq; +struct opp_table; struct thermal_cooling_device; struct panfrost_device; struct panfrost_devfreq { struct devfreq *devfreq; + struct opp_table *regulators_opp_table; struct thermal_cooling_device *cooling; bool opp_of_table_added; diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c index f1474b961def..e6896733838a 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.c +++ b/drivers/gpu/drm/panfrost/panfrost_device.c @@ -225,9 +225,12 @@ int panfrost_device_init(struct panfrost_device *pfdev) goto out_clk; } - err = panfrost_regulator_init(pfdev); - if (err) - goto out_devfreq; + /* OPP will handle regulators */ + if (!pfdev->pfdevfreq.opp_of_table_added) { + err = panfrost_regulator_init(pfdev); + if (err) + goto out_devfreq; + } err = panfrost_reset_init(pfdev); if (err) { From patchwork Fri Jul 10 09:54:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= X-Patchwork-Id: 11661603 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 4877A913 for ; Tue, 14 Jul 2020 07:03:05 +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 26C8E221ED for ; Tue, 14 Jul 2020 07:03:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MMRQJYeh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 26C8E221ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 3997D6E8FC; Tue, 14 Jul 2020 07:02:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by gabe.freedesktop.org (Postfix) with ESMTPS id 23E316EBCB for ; Fri, 10 Jul 2020 09:54:27 +0000 (UTC) Received: by mail-wm1-x330.google.com with SMTP id o2so5273795wmh.2 for ; Fri, 10 Jul 2020 02:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vGrB4C2EapNRMSvNvzwinnqh7atFRSmJOU/XyLZhEhE=; b=MMRQJYehw8ZQxxFT5CqPiRrGsbm364F4MVV/yZWQp1C+52h+7xpyjj46Xj+tgW0zyU AvB0zj5LduZikGya+Y2tPRfS2wzszgBc/5FP/xJQgtR0qrzyJYzBXJ3zhmUKmCSSQ0Mg Y0oowsdZX17mt+QREO7oYdJeLf4sN3ajCGwcQR9vhnpOvRKZ6mnWeEyUPTdSCUlHBhhb huZCxkWq6OVL3sipFjWcoIjtzlhr8ERlCkfkZRBSfRbtTriB1PwTZarV8WgMt+66xYfv d5u6NhGC1UyZrHSPqECxrYoXk4r5KMUVDkjlfni0Q15OzKegnU8jihN9CkckWWFLSTeM kRiw== 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=vGrB4C2EapNRMSvNvzwinnqh7atFRSmJOU/XyLZhEhE=; b=JhZnDlLXsUeGV4CUyxwIQdqmU3OzwTlxKEpfd+h/B95ofxp0D+NRwILGfSdbYem/86 2DqNFyNx0icm8L3xmsyrFm5cwnmlvAgwUM2pKzEdr56tr1eDCbiRWkExtFckSAq2pCLX qBEbS5AP+rBmxdQozkCflhVsyyib3PK0L1qY/BjY6longCu914Qun5ALe6rLdedbb33C zWFHwPXgF2bcMpfQImLG1gyav4Thb5B3Cpmmp5aTymhu+YvhPvAVPDRhfm1YjzUWVCEa v1VfT05vHRYdyVZL52wuvZcB96+m4Ypg0XR+uORP//hqeTNdmbzcUGglN9cS1K9fxnCJ sDuw== X-Gm-Message-State: AOAM531VHK4VHng9GikBJybKSts+W96Wu7Oh9AirhBcCicuwiMl8dggE 146qQnaik5TAPlFGpzxlqqM= X-Google-Smtp-Source: ABdhPJxvOyxWrFrfdSeYFgEZW0vN3ESP+d6i5l29mIhd8ro9UaD9Zd651omuIzA2cece87Wv0D2yrA== X-Received: by 2002:a1c:dfc5:: with SMTP id w188mr4526829wmg.182.1594374865613; Fri, 10 Jul 2020 02:54:25 -0700 (PDT) Received: from clement-Latitude-7490.numericable.fr (213-245-241-245.rev.numericable.fr. [213.245.241.245]) by smtp.gmail.com with ESMTPSA id u23sm10176092wru.94.2020.07.10.02.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:54:24 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Viresh Kumar , Nishanth Menon , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v5 11/14] arm64: defconfig: Enable devfreq cooling device Date: Fri, 10 Jul 2020 11:54:06 +0200 Message-Id: <20200710095409.407087-12-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710095409.407087-1-peron.clem@gmail.com> References: <20200710095409.407087-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 14 Jul 2020 07:02:08 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Devfreq cooling device framework is used in Panfrost to throttle GPU in order to regulate its temperature. Enable this driver for ARM64 SoC. Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 89538d9e39e5..8a295bcb4dd3 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig @@ -504,6 +504,7 @@ CONFIG_SENSORS_INA2XX=m CONFIG_SENSORS_INA3221=m CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y CONFIG_CPU_THERMAL=y +CONFIG_DEVFREQ_THERMAL=y CONFIG_THERMAL_EMULATION=y CONFIG_QORIQ_THERMAL=m CONFIG_SUN8I_THERMAL=y From patchwork Fri Jul 10 09:54:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= X-Patchwork-Id: 11661583 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 9BCBB13B6 for ; Tue, 14 Jul 2020 07:02:41 +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 7A20F221ED for ; Tue, 14 Jul 2020 07:02:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="arCHEQlS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A20F221ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 999106E8EE; Tue, 14 Jul 2020 07:02:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4811C6EBCD for ; Fri, 10 Jul 2020 09:54:28 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id o2so5273859wmh.2 for ; Fri, 10 Jul 2020 02:54:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8VG9wQ36+6wND2b+1ll55zwCVUgbhF9bJxt2xblFID8=; b=arCHEQlSPWMax2PHYcz1oSUlwEmdK/gJoipdUagX+JC4fIdh2+uF0ipKITX1uERJ7a McyCu8VSAkzZ2X1uIPcoPYrt57DcBTgqlbaDnNPj1+EzZGCWMo6kPGoxlvm6ekXMCbdK ZgycShxzBoHe4pSmN2YkIrKtYK8tgCZaaOlmVmjsBjG6dlStcaYLaOqVqrh36TACYRj7 47pOHc8JeQNlLbRjrFIJL7ukWLVyoqlDy542+r+MRB9cTeXb4XCdZzr6xb/GSkPsvY62 DZCA6xa1A+MqBlVYeB5j1lR+2q9QVXpaJnFxpa52glDuRuTPkWF4gIBGRGhNrXRCZ6hc RJIw== 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=8VG9wQ36+6wND2b+1ll55zwCVUgbhF9bJxt2xblFID8=; b=aa9ZT/YMQksf7hQ9YTIoN98Vc84D+uRvDlnxOw8S79EE7g6zg7bMOxmts5DAlCOUsy 1I90avjaa0Tcxxnbwrunio1/0x7csPWiNc8ThrZtnSwkK7f44eTlwqgNjj37gcE8C/SD nperF/LNzc8B9sUb9HmXbJ9S+SCd7UP01A3FOLuW8e70MrQ9YM70AblqzNsSn5qrTIUt 4cALQFxqBzXt3RrYROWzGK2LxyQ96FPcA/J4NAec8ckjzXdt7/Uuf2G/wUkGwBN/5na5 vc9d0eiTbJphTkyQF5WGKelzi3no7JMMsFUFYdKWKs15xGgJKqOuCqMcyjEDvntMY4bx XQOQ== X-Gm-Message-State: AOAM532Z9ugv3fVaOsk8VVIsCPKcO7fxQoVDc24oufyEb2b8OMKODfBl jKfjLr9k5cCH5ag99dQ1WPc= X-Google-Smtp-Source: ABdhPJyCS0Byis+30zzDr4BEH6T3l1hR4Yd0kDf359JHDMzQ2V1yzUqlbi3l5elMmoSteGmC6tQ0gA== X-Received: by 2002:a1c:5646:: with SMTP id k67mr4515905wmb.61.1594374866911; Fri, 10 Jul 2020 02:54:26 -0700 (PDT) Received: from clement-Latitude-7490.numericable.fr (213-245-241-245.rev.numericable.fr. [213.245.241.245]) by smtp.gmail.com with ESMTPSA id u23sm10176092wru.94.2020.07.10.02.54.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:54:26 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Viresh Kumar , Nishanth Menon , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v5 12/14] arm64: dts: allwinner: h6: Add cooling map for GPU Date: Fri, 10 Jul 2020 11:54:07 +0200 Message-Id: <20200710095409.407087-13-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710095409.407087-1-peron.clem@gmail.com> References: <20200710095409.407087-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 14 Jul 2020 07:02:08 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add a simple cooling map for the GPU. Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi index 9ce78a7b117d..1c939c55aaea 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi @@ -175,6 +175,7 @@ gpu: gpu@1800000 { clocks = <&ccu CLK_GPU>, <&ccu CLK_BUS_GPU>; clock-names = "core", "bus"; resets = <&ccu RST_BUS_GPU>; + #cooling-cells = <2>; status = "disabled"; }; @@ -1013,6 +1014,27 @@ gpu-thermal { polling-delay-passive = <0>; polling-delay = <0>; thermal-sensors = <&ths 1>; + + trips { + gpu_alert: gpu-alert { + temperature = <85000>; + hysteresis = <2000>; + type = "passive"; + }; + + gpu-crit { + temperature = <100000>; + hysteresis = <0>; + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&gpu_alert>; + cooling-device = <&gpu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; }; }; }; From patchwork Fri Jul 10 09:54:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= X-Patchwork-Id: 11661589 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 E848813B6 for ; Tue, 14 Jul 2020 07:02:45 +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 C649E221ED for ; Tue, 14 Jul 2020 07:02:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ax7KLwYX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C649E221ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 217A26E8E9; Tue, 14 Jul 2020 07:02:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6486C6EBCD for ; Fri, 10 Jul 2020 09:54:29 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id o2so5273923wmh.2 for ; Fri, 10 Jul 2020 02:54:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gRxnrLEUrSrlK3zy1+2PoRYSjZZZ/aiOGCPYzvHmseE=; b=Ax7KLwYXMudeWTKZWMZoKaIdW+41vP/yk5pKH7JXbzOuY//U/J7sWJOgQoweFB5Ge9 i4UMNN5Bx4cGkLa2CxA4RqLCNSvWnYhsCw2zSO29HftQPD5xgwhUHAO4F0PbX9OxoYMD CFefLJyFKjoAuLUpFy3t1adPxhdIMid6vBhO508c7MHFf9Oa8l//+W9N1o3b9VGSAYBD XVoHj3+ynKTaAxRf8jfbHf6d+xDig9Aqf1bHV8S6+NPG8yIuTl4qOsCeA8VUXhZlqsor Fb35cQkYy/XLpb6YSDbVcBzP7/5lizIBiBeBaVtJTmtTH16hmim7CWoTdF07NL1yORe5 tdvA== 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=gRxnrLEUrSrlK3zy1+2PoRYSjZZZ/aiOGCPYzvHmseE=; b=JP2oPoDlPpwKzTjhtgW79q7Bx6kO03SdU+y0EF45vOwZrQcmldEfC49daFGz0Lkclc ytIO6veHL9RrSMbP3JtNsJgpYAV9A93QcpXooxtGvePkL+DAhx+fit7W23tXxu7+8N5O DMkOJF8Y6PuQwY4lSDeyLxE+9XyTTP4eVJqFFONz2TyFfXHBMeEP5u/oDc3ck5hJOk9M qAYRR5tFipFnLSUq142h89d0mkVuG7HJF8g/tqFV15B0jXJmKWIJGCJynkjfu76aSl09 jwt28qwifyhMguunBiG6z+V54lkJ409CRLBDTgcopeMu3BfRX0wZOy1l46DYKKvGtKqM XFRA== X-Gm-Message-State: AOAM533zfdi2pjd+0wK8XwJD2joRfYJeEoXk+nQ95l7Fo3sstBnAW6Re yxKmVhmv3MUtReL0JoSqqrI= X-Google-Smtp-Source: ABdhPJwTns1K8KXgCQ0MyV0FMjZlV8NiWamZDQPmHqlyMxrvB7J87elQSbKPOX8421NQ1QnrEw4/rA== X-Received: by 2002:a1c:3504:: with SMTP id c4mr4326573wma.177.1594374867967; Fri, 10 Jul 2020 02:54:27 -0700 (PDT) Received: from clement-Latitude-7490.numericable.fr (213-245-241-245.rev.numericable.fr. [213.245.241.245]) by smtp.gmail.com with ESMTPSA id u23sm10176092wru.94.2020.07.10.02.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:54:27 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Viresh Kumar , Nishanth Menon , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v5 13/14] [DO NOT MERGE] arm64: dts: allwinner: h6: Add GPU OPP table Date: Fri, 10 Jul 2020 11:54:08 +0200 Message-Id: <20200710095409.407087-14-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710095409.407087-1-peron.clem@gmail.com> References: <20200710095409.407087-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 14 Jul 2020 07:02:08 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add an Operating Performance Points table for the GPU to enable Dynamic Voltage & Frequency Scaling on the H6. The voltage range is set with minival voltage set to the target and the maximal voltage set to 1.2V. This allow DVFS framework to work properly on board with fixed regulator. Signed-off-by: Clément Péron --- arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 80 ++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi index 1c939c55aaea..16c3ad8abd9d 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi @@ -175,6 +175,7 @@ gpu: gpu@1800000 { clocks = <&ccu CLK_GPU>, <&ccu CLK_BUS_GPU>; clock-names = "core", "bus"; resets = <&ccu RST_BUS_GPU>; + operating-points-v2 = <&gpu_opp_table>; #cooling-cells = <2>; status = "disabled"; }; @@ -1037,4 +1038,83 @@ map0 { }; }; }; + + gpu_opp_table: gpu-opp-table { + compatible = "operating-points-v2"; + + opp@216000000 { + opp-hz = /bits/ 64 <216000000>; + opp-microvolt = <810000 810000 1200000>; + }; + + opp@264000000 { + opp-hz = /bits/ 64 <264000000>; + opp-microvolt = <810000 810000 1200000>; + }; + + opp@312000000 { + opp-hz = /bits/ 64 <312000000>; + opp-microvolt = <810000 810000 1200000>; + }; + + opp@336000000 { + opp-hz = /bits/ 64 <336000000>; + opp-microvolt = <810000 810000 1200000>; + }; + + opp@360000000 { + opp-hz = /bits/ 64 <360000000>; + opp-microvolt = <820000 820000 1200000>; + }; + + opp@384000000 { + opp-hz = /bits/ 64 <384000000>; + opp-microvolt = <830000 830000 1200000>; + }; + + opp@408000000 { + opp-hz = /bits/ 64 <408000000>; + opp-microvolt = <840000 840000 1200000>; + }; + + opp@420000000 { + opp-hz = /bits/ 64 <420000000>; + opp-microvolt = <850000 850000 1200000>; + }; + + opp@432000000 { + opp-hz = /bits/ 64 <432000000>; + opp-microvolt = <860000 860000 1200000>; + }; + + opp@456000000 { + opp-hz = /bits/ 64 <456000000>; + opp-microvolt = <870000 870000 1200000>; + }; + + opp@504000000 { + opp-hz = /bits/ 64 <504000000>; + opp-microvolt = <890000 890000 1200000>; + }; + + opp@540000000 { + opp-hz = /bits/ 64 <540000000>; + opp-microvolt = <910000 910000 1200000>; + }; + + opp@576000000 { + opp-hz = /bits/ 64 <576000000>; + opp-microvolt = <930000 930000 1200000>; + }; + + opp@624000000 { + opp-hz = /bits/ 64 <624000000>; + opp-microvolt = <950000 950000 1200000>; + }; + + opp@756000000 { + opp-hz = /bits/ 64 <756000000>; + opp-microvolt = <1040000 1040000 1200000>; + }; + }; }; From patchwork Fri Jul 10 09:54:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= X-Patchwork-Id: 11661613 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 7168013B6 for ; Tue, 14 Jul 2020 07:03:15 +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 4ED59221ED for ; Tue, 14 Jul 2020 07:03:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LkAG+JzI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4ED59221ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 24E3E6E901; Tue, 14 Jul 2020 07:02:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD14A6EBCE for ; Fri, 10 Jul 2020 09:54:30 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id a6so5298240wrm.4 for ; Fri, 10 Jul 2020 02:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DFfhRB3CIFp7+b9HYaYFBTlz+H/vZeZ2FswijDgFipc=; b=LkAG+JzIcrjWk6wsbbvoJiQ+Dhzfbf1ff68EZ4/MAk9dKnXdHGf5arbiMI5gEIKidJ jVLBKwoToirkaWTw8Gymu76RGj5XKW7rDwOKBs9QNf06BqMfOEjBw1kvsOElM+nBV4o2 9tnPETwBjUFaMKuv4fkTS28qs3Z2qNp4EwUdt/k5gb+/o7aCikBb88sDGxc5aVaGQdvQ qSP07OBrupatkzVU+UukYqu2O1THtQAZEg2KKpuXBBLaDjKLWFoZEw/ugKH4jxf3mZ8h 7XN+0HflMjzoV0c87Bg35XLqlJeC8Hjngypjmw5TzjavELK5bDrnoEPZJQD4RiATXL5l BniA== 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=DFfhRB3CIFp7+b9HYaYFBTlz+H/vZeZ2FswijDgFipc=; b=t/E8jqPx+eQfTbY8w3qqe5Ps9CjKBnu9EGI5nXpcPZPtiZzHPl5FwDUJIUILywGYOA OTXqzdhulAUlcfjX7GykyH1dgVmKLbPAZlx7JJaK/sJGRkABJT/CjArYQKuQD+gqzvyh w9Uj+JmX6NOEtJ+2e1tpP/RCKQFGqb++hqsnQBTHlQtea1/SVZHi6/nqU0lsMyg0cKBw vU9q95J/awLuPm5AhycyCr4T/iJ9V40a517u1UJrVC7acttTuHO77u2mumLJFtPCW9KS JxpdWL0wWyB9u3yfWX2yjDSlk34+t2exRHZK/4wmxHostInT1PQu/o5CZRZiJgHzkGwC xNmQ== X-Gm-Message-State: AOAM530N6BaZXDHJON/zamsPda0EETah4Qbw6GRKD+z9vVrseN5HRuBg Cd/eyJ7Z8G/amFkx6SN5w4w= X-Google-Smtp-Source: ABdhPJweU8vHChcfF7n6zCNGPvYpioyH/JYFNiQfISKnR8gO0ao1GlphavbGVRCAyGh9bV0XTNYxKg== X-Received: by 2002:a05:6000:1006:: with SMTP id a6mr64201904wrx.332.1594374869330; Fri, 10 Jul 2020 02:54:29 -0700 (PDT) Received: from clement-Latitude-7490.numericable.fr (213-245-241-245.rev.numericable.fr. [213.245.241.245]) by smtp.gmail.com with ESMTPSA id u23sm10176092wru.94.2020.07.10.02.54.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:54:28 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Viresh Kumar , Nishanth Menon , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v5 14/14] [DO NOT MERGE] arm64: dts: allwinner: force GPU regulator to be always Date: Fri, 10 Jul 2020 11:54:09 +0200 Message-Id: <20200710095409.407087-15-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710095409.407087-1-peron.clem@gmail.com> References: <20200710095409.407087-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 14 Jul 2020 07:02:08 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Signed-off-by: Clément Péron --- arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts index 3f7ceeb1a767..14257f7476b8 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-beelink-gs1.dts @@ -245,6 +245,7 @@ reg_dcdca: dcdca { }; reg_dcdcc: dcdcc { + regulator-always-on; regulator-enable-ramp-delay = <32000>; regulator-min-microvolt = <810000>; regulator-max-microvolt = <1080000>;