From nobody Thu Oct 2 19:28:01 2025 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 687A4340DAB; Fri, 12 Sep 2025 18:38:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757702328; cv=pass; b=p5/PtXGl5azMHoDb3dW0VzmEu++ZswMH90wXGUhBitcwJLa8wj9nzj4vvERVsZ5hKi9YsrEOs+ShVfbAV4qcqU9Gtr6W0o4c7q1hOEq0Dy8R1COEuu7GwhgHUQCkjJ8lMRS4qV+lkmGv4M1JkoxiwQLQvwoGJors+tkPDgtffBQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757702328; c=relaxed/simple; bh=C09om0hSevmo3F26EgHRDJXZTSL3ol4BTavYaJtNduo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cJWlZAGkLBW9XffK4H/cYdP3248BUPdjkv9ry3zEXAT1PHWOVOEXGQcW5lIV7eB5ntuNxUByhr/U/04qQnVki0h3PccgPEcY5rhxazApG5Rp6knPq9RfgOAeDivN4+i9f9TbEHM84zxwT73w35tRyIZ/zHhZAO1GWeQBGHYgnJE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b=OpQH0mzJ; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b="OpQH0mzJ" ARC-Seal: i=1; a=rsa-sha256; t=1757702303; cv=none; d=zohomail.com; s=zohoarc; b=a4tRqvqtJl9R9hCDCmWgA92dpDyvjYyxf5bZaBZnzumlk0K88olDl3cj8sv/AQN9MiDYQfW0cDu+xcB5YOR1fcYGMTLCMw2m6842DX09giz3fTARjh3/LHZTuiFKzt8ZZ+xTMINw5l8v819T1To1eG9OIq48c+o4MQIwWW/s6T8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757702303; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=C8sOpy/rAktuTLkSbEosXeREaQf1wLgvwiE0AeRcq3g=; b=Vxv4qnF4/hRnA6gggJC60iOILrka4iiIG5PRNxo4Rkbhbf9YYw4y3pp+VS0NzRGELT6sHnSjWZKLHDyAoCXdWKibFNk7+TIvIt/UzHJiAVNAB4Pu9tl1/f0A6J6AXooiI2dISM9mnJ/Rf6E+Es5kxLIMbKPBEeklHfZRKjIzF/I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=nicolas.frattaroli@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1757702302; s=zohomail; d=collabora.com; i=nicolas.frattaroli@collabora.com; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:References:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=C8sOpy/rAktuTLkSbEosXeREaQf1wLgvwiE0AeRcq3g=; b=OpQH0mzJjlgF2SVIxCZOAbCy5K9FFiQZ+cLHOXqHG0zoq/rJbknktGNta9M0deEi noAbDTS8LSGEusGxWsg/XWY/o8DcTBrGs/af3v5pU1KytBZrfKFle3YvCIMZAj2o3ly lFik1GOirgeAWXVfZIID3uWgK0Ruj4ZUQI6qx58U= Received: by mx.zohomail.com with SMTPS id 1757702302096356.60938068660244; Fri, 12 Sep 2025 11:38:22 -0700 (PDT) From: Nicolas Frattaroli Date: Fri, 12 Sep 2025 20:37:07 +0200 Subject: [PATCH v2 08/10] drm/panthor: devfreq: expose get_dev_status and make it more generic Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250912-mt8196-gpufreq-v2-8-779a8a3729d9@collabora.com> References: <20250912-mt8196-gpufreq-v2-0-779a8a3729d9@collabora.com> In-Reply-To: <20250912-mt8196-gpufreq-v2-0-779a8a3729d9@collabora.com> To: AngeloGioacchino Del Regno , Boris Brezillon , Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jassi Brar , Kees Cook , "Gustavo A. R. Silva" , Chia-I Wu , Chen-Yu Tsai Cc: kernel@collabora.com, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org, linux-hardening@vger.kernel.org, Nicolas Frattaroli X-Mailer: b4 0.14.2 The only device-specific part of panthor's get_dev_status devfreq callback is getting the clock frequency. All the other logic surrounding what it does may be useful for other devfreq implementations however. Expose it in the panthor_devfreq.h header file, and make it call back into get_cur_freq instead of poking the common clock framework directly. Signed-off-by: Nicolas Frattaroli --- drivers/gpu/drm/panthor/panthor_devfreq.c | 11 ++++++++--- drivers/gpu/drm/panthor/panthor_devfreq.h | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/panthor/panthor_devfreq.c b/drivers/gpu/drm/pa= nthor/panthor_devfreq.c index 02eb3ca15d1874e1cbafc6b614b196c5cc75b6a1..34b621b155f1324ba4f0a07c981= da669d945a545 100644 --- a/drivers/gpu/drm/panthor/panthor_devfreq.c +++ b/drivers/gpu/drm/panthor/panthor_devfreq.c @@ -50,14 +50,18 @@ static void panthor_devfreq_reset(struct panthor_devfre= q *pdevfreq) pdevfreq->time_last_update =3D ktime_get(); } =20 -static int panthor_devfreq_get_dev_status(struct device *dev, - struct devfreq_dev_status *status) +int panthor_devfreq_get_dev_status(struct device *dev, + struct devfreq_dev_status *status) { struct panthor_device *ptdev =3D dev_get_drvdata(dev); struct panthor_devfreq *pdevfreq =3D ptdev->devfreq; + struct devfreq_dev_profile *p =3D pdevfreq->devfreq->profile; unsigned long irqflags; + int ret; =20 - status->current_frequency =3D clk_get_rate(ptdev->clks.core); + ret =3D p->get_cur_freq(dev, &status->current_frequency); + if (ret) + return ret; =20 spin_lock_irqsave(&pdevfreq->lock, irqflags); =20 @@ -79,6 +83,7 @@ static int panthor_devfreq_get_dev_status(struct device *= dev, =20 return 0; } +EXPORT_SYMBOL(panthor_devfreq_get_dev_status); =20 static int panthor_devfreq_get_cur_freq(struct device *dev, unsigned long = *freq) { diff --git a/drivers/gpu/drm/panthor/panthor_devfreq.h b/drivers/gpu/drm/pa= nthor/panthor_devfreq.h index e8b5ccddd45c52ee3215e9c84c6ebd9109640282..a891cb5fdc34636444f141e10f5= d45828fc35b51 100644 --- a/drivers/gpu/drm/panthor/panthor_devfreq.h +++ b/drivers/gpu/drm/panthor/panthor_devfreq.h @@ -52,6 +52,9 @@ void panthor_devfreq_suspend(struct panthor_device *ptdev= ); void panthor_devfreq_record_busy(struct panthor_device *ptdev); void panthor_devfreq_record_idle(struct panthor_device *ptdev); =20 +int panthor_devfreq_get_dev_status(struct device *dev, + struct devfreq_dev_status *status); + unsigned long panthor_devfreq_get_freq(struct panthor_device *ptdev); =20 #endif /* __PANTHOR_DEVFREQ_H__ */ --=20 2.51.0