From patchwork Thu Jul 9 14:03:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= X-Patchwork-Id: 11655957 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 E396314E3 for ; Fri, 10 Jul 2020 07:53:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C0EFF207BC for ; Fri, 10 Jul 2020 07:53:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IFuRYrT9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0EFF207BC 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 D62886EBAD; Fri, 10 Jul 2020 07:53:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 97AAA6E02A for ; Thu, 9 Jul 2020 14:03:28 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id q15so1945269wmj.2 for ; Thu, 09 Jul 2020 07:03:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WimOihJEoGFrQflh5MG/QpMyDue9zSaiyBZVUVInhdA=; b=IFuRYrT9MaZwOKEyAiA8UmCjLbteJEHlXzsg6EmBXUBXYZdYR4TCSFCIiwFoDLwW4V kKN4JyGC4Y/LUEDf3R8qoxR80n6dYuHWy2QDiIvTQlw/el77Qyk6/Q0A7GqlllsGRcuM yrvEfFfa2SQTDfTcGXnn/sAo4DSrDmeVP4JXO9oHoQ2KTGo4LrPBge9+4ODXfN+9G+IO udYNxGREOwpxc+cTZn2/hduYfr902zz0cQPIDeL1OPLcXc1QFpYSEBkJGv+GbzczMhmG tp1l6fn2ALtuqpfgAa9hYZb/LU96+7ty4dGEARmjAlgWDS6+Vmn47g6jKf55SqQzFkFN eR5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WimOihJEoGFrQflh5MG/QpMyDue9zSaiyBZVUVInhdA=; b=OCx4Kb7S4QPxlMeVAXCzAF8AgtfBnjVVqZcUNa1HDSJ184P+h/L+pkZFoOb0PFF1x+ 5Jds1EiyqLyfg1rdPkZfYpjT5R1wVJFKLXxQ8wTTWwq6KIS06nx7q3Wn6nD39Z2PU7ym vVyHHQKtzzr7aCV9JJ7Cc6ERS1fquQBFbOZ6U+RwFn+Zmbg5Xn7XJzsEelTF9++YoN+8 Vc+xwPvFPi4DYaRNSDdIfQ+V2+ggVfl2doWA7Fyp4dTemdc5R2q/d3NRpHfMPRQrYK1h VSMufCZQXwVP1/A84qNtakHPA5lW8qWVtJll3FZJgDZeAACXdkT2zaRZR4eRO0I8pqEx Gd6w== X-Gm-Message-State: AOAM531oNkx6kBhYabdPYmHqI++El7tUMBApaxC2obZdeFCmHT9Gn7GC wIjIthR7V9NprNUbtkTVAxQ= X-Google-Smtp-Source: ABdhPJzAoqdWs8PVIGAYlZoJA4xOiECwNNPPLMh9DfIAcPbQvgFdx8vtLOY0r9qTioxzqki623ZYMg== X-Received: by 2002:a1c:1b0d:: with SMTP id b13mr114893wmb.169.1594303407170; Thu, 09 Jul 2020 07:03:27 -0700 (PDT) Received: from clement-Latitude-7490.numericable.fr (213-245-241-245.rev.numericable.fr. [213.245.241.245]) by smtp.gmail.com with ESMTPSA id s8sm5545256wru.38.2020.07.09.07.03.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:03:26 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Viresh Kumar , Nishanth Menon , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 01/14] drm/panfrost: avoid static declaration Date: Thu, 9 Jul 2020 16:03:09 +0200 Message-Id: <20200709140322.131320-2-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200709140322.131320-1-peron.clem@gmail.com> References: <20200709140322.131320-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 10 Jul 2020 07:52:58 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This declaration can be avoided so change it. Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 38 ++++++++++----------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 413987038fbf..1b560b903ea6 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -14,7 +14,24 @@ #include "panfrost_gpu.h" #include "panfrost_regs.h" -static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev); +static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev) +{ + ktime_t now; + ktime_t last; + + if (!pfdev->devfreq.devfreq) + return; + + now = ktime_get(); + last = pfdev->devfreq.time_last_update; + + if (atomic_read(&pfdev->devfreq.busy_count) > 0) + pfdev->devfreq.busy_time += ktime_sub(now, last); + else + pfdev->devfreq.idle_time += ktime_sub(now, last); + + pfdev->devfreq.time_last_update = now; +} static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, u32 flags) @@ -139,25 +156,6 @@ void panfrost_devfreq_suspend(struct panfrost_device *pfdev) devfreq_suspend_device(pfdev->devfreq.devfreq); } -static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev) -{ - ktime_t now; - ktime_t last; - - if (!pfdev->devfreq.devfreq) - return; - - now = ktime_get(); - last = pfdev->devfreq.time_last_update; - - if (atomic_read(&pfdev->devfreq.busy_count) > 0) - pfdev->devfreq.busy_time += ktime_sub(now, last); - else - pfdev->devfreq.idle_time += ktime_sub(now, last); - - pfdev->devfreq.time_last_update = now; -} - void panfrost_devfreq_record_busy(struct panfrost_device *pfdev) { panfrost_devfreq_update_utilization(pfdev); From patchwork Thu Jul 9 14:03:10 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: 11655923 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 DBCDF92A for ; Fri, 10 Jul 2020 07:53:19 +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 B955F2077D for ; Fri, 10 Jul 2020 07:53:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qUw4vwuS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B955F2077D 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 A07716EB7F; Fri, 10 Jul 2020 07:52:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id ED0F66E02A for ; Thu, 9 Jul 2020 14:03:29 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id j18so1941122wmi.3 for ; Thu, 09 Jul 2020 07:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ciy3HDqvKk5PARaiKZGCtCw2SjWa+ryFuI+p7pTDJCM=; b=qUw4vwuSn+ptn4MbZwbW/4JcHgMoD6jfSrQjR2v5avUDM1fN1z5f4uplCFgKWNQsqS 9aSMrqGg6d4qt8j0eitxmLT/3ywxOWQM76Vt5A3z+Ag+D2q4SDr3vNE+S46BDS2b9Be2 p5D8baGzBdcaQyO8TRciSqYeuYLqn94NSm4twhD9ziglGI7ZcFB58mQwu2qAIo+EEdu+ lms38xcgyOUDkJ9xnZ4/nLvXWMfCkA7dA9OkWy73/l3JO/RoNhesHEXRB6dITXHboR9Q m8+6N6pmfpBYorORnGQKIASx4qS+ecxsFpajjw/YQ0146QyzAuO5ExH1bD5iu9oHF3v2 l1aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ciy3HDqvKk5PARaiKZGCtCw2SjWa+ryFuI+p7pTDJCM=; b=OF9X4yF/kWy6cJGFxm+slk0hRXSWy5ZCSUyucFZZ0kMr8H65BAIZ8j5VNCIf12x8cz sMfsfEKis7hQaVT2DMNnvgDaf+7Xc9F06jx+xFTMg/zGTT+wJYDGRMJUQLwsiRQlYlP/ 7wUuPuDHuFFLLpcxCKHQWkFHO6QFNCZUbArEkzrJ9eHi39gQUYc0/DivJpNj/pKsU1uP hKqCAO/1+ggp30E4E6pdCxKuYFzRJ3F3x0M9R8PBajtPB9zbf+HbuDsm7aTp5WJXgT9b PhnPrdN/rjDA9tvDDaDoF2pTEa/r+qKs2BB5QbksfrCmRq7/F6LylkZIVH2Fl5Y2GRGU +Z/Q== X-Gm-Message-State: AOAM530l7mqvHSf7k74DwmxH1zI3Gh8DTysHBkVUtWAfsaOZKuPO3xAw KJL4nqIZr/4gpq/Zto+Wpq8= X-Google-Smtp-Source: ABdhPJxXQ2zcpVry+tBbqOjdH8BhqmMtk4qHHwoxi4Ph0toh3/O+Dx0OhluRkSrLaCze2KElp1CKFg== X-Received: by 2002:a1c:4183:: with SMTP id o125mr134976wma.101.1594303408531; Thu, 09 Jul 2020 07:03:28 -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 s8sm5545256wru.38.2020.07.09.07.03.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:03:27 -0700 (PDT) From: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= To: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Viresh Kumar , Nishanth Menon , Stephen Boyd , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v3 02/14] drm/panfrost: clean headers in devfreq Date: Thu, 9 Jul 2020 16:03:10 +0200 Message-Id: <20200709140322.131320-3-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200709140322.131320-1-peron.clem@gmail.com> References: <20200709140322.131320-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 10 Jul 2020 07:52:58 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Don't include not required headers and sort them. Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 1b560b903ea6..df7b71da9a84 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -1,18 +1,14 @@ // SPDX-License-Identifier: GPL-2.0 /* Copyright 2019 Collabora ltd. */ + +#include #include #include #include #include -#include -#include #include "panfrost_device.h" #include "panfrost_devfreq.h" -#include "panfrost_features.h" -#include "panfrost_issues.h" -#include "panfrost_gpu.h" -#include "panfrost_regs.h" static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev) { From patchwork Thu Jul 9 14:03:11 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: 11655929 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 34FF592A for ; Fri, 10 Jul 2020 07:53:26 +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 0D6902077D for ; Fri, 10 Jul 2020 07:53:26 +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="W+v8x9+F" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D6902077D 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 EBDD86EB82; Fri, 10 Jul 2020 07:52:59 +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 483FE6EA70 for ; Thu, 9 Jul 2020 14:03:31 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id l2so1941833wmf.0 for ; Thu, 09 Jul 2020 07:03:31 -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=UkW9l8coJNpZK7uX8c6xzFbB2l+pGmfP62kLElQGlUY=; b=W+v8x9+FNPWAzpyi5MQPB137c+NQkkyrDsBman9ISVngwRPnGJzp0t8AEW0o+7nM+F Y00ECIFPX8z+r8390mu7JtnC+/G2lNt/VpETuByq9w66musgFxqBf0G3AFYSx7WAuYpc pol244/MK4olowGHH2GjWw3dMA9gbFkkswKYKkCGNtgNNKS6eyCA06El6ujw7BDlWi6Z jiuplLH27xfXHm5o0Vn/B19yq7/+Y8gdWpWQos668zhdX9d2PevOtHIxvyybq5fRGFRF dZ3YsugPsbm1W7okkJXJ0EADWXPZ4XkRxZ5rAhjCOl/MtP/sGn1sALP/KGND+8h9BxT6 F6gw== 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=UkW9l8coJNpZK7uX8c6xzFbB2l+pGmfP62kLElQGlUY=; b=S+WUHlTff60iTcBaiiFCZu/n0fTQ+honUicsUAp7+LWsT3I9I7glvN+og1DbFZpIwx qgNF1dzTxfwnalxWmcxC8FcWgB/2OtbT+xm6rWN5iP7r7T3e7llZyWNzGWovVLTvdqnd zQUQvafaEQrF2+xdacU9L5/29UGd2UX1Bolq/9ABkYUpcUlGeopOuFwOEidZTEKNEZNm fzdHMquSLxWuHlir7PrQMP8JucFPfTySEIFcNv1lqjcrpsu8XlfjUcwPcXt+oiJ8Sycd REBZVnL5axPoOXIKfaJE4Qbu+avQTg4OXOS2x1KdBgLCufI2QnYwebpsOxx7fdPZKxpT LuGw== X-Gm-Message-State: AOAM533oUmhsmSLyWz2Jx+/YUYkSIsNOEbHL5ZhPeT9oTkAm5aLkX3F2 +ipHGU8vqdGcuMX4VTfvWsY= X-Google-Smtp-Source: ABdhPJwbsZeBCrJpIlgXGSJrKOqiQ7CzbHa36MSGND6Bj1J3HOXltsXkbGpTDH2sVn5b4QQN7SbBjQ== X-Received: by 2002:a1c:7413:: with SMTP id p19mr189941wmc.60.1594303409857; Thu, 09 Jul 2020 07:03:29 -0700 (PDT) Received: from clement-Latitude-7490.numericable.fr (213-245-241-245.rev.numericable.fr. [213.245.241.245]) by smtp.gmail.com with ESMTPSA id s8sm5545256wru.38.2020.07.09.07.03.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:03:29 -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 v3 03/14] drm/panfrost: don't use pfdevfreq.busy_count to know if hw is idle Date: Thu, 9 Jul 2020 16:03:11 +0200 Message-Id: <20200709140322.131320-4-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200709140322.131320-1-peron.clem@gmail.com> References: <20200709140322.131320-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 10 Jul 2020 07:52:58 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This use devfreq variable that will be lock with spinlock in future patches. We should either introduce a function to access this one but as devfreq is optional let's just remove it. Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_job.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c index 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 Thu Jul 9 14:03:12 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: 11655943 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 01B7892A for ; Fri, 10 Jul 2020 07:53:44 +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 D3C3C2077D for ; Fri, 10 Jul 2020 07:53:43 +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="VRzIX4Uk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3C3C2077D 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 1023C6EB8A; Fri, 10 Jul 2020 07:53:00 +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 78EDC6EA75 for ; Thu, 9 Jul 2020 14:03:32 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id k6so2520173wrn.3 for ; Thu, 09 Jul 2020 07:03:32 -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=VRoC5bGLlEhSD60pEeaPChiHjDUdFGDEmZk20OrMuc8=; b=VRzIX4UkDZrcfBCSmFx2qL3bw3uwmBfQkN30yMkwsg8YIFFtfqQr8L7lM0glu9Gptp NNww1+6BwGEVUlKkKQM5I1UZOx1wi+HU1XsLYM4qp4VEvTTH3l29SyFJ7fRjmxNGtCt5 NANjekv6+7q47QIKzfQjjE53YHyTx9wCWbAWhHMJ+VvAS0qIjkqLFYMtyENmaI33kDPT E+kRWgaK1xUcVrgm/ZG6RwKMmiHVmEQsx8XkazsavTKB65+IQBcGbMglmcSd23hfdQsz Pyb1tTDRWhl6IrWwqAmiF7VdkffTeKMwhg6ba3WBMevikYTDDvL9UkwlcAQp1Fv23cbY dHNQ== 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=VRoC5bGLlEhSD60pEeaPChiHjDUdFGDEmZk20OrMuc8=; b=CGxvCqbSWYausxMhyD8+orBsFDnGaVVMrExw/QM0VhoWxfGfmrvp0q8aZuRTEmOkri HVwd2xQkvXjOmXk8pXZWkxewb+DxKgIHTxRkShlfrUl9yiEwy2fcusNNue40yoRKLmSC s3sLGB3Z5bZtMYbDZyPreRIYYfA7BbA0R/7cLVdVP7OW5ZP6fSS/xLyrW7k/8WNCnmgW smws79jVhzGPUwmx3m9syCV3I/2fzfcwP58N2++wHK3QyVk9r88tVeQS2u4s+pkH33cm mM3gwzPMCzMiqYDbDddqeQbIaKQ6tHSOeixDW/4h9G6A1IocXHTKLR0ehKq2tGFoAkUN bvlg== X-Gm-Message-State: AOAM532BkCaPKk/jc+b76mNedWywEXDMIqMs1fGAREpmHrV7M5oZ766g q+2Mty74PtzxOj7Dx8iWT8wQdN4MEwU= X-Google-Smtp-Source: ABdhPJzXtEuBoawLX4d1SvLyRTEANvQMgFlipC/UWsLRMfhoJFgeyV8hdw1DOV8Qxc5Mgw3tD8GX4g== X-Received: by 2002:a5d:4dc2:: with SMTP id f2mr64829525wru.399.1594303411006; Thu, 09 Jul 2020 07:03:31 -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 s8sm5545256wru.38.2020.07.09.07.03.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:03:30 -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 v3 04/14] drm/panfrost: introduce panfrost_devfreq struct Date: Thu, 9 Jul 2020 16:03:12 +0200 Message-Id: <20200709140322.131320-5-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200709140322.131320-1-peron.clem@gmail.com> References: <20200709140322.131320-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 10 Jul 2020 07:52:58 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Introduce a proper panfrost_devfreq to deal with devfreq variables. Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 76 ++++++++++++--------- drivers/gpu/drm/panfrost/panfrost_devfreq.h | 20 +++++- drivers/gpu/drm/panfrost/panfrost_device.h | 11 +-- drivers/gpu/drm/panfrost/panfrost_job.c | 6 +- 4 files changed, 66 insertions(+), 47 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index df7b71da9a84..962550363391 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -10,23 +10,23 @@ #include "panfrost_device.h" #include "panfrost_devfreq.h" -static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev) +static void panfrost_devfreq_update_utilization(struct panfrost_devfreq *pfdevfreq) { ktime_t now; ktime_t last; - if (!pfdev->devfreq.devfreq) + if (!pfdevfreq->devfreq) return; now = ktime_get(); - last = pfdev->devfreq.time_last_update; + last = pfdevfreq->time_last_update; - if (atomic_read(&pfdev->devfreq.busy_count) > 0) - pfdev->devfreq.busy_time += ktime_sub(now, last); + if (atomic_read(&pfdevfreq->busy_count) > 0) + pfdevfreq->busy_time += ktime_sub(now, last); else - pfdev->devfreq.idle_time += ktime_sub(now, last); + pfdevfreq->idle_time += ktime_sub(now, last); - pfdev->devfreq.time_last_update = now; + pfdevfreq->time_last_update = now; } static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, @@ -47,30 +47,31 @@ static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, return 0; } -static void panfrost_devfreq_reset(struct panfrost_device *pfdev) +static void panfrost_devfreq_reset(struct panfrost_devfreq *pfdevfreq) { - pfdev->devfreq.busy_time = 0; - pfdev->devfreq.idle_time = 0; - pfdev->devfreq.time_last_update = ktime_get(); + pfdevfreq->busy_time = 0; + pfdevfreq->idle_time = 0; + pfdevfreq->time_last_update = ktime_get(); } static int panfrost_devfreq_get_dev_status(struct device *dev, struct devfreq_dev_status *status) { struct panfrost_device *pfdev = dev_get_drvdata(dev); + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; - panfrost_devfreq_update_utilization(pfdev); + panfrost_devfreq_update_utilization(pfdevfreq); status->current_frequency = clk_get_rate(pfdev->clock); - status->total_time = ktime_to_ns(ktime_add(pfdev->devfreq.busy_time, - pfdev->devfreq.idle_time)); + status->total_time = ktime_to_ns(ktime_add(pfdevfreq->busy_time, + pfdevfreq->idle_time)); - status->busy_time = ktime_to_ns(pfdev->devfreq.busy_time); + status->busy_time = ktime_to_ns(pfdevfreq->busy_time); - panfrost_devfreq_reset(pfdev); + panfrost_devfreq_reset(pfdevfreq); - dev_dbg(pfdev->dev, "busy %lu total %lu %lu %% freq %lu MHz\n", status->busy_time, - status->total_time, + dev_dbg(pfdev->dev, "busy %lu total %lu %lu %% freq %lu MHz\n", + status->busy_time, status->total_time, status->busy_time / (status->total_time / 100), status->current_frequency / 1000 / 1000); @@ -91,6 +92,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) struct device *dev = &pfdev->pdev->dev; struct devfreq *devfreq; struct thermal_cooling_device *cooling; + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; ret = dev_pm_opp_of_add_table(dev); if (ret == -ENODEV) /* Optional, continue without devfreq */ @@ -98,7 +100,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) else if (ret) return ret; - panfrost_devfreq_reset(pfdev); + panfrost_devfreq_reset(pfdevfreq); cur_freq = clk_get_rate(pfdev->clock); @@ -116,53 +118,59 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) dev_pm_opp_of_remove_table(dev); return PTR_ERR(devfreq); } - pfdev->devfreq.devfreq = devfreq; + pfdevfreq->devfreq = devfreq; cooling = of_devfreq_cooling_register(dev->of_node, devfreq); if (IS_ERR(cooling)) DRM_DEV_INFO(dev, "Failed to register cooling device\n"); else - pfdev->devfreq.cooling = cooling; + pfdevfreq->cooling = cooling; return 0; } void panfrost_devfreq_fini(struct panfrost_device *pfdev) { - if (pfdev->devfreq.cooling) - devfreq_cooling_unregister(pfdev->devfreq.cooling); + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + + if (pfdevfreq->cooling) + devfreq_cooling_unregister(pfdevfreq->cooling); dev_pm_opp_of_remove_table(&pfdev->pdev->dev); } void panfrost_devfreq_resume(struct panfrost_device *pfdev) { - if (!pfdev->devfreq.devfreq) + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + + if (!pfdevfreq->devfreq) return; - panfrost_devfreq_reset(pfdev); + panfrost_devfreq_reset(pfdevfreq); - devfreq_resume_device(pfdev->devfreq.devfreq); + devfreq_resume_device(pfdevfreq->devfreq); } void panfrost_devfreq_suspend(struct panfrost_device *pfdev) { - if (!pfdev->devfreq.devfreq) + struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + + if (!pfdevfreq->devfreq) return; - devfreq_suspend_device(pfdev->devfreq.devfreq); + devfreq_suspend_device(pfdevfreq->devfreq); } -void panfrost_devfreq_record_busy(struct panfrost_device *pfdev) +void panfrost_devfreq_record_busy(struct panfrost_devfreq *pfdevfreq) { - panfrost_devfreq_update_utilization(pfdev); - atomic_inc(&pfdev->devfreq.busy_count); + panfrost_devfreq_update_utilization(pfdevfreq); + atomic_inc(&pfdevfreq->busy_count); } -void panfrost_devfreq_record_idle(struct panfrost_device *pfdev) +void panfrost_devfreq_record_idle(struct panfrost_devfreq *pfdevfreq) { int count; - panfrost_devfreq_update_utilization(pfdev); - count = atomic_dec_if_positive(&pfdev->devfreq.busy_count); + panfrost_devfreq_update_utilization(pfdevfreq); + count = atomic_dec_if_positive(&pfdevfreq->busy_count); WARN_ON(count < 0); } diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h index 0611beffc8d0..0697f8d5aa34 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h @@ -4,13 +4,29 @@ #ifndef __PANFROST_DEVFREQ_H__ #define __PANFROST_DEVFREQ_H__ +#include + +struct devfreq; +struct thermal_cooling_device; + +struct panfrost_device; + +struct panfrost_devfreq { + struct devfreq *devfreq; + struct thermal_cooling_device *cooling; + ktime_t busy_time; + ktime_t idle_time; + ktime_t time_last_update; + atomic_t busy_count; +}; + int panfrost_devfreq_init(struct panfrost_device *pfdev); void panfrost_devfreq_fini(struct panfrost_device *pfdev); void panfrost_devfreq_resume(struct panfrost_device *pfdev); void panfrost_devfreq_suspend(struct panfrost_device *pfdev); -void panfrost_devfreq_record_busy(struct panfrost_device *pfdev); -void panfrost_devfreq_record_idle(struct panfrost_device *pfdev); +void panfrost_devfreq_record_busy(struct panfrost_devfreq *devfreq); +void panfrost_devfreq_record_idle(struct panfrost_devfreq *devfreq); #endif /* __PANFROST_DEVFREQ_H__ */ diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h index c30c719a8059..2efa59c9d1c5 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.h +++ b/drivers/gpu/drm/panfrost/panfrost_device.h @@ -13,6 +13,8 @@ #include #include +#include "panfrost_devfreq.h" + struct panfrost_device; struct panfrost_mmu; struct panfrost_job_slot; @@ -107,14 +109,7 @@ struct panfrost_device { struct list_head shrinker_list; struct shrinker shrinker; - struct { - struct devfreq *devfreq; - struct thermal_cooling_device *cooling; - ktime_t busy_time; - ktime_t idle_time; - ktime_t time_last_update; - atomic_t busy_count; - } devfreq; + struct panfrost_devfreq pfdevfreq; }; struct panfrost_mmu { diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c index 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 Thu Jul 9 14:03:13 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: 11655927 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 3A71A92A for ; Fri, 10 Jul 2020 07:53:24 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 178B62077D for ; Fri, 10 Jul 2020 07:53:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CUBY/goh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 178B62077D 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 90B016EB7C; Fri, 10 Jul 2020 07:52:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id C211C6EA75 for ; Thu, 9 Jul 2020 14:03:33 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id f139so1929538wmf.5 for ; Thu, 09 Jul 2020 07:03:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ztEfvDOenwmzhW91KrXpwCBICtYWbElja0rQb72V3Pc=; b=CUBY/gohnMihUfeW7hYoZa4qRuiuQR6oligMzAnmkB6qyrwohT837xR+hdTJY71AuN vRGEetbFmM/z0UeTMsaZw5vbs1h/T1iTja3IZz3OP/WiG4AL9OuShqkElaI2f1YXBH8N 6XSr/k0UULPgkxEILbww2PnvUk0cDm4MNUDd3kDy63uMWlj8XQ+NflE4Tr3+csuMTxoH l8ylr0QVrmNAiZeWyxQMNGm8S0Nivf79M+AGDQF871Q9Bma1NQwIxANBmPBYsXqHAba1 fpLidTdFSDfa/od40aFvbL5kEI8A4z0PPCRZwzq892JpUlG9EDMMRE57RkC/ncskpI5O GmWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ztEfvDOenwmzhW91KrXpwCBICtYWbElja0rQb72V3Pc=; b=i7Il5aTn/ILrac+ZZjZpK6q1EFp3ai4GFGsiv2PEw6dvOqzXY1JvEr1KBQXP8jllnw p5jxjf8URBgf/kbDwI3E+2YeU0D2WP3KqDJ3lxd80hAFkiH1K800nYbCq04xgAMctDP3 5/jA2R6UyqumhiGCVfG3oQdAFWb1mWXmM2Cqalrd78/Dhu5mB1HspeloTGpFD6eEZZ+v 1dum2oP+7qyS85DrYRKy/4dDLpLeVonVsCk5uUKA71Hbp2pIjitqJ0JMGmBtH5wQMLwg ZU2RPqNOs8CwDhkZo3gHOwKxGUJg9UGLcws/00Re5Ckgm/qB18dNQTDo8p9qWMisfvA6 P11g== X-Gm-Message-State: AOAM533hRfkKAMU+j4k6QJpD1kD05GTEYrjHNZvcyXeIRhVE+W3WL7XU 6N0OumJOJ5eBwNYZZlOhZ1w= X-Google-Smtp-Source: ABdhPJx/ayH+Q5ywOwP/RWCOz75bR/TbNDJfRCtUuCjaJiMQMCnozgskzfgigx+WYPDigoa5e69SWg== X-Received: by 2002:a1c:dfc5:: with SMTP id w188mr170663wmg.182.1594303412263; Thu, 09 Jul 2020 07:03:32 -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 s8sm5545256wru.38.2020.07.09.07.03.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:03:31 -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 v3 05/14] drm/panfrost: use spinlock instead of atomic Date: Thu, 9 Jul 2020 16:03:13 +0200 Message-Id: <20200709140322.131320-6-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200709140322.131320-1-peron.clem@gmail.com> References: <20200709140322.131320-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 10 Jul 2020 07:52:58 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Convert busy_count to a simple int protected by spinlock. Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 43 +++++++++++++++------ drivers/gpu/drm/panfrost/panfrost_devfreq.h | 9 ++++- 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 962550363391..78753cfb59fb 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -12,16 +12,12 @@ static void panfrost_devfreq_update_utilization(struct panfrost_devfreq *pfdevfreq) { - ktime_t now; - ktime_t last; - - if (!pfdevfreq->devfreq) - return; + ktime_t now, last; now = ktime_get(); last = pfdevfreq->time_last_update; - if (atomic_read(&pfdevfreq->busy_count) > 0) + if (pfdevfreq->busy_count > 0) pfdevfreq->busy_time += ktime_sub(now, last); else pfdevfreq->idle_time += ktime_sub(now, last); @@ -59,10 +55,14 @@ static int panfrost_devfreq_get_dev_status(struct device *dev, { struct panfrost_device *pfdev = dev_get_drvdata(dev); struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + unsigned long irqflags; + + status->current_frequency = clk_get_rate(pfdev->clock); + + spin_lock_irqsave(&pfdevfreq->lock, irqflags); panfrost_devfreq_update_utilization(pfdevfreq); - status->current_frequency = clk_get_rate(pfdev->clock); status->total_time = ktime_to_ns(ktime_add(pfdevfreq->busy_time, pfdevfreq->idle_time)); @@ -70,6 +70,8 @@ static int panfrost_devfreq_get_dev_status(struct device *dev, panfrost_devfreq_reset(pfdevfreq); + spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); + dev_dbg(pfdev->dev, "busy %lu total %lu %lu %% freq %lu MHz\n", status->busy_time, status->total_time, status->busy_time / (status->total_time / 100), @@ -100,6 +102,8 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) else if (ret) return ret; + spin_lock_init(&pfdevfreq->lock); + panfrost_devfreq_reset(pfdevfreq); cur_freq = clk_get_rate(pfdev->clock); @@ -162,15 +166,32 @@ void panfrost_devfreq_suspend(struct panfrost_device *pfdev) void panfrost_devfreq_record_busy(struct panfrost_devfreq *pfdevfreq) { + unsigned long irqflags; + + if (!pfdevfreq->devfreq) + return; + + spin_lock_irqsave(&pfdevfreq->lock, irqflags); + panfrost_devfreq_update_utilization(pfdevfreq); - atomic_inc(&pfdevfreq->busy_count); + + pfdevfreq->busy_count++; + + spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); } void panfrost_devfreq_record_idle(struct panfrost_devfreq *pfdevfreq) { - int count; + unsigned long irqflags; + + if (!pfdevfreq->devfreq) + return; + + spin_lock_irqsave(&pfdevfreq->lock, irqflags); panfrost_devfreq_update_utilization(pfdevfreq); - count = atomic_dec_if_positive(&pfdevfreq->busy_count); - WARN_ON(count < 0); + + WARN_ON(--pfdevfreq->busy_count < 0); + + spin_unlock_irqrestore(&pfdevfreq->lock, irqflags); } diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h index 0697f8d5aa34..3392df1020be 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h @@ -4,6 +4,7 @@ #ifndef __PANFROST_DEVFREQ_H__ #define __PANFROST_DEVFREQ_H__ +#include #include struct devfreq; @@ -14,10 +15,16 @@ struct panfrost_device; struct panfrost_devfreq { struct devfreq *devfreq; struct thermal_cooling_device *cooling; + ktime_t busy_time; ktime_t idle_time; ktime_t time_last_update; - atomic_t busy_count; + int busy_count; + /* + * Protect busy_time, idle_time, time_last_update and busy_count + * because these can be updated concurrently between multiple jobs. + */ + spinlock_t lock; }; int panfrost_devfreq_init(struct panfrost_device *pfdev); From patchwork Thu Jul 9 14:03:14 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: 11655941 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 B4E8B92A for ; Fri, 10 Jul 2020 07:53:42 +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 923E12077D for ; Fri, 10 Jul 2020 07:53:42 +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="TvqytnKA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 923E12077D 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 2C79D6EB83; Fri, 10 Jul 2020 07:53:00 +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 F1B0D6EA77 for ; Thu, 9 Jul 2020 14:03:34 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id f18so2536337wrs.0 for ; Thu, 09 Jul 2020 07:03:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eRj3Oh7sZBJWwDgWc3ORgJ0pvlwZ3+3t0oGyKYtF1AQ=; b=TvqytnKA8EMxKSNy7l2um5FuNdy3SYJ1dCG/7d4j6F6McuYKM8i2ZJD6vKXk0zi0sW iLOnpHvZFdRKvuQ4F/qk2i4hnaCpqz3S+KTaObiu/vxoojV/loemRU+qqb69JvOiKPDP L9xNxHrXw8FYaQ2Qu+2GrfYO2+fFLb7lmV+omk+L5cNjBloyV2TtY/zbzYyBYQnFimYN 8AyZi1sj7XAKYvMWS2Bioq/QOag3KODrknXJbFSNxV1V8A4z1fTwFOLHwC1SyhPGv+bZ Ml24pU2qObO2sXH93W147qiqJXbCXO17gVDejiU3pLSkOldsS0DL7DUgMX1yuOwiNtJL 7Ltg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eRj3Oh7sZBJWwDgWc3ORgJ0pvlwZ3+3t0oGyKYtF1AQ=; b=XUlHswMvUOpENeTINUx1jMLmRAy6bnipb7ERSPV0SoIyVbflDQvMLAhjrlxQJo/c48 PC0dLiuXMcmhveo9KDiVnSNz1Cp7HVA4IJVeh7NJxaP4p21AIk8AV0vc4fKZa0ioO77E 8kXvM4l+rn1kilGQ/B4awlfiZA2yD+8YCnisAkAomh5WbEFlyeH4Az39BIqEjgEqAZzM dG5D7VpFijxNPZU/CF+suXsw9W5ugEwyb9W52CrC6oOLd2BYmwPYmsEE90XIQofKFEqQ FYF+S0idsnWKTKehq0ZVb4dQNlMLUq1Mo2rI617qSkzrBDD+r0xicAOik6PDUsPSThfh wftw== X-Gm-Message-State: AOAM532WMgdKRo1ZccQXmI86EVkxDvoINhwYoZ4Zj4v7kCO7XMyr5aW5 NswUUrd258pgP9Ohg1jhHBk= X-Google-Smtp-Source: ABdhPJw84FXJpRMyrNsB+Uk7XKJyvE///uOAMmssgYl7VQxKTPBERcN45fyPtDnuQOC7hHl3ZBZChg== X-Received: by 2002:a5d:420e:: with SMTP id n14mr67522767wrq.164.1594303413447; Thu, 09 Jul 2020 07:03:33 -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 s8sm5545256wru.38.2020.07.09.07.03.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:03:32 -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 v3 06/14] drm/panfrost: properly handle error in probe Date: Thu, 9 Jul 2020 16:03:14 +0200 Message-Id: <20200709140322.131320-7-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200709140322.131320-1-peron.clem@gmail.com> References: <20200709140322.131320-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 10 Jul 2020 07:52:58 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Introduce a boolean to know if opp table has been added. With this, we can call panfrost_devfreq_fini() in case of error and release what has been initialised. Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 25 ++++++++++++++++----- drivers/gpu/drm/panfrost/panfrost_devfreq.h | 1 + 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 78753cfb59fb..d9007f44b772 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -101,6 +101,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) return 0; else if (ret) return ret; + pfdevfreq->opp_of_table_added = true; spin_lock_init(&pfdevfreq->lock); @@ -109,8 +110,10 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) cur_freq = clk_get_rate(pfdev->clock); opp = devfreq_recommended_opp(dev, &cur_freq, 0); - if (IS_ERR(opp)) - return PTR_ERR(opp); + if (IS_ERR(opp)) { + ret = PTR_ERR(opp); + goto err_fini; + } panfrost_devfreq_profile.initial_freq = cur_freq; dev_pm_opp_put(opp); @@ -119,8 +122,8 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) DEVFREQ_GOV_SIMPLE_ONDEMAND, NULL); if (IS_ERR(devfreq)) { DRM_DEV_ERROR(dev, "Couldn't initialize GPU devfreq\n"); - dev_pm_opp_of_remove_table(dev); - return PTR_ERR(devfreq); + ret = PTR_ERR(devfreq); + goto err_fini; } pfdevfreq->devfreq = devfreq; @@ -131,15 +134,25 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) pfdevfreq->cooling = cooling; return 0; + +err_fini: + panfrost_devfreq_fini(pfdev); + return ret; } void panfrost_devfreq_fini(struct panfrost_device *pfdev) { struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; - if (pfdevfreq->cooling) + if (pfdevfreq->cooling) { devfreq_cooling_unregister(pfdevfreq->cooling); - dev_pm_opp_of_remove_table(&pfdev->pdev->dev); + pfdevfreq->cooling = NULL; + } + + if (pfdevfreq->opp_of_table_added) { + dev_pm_opp_of_remove_table(&pfdev->pdev->dev); + pfdevfreq->opp_of_table_added = false; + } } void panfrost_devfreq_resume(struct panfrost_device *pfdev) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h index 3392df1020be..210269944687 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h @@ -15,6 +15,7 @@ struct panfrost_device; struct panfrost_devfreq { struct devfreq *devfreq; struct thermal_cooling_device *cooling; + bool opp_of_table_added; ktime_t busy_time; ktime_t idle_time; From patchwork Thu Jul 9 14:03:15 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: 11655939 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 C3A3592A for ; Fri, 10 Jul 2020 07:53:39 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A1AC42077D for ; Fri, 10 Jul 2020 07:53:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NMgaLp5j" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A1AC42077D 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 A1B2F6EB84; Fri, 10 Jul 2020 07:53:01 +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 32EEC6EA77 for ; Thu, 9 Jul 2020 14:03:36 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id j18so1941562wmi.3 for ; Thu, 09 Jul 2020 07:03:36 -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=JKW/GFXJRvXHBJ7nA8bjC5XW9nj30bx6DuRlEB0HNtQ=; b=NMgaLp5jU8o/Dd3Jp7/66haZtao+33lbMBXYdUVDYGLT7KlbSQWZRSh+T67gWuTkft sHofRUKjWfYOkUir0htLzyVeGAL+qTCnf73DqSZSeJh0UOzmEGAoSS9hijBO93aZswti hsW5ItgZlpUkt9Uae5JBxyrL6OszGvaG3dPKYkJh+6wYoHqGcSmqyhy0hFUQJLvO7TNJ 5oZHfxKoC0L3OMQNOmdovrK5BI6QTsX6G7aP2b38vpphpFfP1M1o6pQxbvA3OPWUWylA a/iUnP/O5arGTq/U8govaQBY0l6afrlrdLtvo9rccYca9bp9ZaKvv4M4iLSAhAMBLNap gcgA== 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=JKW/GFXJRvXHBJ7nA8bjC5XW9nj30bx6DuRlEB0HNtQ=; b=TT+KkUM1B7FYyvwylX1HYzGjLleEx6TVNCGAe9YTmcSY5hFkyFhX5ENRE6zg3A4D25 CUpXWW590Cgj3WvUvmo3+JsgITTQpzN0YCb52H91ykTvjWxaRFbvHzfuf1vNEOrQ4PvC hmlTahIleC5HUuGF9IY76GQDI5viDwdYhBY4RSgORgrDPSDPFKIn7fbRxPwBIgPyehVN 6z3EXH9LuJXE6AyA9gwBLrHeu4QUZvYr+ysrYb16x4zz2Uxr/cCINJeTz+0zXP7F7WvV fteF4shOVZ5k7MV3KBV2nN5vIkztNESqWm2a2GuuWvOMROKo2S87PVccYuSLMU9pl79o vFCg== X-Gm-Message-State: AOAM532cnxWWnCFTCXqK9plo1mmj8OoogR/O7/ZXEgMyxWkBVF7+Yftr CVWAJ/bLpujYs4KO4fWF0d4= X-Google-Smtp-Source: ABdhPJxILflVyu8Lm0seStqnwju2jYItTgeZ7W0SCCrBRXZTDmDCDL7zzPjGyEeU/IQ2UoSUomR6rA== X-Received: by 2002:a05:600c:281:: with SMTP id 1mr127812wmk.143.1594303414757; Thu, 09 Jul 2020 07:03:34 -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 s8sm5545256wru.38.2020.07.09.07.03.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:03:34 -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 v3 07/14] drm/panfrost: rename error labels in device_init Date: Thu, 9 Jul 2020 16:03:15 +0200 Message-Id: <20200709140322.131320-8-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200709140322.131320-1-peron.clem@gmail.com> References: <20200709140322.131320-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 10 Jul 2020 07:52:58 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Rename goto labels in device_init it will be easier to maintain. Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron Reviewed-by: Steven Price --- 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 Thu Jul 9 14:03:16 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: 11655935 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 3BCEC92A for ; Fri, 10 Jul 2020 07:53:34 +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 19CF12077D for ; Fri, 10 Jul 2020 07:53:34 +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="RWd6xeQa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 19CF12077D 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 804B56EB98; Fri, 10 Jul 2020 07:53:02 +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 DD1FA6EA7B for ; Thu, 9 Jul 2020 14:03:37 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id g10so6341052wmc.1 for ; Thu, 09 Jul 2020 07:03:37 -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=l36lxSRuzC4M5+GyPXFxDj/EhvfNIEQcQmOpcVgl7wo=; b=RWd6xeQaKkXBDcqaUA/vXcv9CsRqjpa1gLy87640mOge+kKSxYZka0L+8EC2/siJ+q 7hI528ObcBzT3vpDQ3t1YTwExWlLqYzelTdhfRY6kbwcQwhiZB48cGHmrsoHfrL/b3+z GJSV9+MXXxU+8BI4nXWt2H2cw2j+UgDAwSwU/gOIH/wjjGdw0JipkSzveBKhfsnqYPpq md3JGAjHvuE99SU7q0iU+5w/PLqUQTWfwu5Ife5JtJJtN0uq2p1FBCVy9ko32W5nmn32 npoM+x1zAiXRV1hWLL0QQ7lAkTFqhaUU5xsVN/ognjsXHL9JW0wOTrdk5eme+xICLWql EcXw== 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=l36lxSRuzC4M5+GyPXFxDj/EhvfNIEQcQmOpcVgl7wo=; b=ewaZXc/jTf+mAtk7a3jUN8exVpy6zNk1tu6KqPT0Mfw4M1nqxnGJrbtezzvNvFTPlP vu2LBOm0Y/N+JVHVquVbDUiZ5Sgh42ZCYEYIAc9HGRcaWx12WuXoU1y2tKeYi8mp04gu ETc0ryvo47PGg8lDLXSfAArbvxSPrOdyqtS1l23mu+v4OY8fxkKmkK73wbMlUPZCZ0ue /XgTDWvKKV/q992A6Zivis+NWoFJ/Bko0NMFXYq0THcqwOBRmtusAjI2sH5SBxoaMzzv aNGudH0R+K4ggYgUUulKnBHG6EfFWZ5JGfnt4qKzQKysMzbt6eiDlfv8wCHI+BldapYE DVaA== X-Gm-Message-State: AOAM532V94vKsWT9yK8oJDs+9BmbqjiQtUb27OTWz+scNeXpAIweO4Gm DmZJqaUMRLIQZqRV1Nuoqfg= X-Google-Smtp-Source: ABdhPJzQSsS3ZPutPIRqkj3+0gwoeFRJt699I4f8i1gp/1FAi0eILeOJ9Za1ciNteC/ZwKxiovGPGA== X-Received: by 2002:a1c:e088:: with SMTP id x130mr196656wmg.14.1594303416312; Thu, 09 Jul 2020 07:03:36 -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 s8sm5545256wru.38.2020.07.09.07.03.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:03:35 -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 v3 08/14] drm/panfrost: move devfreq_init()/fini() in device Date: Thu, 9 Jul 2020 16:03:16 +0200 Message-Id: <20200709140322.131320-9-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200709140322.131320-1-peron.clem@gmail.com> References: <20200709140322.131320-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 10 Jul 2020 07:52:58 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Later we will introduce devfreq probing regulator if they are present. As regulator should be probe only one time we need to get this logic in the device_init(). panfrost_device is already taking care of devfreq_resume() and devfreq_suspend(), so it's not totally illogic to move the devfreq_init() and devfreq_fini() here. Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron Reviewed-by: Steven Price --- 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 Thu Jul 9 14:03:17 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: 11655933 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 3395792A for ; Fri, 10 Jul 2020 07:53:31 +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 115B22077D for ; Fri, 10 Jul 2020 07:53:31 +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="T4Czs3C6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 115B22077D 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 CE87A6EB81; Fri, 10 Jul 2020 07:52:59 +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 0EAFB6EA7B for ; Thu, 9 Jul 2020 14:03:39 +0000 (UTC) Received: by mail-wm1-x342.google.com with SMTP id f18so1935100wml.3 for ; Thu, 09 Jul 2020 07:03:38 -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=BOFwyA/KeHpSrdpEHkJSq/OdhfI9WWMw9P1g3AHQGKw=; b=T4Czs3C6f6XNS5I7SnWmY+8UswejwqxgdF8WGbwSzdU9C3od4s11THuBNl6q7ToVBt qKIUWBOc1tZgJIGcWAzD+CPggtiFlXrSg/hTeC4q7NUixjIVyLvRaRH92yMSxhIeU0mU en/A+FAHqulAQoOyqdCJSrwrYWxb1X6gNVDWfljZDBVZe34iMixa4B8FHS7UszV81fJI Pf78p/EQTKyyssjgtVuAZZg5Xyf2YKJVvblYO+PwxQEpC9qC892uYSPs4VaStTf1yRcj lybHYCpSXL36dKMcKiV01EKsq6NqfpKfunp865yFxsRACkJSkZ0z3QyoGClwLadzSoAN 3I5w== 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=BOFwyA/KeHpSrdpEHkJSq/OdhfI9WWMw9P1g3AHQGKw=; b=Yjv/HQ9m72sbehIYKAa8Zdo82hmeZ4IzDGDKM0vhhUEwK0spDVyZmMHF9qS1id+xeN ea/xKlcSAs1spX0BndMZFo/G2e6PFF4iOkC+na1iAnMqUUdxr77m6UO9AXiZa79D/MkA 9NjXP1R3ZBmLjewFyDBQDSoMdVyyDXW0mVYoPtyu+Drtf7rmimoFy1wmNrrhFkrVmnl1 yrE0Hd5nGNqc1Jg3IY6lFrw0+XOJb4UUNWYtrYpkHfWetbS1PAsDAJZoaZk64I3ISy2K gCA83eXMOI9zIKKrbGHr1xCuJYkaIiKku1W+jt0lJQAuCqa2NGCSk/AUrnDQjyvimrwv 5rGQ== X-Gm-Message-State: AOAM530m9gu/Qe4FpOqfEuDHbZEPv73evMdgitT7P5RgPVQd7tAXfZ8H 0wj5F54gJSmFeNYCfDOeLZM= X-Google-Smtp-Source: ABdhPJyvaIRwfYI3tdberZprFXUuYfO1fIWqAYdaMWC4jYWrQqCTVnhzxV1LgDMR1AE+B8tzK3c64g== X-Received: by 2002:a1c:238d:: with SMTP id j135mr140330wmj.71.1594303417600; Thu, 09 Jul 2020 07:03:37 -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 s8sm5545256wru.38.2020.07.09.07.03.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:03:36 -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 v3 09/14] drm/panfrost: dynamically alloc regulators Date: Thu, 9 Jul 2020 16:03:17 +0200 Message-Id: <20200709140322.131320-10-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200709140322.131320-1-peron.clem@gmail.com> References: <20200709140322.131320-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 10 Jul 2020 07:52:58 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We will later introduce regulators managed by OPP. Only alloc regulators when it's needed. This also help use to release the regulators only when they are allocated. Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_device.c | 14 +++++++++----- drivers/gpu/drm/panfrost/panfrost_device.h | 3 +-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c index 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 Thu Jul 9 14:03:18 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: 11655947 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 D0EAE14E3 for ; Fri, 10 Jul 2020 07:53:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AEE072077D for ; Fri, 10 Jul 2020 07:53:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BxHDPHyD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AEE072077D 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 EC3BE6EBA4; Fri, 10 Jul 2020 07:53:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1CEA66EA70 for ; Thu, 9 Jul 2020 14:03:40 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id j18so1941844wmi.3 for ; Thu, 09 Jul 2020 07:03:40 -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=CM7F/yVSMdD0MwnLwyut2LHrVbWT5ZWz854NoFHIMAw=; b=BxHDPHyDMwCkfTRC0Q1ZkF+4Ma/zBrkuVIa4nfvYIsH2XocNv4/T2cCjIDPMZxVeSp WzwSmOUfaPaEhKZ+AF5jAS/HRwcF9+4cBfNgiTh99EimNQ/KHh6vAllxXE7iYnbaTVKb nHpJuSezWIWU3u56NX2xFCKdU1Q1LQvGq3Wpr+wqvGIsooyBLiJVXGOqG6iUXAyIFZDy g/BKZCBw26gjWPqFdq0WFM82Qz4L3xuFDFlxNaC9RkpDQXTTb7iiYnS0LGrB2fA6R+4d HfheXePR0dF1+NT7L++XoVTvdzEPlIpEP3AEvzdQ1os6voSfK5HB+FtQlGf4LNfmKAhr OVaw== 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=CM7F/yVSMdD0MwnLwyut2LHrVbWT5ZWz854NoFHIMAw=; b=KZgbUiUVFmGoSU56rDfgqF9y7h9rMMDRhnXlgVazVoxp8iwUnAeshIjaaW7OeQtjpR CNmq6tqfllfu+1vbcmyv4FSb6gkj8/4nEb7MvTlS0VfK+TlEwjcC115JSYtesd7rGelI GK+d0f7IYLTYRppi/9iPhETHSKlwirrqmZdt8lAYr6wuPoq9efToutNnMtfiBxJB7HYK 7r9VSeKuFraKtqbgZVC3NPmmlgzCsAa7h9v0IlIs9qY6KRZPMmvkUr3K0y1mA+Al0lmF Hf8UBgRLJwO0OkeB/aAkxuq/T0Bw5aUGUXIAPVCXy80xqlNKvyKDK+NfplMjSEgqmSTz CTNg== X-Gm-Message-State: AOAM530Y8wwhANc7eIkx+KyFkqTQqdmELSQNnO73VF7Y6HwnFhr1XfQ4 jvIlCcWpFRrhcbaQZGRW/Zk= X-Google-Smtp-Source: ABdhPJzisUnpfGKLyaQeAsd/vql6nryFcY7P93DXPG4QqxdWDcIEuaAMiLxSeRT61HwRyMIIkgBebg== X-Received: by 2002:a1c:ba08:: with SMTP id k8mr199642wmf.28.1594303418680; Thu, 09 Jul 2020 07:03:38 -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 s8sm5545256wru.38.2020.07.09.07.03.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:03:38 -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 v3 10/14] drm/panfrost: add regulators to devfreq Date: Thu, 9 Jul 2020 16:03:18 +0200 Message-Id: <20200709140322.131320-11-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200709140322.131320-1-peron.clem@gmail.com> References: <20200709140322.131320-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 10 Jul 2020 07:52:58 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Some OPP tables specify voltage for each frequency. Devfreq can handle these regulators but they should be get only 1 time to avoid issue and know who is in charge. If OPP table is probe don't init regulator. Reviewed-by: Steven Price Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 29 ++++++++++++++++++--- drivers/gpu/drm/panfrost/panfrost_devfreq.h | 2 ++ drivers/gpu/drm/panfrost/panfrost_device.c | 11 +++++--- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index d9007f44b772..8ab025d0035f 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -93,14 +93,30 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) unsigned long cur_freq; struct device *dev = &pfdev->pdev->dev; struct devfreq *devfreq; + struct opp_table *opp_table; struct thermal_cooling_device *cooling; struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; + opp_table = dev_pm_opp_set_regulators(dev, pfdev->comp->supply_names, + pfdev->comp->num_supplies); + if (IS_ERR(opp_table)) { + ret = PTR_ERR(opp_table); + /* Continue if the optional regulator is missing */ + if (ret != -ENODEV) { + DRM_DEV_ERROR(dev, "Couldn't set OPP regulators\n"); + goto err_fini; + } + } else { + pfdevfreq->regulators_opp_table = opp_table; + } + ret = dev_pm_opp_of_add_table(dev); - if (ret == -ENODEV) /* Optional, continue without devfreq */ - return 0; - else if (ret) - return ret; + if (ret) { + /* Optional, continue without devfreq */ + if (ret == -ENODEV) + ret = 0; + goto err_fini; + } pfdevfreq->opp_of_table_added = true; spin_lock_init(&pfdevfreq->lock); @@ -153,6 +169,11 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev) dev_pm_opp_of_remove_table(&pfdev->pdev->dev); pfdevfreq->opp_of_table_added = false; } + + if (pfdevfreq->regulators_opp_table) { + dev_pm_opp_put_regulators(pfdevfreq->regulators_opp_table); + pfdevfreq->regulators_opp_table = NULL; + } } void panfrost_devfreq_resume(struct panfrost_device *pfdev) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h index 210269944687..db6ea48e21f9 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h @@ -8,12 +8,14 @@ #include struct devfreq; +struct opp_table; struct thermal_cooling_device; struct panfrost_device; struct panfrost_devfreq { struct devfreq *devfreq; + struct opp_table *regulators_opp_table; struct thermal_cooling_device *cooling; bool opp_of_table_added; diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c index 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 Thu Jul 9 14:03:19 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: 11655963 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 DB56A92A for ; Fri, 10 Jul 2020 07:54:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B7AC12077D for ; Fri, 10 Jul 2020 07:54: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="JeUNWsNg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B7AC12077D 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 E35CF6EBB4; Fri, 10 Jul 2020 07:53:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by gabe.freedesktop.org (Postfix) with ESMTPS id 594ED6EA7D for ; Thu, 9 Jul 2020 14:03:41 +0000 (UTC) Received: by mail-wr1-x436.google.com with SMTP id b6so2487108wrs.11 for ; Thu, 09 Jul 2020 07:03:41 -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=dcu4SndGV5Tss4rBZKTNWEr/Y8nrFq0nn6EDq7ivZDo=; b=JeUNWsNgXbbHWdzNwV8DR/fxWrHOaJhAiPJovG4vKr8ythoAoJ08L4/HJE3vSZoGyg miP1i8jMb3TBa58bPs9dzrAL9BNc6hdx6URpUvU0/V1NZ2L/Oe513SIgicQydG031DpV CpZ/mSDZmlpHwRlXHzfAjVcVivLZVX5XZupXuQvFwXbR8jYz39D/si/Vl6GhLR5NVJ8G 9y7GrslfmI9yzpEXDIYyQWBcqlGPkHBHT28bFXixZuEA4fuUeYFvJgOqoPP6DvC6ylhG FW9SymR3OTCJ69ldpO8It/zlgwY1BnZlDZS8IQzxxEmfWM7qVnjiJlTOUzOhugB1jhO6 BFUg== 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=dcu4SndGV5Tss4rBZKTNWEr/Y8nrFq0nn6EDq7ivZDo=; b=PjsdLx3hmdbF+QrUAhpD0Jn52mlRZaOjIldyWEE3dYXnYBD2fx6xOMEtFC31Am4InU r4G1dFgYhDqIBTwWvtqyXnA/hwJ3ZSzy90aq0v0DZg6Fj/EoiChV7kj215sM95MLV5pw cgKeM7IdQfhnp2Af7Pec8UdThANAcOmyM/tUIGauVd9/1EZw8Srk8XYkn/XX4tR6Tnr7 GcBncHRw/urUoOKWVnv7iJD+eS1clRRsa3ous5PBn8qbKEXP2K9wE1PvTCn9i3Z3yc88 CEZaT8WXtxCfOtb/lYoiYyIgZ9TjOcf2jW0KcVI5aU0PUPcof3C+7woAjzerrZVb0QfW 5SKw== X-Gm-Message-State: AOAM53027vw21NWTK8LK5zfvaCffHtZ/2Tp0UvzgyF2v2CeQwMOf9iRR VzMYPYCawmgQ+X7nqUnhuwE= X-Google-Smtp-Source: ABdhPJzpkoGDkREmIoP1jIdxUD7tsYkEzzBcGj/mODktAXM4oPSJ2LpVO3mDm+oHE19inD4vm1bLzg== X-Received: by 2002:a5d:66ca:: with SMTP id k10mr52588436wrw.244.1594303419826; Thu, 09 Jul 2020 07:03:39 -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 s8sm5545256wru.38.2020.07.09.07.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:03:39 -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 v3 11/14] arm64: defconfig: Enable devfreq cooling device Date: Thu, 9 Jul 2020 16:03:19 +0200 Message-Id: <20200709140322.131320-12-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200709140322.131320-1-peron.clem@gmail.com> References: <20200709140322.131320-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 10 Jul 2020 07:52:58 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Devfreq cooling device framework is used in Panfrost to throttle GPU in order to regulate its temperature. Enable this driver for ARM64 SoC. Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 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 Thu Jul 9 14:03:20 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: 11655965 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 7BADE92A for ; Fri, 10 Jul 2020 07:54: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 590E82077D for ; Fri, 10 Jul 2020 07:54: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="QltWwipS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 590E82077D 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 C78296EBBC; Fri, 10 Jul 2020 07:53:06 +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 78C7B6EA75 for ; Thu, 9 Jul 2020 14:03:42 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id q5so2508259wru.6 for ; Thu, 09 Jul 2020 07:03:42 -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=IGSDRqVm1JOZ64MgS3vkOb+1FLTRNpff/hgpbfnfooY=; b=QltWwipSdHi08KdX6oNOYrCOU3nuRZ2oqlCna2xNWmwU93UXHzqIe6EhlAVKTSoKYg RC12Xg33XJ6+bMKWAoKIhFaPw4BpbWY6BCUiue1z5RTvYl7ilsYPhf1Ceo+Lw0BGFAL9 uJTV6imSHnZj/Zsj0nCjEaK50qaHZZ7IcyF84LWWEFTQq53BTWRBjA1DcYAZi3xMMPXj Txr/SOUOwjuRevz5DC4m7GosDUgWqm4YEaCcw9u+TiMgLxMz8bM1U/W+Ocv/6Vf3fyE9 J385tuU3tSivLhmwdnC6mFCLKTkdC+kx9kthXrtarIhU/d/5k16B4W1LgC1HekkobzU9 iaAw== 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=IGSDRqVm1JOZ64MgS3vkOb+1FLTRNpff/hgpbfnfooY=; b=ZmkXTYwjxIk6TeZHNvOUh0qLlSlgHfIE9rmxvSAYtgDC4mi8tu98g4tZYU1hhlWkKq 1uxuOIpvHpUZGe9MjUsPiozuAphhKX4U5UDNScN1fTX9iAhnAMOtMgoMRzyc02ms2EuD si+0O8ibgN04E02VKHZ0rtO2JSMCEm4xhv9nHsL8K3E79c3gOCYPzT1Vq0baIRmPGmSL XNK1Vyl4+JsLelPkM00gm8bJImXq/PDrZ6gOXUfj25MAgLGYLHjr9nQ1xvpn9TDKudza 05mZv67yHAJIzCyCkjLHhw/pWdcAhepAsEImQfIX1fxrC62/WQ8UHhP0A2K4q1Uf6pDc 9lWw== X-Gm-Message-State: AOAM532/Zeib1wvymlVeaWCdm04dGoBAApZqyRteNNiLJECC5hmLQ0vA ZMkaYjKBL4a+VyFwDSkZWhw= X-Google-Smtp-Source: ABdhPJyHqIxm58EdIGIO13FCV6nEuBJUZ9dl18TlYFSgwLEHFySc4yWbcI5jJYl+BM0LfhDROjoK8Q== X-Received: by 2002:adf:f34c:: with SMTP id e12mr60699527wrp.46.1594303421047; Thu, 09 Jul 2020 07:03:41 -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 s8sm5545256wru.38.2020.07.09.07.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:03:40 -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 v3 12/14] arm64: dts: allwinner: h6: Add cooling map for GPU Date: Thu, 9 Jul 2020 16:03:20 +0200 Message-Id: <20200709140322.131320-13-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200709140322.131320-1-peron.clem@gmail.com> References: <20200709140322.131320-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 10 Jul 2020 07:52:58 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?Q2zDqW1lbnQgUMOpcm9u?= , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add a simple cooling map for the GPU. Reviewed-by: Alyssa Rosenzweig Signed-off-by: Clément Péron --- arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi index 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 Thu Jul 9 14:03:21 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: 11655953 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 9F0E514E3 for ; Fri, 10 Jul 2020 07:53:56 +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 7CF432077D for ; Fri, 10 Jul 2020 07:53:56 +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="mLDmywv4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7CF432077D 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 1E0576EB8B; Fri, 10 Jul 2020 07:53:00 +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 C347C6EA77 for ; Thu, 9 Jul 2020 14:03:43 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id z2so2517822wrp.2 for ; Thu, 09 Jul 2020 07:03:43 -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=mLDmywv4Oyl2j8kyqhXiSFxSLl7dO8X7KPFt0TbHLtP1ytCVznMnWvtOeGZIR7L+zR dfwYDG8Mu8a0wSLIvXqov/CJ2EP+wNQZQiBeuM/z2BtdzBZOMDUb6hBLJENFWPjUN2GX 473RKK8BMpuQQJFVYWuPWIlube2JOBKsWOUUNERU5pbipiYMvChMD0UBBXvwlkwoCMwx DA3i2d6imdqMm/SrOPB3LDr02ElCh2s3gPwb/f1hd8DSKy7Xrnb0vXCBEwI5iawBJ0D+ H7c/RkG76Uaak00eC1cC5+yvlcS9wpI9N/wzordOFkOLbpuu/wmfK0M0kUi/sTVdvdjX 04pw== 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=eI8aN+UKRDSJEzX+ahC5bSNguv4UKLi/mrYmLMgLILoA35Hx4HwcEjukTFTpQX5PBO qZ96tCBKC1V7WOy9911NntZZ4MzqCXiqIxxK0G2+g5MhtcbT91r6NMR5bqZ9eVezo+YP EdPq6si4DID0waHtH3EOXRy5B0We/FhUgg26+QIW7q0XgOWKdOyzCbMD8Iz4cEG5+Q+z kwny7Edh/f9LtiCGiakgU/bNJfex5vlfQd671H+Rx+0Brzt765no4TnJAbzEENYKq9n1 Wrv4wj3twhvkw9N50pGFS7vD7ZQ904Snn/4Lpw613oBBXe6GtFCrHTIRwKYCBXDCYq1e qiqA== X-Gm-Message-State: AOAM530rIVle6pMPhj8OaNhpsQy7Snr2Z3xBOfl6liB+h854zVJyej01 YdqCCwesNBef65B+m1A3HTQ= X-Google-Smtp-Source: ABdhPJwXj+/UHrYQECUcRL7M8ks0AHImGxyCFdxtiqE3Z46FlmksIb9RhYX2U7P1Wi4nWCRJsLa0xQ== X-Received: by 2002:adf:91e1:: with SMTP id 88mr56447637wri.89.1594303422255; Thu, 09 Jul 2020 07:03:42 -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 s8sm5545256wru.38.2020.07.09.07.03.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:03:41 -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 v3 13/14] [DO NOT MERGE] arm64: dts: allwinner: h6: Add GPU OPP table Date: Thu, 9 Jul 2020 16:03:21 +0200 Message-Id: <20200709140322.131320-14-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200709140322.131320-1-peron.clem@gmail.com> References: <20200709140322.131320-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 10 Jul 2020 07:52:58 +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 Thu Jul 9 14:03: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: 11655959 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 3E4A214E3 for ; Fri, 10 Jul 2020 07:54:01 +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 1BCB62077D for ; Fri, 10 Jul 2020 07:54:01 +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="G6q0CF1k" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1BCB62077D 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 2D3C46EB9E; Fri, 10 Jul 2020 07:53:03 +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 E54A36E02A for ; Thu, 9 Jul 2020 14:03:44 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id q5so2508427wru.6 for ; Thu, 09 Jul 2020 07:03: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=DFfhRB3CIFp7+b9HYaYFBTlz+H/vZeZ2FswijDgFipc=; b=G6q0CF1kORRNof0tQD5r5NoQptbBhuWv1c/fs/r9CwDbcexcB/5B+EpnFZAyC0xynB TLPEFz27dI9N6mnQizXEdM5Fx85hbntmmpaI+2qoJOrcf8faPX3GUOfc8IjsUwiW1+3b e7HPabKQZTToNaRmwvKoYF+kLUf8NXXQINYMJsMY3+UQspFvPotKsRqu+FG8QM3B0rVy k4BsagiLGMLuB2NrQwbIOJWhU0B3mQW+5c0kHq9934E0h1meOOVPiGsRPo2IoyKOke+y RtfRN6JZF6a/JdlP/S1xtQkycBz+oVpsx5KYQX5HNSW3NOXCjBlpLyejw1FpK2Wlq1Lg qAAw== 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=pttZ6+A6DK+BH/H7qU6PXpaxhr8p+FJ/jhVrdH2Zb7S+BDizlpP0Bdj9N70MWRSGsc h0DnkHr293CjzsI9eT2/EsBxmBrFWkmZl3opRbjo/SjxGixtSwZPChAxyDnrgqyQx0HB SXYbGQtenwL4bO1hKq8r/u6okAArQGaER2tMVsWmjzQDPu5YPnqGUXvnjsQLRNZq8UzK YawTccG8rUXWyD4ml6vWYBt9TCU/pv4H0wz4vkZ3YqCd/jKMg9uJNDJKoX1d/uuybAZl d15XkwRdENlzHcyKnLuukYsD7w5l9ZZAKsc47ZFOLbXqS+aqTcvtcFAJGSQdGzVs6ce/ ApTg== X-Gm-Message-State: AOAM531V5DjvU2KPZwkFI4WMyeXEgUYginXFlSr3J2Oc7vt0700XYUfs j0uKWBbq0OOzZPYYPi9yFXM= X-Google-Smtp-Source: ABdhPJxKsJGmE1cXYIqvgGVcbqQhYNjKkdXWYq3nTtCEanj2piNLMs6tz3AQM8Wn4LqysoxPncAyVA== X-Received: by 2002:adf:e884:: with SMTP id d4mr61159232wrm.176.1594303423483; Thu, 09 Jul 2020 07:03: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 s8sm5545256wru.38.2020.07.09.07.03.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 07:03: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 v3 14/14] [DO NOT MERGE] arm64: dts: allwinner: force GPU regulator to be always Date: Thu, 9 Jul 2020 16:03:22 +0200 Message-Id: <20200709140322.131320-15-peron.clem@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200709140322.131320-1-peron.clem@gmail.com> References: <20200709140322.131320-1-peron.clem@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 10 Jul 2020 07:52:58 +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>;