es1688.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #ifndef __SOUND_ES1688_H
  2. #define __SOUND_ES1688_H
  3. /*
  4. * Header file for ES488/ES1688
  5. * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
  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 <sound/control.h>
  24. #include <sound/pcm.h>
  25. #include <linux/interrupt.h>
  26. #define ES1688_HW_AUTO 0x0000
  27. #define ES1688_HW_688 0x0001
  28. #define ES1688_HW_1688 0x0002
  29. #define ES1688_HW_UNDEF 0x0003
  30. struct snd_es1688 {
  31. unsigned long port; /* port of ESS chip */
  32. struct resource *res_port;
  33. unsigned long mpu_port; /* MPU-401 port of ESS chip */
  34. int irq; /* IRQ number of ESS chip */
  35. int mpu_irq; /* MPU IRQ */
  36. int dma8; /* 8-bit DMA */
  37. unsigned short version; /* version of ESS chip */
  38. unsigned short hardware; /* see to ES1688_HW_XXXX */
  39. unsigned short trigger_value;
  40. unsigned char pad;
  41. unsigned int dma_size;
  42. struct snd_pcm *pcm;
  43. struct snd_pcm_substream *playback_substream;
  44. struct snd_pcm_substream *capture_substream;
  45. spinlock_t reg_lock;
  46. spinlock_t mixer_lock;
  47. };
  48. /* I/O ports */
  49. #define ES1688P(codec, x) ((codec)->port + e_s_s_ESS1688##x)
  50. #define e_s_s_ESS1688RESET 0x6
  51. #define e_s_s_ESS1688READ 0xa
  52. #define e_s_s_ESS1688WRITE 0xc
  53. #define e_s_s_ESS1688COMMAND 0xc
  54. #define e_s_s_ESS1688STATUS 0xc
  55. #define e_s_s_ESS1688DATA_AVAIL 0xe
  56. #define e_s_s_ESS1688DATA_AVAIL_16 0xf
  57. #define e_s_s_ESS1688MIXER_ADDR 0x4
  58. #define e_s_s_ESS1688MIXER_DATA 0x5
  59. #define e_s_s_ESS1688OPL3_LEFT 0x0
  60. #define e_s_s_ESS1688OPL3_RIGHT 0x2
  61. #define e_s_s_ESS1688OPL3_BOTH 0x8
  62. #define e_s_s_ESS1688ENABLE0 0x0
  63. #define e_s_s_ESS1688ENABLE1 0x9
  64. #define e_s_s_ESS1688ENABLE2 0xb
  65. #define e_s_s_ESS1688INIT1 0x7
  66. #define ES1688_DSP_CMD_DMAOFF 0xd0
  67. #define ES1688_DSP_CMD_SPKON 0xd1
  68. #define ES1688_DSP_CMD_SPKOFF 0xd3
  69. #define ES1688_DSP_CMD_DMAON 0xd4
  70. #define ES1688_PCM_DEV 0x14
  71. #define ES1688_MIC_DEV 0x1a
  72. #define ES1688_REC_DEV 0x1c
  73. #define ES1688_MASTER_DEV 0x32
  74. #define ES1688_FM_DEV 0x36
  75. #define ES1688_CD_DEV 0x38
  76. #define ES1688_AUX_DEV 0x3a
  77. #define ES1688_SPEAKER_DEV 0x3c
  78. #define ES1688_LINE_DEV 0x3e
  79. #define ES1688_RECLEV_DEV 0xb4
  80. #define ES1688_MIXS_MASK 0x17
  81. #define ES1688_MIXS_MIC 0x00
  82. #define ES1688_MIXS_MIC_MASTER 0x01
  83. #define ES1688_MIXS_CD 0x02
  84. #define ES1688_MIXS_AOUT 0x03
  85. #define ES1688_MIXS_MIC1 0x04
  86. #define ES1688_MIXS_REC_MIX 0x05
  87. #define ES1688_MIXS_LINE 0x06
  88. #define ES1688_MIXS_MASTER 0x07
  89. #define ES1688_MIXS_MUTE 0x10
  90. /*
  91. */
  92. void snd_es1688_mixer_write(struct snd_es1688 *chip, unsigned char reg, unsigned char data);
  93. int snd_es1688_create(struct snd_card *card,
  94. struct snd_es1688 *chip,
  95. unsigned long port,
  96. unsigned long mpu_port,
  97. int irq,
  98. int mpu_irq,
  99. int dma8,
  100. unsigned short hardware);
  101. int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, int device);
  102. int snd_es1688_mixer(struct snd_card *card, struct snd_es1688 *chip);
  103. int snd_es1688_reset(struct snd_es1688 *chip);
  104. #endif /* __SOUND_ES1688_H */