From: Soomin Kim Date: Sun, 14 Aug 2016 12:24:32 +0000 (+0900) Subject: [COMMON] thermal: isp_cooling: Add fucntion to get fps X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c2aaa1c02fcbf52f3a75a8163c9e178b7ef34388;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] thermal: isp_cooling: Add fucntion to get fps isp_cooling_get_fps() is added to get fps value of ISP. Change-Id: Ie6a925649757c6638035831368129c52d771d8d0 Signed-off-by: Soomin Kim --- diff --git a/drivers/thermal/isp_cooling.c b/drivers/thermal/isp_cooling.c index 7353481ec84c..bcdca29ff0c1 100644 --- a/drivers/thermal/isp_cooling.c +++ b/drivers/thermal/isp_cooling.c @@ -99,7 +99,7 @@ static void release_idr(struct idr *idr, int id) enum isp_cooling_property { GET_LEVEL, - GET_FREQ, + GET_FPS, GET_MAXL, }; @@ -166,6 +166,7 @@ static int get_property(unsigned int isp, unsigned long input, } i = 0; + level = (int)input; isp_fps_for_each_valid_entry(pos, table) { /* ignore duplicate entry */ if (fps == pos->fps) @@ -179,7 +180,7 @@ static int get_property(unsigned int isp, unsigned long input, *output = descend ? i : (max_level - i); return 0; } - if (property == GET_FREQ && level == i) { + if (property == GET_FPS && level == i) { /* get fps by level */ *output = fps; return 0; @@ -212,6 +213,26 @@ unsigned long isp_cooling_get_level(unsigned int isp, unsigned int fps) } EXPORT_SYMBOL_GPL(isp_cooling_get_level); +/** + * isp_cooling_get_fps - for a give isp, return the fps value corresponding to cooling level. + * @isp: isp for which the level is required + * @level: the cooling level + * + * This function will match the fps value corresponding to the + * requested @level and return it. + * + * Return: The matched fps value on success or ISP_FPS_INVALID otherwise. + */ +unsigned long isp_cooling_get_fps(unsigned int isp, unsigned long level) +{ + unsigned int val; + + if (get_property(isp, level, &val, GET_FPS)) + return ISP_FPS_INVALID; + + return (unsigned long)val; +} + /** * isp_apply_cooling - function to apply fps clipping. * @isp_device: isp_cooling_device pointer containing fps diff --git a/include/linux/isp_cooling.h b/include/linux/isp_cooling.h index 74de3ae80484..b3290b675145 100644 --- a/include/linux/isp_cooling.h +++ b/include/linux/isp_cooling.h @@ -28,6 +28,8 @@ #include #include +#define ISP_FPS_INVALID ~1 + #ifdef CONFIG_ISP_THERMAL #define ISP_FPS_ENTRY_INVALID ~0 @@ -102,6 +104,7 @@ of_isp_cooling_register(struct device_node *np, void isp_cooling_unregister(struct thermal_cooling_device *cdev); unsigned long isp_cooling_get_level(unsigned int isp, unsigned int fps); +unsigned long isp_cooling_get_fps(unsigned int isp, unsigned long level); #else /* !CONFIG_GPU_THERMAL */ static inline struct thermal_cooling_device * isp_cooling_register(const struct cpumask *clip_gpus) @@ -124,6 +127,11 @@ unsigned long isp_cooling_get_level(unsigned int isp, unsigned int fps) { return THERMAL_CSTATE_INVALID; } +static inline +unsigned long isp_cooling_get_fps(unsigned int isp, unsigned long level) +{ + return ISP_FPS_INVALID; +} #endif /* CONFIG_ISP_THERMAL */ #endif /* __ISP_COOLING_H__ */