Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright 2020 Martin Blumenstingl <martin.blumenstingl@googlemail.com> */
0003 
0004 #ifndef __LIMA_DEVFREQ_H__
0005 #define __LIMA_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 lima_device;
0015 
0016 struct lima_devfreq {
0017     struct devfreq *devfreq;
0018     struct thermal_cooling_device *cooling;
0019     struct devfreq_simple_ondemand_data gov_data;
0020 
0021     ktime_t busy_time;
0022     ktime_t idle_time;
0023     ktime_t time_last_update;
0024     int busy_count;
0025     /*
0026      * Protect busy_time, idle_time, time_last_update and busy_count
0027      * because these can be updated concurrently, for example by the GP
0028      * and PP interrupts.
0029      */
0030     spinlock_t lock;
0031 };
0032 
0033 int lima_devfreq_init(struct lima_device *ldev);
0034 void lima_devfreq_fini(struct lima_device *ldev);
0035 
0036 void lima_devfreq_record_busy(struct lima_devfreq *devfreq);
0037 void lima_devfreq_record_idle(struct lima_devfreq *devfreq);
0038 
0039 int lima_devfreq_resume(struct lima_devfreq *devfreq);
0040 int lima_devfreq_suspend(struct lima_devfreq *devfreq);
0041 
0042 #endif