From patchwork Sun Jan 12 00:16:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 11329007 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 19E1C109A for ; Sun, 12 Jan 2020 00:17:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 EC2DA20848 for ; Sun, 12 Jan 2020 00:16:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ACaHE5vB"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b="UH7MWGgm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC2DA20848 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9YDJdKPYlzOKOkrKo58yRhiT1i4WVaBaZicgTBp7BsI=; b=ACaHE5vBsg/QmJ fligN6Od6OxIxfUz2iwO43ju1xRN8LTAqTq8pEedD0hUEuoq+63BkvU1oqYG1F1E3k2ly2OxJxEW3 4q3+amNwXXLNeSUYQbiDZW9OrX4W3X3EI/RbkOFwCMSoxJ6oOfDzQEekpaxANLSBUOOtEVRoS8gy7 MmKtqjqWBafXI4wjG+BbfSyMTi8z9Iv8vBghasYkwd7IuiGLFCv0cJ/+VssAaCzXDZpTdmzpTTDPJ Tkvsj9avbitxKKUCcihHkDDZQAY7pUxrpOnOVB2DawcWG6FAJyK3NsthM1Wojz9unjqDjbdVJkkPz sy+VCMJntT99JE9mZXRA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iqQw1-0005hZ-5n; Sun, 12 Jan 2020 00:16:53 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iqQvu-0005cV-GP; Sun, 12 Jan 2020 00:16:47 +0000 Received: by mail-wm1-x342.google.com with SMTP id t14so5826354wmi.5; Sat, 11 Jan 2020 16:16:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TO4ro9G4vD3zIHyJt/0agdTa39l4m1TB7ZW3wf7lrf0=; b=UH7MWGgmwpk+vFbDOSAfRRM5C2mVjwsDV1I/lidLxqldDbgNh2mQf1YvA9C/MsU15K eSNVEdudBaJL3+6RGJN2DaZN3xbK4vXy5fdslb47DmZYmpER4EKUUIMYxqpmcOntHN1l h0OGL18OHKnXe/pn/dS+JeYnlNQ36lO5c+iEAPAm95AnQBFva2HCmFAgf9whFsoL3rPk vAP5147OME9RQ3F9CGQP5epoyqVAK/twGXgZIFxRjJM97l6b+4qqcaRMLldmjvfZtp/g hTifIsQG74JrK5hFgARq04sLxGb7P2nGygPB1DnFV1tFlija8XeEg34NvACoT25k77PD 2ThA== 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=TO4ro9G4vD3zIHyJt/0agdTa39l4m1TB7ZW3wf7lrf0=; b=TwZw27TvQI7W3XYlZKcvLqvJgsBT51YofG3RJmIy6uP6UH/zmPOUYwjEZHYWf8qw0C rUVJGSfifwBXek28fbIU7kjSvTuufONqoR0B87q9zFk4MuggGf24/HDqPaNFlLqVJZm3 1K6FKUfXmEgH9gDKPTn1Uwr9s5hCCohZd/7yy44cz/VoasjHSCHdPA2D+XJhV7rmaeE7 aoW6eo1eFnMz/m7yRP7E9UEeexc/OorNnc9kfqEADjEWUshwZLOIjCiz56pWYa83io+R L8scwJsLdHYtkNYzFrkZCfw8iCHJck4O1zLOv4Fw3Xqt/bWkj+BOuQBdCA4jJEpofjQ0 60bw== X-Gm-Message-State: APjAAAX9twXFujOt/2qTdxev8xsRuJBUedf4A85uU+iXmug5v+sfX+la hpcXb+5FzdbmldFuMJ9GS3I= X-Google-Smtp-Source: APXvYqxwsOHaGPq94M95EVR5OBQt7fgZiB2P/O5Jg9DgUSfO9JLb4kiGFlvW8Na/knMYtda6GHHQNg== X-Received: by 2002:a05:600c:230d:: with SMTP id 13mr11799060wmo.12.1578788204957; Sat, 11 Jan 2020 16:16:44 -0800 (PST) Received: from localhost.localdomain (p200300F1373A1900428D5CFFFEB99DB8.dip0.t-ipconnect.de. [2003:f1:373a:1900:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id h66sm8575535wme.41.2020.01.11.16.16.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Jan 2020 16:16:44 -0800 (PST) From: Martin Blumenstingl To: dri-devel@lists.freedesktop.org, alyssa@rosenzweig.io, steven.price@arm.com, tomeu.vizoso@collabora.com, robh@kernel.org Subject: [PATCH RFT v2 1/3] drm/panfrost: enable devfreq based the "operating-points-v2" property Date: Sun, 12 Jan 2020 01:16:21 +0100 Message-Id: <20200112001623.2121227-2-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200112001623.2121227-1-martin.blumenstingl@googlemail.com> References: <20200112001623.2121227-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200111_161646_542040_A89DF5B1 X-CRM114-Status: GOOD ( 11.80 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:342 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (martin.blumenstingl[at]googlemail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, linux-kernel@vger.kernel.org, Martin Blumenstingl , linux-rockchip@lists.infradead.org, daniel@ffwll.ch, sudeep.holla@arm.com, linux-amlogic@lists.infradead.org, robin.murphy@arm.com Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org Decouple the check to see whether we want to enable devfreq for the GPU from dev_pm_opp_set_regulators(). This is preparation work for adding back support for regulator control (which means we need to call dev_pm_opp_set_regulators() before dev_pm_opp_of_add_table(), which means having a check for "is devfreq enabled" that is not tied to dev_pm_opp_of_add_table() makes things easier). Signed-off-by: Martin Blumenstingl --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 413987038fbf..1471588763ce 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include "panfrost_device.h" @@ -79,10 +80,12 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) struct devfreq *devfreq; struct thermal_cooling_device *cooling; - ret = dev_pm_opp_of_add_table(dev); - if (ret == -ENODEV) /* Optional, continue without devfreq */ + if (!device_property_present(dev, "operating-points-v2")) + /* Optional, continue without devfreq */ return 0; - else if (ret) + + ret = dev_pm_opp_of_add_table(dev); + if (ret) return ret; panfrost_devfreq_reset(pfdev); From patchwork Sun Jan 12 00:16:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 11329011 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 CD574138D for ; Sun, 12 Jan 2020 00:17:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 AB52020848 for ; Sun, 12 Jan 2020 00:17:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AuPIVVA5"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b="vFu1zH2O" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB52020848 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QUsnMypa5eF1+/RIZuYuO+pWRK+fplaYO/eWcns6pBI=; b=AuPIVVA5UCpQFu siyqXgOcvdmy02ztbtm/NG8qXHxgEU8OYjS0tgdbZmMH6XmSgwpAhjdMkwDZoUO/yMsZq+qXtsA6C ff1CGZGwIz/IfnrDDQh7JFUMi9Fg7RSlOOaNGYur2FPXf3GQJi6yAx+Um6v2S+BmzKvzAfwWqBf7z Bgpo9Fw+cpuBBIup/NSO9kDHVZf4KfWYZzOLUgVN9ECAlV9RiSYVJEqkx+ygQxYjoZDvRUmopE7ef AC7zHnk7WHN+JJz/LiUabWWpiYfE55hXZyLVL0R/pVIbY5f2NncDrKOmINzq2YhxjsMVxvysBAKTw wKB34jscoJw4uZQhfj0g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iqQw5-0005nP-UI; Sun, 12 Jan 2020 00:16:57 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iqQvv-0005cu-Bc; Sun, 12 Jan 2020 00:16:48 +0000 Received: by mail-wr1-x444.google.com with SMTP id y11so5191330wrt.6; Sat, 11 Jan 2020 16:16:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=u/ZwSehH+63Wca8LW+bRhFH9IjAyR/Srx1YNfx4JoKc=; b=vFu1zH2Ow9/UtMn8FnIkbj8ye3ZG0bOu0Pf6UW3FtStq7LsxbfNrGKZexZ8gMh+R3w LIFytqdtv6aLFMhHeEMrc3wpr7jrdElrel5sEauFkNVjRiOfrYvXTw8u94Lj+OurjBdE +OfJby1/+M3z4Bp8z9LZAu6r8bTmnQPnIjvZo7ZZeipiwHJGdmNSgyLu8MW7mpmb+C2K BCWoY1HHgjKoR2IQ9afeWq0GbqEQWj+QiIN2BMh7MK8XyJl1gJqiMDAc8AqCo2c2d4X4 h7wpI+lzeFs+ODa6SRFF1+RffGHidTfLvHQrdHfRWFJ/EnzEfTTrE7pAIiJ9u5jGekbg yf4g== 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=u/ZwSehH+63Wca8LW+bRhFH9IjAyR/Srx1YNfx4JoKc=; b=os0+HmP28uDbmO7z9CLJI6H55y1z04F1Q6cLUKksFM4VFCpREz9u5LRXVjLO7Iofx2 rRx5KOxevHxx6lZSuMcDnnddG38pGMw7H7H3mRlaOGfR+tzvd0LkIjnMDX9QFH29L72y Saorr7okOajKENrM0FrC6DIqlb6cOLFHtQTuEXUB3TW3WzHgahcsDXzPsmbnKReN22jF AVZScx2qvDcLdXF4Tcb2REjTC7klQH/P68beVD+EO6P4zhViluT9RYK8ytFompgT2h6k Gq9Nx5CHprU7wu3xhkd/Oew3NCJtUmgCqBBcZQlNEj5MoNonqtnQ1G2Moy0tcCWXnJFU 4k+g== X-Gm-Message-State: APjAAAVl9GnAL8ur71MSof8T63WCWBRz8TObP9MxAI13IlU9lmE5ZtDz C4xHEeIdiqa//XGIvXkFlMc= X-Google-Smtp-Source: APXvYqzhBnH1QtVtoGevRNkruEHHQpOM3dYTmLALFHsUQVXGJIlv0gbK5NlcKnKn5cWW9AvIFcCrJA== X-Received: by 2002:adf:f78e:: with SMTP id q14mr10672631wrp.186.1578788206180; Sat, 11 Jan 2020 16:16:46 -0800 (PST) Received: from localhost.localdomain (p200300F1373A1900428D5CFFFEB99DB8.dip0.t-ipconnect.de. [2003:f1:373a:1900:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id h66sm8575535wme.41.2020.01.11.16.16.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Jan 2020 16:16:45 -0800 (PST) From: Martin Blumenstingl To: dri-devel@lists.freedesktop.org, alyssa@rosenzweig.io, steven.price@arm.com, tomeu.vizoso@collabora.com, robh@kernel.org Subject: [PATCH RFT v2 2/3] drm/panfrost: call dev_pm_opp_of_remove_table() in all error-paths Date: Sun, 12 Jan 2020 01:16:22 +0100 Message-Id: <20200112001623.2121227-3-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200112001623.2121227-1-martin.blumenstingl@googlemail.com> References: <20200112001623.2121227-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200111_161647_396896_97C4CFA3 X-CRM114-Status: GOOD ( 10.44 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:444 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (martin.blumenstingl[at]googlemail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, linux-kernel@vger.kernel.org, Martin Blumenstingl , linux-rockchip@lists.infradead.org, daniel@ffwll.ch, sudeep.holla@arm.com, linux-amlogic@lists.infradead.org, robin.murphy@arm.com Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org If devfreq_recommended_opp() fails we need to undo dev_pm_opp_of_add_table() by calling dev_pm_opp_of_remove_table() (just like we do it in the other error-path below). Fixes: f3ba91228e8e91 ("drm/panfrost: Add initial panfrost driver") Reviewed-by: Steven Price Signed-off-by: Martin Blumenstingl --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 1471588763ce..170f6c8c9651 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -93,8 +93,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)) + if (IS_ERR(opp)) { + dev_pm_opp_of_remove_table(dev); return PTR_ERR(opp); + } panfrost_devfreq_profile.initial_freq = cur_freq; dev_pm_opp_put(opp); From patchwork Sun Jan 12 00:16:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 11329013 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 AE85A109A for ; Sun, 12 Jan 2020 00:17:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 8C4CC20848 for ; Sun, 12 Jan 2020 00:17:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FeDO3Ky7"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b="TvvrlqVK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C4CC20848 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BPHp5+2lgp8AmIfUzXJbYVgaGW09+lmU3pYTd7qsTFY=; b=FeDO3Ky725sUQ6 Dvg66J6+FGDR5/nF5ayY60kewgJuj5xB0wQqfQEuU9s7HZfgaF27b5kRoX8gtF9+WA83U34fUjub6 DphJo0Xfcr+qyUy6LMt5fvB7Rv6f4x5KqzgigbGUrB6pfLPgXO0GfUr1i48w0qMgFjfV341nxDgNE LrzZChSO5/6yNUeUbCeTm1LNONKP1gCcO7V/zULAOJPXUR02bA9Fi7zwQ05yMwAzRUg5w2CllzTKU InJxIQnszFpTto8ttg+PliWkSWFclVG7lIWXbYY2fc89xA8y+4o8PXIj6De0Nvw1fwn02wWMjBr++ EIBTpFd3qKGzEcqOMv7Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iqQw9-0005sJ-M0; Sun, 12 Jan 2020 00:17:01 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iqQvw-0005dL-Pq; Sun, 12 Jan 2020 00:16:50 +0000 Received: by mail-wm1-x341.google.com with SMTP id u2so5832706wmc.3; Sat, 11 Jan 2020 16:16:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=No9N9xYZ+QFAr1x7bc0MPpLHxIMMTgoTSD9/8JFQuIk=; b=TvvrlqVKcqkTNLBPSRxaQEpBBhYhQHqg4aoxLtvU4MZaezCkUEbu521TaNR5r0lvEY Iwqi+i86WFN2n54aIFXI4MuOFinV6B1wvqZSmNByTKWPizjer/JFcSvcsAsNZdKtPIH4 gZjTzfqfskCoUy8ldaBYOBNAsP8x9jgh0JP5b3/zwyaMWLYwYixOTiHL7fWzdMAGB1BZ ibJ+te6jZOkVTPyQ56ENUWCG9kOArwNe1uvo4uEPXLotkSM8oa6OlVwgmJqb8CV4SUcl MTlhOhabjdaZVugYhyxZ4xGim/0h3DhfmyU4182w2D57kKogaApZMgrVB9upj8I644C6 hMdw== 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=No9N9xYZ+QFAr1x7bc0MPpLHxIMMTgoTSD9/8JFQuIk=; b=NcmpbWwkpkiELnl0Sv8p2UuLhqZuTnJCJwp8fgR0eeCbQE0JKij1VIGeS1GAmnLS2v vNB1UXiN+erec4dG0yEw/hXmFhLcnLZRVE5AU/INxHQpM9nQlBRc6Bh+cietf+VnjLnh ala1YMgzyX5ZvHFE11v8wqgILGXLZFx6metuyAAKp5Tsbd/qkqAct6ZF+nvg3WVVBzz1 ooQG7ehsXUMoNO1HU5u6yxjgX/nKn67kaoAWgIdEepDyfXnYvKiSk0y6Av1zw2ditf0j Yu0FUvdwO2pHEqViXPTUWyhn5TVdT8K4g9h+xP/KYdJ/xtcM3YNTnX3qaIoXrMf4XQv5 MwHg== X-Gm-Message-State: APjAAAUiHhhhIFCcpSGzdMQiMMBycoplGZbqsN0JSdutpYKFtR9sPODG fhfN6jtBptqWQ2Kiguurb3A= X-Google-Smtp-Source: APXvYqwyHONLbwGv/sAnDgb6Jev2B1rSuuf3t9Uadi5LTfguJPS85uqYijPkZEdCDdPZ/CHTFuMe1Q== X-Received: by 2002:a1c:dc08:: with SMTP id t8mr12425668wmg.139.1578788207216; Sat, 11 Jan 2020 16:16:47 -0800 (PST) Received: from localhost.localdomain (p200300F1373A1900428D5CFFFEB99DB8.dip0.t-ipconnect.de. [2003:f1:373a:1900:428d:5cff:feb9:9db8]) by smtp.googlemail.com with ESMTPSA id h66sm8575535wme.41.2020.01.11.16.16.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Jan 2020 16:16:46 -0800 (PST) From: Martin Blumenstingl To: dri-devel@lists.freedesktop.org, alyssa@rosenzweig.io, steven.price@arm.com, tomeu.vizoso@collabora.com, robh@kernel.org Subject: [PATCH RFT v2 3/3] drm/panfrost: Use the mali-supply regulator for control again Date: Sun, 12 Jan 2020 01:16:23 +0100 Message-Id: <20200112001623.2121227-4-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200112001623.2121227-1-martin.blumenstingl@googlemail.com> References: <20200112001623.2121227-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200111_161648_857274_0E81FC2F X-CRM114-Status: GOOD ( 16.75 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:341 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (martin.blumenstingl[at]googlemail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, linux-kernel@vger.kernel.org, Martin Blumenstingl , linux-rockchip@lists.infradead.org, daniel@ffwll.ch, sudeep.holla@arm.com, linux-amlogic@lists.infradead.org, robin.murphy@arm.com Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org dev_pm_opp_set_rate() needs a reference to the regulator which should be updated when updating the GPU frequency. The name of the regulator has to be passed at initialization-time using dev_pm_opp_set_regulators(). Add the call to dev_pm_opp_set_regulators() so dev_pm_opp_set_rate() will update the GPU regulator when updating the frequency (just like we did this manually before when we open-coded dev_pm_opp_set_rate()). Fixes: 221bc77914cbcc ("drm/panfrost: Use generic code for devfreq") Reported-by: Robin Murphy Signed-off-by: Martin Blumenstingl --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 33 +++++++++++++++++---- drivers/gpu/drm/panfrost/panfrost_device.h | 1 + 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 170f6c8c9651..3b580a0123e1 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -74,6 +74,7 @@ static struct devfreq_dev_profile panfrost_devfreq_profile = { int panfrost_devfreq_init(struct panfrost_device *pfdev) { int ret; + struct opp_table *opp_table; struct dev_pm_opp *opp; unsigned long cur_freq; struct device *dev = &pfdev->pdev->dev; @@ -84,9 +85,22 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) /* Optional, continue without devfreq */ return 0; + opp_table = dev_pm_opp_set_regulators(dev, + (const char *[]){ "mali" }, + 1); + if (IS_ERR(opp_table)) { + ret = PTR_ERR(opp_table); + + /* Continue if the optional regulator is missing */ + if (ret != -ENODEV) + return ret; + } else { + pfdev->devfreq.regulators_opp_table = opp_table; + } + ret = dev_pm_opp_of_add_table(dev); if (ret) - return ret; + goto err_opp_put_regulators; panfrost_devfreq_reset(pfdev); @@ -94,8 +108,8 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) opp = devfreq_recommended_opp(dev, &cur_freq, 0); if (IS_ERR(opp)) { - dev_pm_opp_of_remove_table(dev); - return PTR_ERR(opp); + ret = PTR_ERR(opp); + goto err_opp_of_remove_table; } panfrost_devfreq_profile.initial_freq = cur_freq; @@ -105,8 +119,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_opp_of_remove_table; } pfdev->devfreq.devfreq = devfreq; @@ -117,6 +131,13 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) pfdev->devfreq.cooling = cooling; return 0; + +err_opp_of_remove_table: + dev_pm_opp_of_remove_table(dev); +err_opp_put_regulators: + if (pfdev->devfreq.regulators_opp_table) + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); + return ret; } void panfrost_devfreq_fini(struct panfrost_device *pfdev) @@ -124,6 +145,8 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev) if (pfdev->devfreq.cooling) devfreq_cooling_unregister(pfdev->devfreq.cooling); dev_pm_opp_of_remove_table(&pfdev->pdev->dev); + if (pfdev->devfreq.regulators_opp_table) + dev_pm_opp_put_regulators(pfdev->devfreq.regulators_opp_table); } void panfrost_devfreq_resume(struct panfrost_device *pfdev) diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h index 06713811b92c..4878b239e301 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.h +++ b/drivers/gpu/drm/panfrost/panfrost_device.h @@ -85,6 +85,7 @@ struct panfrost_device { struct { struct devfreq *devfreq; + struct opp_table *regulators_opp_table; struct thermal_cooling_device *cooling; ktime_t busy_time; ktime_t idle_time;