wcd9378-mbhc.h 2.0 KB

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