From patchwork Sat Jul 4 10:25:22 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: 11645015 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 4B12B912 for ; Mon, 6 Jul 2020 07:19:35 +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 2923E2070C for ; Mon, 6 Jul 2020 07:19:35 +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="LLw6z/lP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2923E2070C 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 2B9C26E25A; Mon, 6 Jul 2020 07:19:19 +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 EC8D889711 for ; Sat, 4 Jul 2020 10:25:44 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id a6so35320854wrm.4 for ; Sat, 04 Jul 2020 03:25:44 -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=3PPcg5UlBRq0w4LR6ro2v8Q7Hq7d6jVFUN9WJytznf0=; b=LLw6z/lPBPk9eRudhoD2GhCQN2yf6/vRH7B9bzbbvt2rZyBFg8i4afsacJl2VCxxyc MU0WnqLFBci4J72OOA4qlyc0wdPBMIWoIZ9ReADOe4aljTU0XwPrvP8EC8hqKHZCDzgU C2K/kDDkHUVzv91aW+wkI2ttYeiEox+KJyE1GtTxCjFXZI8K4FhT0hgP1X5aSi/YapAq 2uwI6rtvxeqQT0mXOj0Nqc1+Igpxur2KwJVPbvxg1ATtPzz2yWaM1M9kTm+CoP9c9f6n m92vefWCiZ4APg7m/P4884EKsdpJoSfnZ5EAY9SQyjyovpc0FR3mol9XeEm2PfAhyxs/ cbyg== 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=3PPcg5UlBRq0w4LR6ro2v8Q7Hq7d6jVFUN9WJytznf0=; b=FUMchqA2wSqC7ET3gCuI1F3cKbpZebZ6Gd/htgVj+3UD6CwqwwLhK7/uFyogaGSXcM MiL/XBDhkyfO+ZkEHbqtFrUw3Ntj5Ffketf+xXAUGfdfiAiWZAKBB4GsDjdml0QTPxGL pgv8DNe3gCkrvbWGeOYUd0rF1Bd6mHVJIHI0MUNHijLOn9nfuDc7HKox0/LmZPjX5RvC E4LGHCgQv1nDCnMmMMWstSK8Wmz9EdjhC4uKt3PCMAvGs2SiVi9sAasLxRh/hwkJHc8H pU85fpkjBbLI7kN7qBAZ/B3mokJeNmBen23mGdiriP2Q+Bx97tfBP5Rqlyy7chb2wvIy sUhQ== X-Gm-Message-State: AOAM530Vl/lVb2d5BllxHioyvdf7uHTco5/oKawHQVmD1H9CBzYbCRwC 88qG8UjsttVAsM1pltjPE3M= X-Google-Smtp-Source: ABdhPJwgyjK4HfdOdlAHjlrwJp3kauA7Q5SEnSmInR4v0bMUWpQskG8gyIQp4x8u4GgxMvdShnulTQ== X-Received: by 2002:a5d:4a45:: with SMTP id v5mr40632842wrs.228.1593858343437; Sat, 04 Jul 2020 03:25:43 -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 g14sm16421428wrm.93.2020.07.04.03.25.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 03:25:42 -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 v2 01/14] drm/panfrost: avoid static declaration Date: Sat, 4 Jul 2020 12:25:22 +0200 Message-Id: <20200704102535.189647-2-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200704102535.189647-1-peron.clem@gmail.com> References: <20200704102535.189647-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 06 Jul 2020 07:19:17 +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. Signed-off-by: Clément Péron Reviewed-by: Steven Price --- 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 Sat Jul 4 10:25:23 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: 11645083 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 0F63E13B4 for ; Mon, 6 Jul 2020 07:20: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 E1E872073E for ; Mon, 6 Jul 2020 07:20:27 +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="hS2gSZNY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E1E872073E 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 456856E32F; Mon, 6 Jul 2020 07:19:31 +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 CF37B89711 for ; Sat, 4 Jul 2020 10:25:45 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id o11so35334205wrv.9 for ; Sat, 04 Jul 2020 03:25:45 -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=2uyp/MfaDITohcGBEN+pDw23B/gCn7tCuAyxbyBm56M=; b=hS2gSZNYwy/ZY2DBi6VycIP0XgCiAQvLzQbonhggp0zl69dzXQxeTngj314MAY2pBO YVyBsVuJg/sTryjpXZHBKHVES/nVJgsiPhRuN4LxZJSOQDPLjuyR9fPyn1LxXxjnXfTS yaTJh/daGv7gV/5UmAfQYI/c/gMep45swriGx6RKB5S0axtuK6JXWfve3XrS1s/xYc+Y gEWA5yxWrgxL1a0KHfyJQUNllGNjmtbr+WGwQ6Wivy56IMl4I9NPFnms/ksB8xWO0Kpe wc+IcTtXVvg++aoFbv8Fw807+90zvO50EtDWCZr4phVpt0Y7ARzG+jE/xYNDrRQHBUh9 MAkQ== 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=2uyp/MfaDITohcGBEN+pDw23B/gCn7tCuAyxbyBm56M=; b=FiRlnK8DpGQI/Z9BLB1u7QAE2J+AEopXiZEDgrJsLd6m7kOKyVzeTlpRp51tDZcWzP orE1Z/ewBhb0bqvQzpHCdu4+Pj6n8c/vM3GGHT57XR9EKV5uJOo5E0eMnDkh/3ehB4dR +9notb/reHNX6GYeSWOS7Kl8Z4zt2S/IOiJ/ccDetOPRNaLnr8VB6ggq5JoijZC9JjxY mFcicHvs+RVDA1IQOS1L+eD2atnE3QzTpedpEIs3sEs5i1TOqQCMPX47sB2nyj32JaJj DAIqfUcWnPWuEtPTfI+6j7nMoMyLSuZaNe0jycymsM0gb7NTq2qaTrOj+Hmj0VR9XyZ2 wGig== X-Gm-Message-State: AOAM531pd7/WT8/kRTI3K/c+NYH4U+SyaspM3crOVj681s/kyFFApW6a zauqlkGbaTLlg0PkXdCanMo= X-Google-Smtp-Source: ABdhPJwDC6OrmJ3KyitbYyv9GGaSuSJ8BHvwjptu2GIXtAgJx6HO9WktHkuYPp8IujxLo+KSXAhw0g== X-Received: by 2002:adf:8091:: with SMTP id 17mr28205914wrl.13.1593858344483; Sat, 04 Jul 2020 03:25:44 -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 g14sm16421428wrm.93.2020.07.04.03.25.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 03:25:43 -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 v2 02/14] drm/panfrost: clean headers in devfreq Date: Sat, 4 Jul 2020 12:25:23 +0200 Message-Id: <20200704102535.189647-3-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200704102535.189647-1-peron.clem@gmail.com> References: <20200704102535.189647-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 06 Jul 2020 07:19:17 +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. Signed-off-by: Clément Péron Reviewed-by: Steven Price --- 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 Sat Jul 4 10:25:24 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: 11645059 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 8581413B4 for ; Mon, 6 Jul 2020 07:20: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 63A6E2073E for ; Mon, 6 Jul 2020 07:20: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="VVl0MBp7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 63A6E2073E 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 957FE6E301; Mon, 6 Jul 2020 07:19:29 +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 DF9EB89E8C for ; Sat, 4 Jul 2020 10:25:46 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id s10so35270877wrw.12 for ; Sat, 04 Jul 2020 03:25:46 -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=QLa/udBRiowVJ35/Uw/nPH/NJx9A1pXdMfcVlQ9GEAU=; b=VVl0MBp7pBir+NBNWsZUpHtqsOKb3OiYuCBScYawkUgbIas/8oGM1B+TfZ0PeoVTgg 3DbA4QlV6xV0+pav9N2+A+rgTrMxGSX3Zqk6WwqFWlAkmllNsI+OCNhmWZtCK0yl5Y+G q6r45D+mJVbM+Y0T3aKhGpVEPFwNbz/IUP93462kW+2pAJVhbiM4MAoIim34p3zAbDdP OCceF0g7rhBkKYnIAO7CQRkc6KuHG6KePJfWeNDYbUaKzr5y5ap9T7Pn9mL/5l1DZ+zM beJwPvMKoPGmXYzAXXg2umCgf9U3vbu81G1kYaGLkAAeFMBCaPX/qe/6tiUbucFVF8wd 5wsg== 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=QLa/udBRiowVJ35/Uw/nPH/NJx9A1pXdMfcVlQ9GEAU=; b=J0p54z8WjPcmtcYXbo1eR90LeSZgIUm8QCt29zI6fAQkYNDV6F6klGu0iMqvDYyAsZ MR9BvdKzhxIZ3Aw2TwVr29EH0+MBLllJw8ey7LoOeSlqB+gey7uFf4fq2bQjGkezPYFg CzL/iSQN0S+EroJxNGMFuoCU5Y7fHtkuAQTV5e+UOmms2nGV8cgOCi0DNvcorgyqZH7A vTLMNmpC2Spov+TYl3kzwszS0BRNAp1A9kTPDAqrJ2VgBclr+k6kb2+MmGT0hyaHluGb gpHYSw3gwk4gdxQdYM3FcnoVIFbdLid4TUcFMdGY5l7uxdi+pU/hvivp/1QqUq3h1Cgo UP/Q== X-Gm-Message-State: AOAM533Nba1FW4TMQ91ZwZCHB6DfYs9WdO1qlwff9GcfPd4C18gWPqse VpnNhh73cqXFSlgOqxVKUwY= X-Google-Smtp-Source: ABdhPJzDuEfCwuvlJkpmWNd1MaGX1GIjG8W6x5PL/vM3PbaH17/Rs5W3IFG15toS4gEpArJKEqxkUQ== X-Received: by 2002:a5d:5706:: with SMTP id a6mr5446186wrv.328.1593858345457; Sat, 04 Jul 2020 03:25:45 -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 g14sm16421428wrm.93.2020.07.04.03.25.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 03:25:44 -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 v2 03/14] drm/panfrost: don't use pfdevfreq.busy_count to know if hw is idle Date: Sat, 4 Jul 2020 12:25:24 +0200 Message-Id: <20200704102535.189647-4-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200704102535.189647-1-peron.clem@gmail.com> References: <20200704102535.189647-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 06 Jul 2020 07:19:17 +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. Signed-off-by: Clément Péron Reviewed-by: Steven Price --- 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 7914b1570841..63e32a9f2749 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 Sat Jul 4 10:25:25 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: 11645089 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 EBD5713B6 for ; Mon, 6 Jul 2020 07:20:33 +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 CA51920774 for ; Mon, 6 Jul 2020 07:20:33 +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="Sowfu0LC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA51920774 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 AB9F56E356; Mon, 6 Jul 2020 07:19:32 +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 08A9A89E8C for ; Sat, 4 Jul 2020 10:25:47 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id 17so36477631wmo.1 for ; Sat, 04 Jul 2020 03:25:47 -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=BeNdffpPmYnmhm02KtRcgQ/SrqRpQJMfHL7+M9hoCsI=; b=Sowfu0LC8UqSHkxtyX9RUMFBW7jW2vzo8CVJTB4NkbaRHl4opgX23d1qNBr83m2Wa6 mIN56Os/DPM+sFRnf3Zz8Cfvos4lTjsUi666vJK31J4WrOi8r+c/mXkLKvvJqu53q+8H g/EtJwj+8+G389BI/BhC0Zo+Igt0xSRnz+f7wWRVbJlTaS5kZiUWrYIXmAf7J94G8PWi C9R6XNvMjHEIp5ObrHB9OquDQORqCs34ydO+eMVcEy6+J+463RDdQ+W1b04v1jRi1Anj JFtyaa9NpckmvpgTr5D4loBepY58wqXOC75znzvWKgfvRX6Kuz3H9Eo414JvyrJjeFRS QJWQ== 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=BeNdffpPmYnmhm02KtRcgQ/SrqRpQJMfHL7+M9hoCsI=; b=CgWrYmt6XVyX/Iz8HQyxAtOQb8w116VIQSbkUNcMb+3N41bEH+3BRjmy+wMPmxyWOo gTPDvYLzgtPIZEpGa6YcsPOWP+wSFQplqaQeQmQAIgPDCuWoftgNYFpr3YDeqeE9UhHY p1EEMou90JCrXVUnPT4rUwNu9QCTIvGxDlffczRpziSZq6ot8OL7Axvh47wO1eRGLmCf 27kWuKKFzgZefLPKvlK2ucJ8FdEwXrWWiwwuL8IXV48bk9upJZtwO8TgL9wXYxGZUicP AQNoVKiVD4mBAwewBesOfOjemNh2h7pV86ztgfQStvIRMOzDIeDG/PUY7hmTdlZEQGXQ s92w== X-Gm-Message-State: AOAM533IbL9GwzKFMhXBEjnOnk0nt3D8y+JHDbq6yEqQY3m/Yt4W3y2K ImAHXNU2n2vzKNQjtiG11vU= X-Google-Smtp-Source: ABdhPJxnKFaXi7VkT/L9f/V1duxJLFFKA5PDg/KP77cyDWKIKdj67y6TiKIVWPMVl+xxo3nHnUYQGA== X-Received: by 2002:a1c:23d0:: with SMTP id j199mr41750804wmj.12.1593858346494; Sat, 04 Jul 2020 03:25:46 -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 g14sm16421428wrm.93.2020.07.04.03.25.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 03:25:45 -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 v2 04/14] drm/panfrost: introduce panfrost_devfreq struct Date: Sat, 4 Jul 2020 12:25:25 +0200 Message-Id: <20200704102535.189647-5-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200704102535.189647-1-peron.clem@gmail.com> References: <20200704102535.189647-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 06 Jul 2020 07:19:17 +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. Signed-off-by: Clément Péron Reviewed-by: Steven Price --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 76 ++++++++++++--------- drivers/gpu/drm/panfrost/panfrost_devfreq.h | 20 +++++- drivers/gpu/drm/panfrost/panfrost_device.h | 11 +-- drivers/gpu/drm/panfrost/panfrost_job.c | 6 +- 4 files changed, 66 insertions(+), 47 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index df7b71da9a84..962550363391 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -10,23 +10,23 @@ #include "panfrost_device.h" #include "panfrost_devfreq.h" -static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev) +static void panfrost_devfreq_update_utilization(struct panfrost_devfreq *pfdevfreq) { ktime_t now; ktime_t last; - if (!pfdev->devfreq.devfreq) + if (!pfdevfreq->devfreq) return; now = ktime_get(); - last = pfdev->devfreq.time_last_update; + last = pfdevfreq->time_last_update; - if (atomic_read(&pfdev->devfreq.busy_count) > 0) - pfdev->devfreq.busy_time += ktime_sub(now, last); + if (atomic_read(&pfdevfreq->busy_count) > 0) + pfdevfreq->busy_time += ktime_sub(now, last); else - pfdev->devfreq.idle_time += ktime_sub(now, last); + pfdevfreq->idle_time += ktime_sub(now, last); - pfdev->devfreq.time_last_update = now; + pfdevfreq->time_last_update = now; } static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, @@ -47,30 +47,31 @@ static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, return 0; } -static void panfrost_devfreq_reset(struct panfrost_device *pfdev) +static void panfrost_devfreq_reset(struct panfrost_devfreq *pfdevfreq) { - pfdev->devfreq.busy_time = 0; - pfdev->devfreq.idle_time = 0; - pfdev->devfreq.time_last_update = ktime_get(); + pfdevfreq->busy_time = 0; + pfdevfreq->idle_time = 0; + pfdevfreq->time_last_update = ktime_get(); } static int panfrost_devfreq_get_dev_status(struct device *dev, struct devfreq_dev_status *status) { struct panfrost_device *pfdev = dev_get_drvdata(dev); + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; - panfrost_devfreq_update_utilization(pfdev); + panfrost_devfreq_update_utilization(pfdevfreq); status->current_frequency = clk_get_rate(pfdev->clock); - status->total_time = ktime_to_ns(ktime_add(pfdev->devfreq.busy_time, - pfdev->devfreq.idle_time)); + status->total_time = ktime_to_ns(ktime_add(pfdevfreq->busy_time, + pfdevfreq->idle_time)); - status->busy_time = ktime_to_ns(pfdev->devfreq.busy_time); + status->busy_time = ktime_to_ns(pfdevfreq->busy_time); - panfrost_devfreq_reset(pfdev); + panfrost_devfreq_reset(pfdevfreq); - dev_dbg(pfdev->dev, "busy %lu total %lu %lu %% freq %lu MHz\n", status->busy_time, - status->total_time, + dev_dbg(pfdev->dev, "busy %lu total %lu %lu %% freq %lu MHz\n", + status->busy_time, status->total_time, status->busy_time / (status->total_time / 100), status->current_frequency / 1000 / 1000); @@ -91,6 +92,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) struct device *dev = &pfdev->pdev->dev; struct devfreq *devfreq; struct thermal_cooling_device *cooling; + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; ret = dev_pm_opp_of_add_table(dev); if (ret == -ENODEV) /* Optional, continue without devfreq */ @@ -98,7 +100,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) else if (ret) return ret; - panfrost_devfreq_reset(pfdev); + panfrost_devfreq_reset(pfdevfreq); cur_freq = clk_get_rate(pfdev->clock); @@ -116,53 +118,59 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) dev_pm_opp_of_remove_table(dev); return PTR_ERR(devfreq); } - pfdev->devfreq.devfreq = devfreq; + pfdevfreq->devfreq = devfreq; cooling = of_devfreq_cooling_register(dev->of_node, devfreq); if (IS_ERR(cooling)) DRM_DEV_INFO(dev, "Failed to register cooling device\n"); else - pfdev->devfreq.cooling = cooling; + pfdevfreq->cooling = cooling; return 0; } void panfrost_devfreq_fini(struct panfrost_device *pfdev) { - if (pfdev->devfreq.cooling) - devfreq_cooling_unregister(pfdev->devfreq.cooling); + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + + if (pfdevfreq->cooling) + devfreq_cooling_unregister(pfdevfreq->cooling); dev_pm_opp_of_remove_table(&pfdev->pdev->dev); } void panfrost_devfreq_resume(struct panfrost_device *pfdev) { - if (!pfdev->devfreq.devfreq) + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + + if (!pfdevfreq->devfreq) return; - panfrost_devfreq_reset(pfdev); + panfrost_devfreq_reset(pfdevfreq); - devfreq_resume_device(pfdev->devfreq.devfreq); + devfreq_resume_device(pfdevfreq->devfreq); } void panfrost_devfreq_suspend(struct panfrost_device *pfdev) { - if (!pfdev->devfreq.devfreq) + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + + if (!pfdevfreq->devfreq) return; - devfreq_suspend_device(pfdev->devfreq.devfreq); + devfreq_suspend_device(pfdevfreq->devfreq); } -void panfrost_devfreq_record_busy(struct panfrost_device *pfdev) +void panfrost_devfreq_record_busy(struct panfrost_devfreq *pfdevfreq) { - panfrost_devfreq_update_utilization(pfdev); - atomic_inc(&pfdev->devfreq.busy_count); + panfrost_devfreq_update_utilization(pfdevfreq); + atomic_inc(&pfdevfreq->busy_count); } -void panfrost_devfreq_record_idle(struct panfrost_device *pfdev) +void panfrost_devfreq_record_idle(struct panfrost_devfreq *pfdevfreq) { int count; - panfrost_devfreq_update_utilization(pfdev); - count = atomic_dec_if_positive(&pfdev->devfreq.busy_count); + panfrost_devfreq_update_utilization(pfdevfreq); + count = atomic_dec_if_positive(&pfdevfreq->busy_count); WARN_ON(count < 0); } diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h index 0611beffc8d0..0697f8d5aa34 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h @@ -4,13 +4,29 @@ #ifndef __PANFROST_DEVFREQ_H__ #define __PANFROST_DEVFREQ_H__ +#include + +struct devfreq; +struct thermal_cooling_device; + +struct panfrost_device; + +struct panfrost_devfreq { + struct devfreq *devfreq; + struct thermal_cooling_device *cooling; + ktime_t busy_time; + ktime_t idle_time; + ktime_t time_last_update; + atomic_t busy_count; +}; + int panfrost_devfreq_init(struct panfrost_device *pfdev); void panfrost_devfreq_fini(struct panfrost_device *pfdev); void panfrost_devfreq_resume(struct panfrost_device *pfdev); void panfrost_devfreq_suspend(struct panfrost_device *pfdev); -void panfrost_devfreq_record_busy(struct panfrost_device *pfdev); -void panfrost_devfreq_record_idle(struct panfrost_device *pfdev); +void panfrost_devfreq_record_busy(struct panfrost_devfreq *devfreq); +void panfrost_devfreq_record_idle(struct panfrost_devfreq *devfreq); #endif /* __PANFROST_DEVFREQ_H__ */ diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h index c30c719a8059..2efa59c9d1c5 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.h +++ b/drivers/gpu/drm/panfrost/panfrost_device.h @@ -13,6 +13,8 @@ #include #include +#include "panfrost_devfreq.h" + struct panfrost_device; struct panfrost_mmu; struct panfrost_job_slot; @@ -107,14 +109,7 @@ struct panfrost_device { struct list_head shrinker_list; struct shrinker shrinker; - struct { - struct devfreq *devfreq; - struct thermal_cooling_device *cooling; - ktime_t busy_time; - ktime_t idle_time; - ktime_t time_last_update; - atomic_t busy_count; - } devfreq; + struct panfrost_devfreq pfdevfreq; }; struct panfrost_mmu { diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c index 63e32a9f2749..a67f3eac6a58 100644 --- a/drivers/gpu/drm/panfrost/panfrost_job.c +++ b/drivers/gpu/drm/panfrost/panfrost_job.c @@ -155,7 +155,7 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js) } cfg = panfrost_mmu_as_get(pfdev, &job->file_priv->mmu); - panfrost_devfreq_record_busy(pfdev); + panfrost_devfreq_record_busy(&pfdev->pfdevfreq); job_write(pfdev, JS_HEAD_NEXT_LO(js), jc_head & 0xFFFFFFFF); job_write(pfdev, JS_HEAD_NEXT_HI(js), jc_head >> 32); @@ -415,7 +415,7 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job) } spin_unlock_irqrestore(&pfdev->js->job_lock, flags); - panfrost_devfreq_record_idle(pfdev); + panfrost_devfreq_record_idle(&pfdev->pfdevfreq); panfrost_device_reset(pfdev); for (i = 0; i < NUM_JOB_SLOTS; i++) @@ -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 Sat Jul 4 10:25:26 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: 11645079 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 9BB4C13B4 for ; Mon, 6 Jul 2020 07:20: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 772572073E for ; Mon, 6 Jul 2020 07:20: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="HydICvJU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 772572073E 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 E34E26E35F; Mon, 6 Jul 2020 07:19: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 18D976E3F7 for ; Sat, 4 Jul 2020 10:25:49 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id b6so35298220wrs.11 for ; Sat, 04 Jul 2020 03:25:49 -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=OkGU7R40AthO2TACaX1LtXYqx5KDs3cB/We4L7vR8bk=; b=HydICvJUK/LGVZcnkEFXBnqKLswqIa68JJEBXkvuz8f9/2vj5+AjOrUgOOWT1clw4R I8/tz84KmvQnIGzuBr2JUX10kPAiueZiDbfxuD/oCcvVVlvKaaKHuT+mqEUxv7CAIiHc ZhwtxNvbwnJDR2NL10gkuTxwbs7gFpGncr+l8/wWThJTL8mZJw9aALNLoZLsZgQsH5TZ W45z95tCgP6wl/ilBJmscu/8oMrtOfPbbbWrkPrV0XASnuwrd0gZ5H6++RmvW04KfMW3 Tv5q+63//1komVkpqPbFCKTeXPlbkG9agUx9+OqsZS60RFYM1/6l0lcX+Eb4SNr7dHbH E6Qw== 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=OkGU7R40AthO2TACaX1LtXYqx5KDs3cB/We4L7vR8bk=; b=mSb1xey/YujxIvZtvmpnqUzfN2iQBiFwo8EsmQL2xvpcEniWTDrGaFfIZNVpYhSOtu 3Sv//1BH23pMmk40Tn24jULuU6EFFzLnGpsANjTSvFWZAt+LSbolQOy6suvnoyDSs5AE YZc6AJXIHuCVDCebknUPZ26qQWakr4kO7SuDeIdxVIw+WWU3epQmabZDTHI4HA7wVl1z pjHGTpiY5UBhFTUPgFhJn6c0b0u4Wh5BWOloVD5oEnmk8joeCgqjaZeAKU3yx+ouUQ9q Sl8nsGwCDvyhId7vpOC24dNJzpqBvcWWTFugfGfzndY9wZd3ZKPDHwGHJdDPUZTpghVM iXJw== X-Gm-Message-State: AOAM533jW0309yaZeYlTJtZ0wBPBpQTBPph7KgAdTXYHPgPmy1IkaWQr 6VeNSPYcbZ39sdvi4SiUNY0= X-Google-Smtp-Source: ABdhPJx6MzIcCKDpWG3DM2Je7NIa+Lu0rqLChPAdo146B9pr6L4ywTlTrfs95aBCFwbtJpfnPzR6jA== X-Received: by 2002:adf:82b8:: with SMTP id 53mr43772293wrc.172.1593858347670; Sat, 04 Jul 2020 03:25:47 -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 g14sm16421428wrm.93.2020.07.04.03.25.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 03:25:46 -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 v2 05/14] drm/panfrost: use spinlock instead of atomic Date: Sat, 4 Jul 2020 12:25:26 +0200 Message-Id: <20200704102535.189647-6-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200704102535.189647-1-peron.clem@gmail.com> References: <20200704102535.189647-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 06 Jul 2020 07:19:17 +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. Signed-off-by: Clément Péron Reviewed-by: Steven Price --- 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 Sat Jul 4 10:25:27 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: 11645049 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 E9F9813B6 for ; Mon, 6 Jul 2020 07:20:03 +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 C7EF92070C for ; Mon, 6 Jul 2020 07:20:03 +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="qNFNgYAd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C7EF92070C 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 34D3D6E2B8; Mon, 6 Jul 2020 07:19:28 +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 471EE6E3F7 for ; Sat, 4 Jul 2020 10:25:50 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id z2so13055973wrp.2 for ; Sat, 04 Jul 2020 03:25:50 -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=UtYpmlK0sBLIGu+jD6jSIfVxQzKUKkc64VLLUVnW2E0=; b=qNFNgYAd58cWTopWsCnVpN6KF4hgB35zsvk6rweB2geap+2a/hZHA4uMl6E/nhyVcz 4ypnl0H+eZ43sMPKGNvmbbssEXLnVdNP87/3ePmLXVN3fjJ7dBtESN0y6eZgz/eW5wmF D8m38BQ7KY6+zDcy3BkKBdVqRbWTVtxZd2KIOEpCgimRHWJhRsacbK1tBOENgfk557hF BOagm7Vf7N1RO3OOeVg5Ld4aYv490y6kKN94T2AjBJ1Cw/Q0c8EKUkwbKV+50Gyz6zZu zVZrjvDEvR66R7ATN6aQmSk1hr3Iw9rizpE1dlrX3vUob8+6+iU7sgzkRYRBYnzOke+h NsjQ== 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=UtYpmlK0sBLIGu+jD6jSIfVxQzKUKkc64VLLUVnW2E0=; b=i5YNudSeB9qpsnY28cAWqCcbqxibj15BXOJoYl6GJsGYVY+aoTAZl4LruUrCC6lVqI bOwHYqK5pQT48UO7nqSXzASr4h3Z7iF0Aauan7kr5sl37YeGKQdGcBTtEJ0zWjUHWbCD +6gkAtaN9pTNDXh95UqAHdh5eD8BcYio4LGQ5RHZOqYUXedKZ1lF80cE9Mv2ZMP+Vhvn gitX7Bq0D8T8Bf6TrqUlvS/Fld6a2S2tfj5qsUZBat+CRyaFxtFppqCcRBC8mtS8wDOz rzDjR32Jev1edkx3rUizdGm1d1We0FzLvrtwX3SA4lsotZBEtQ76snwV1LgDzyJHWj5E XmfQ== X-Gm-Message-State: AOAM533Fyoh8HPerglUJvSSbHA8wqi20jBXMuU2Dnt5b4RlXSe/We3pD bNDzyZmtnCy4Ih77wjhiS1k= X-Google-Smtp-Source: ABdhPJy/tukX+K79X4Pugp0jciTOgHL2tsymvPVNBkXelV2FU7kvRasFKCl5O0QlvUUsoGSmQgxY2w== X-Received: by 2002:adf:fe4b:: with SMTP id m11mr39485996wrs.36.1593858348780; Sat, 04 Jul 2020 03:25:48 -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 g14sm16421428wrm.93.2020.07.04.03.25.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 03:25:48 -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 v2 06/14] drm/panfrost: properly handle error in probe Date: Sat, 4 Jul 2020 12:25:27 +0200 Message-Id: <20200704102535.189647-7-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200704102535.189647-1-peron.clem@gmail.com> References: <20200704102535.189647-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 06 Jul 2020 07:19:17 +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. Signed-off-by: Clément Péron Reviewed-by: Steven Price --- 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 Sat Jul 4 10:25:28 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: 11645021 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 398D7912 for ; Mon, 6 Jul 2020 07:19:48 +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 180EC2074F for ; Mon, 6 Jul 2020 07:19:48 +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="Yi3Q7Aum" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 180EC2074F 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 7C63C6E290; Mon, 6 Jul 2020 07:19:20 +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 5D4166E3F7 for ; Sat, 4 Jul 2020 10:25:51 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id f2so7342943wrp.7 for ; Sat, 04 Jul 2020 03:25:51 -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=ZTAD94SYmvrJ+EFhISqWY8vBWQR9v8s+XBZIL9+A5es=; b=Yi3Q7AumboBSbsek8DjWtlQ9c10SbTrXYjcMr+rBaAc4VHSqVM6IpfGf8cdW0VtY6W HD3FhPLO4DAnUDp+vpl1IiNzGQncT8eF2MvWK7LOcfqGQpQ6Lbi5946UXk8j2fadav0f RYw1OVPiiI8ipVovArVWNu5/Vqe6mVcYZ+oaZdTsFMJhhQBa78PbriKiG1TN4ZfyIGR+ RvISp9wqEPCLfOhV78e1wh/CZdlseUZnUwC0Mq24QTscVxu9LlrgUeduTFA8BgWUFZKD v6S9s6lGfmAU/5tMhnnAp9spVJLmQa9oNO/Vr3BYQQ0ctTpr8Uj8D2rbrAp7gTt3AvhD 2+Gg== 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=ZTAD94SYmvrJ+EFhISqWY8vBWQR9v8s+XBZIL9+A5es=; b=Tpfrlnsm97UepTCMgTW5iD+mTUggPBeFNpHuBY5XPKW8Qeoj75hvTvPybON6EF2ipJ d/DAWFXB1D4uyb3S012ha1uPrBq2aQOZwyECTXeD9++fSRNo3r27p56T91xN/LH7zZqv ul/5v1XJODS6OoerhCV1YQCPMyTqI5PSwcmC/SBJjmSL8+5saixOnBiijIHUvrPozKr4 XL2D39pgCYDInj40EPcckDgTg/i5yeF2xL2O8VUxISxMCAINRzFTjCmzklJ+w6DytpsW cMNX+c2itSMdPuUrKJ6xTH4nlk4W2qEh+MxDGE6bJ3CXXHjZkRMOkbDc9dylg+42DGfS 6Ihg== X-Gm-Message-State: AOAM530f38dJyixCWbn9gCsYlnvgIq4ZtgA2nCAGWubdrNV4zEIIqNBi M4/f25EnC0tfEEoCYeH5c1A= X-Google-Smtp-Source: ABdhPJykyG4asxyffWyKxljFdyjAyR9I1fXuAeS8wS1A/odEXdj7M78gsOEIXxbIcjmyVb3VUgKwUg== X-Received: by 2002:a5d:69cf:: with SMTP id s15mr29403010wrw.10.1593858349937; Sat, 04 Jul 2020 03:25:49 -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 g14sm16421428wrm.93.2020.07.04.03.25.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 03:25:49 -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 v2 07/14] drm/panfrost: rename error labels in device_init Date: Sat, 4 Jul 2020 12:25:28 +0200 Message-Id: <20200704102535.189647-8-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200704102535.189647-1-peron.clem@gmail.com> References: <20200704102535.189647-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 06 Jul 2020 07:19:17 +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. 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 8136babd3ba9..cc16d102b275 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.c +++ b/drivers/gpu/drm/panfrost/panfrost_device.c @@ -215,57 +215,57 @@ int panfrost_device_init(struct panfrost_device *pfdev) err = panfrost_regulator_init(pfdev); if (err) { dev_err(pfdev->dev, "regulator init failed %d\n", 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 Sat Jul 4 10:25:29 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: 11645055 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 1999B13B4 for ; Mon, 6 Jul 2020 07:20:08 +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 EC1A62075B for ; Mon, 6 Jul 2020 07:20:07 +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="EAmDMlJ2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC1A62075B 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 E07D16E2D6; Mon, 6 Jul 2020 07:19:28 +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 5F76C6E409 for ; Sat, 4 Jul 2020 10:25:52 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id f2so7342968wrp.7 for ; Sat, 04 Jul 2020 03:25:52 -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=czEmxOplWl/ihZz6Bt2jvlGMVXmPgT75PDRsU7SwMwA=; b=EAmDMlJ2JBtETZactBM4rssBiXrZdMLiMz4NLtV4BcqbwyFQ+4FHmSWTT+H9UUnma6 Kv006v35J0SQyn5EtFK1IJk8UrTApoDn5aGjcLvDx29gVwq91Sp5SJc7SyIkqJbDzML4 IIJhBmqkI48V/d7XpRxVnU+IfPNK0x+K0CagrQBQj7s8HM7f4OmOZk0+HNmMBN75/E4f g1cLMdruBt44KbJg8MsQ4EyBH2F5MKBJnewBZpvM9zykoSlOozdGuYjWCUEzTwpgBKUX ZRP0l2kVvEi7uFZmBEgNo60l9kf042FSOGb95ePnXSuuybeymS4gVK0SOiHg02uDV4GE PEgQ== 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=czEmxOplWl/ihZz6Bt2jvlGMVXmPgT75PDRsU7SwMwA=; b=YYn12KtCs1oBBc7jqCxeqk7Q5A7c6G+gabbVQx19THZj7L0mwxlWwcwgUyJoN1+Gyi n/kQelQsXPZ5hXX7z4HDquetnN65vMAqO61C8YeobHiKi1Dw07Nuc4rDS4rB+BIQ3IA2 /kuasZIzP7sxc2g13BIAcDodlqw+14bD/kS8OC4P2Vzz5khdBV269PhZSol8F9h2zWTg MiiaaWtwwm7oTfCAzG/PSCZANa9iyuc0UxNd4cD8Iaeqg7ALsfXqrsUHe/iwaIPF0MOO kHzfZNma8qPraf//UmktiTIPZifeCwLtamYNYx0RwEohjrvYKF36bPmACdBpYGu+fO4R pokg== X-Gm-Message-State: AOAM530OFUWZT6s6yqAIp6lHTdiS9KhHB5hVjJg7Rr1AJT3jIwRddZVU xc7aq6bh8+ZNzdQoTAtSaiQ= X-Google-Smtp-Source: ABdhPJw1psxKrWFiSaDxrj+otByubFEIFRvaF35q6qFjq4w+V4aYu2Yn5JF34Ax+AAtf9OBZdFGMqw== X-Received: by 2002:a5d:51ce:: with SMTP id n14mr40562723wrv.155.1593858351009; Sat, 04 Jul 2020 03:25:51 -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 g14sm16421428wrm.93.2020.07.04.03.25.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 03:25:50 -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 v2 08/14] drm/panfrost: move devfreq_init()/fini() in device Date: Sat, 4 Jul 2020 12:25:29 +0200 Message-Id: <20200704102535.189647-9-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200704102535.189647-1-peron.clem@gmail.com> References: <20200704102535.189647-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 06 Jul 2020 07:19:17 +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. 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 cc16d102b275..464da1646398 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.c +++ b/drivers/gpu/drm/panfrost/panfrost_device.c @@ -212,10 +212,17 @@ 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) { dev_err(pfdev->dev, "regulator init failed %d\n", err); - goto out_clk; + goto out_devfreq; } err = panfrost_reset_init(pfdev); @@ -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 882fecc33fdb..4dda68689015 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 Sat Jul 4 10:25:30 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: 11645077 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 DD19F13B4 for ; Mon, 6 Jul 2020 07:20: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 BAB2F2063A for ; Mon, 6 Jul 2020 07:20:20 +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="u895Asqn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BAB2F2063A 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 A60866E369; Mon, 6 Jul 2020 07:19: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 671066E409 for ; Sat, 4 Jul 2020 10:25:53 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id f139so36540035wmf.5 for ; Sat, 04 Jul 2020 03:25:53 -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=dEvAV3WC8gjOi8/db5UgonIFrnz7oP9M+fD1t4PD98A=; b=u895AsqnI++nW+ATsCD6BM53ooaKE7DfxiT5p2rrbYNdSijhTa2fQojXDTEIR7jYPF eDuyVN7haX4f7btL7FsYhYPvf+qtegwUjvvWWxU2a+3rlGHRajWGZnXWwldaiRQqcO/B 6cwLMKgC4aChrc/tG8Z2LdbCLvM1pN4OOfieirBaNfQULsq97lAy3uSGUYI0zExf/EMg /wEbPOoKEenrXogE201dj1V7BdCaolqxGGhSyJ1iuPRWAyWxco+8y7t9Zu17E/orMXei NVGn3grc7xb4aECQK6M7VAlQ2ylCejDxl//pNzxVP/BRXfjaXSD9afGlg/5+0dsGcO4q PdIA== 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=dEvAV3WC8gjOi8/db5UgonIFrnz7oP9M+fD1t4PD98A=; b=Gvjf+zuQgyi6RUyWMTPyEoYg7wDh+IdZbJ/t5TSjpTQ6lEtTq+YD2t2QNgEAcIwivQ Anb/G+TPlwMlWAh/NGEVZc7EsC9MP5pduGgqd+7tXILJXTnhM4vqZT/2DWlffPms7ue7 sfVaVty9KQIwkh9Pfi/nZCNJkKH3ntGpKgR4rTbZSg/Ir8ZmgBezKudx53xlyN1rCidf huwx1x/GHbSHGJ2KQPLsMstIqIVniK6Mk7PzA4HB9rUFQOkiaAelyhCrJQfWyBoFCQRq /WLWv+IP8/bjifUrKICqqIBJprsnHdzDifoAm1fdu+8kpVnIKHqvKYqGb9xfPfpmZXIc Typw== X-Gm-Message-State: AOAM532EFXwHECvm3dPX2+pwYxoFS80zie+xXAFxXLmF+sM4cgZYvKuQ HRxKFXTGCmDtYLK5EFZBbUA= X-Google-Smtp-Source: ABdhPJxPyjX8E1s13IMa5BpsRPWoAPS1pYxySTMxZT0pEmMWQ3CcE7UVh59cuHmumr5QkfbuhHRayw== X-Received: by 2002:a1c:18e:: with SMTP id 136mr10189686wmb.93.1593858352040; Sat, 04 Jul 2020 03:25:52 -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 g14sm16421428wrm.93.2020.07.04.03.25.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 03:25:51 -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 v2 09/14] drm/panfrost: dynamically alloc regulators Date: Sat, 4 Jul 2020 12:25:30 +0200 Message-Id: <20200704102535.189647-10-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200704102535.189647-1-peron.clem@gmail.com> References: <20200704102535.189647-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 06 Jul 2020 07:19:17 +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. Signed-off-by: Clément Péron Reviewed-by: Steven Price --- 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 464da1646398..0b0fb45aee82 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]; @@ -117,8 +119,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 Sat Jul 4 10:25:31 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: 11645069 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 68F4A13B4 for ; Mon, 6 Jul 2020 07:20:16 +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 4778D2063A for ; Mon, 6 Jul 2020 07:20: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="XhrFjlEY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4778D2063A 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 258046E2E4; Mon, 6 Jul 2020 07:19:29 +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 88F796E40B for ; Sat, 4 Jul 2020 10:25:54 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id f7so32305724wrw.1 for ; Sat, 04 Jul 2020 03: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=+ekmXxgc2CJLhUtRJfX6RJbgFcgiu4O269w7FRXLrjM=; b=XhrFjlEY5PPJ5atPvo98rUZh1ZQWnHm5Ls6NPL6ZTnGWOAxgiXwXfUtKj4vFQXEkZ1 sYO5UqWCjprLeI5XG5bD0nfsyMeBD8uZLIaFiE7N5XASwC6BW0zIXcnBBZ0v+wDNdt7P SIGro8XEPu8P2ii8FVA2HtRZ48opMJz8RZjXPrvdz4ceT5zPYOFuN7jHfBguQ8sOgFaC qDcKZJcoS+C/p/epqdy4cSkgQsD7dBnRa1JBYiYsmZQO1sfzS5Hyl45VzImUOvNxnX7l s0ysH9XHR4q+oEBTNOacdVKS54TI587vSIHnjltfSLJv7wd6ILU0ZdX+iqSBe1ck5uM2 eg6A== 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=+ekmXxgc2CJLhUtRJfX6RJbgFcgiu4O269w7FRXLrjM=; b=Fh/w/tecORSX/vGjN0u/yCl89wcLaqeEYDiLKcQ4pctkVl9kKJLQCWEl929XCatYrF Z4ltgR8BPeZ8kPIb9inLmA3E3Xqv/AoR5HnJqb51rfhqvBJH4v+tWUOrZPh8JxWehgyB hGSWByImlcoIRtexqQlGxWYBGfS5wWJ2qjGRpiT6T8pC0eaFqlhSN35hAfm3X4vbLYBR 100K5+2FhX3FX7HDyk5TMVcuv30J/PJzdz2POiZrRvKrdhN39Xc7OOXuwo9CK4CZ6r1o mAjAyxGxbdlcVNm8fdryK4VewTYy/QZRhLrtJqGkVPbK0top3jVM9qRKAguBX8J3uzlg cfsA== X-Gm-Message-State: AOAM532xiSoy5bpzAqz5AlDMYA/sVff+N9mMFn6KG1/asbKuIzmnMqYw wcLoHvuFWQjR6mNNMdJ0jv4= X-Google-Smtp-Source: ABdhPJy38Ca5rvU97m5F4CdQCK7nkRR1FB9ubCnok0fal6lPP07aDjaptGbQHLPIbee5P1rhdOSDWA== X-Received: by 2002:adf:ee4d:: with SMTP id w13mr11520166wro.245.1593858353105; Sat, 04 Jul 2020 03: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 g14sm16421428wrm.93.2020.07.04.03.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 03: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 v2 10/14] drm/panfrost: add regulators to devfreq Date: Sat, 4 Jul 2020 12:25:31 +0200 Message-Id: <20200704102535.189647-11-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200704102535.189647-1-peron.clem@gmail.com> References: <20200704102535.189647-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 06 Jul 2020 07:19:17 +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. Signed-off-by: Clément Péron Reviewed-by: Steven Price --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 19 +++++++++++++++++++ drivers/gpu/drm/panfrost/panfrost_devfreq.h | 2 ++ drivers/gpu/drm/panfrost/panfrost_device.c | 11 +++++++---- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index d9007f44b772..d1e3e9d00a48 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -93,6 +93,7 @@ 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; @@ -105,6 +106,19 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) spin_lock_init(&pfdevfreq->lock); + 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; + } + panfrost_devfreq_reset(pfdevfreq); cur_freq = clk_get_rate(pfdev->clock); @@ -153,6 +167,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 0b0fb45aee82..1b5fc9221828 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.c +++ b/drivers/gpu/drm/panfrost/panfrost_device.c @@ -223,10 +223,13 @@ int panfrost_device_init(struct panfrost_device *pfdev) goto out_clk; } - err = panfrost_regulator_init(pfdev); - if (err) { - dev_err(pfdev->dev, "regulator init failed %d\n", err); - goto out_devfreq; + /* OPP will handle regulators */ + if (!pfdev->pfdevfreq.opp_of_table_added) { + err = panfrost_regulator_init(pfdev); + if (err) { + dev_err(pfdev->dev, "regulator init failed %d\n", err); + goto out_devfreq; + } } err = panfrost_reset_init(pfdev); From patchwork Sat Jul 4 10:25:32 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: 11645071 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 C350113B4 for ; Mon, 6 Jul 2020 07:20: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 A1C3D2075B for ; Mon, 6 Jul 2020 07:20:17 +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="c6T23DJJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A1C3D2075B 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 DCA826E2D1; Mon, 6 Jul 2020 07:19:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by gabe.freedesktop.org (Postfix) with ESMTPS id C921E6E40C for ; Sat, 4 Jul 2020 10:25:55 +0000 (UTC) Received: by mail-wr1-x42b.google.com with SMTP id r12so35257092wrj.13 for ; Sat, 04 Jul 2020 03:25:55 -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=aa8te2AcMwPmqAg9uKOXlMlgp9vWL13NU2V3cR52oIU=; b=c6T23DJJiHs5BtAKmNutM8G+MKEe23gN/maB70SgfCaol8AfeQQ+G8TYIru7RAFnVe gykZWTU2QlbC2rnUKQ/HBeKg6xs9YsgBm40QwJ4zwhH7b6V/7Ao2HCNFemANB9rdpmz1 JGS92y/SEVnqf6Q069alN55283PDakjsnw6ojaeK8uFh2m9hWHymIla+yylDoYHDNT/J oXEdNQuVRJCH3VP1rH1BurCJaDG1gwBa5NraMYbPyV3H/2Y5auqTzHfV9RYBjfUEwO+T f57qbaQfqFsW5tAD7qITLW8NpanEznAi0SVdgUU+uetvWDuteTw9g9xAGH31Gb+MZ49G 3t3A== 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=aa8te2AcMwPmqAg9uKOXlMlgp9vWL13NU2V3cR52oIU=; b=F+5SCnOQT5G+DdvC5TVTfPof6UGDuzWSOgro5RY080YAvtE+C63ob+7oxvhkfqIKj9 0PkJO3wOU3M6jC/aQHddnB/LvnvqHzGpSdHkP4+c8OuONdC2yhFFPPs9BvrI+gGQbVYE xYWmHnhz9gX0Tzcc2rXXZowBNdazGxY+gXZF+mH65kbrHSHRAfRV2lbr2887ThQLAbnY /jgsXrwKyeo3sMJdpSNYiHCnzAyi/Qae9LNxeM2AfzbUiFZ1QoABD9wuAkBWNgEuUzh6 l5Hv+p89ebJKzy+yU1ZkmE+TtnGqGz8L956kvNbh452KwhzUpgnLJpwmpQ2ji10hDBw1 LzaQ== X-Gm-Message-State: AOAM531WhQ6ARah8D4seIUFUMwcoYCEYM3OGrNLpcF4Us+t/wnLA+v1b RzBdnet0LPgKjCU0XMDxVkw= X-Google-Smtp-Source: ABdhPJwTY8xk+AwUuvBq2SX6rifzkA/0NydoFJzAmeI9i+CYuQQd2tXt9uKF7RQQ7yyoYhGi5RfQZA== X-Received: by 2002:adf:e6c8:: with SMTP id y8mr42893726wrm.40.1593858354417; Sat, 04 Jul 2020 03: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 g14sm16421428wrm.93.2020.07.04.03.25.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 03:25:53 -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 v2 11/14] arm64: defconfig: Enable devfreq cooling device Date: Sat, 4 Jul 2020 12:25:32 +0200 Message-Id: <20200704102535.189647-12-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200704102535.189647-1-peron.clem@gmail.com> References: <20200704102535.189647-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 06 Jul 2020 07:19:18 +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. 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 883e8bace3ed..1b7f9ffdc314 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig @@ -501,6 +501,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 Sat Jul 4 10:25:33 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: 11645019 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 B6F12912 for ; Mon, 6 Jul 2020 07:19:46 +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 955F52070C for ; Mon, 6 Jul 2020 07:19:46 +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="OtcohPOv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 955F52070C 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 C71C06E265; Mon, 6 Jul 2020 07:19:19 +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 D5B8F6E418 for ; Sat, 4 Jul 2020 10:25:56 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id z15so24036551wrl.8 for ; Sat, 04 Jul 2020 03: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=ljYbPfikKidTyz4vCaRd3InFHHUQa8/wBp/13AuL7tw=; b=OtcohPOvXt2wkLQ8Gr+W1KKjsQooO/5qB9Qw8JWG4RNqLiqDxo/9dseNe3YnuskVz1 s7+RSXF88YSx0S6+WZ8nxtvazmNCAcDUDipl+5YPKdkS0Sj+UxAu+3DwQ69w7IWJNq/e OEn29d41euiV7DUJLQ+IsPKmiIoZaugWLz0hax5yM9jQ2D5MD9QIbuyu6fhXI3OLFifN A3oxh7V5aXwUq4ERKGIgHYaqepYNQSO+ryAMrM3CqymMBsQVRYGPBQ6PElR5bge+l0c9 +IDp464kLvagcPqwbTfP8MgY1W0ukcv19uHRk6Ya1lgRMXDV2XEaIfsvW39GtXFdUhOY 021A== 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=ljYbPfikKidTyz4vCaRd3InFHHUQa8/wBp/13AuL7tw=; b=K50OIxu5xkujjMxNQV06oQfyTRsk9STcYvPhL/6dAtm76uzQiI0IGbxphpQ9SQGoFy We0aDT0Vb+HXf0hf4ca/gOlU3ij3z3hILFSXgGlkyroyE/47Ni1dA+U1cWU/5k1qpYKu 6h7N485Jw/T6VzzEHVu8uUQfua8PVofC4m3QwfCCa2SjpTRzP0j29KFiRFlipYr6e+Nr WVYbapTjntNucvbOwSVKeFgaFg45ZD1h8CnY+CAsE4dL/RrP4J1MqnAfOn8Rlvu1YeFC CjBl5Zp1QwYmxAUxYuLcASb3Gkl5dHaCrhEjfG9AXTO60T51AsFj/xIxTaxuwHoedcLn 2ptA== X-Gm-Message-State: AOAM533tSFI0BKQInVsHWgEme+fRcGdtv23y5ExotqPxro7eE+Vgtpc4 JSBzoakuZ/nZMKLjQPL7ZkE= X-Google-Smtp-Source: ABdhPJyzbanNd720c5+6eFrmSAieB5pdrwV6bL2dAq30zpazgrsKSLmIJk9Tt8TYJ1H6eSrfY76sgw== X-Received: by 2002:adf:f34e:: with SMTP id e14mr40085606wrp.299.1593858355499; Sat, 04 Jul 2020 03: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 g14sm16421428wrm.93.2020.07.04.03.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 03: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 v2 12/14] arm64: dts: allwinner: h6: Add cooling map for GPU Date: Sat, 4 Jul 2020 12:25:33 +0200 Message-Id: <20200704102535.189647-13-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200704102535.189647-1-peron.clem@gmail.com> References: <20200704102535.189647-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 06 Jul 2020 07:19:18 +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. 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 78b1361dfbb9..8f514a2169aa 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi @@ -174,6 +174,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"; }; @@ -1012,6 +1013,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 Sat Jul 4 10:25:34 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: 11645097 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 5FE3113B6 for ; Mon, 6 Jul 2020 07:20:47 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3BBC72073E for ; Mon, 6 Jul 2020 07:20:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YJk9vSxe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BBC72073E 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 9B9576E2E2; Mon, 6 Jul 2020 07:19:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by gabe.freedesktop.org (Postfix) with ESMTPS id 00E3A6E418 for ; Sat, 4 Jul 2020 10:25:57 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id 22so34252941wmg.1 for ; Sat, 04 Jul 2020 03: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=XV7x1Z5zj5Wjg3tK4n9i9paBzVB6Q8ndZsAB3QS+Wh0=; b=YJk9vSxe5NhDgZFDHmcheGZlJww4ux80NP9cQd2gkxXxRkH2UhzJimhJGqI4CM2X2f jRDNT+bVpr0toyfx5Lv7tLOCzQBoWaY/FsLAyQ0O6I0+OdWI7+YI+LiTf/22WEfpTGNQ cfu9pKktCp+C5Do2vDPasFu4SzNW7SiYwiKsVoaJ4aL82YmNyS0vBtKrCYfxskSg5Hkt /U4TJs2tkW+nX0N+YpgfNLauTOZbfBTUu6qyTAv/+WeAY4xml1WptBbLSqGJhQSTrLBV rwr09ULZ2C0GNSkTf6F10J1S4bJTd72Oykl+ByOp5INRS+rzUsZQ0aApujfcKqZz16N9 GaVA== 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=XV7x1Z5zj5Wjg3tK4n9i9paBzVB6Q8ndZsAB3QS+Wh0=; b=UgoMWfsPjrZuXLSrs4EVeC7swHSaIR/kOonWbA4513lN6lyZa+MwC768fWCYQQyNUm mQeLQX0nHORvkGeRTAEY0iSYDPTiZNHpHKjOVpLPn+TnGt/kC0s2ccTou535UeoOLiST QPxRrg7Yn6V97D3BBzTbQp+BFdTNDYEVnRu1geD8a0dakzC1GkP9fTdgNJOLjcR+XmZp 9fLo63QVOocXj4xRVG72G3XAAdIN7b6BYxJqwZAdPlJE3nVtZnnHBMc+UW4SlBvLdMs1 7P8GJAECvdqThjeOAIhiojRzGf7eS38pU1LZOoOtADYGV5vTgwXn4/O/j7+41J3fft99 hbIA== X-Gm-Message-State: AOAM532NTspllWR5LrAdat/FxCU3gwv0g0sWmJ++QdCMyIdbN3tK+3/E 77kQ7yewIrCshPoObpmCW80= X-Google-Smtp-Source: ABdhPJyEqBogAJqlBS2lzYmp9Ca55PYUAmfvL4gpcqCMlxNsqnWTHMWole1Oam7OJve7VD9Th2kHrQ== X-Received: by 2002:a1c:9d96:: with SMTP id g144mr43273725wme.163.1593858356565; Sat, 04 Jul 2020 03:25:56 -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 g14sm16421428wrm.93.2020.07.04.03.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 03: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 v2 13/14] [DO NOT MERGE] arm64: dts: allwinner: h6: Add GPU OPP table Date: Sat, 4 Jul 2020 12:25:34 +0200 Message-Id: <20200704102535.189647-14-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200704102535.189647-1-peron.clem@gmail.com> References: <20200704102535.189647-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 06 Jul 2020 07:19:18 +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 8f514a2169aa..a69f9e09a829 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi @@ -174,6 +174,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"; }; @@ -1036,4 +1037,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 Sat Jul 4 10: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: 11645053 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 B958113B4 for ; Mon, 6 Jul 2020 07:20:06 +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 965F62073E for ; Mon, 6 Jul 2020 07:20: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="mV0As66A" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 965F62073E 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 DE4D16E312; Mon, 6 Jul 2020 07:19:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1110F6E3F5 for ; Sat, 4 Jul 2020 10:25:59 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id f7so32305831wrw.1 for ; Sat, 04 Jul 2020 03: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=DFfhRB3CIFp7+b9HYaYFBTlz+H/vZeZ2FswijDgFipc=; b=mV0As66Am/M4p3bN+Mk7zZSGHK6Mju2VuzevBcWkz9Cou17jszv2pO2QbbzwNeOaJa Sj4ucKGda4iIFmVg66SENMIA4Nbfixy5oLosZhwOeitQbZDVoybvi26g58zCQYS5gXw2 6dh3fItZTnjBK77c3iOLP61WoofeBUGqhcLdc/t7wx0skGuS2mxJIrY8kISVZm+L8o7C tGXSW/9ImyPQA+VxUKhnX0qKuyF/34WBMRYTRWe/sL6Xcdmf6fHgqnVCFZGLHk9XT/GU j5SfM/3tQsnIZ8PCqFOonlFh9u7dzJE9s+kyx4J0AxD4V15h+WK2V66gSig+S8+NfmIk x4vg== 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=eUHunzDmjMkA6PCR5upbB+ImeyNCumoWzBYWvLdiOHMBazyvQnfODsTEy2MFCwLMqK fqxuhJIVCJr6FERGIwNXhYFh6qg9Bd3RackwrIlSGlFSxZ1abeURseowdfDbSaki1g2B a4EOBLBNJnLINF+sg2S6adjbkHaZ0sqYXRU7Fogb5Oi4pEdEMaajqO4aKCPRtqputqSP HSr9iYT/YrH4FbgwBRHYna4MRUqNpT+JwSP8wBjnhvWbpe8WnWPyLMZmYRa4hQOyZPAN AENSeyFybRkUiv1DJrtw8hl0eRVSFJEa0JFDR5D5G5l1yg4XfOGIgeckSitCi6LiJBD/ 7iGw== X-Gm-Message-State: AOAM533FIQjyFYFWtyU3cF8nu6ZllpX/UZyzf7UNYCaFNnO2voA7Kn99 MOnHtg+o9JzYIAgB1IawaNU= X-Google-Smtp-Source: ABdhPJyBqdyjxO1QJ2Wkyp5nBh0YukoTPRY6UODWodbPokllpS3WEnTqIyCf9+af/s+NraJgatVQIw== X-Received: by 2002:a5d:420b:: with SMTP id n11mr40233460wrq.91.1593858357628; Sat, 04 Jul 2020 03: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 g14sm16421428wrm.93.2020.07.04.03.25.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 03: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 v2 14/14] [DO NOT MERGE] arm64: dts: allwinner: force GPU regulator to be always Date: Sat, 4 Jul 2020 12:25:35 +0200 Message-Id: <20200704102535.189647-15-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200704102535.189647-1-peron.clem@gmail.com> References: <20200704102535.189647-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 06 Jul 2020 07:19:17 +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>;