2018-09-10 19:27:58 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/* Copyright 2019 Collabora ltd. */
|
|
|
|
|
|
|
|
#ifndef __PANFROST_DEVFREQ_H__
|
|
|
|
#define __PANFROST_DEVFREQ_H__
|
|
|
|
|
2020-07-10 09:54:00 +00:00
|
|
|
#include <linux/spinlock.h>
|
2020-07-10 09:53:59 +00:00
|
|
|
#include <linux/ktime.h>
|
|
|
|
|
|
|
|
struct devfreq;
|
2020-07-10 09:54:05 +00:00
|
|
|
struct opp_table;
|
2020-07-10 09:53:59 +00:00
|
|
|
struct thermal_cooling_device;
|
|
|
|
|
|
|
|
struct panfrost_device;
|
|
|
|
|
|
|
|
struct panfrost_devfreq {
|
|
|
|
struct devfreq *devfreq;
|
2020-07-10 09:54:05 +00:00
|
|
|
struct opp_table *regulators_opp_table;
|
2020-07-10 09:53:59 +00:00
|
|
|
struct thermal_cooling_device *cooling;
|
2020-07-10 09:54:01 +00:00
|
|
|
bool opp_of_table_added;
|
2020-07-10 09:54:00 +00:00
|
|
|
|
2020-07-10 09:53:59 +00:00
|
|
|
ktime_t busy_time;
|
|
|
|
ktime_t idle_time;
|
|
|
|
ktime_t time_last_update;
|
2020-07-10 09:54:00 +00:00
|
|
|
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;
|
2020-07-10 09:53:59 +00:00
|
|
|
};
|
|
|
|
|
2018-09-10 19:27:58 +00:00
|
|
|
int panfrost_devfreq_init(struct panfrost_device *pfdev);
|
2019-08-16 09:31:07 +00:00
|
|
|
void panfrost_devfreq_fini(struct panfrost_device *pfdev);
|
2018-09-10 19:27:58 +00:00
|
|
|
|
|
|
|
void panfrost_devfreq_resume(struct panfrost_device *pfdev);
|
|
|
|
void panfrost_devfreq_suspend(struct panfrost_device *pfdev);
|
|
|
|
|
2020-07-10 09:53:59 +00:00
|
|
|
void panfrost_devfreq_record_busy(struct panfrost_devfreq *devfreq);
|
|
|
|
void panfrost_devfreq_record_idle(struct panfrost_devfreq *devfreq);
|
2018-09-10 19:27:58 +00:00
|
|
|
|
|
|
|
#endif /* __PANFROST_DEVFREQ_H__ */
|