aqt1000-mbhc.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
  3. */
  4. #ifndef __AQT1000_MBHC_H__
  5. #define __AQT1000_MBHC_H__
  6. #include <asoc/wcd-mbhc-v2.h>
  7. struct aqt1000_mbhc {
  8. struct wcd_mbhc wcd_mbhc;
  9. struct blocking_notifier_head notifier;
  10. struct aqt1000 *aqt;
  11. struct fw_info *fw_data;
  12. bool mbhc_started;
  13. };
  14. #if IS_ENABLED(CONFIG_SND_SOC_AQT1000)
  15. extern int aqt_mbhc_init(struct aqt1000_mbhc **mbhc,
  16. struct snd_soc_component *component,
  17. struct fw_info *fw_data);
  18. extern void aqt_mbhc_hs_detect_exit(struct snd_soc_component *component);
  19. extern int aqt_mbhc_hs_detect(struct snd_soc_component *component,
  20. struct wcd_mbhc_config *mbhc_cfg);
  21. extern void aqt_mbhc_deinit(struct snd_soc_component *component);
  22. extern int aqt_mbhc_post_ssr_init(struct aqt1000_mbhc *mbhc,
  23. struct snd_soc_component *component);
  24. extern int aqt_mbhc_get_impedance(struct aqt1000_mbhc *aqt_mbhc,
  25. uint32_t *zl, uint32_t *zr);
  26. #else
  27. static inline int aqt_mbhc_init(struct aqt1000_mbhc **mbhc,
  28. struct snd_soc_component *component,
  29. struct fw_info *fw_data)
  30. {
  31. return 0;
  32. }
  33. static inline void aqt_mbhc_hs_detect_exit(struct snd_soc_component *component)
  34. {
  35. }
  36. static inline int aqt_mbhc_hs_detect(struct snd_soc_component *component,
  37. struct wcd_mbhc_config *mbhc_cfg)
  38. {
  39. return 0;
  40. }
  41. static inline void aqt_mbhc_deinit(struct snd_soc_component *component)
  42. {
  43. }
  44. static inline int aqt_mbhc_post_ssr_init(struct aqt1000_mbhc *mbhc,
  45. struct snd_soc_component *component)
  46. {
  47. return 0;
  48. }
  49. static inline int aqt_mbhc_get_impedance(struct aqt1000_mbhc *aqt_mbhc,
  50. uint32_t *zl, uint32_t *zr)
  51. {
  52. if (zl)
  53. *zl = 0;
  54. if (zr)
  55. *zr = 0;
  56. return -EINVAL;
  57. }
  58. #endif
  59. #endif /* __AQT1000_MBHC_H__ */