aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/panfrost/panfrost_devfreq.h
diff options
context:
space:
mode:
authorClément Péron <peron.clem@gmail.com>2020-07-10 11:54:00 +0200
committerRob Herring <robh@kernel.org>2020-08-07 10:11:26 -0600
commited85df3f60740bb4be23fbc2db283d59b361a834 (patch)
treecdc3736b348bdab97456effcd549f5539e3a5a89 /drivers/gpu/drm/panfrost/panfrost_devfreq.h
parent9bfacfc82f903b066b0b63460d5b7943705048a4 (diff)
downloadkernel_replicant_linux-ed85df3f60740bb4be23fbc2db283d59b361a834.tar.gz
kernel_replicant_linux-ed85df3f60740bb4be23fbc2db283d59b361a834.tar.bz2
kernel_replicant_linux-ed85df3f60740bb4be23fbc2db283d59b361a834.zip
drm/panfrost: use spinlock instead of atomic
Convert busy_count to a simple int protected by spinlock. Reviewed-by: Steven Price <steven.price@arm.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Signed-off-by: Clément Péron <peron.clem@gmail.com> Signed-off-by: Rob Herring <robh@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200710095409.407087-6-peron.clem@gmail.com
Diffstat (limited to 'drivers/gpu/drm/panfrost/panfrost_devfreq.h')
-rw-r--r--drivers/gpu/drm/panfrost/panfrost_devfreq.h9
1 files changed, 8 insertions, 1 deletions
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 <linux/spinlock.h>
#include <linux/ktime.h>
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);