mpc5200_dma.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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_end: physical address of end of DMA region
  14. * @period_next_pt: physical address of next DMA buffer to enqueue
  15. * @period_bytes: size of DMA period in bytes
  16. * @ac97_slot_bits: Enable bits for turning on the correct AC97 slot
  17. */
  18. struct psc_dma_stream {
  19. struct snd_pcm_runtime *runtime;
  20. int active;
  21. struct psc_dma *psc_dma;
  22. struct bcom_task *bcom_task;
  23. int irq;
  24. struct snd_pcm_substream *stream;
  25. int period_next;
  26. int period_current;
  27. int period_bytes;
  28. int period_count;
  29. /* AC97 state */
  30. u32 ac97_slot_bits;
  31. };
  32. /**
  33. * psc_dma - Private driver data
  34. * @name: short name for this device ("PSC0", "PSC1", etc)
  35. * @psc_regs: pointer to the PSC's registers
  36. * @fifo_regs: pointer to the PSC's FIFO registers
  37. * @irq: IRQ of this PSC
  38. * @dev: struct device pointer
  39. * @dai: the CPU DAI for this device
  40. * @sicr: Base value used in serial interface control register; mode is ORed
  41. * with this value.
  42. * @playback: Playback stream context data
  43. * @capture: Capture stream context data
  44. */
  45. struct psc_dma {
  46. char name[32];
  47. struct mpc52xx_psc __iomem *psc_regs;
  48. struct mpc52xx_psc_fifo __iomem *fifo_regs;
  49. unsigned int irq;
  50. struct device *dev;
  51. spinlock_t lock;
  52. struct mutex mutex;
  53. u32 sicr;
  54. uint sysclk;
  55. int imr;
  56. int id;
  57. unsigned int slots;
  58. /* per-stream data */
  59. struct psc_dma_stream playback;
  60. struct psc_dma_stream capture;
  61. /* Statistics */
  62. struct {
  63. unsigned long overrun_count;
  64. unsigned long underrun_count;
  65. } stats;
  66. };
  67. /* Utility for retrieving psc_dma_stream structure from a substream */
  68. static inline struct psc_dma_stream *
  69. to_psc_dma_stream(struct snd_pcm_substream *substream, struct psc_dma *psc_dma)
  70. {
  71. if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
  72. return &psc_dma->capture;
  73. return &psc_dma->playback;
  74. }
  75. int mpc5200_audio_dma_create(struct platform_device *op);
  76. int mpc5200_audio_dma_destroy(struct platform_device *op);
  77. #endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */