| /* linux/include/soc/samsung/exynos-dm.h |
| * |
| * Copyright (C) 2016 Samsung Electronics Co., Ltd. |
| * http://www.samsung.com |
| * |
| * EXYNOS5 - Header file for exynos DVFS Manager support |
| * |
| * This program is free software; you can redistribute it and/or modify |
| * it under the terms of the GNU General Public License version 2 as |
| * published by the Free Software Foundation. |
| */ |
| |
| #ifndef __EXYNOS_DM_H |
| #define __EXYNOS_DM_H |
| |
| #define EXYNOS_DM_MODULE_NAME "exynos-dm" |
| #define EXYNOS_DM_TYPE_NAME_LEN 16 |
| |
| #define EXYNOS_DM_RELATION_L 0 |
| #define EXYNOS_DM_RELATION_H 1 |
| |
| enum exynos_dm_type { |
| DM_CPU_CL0 = 0, |
| DM_CPU_CL1, |
| DM_MIF, |
| DM_INT, |
| DM_INTCAM, |
| DM_DISP, |
| #if defined(CONFIG_SOC_EXYNOS7885) |
| DM_FSYS, |
| DM_AUD, |
| #endif |
| DM_CAM, |
| DM_GPU, |
| DM_TYPE_END |
| }; |
| |
| static const char dm_type_name[DM_TYPE_END][EXYNOS_DM_TYPE_NAME_LEN] = { |
| "dm_cpu_cl0", |
| "dm_cpu_cl1", |
| "dm_mif", |
| "dm_int", |
| "dm_intcam", |
| "dm_disp", |
| #if defined(CONFIG_SOC_EXYNOS7885) |
| "dm_fsys", |
| "dm_aud", |
| #endif |
| "dm_cam", |
| "dm_gpu", |
| }; |
| |
| enum exynos_dvfs_type { |
| DVFS_CPUFREQ = 0, |
| DVFS_DEVFREQ, |
| DVFS_GPU, |
| DVFS_TYPE_END |
| }; |
| |
| enum exynos_constraint_type { |
| CONSTRAINT_MIN = 0, |
| CONSTRAINT_MAX, |
| CONSTRAINT_END |
| }; |
| |
| enum dvfs_direction { |
| DOWN = 0, |
| UP, |
| DIRECTION_END |
| }; |
| |
| struct exynos_dm_freq { |
| u32 master_freq; |
| u32 constraint_freq; |
| }; |
| |
| struct exynos_dm_constraint { |
| struct list_head node; |
| |
| bool guidance; /* check constraint table by hw guide */ |
| u32 table_length; |
| |
| enum exynos_constraint_type constraint_type; |
| enum exynos_dm_type constraint_dm_type; |
| char dm_type_name[EXYNOS_DM_TYPE_NAME_LEN]; |
| struct exynos_dm_freq *freq_table; |
| u32 min_freq; |
| u32 max_freq; |
| |
| struct exynos_dm_constraint *sub_constraint; |
| }; |
| |
| struct exynos_dm_data { |
| bool available; /* use for DVFS domain available */ |
| #ifdef CONFIG_EXYNOS_ACPM |
| bool policy_use; |
| #endif |
| enum exynos_dm_type dm_type; |
| enum exynos_dvfs_type dvfs_type; |
| char dm_type_name[EXYNOS_DM_TYPE_NAME_LEN]; |
| |
| u32 min_freq; |
| u32 max_freq; |
| u32 cur_freq; |
| u32 target_freq; |
| |
| u32 gov_min_freq; |
| |
| u32 policy_min_freq; |
| u32 policy_max_freq; |
| |
| int (*freq_scaler) (enum exynos_dm_type dm_type, u32 target_freq, unsigned int relation); |
| |
| struct list_head min_clist; |
| struct list_head max_clist; |
| u32 constraint_checked; |
| #ifdef CONFIG_EXYNOS_ACPM |
| u32 cal_id; |
| #endif |
| }; |
| |
| struct exynos_dm_device { |
| struct device *dev; |
| struct mutex lock; |
| struct exynos_dm_data dm_data[DM_TYPE_END]; |
| }; |
| |
| /* External Function call */ |
| #if defined(CONFIG_EXYNOS_DVFS_MANAGER) |
| int exynos_dm_data_init(enum exynos_dm_type dm_type, |
| u32 min_freq, u32 max_freq, u32 cur_freq); |
| int register_exynos_dm_constraint_table(enum exynos_dm_type dm_type, |
| struct exynos_dm_constraint *constraint); |
| int unregister_exynos_dm_constraint_table(enum exynos_dm_type dm_type, |
| struct exynos_dm_constraint *constraint); |
| int register_exynos_dm_freq_scaler(enum exynos_dm_type dm_type, |
| int (*scaler_func)(enum exynos_dm_type dm_type, u32 target_freq, unsigned int relation)); |
| int unregister_exynos_dm_freq_scaler(enum exynos_dm_type dm_type); |
| int policy_update_call_to_DM(enum exynos_dm_type dm_type, u32 min_freq, u32 max_freq); |
| int DM_CALL(enum exynos_dm_type dm_type, unsigned long *target_freq); |
| int policy_update_with_DM_CALL(enum exynos_dm_type dm_type, u32 min_freq, u32 max_freq, unsigned long *target_freq); |
| #else |
| static inline |
| int exynos_dm_data_init(enum exynos_dm_type dm_type, |
| u32 min_freq, u32 max_freq, u32 cur_freq) |
| { |
| return 0; |
| } |
| static inline |
| int register_exynos_dm_constraint_table(enum exynos_dm_type dm_type, |
| struct exynos_dm_constraint *constraint) |
| { |
| return 0; |
| } |
| static inline |
| int unregister_exynos_dm_constraint_table(enum exynos_dm_type dm_type, |
| struct exynos_dm_constraint *constraint) |
| { |
| return 0; |
| } |
| static inline |
| int register_exynos_dm_freq_scaler(enum exynos_dm_type dm_type, |
| int (*scaler_func)(enum exynos_dm_type dm_type, u32 target_freq, unsigned int relation)) |
| { |
| return 0; |
| } |
| static inline |
| int unregister_exynos_dm_freq_scaler(enum exynos_dm_type dm_type) |
| { |
| return 0; |
| } |
| static inline |
| int policy_update_call_to_DM(enum exynos_dm_type dm_type, u32 min_freq, u32 max_freq) |
| { |
| return 0; |
| } |
| static inline |
| int DM_CALL(enum exynos_dm_type dm_type, unsigned long *target_freq) |
| { |
| return 0; |
| } |
| static inline |
| int policy_update_with_DM_CALL(enum exynos_dm_type dm_type, u32 min_freq, u32 max_freq, unsigned long *target_freq) |
| { |
| return 0; |
| } |
| #endif |
| |
| #endif /* __EXYNOS_DM_H */ |