wcd938x-mbhc.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __WCD938X_MBHC_H__
  6. #define __WCD938X_MBHC_H__
  7. #include <asoc/wcd-mbhc-v2.h>
  8. struct wcd938x_mbhc {
  9. struct wcd_mbhc wcd_mbhc;
  10. struct blocking_notifier_head notifier;
  11. struct fw_info *fw_data;
  12. };
  13. #if IS_ENABLED(CONFIG_SND_SOC_WCD938X)
  14. extern int wcd938x_mbhc_init(struct wcd938x_mbhc **mbhc,
  15. struct snd_soc_component *component,
  16. struct fw_info *fw_data);
  17. extern void wcd938x_mbhc_hs_detect_exit(struct snd_soc_component *component);
  18. extern int wcd938x_mbhc_hs_detect(struct snd_soc_component *component,
  19. struct wcd_mbhc_config *mbhc_cfg);
  20. extern void wcd938x_mbhc_deinit(struct snd_soc_component *component);
  21. extern void wcd938x_mbhc_ssr_down(struct wcd938x_mbhc *mbhc,
  22. struct snd_soc_component *component);
  23. extern int wcd938x_mbhc_post_ssr_init(struct wcd938x_mbhc *mbhc,
  24. struct snd_soc_component *component);
  25. extern int wcd938x_mbhc_get_impedance(struct wcd938x_mbhc *wcd938x_mbhc,
  26. uint32_t *zl, uint32_t *zr);
  27. #else
  28. static inline int wcd938x_mbhc_init(struct wcd938x_mbhc **mbhc,
  29. struct snd_soc_component *component,
  30. struct fw_info *fw_data)
  31. {
  32. return 0;
  33. }
  34. static inline void wcd938x_mbhc_hs_detect_exit(
  35. struct snd_soc_component *component)
  36. {
  37. }
  38. static inline int wcd938x_mbhc_hs_detect(struct snd_soc_component *component,
  39. struct wcd_mbhc_config *mbhc_cfg)
  40. {
  41. return 0;
  42. }
  43. static inline void wcd938x_mbhc_deinit(struct snd_soc_component *component)
  44. {
  45. }
  46. static inline void wcd938x_mbhc_ssr_down(struct wcd938x_mbhc *mbhc,
  47. struct snd_soc_component *component)
  48. {
  49. }
  50. static inline int wcd938x_mbhc_post_ssr_init(struct wcd938x_mbhc *mbhc,
  51. struct snd_soc_component *component)
  52. {
  53. return 0;
  54. }
  55. static inline int wcd938x_mbhc_get_impedance(struct wcd938x_mbhc *wcd938x_mbhc,
  56. uint32_t *zl, uint32_t *zr)
  57. {
  58. if (zl)
  59. *zl = 0;
  60. if (zr)
  61. *zr = 0;
  62. return -EINVAL;
  63. }
  64. #endif
  65. #endif /* __WCD938X_MBHC_H__ */