wcd939x-mbhc.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef __WCD939X_MBHC_H__
  7. #define __WCD939X_MBHC_H__
  8. #include <asoc/wcd-mbhc-v2.h>
  9. struct wcd939x_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_WCD939X)
  15. extern int wcd939x_mbhc_init(struct wcd939x_mbhc **mbhc,
  16. struct snd_soc_component *component,
  17. struct fw_info *fw_data);
  18. extern void wcd939x_mbhc_hs_detect_exit(struct snd_soc_component *component);
  19. extern int wcd939x_mbhc_hs_detect(struct snd_soc_component *component,
  20. struct wcd_mbhc_config *mbhc_cfg);
  21. extern void wcd939x_mbhc_deinit(struct snd_soc_component *component);
  22. extern void wcd939x_mbhc_ssr_down(struct wcd939x_mbhc *mbhc,
  23. struct snd_soc_component *component);
  24. extern int wcd939x_mbhc_post_ssr_init(struct wcd939x_mbhc *mbhc,
  25. struct snd_soc_component *component);
  26. extern int wcd939x_mbhc_get_impedance(struct wcd939x_mbhc *wcd939x_mbhc,
  27. uint32_t *zl, uint32_t *zr);
  28. #else
  29. static inline int wcd939x_mbhc_init(struct wcd939x_mbhc **mbhc,
  30. struct snd_soc_component *component,
  31. struct fw_info *fw_data)
  32. {
  33. return 0;
  34. }
  35. static inline void wcd939x_mbhc_hs_detect_exit(
  36. struct snd_soc_component *component)
  37. {
  38. }
  39. static inline int wcd939x_mbhc_hs_detect(struct snd_soc_component *component,
  40. struct wcd_mbhc_config *mbhc_cfg)
  41. {
  42. return 0;
  43. }
  44. static inline void wcd939x_mbhc_deinit(struct snd_soc_component *component)
  45. {
  46. }
  47. static inline void wcd939x_mbhc_ssr_down(struct wcd939x_mbhc *mbhc,
  48. struct snd_soc_component *component)
  49. {
  50. }
  51. static inline int wcd939x_mbhc_post_ssr_init(struct wcd939x_mbhc *mbhc,
  52. struct snd_soc_component *component)
  53. {
  54. return 0;
  55. }
  56. static inline int wcd939x_mbhc_get_impedance(struct wcd939x_mbhc *wcd939x_mbhc,
  57. uint32_t *zl, uint32_t *zr)
  58. {
  59. if (zl)
  60. *zl = 0;
  61. if (zr)
  62. *zr = 0;
  63. return -EINVAL;
  64. }
  65. #endif
  66. #endif /* __WCD939X_MBHC_H__ */