msm_common.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* Copyright (c) 2020, 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 _MSM_COMMON_H_
  13. #define _MSM_COMMON_H_
  14. #include <sound/soc.h>
  15. #include <sound/pcm.h>
  16. enum {
  17. MI2S = 0,
  18. TDM,
  19. AUXPCM,
  20. };
  21. enum {
  22. PRI_MI2S_TDM_AUXPCM = 0,
  23. SEC_MI2S_TDM_AUXPCM,
  24. TER_MI2S_TDM_AUXPCM,
  25. QUAT_MI2S_TDM_AUXPCM,
  26. QUIN_MI2S_TDM_AUXPCM,
  27. SEN_MI2S_TDM_AUXPCM,
  28. MI2S_TDM_AUXPCM_MAX,
  29. };
  30. struct msm_common_pdata {
  31. uint8_t *aud_dev_state;
  32. struct kobject aud_dev_kobj;
  33. uint8_t dsp_sessions_closed;
  34. uint32_t num_aud_devs;
  35. struct device_node *mi2s_gpio_p[MI2S_TDM_AUXPCM_MAX];
  36. struct mutex lock[MI2S_TDM_AUXPCM_MAX];
  37. atomic_t mi2s_gpio_ref_cnt[MI2S_TDM_AUXPCM_MAX];
  38. };
  39. struct msm_common_pdata *msm_common_get_pdata(struct snd_soc_card *card);
  40. void msm_common_set_pdata(struct snd_soc_card *card,
  41. struct msm_common_pdata *pdata);
  42. int msm_common_snd_startup(struct snd_pcm_substream *substream);
  43. void msm_common_snd_shutdown(struct snd_pcm_substream *substream);
  44. int msm_common_snd_init(struct platform_device *pdev,
  45. struct snd_soc_card *card);
  46. void msm_common_snd_deinit(struct msm_common_pdata *pdata);
  47. int msm_common_dai_link_init(struct snd_soc_pcm_runtime *rtd);
  48. #endif