cs5535audio.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #ifndef __SOUND_CS5535AUDIO_H
  2. #define __SOUND_CS5535AUDIO_H
  3. #define cs_writel(cs5535au, reg, val) outl(val, (cs5535au)->port + reg)
  4. #define cs_writeb(cs5535au, reg, val) outb(val, (cs5535au)->port + reg)
  5. #define cs_readl(cs5535au, reg) inl((cs5535au)->port + reg)
  6. #define cs_readw(cs5535au, reg) inw((cs5535au)->port + reg)
  7. #define cs_readb(cs5535au, reg) inb((cs5535au)->port + reg)
  8. #define CS5535AUDIO_MAX_DESCRIPTORS 128
  9. /* acc_codec bar0 reg addrs */
  10. #define ACC_GPIO_STATUS 0x00
  11. #define ACC_CODEC_STATUS 0x08
  12. #define ACC_CODEC_CNTL 0x0C
  13. #define ACC_IRQ_STATUS 0x12
  14. #define ACC_BM0_CMD 0x20
  15. #define ACC_BM1_CMD 0x28
  16. #define ACC_BM2_CMD 0x30
  17. #define ACC_BM3_CMD 0x38
  18. #define ACC_BM4_CMD 0x40
  19. #define ACC_BM5_CMD 0x48
  20. #define ACC_BM6_CMD 0x50
  21. #define ACC_BM7_CMD 0x58
  22. #define ACC_BM0_PRD 0x24
  23. #define ACC_BM1_PRD 0x2C
  24. #define ACC_BM2_PRD 0x34
  25. #define ACC_BM3_PRD 0x3C
  26. #define ACC_BM4_PRD 0x44
  27. #define ACC_BM5_PRD 0x4C
  28. #define ACC_BM6_PRD 0x54
  29. #define ACC_BM7_PRD 0x5C
  30. #define ACC_BM0_STATUS 0x21
  31. #define ACC_BM1_STATUS 0x29
  32. #define ACC_BM2_STATUS 0x31
  33. #define ACC_BM3_STATUS 0x39
  34. #define ACC_BM4_STATUS 0x41
  35. #define ACC_BM5_STATUS 0x49
  36. #define ACC_BM6_STATUS 0x51
  37. #define ACC_BM7_STATUS 0x59
  38. #define ACC_BM0_PNTR 0x60
  39. #define ACC_BM1_PNTR 0x64
  40. #define ACC_BM2_PNTR 0x68
  41. #define ACC_BM3_PNTR 0x6C
  42. #define ACC_BM4_PNTR 0x70
  43. #define ACC_BM5_PNTR 0x74
  44. #define ACC_BM6_PNTR 0x78
  45. #define ACC_BM7_PNTR 0x7C
  46. /* acc_codec bar0 reg bits */
  47. /* ACC_IRQ_STATUS */
  48. #define IRQ_STS 0
  49. #define WU_IRQ_STS 1
  50. #define BM0_IRQ_STS 2
  51. #define BM1_IRQ_STS 3
  52. #define BM2_IRQ_STS 4
  53. #define BM3_IRQ_STS 5
  54. #define BM4_IRQ_STS 6
  55. #define BM5_IRQ_STS 7
  56. #define BM6_IRQ_STS 8
  57. #define BM7_IRQ_STS 9
  58. /* ACC_BMX_STATUS */
  59. #define EOP (1<<0)
  60. #define BM_EOP_ERR (1<<1)
  61. /* ACC_BMX_CTL */
  62. #define BM_CTL_EN 0x00000001
  63. #define BM_CTL_PAUSE 0x00000011
  64. #define BM_CTL_DIS 0x00000000
  65. #define BM_CTL_BYTE_ORD_LE 0x00000000
  66. #define BM_CTL_BYTE_ORD_BE 0x00000100
  67. /* cs5535 specific ac97 codec register defines */
  68. #define CMD_MASK 0xFF00FFFF
  69. #define CMD_NEW 0x00010000
  70. #define STS_NEW 0x00020000
  71. #define PRM_RDY_STS 0x00800000
  72. #define ACC_CODEC_CNTL_WR_CMD (~0x80000000)
  73. #define ACC_CODEC_CNTL_RD_CMD 0x80000000
  74. #define PRD_JMP 0x2000
  75. #define PRD_EOP 0x4000
  76. #define PRD_EOT 0x8000
  77. enum { CS5535AUDIO_DMA_PLAYBACK, CS5535AUDIO_DMA_CAPTURE, NUM_CS5535AUDIO_DMAS };
  78. struct cs5535audio;
  79. struct cs5535audio_dma_ops {
  80. int type;
  81. void (*enable_dma)(struct cs5535audio *cs5535au);
  82. void (*disable_dma)(struct cs5535audio *cs5535au);
  83. void (*pause_dma)(struct cs5535audio *cs5535au);
  84. void (*setup_prd)(struct cs5535audio *cs5535au, u32 prd_addr);
  85. u32 (*read_dma_pntr)(struct cs5535audio *cs5535au);
  86. };
  87. struct cs5535audio_dma_desc {
  88. u32 addr;
  89. u16 size;
  90. u16 ctlreserved;
  91. };
  92. struct cs5535audio_dma {
  93. const struct cs5535audio_dma_ops *ops;
  94. struct snd_dma_buffer desc_buf;
  95. struct snd_pcm_substream *substream;
  96. unsigned int buf_addr, buf_bytes;
  97. unsigned int period_bytes, periods;
  98. };
  99. struct cs5535audio {
  100. struct snd_card *card;
  101. struct snd_ac97 *ac97;
  102. int irq;
  103. struct pci_dev *pci;
  104. unsigned long port;
  105. spinlock_t reg_lock;
  106. struct snd_pcm_substream *playback_substream;
  107. struct snd_pcm_substream *capture_substream;
  108. struct cs5535audio_dma dmas[NUM_CS5535AUDIO_DMAS];
  109. };
  110. int __devinit snd_cs5535audio_pcm(struct cs5535audio *cs5535audio);
  111. #endif /* __SOUND_CS5535AUDIO_H */