wcd-mbhc-v2-api.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef __WCD_MBHC_V2_API_H__
  13. #define __WCD_MBHC_V2_API_H__
  14. #include "wcd-mbhc-v2.h"
  15. #if IS_ENABLED(CONFIG_SND_SOC_WCD_MBHC)
  16. int wcd_mbhc_start(struct wcd_mbhc *mbhc,
  17. struct wcd_mbhc_config *mbhc_cfg);
  18. void wcd_mbhc_stop(struct wcd_mbhc *mbhc);
  19. int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec,
  20. const struct wcd_mbhc_cb *mbhc_cb,
  21. const struct wcd_mbhc_intr *mbhc_cdc_intr_ids,
  22. struct wcd_mbhc_register *wcd_mbhc_regs,
  23. bool impedance_det_en);
  24. int wcd_mbhc_get_impedance(struct wcd_mbhc *mbhc, uint32_t *zl,
  25. uint32_t *zr);
  26. void wcd_mbhc_deinit(struct wcd_mbhc *mbhc);
  27. #else
  28. static inline void wcd_mbhc_stop(struct wcd_mbhc *mbhc)
  29. {
  30. }
  31. int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec,
  32. const struct wcd_mbhc_cb *mbhc_cb,
  33. const struct wcd_mbhc_intr *mbhc_cdc_intr_ids,
  34. struct wcd_mbhc_register *wcd_mbhc_regs,
  35. bool impedance_det_en)
  36. {
  37. return 0;
  38. }
  39. static inline int wcd_mbhc_start(struct wcd_mbhc *mbhc,
  40. struct wcd_mbhc_config *mbhc_cfg)
  41. {
  42. return 0;
  43. }
  44. static inline int wcd_mbhc_get_impedance(struct wcd_mbhc *mbhc,
  45. uint32_t *zl,
  46. uint32_t *zr)
  47. {
  48. *zl = 0;
  49. *zr = 0;
  50. return -EINVAL;
  51. }
  52. static inline void wcd_mbhc_deinit(struct wcd_mbhc *mbhc)
  53. {
  54. }
  55. #endif
  56. #endif /* __WCD_MBHC_V2_API_H__ */