ad1816a.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. #ifndef __SOUND_AD1816A_H
  2. #define __SOUND_AD1816A_H
  3. /*
  4. ad1816a.h - definitions for ADI SoundPort AD1816A chip.
  5. Copyright (C) 1999-2000 by Massimo Piccioni <dafastidio@libero.it>
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. */
  18. #include <sound/control.h>
  19. #include <sound/pcm.h>
  20. #include <sound/timer.h>
  21. #define AD1816A_REG(r) (chip->port + r)
  22. #define AD1816A_CHIP_STATUS 0x00
  23. #define AD1816A_INDIR_ADDR 0x00
  24. #define AD1816A_INTERRUPT_STATUS 0x01
  25. #define AD1816A_INDIR_DATA_LOW 0x02
  26. #define AD1816A_INDIR_DATA_HIGH 0x03
  27. #define AD1816A_PIO_DEBUG 0x04
  28. #define AD1816A_PIO_STATUS 0x05
  29. #define AD1816A_PIO_DATA 0x06
  30. #define AD1816A_RESERVED_7 0x07
  31. #define AD1816A_PLAYBACK_CONFIG 0x08
  32. #define AD1816A_CAPTURE_CONFIG 0x09
  33. #define AD1816A_RESERVED_10 0x0a
  34. #define AD1816A_RESERVED_11 0x0b
  35. #define AD1816A_JOYSTICK_RAW_DATA 0x0c
  36. #define AD1816A_JOYSTICK_CTRL 0x0d
  37. #define AD1816A_JOY_POS_DATA_LOW 0x0e
  38. #define AD1816A_JOY_POS_DATA_HIGH 0x0f
  39. #define AD1816A_LOW_BYTE_TMP 0x00
  40. #define AD1816A_INTERRUPT_ENABLE 0x01
  41. #define AD1816A_EXTERNAL_CTRL 0x01
  42. #define AD1816A_PLAYBACK_SAMPLE_RATE 0x02
  43. #define AD1816A_CAPTURE_SAMPLE_RATE 0x03
  44. #define AD1816A_VOICE_ATT 0x04
  45. #define AD1816A_FM_ATT 0x05
  46. #define AD1816A_I2S_1_ATT 0x06
  47. #define AD1816A_I2S_0_ATT 0x07
  48. #define AD1816A_PLAYBACK_BASE_COUNT 0x08
  49. #define AD1816A_PLAYBACK_CURR_COUNT 0x09
  50. #define AD1816A_CAPTURE_BASE_COUNT 0x0a
  51. #define AD1816A_CAPTURE_CURR_COUNT 0x0b
  52. #define AD1816A_TIMER_BASE_COUNT 0x0c
  53. #define AD1816A_TIMER_CURR_COUNT 0x0d
  54. #define AD1816A_MASTER_ATT 0x0e
  55. #define AD1816A_CD_GAIN_ATT 0x0f
  56. #define AD1816A_SYNTH_GAIN_ATT 0x10
  57. #define AD1816A_VID_GAIN_ATT 0x11
  58. #define AD1816A_LINE_GAIN_ATT 0x12
  59. #define AD1816A_MIC_GAIN_ATT 0x13
  60. #define AD1816A_PHONE_IN_GAIN_ATT 0x13
  61. #define AD1816A_ADC_SOURCE_SEL 0x14
  62. #define AD1816A_ADC_PGA 0x14
  63. #define AD1816A_CHIP_CONFIG 0x20
  64. #define AD1816A_DSP_CONFIG 0x21
  65. #define AD1816A_FM_SAMPLE_RATE 0x22
  66. #define AD1816A_I2S_1_SAMPLE_RATE 0x23
  67. #define AD1816A_I2S_0_SAMPLE_RATE 0x24
  68. #define AD1816A_RESERVED_37 0x25
  69. #define AD1816A_PROGRAM_CLOCK_RATE 0x26
  70. #define AD1816A_3D_PHAT_CTRL 0x27
  71. #define AD1816A_PHONE_OUT_ATT 0x27
  72. #define AD1816A_RESERVED_40 0x28
  73. #define AD1816A_HW_VOL_BUT 0x29
  74. #define AD1816A_DSP_MAILBOX_0 0x2a
  75. #define AD1816A_DSP_MAILBOX_1 0x2b
  76. #define AD1816A_POWERDOWN_CTRL 0x2c
  77. #define AD1816A_TIMER_CTRL 0x2c
  78. #define AD1816A_VERSION_ID 0x2d
  79. #define AD1816A_RESERVED_46 0x2e
  80. #define AD1816A_READY 0x80
  81. #define AD1816A_PLAYBACK_IRQ_PENDING 0x80
  82. #define AD1816A_CAPTURE_IRQ_PENDING 0x40
  83. #define AD1816A_TIMER_IRQ_PENDING 0x20
  84. #define AD1816A_PLAYBACK_ENABLE 0x01
  85. #define AD1816A_PLAYBACK_PIO 0x02
  86. #define AD1816A_CAPTURE_ENABLE 0x01
  87. #define AD1816A_CAPTURE_PIO 0x02
  88. #define AD1816A_FMT_LINEAR_8 0x00
  89. #define AD1816A_FMT_ULAW_8 0x08
  90. #define AD1816A_FMT_LINEAR_16_LIT 0x10
  91. #define AD1816A_FMT_ALAW_8 0x18
  92. #define AD1816A_FMT_LINEAR_16_BIG 0x30
  93. #define AD1816A_FMT_ALL 0x38
  94. #define AD1816A_FMT_STEREO 0x04
  95. #define AD1816A_PLAYBACK_IRQ_ENABLE 0x8000
  96. #define AD1816A_CAPTURE_IRQ_ENABLE 0x4000
  97. #define AD1816A_TIMER_IRQ_ENABLE 0x2000
  98. #define AD1816A_TIMER_ENABLE 0x0080
  99. #define AD1816A_SRC_LINE 0x00
  100. #define AD1816A_SRC_OUT 0x10
  101. #define AD1816A_SRC_CD 0x20
  102. #define AD1816A_SRC_SYNTH 0x30
  103. #define AD1816A_SRC_VIDEO 0x40
  104. #define AD1816A_SRC_MIC 0x50
  105. #define AD1816A_SRC_MONO 0x50
  106. #define AD1816A_SRC_PHONE_IN 0x60
  107. #define AD1816A_SRC_MASK 0x70
  108. #define AD1816A_CAPTURE_NOT_EQUAL 0x1000
  109. #define AD1816A_WSS_ENABLE 0x8000
  110. struct snd_ad1816a {
  111. unsigned long port;
  112. struct resource *res_port;
  113. int irq;
  114. int dma1;
  115. int dma2;
  116. unsigned short hardware;
  117. unsigned short version;
  118. spinlock_t lock;
  119. unsigned short mode;
  120. unsigned int clock_freq;
  121. struct snd_card *card;
  122. struct snd_pcm *pcm;
  123. struct snd_pcm_substream *playback_substream;
  124. struct snd_pcm_substream *capture_substream;
  125. unsigned int p_dma_size;
  126. unsigned int c_dma_size;
  127. struct snd_timer *timer;
  128. #ifdef CONFIG_PM
  129. unsigned short image[48];
  130. #endif
  131. };
  132. #define AD1816A_HW_AUTO 0
  133. #define AD1816A_HW_AD1816A 1
  134. #define AD1816A_HW_AD1815 2
  135. #define AD1816A_HW_AD18MAX10 3
  136. #define AD1816A_MODE_PLAYBACK 0x01
  137. #define AD1816A_MODE_CAPTURE 0x02
  138. #define AD1816A_MODE_TIMER 0x04
  139. #define AD1816A_MODE_OPEN (AD1816A_MODE_PLAYBACK | \
  140. AD1816A_MODE_CAPTURE | \
  141. AD1816A_MODE_TIMER)
  142. extern int snd_ad1816a_create(struct snd_card *card, unsigned long port,
  143. int irq, int dma1, int dma2,
  144. struct snd_ad1816a *chip);
  145. extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device);
  146. extern int snd_ad1816a_mixer(struct snd_ad1816a *chip);
  147. extern int snd_ad1816a_timer(struct snd_ad1816a *chip, int device);
  148. #ifdef CONFIG_PM
  149. extern void snd_ad1816a_suspend(struct snd_ad1816a *chip);
  150. extern void snd_ad1816a_resume(struct snd_ad1816a *chip);
  151. #endif
  152. #endif /* __SOUND_AD1816A_H */