btfm_codec_hw_interface.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. #ifndef __LINUX_BTFM_CODEC_HW_INTERFACE_H
  6. #define __LINUX_BTFM_CODEC_HW_INTERFACE_H
  7. #include <linux/kernel.h>
  8. #include <linux/bitops.h>
  9. #include <sound/pcm.h>
  10. #include <sound/pcm_params.h>
  11. #include <sound/soc.h>
  12. #include <sound/soc-dapm.h>
  13. #include <sound/tlv.h>
  14. /* This flag is set to indicate btfm codec driver is
  15. * responsible to configure master.
  16. */
  17. #define BTADV_AUDIO_MASTER_CONFIG 0
  18. #define DEVICE_NAME_MAX_LEN 64
  19. struct hwep_comp_drv {
  20. int (*hwep_probe) (struct snd_soc_component *component);
  21. void (*hwep_remove) (struct snd_soc_component *component);
  22. unsigned int (*hwep_read)(struct snd_soc_component *component, unsigned int reg);
  23. int (*hwep_write)(struct snd_soc_component *componentm, unsigned int reg, unsigned int value);
  24. };
  25. struct hwep_dai_ops {
  26. int (*hwep_startup)(void *);
  27. void (*hwep_shutdown)(void *, int);
  28. int (*hwep_hw_params)(void *, uint32_t, uint32_t);
  29. int (*hwep_prepare)(void *, uint32_t, uint32_t, int);
  30. int (*hwep_set_channel_map)(void *, unsigned int, unsigned int *,
  31. unsigned int, unsigned int *);
  32. int (*hwep_get_channel_map)(void *, unsigned int *, unsigned int *,
  33. unsigned int *, unsigned int *, int);
  34. };
  35. struct hwep_dai_driver {
  36. const char *dai_name;
  37. unsigned int id;
  38. struct snd_soc_pcm_stream capture;
  39. struct snd_soc_pcm_stream playback;
  40. struct hwep_dai_ops *dai_ops;
  41. };
  42. struct hwep_data {
  43. struct device *dev;
  44. char driver_name [DEVICE_NAME_MAX_LEN];
  45. struct hwep_comp_drv *drv;
  46. struct hwep_dai_driver *dai_drv;
  47. int num_dai;
  48. unsigned long flags;
  49. };
  50. int btfmcodec_register_hw_ep(struct hwep_data *);
  51. int btfmcodec_unregister_hw_ep(char *);
  52. // ToDo below.
  53. /*
  54. #if IS_ENABLED(CONFIG_SLIM_BTFM_CODEC_DRV)
  55. int btfmcodec_register_hw_ep(struct hwep_data *);
  56. int btfmcodec_unregister_hw_ep(char *);
  57. #else
  58. static inline int btfmcodec_register_hw_ep(struct hwep_data *hwep_info)
  59. {
  60. return -EOPNOTSUPP;
  61. }
  62. static inline int btfmcodec_unregister_hw_ep(char *dev_name)
  63. {
  64. return -EOPNOTSUPP;
  65. }
  66. #endif
  67. */
  68. #endif /*__LINUX_BTFM_CODEC_HW_INTERFACE_H */