wcd937x-mbhc.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (c) 2018, The Linux Foundation. All rights reserved.
  3. */
  4. #ifndef __WCD937X_MBHC_H__
  5. #define __WCD937X_MBHC_H__
  6. #include "../wcd-mbhc-v2.h"
  7. struct wcd937x_mbhc {
  8. struct wcd_mbhc wcd_mbhc;
  9. struct blocking_notifier_head notifier;
  10. struct fw_info *fw_data;
  11. };
  12. #if IS_ENABLED(CONFIG_SND_SOC_WCD937X)
  13. extern int wcd937x_mbhc_init(struct wcd937x_mbhc **mbhc,
  14. struct snd_soc_codec *codec,
  15. struct fw_info *fw_data);
  16. extern void wcd937x_mbhc_hs_detect_exit(struct snd_soc_codec *codec);
  17. extern int wcd937x_mbhc_hs_detect(struct snd_soc_codec *codec,
  18. struct wcd_mbhc_config *mbhc_cfg);
  19. extern void wcd937x_mbhc_deinit(struct snd_soc_codec *codec);
  20. extern int wcd937x_mbhc_post_ssr_init(struct wcd937x_mbhc *mbhc,
  21. struct snd_soc_codec *codec);
  22. extern int wcd937x_mbhc_get_impedance(struct wcd937x_mbhc *wcd937x_mbhc,
  23. uint32_t *zl, uint32_t *zr);
  24. #else
  25. static inline int wcd937x_mbhc_init(struct wcd937x_mbhc **mbhc,
  26. struct snd_soc_codec *codec,
  27. struct fw_info *fw_data)
  28. {
  29. return 0;
  30. }
  31. static inline void wcd937x_mbhc_hs_detect_exit(struct snd_soc_codec *codec)
  32. {
  33. }
  34. static inline int wcd937x_mbhc_hs_detect(struct snd_soc_codec *codec,
  35. struct wcd_mbhc_config *mbhc_cfg)
  36. {
  37. return 0;
  38. }
  39. static inline void wcd937x_mbhc_deinit(struct snd_soc_codec *codec)
  40. {
  41. }
  42. static inline int wcd937x_mbhc_post_ssr_init(struct wcd937x_mbhc *mbhc,
  43. struct snd_soc_codec *codec)
  44. {
  45. return 0;
  46. }
  47. static inline int wcd937x_mbhc_get_impedance(struct wcd937x_mbhc *wcd937x_mbhc,
  48. uint32_t *zl, uint32_t *zr)
  49. {
  50. if (zl)
  51. *zl = 0;
  52. if (zr)
  53. *zr = 0;
  54. return -EINVAL;
  55. }
  56. #endif
  57. #endif /* __WCD937X_MBHC_H__ */