harmony.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /* Hewlett-Packard Harmony audio driver
  2. * Copyright (C) 2004, Kyle McMartin <kyle@parisc-linux.org>
  3. */
  4. #ifndef __HARMONY_H__
  5. #define __HARMONY_H__
  6. struct harmony_buffer {
  7. unsigned long addr;
  8. int buf;
  9. int count;
  10. int size;
  11. int coherent;
  12. };
  13. struct snd_harmony {
  14. int irq;
  15. unsigned long hpa; /* hard physical address */
  16. void __iomem *iobase; /* remapped io address */
  17. struct parisc_device *dev;
  18. struct {
  19. u32 gain;
  20. u32 rate;
  21. u32 format;
  22. u32 stereo;
  23. int playing;
  24. int capturing;
  25. } st;
  26. struct snd_dma_device dma; /* playback/capture */
  27. struct harmony_buffer pbuf;
  28. struct harmony_buffer cbuf;
  29. struct snd_dma_buffer gdma; /* graveyard */
  30. struct snd_dma_buffer sdma; /* silence */
  31. struct {
  32. unsigned long play_intr;
  33. unsigned long rec_intr;
  34. unsigned long graveyard_intr;
  35. unsigned long silence_intr;
  36. } stats;
  37. struct snd_pcm *pcm;
  38. struct snd_card *card;
  39. struct snd_pcm_substream *psubs;
  40. struct snd_pcm_substream *csubs;
  41. struct snd_info_entry *proc;
  42. spinlock_t lock;
  43. spinlock_t mixer_lock;
  44. };
  45. #define MAX_PCM_DEVICES 1
  46. #define MAX_PCM_SUBSTREAMS 4
  47. #define MAX_MIDI_DEVICES 0
  48. #define HARMONY_SIZE 64
  49. #define BUF_SIZE PAGE_SIZE
  50. #define MAX_BUFS 16
  51. #define MAX_BUF_SIZE (MAX_BUFS * BUF_SIZE)
  52. #define PLAYBACK_BUFS MAX_BUFS
  53. #define RECORD_BUFS MAX_BUFS
  54. #define GRAVEYARD_BUFS 1
  55. #define GRAVEYARD_BUFSZ (GRAVEYARD_BUFS*BUF_SIZE)
  56. #define SILENCE_BUFS 1
  57. #define SILENCE_BUFSZ (SILENCE_BUFS*BUF_SIZE)
  58. #define HARMONY_ID 0x000
  59. #define HARMONY_RESET 0x004
  60. #define HARMONY_CNTL 0x008
  61. #define HARMONY_GAINCTL 0x00c
  62. #define HARMONY_PNXTADD 0x010
  63. #define HARMONY_PCURADD 0x014
  64. #define HARMONY_RNXTADD 0x018
  65. #define HARMONY_RCURADD 0x01c
  66. #define HARMONY_DSTATUS 0x020
  67. #define HARMONY_OV 0x024
  68. #define HARMONY_PIO 0x028
  69. #define HARMONY_DIAG 0x03c
  70. #define HARMONY_CNTL_C 0x80000000
  71. #define HARMONY_CNTL_ST 0x00000020
  72. #define HARMONY_CNTL_44100 0x00000015 /* HARMONY_SR_44KHZ */
  73. #define HARMONY_CNTL_8000 0x00000008 /* HARMONY_SR_8KHZ */
  74. #define HARMONY_DSTATUS_ID 0x00000000 /* interrupts off */
  75. #define HARMONY_DSTATUS_PN 0x00000200 /* playback fill */
  76. #define HARMONY_DSTATUS_RN 0x00000002 /* record fill */
  77. #define HARMONY_DSTATUS_IE 0x80000000 /* interrupts on */
  78. #define HARMONY_DF_16BIT_LINEAR 0x00000000
  79. #define HARMONY_DF_8BIT_ULAW 0x00000001
  80. #define HARMONY_DF_8BIT_ALAW 0x00000002
  81. #define HARMONY_SS_MONO 0x00000000
  82. #define HARMONY_SS_STEREO 0x00000001
  83. #define HARMONY_GAIN_SILENCE 0x01F00FFF
  84. #define HARMONY_GAIN_DEFAULT 0x01F00FFF
  85. #define HARMONY_GAIN_HE_SHIFT 27 /* headphones enabled */
  86. #define HARMONY_GAIN_HE_MASK (1 << HARMONY_GAIN_HE_SHIFT)
  87. #define HARMONY_GAIN_LE_SHIFT 26 /* line-out enabled */
  88. #define HARMONY_GAIN_LE_MASK (1 << HARMONY_GAIN_LE_SHIFT)
  89. #define HARMONY_GAIN_SE_SHIFT 25 /* internal-speaker enabled */
  90. #define HARMONY_GAIN_SE_MASK (1 << HARMONY_GAIN_SE_SHIFT)
  91. #define HARMONY_GAIN_IS_SHIFT 24 /* input select - 0 for line, 1 for mic */
  92. #define HARMONY_GAIN_IS_MASK (1 << HARMONY_GAIN_IS_SHIFT)
  93. /* monitor attenuation */
  94. #define HARMONY_GAIN_MA 0x0f
  95. #define HARMONY_GAIN_MA_SHIFT 20
  96. #define HARMONY_GAIN_MA_MASK (HARMONY_GAIN_MA << HARMONY_GAIN_MA_SHIFT)
  97. /* input gain */
  98. #define HARMONY_GAIN_IN 0x0f
  99. #define HARMONY_GAIN_LI_SHIFT 16
  100. #define HARMONY_GAIN_LI_MASK (HARMONY_GAIN_IN << HARMONY_GAIN_LI_SHIFT)
  101. #define HARMONY_GAIN_RI_SHIFT 12
  102. #define HARMONY_GAIN_RI_MASK (HARMONY_GAIN_IN << HARMONY_GAIN_RI_SHIFT)
  103. /* output gain (master volume) */
  104. #define HARMONY_GAIN_OUT 0x3f
  105. #define HARMONY_GAIN_LO_SHIFT 6
  106. #define HARMONY_GAIN_LO_MASK (HARMONY_GAIN_OUT << HARMONY_GAIN_LO_SHIFT)
  107. #define HARMONY_GAIN_RO_SHIFT 0
  108. #define HARMONY_GAIN_RO_MASK (HARMONY_GAIN_OUT << HARMONY_GAIN_RO_SHIFT)
  109. #define HARMONY_MAX_OUT (HARMONY_GAIN_RO_MASK >> HARMONY_GAIN_RO_SHIFT)
  110. #define HARMONY_MAX_IN (HARMONY_GAIN_RI_MASK >> HARMONY_GAIN_RI_SHIFT)
  111. #define HARMONY_MAX_MON (HARMONY_GAIN_MA_MASK >> HARMONY_GAIN_MA_SHIFT)
  112. #define HARMONY_SR_8KHZ 0x08
  113. #define HARMONY_SR_16KHZ 0x09
  114. #define HARMONY_SR_27KHZ 0x0A
  115. #define HARMONY_SR_32KHZ 0x0B
  116. #define HARMONY_SR_48KHZ 0x0E
  117. #define HARMONY_SR_9KHZ 0x0F
  118. #define HARMONY_SR_5KHZ 0x10
  119. #define HARMONY_SR_11KHZ 0x11
  120. #define HARMONY_SR_18KHZ 0x12
  121. #define HARMONY_SR_22KHZ 0x13
  122. #define HARMONY_SR_37KHZ 0x14
  123. #define HARMONY_SR_44KHZ 0x15
  124. #define HARMONY_SR_33KHZ 0x16
  125. #define HARMONY_SR_6KHZ 0x17
  126. #endif /* __HARMONY_H__ */