46 lines · c
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/devfreq.h>8#include <linux/spinlock.h>9#include <linux/ktime.h>10 11struct devfreq;12struct thermal_cooling_device;13 14struct panfrost_device;15 16struct panfrost_devfreq {17 struct devfreq *devfreq;18 struct thermal_cooling_device *cooling;19 struct devfreq_simple_ondemand_data gov_data;20 bool opp_of_table_added;21 22 unsigned long current_frequency;23 unsigned long fast_rate;24 25 ktime_t busy_time;26 ktime_t idle_time;27 ktime_t time_last_update;28 int busy_count;29 /*30 * Protect busy_time, idle_time, time_last_update and busy_count31 * because these can be updated concurrently between multiple jobs.32 */33 spinlock_t lock;34};35 36int panfrost_devfreq_init(struct panfrost_device *pfdev);37void panfrost_devfreq_fini(struct panfrost_device *pfdev);38 39void panfrost_devfreq_resume(struct panfrost_device *pfdev);40void panfrost_devfreq_suspend(struct panfrost_device *pfdev);41 42void panfrost_devfreq_record_busy(struct panfrost_devfreq *devfreq);43void panfrost_devfreq_record_idle(struct panfrost_devfreq *devfreq);44 45#endif /* __PANFROST_DEVFREQ_H__ */46