• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright 2019 Collabora ltd. */
3 
4 #ifndef __PANFROST_DEVFREQ_H__
5 #define __PANFROST_DEVFREQ_H__
6 
7 #include <linux/spinlock.h>
8 #include <linux/ktime.h>
9 
10 struct devfreq;
11 struct opp_table;
12 struct thermal_cooling_device;
13 
14 struct panfrost_device;
15 
16 struct panfrost_devfreq {
17 	struct devfreq *devfreq;
18 	struct opp_table *regulators_opp_table;
19 	struct thermal_cooling_device *cooling;
20 	bool opp_of_table_added;
21 
22 	ktime_t busy_time;
23 	ktime_t idle_time;
24 	ktime_t time_last_update;
25 	int busy_count;
26 	/*
27 	 * Protect busy_time, idle_time, time_last_update and busy_count
28 	 * because these can be updated concurrently between multiple jobs.
29 	 */
30 	spinlock_t lock;
31 };
32 
33 int panfrost_devfreq_init(struct panfrost_device *pfdev);
34 void panfrost_devfreq_fini(struct panfrost_device *pfdev);
35 
36 void panfrost_devfreq_resume(struct panfrost_device *pfdev);
37 void panfrost_devfreq_suspend(struct panfrost_device *pfdev);
38 
39 void panfrost_devfreq_record_busy(struct panfrost_devfreq *devfreq);
40 void panfrost_devfreq_record_idle(struct panfrost_devfreq *devfreq);
41 
42 #endif /* __PANFROST_DEVFREQ_H__ */
43