drv_pmic_codec.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _DRV_PMIC_CODEC_H_
  13. #define _DRV_PMIC_CODEC_H_
  14. #include <stdint.h>
  15. #include <stdbool.h>
  16. #include <stddef.h>
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. typedef enum
  21. {
  22. UNKNOWN_MIC_TYPE,
  23. HEADSET_NO_MIC,
  24. HEADSET_4POLE_NORMAL,
  25. HEADSET_4POLE_NOT_NORMAL,
  26. HEADSET_APPLE,
  27. HEADSET_TYPE_ERR = -1,
  28. } SC2720_HEADSET_TYPE_T;
  29. typedef struct HeadPhoneSt
  30. {
  31. uint32_t Connected;
  32. SC2720_HEADSET_TYPE_T MicType;
  33. } T_HEADPHONE_STATUS;
  34. typedef struct
  35. {
  36. uint32_t headset_stable_max_value; // 2.65v
  37. uint32_t headset_one_half_adc_gnd; //0.15V
  38. uint32_t headset_adc_threshold_3pole_detect; //0.9V
  39. uint32_t headset_half_adc_gnd; //0.05V
  40. uint32_t headset_adc_gnd; // 0.1v
  41. uint32_t headset_key_send_min_vol;
  42. uint32_t headset_key_send_max_vol;
  43. uint32_t headset_key_volup_min_vol;
  44. uint32_t headset_key_volup_max_vol;
  45. uint32_t headset_key_voldown_min_vol;
  46. uint32_t headset_key_voldown_max_vol;
  47. uint32_t coefficient;
  48. } HEADSET_INFO_T, *HEADSET_INFO_T_PTR;
  49. /**
  50. * @brief headset insert depop and other related oper
  51. *
  52. * @heaset_type headset type,
  53. * @return
  54. */
  55. void __sprd_codec_headset_related_oper(uint32_t heaset_type);
  56. /**
  57. * @brief detect headset type.
  58. *
  59. * @return headset type
  60. */
  61. uint32_t __sprd_codec_headset_type_detect(void);
  62. /**
  63. * @brief set headset connection status.
  64. *
  65. * @status headset insert state,
  66. * @return
  67. */
  68. void __sprd_codec_set_headset_connection_status(uint32_t status);
  69. /**
  70. * @brief return the headset insert state.
  71. *
  72. * @return
  73. * true insert.
  74. * false no insert.
  75. */
  76. bool drvPmicAudHeadsetInsertConfirm(void);
  77. /**
  78. * @brief return the headbutton press state.
  79. *
  80. * @return
  81. * true press.
  82. * false no press.
  83. */
  84. bool drvPmicAudHeadButtonPressConfirm(void);
  85. /**
  86. * @brief return the volt for the hmic channel in mV.
  87. *
  88. * @param is_big_scale set the scale of the hmic channel,true use ADC_SCALE_1V250,
  89. * true use ADC_SCALE_1V250,,rg_aud_hedet_v2ad_scale 0
  90. * false use ADC_SCALE_1V250,rg_aud_hedet_v2ad_scale 1
  91. * @return
  92. * -1 failure
  93. * the volt vlaue.
  94. */
  95. uint32_t drvPmicAudGetHmicAdcValue(bool is_big_scale);
  96. /**
  97. * @brief headset detect poweron init.
  98. */
  99. void drvPmicAudHeadsetDectRegInit(void);
  100. #ifdef __cplusplus
  101. }
  102. #endif
  103. #endif