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