sprd-pcm-dma.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // SPDX-License-Identifier: GPL-2.0
  2. #ifndef __SPRD_PCM_DMA_H
  3. #define __SPRD_PCM_DMA_H
  4. #define DRV_NAME "sprd_pcm_dma"
  5. #define SPRD_PCM_CHANNEL_MAX 2
  6. extern const struct snd_compress_ops sprd_platform_compress_ops;
  7. struct sprd_pcm_dma_params {
  8. dma_addr_t dev_phys[SPRD_PCM_CHANNEL_MAX];
  9. u32 datawidth[SPRD_PCM_CHANNEL_MAX];
  10. u32 fragment_len[SPRD_PCM_CHANNEL_MAX];
  11. const char *chan_name[SPRD_PCM_CHANNEL_MAX];
  12. };
  13. struct sprd_compr_playinfo {
  14. int total_time;
  15. int current_time;
  16. int total_data_length;
  17. int current_data_offset;
  18. };
  19. struct sprd_compr_params {
  20. u32 direction;
  21. u32 rate;
  22. u32 sample_rate;
  23. u32 channels;
  24. u32 format;
  25. u32 period;
  26. u32 periods;
  27. u32 info_phys;
  28. u32 info_size;
  29. };
  30. struct sprd_compr_callback {
  31. void (*drain_notify)(void *data);
  32. void *drain_data;
  33. };
  34. struct sprd_compr_ops {
  35. int (*open)(int str_id, struct sprd_compr_callback *cb);
  36. int (*close)(int str_id);
  37. int (*start)(int str_id);
  38. int (*stop)(int str_id);
  39. int (*pause)(int str_id);
  40. int (*pause_release)(int str_id);
  41. int (*drain)(int received_total);
  42. int (*set_params)(int str_id, struct sprd_compr_params *params);
  43. };
  44. struct sprd_compr_data {
  45. struct sprd_compr_ops *ops;
  46. struct sprd_pcm_dma_params *dma_params;
  47. };
  48. #endif /* __SPRD_PCM_DMA_H */