Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright 2019 Collabora ltd. */
0003 
0004 #ifndef __PANFROST_DEVFREQ_H__
0005 #define __PANFROST_DEVFREQ_H__
0006 
0007 #include <linux/devfreq.h>
0008 #include <linux/spinlock.h>
0009 #include <linux/ktime.h>
0010 
0011 struct devfreq;
0012 struct thermal_cooling_device;
0013 
0014 struct panfrost_device;
0015 
0016 struct panfrost_devfreq {
0017     struct devfreq *devfreq;
0018     struct thermal_cooling_device *cooling;
0019     struct devfreq_simple_ondemand_data gov_data;
0020     bool opp_of_table_added;
0021 
0022     ktime_t busy_time;
0023     ktime_t idle_time;
0024     ktime_t time_last_update;
0025     int busy_count;
0026     /*
0027      * Protect busy_time, idle_time, time_last_update and busy_count
0028      * because these can be updated concurrently between multiple jobs.
0029      */
0030     spinlock_t lock;
0031 };
0032 
0033 int panfrost_devfreq_init(struct panfrost_device *pfdev);
0034 void panfrost_devfreq_fini(struct panfrost_device *pfdev);
0035 
0036 void panfrost_devfreq_resume(struct panfrost_device *pfdev);
0037 void panfrost_devfreq_suspend(struct panfrost_device *pfdev);
0038 
0039 void panfrost_devfreq_record_busy(struct panfrost_devfreq *devfreq);
0040 void panfrost_devfreq_record_idle(struct panfrost_devfreq *devfreq);
0041 
0042 #endif /* __PANFROST_DEVFREQ_H__ */