From 26129728c001c8640e18acb144b1a2d32aa8798d Mon Sep 17 00:00:00 2001 From: Hyeonseong Gil Date: Tue, 27 Feb 2018 17:48:37 +0900 Subject: [PATCH] [COMMON] soc: samsung: exynos-dm: pass devdata through scaler. Change-Id: I94feea7b905f9840b8893191491a70be3c78b3ba Signed-off-by: Hyeonseong Gil --- drivers/soc/samsung/exynos-dm.c | 16 +++++++++------- include/soc/samsung/exynos-dm.h | 12 +++++++----- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/soc/samsung/exynos-dm.c b/drivers/soc/samsung/exynos-dm.c index aae995e9b2e4..a2423c7a9d6b 100644 --- a/drivers/soc/samsung/exynos-dm.c +++ b/drivers/soc/samsung/exynos-dm.c @@ -468,7 +468,7 @@ static struct list_head *get_max_constraint_list(struct exynos_dm_data *dm_data) * before DVFS driver registration to DVFS framework. * Initialize sequence Step.1 */ -int exynos_dm_data_init(enum exynos_dm_type dm_type, +int exynos_dm_data_init(enum exynos_dm_type dm_type, void *data, u32 min_freq, u32 max_freq, u32 cur_freq) { int ret = 0; @@ -497,6 +497,8 @@ int exynos_dm_data_init(enum exynos_dm_type dm_type, if (!exynos_dm->dm_data[dm_type].max_freq) exynos_dm->dm_data[dm_type].max_freq = max_freq; + exynos_dm->dm_data[dm_type].devdata = data; + out: mutex_unlock(&exynos_dm->lock); @@ -643,7 +645,7 @@ int unregister_exynos_dm_constraint_table(enum exynos_dm_type dm_type, * Initialize sequence Step.3 */ 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 (*scaler_func)(enum exynos_dm_type dm_type, void *devdata, u32 target_freq, unsigned int relation)) { int ret = 0; @@ -1052,7 +1054,7 @@ static int scaling_callback(enum dvfs_direction dir, unsigned int relation) dm = &exynos_dm->dm_data[min_order[i]]; if (dm->constraint_checked) { if (dm->freq_scaler) { - dm->freq_scaler(dm->dm_type, dm->target_freq, relation); + dm->freq_scaler(dm->dm_type, dm->devdata, dm->target_freq, relation); dm->cur_freq = dm->target_freq; } dm->constraint_checked = 0; @@ -1066,7 +1068,7 @@ static int scaling_callback(enum dvfs_direction dir, unsigned int relation) dm = &exynos_dm->dm_data[max_order[i]]; if (dm->constraint_checked) { if (dm->freq_scaler) { - dm->freq_scaler(dm->dm_type, dm->target_freq, relation); + dm->freq_scaler(dm->dm_type, dm->devdata, dm->target_freq, relation); dm->cur_freq = dm->target_freq; } dm->constraint_checked = 0; @@ -1083,7 +1085,7 @@ static int scaling_callback(enum dvfs_direction dir, unsigned int relation) dm = &exynos_dm->dm_data[min_order[i]]; if (dm->constraint_checked) { if (dm->freq_scaler) { - dm->freq_scaler(dm->dm_type, dm->target_freq, relation); + dm->freq_scaler(dm->dm_type, dm->devdata, dm->target_freq, relation); dm->cur_freq = dm->target_freq; } dm->constraint_checked = 0; @@ -1097,7 +1099,7 @@ static int scaling_callback(enum dvfs_direction dir, unsigned int relation) dm = &exynos_dm->dm_data[max_order[i]]; if (dm->constraint_checked) { if (dm->freq_scaler) { - dm->freq_scaler(dm->dm_type, dm->target_freq, relation); + dm->freq_scaler(dm->dm_type, dm->devdata, dm->target_freq, relation); dm->cur_freq = dm->target_freq; } dm->constraint_checked = 0; @@ -1116,7 +1118,7 @@ static int scaling_callback(enum dvfs_direction dir, unsigned int relation) dm = &exynos_dm->dm_data[min_order[i]]; if (dm->constraint_checked) { if (dm->freq_scaler) { - dm->freq_scaler(dm->dm_type, dm->target_freq, relation); + dm->freq_scaler(dm->dm_type, dm->devdata, dm->target_freq, relation); dm->cur_freq = dm->target_freq; } dm->constraint_checked = 0; diff --git a/include/soc/samsung/exynos-dm.h b/include/soc/samsung/exynos-dm.h index f4048c659520..6e7cb30e3089 100644 --- a/include/soc/samsung/exynos-dm.h +++ b/include/soc/samsung/exynos-dm.h @@ -110,7 +110,7 @@ struct exynos_dm_data { u32 policy_min_freq; u32 policy_max_freq; - int (*freq_scaler) (enum exynos_dm_type dm_type, u32 target_freq, unsigned int relation); + int (*freq_scaler)(enum exynos_dm_type dm_type, void *devdata, u32 target_freq, unsigned int relation); struct list_head min_clist; struct list_head max_clist; @@ -118,6 +118,8 @@ struct exynos_dm_data { #ifdef CONFIG_EXYNOS_ACPM u32 cal_id; #endif + + void *devdata; }; struct exynos_dm_device { @@ -128,20 +130,20 @@ struct exynos_dm_device { /* External Function call */ #if defined(CONFIG_EXYNOS_DVFS_MANAGER) -int exynos_dm_data_init(enum exynos_dm_type dm_type, +int exynos_dm_data_init(enum exynos_dm_type dm_type, void *data, 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 (*scaler_func)(enum exynos_dm_type dm_type, void *devdata, 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); #else static inline -int exynos_dm_data_init(enum exynos_dm_type dm_type, +int exynos_dm_data_init(enum exynos_dm_type dm_type, void *data, u32 min_freq, u32 max_freq, u32 cur_freq) { return 0; @@ -160,7 +162,7 @@ int unregister_exynos_dm_constraint_table(enum exynos_dm_type dm_type, } 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)) + int (*scaler_func)(enum exynos_dm_type dm_type, void *devdata, u32 target_freq, unsigned int relation)) { return 0; } -- 2.20.1