mpc5200_dma.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Freescale MPC5200 Audio DMA driver
  3. */
  4. #ifndef __SOUND_SOC_FSL_MPC5200_DMA_H__
  5. #define __SOUND_SOC_FSL_MPC5200_DMA_H__
  6. #define PSC_STREAM_NAME_LEN 32
  7. /**
  8. * psc_ac97_stream - Data specific to a single stream (playback or capture)
  9. * @active: flag indicating if the stream is active
  10. * @psc_dma: pointer back to parent psc_dma data structure
  11. * @bcom_task: bestcomm task structure
  12. * @irq: irq number for bestcomm task
  13. * @period_start: physical address of start of DMA region
  14. * @period_end: physical address of end of DMA region
  15. * @period_next_pt: physical address of next DMA buffer to enqueue
  16. * @period_bytes: size of DMA period in bytes
  17. */
  18. struct psc_dma_stream {
  19. struct snd_pcm_runtime *runtime;
  20. snd_pcm_uframes_t appl_ptr;
  21. int active;
  22. struct psc_dma *psc_dma;
  23. struct bcom_task *bcom_task;
  24. int irq;
  25. struct snd_pcm_substream *stream;
  26. dma_addr_t period_start;
  27. dma_addr_t period_end;
  28. dma_addr_t period_next_pt;
  29. dma_addr_t period_current_pt;
  30. int period_bytes;
  31. int period_size;
  32. };
  33. /**
  34. * psc_dma - Private driver data
  35. * @name: short name for this device ("PSC0", "PSC1", etc)
  36. * @psc_regs: pointer to the PSC's registers
  37. * @fifo_regs: pointer to the PSC's FIFO registers
  38. * @irq: IRQ of this PSC
  39. * @dev: struct device pointer
  40. * @dai: the CPU DAI for this device
  41. * @sicr: Base value used in serial interface control register; mode is ORed
  42. * with this value.
  43. * @playback: Playback stream context data
  44. * @capture: Capture stream context data
  45. */
  46. struct psc_dma {
  47. char name[32];
  48. struct mpc52xx_psc __iomem *psc_regs;
  49. struct mpc52xx_psc_fifo __iomem *fifo_regs;
  50. unsigned int irq;
  51. struct device *dev;
  52. spinlock_t lock;
  53. struct mutex mutex;
  54. u32 sicr;
  55. uint sysclk;
  56. int imr;
  57. int id;
  58. unsigned int slots;
  59. /* per-stream data */
  60. struct psc_dma_stream playback;
  61. struct psc_dma_stream capture;
  62. /* Statistics */
  63. struct {
  64. unsigned long overrun_count;
  65. unsigned long underrun_count;
  66. } stats;
  67. };
  68. int mpc5200_audio_dma_create(struct of_device *op);
  69. int mpc5200_audio_dma_destroy(struct of_device *op);
  70. extern struct snd_soc_platform mpc5200_audio_dma_platform;
  71. #endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */