at32-pcm.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* sound/soc/at32/at32-pcm.h
  2. * ASoC PCM interface for Atmel AT32 SoC
  3. *
  4. * Copyright (C) 2008 Long Range Systems
  5. * Geoffrey Wossum <gwossum@acm.org>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef __SOUND_SOC_AT32_AT32_PCM_H
  12. #define __SOUND_SOC_AT32_AT32_PCM_H __FILE__
  13. #include <linux/atmel-ssc.h>
  14. /*
  15. * Registers and status bits that are required by the PCM driver
  16. * TODO: Is ptcr really used?
  17. */
  18. struct at32_pdc_regs {
  19. u32 xpr; /* PDC RX/TX pointer */
  20. u32 xcr; /* PDC RX/TX counter */
  21. u32 xnpr; /* PDC next RX/TX pointer */
  22. u32 xncr; /* PDC next RX/TX counter */
  23. u32 ptcr; /* PDC transfer control */
  24. };
  25. /*
  26. * SSC mask info
  27. */
  28. struct at32_ssc_mask {
  29. u32 ssc_enable; /* SSC RX/TX enable */
  30. u32 ssc_disable; /* SSC RX/TX disable */
  31. u32 ssc_endx; /* SSC ENDTX or ENDRX */
  32. u32 ssc_endbuf; /* SSC TXBUFF or RXBUFF */
  33. u32 pdc_enable; /* PDC RX/TX enable */
  34. u32 pdc_disable; /* PDC RX/TX disable */
  35. };
  36. /*
  37. * This structure, shared between the PCM driver and the interface,
  38. * contains all information required by the PCM driver to perform the
  39. * PDC DMA operation. All fields except dma_intr_handler() are initialized
  40. * by the interface. The dms_intr_handler() pointer is set by the PCM
  41. * driver and called by the interface SSC interrupt handler if it is
  42. * non-NULL.
  43. */
  44. struct at32_pcm_dma_params {
  45. char *name; /* stream identifier */
  46. int pdc_xfer_size; /* PDC counter increment in bytes */
  47. struct ssc_device *ssc; /* SSC device for stream */
  48. struct at32_pdc_regs *pdc; /* PDC register info */
  49. struct at32_ssc_mask *mask; /* SSC mask info */
  50. struct snd_pcm_substream *substream;
  51. void (*dma_intr_handler) (u32, struct snd_pcm_substream *);
  52. };
  53. /*
  54. * The AT32 ASoC platform driver
  55. */
  56. extern struct snd_soc_platform at32_soc_platform;
  57. /*
  58. * SSC register access (since ssc_writel() / ssc_readl() require literal name)
  59. */
  60. #define ssc_readx(base, reg) (__raw_readl((base) + (reg)))
  61. #define ssc_writex(base, reg, value) __raw_writel((value), (base) + (reg))
  62. #endif /* __SOUND_SOC_AT32_AT32_PCM_H */