mtk_charger.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* Copyright Statement:
  2. *
  3. * This software/firmware and related documentation ("MediaTek Software") are
  4. * protected under relevant copyright laws. The information contained herein
  5. * is confidential and proprietary to MediaTek Inc. and/or its licensors.
  6. * Without the prior written permission of MediaTek inc. and/or its licensors,
  7. * any reproduction, modification, use or disclosure of MediaTek Software,
  8. * and information contained herein, in whole or in part, shall be strictly prohibited.
  9. */
  10. /* MediaTek Inc. (C) 2017. All rights reserved.
  11. *
  12. * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  13. * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  14. * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
  15. * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  18. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  19. * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  20. * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
  21. * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
  22. * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
  23. * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
  24. * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
  25. * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
  26. * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  27. * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  28. * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
  29. * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  30. *
  31. * The following software/firmware and/or related documentation ("MediaTek Software")
  32. * have been modified by MediaTek Inc. All revisions are subject to any receiver\'s
  33. * applicable license agreements with MediaTek Inc.
  34. */
  35. #ifndef __MTK_CHARGER_H
  36. #define __MTK_CHARGER_H
  37. #include <printf.h>
  38. struct charger_custom_data {
  39. bool disable_charger;
  40. bool power_path_support;
  41. bool enable_pe_plus;
  42. bool enable_pd20_reset;
  43. int max_charger_voltage;
  44. int min_charger_voltage;
  45. int fast_charge_voltage;
  46. int usb_charger_current;
  47. int ac_charger_current;
  48. int ac_charger_input_current;
  49. int non_std_ac_charger_current;
  50. int charging_host_charger_current;
  51. int ta_ac_charger_current;
  52. int pd_charger_current;
  53. int temp_t4_threshold;
  54. int temp_t3_threshold;
  55. int temp_t1_threshold;
  56. bool enable_anime;
  57. int led_brightness;
  58. int blinking_times;
  59. int blinking_period;
  60. int r_charger_1;
  61. int r_charger_2;
  62. };
  63. unsigned int chr_fdt_getprop_bool(const void *fdt, int nodeoffset, const char *name);
  64. unsigned int chr_fdt_getprop_u32(const void *fdt, int nodeoffset, const char *name);
  65. void chr_fdt_getprop_char_array(const void *fdt, int nodeoffset, const char *name, char *out_value);
  66. void init_charger_custom_data(void);
  67. int init_cust_data_from_dt(void);
  68. int get_bat_volt(int times);
  69. void mtk_charger_start(void);
  70. void check_bat_protect_status(void);
  71. void charger_enable_charging(bool enable);
  72. void charger_enable_power_path(bool enable);
  73. void charger_enable_wdt(bool enable);
  74. bool is_disable_charger(void);
  75. bool is_power_path_supported(void);
  76. void check_charger_volt(void);
  77. void reset_pe_adapter(void);
  78. void reset_pd_adapter(void);
  79. #endif /* __MTK_CHARGER_H */