wcd937x-mbhc.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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_component *component,
  15. struct fw_info *fw_data);
  16. extern void wcd937x_mbhc_hs_detect_exit(struct snd_soc_component *component);
  17. extern int wcd937x_mbhc_hs_detect(struct snd_soc_component *component,
  18. struct wcd_mbhc_config *mbhc_cfg);
  19. extern void wcd937x_mbhc_deinit(struct snd_soc_component *component);
  20. extern int wcd937x_mbhc_post_ssr_init(struct wcd937x_mbhc *mbhc,
  21. struct snd_soc_component *component);
  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_component *component,
  27. struct fw_info *fw_data)
  28. {
  29. return 0;
  30. }
  31. static inline void wcd937x_mbhc_hs_detect_exit(
  32. struct snd_soc_component *component)
  33. {
  34. }
  35. static inline int wcd937x_mbhc_hs_detect(struct snd_soc_component *component,
  36. struct wcd_mbhc_config *mbhc_cfg)
  37. {
  38. return 0;
  39. }
  40. static inline void wcd937x_mbhc_deinit(struct snd_soc_component *component)
  41. {
  42. }
  43. static inline int wcd937x_mbhc_post_ssr_init(struct wcd937x_mbhc *mbhc,
  44. struct snd_soc_component *component)
  45. {
  46. return 0;
  47. }
  48. static inline int wcd937x_mbhc_get_impedance(struct wcd937x_mbhc *wcd937x_mbhc,
  49. uint32_t *zl, uint32_t *zr)
  50. {
  51. if (zl)
  52. *zl = 0;
  53. if (zr)
  54. *zr = 0;
  55. return -EINVAL;
  56. }
  57. #endif
  58. #endif /* __WCD937X_MBHC_H__ */