blob: c16dcb95db77b4bdaeddee45b52d9d4a5727f930 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#include "fingerprint_common.h"
#include <linux/version.h>
#if (KERNEL_VERSION(5, 4, 0) > LINUX_VERSION_CODE)
#include <linux/cpufreq.h>
#else
#include <linux/cpufreq_limit.h>
extern int set_freq_limit(unsigned int id, unsigned int freq);
#endif
#define FINGER_ID 2
#define LIMIT_RELEASE -1
int spi_clk_enable(struct spi_clk_setting *clk_setting)
{
#ifdef ENABLE_SENSORS_FPRINT_SECURE
if (!clk_setting->enabled_clk) {
__pm_stay_awake(clk_setting->spi_wake_lock);
clk_setting->enabled_clk = true;
}
#endif
return 0;
}
int spi_clk_disable(struct spi_clk_setting *clk_setting)
{
#ifdef ENABLE_SENSORS_FPRINT_SECURE
if (clk_setting->enabled_clk) {
__pm_relax(clk_setting->spi_wake_lock);
clk_setting->enabled_clk = false;
}
#endif
return 0;
}
int cpu_speedup_enable(struct boosting_config *boosting)
{
int retval = 0;
#if defined(CONFIG_CPU_FREQ_LIMIT) || defined(CONFIG_CPU_FREQ_LIMIT_USERSPACE)
if (boosting->min_cpufreq_limit) {
pr_debug("%s\n", __func__);
pm_qos_add_request(&boosting->pm_qos, PM_QOS_CPU_DMA_LATENCY, 0);
retval = set_freq_limit(FINGER_ID, boosting->min_cpufreq_limit);
if (retval)
pr_err("booster start failed. (%d)\n", retval);
}
#else
pr_debug("FP_CPU_SPEEDUP does not supported\n");
#endif
return retval;
}
int cpu_speedup_disable(struct boosting_config *boosting)
{
int retval = 0;
#if defined(CONFIG_CPU_FREQ_LIMIT) || defined(CONFIG_CPU_FREQ_LIMIT_USERSPACE)
if (boosting->min_cpufreq_limit) {
pr_debug("%s\n", __func__);
retval = set_freq_limit(FINGER_ID, LIMIT_RELEASE);
if (retval)
pr_err("booster stop failed. (%d)\n", retval);
pm_qos_remove_request(&boosting->pm_qos);
}
#else
pr_debug("FP_CPU_SPEEDUP does not supported\n");
#endif
return retval;
}
|