From patchwork Fri Jul 10 09:25:35 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: 11661569 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 13339913 for ; Tue, 14 Jul 2020 07:02:20 +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 E53E8221ED for ; Tue, 14 Jul 2020 07:02:19 +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="GpJ2AfDt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E53E8221ED 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 D55016E8DB; Tue, 14 Jul 2020 07:02:09 +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 F2C546E082 for ; Fri, 10 Jul 2020 09:25:54 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id k6so5217986wrn.3 for ; Fri, 10 Jul 2020 02:25:54 -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=GpJ2AfDtbHXLCQycXNMvxZwPIi7rXnk/8jSaA9ZZnkKHlUMiNkJvw7EPslgFRbJWgw hav701awxzqvtwNTqjqpHpx8qrNmYkRyx0UvXWW6FY2+NL+rP1GtqwGgC//+uWeEog/+ QSjF/hd+QXKY7Db5KROhJVUhiAqQ2N0m6TLD+jQvrM/puMlAZk+WQHaP+IKDYTWljLfK 5dGWELhdr4++i6PRcD/7+tWe1YiVyXRwgZOY0nWpaGbwdPqdMq+WRy9aZtttYM7yq3OC W23+679XuTQ89ZWtmyWVI0ZQnT8Fgv0og07FCMN58p+CuVXGbv+Gk0WNPc4z7Vy5li+G B8ow== 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=kQVS2Klv7ad5UBosq5/Y7/+PxQOrw2tAM+WCff5OT5A3wPgcylA2qfOcQSn0o5xoh4 Tm3ZrlE46fUDwvG/tYWE94SpGiAcxFCMuLxqTf/vGet069AuXGbWaUXVBfTgVwnlOmQ0 NjaqHfyNYdkGDLDOPd/5E1P/toOUUd+1aSvubfwReR3qliku0pFIQRsU+tZGaVEi1oet 2F6ZeUKJ5lIpqamok0bTDhR8odJmIAPhZbYyRcUMZkbFLF3CSsF2YBCrAvKd5AIgNg0e ZdqW322y2b9ioMTzaVLiDaPKoOO14Yiqa8dBkJikYLU3i5IjU3k/zSdz/XKnYpak25l7 0xjg== X-Gm-Message-State: AOAM533OmE1ur6WX5WNOaHTbIUF+/JFUErMxxCxlf+5Hoo+k5/Az1pAd 6TNV+UlZew1/91hM+50P8no= X-Google-Smtp-Source: ABdhPJztkpwv2u/X8d+I0+14kZgyoIQ8x8qEsfOqO60cJPVWz5ZpmAG7Xk4kWn3hX2rMNDlm4waVTA== X-Received: by 2002:a05:6000:111:: with SMTP id o17mr71160399wrx.178.1594373153543; Fri, 10 Jul 2020 02:25:53 -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 h23sm8179559wmb.3.2020.07.10.02.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:25:52 -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 v4 01/14] drm/panfrost: avoid static declaration Date: Fri, 10 Jul 2020 11:25:35 +0200 Message-Id: <20200710092548.316054-2-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710092548.316054-1-peron.clem@gmail.com> References: <20200710092548.316054-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:25:36 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: 11661633 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 6FE38913 for ; Tue, 14 Jul 2020 07:03:51 +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 4DB8A221ED for ; Tue, 14 Jul 2020 07:03:51 +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="CS12xL4M" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4DB8A221ED 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 E8CD06E926; 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-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 335086E082 for ; Fri, 10 Jul 2020 09:25:56 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id w3so5162236wmi.4 for ; Fri, 10 Jul 2020 02:25:56 -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=CS12xL4MC/BksNlaIwRvyjwByz6TExJ0myJwWurq4UfyGNLpbsSrkuNF/quq0IrCw0 xRCpPjeHPg0vcncegyAUUCeWP1J4CIVCXwsjxoz6JtF1zhhsm+hCrJZhqUuMRR9bBhJX ba0Syb94q0gwzHGWJqAhCZbu1t67N7v6rFtiCR/o5Q7YANVO2fl0VjnrV/qewiMGABS2 LC4Qu0DHz1muygT+uGpJrxahKYbuNbb8UT39MeH0vK+DpFcSG0CxtR+f3pfyxtCr2Wp6 lbHyuEEI0ttwpwZSc8PYtlgzBElPlte8lwG9OfuL4QJnZBSV7p6DaSoWuIB2DrSAhe7u sBIw== 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=TTTZOgXvwWQpBLYbu1jORR1dLiLhKuhQSD6/IgVb0GqSBzp0SCk+e1nkrxLsH1RKem 2iIC8rrsIg5zTC9AJASfOKOM5Qs2mVnkq2obYem5KJ2K5gn2jd3zQmFv57dAVUwGtHel c6p9hd8tQdNjd5oZWbb/FHBWbSBbsJ060sGtv1WRQ0S83nBpkUpfG2T7949ytWfL8jKM FMY7kenKdEYRXvnCXVK6eAsdN7qiMBPq7J2VgOcncGQVGfyCct2UJ9aDQIqkKVU0Fmm2 qWwbVw3vGXSeI4QxQx8spCMGRPw5AQjTuqcTwhoVH+nJ2QGJ87TTZOSn6pgt3KCZlHY3 ph+w== X-Gm-Message-State: AOAM5302ZQtb7GjVRpiMX6KH0ZU8b88kZnPJlHGGlWgs9Ko2/KZSe5sF moyWbdprP+FDuQ1+nR/DU0Y= X-Google-Smtp-Source: ABdhPJwyGsfKRK2ok2A3GZOj8rkfOYAVuUfKijampNPqAXAT3B9HhIiWfpDKg6V5bv2Bk2P0wHopUw== X-Received: by 2002:a05:600c:2511:: with SMTP id d17mr4368631wma.127.1594373154688; Fri, 10 Jul 2020 02:25:54 -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 h23sm8179559wmb.3.2020.07.10.02.25.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:25:54 -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 v4 02/14] drm/panfrost: clean headers in devfreq Date: Fri, 10 Jul 2020 11:25:36 +0200 Message-Id: <20200710092548.316054-3-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710092548.316054-1-peron.clem@gmail.com> References: <20200710092548.316054-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:25:37 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: 11661751 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 0BA47722 for ; Tue, 14 Jul 2020 07:05:23 +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 DDF422073E for ; Tue, 14 Jul 2020 07:05:22 +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="hkFT/OKK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DDF422073E 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 257FE6E919; 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 441B06E0A2 for ; Fri, 10 Jul 2020 09:25:57 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id s10so5163151wrw.12 for ; Fri, 10 Jul 2020 02:25:57 -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=hkFT/OKKaCVHN11jflC/fdm+RLpdfEW5QzjKHoRIV83mbHg0kxzBgflvSleihR1y3C IL77si70ouX8ODvCbisl4SEzwfXpAbk5C37LoWPUSGT52UzRQfnpiI2funI5ZDtgLxl+ qfSE1wpoO3i5thBjaC1/rh5xZ39v1P/yRWx1PaQhggyZMpVyLD/DpeFqZAzVpUDNMIPx gwBaYwV6Ti3xpX5DTmnppuh+8T4HgrYnz56IL48KE6/0uY5nA8Tc54jsl1f+Wa2yalQD 00RZwn6eESTl/qmuF2Bc3TmceHPg/zFr2GGwdbKNHat5ymFfYLm0l8wB3LziB0utQBsc f1mA== 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=DC6J0YeuvUV2B5gW5AGnC2nDUW45s0L2wtBu7bixOlf7QH057sRn+5clpmoyOg/Sy4 B+KCe3XKr6ytP0pljU89i2ZBSBnw6v6R3AyBTb+RghDCpS5yCVYWXIenrMacpKJQhICr awSIN2IsaLZm6y1TaEdJ4vyTKqOIBal6FvNfsgc7WVimbMtC3DBJ96vClrhaqh10MaDG 5bPk6F7QcRmk07nyjB82nMvxH2YgKQSv46KXVauzsgSOjJX+3oCsiTKLRd4sFNJHBufA qG30vs6v5k8Dja0Z0Pc//EUjs4wkwHY0AJ/lPy4JJDQwIpw9PmU0vIn84r55Icrq0/1I je4Q== X-Gm-Message-State: AOAM531H69YNPc8tWj36gJg4eoBCYIsfYeBrqLxuhgRO53CwyA1TmFiD UnZ17c6UH/+3DvYKz0m37nQ= X-Google-Smtp-Source: ABdhPJyGC3VRr1XqdZe9/UFYTPcwbWdNcHpTpKQDrfBZtF31oThwz+2jQt6IrAk+oh/6dpsYTbhH8Q== X-Received: by 2002:adf:e4d0:: with SMTP id v16mr67154778wrm.193.1594373155819; Fri, 10 Jul 2020 02:25:55 -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 h23sm8179559wmb.3.2020.07.10.02.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:25:55 -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 v4 03/14] drm/panfrost: don't use pfdevfreq.busy_count to know if hw is idle Date: Fri, 10 Jul 2020 11:25:37 +0200 Message-Id: <20200710092548.316054-4-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710092548.316054-1-peron.clem@gmail.com> References: <20200710092548.316054-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:25:38 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: 11661567 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 13FB2913 for ; Tue, 14 Jul 2020 07:02:17 +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 E61E4221ED for ; Tue, 14 Jul 2020 07:02:16 +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="lSsk67ke" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E61E4221ED 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 736B06E8D4; Tue, 14 Jul 2020 07:02:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id 98AEC6EBBA for ; Fri, 10 Jul 2020 09:25:58 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id j18so5373905wmi.3 for ; Fri, 10 Jul 2020 02:25:58 -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=jfMXVpKl6vspqUzfRtk9RGf4ooITbe25ARObyR1MQUM=; b=lSsk67ke2Kl1vIf5ERlY7TmmPYQTQq2qrJGd8Q/k8kzYygx4SOrakuBuBa3mNxGZAZ gDrGXb3yttzOHSIMVhjjxjbi4cETm+LNN/kNxIKzpu6u3zT9Fey/LNC7CGDOsn28VAA+ cdt+g+hnhzN68Gbzy1P1KyMlDBUnNuwVqXy0RygWHGly9GtPZiqzYqfvDmGnEF6TFOb/ 5xfGot3zt+Cm99VQ3Gjf+vJitrySkhV+bG9QVCYzdLcg7vaHr8T7tYJvATgWWva9Viwn DVi1YSR05NY/f9eZjRYkOyLA+1yT7LBqTyZ3+aiyCPhBbTe8CYYtxA77LfRp5AE8iOlN pw4g== 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=jfMXVpKl6vspqUzfRtk9RGf4ooITbe25ARObyR1MQUM=; b=HxctK5aH7o+NRrhKOLaXUg92Yl7Q95HgO/0r3CquPaAuK7FWogxr59hgBJnhmttrr6 lWGc4MkKdL6rUX4rJQFfZa+P6zbUmaMHHKfLo8uunKbkIuF7oj26OVQhzOBeI+2GvMeC nf7CZSktES3S5+iZw5ipeQNV8741Qu26Ug6ylRtRJyHIZrt7Y+DlQTJCW4RS2qNB8zzZ 4R+8/FkVFAWKxQxG+r9rbYR0feMWUrewqrIkBzhDZFK7WM4j55/WrzANM9LVRgRwXTbQ TPqucARishipsH8SBSbkp0ntEvXIw7CUctIdjUzBRs2tdb7CwcTNCaHHMOEFH0cdmb4F uqzg== X-Gm-Message-State: AOAM531c6W+WFLafz/629dFdi70Dm4EKBMDeilnXwZdY/qfKRutbBUc0 4U/KCHtMgCMnfWAKpjwXSww= X-Google-Smtp-Source: ABdhPJzbyMlo+MM5KpJLW7iQg9q/fMCIJiRmsZRZEDEGMNVkQA+kCO4fOXXhelpPhnPUUcryZUcBjw== X-Received: by 2002:a1c:2982:: with SMTP id p124mr4500985wmp.26.1594373157054; Fri, 10 Jul 2020 02:25:57 -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 h23sm8179559wmb.3.2020.07.10.02.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:25:56 -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 v4 04/14] drm/panfrost: introduce panfrost_devfreq struct Date: Fri, 10 Jul 2020 11:25:38 +0200 Message-Id: <20200710092548.316054-5-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710092548.316054-1-peron.clem@gmail.com> References: <20200710092548.316054-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 | 4 +- 4 files changed, 65 insertions(+), 46 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..49b2157d8549 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) @@ -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:25:39 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: 11661745 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 243F9722 for ; Tue, 14 Jul 2020 07:05:13 +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 01CDA2220F for ; Tue, 14 Jul 2020 07:05:13 +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="rAgr4XVr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01CDA2220F 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 C12F76E917; 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 CDFD96EBBA for ; Fri, 10 Jul 2020 09:25:59 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id l17so5381158wmj.0 for ; Fri, 10 Jul 2020 02:25:59 -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=rAgr4XVrvsaZLlT8B7Q0nV7cZfe6lCpKkxgxwPpI8GmyuKWjC6NjV/n/KKfVe8BVhL bB0PY3/OpaWRnpSxKhhVmV21vv98kljQDd3g2vYwGHHRArNfYi3sCI1Ez5q4FlZFZShy n12fNGJ5nV4TohL2sRlWbnzKwIUoY8WG1zCRYrgQPA2qmM8G0EvL1jNWw9TwdbxEhkyF CxDWuw60Xuy14JvG18mdz5u+ZrUB1/B912moseM68xq0XM/aaRsduiEExGcG+Gyqf3X1 WAKEGyZS6Rh6luOFfl7w9VmsYz5zyebbhd8A8UQwGWapSBioHfAEk37+f9mVhwWQGHfg Ap9w== 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=dHdac9FhrlrWrVUMmxoEAf/A/u6qPXLUqXiAvJ+wEYB7+m41nGNXGFa4TI9IcIocZk G4JOqgNELMSPJBRsInGgSAnLDBdssfIbP3X/Q98fiSB1Ywou1FufFGAx1x2EPNtTvlwB MKace1mgVbRi09w3jAFbzbvCHAJ9DX2wbuMzLo62NMVBj742uQJcYem1gL4uxFiFl40O Zm8XvZbEER8gQ599uIwMBUs2kSxcrR25ji0PYtF9ImnURND+4GlRGb7MaAUxU5vEZBpR J/ekPHUkYFODeUQu7w1qPf6Ov7gXQkiD9g13+rQWtgnUXiPLo9nVFivRm7Man520HUQL 7GBA== X-Gm-Message-State: AOAM531C/SXbXjignWqApbvbRFcCN5sGbuT8Nia1gDfAhjwF+Y+2bzUx GKp1Zc2RjBdu0VtsPHhZHmY= X-Google-Smtp-Source: ABdhPJzwaGhKTKcokekZX+14u3sQfupY3jr58vELmEoxJ2oIVR8Z4IdklFRTMCu1qMAa8IVJn7ysbA== X-Received: by 2002:a1c:4143:: with SMTP id o64mr4424200wma.28.1594373158417; Fri, 10 Jul 2020 02:25:58 -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 h23sm8179559wmb.3.2020.07.10.02.25.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:25:57 -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 v4 05/14] drm/panfrost: use spinlock instead of atomic Date: Fri, 10 Jul 2020 11:25:39 +0200 Message-Id: <20200710092548.316054-6-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710092548.316054-1-peron.clem@gmail.com> References: <20200710092548.316054-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:25:40 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: 11661579 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 CA21413B6 for ; Tue, 14 Jul 2020 07:02:36 +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 A7ECF221F6 for ; Tue, 14 Jul 2020 07:02:36 +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="E4GpAiyV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7ECF221F6 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 D7CF06E8E4; 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-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 400546EBBD for ; Fri, 10 Jul 2020 09:26:01 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id b6so5179368wrs.11 for ; Fri, 10 Jul 2020 02:26:01 -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=E4GpAiyV9Kyb/V4RrgUETUNMim7T52pdnh5of0wT32aNKAQaUi+JIRWLnDzExKxNyq VKUH/VcndndpMN9bWmH3hEjgkzT+U9/fbuoXIBpirjvAyI0PPU+8lVBC+QsHR3IIsHJM 54igzG/UcACPfFVmTNQy/wf+f564p8xe4DRqxbmbvlRWfzhm3SwhN/n29TZZ3gvq/TFF fLuVUXpo57j1spIW/pCw2zxVYPG8kH2vWXayMTxZMlFnfxMuc3FogvPWTIT5W4aCCdGN oLwvcv+jgRvyAQGlEoHZKEkt8Pl1ucGWSglBh1w+ymY3qdVnU+i+ERot9zuu0mWPY+X6 Mcuw== 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=l6bVfEmx9rDcLoqm826kOpNE/psxNLj4yOeXg1ZiitkIU6I2VvGEdSfvaeuV2iSQq2 Sw306nJBspqCaqYxZYbzmaOskTSYnruwAw4HGruuiK12FRXGgIuIXWfKgxsaPQgXjWJW 42jSvSyo3yp82FvS3rai1aHtYH3vvCbur+phIQJHlPnaPcYcBACZVEm9wNj5YpOXv2xI w+LYKQutyMbrFeICZCBrAN2ccOUFmiLeD60ff/+WFfCeEnizVrDp/QIe9At2AFoyDr3r lzRNchC/0bB8rlDyhJPDq8f8NYtV8kFpYTuPcBLW0fP+fzejcLkFTiQgdBxIZHZzxk29 sN9g== X-Gm-Message-State: AOAM530h9PUGEQIxDwIy2KpoaCq8PLpKR9RhVjq4EEidLrskS4IG9Z+i ZFbOrKHmb8Oi9+3O/tUugv4= X-Google-Smtp-Source: ABdhPJyHhHpFVP4toqlpGZIZenUeHlbbfH+Vx2+9lkZq5JZNpCl8/ymXw8F6Ur9NnenathGSw5dnLA== X-Received: by 2002:a5d:44c7:: with SMTP id z7mr72021659wrr.226.1594373159795; Fri, 10 Jul 2020 02:25:59 -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 h23sm8179559wmb.3.2020.07.10.02.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:25:59 -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 v4 06/14] drm/panfrost: properly handle error in probe Date: Fri, 10 Jul 2020 11:25:40 +0200 Message-Id: <20200710092548.316054-7-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710092548.316054-1-peron.clem@gmail.com> References: <20200710092548.316054-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:25:41 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: 11661743 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 A032C722 for ; Tue, 14 Jul 2020 07:05:07 +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 A70EA221EB for ; Tue, 14 Jul 2020 07:05:06 +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="S2ig4kvm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A70EA221EB 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 AB51E6E916; 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-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 60EAA6EBBD for ; Fri, 10 Jul 2020 09:26:02 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id j18so5374168wmi.3 for ; Fri, 10 Jul 2020 02:26:02 -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=S2ig4kvmDSJIPwYoXEgwMT8FZkjfG9AVU443JHmffIUG51/Is4LsPtP5tODmYYaEsc auB8gLKNNCaSSTKDeLuP9AHMK8ekbeF3eb2nz2ZLiKUxjW9avc5hIebi+FQ1LkyRpfE9 1HnrWiQh0UzK+EyDN0LW8bI8ANdBw2aAafYBFf9oCnGTmQ1mIJj5tarTQBvjn6ECNjkL brj0s1P/EIxKJShtsZRjCpDx5bewqgdUs1SfYoESwuAkI6ipnjL9vYjLdmZVfzF03Jac kyL4fMD+LmzMTVWrea13dQl6Sf91dDhNWSyQcjcrCx90ZO7e9Nhm+6Fz9qJDVXXACAJn j8lQ== 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=Tbp3goPuwEV6oRboZPy31nWrXcX941NSsVDzS+DGmX2em1CzY2S2CST1sBceLs8qx1 82rQU5pRo2KNvltdmIcwNZ4WapyowgE1mokiT5tIDBL2Y7DuVA9wQN+fJC66JCKXq204 YiUiIo7/V5/sw9Utewiw0DCpM1xeayTMhi6/482+7G5r1ozRRrxHh623FitQO9ZZdQM4 lhUUmcx208UW0i3ow/k1Gk8rzU/+9GmBfMiR9C2xlenM0R+SfXO6VVYUdVJg2l9noVPn J72ynmIIeeYGZEppj3nqUxK8Od/cAzpcvttbEg/VFkG2jHKVlBpfgO5RhaLJCMfF/KwP 4pIA== X-Gm-Message-State: AOAM532OH/qHTPR1TFZvTm6pmpLFdh0M1bmkCq2BKj0UChKlMWMo9Rpl Hmzt20WTi+paSzRLsGw1xbo= X-Google-Smtp-Source: ABdhPJwf0I1oRgP5F+GFt4RKjJo/KGgOpRV0lTTEpc+BKVvDFwJ4KfE3PAObQkkIVtQDkCgqg4qb5g== X-Received: by 2002:a7b:c194:: with SMTP id y20mr4487588wmi.83.1594373160910; Fri, 10 Jul 2020 02:26:00 -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 h23sm8179559wmb.3.2020.07.10.02.25.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:26:00 -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 v4 07/14] drm/panfrost: rename error labels in device_init Date: Fri, 10 Jul 2020 11:25:41 +0200 Message-Id: <20200710092548.316054-8-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710092548.316054-1-peron.clem@gmail.com> References: <20200710092548.316054-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:25:42 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: 11661623 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 57E51913 for ; Tue, 14 Jul 2020 07:03: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 363CE221F4 for ; Tue, 14 Jul 2020 07:03: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="l3Lb6fIE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 363CE221F4 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 37C176E909; Tue, 14 Jul 2020 07:02:45 +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 80BB36EBBD for ; Fri, 10 Jul 2020 09:26:03 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id f139so5165813wmf.5 for ; Fri, 10 Jul 2020 02:26:03 -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=l3Lb6fIExRbdpU0vraUVP54jJ9Vgq6xtltX87nJb8koLNnc3W+QqkaBd6YJiYmTtCd EWUKH+L4puqm3WgcQEL++Sx/2bynhDejTAzkIiWGfxtzdW2HllMYxVELMyCopkUsbJ/W xyTgBBOnYN/1wpzc1M8m7/JoA8LQk6c4dRGYS87ip4BIMya+Cm1FzutIE2UWOujC+Lkn yM2ocnS7s72m8dnH6ksSs75Jmdl6EzIFBnysbjQKVCXyfTkwt2jYuCJ9HahDiVEIWLlE DqVTYKlNrtJjfx7PG2tQnz1eAM6ZX4M4Hj3fzb2aiHPP45IUxNl9KWoD9mTyC47IVtQv XpGg== 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=XHTX9JTPs60+pNQI8p4p8U5EVkEqq2AoZNL+rBgM7C9VWuxE5h7yOnUkX8WlQUQ83S Ca6mIbrepMn5LiU1xL8HQuIOaN8w5JGmadN9RjRisRJNRuCl6lGkKgQUho1xTduCP4hP VKRTRZkrbXkqvAUrNDl2D4IRru9e1/GyPIPvjU0qMB/yvU7pOQspzFSkLK4rCmmox4rv byuy6NY2nHZ/qbQ9RSlr2HMSlz+1OINq1h+ABXcZNsmCSKEsi6sBK0nKe2KgnSdBSn+8 mn0sShLhDbuWx1C+Kzf3ND6oSz/sPbO6UK+TFPX78OOYT7SptGT9kx55TS6hCXNLivAt cqBg== X-Gm-Message-State: AOAM531RgucjZcy5VuT8ZunNdGrEgaa9dYWRJ/XlIvDzRNaudeRBHkzX iQ2469a/hUGh+dFP3aHyN3s= X-Google-Smtp-Source: ABdhPJxhFX6NER9xU/kBe5OXyQKFiHiVINWKc4BkdGJM0r872IK5XL9tWT/139bTTq1uVq0FYb4pAw== X-Received: by 2002:a1c:2602:: with SMTP id m2mr4503319wmm.50.1594373162132; Fri, 10 Jul 2020 02:26:02 -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 h23sm8179559wmb.3.2020.07.10.02.26.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:26:01 -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 v4 08/14] drm/panfrost: move devfreq_init()/fini() in device Date: Fri, 10 Jul 2020 11:25:42 +0200 Message-Id: <20200710092548.316054-9-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710092548.316054-1-peron.clem@gmail.com> References: <20200710092548.316054-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:25:43 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: 11661797 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 EF76E13B1 for ; Tue, 14 Jul 2020 07:05:58 +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 CDB6F2076D for ; Tue, 14 Jul 2020 07:05:58 +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="Y7nzpXtX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CDB6F2076D 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 722406E91A; 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 C4A6B6EBC4 for ; Fri, 10 Jul 2020 09:26:04 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id b6so5179559wrs.11 for ; Fri, 10 Jul 2020 02:26:04 -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=Y7nzpXtXRxpJSxpeg/gn+LqJ0P6LF/bosc2WNKPfU3gLUmsGRJVaWZQhfvoZD0mjMS hkl39E7C3ixbMm2QOeXr0XrXBTDlruqHWC0DOomlsLGr6nzXxS3Z4DzZaASsqiGCKrVS zeimHdeUd4H1tAalgo7zb4+qkmnfxusA6A45+qqJ+o3aZYCy/4SvBhFR1B/VcSuVkUEF tONA4HyMnJtRzbl6UEitufQD9cGzY8vukonjUxm68XAjR5UkusXC2u4lfbSA3TPo71hE 9axMNPJ1yxWiWjr0RO/hkKuGHjhJLuD6xpGjYaYZ1mBySTCjvSJkFjz4TCPDr4XzA6U6 r9sw== 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=YovSDVBpSlMeQ73P3NoTzIUrr3h8eXtom7QSg2hqnXQNeNRY7Q5fZ7HhD4fbnkbgTu I4uuQptEML5Uyg0uveZvxGfMghtniaKvZsqcNvPfCACXv2p4UrG7nfNPyoKaP316tguv DW0URqPX3O/ScMZVl45AnxD0ac3vlv4Oh9ArrUaQoTGhEkimtipN/E7K3egMGKKkLtqe QwnmQSsRBkFLqnLeeFx40iEnBUMP6G4C0LVArB5KxLwKVcgHiZYHGBnXLKLjo674Fykw vnMZaRD6LjRTJ0BLPPGE2Im9qq7i3XkpWMtdXBQZ1ysJTxShEFflv2h+yEVSxUHP+4MD e1eQ== X-Gm-Message-State: AOAM533ZkxNmZrF84+Ntei4zbVatlz/PP4YDgZlMt4ky1qWThjQDs1oh aeGvTE2TMbH/pJmlh+tmAlg= X-Google-Smtp-Source: ABdhPJziUwRUwIxiSgoQpaz2tu8FXmSti7msKAPtnrROxJBkyVOphRSwnAKWACzVX/5Aa0cjpuEpcw== X-Received: by 2002:adf:ef89:: with SMTP id d9mr71367031wro.124.1594373163341; Fri, 10 Jul 2020 02:26:03 -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 h23sm8179559wmb.3.2020.07.10.02.26.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:26:02 -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 v4 09/14] drm/panfrost: dynamically alloc regulators Date: Fri, 10 Jul 2020 11:25:43 +0200 Message-Id: <20200710092548.316054-10-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710092548.316054-1-peron.clem@gmail.com> References: <20200710092548.316054-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:25:44 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: 11661619 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 9A0C5913 for ; Tue, 14 Jul 2020 07:03:22 +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 785CA221ED for ; Tue, 14 Jul 2020 07:03:22 +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="PoidVBDB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 785CA221ED 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 5B9136E8FB; Tue, 14 Jul 2020 07:02:44 +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 E974F6EBC4 for ; Fri, 10 Jul 2020 09:26:05 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id f18so5232119wrs.0 for ; Fri, 10 Jul 2020 02:26:05 -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=PoidVBDBasXLQFWmsFE2egWQs2iToQTBrSpdsh+xyaux//B6fFUZS+ZCWomZygNU5H MEFEOOcpeXNPDjh4RXIieiu4M+aFrJfuoYDFx+issHJu0WBF2vOCLV4LxHeu903v1yrJ uu8w1ltXMFo1NTAihLEP+BWDgUG7zpS67Sxm8cbgUTI5pLGIDD2eeHFwUNr/ytc2bH7t Xgwlw6VLe9+Ya2tRlcP0YcJzyAqeTK7msj6c6yoaw4CoHJ3nNUCb++FwPUGufRRZIviJ bOP7hEcAn2jItswZVDa/5/EVof+vBP9VDKpgb7PChu5yA9yLoCpKL/e7yBgxFy6uZskZ 4XrQ== 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=fOjI2uqtRNSjVMD1OsyK0BjDROSNvAUGot9MBq80oQoKALLy0uavJbHuRtw7uv7OZU mJ6nqL8g90XlYaAiL4pkbRex0+BXolKG/PcgpH5yGD36nAwbpDD27IsIVEV3mhXB+1q6 qL99Tldcgo2FAxeIaRAA1YYOVl31O8CGXRWdnOuAQ6H0XD+OsjLAS4PqdWkaq89pg4xX tTwIJp1PTezbDi3cbs6Jah7wCtACaZxAy9OTk4jhOc7FsLxsi2EfkXn7L9qiIPz63/mT 4kE2C23Tc+qxw11V0es4FYzDNm3jy8WVlWxF64hcMJIV5JfP7vMtzkD/CugniIAmHlCw SYEQ== X-Gm-Message-State: AOAM530yaavMC8YvTQmIcfz+zfRaH3jIZl8YWjymGT1t+m6eYmBYEgPM BH+05QkLLbBmc+ufWarFA98= X-Google-Smtp-Source: ABdhPJwYR8ciGq8i3bG6prAZuywKeb17+z94MbiMvQpAryACtdTYkS/ZvIaeuU7+xPuXmoOMs0dQ2g== X-Received: by 2002:a5d:5084:: with SMTP id a4mr69350973wrt.191.1594373164479; Fri, 10 Jul 2020 02:26:04 -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 h23sm8179559wmb.3.2020.07.10.02.26.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:26:03 -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 v4 10/14] drm/panfrost: add regulators to devfreq Date: Fri, 10 Jul 2020 11:25:44 +0200 Message-Id: <20200710092548.316054-11-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710092548.316054-1-peron.clem@gmail.com> References: <20200710092548.316054-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:25:45 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: 11661647 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 D796313B6 for ; Tue, 14 Jul 2020 07:04: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 8C399221FB for ; Tue, 14 Jul 2020 07:04: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="O1bK2s+z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C399221FB 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 305FC6E937; Tue, 14 Jul 2020 07:02:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2DCDA6EBC4 for ; Fri, 10 Jul 2020 09:26:07 +0000 (UTC) Received: by mail-wm1-x329.google.com with SMTP id g75so5352669wme.5 for ; Fri, 10 Jul 2020 02:26:07 -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=O1bK2s+zy853RT/ldbRQeQA6LdWuBhgSywFH2AM+GjDWIiL9877PrIij4rkSKT+nIS TtvHoE9PJw/P6Od0Y2hYvgOMFfsf2im2F/hugBuMcV6/r+D8wQ99PN2euw6FJyf3eThP nW73K55Q18h7nP3S3TrBJEUdMivbz+G9BRZpRBo3o5JckFoDwE72nNB8tmXWVHkAXqDq la4tKeE+XCIXvMVA39vB+V3u9XFJoJz+DBpehzv2UT0xd6pEaILDDDvI0iIBfahkmtSS iNq1SxNPQB343OMffoHxNUZpx8IpcXPohLPY2TJovuxSop4UtCcVQYJlDDVhlykiLoOo h3Yg== 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=IYg6/TZf0/btNQeXv0kEj2OCGwZzh+9VZXrTXSb2aP7BJaSXYzTA4/dvnM5pYnCSNM kdwMfR/24qZRkZOIyK2yLfcuPtCs3RDgDgwB6+uvw6X16bTJnVkB6OfWHXrNDsrWe7cy J07MK36U2pzBEzQsV1DB7njDnK4h+coj7uXsjE26w1qF/xaUo88qZeOIQtp7SfHeSZ9R lcu9rvp//R9jdQeMy4Mr+JcVT35N1frWtfgMhb7npXnqpU3CizNVj/tWXzqdRZGAyAMR uOWGxctFUjH2vU2SsZH0+nrcQV8gJ/S7u8o47jxa1EBYy4Qf6h8cuCad8RZlrTkjLdVt sujw== X-Gm-Message-State: AOAM5307LgWSnsxKaQ3Q4fIupI6qDuf1I9rz1isosExnEx2Jh2Y2NQp+ dJs6lc7PFQ2piVR1lpcm/SU= X-Google-Smtp-Source: ABdhPJzggwLJmzAeo25TWwoScYbm5Sywfa4ImakZ7GZScH3ClsljY2PBANXZhZNdablTFl1UBIiFXQ== X-Received: by 2002:a1c:23d0:: with SMTP id j199mr4521494wmj.12.1594373165681; Fri, 10 Jul 2020 02:26:05 -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 h23sm8179559wmb.3.2020.07.10.02.26.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:26:04 -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 v4 11/14] arm64: defconfig: Enable devfreq cooling device Date: Fri, 10 Jul 2020 11:25:45 +0200 Message-Id: <20200710092548.316054-12-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710092548.316054-1-peron.clem@gmail.com> References: <20200710092548.316054-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:25:46 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: 11661595 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 7FA2613B6 for ; Tue, 14 Jul 2020 07:02:59 +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 5DC5D221F2 for ; Tue, 14 Jul 2020 07:02:59 +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="carzkvlL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5DC5D221F2 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 A482F6E8FE; 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-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 634C86EBBA for ; Fri, 10 Jul 2020 09:26:08 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id q15so5364862wmj.2 for ; Fri, 10 Jul 2020 02:26:08 -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=carzkvlL4fPgiY8/ikmG/X30/j14DZTnoy/ZCCRzPEovmjSSEjaSr0hHan1ZPp5ctO +Gf9XxFrLm6CMf32AlmmkOYRBK2KOQlUMNwqO6MQxwL3MEU3+WmznHgYSnqq3jCxiNx5 h69+pu8JnjF+P/MaOiPDCMrDomeMx3FGwAege9a9KaSs0A8xh9TxWgGv2q8RrfYAyEiC a5JYNYsmWkxJkuPs2Y8YW5q4s4BF7OCzFr88UMxVXvx60wiQpfc0cWW0J0MFglDsH+nQ Hn1+k2D4l1a4ja044od/3j4EJ5iRrG9p2lsarnlD4ZtI9J/G2mvxM6XLT4ahZ9o/yr0h CaFw== 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=RoaOApINrdchIlWZyCl+Q7SnegjhsODKLaWC5t2dSxw2OrSkwBaoG50oTTb/xgzDxw 60oyXJPfZaqriJOnH82/uO7HQAG+L30PYXDsfiPHsfHja9ZpfDEI2TPua4DnZfAm05C/ VxfNVWp99xqiQk8Bq8/KT0gyPQFiwnTPU+5jYvr4FosVIghPadDHVXLibi0QaurdGSDC /HCm+j/mC0RBdBTdRNl/46akih+foQgSxMaQh0B/bkM+sJfIXO4jkRUeHwNzhueln3xR 8WIorvq9d7DPoHLZT1h7vOBbtT9fcng1gEMGBjdLYB0n4yX1E7/2bDJZIKgIjs2PTzoe 6WPQ== X-Gm-Message-State: AOAM531T/cAfyajUKP8D8z1GzUMSVL1cpdNpHkH/u9ihj865qPknDPW5 bmw0m04D79CoxswWsGpA1VY= X-Google-Smtp-Source: ABdhPJzfsp51zsDGVN3GNH7Jbje1TAsP8U6D5DpK8iDepJ7CTVH039bhVIuUP/0C2wAuc0dbbbuGtw== X-Received: by 2002:a7b:ca59:: with SMTP id m25mr4494841wml.151.1594373167015; Fri, 10 Jul 2020 02:26:07 -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 h23sm8179559wmb.3.2020.07.10.02.26.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:26:06 -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 v4 12/14] arm64: dts: allwinner: h6: Add cooling map for GPU Date: Fri, 10 Jul 2020 11:25:46 +0200 Message-Id: <20200710092548.316054-13-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710092548.316054-1-peron.clem@gmail.com> References: <20200710092548.316054-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:25:47 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: 11661577 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 D9744913 for ; Tue, 14 Jul 2020 07:02:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B725E221ED for ; Tue, 14 Jul 2020 07:02: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="bSawlulE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B725E221ED 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 6D3E16E8DF; 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-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 825AE6EBBA for ; Fri, 10 Jul 2020 09:26:09 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id f18so5172509wml.3 for ; Fri, 10 Jul 2020 02:26:09 -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=bSawlulEpd9Gvd+NXknKucPeR5epPWbrc8DgBm+CGFcpLMSZfETEbjd/QKCnqHOFto TCF7azngY7Kue6kkHfCNjQnihQgPSOUMOZrZA9/qLRvveZl2APcz6wY/pKuZDQU3d9HT v/oG/L4KTdExJ0uytXLDs3fxMv2gDEgoe5zYkPG7ibAHbG3txEl6f9askhqUG2Wf+RbB LTWT/SGqoJH9aRVL0/GBVRJzYjQOkVSARxe+xtw6yR7OiuOEMGjd9Xw4fM4SBp5nbheT FdbFnq66hrMZpT5+zwCHQEj7/zY0ozXOUkK/mAJL/lcwdx8cEZU0HYm50Bl5WrEDLhV6 gnGg== 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=JFO6oKAlCs1H9CEnqy6sOGtXj50b6dSxh8QOVEeSoD5UG+XR3XQ+vs8hAChRMdfNgl shgI4lWnIrAD4r9rJJ1bGMmfJQE1DiLyNHXxlnyCuJx6mu1bgPNIVdSTuYM41d1rSZJ+ xVIn0AuXC9hw7VO6HePmVrLMFy8wplqf0rppC1WbI4JPezHLq7x6FcMQIqBO6s/JUIql lDkHxkY2hH9/jtvIXQ1DOZquiOxjr48nG9I3Hfp8EkHdtL6in05YJBFePdl/oIR4a9Fl jnEjnx0qfqvEcL88Hkuv9DJaWon2lDKJVMCxLIsOJoDIcWkni6tHoXN7gsfFn0UoIfAu nG/Q== X-Gm-Message-State: AOAM533l0y0Tna2ePJlI/DGyrzMmjbq1Sv/EJaK//Lw0t471FNG+RJml JqoX3GSzBwe0d5ULrVBT/fs= X-Google-Smtp-Source: ABdhPJzK2+qhw5quxWJfN44dQFlBu1dD9VH3B/Tx16GZDKFQPlmPAM1LR4v85GhCEQ96wokmZWS/oA== X-Received: by 2002:a1c:2805:: with SMTP id o5mr4337815wmo.25.1594373168118; Fri, 10 Jul 2020 02:26:08 -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 h23sm8179559wmb.3.2020.07.10.02.26.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:26:07 -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 v4 13/14] [DO NOT MERGE] arm64: dts: allwinner: h6: Add GPU OPP table Date: Fri, 10 Jul 2020 11:25:47 +0200 Message-Id: <20200710092548.316054-14-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710092548.316054-1-peron.clem@gmail.com> References: <20200710092548.316054-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:25:48 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: 11661607 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 AA56413B6 for ; Tue, 14 Jul 2020 07:03:09 +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 887C8221F9 for ; Tue, 14 Jul 2020 07:03:09 +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="joF8Y/Gi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 887C8221F9 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 3FD466E8F8; Tue, 14 Jul 2020 07:02:32 +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 2C3A66EBC6 for ; Fri, 10 Jul 2020 09:26:11 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id j4so5186000wrp.10 for ; Fri, 10 Jul 2020 02:26:11 -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=joF8Y/GicfhYL8oSuhK490OvHX+3VzCXNwByiLydKiRvzQ8Pijr8y0OoMbaJTBEp3a OeghOfb0fzHI7I25C71ky1GTo0Qq35xHC/zPnFG6Ume0tbrLHYKSK0EnN94LwAE7etGO 9yZDXbSEvsTKUR1zln21Cor9Hguv1x6U16GdCFHEo4Y9ysCgcUCzjAfgNBYXAVyWsAZh VIzC79lrQexvzhm4rX1ZUjP5IJZTib8l+JkG1K7+s5VXTF4XRhpJqtkLmpo0AqRvnkoB QRUaSL+eehYEgCPUGf/uy/FA+8CiSabpi8QNvW0lle6Ft1YnAsvbDZ4963UOVg/zky25 46MA== 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=J/qHluJdblWSKU4pWznDswuQAQWVCRPY/OiTdf5ipswomt/ENMTrID0Kzy9X+YJ/wW xEHmaeqzD928AGG/RW3G42RaxRdRznVwoMdUpeKO6WOqc4WQAPmli8nrL402Y0EAkfdi gQ2Me0KyVV8owiRuu2rKWnEox3hXN01TMhzkI0Jb0QoE1PmuQTJbW0dpgX+OIEx2hnpx K3Nlef2LauTvTxxxeO+tESZpBanaG0Nr/KQL1Ljans9XHXtT2fnBv/Rnv1h7xZsUIVlR knX0NALTz2mpA9sfPTIJH+TGHqfK84Sqxw8CjXLeFpFg7SlD91ApMdOWQ/JDVVxcDDsF MT+A== X-Gm-Message-State: AOAM532RAnRD+ltFRpeEiEg+VXLRsoLkCLgrgmWfh1XSSYl2+1tTYfBG d0PTggu/tSV7vDdyb3IdAkM= X-Google-Smtp-Source: ABdhPJyfpqa0BGTWzUtWGqgYjvoSu1DHtTUy+/NrLOOAX+svDx5rdF8+T0WttUQmSLlHXPQJgXOMfQ== X-Received: by 2002:a5d:44c7:: with SMTP id z7mr72022276wrr.226.1594373169731; Fri, 10 Jul 2020 02:26:09 -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 h23sm8179559wmb.3.2020.07.10.02.26.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 02:26:08 -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 v4 14/14] [DO NOT MERGE] arm64: dts: allwinner: force GPU regulator to be always Date: Fri, 10 Jul 2020 11:25:48 +0200 Message-Id: <20200710092548.316054-15-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710092548.316054-1-peron.clem@gmail.com> References: <20200710092548.316054-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>;