ad1848.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #ifndef __SOUND_AD1848_H
  2. #define __SOUND_AD1848_H
  3. /*
  4. * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
  5. * Definitions for AD1847/AD1848/CS4248 chips
  6. *
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. *
  22. */
  23. #include "pcm.h"
  24. #include <linux/interrupt.h>
  25. #include "wss.h" /* temporary till the driver is removed */
  26. /* IO ports */
  27. #define AD1848P( chip, x ) ( (chip) -> port + c_d_c_AD1848##x )
  28. #define c_d_c_AD1848REGSEL 0
  29. #define c_d_c_AD1848REG 1
  30. #define c_d_c_AD1848STATUS 2
  31. #define c_d_c_AD1848PIO 3
  32. /* codec registers */
  33. #define AD1848_LEFT_INPUT 0x00 /* left input control */
  34. #define AD1848_RIGHT_INPUT 0x01 /* right input control */
  35. #define AD1848_AUX1_LEFT_INPUT 0x02 /* left AUX1 input control */
  36. #define AD1848_AUX1_RIGHT_INPUT 0x03 /* right AUX1 input control */
  37. #define AD1848_AUX2_LEFT_INPUT 0x04 /* left AUX2 input control */
  38. #define AD1848_AUX2_RIGHT_INPUT 0x05 /* right AUX2 input control */
  39. #define AD1848_LEFT_OUTPUT 0x06 /* left output control register */
  40. #define AD1848_RIGHT_OUTPUT 0x07 /* right output control register */
  41. #define AD1848_DATA_FORMAT 0x08 /* clock and data format - playback/capture - bits 7-0 MCE */
  42. #define AD1848_IFACE_CTRL 0x09 /* interface control - bits 7-2 MCE */
  43. #define AD1848_PIN_CTRL 0x0a /* pin control */
  44. #define AD1848_TEST_INIT 0x0b /* test and initialization */
  45. #define AD1848_MISC_INFO 0x0c /* miscellaneous information */
  46. #define AD1848_LOOPBACK 0x0d /* loopback control */
  47. #define AD1848_DATA_UPR_CNT 0x0e /* playback/capture upper base count */
  48. #define AD1848_DATA_LWR_CNT 0x0f /* playback/capture lower base count */
  49. /* definitions for codec register select port - CODECP( REGSEL ) */
  50. #define AD1848_INIT 0x80 /* CODEC is initializing */
  51. #define AD1848_MCE 0x40 /* mode change enable */
  52. #define AD1848_TRD 0x20 /* transfer request disable */
  53. /* definitions for codec status register - CODECP( STATUS ) */
  54. #define AD1848_GLOBALIRQ 0x01 /* IRQ is active */
  55. /* definitions for AD1848_LEFT_INPUT and AD1848_RIGHT_INPUT registers */
  56. #define AD1848_ENABLE_MIC_GAIN 0x20
  57. #define AD1848_MIXS_LINE1 0x00
  58. #define AD1848_MIXS_AUX1 0x40
  59. #define AD1848_MIXS_LINE2 0x80
  60. #define AD1848_MIXS_ALL 0xc0
  61. /* definitions for clock and data format register - AD1848_PLAYBK_FORMAT */
  62. #define AD1848_LINEAR_8 0x00 /* 8-bit unsigned data */
  63. #define AD1848_ALAW_8 0x60 /* 8-bit A-law companded */
  64. #define AD1848_ULAW_8 0x20 /* 8-bit U-law companded */
  65. #define AD1848_LINEAR_16 0x40 /* 16-bit twos complement data - little endian */
  66. #define AD1848_STEREO 0x10 /* stereo mode */
  67. /* bits 3-1 define frequency divisor */
  68. #define AD1848_XTAL1 0x00 /* 24.576 crystal */
  69. #define AD1848_XTAL2 0x01 /* 16.9344 crystal */
  70. /* definitions for interface control register - AD1848_IFACE_CTRL */
  71. #define AD1848_CAPTURE_PIO 0x80 /* capture PIO enable */
  72. #define AD1848_PLAYBACK_PIO 0x40 /* playback PIO enable */
  73. #define AD1848_CALIB_MODE 0x18 /* calibration mode bits */
  74. #define AD1848_AUTOCALIB 0x08 /* auto calibrate */
  75. #define AD1848_SINGLE_DMA 0x04 /* use single DMA channel */
  76. #define AD1848_CAPTURE_ENABLE 0x02 /* capture enable */
  77. #define AD1848_PLAYBACK_ENABLE 0x01 /* playback enable */
  78. /* definitions for pin control register - AD1848_PIN_CTRL */
  79. #define AD1848_IRQ_ENABLE 0x02 /* enable IRQ */
  80. #define AD1848_XCTL1 0x40 /* external control #1 */
  81. #define AD1848_XCTL0 0x80 /* external control #0 */
  82. /* definitions for test and init register - AD1848_TEST_INIT */
  83. #define AD1848_CALIB_IN_PROGRESS 0x20 /* auto calibrate in progress */
  84. #define AD1848_DMA_REQUEST 0x10 /* DMA request in progress */
  85. /* IBM Thinkpad specific stuff */
  86. #define AD1848_THINKPAD_CTL_PORT1 0x15e8
  87. #define AD1848_THINKPAD_CTL_PORT2 0x15e9
  88. #define AD1848_THINKPAD_CS4248_ENABLE_BIT 0x02
  89. /* exported functions */
  90. void snd_ad1848_out(struct snd_wss *chip, unsigned char reg,
  91. unsigned char value);
  92. int snd_ad1848_create(struct snd_card *card,
  93. unsigned long port,
  94. int irq, int dma,
  95. unsigned short hardware,
  96. struct snd_wss **chip);
  97. int snd_ad1848_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm);
  98. const struct snd_pcm_ops *snd_ad1848_get_pcm_ops(int direction);
  99. int snd_ad1848_mixer(struct snd_wss *chip);
  100. #endif /* __SOUND_AD1848_H */