aboutsummaryrefslogtreecommitdiffstats
path: root/sound/parisc/harmony.h
diff options
context:
space:
mode:
Diffstat (limited to 'sound/parisc/harmony.h')
-rw-r--r--sound/parisc/harmony.h151
1 files changed, 151 insertions, 0 deletions
diff --git a/sound/parisc/harmony.h b/sound/parisc/harmony.h
new file mode 100644
index 000000000000..ef77f9a577d5
--- /dev/null
+++ b/sound/parisc/harmony.h
@@ -0,0 +1,151 @@
1/* Hewlett-Packard Harmony audio driver
2 * Copyright (C) 2004, Kyle McMartin <kyle@parisc-linux.org>
3 */
4
5#ifndef __HARMONY_H__
6#define __HARMONY_H__
7
8struct harmony_buffer {
9 unsigned long addr;
10 int buf;
11 int count;
12 int size;
13 int coherent;
14};
15
16typedef struct snd_card_harmony {
17 int irq;
18
19 unsigned long hpa; /* hard physical address */
20 void __iomem *iobase; /* remapped io address */
21
22 struct parisc_device *dev;
23
24 struct {
25 u32 gain;
26 u32 rate;
27 u32 format;
28 u32 stereo;
29 int playing;
30 int capturing;
31 } st;
32
33 struct snd_dma_device dma; /* playback/capture */
34 struct harmony_buffer pbuf;
35 struct harmony_buffer cbuf;
36
37 struct snd_dma_buffer gdma; /* graveyard */
38 struct snd_dma_buffer sdma; /* silence */
39
40 struct {
41 unsigned long play_intr;
42 unsigned long rec_intr;
43 unsigned long graveyard_intr;
44 unsigned long silence_intr;
45 } stats;
46
47 snd_pcm_t *pcm;
48 snd_card_t *card;
49 snd_pcm_substream_t *psubs;
50 snd_pcm_substream_t *csubs;
51 snd_info_entry_t *proc;
52
53 spinlock_t lock;
54 spinlock_t mixer_lock;
55} harmony_t;
56
57#define MAX_PCM_DEVICES 1
58#define MAX_PCM_SUBSTREAMS 4
59#define MAX_MIDI_DEVICES 0
60
61#define HARMONY_SIZE 64
62
63#define BUF_SIZE PAGE_SIZE
64#define MAX_BUFS 10
65#define MAX_BUF_SIZE (MAX_BUFS * BUF_SIZE)
66
67#define PLAYBACK_BUFS MAX_BUFS
68#define RECORD_BUFS MAX_BUFS
69#define GRAVEYARD_BUFS 1
70#define GRAVEYARD_BUFSZ (GRAVEYARD_BUFS*BUF_SIZE)
71#define SILENCE_BUFS 1
72#define SILENCE_BUFSZ (SILENCE_BUFS*BUF_SIZE)
73
74#define HARMONY_ID 0x000
75#define HARMONY_RESET 0x004
76#define HARMONY_CNTL 0x008
77#define HARMONY_GAINCTL 0x00c
78#define HARMONY_PNXTADD 0x010
79#define HARMONY_PCURADD 0x014
80#define HARMONY_RNXTADD 0x018
81#define HARMONY_RCURADD 0x01c
82#define HARMONY_DSTATUS 0x020
83#define HARMONY_OV 0x024
84#define HARMONY_PIO 0x028
85#define HARMONY_DIAG 0x03c
86
87#define HARMONY_CNTL_C 0x80000000
88#define HARMONY_CNTL_ST 0x00000020
89#define HARMONY_CNTL_44100 0x00000015 /* HARMONY_SR_44KHZ */
90#define HARMONY_CNTL_8000 0x00000008 /* HARMONY_SR_8KHZ */
91
92#define HARMONY_DSTATUS_ID 0x00000000 /* interrupts off */
93#define HARMONY_DSTATUS_PN 0x00000200 /* playback fill */
94#define HARMONY_DSTATUS_RN 0x00000002 /* record fill */
95#define HARMONY_DSTATUS_IE 0x80000000 /* interrupts on */
96
97#define HARMONY_DF_16BIT_LINEAR 0x00000000
98#define HARMONY_DF_8BIT_ULAW 0x00000001
99#define HARMONY_DF_8BIT_ALAW 0x00000002
100
101#define HARMONY_SS_MONO 0x00000000
102#define HARMONY_SS_STEREO 0x00000001
103
104#define HARMONY_GAIN_SILENCE 0x00F00FFF
105#define HARMONY_GAIN_DEFAULT 0x0FF00000
106
107#define HARMONY_GAIN_HE_SHIFT 27
108#define HARMONY_GAIN_HE_MASK (1 << HARMONY_GAIN_HE_SHIFT)
109#define HARMONY_GAIN_LE_SHIFT 26
110#define HARMONY_GAIN_LE_MASK (1 << HARMONY_GAIN_LE_SHIFT)
111#define HARMONY_GAIN_SE_SHIFT 25
112#define HARMONY_GAIN_SE_MASK (1 << HARMONY_GAIN_SE_SHIFT)
113#define HARMONY_GAIN_IS_SHIFT 24
114#define HARMONY_GAIN_IS_MASK (1 << HARMONY_GAIN_IS_SHIFT)
115
116#define HARMONY_GAIN_MA 0x0f
117#define HARMONY_GAIN_MA_SHIFT 20
118#define HARMONY_GAIN_MA_MASK (HARMONY_GAIN_MA << HARMONY_GAIN_MA_SHIFT)
119
120#define HARMONY_GAIN_IN 0x0f
121#define HARMONY_GAIN_LI_SHIFT 16
122#define HARMONY_GAIN_LI_MASK (HARMONY_GAIN_IN << HARMONY_GAIN_LI_SHIFT)
123#define HARMONY_GAIN_RI_SHIFT 12
124#define HARMONY_GAIN_RI_MASK (HARMONY_GAIN_IN << HARMONY_GAIN_RI_SHIFT)
125
126#define HARMONY_GAIN_OUT 0x3f
127#define HARMONY_GAIN_LO_SHIFT 6
128#define HARMONY_GAIN_LO_MASK (HARMONY_GAIN_OUT << HARMONY_GAIN_LO_SHIFT)
129#define HARMONY_GAIN_RO_SHIFT 0
130#define HARMONY_GAIN_RO_MASK (HARMONY_GAIN_OUT << HARMONY_GAIN_RO_SHIFT)
131
132#define HARMONY_MAX_OUT (HARMONY_GAIN_RO_MASK >> HARMONY_GAIN_RO_SHIFT)
133#define HARMONY_MAX_IN (HARMONY_GAIN_RI_MASK >> HARMONY_GAIN_RI_SHIFT)
134#define HARMONY_MAX_MON (HARMONY_GAIN_MA_MASK >> HARMONY_GAIN_MA_SHIFT)
135
136#define HARMONY_SR_8KHZ 0x08
137#define HARMONY_SR_16KHZ 0x09
138#define HARMONY_SR_27KHZ 0x0A
139#define HARMONY_SR_32KHZ 0x0B
140#define HARMONY_SR_48KHZ 0x0E
141#define HARMONY_SR_9KHZ 0x0F
142#define HARMONY_SR_5KHZ 0x10
143#define HARMONY_SR_11KHZ 0x11
144#define HARMONY_SR_18KHZ 0x12
145#define HARMONY_SR_22KHZ 0x13
146#define HARMONY_SR_37KHZ 0x14
147#define HARMONY_SR_44KHZ 0x15
148#define HARMONY_SR_33KHZ 0x16
149#define HARMONY_SR_6KHZ 0x17
150
151#endif /* __HARMONY_H__ */