rouleur-mbhc.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* Copyright (c) 2020, The Linux Foundation. All rights reserved.
  3. */
  4. #ifndef __ROULEUR_MBHC_H__
  5. #define __ROULEUR_MBHC_H__
  6. #include <asoc/wcd-mbhc-v2.h>
  7. struct rouleur_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_ROULEUR)
  13. extern int rouleur_mbhc_init(struct rouleur_mbhc **mbhc,
  14. struct snd_soc_component *component,
  15. struct fw_info *fw_data);
  16. extern void rouleur_mbhc_hs_detect_exit(struct snd_soc_component *component);
  17. extern int rouleur_mbhc_hs_detect(struct snd_soc_component *component,
  18. struct wcd_mbhc_config *mbhc_cfg);
  19. extern void rouleur_mbhc_deinit(struct snd_soc_component *component);
  20. extern int rouleur_mbhc_post_ssr_init(struct rouleur_mbhc *mbhc,
  21. struct snd_soc_component *component);
  22. extern void rouleur_mbhc_ssr_down(struct rouleur_mbhc *mbhc,
  23. struct snd_soc_component *component);
  24. extern int rouleur_mbhc_get_impedance(struct rouleur_mbhc *rouleur_mbhc,
  25. uint32_t *zl, uint32_t *zr);
  26. #else
  27. static inline int rouleur_mbhc_init(struct rouleur_mbhc **mbhc,
  28. struct snd_soc_component *component,
  29. struct fw_info *fw_data)
  30. {
  31. return 0;
  32. }
  33. static inline void rouleur_mbhc_hs_detect_exit(
  34. struct snd_soc_component *component)
  35. {
  36. }
  37. static inline int rouleur_mbhc_hs_detect(struct snd_soc_component *component,
  38. struct wcd_mbhc_config *mbhc_cfg)
  39. {
  40. return 0;
  41. }
  42. static inline void rouleur_mbhc_deinit(struct snd_soc_component *component)
  43. {
  44. }
  45. static inline int rouleur_mbhc_post_ssr_init(struct rouleur_mbhc *mbhc,
  46. struct snd_soc_component *component)
  47. {
  48. return 0;
  49. }
  50. static inline void rouleur_mbhc_ssr_down(struct rouleur_mbhc *mbhc,
  51. struct snd_soc_component *component)
  52. {
  53. }
  54. static inline int rouleur_mbhc_get_impedance(struct rouleur_mbhc *rouleur_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 /* __ROULEUR_MBHC_H__ */