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