fingerprint_common_qcom.c 2.0 KB

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