aqt1000-mbhc.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef __AQT1000_MBHC_H__
  13. #define __AQT1000_MBHC_H__
  14. #include "../wcd-mbhc-v2.h"
  15. struct aqt1000_mbhc {
  16. struct wcd_mbhc wcd_mbhc;
  17. struct blocking_notifier_head notifier;
  18. struct aqt1000 *aqt;
  19. struct fw_info *fw_data;
  20. bool mbhc_started;
  21. };
  22. #if IS_ENABLED(CONFIG_SND_SOC_AQT1000)
  23. extern int aqt_mbhc_init(struct aqt1000_mbhc **mbhc,
  24. struct snd_soc_codec *codec,
  25. struct fw_info *fw_data);
  26. extern void aqt_mbhc_hs_detect_exit(struct snd_soc_codec *codec);
  27. extern int aqt_mbhc_hs_detect(struct snd_soc_codec *codec,
  28. struct wcd_mbhc_config *mbhc_cfg);
  29. extern void aqt_mbhc_deinit(struct snd_soc_codec *codec);
  30. extern int aqt_mbhc_post_ssr_init(struct aqt1000_mbhc *mbhc,
  31. struct snd_soc_codec *codec);
  32. extern int aqt_mbhc_get_impedance(struct aqt1000_mbhc *aqt_mbhc,
  33. uint32_t *zl, uint32_t *zr);
  34. #else
  35. static inline int aqt_mbhc_init(struct aqt1000_mbhc **mbhc,
  36. struct snd_soc_codec *codec,
  37. struct fw_info *fw_data)
  38. {
  39. return 0;
  40. }
  41. static inline void aqt_mbhc_hs_detect_exit(struct snd_soc_codec *codec)
  42. {
  43. }
  44. static inline int aqt_mbhc_hs_detect(struct snd_soc_codec *codec,
  45. struct wcd_mbhc_config *mbhc_cfg)
  46. {
  47. return 0;
  48. }
  49. static inline void aqt_mbhc_deinit(struct snd_soc_codec *codec)
  50. {
  51. }
  52. static inline int aqt_mbhc_post_ssr_init(struct aqt1000_mbhc *mbhc,
  53. struct snd_soc_codec *codec)
  54. {
  55. return 0;
  56. }
  57. static inline int aqt_mbhc_get_impedance(struct aqt1000_mbhc *aqt_mbhc,
  58. uint32_t *zl, uint32_t *zr)
  59. {
  60. if (zl)
  61. *zl = 0;
  62. if (zr)
  63. *zr = 0;
  64. return -EINVAL;
  65. }
  66. #endif
  67. #endif /* __AQT1000_MBHC_H__ */