drm/msm: Split out devfreq handling

Before we start adding more cleverness, split it into it's own file.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20210726144653.2180096-2-robdclark@gmail.com
Signed-off-by: Rob Clark <robdclark@chromium.org>
This commit is contained in:
Rob Clark
2021-07-26 07:46:48 -07:00
parent 298287f6e7
commit af5b4fff0f
5 changed files with 165 additions and 121 deletions

View File

@@ -80,6 +80,26 @@ struct msm_gpu_fault_info {
const char *block;
};
/**
* struct msm_gpu_devfreq - devfreq related state
*/
struct msm_gpu_devfreq {
/** devfreq: devfreq instance */
struct devfreq *devfreq;
/**
* busy_cycles:
*
* Used by implementation of gpu->gpu_busy() to track the last
* busy counter value, for calculating elapsed busy cycles since
* last sampling period.
*/
u64 busy_cycles;
/** time: Time of last sampling period. */
ktime_t time;
};
struct msm_gpu {
const char *name;
struct drm_device *dev;
@@ -151,11 +171,7 @@ struct msm_gpu {
struct drm_gem_object *memptrs_bo;
struct {
struct devfreq *devfreq;
u64 busy_cycles;
ktime_t time;
} devfreq;
struct msm_gpu_devfreq devfreq;
uint32_t suspend_count;
@@ -301,7 +317,11 @@ static inline void gpu_write64(struct msm_gpu *gpu, u32 lo, u32 hi, u64 val)
int msm_gpu_pm_suspend(struct msm_gpu *gpu);
int msm_gpu_pm_resume(struct msm_gpu *gpu);
void msm_gpu_resume_devfreq(struct msm_gpu *gpu);
void msm_devfreq_init(struct msm_gpu *gpu);
void msm_devfreq_cleanup(struct msm_gpu *gpu);
void msm_devfreq_resume(struct msm_gpu *gpu);
void msm_devfreq_suspend(struct msm_gpu *gpu);
int msm_gpu_hw_init(struct msm_gpu *gpu);