[COMMON] soc: samsung: exynos-dm: pass devdata through scaler.
authorHyeonseong Gil <hs.gil@samsung.com>
Tue, 27 Feb 2018 08:48:37 +0000 (17:48 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:26:10 +0000 (17:26 +0900)
Change-Id: I94feea7b905f9840b8893191491a70be3c78b3ba
Signed-off-by: Hyeonseong Gil <hs.gil@samsung.com>
drivers/soc/samsung/exynos-dm.c
include/soc/samsung/exynos-dm.h

index aae995e9b2e445d42c0cde5d2984a570fe9cbb70..a2423c7a9d6bc1f74e198588347afcc812c92ef3 100644 (file)
@@ -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;
index f4048c6595208f5421159deb42091ba64bf9eb64..6e7cb30e3089c3206c7717e20eb40f511545c12d 100644 (file)
@@ -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;
 }