pass: hal: Add functions for getting available min/max frequency 45/143145/6
authorDongwoo Lee <dwoo08.lee@samsung.com>
Mon, 7 Aug 2017 05:16:24 +0000 (14:16 +0900)
committerDongwoo Lee <dwoo08.lee@samsung.com>
Wed, 16 Aug 2017 01:23:15 +0000 (10:23 +0900)
This patch adds the new functions to HAL dvfs callbacks to get
available minimum and maximum frequency. Available frequency means
that the frequency which can be set to the resource. Thus,
HAL implementation for these function should return the proper value
as following the resource's available frequency list.

Change-Id: Ie39eef51c115e12bb5c2f82d07c557328a8a0e2b
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
src/hal/hal.h
src/pass/pass-hal.c
src/pass/pass-hal.h

index 64c085b92625599895fba0e15ec639c56fd6a2a0..6e2b7aca461aa994d5feb1f7739ccd8a63c46283 100644 (file)
@@ -124,6 +124,10 @@ struct pass_resource_dvfs_ops {
        int (*get_max_freq)(char *res_name);
        int (*set_max_freq)(char *res_name, int freq);
 
+       /* Get the minimum/maximum frequency which can be set to resource. */
+       int (*get_available_min_freq)(char *res_name);
+       int (*get_available_max_freq)(char *res_name);
+
        /* Get and set the up_threshold to support boosting. */
        int (*get_up_threshold)(char *res_name);
        int (*set_up_threshold)(char *res_name, int up_threshold);
index 2308e23c453b22130ec7a6257b40fd16a213042e..b98a4fef7753ff74db9a72ebd1fe2504542bf0c8 100644 (file)
@@ -243,6 +243,51 @@ int pass_set_max_freq(struct pass_resource *res, int freq)
        return dvfs->set_max_freq(res_name, freq);
 }
 
+/* Get the minimum/maximum frequency which can be set to resource. */
+int pass_get_available_min_freq(struct pass_resource *res)
+{
+       struct pass_resource_dvfs_ops *dvfs;
+       char *res_name;
+       int res_type;
+
+       if (!res)
+               return -EINVAL;
+
+       res_name = res->cdata.res_name;
+       res_type = res->cdata.res_type;
+
+       dvfs = get_dvfs(res, res_type);
+       if (!dvfs)
+               return -EINVAL;
+
+       if (!dvfs->get_available_min_freq || !res_name)
+               return -EINVAL;
+
+       return dvfs->get_available_min_freq(res_name);
+}
+
+int pass_get_available_max_freq(struct pass_resource *res)
+{
+       struct pass_resource_dvfs_ops *dvfs;
+       char *res_name;
+       int res_type;
+
+       if (!res)
+               return -EINVAL;
+
+       res_name = res->cdata.res_name;
+       res_type = res->cdata.res_type;
+
+       dvfs = get_dvfs(res, res_type);
+       if (!dvfs)
+               return -EINVAL;
+
+       if (!dvfs->get_available_max_freq || !res_name)
+               return -EINVAL;
+
+       return dvfs->get_available_max_freq(res_name);
+}
+
 /* Get and set the up_threshold for DVFS resource. */
 int pass_get_up_threshold(struct pass_resource *res)
 {
index c430419567890c957bc91a81d1b327524fcb5038..3b45c84e17480c238cd6272a9a5c554869e79cb7 100644 (file)
@@ -51,6 +51,10 @@ int pass_set_min_freq(struct pass_resource *res, int freq);
 int pass_get_max_freq(struct pass_resource *res);
 int pass_set_max_freq(struct pass_resource *res, int freq);
 
+/* Get the minimum/maximum frequency which can be set to resource. */
+int pass_get_available_min_freq(struct pass_resource *res);
+int pass_get_available_max_freq(struct pass_resource *res);
+
 /* Get and set the up_threshold to support boosting. */
 int pass_get_up_threshold(struct pass_resource *res);
 int pass_set_up_threshold(struct pass_resource *res, int up_threshold);