aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/ad1848.h218
-rw-r--r--include/sound/asound.h52
-rw-r--r--include/sound/asoundef.h89
-rw-r--r--include/sound/core.h32
-rw-r--r--include/sound/cs4231.h175
-rw-r--r--include/sound/jack.h75
-rw-r--r--include/sound/memalloc.h16
-rw-r--r--include/sound/minors.h2
-rw-r--r--include/sound/pcm.h39
-rw-r--r--include/sound/pxa2xx-lib.h45
-rw-r--r--include/sound/sb.h5
-rw-r--r--include/sound/snd_wavefront.h1
-rw-r--r--include/sound/soc-of-simple.h25
-rw-r--r--include/sound/soc.h74
-rw-r--r--include/sound/version.h2
-rw-r--r--include/sound/vx_core.h9
-rw-r--r--include/sound/wss.h235
17 files changed, 587 insertions, 507 deletions
diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h
deleted file mode 100644
index d9aebdf6db63..000000000000
--- a/include/sound/ad1848.h
+++ /dev/null
@@ -1,218 +0,0 @@
1#ifndef __SOUND_AD1848_H
2#define __SOUND_AD1848_H
3
4/*
5 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
6 * Definitions for AD1847/AD1848/CS4248 chips
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#include "pcm.h"
26#include <linux/interrupt.h>
27
28/* IO ports */
29
30#define AD1848P( chip, x ) ( (chip) -> port + c_d_c_AD1848##x )
31
32#define c_d_c_AD1848REGSEL 0
33#define c_d_c_AD1848REG 1
34#define c_d_c_AD1848STATUS 2
35#define c_d_c_AD1848PIO 3
36
37/* codec registers */
38
39#define AD1848_LEFT_INPUT 0x00 /* left input control */
40#define AD1848_RIGHT_INPUT 0x01 /* right input control */
41#define AD1848_AUX1_LEFT_INPUT 0x02 /* left AUX1 input control */
42#define AD1848_AUX1_RIGHT_INPUT 0x03 /* right AUX1 input control */
43#define AD1848_AUX2_LEFT_INPUT 0x04 /* left AUX2 input control */
44#define AD1848_AUX2_RIGHT_INPUT 0x05 /* right AUX2 input control */
45#define AD1848_LEFT_OUTPUT 0x06 /* left output control register */
46#define AD1848_RIGHT_OUTPUT 0x07 /* right output control register */
47#define AD1848_DATA_FORMAT 0x08 /* clock and data format - playback/capture - bits 7-0 MCE */
48#define AD1848_IFACE_CTRL 0x09 /* interface control - bits 7-2 MCE */
49#define AD1848_PIN_CTRL 0x0a /* pin control */
50#define AD1848_TEST_INIT 0x0b /* test and initialization */
51#define AD1848_MISC_INFO 0x0c /* miscellaneous information */
52#define AD1848_LOOPBACK 0x0d /* loopback control */
53#define AD1848_DATA_UPR_CNT 0x0e /* playback/capture upper base count */
54#define AD1848_DATA_LWR_CNT 0x0f /* playback/capture lower base count */
55
56/* definitions for codec register select port - CODECP( REGSEL ) */
57
58#define AD1848_INIT 0x80 /* CODEC is initializing */
59#define AD1848_MCE 0x40 /* mode change enable */
60#define AD1848_TRD 0x20 /* transfer request disable */
61
62/* definitions for codec status register - CODECP( STATUS ) */
63
64#define AD1848_GLOBALIRQ 0x01 /* IRQ is active */
65
66/* definitions for AD1848_LEFT_INPUT and AD1848_RIGHT_INPUT registers */
67
68#define AD1848_ENABLE_MIC_GAIN 0x20
69
70#define AD1848_MIXS_LINE1 0x00
71#define AD1848_MIXS_AUX1 0x40
72#define AD1848_MIXS_LINE2 0x80
73#define AD1848_MIXS_ALL 0xc0
74
75/* definitions for clock and data format register - AD1848_PLAYBK_FORMAT */
76
77#define AD1848_LINEAR_8 0x00 /* 8-bit unsigned data */
78#define AD1848_ALAW_8 0x60 /* 8-bit A-law companded */
79#define AD1848_ULAW_8 0x20 /* 8-bit U-law companded */
80#define AD1848_LINEAR_16 0x40 /* 16-bit twos complement data - little endian */
81#define AD1848_STEREO 0x10 /* stereo mode */
82/* bits 3-1 define frequency divisor */
83#define AD1848_XTAL1 0x00 /* 24.576 crystal */
84#define AD1848_XTAL2 0x01 /* 16.9344 crystal */
85
86/* definitions for interface control register - AD1848_IFACE_CTRL */
87
88#define AD1848_CAPTURE_PIO 0x80 /* capture PIO enable */
89#define AD1848_PLAYBACK_PIO 0x40 /* playback PIO enable */
90#define AD1848_CALIB_MODE 0x18 /* calibration mode bits */
91#define AD1848_AUTOCALIB 0x08 /* auto calibrate */
92#define AD1848_SINGLE_DMA 0x04 /* use single DMA channel */
93#define AD1848_CAPTURE_ENABLE 0x02 /* capture enable */
94#define AD1848_PLAYBACK_ENABLE 0x01 /* playback enable */
95
96/* definitions for pin control register - AD1848_PIN_CTRL */
97
98#define AD1848_IRQ_ENABLE 0x02 /* enable IRQ */
99#define AD1848_XCTL1 0x40 /* external control #1 */
100#define AD1848_XCTL0 0x80 /* external control #0 */
101
102/* definitions for test and init register - AD1848_TEST_INIT */
103
104#define AD1848_CALIB_IN_PROGRESS 0x20 /* auto calibrate in progress */
105#define AD1848_DMA_REQUEST 0x10 /* DMA request in progress */
106
107/* defines for codec.mode */
108
109#define AD1848_MODE_NONE 0x0000
110#define AD1848_MODE_PLAY 0x0001
111#define AD1848_MODE_CAPTURE 0x0002
112#define AD1848_MODE_TIMER 0x0004
113#define AD1848_MODE_OPEN (AD1848_MODE_PLAY|AD1848_MODE_CAPTURE|AD1848_MODE_TIMER)
114#define AD1848_MODE_RUNNING 0x0010
115
116/* defines for codec.hardware */
117
118#define AD1848_HW_DETECT 0x0000 /* let AD1848 driver detect chip */
119#define AD1848_HW_AD1847 0x0001 /* AD1847 chip */
120#define AD1848_HW_AD1848 0x0002 /* AD1848 chip */
121#define AD1848_HW_CS4248 0x0003 /* CS4248 chip */
122#define AD1848_HW_CMI8330 0x0004 /* CMI8330 chip */
123#define AD1848_HW_THINKPAD 0x0005 /* Thinkpad 360/750/755 */
124
125/* IBM Thinkpad specific stuff */
126#define AD1848_THINKPAD_CTL_PORT1 0x15e8
127#define AD1848_THINKPAD_CTL_PORT2 0x15e9
128#define AD1848_THINKPAD_CS4248_ENABLE_BIT 0x02
129
130struct snd_ad1848 {
131 unsigned long port; /* i/o port */
132 struct resource *res_port;
133 int irq; /* IRQ line */
134 int dma; /* data DMA */
135 unsigned short version; /* version of CODEC chip */
136 unsigned short mode; /* see to AD1848_MODE_XXXX */
137 unsigned short hardware; /* see to AD1848_HW_XXXX */
138 unsigned short single_dma:1; /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */
139
140 struct snd_pcm *pcm;
141 struct snd_pcm_substream *playback_substream;
142 struct snd_pcm_substream *capture_substream;
143 struct snd_card *card;
144
145 unsigned char image[32]; /* SGalaxy needs an access to extended registers */
146 int mce_bit;
147 int calibrate_mute;
148 int dma_size;
149 int thinkpad_flag; /* Thinkpad CS4248 needs some extra help */
150
151#ifdef CONFIG_PM
152 void (*suspend)(struct snd_ad1848 *chip);
153 void (*resume)(struct snd_ad1848 *chip);
154#endif
155
156 spinlock_t reg_lock;
157};
158
159/* exported functions */
160
161void snd_ad1848_out(struct snd_ad1848 *chip, unsigned char reg, unsigned char value);
162
163int snd_ad1848_create(struct snd_card *card,
164 unsigned long port,
165 int irq, int dma,
166 unsigned short hardware,
167 struct snd_ad1848 ** chip);
168
169int snd_ad1848_pcm(struct snd_ad1848 * chip, int device, struct snd_pcm **rpcm);
170const struct snd_pcm_ops *snd_ad1848_get_pcm_ops(int direction);
171int snd_ad1848_mixer(struct snd_ad1848 * chip);
172
173/* exported mixer stuffs */
174enum { AD1848_MIX_SINGLE, AD1848_MIX_DOUBLE, AD1848_MIX_CAPTURE };
175
176#define AD1848_MIXVAL_SINGLE(reg, shift, mask, invert) \
177 ((reg) | ((shift) << 8) | ((mask) << 16) | ((invert) << 24))
178#define AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) \
179 ((left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22))
180
181/* for ease of use */
182struct ad1848_mix_elem {
183 const char *name;
184 int index;
185 int type;
186 unsigned long private_value;
187 const unsigned int *tlv;
188};
189
190#define AD1848_SINGLE(xname, xindex, reg, shift, mask, invert) \
191{ .name = xname, \
192 .index = xindex, \
193 .type = AD1848_MIX_SINGLE, \
194 .private_value = AD1848_MIXVAL_SINGLE(reg, shift, mask, invert) }
195
196#define AD1848_SINGLE_TLV(xname, xindex, reg, shift, mask, invert, xtlv) \
197{ .name = xname, \
198 .index = xindex, \
199 .type = AD1848_MIX_SINGLE, \
200 .private_value = AD1848_MIXVAL_SINGLE(reg, shift, mask, invert), \
201 .tlv = xtlv }
202
203#define AD1848_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
204{ .name = xname, \
205 .index = xindex, \
206 .type = AD1848_MIX_DOUBLE, \
207 .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert) }
208
209#define AD1848_DOUBLE_TLV(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert, xtlv) \
210{ .name = xname, \
211 .index = xindex, \
212 .type = AD1848_MIX_DOUBLE, \
213 .private_value = AD1848_MIXVAL_DOUBLE(left_reg, right_reg, shift_left, shift_right, mask, invert), \
214 .tlv = xtlv }
215
216int snd_ad1848_add_ctl_elem(struct snd_ad1848 *chip, const struct ad1848_mix_elem *c);
217
218#endif /* __SOUND_AD1848_H */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 3eaf155b850d..2c4dc908a54a 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -93,9 +93,10 @@ enum {
93 SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */ 93 SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */
94 SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */ 94 SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */
95 SNDRV_HWDEP_IFACE_HDA, /* HD-audio */ 95 SNDRV_HWDEP_IFACE_HDA, /* HD-audio */
96 SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */
96 97
97 /* Don't forget to change the following: */ 98 /* Don't forget to change the following: */
98 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_HDA 99 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_USB_STREAM
99}; 100};
100 101
101struct snd_hwdep_info { 102struct snd_hwdep_info {
@@ -296,29 +297,39 @@ struct snd_pcm_info {
296 unsigned char reserved[64]; /* reserved for future... */ 297 unsigned char reserved[64]; /* reserved for future... */
297}; 298};
298 299
299typedef int __bitwise snd_pcm_hw_param_t; 300typedef int snd_pcm_hw_param_t;
300#define SNDRV_PCM_HW_PARAM_ACCESS ((__force snd_pcm_hw_param_t) 0) /* Access type */ 301#define SNDRV_PCM_HW_PARAM_ACCESS 0 /* Access type */
301#define SNDRV_PCM_HW_PARAM_FORMAT ((__force snd_pcm_hw_param_t) 1) /* Format */ 302#define SNDRV_PCM_HW_PARAM_FORMAT 1 /* Format */
302#define SNDRV_PCM_HW_PARAM_SUBFORMAT ((__force snd_pcm_hw_param_t) 2) /* Subformat */ 303#define SNDRV_PCM_HW_PARAM_SUBFORMAT 2 /* Subformat */
303#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS 304#define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS
304#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT 305#define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT
305 306
306#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS ((__force snd_pcm_hw_param_t) 8) /* Bits per sample */ 307#define SNDRV_PCM_HW_PARAM_SAMPLE_BITS 8 /* Bits per sample */
307#define SNDRV_PCM_HW_PARAM_FRAME_BITS ((__force snd_pcm_hw_param_t) 9) /* Bits per frame */ 308#define SNDRV_PCM_HW_PARAM_FRAME_BITS 9 /* Bits per frame */
308#define SNDRV_PCM_HW_PARAM_CHANNELS ((__force snd_pcm_hw_param_t) 10) /* Channels */ 309#define SNDRV_PCM_HW_PARAM_CHANNELS 10 /* Channels */
309#define SNDRV_PCM_HW_PARAM_RATE ((__force snd_pcm_hw_param_t) 11) /* Approx rate */ 310#define SNDRV_PCM_HW_PARAM_RATE 11 /* Approx rate */
310#define SNDRV_PCM_HW_PARAM_PERIOD_TIME ((__force snd_pcm_hw_param_t) 12) /* Approx distance between interrupts in us */ 311#define SNDRV_PCM_HW_PARAM_PERIOD_TIME 12 /* Approx distance between
311#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE ((__force snd_pcm_hw_param_t) 13) /* Approx frames between interrupts */ 312 * interrupts in us
312#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES ((__force snd_pcm_hw_param_t) 14) /* Approx bytes between interrupts */ 313 */
313#define SNDRV_PCM_HW_PARAM_PERIODS ((__force snd_pcm_hw_param_t) 15) /* Approx interrupts per buffer */ 314#define SNDRV_PCM_HW_PARAM_PERIOD_SIZE 13 /* Approx frames between
314#define SNDRV_PCM_HW_PARAM_BUFFER_TIME ((__force snd_pcm_hw_param_t) 16) /* Approx duration of buffer in us */ 315 * interrupts
315#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE ((__force snd_pcm_hw_param_t) 17) /* Size of buffer in frames */ 316 */
316#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES ((__force snd_pcm_hw_param_t) 18) /* Size of buffer in bytes */ 317#define SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14 /* Approx bytes between
317#define SNDRV_PCM_HW_PARAM_TICK_TIME ((__force snd_pcm_hw_param_t) 19) /* Approx tick duration in us */ 318 * interrupts
319 */
320#define SNDRV_PCM_HW_PARAM_PERIODS 15 /* Approx interrupts per
321 * buffer
322 */
323#define SNDRV_PCM_HW_PARAM_BUFFER_TIME 16 /* Approx duration of buffer
324 * in us
325 */
326#define SNDRV_PCM_HW_PARAM_BUFFER_SIZE 17 /* Size of buffer in frames */
327#define SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18 /* Size of buffer in bytes */
328#define SNDRV_PCM_HW_PARAM_TICK_TIME 19 /* Approx tick duration in us */
318#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS 329#define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS
319#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME 330#define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME
320 331
321#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ 332#define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */
322 333
323struct snd_interval { 334struct snd_interval {
324 unsigned int min, max; 335 unsigned int min, max;
@@ -696,7 +707,7 @@ struct snd_timer_tread {
696 * * 707 * *
697 ****************************************************************************/ 708 ****************************************************************************/
698 709
699#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 5) 710#define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6)
700 711
701struct snd_ctl_card_info { 712struct snd_ctl_card_info {
702 int card; /* card number */ 713 int card; /* card number */
@@ -707,8 +718,7 @@ struct snd_ctl_card_info {
707 unsigned char longname[80]; /* name + info text about soundcard */ 718 unsigned char longname[80]; /* name + info text about soundcard */
708 unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */ 719 unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */
709 unsigned char mixername[80]; /* visual mixer identification */ 720 unsigned char mixername[80]; /* visual mixer identification */
710 unsigned char components[80]; /* card components / fine identification, delimited with one space (AC97 etc..) */ 721 unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */
711 unsigned char reserved[48]; /* reserved for future */
712}; 722};
713 723
714typedef int __bitwise snd_ctl_elem_type_t; 724typedef int __bitwise snd_ctl_elem_type_t;
diff --git a/include/sound/asoundef.h b/include/sound/asoundef.h
index a6e0facf8a37..20ebf3298eba 100644
--- a/include/sound/asoundef.h
+++ b/include/sound/asoundef.h
@@ -60,35 +60,56 @@
60#define IEC958_AES1_PRO_USERBITS_UDEF (12<<4) /* user defined application */ 60#define IEC958_AES1_PRO_USERBITS_UDEF (12<<4) /* user defined application */
61#define IEC958_AES1_CON_CATEGORY 0x7f 61#define IEC958_AES1_CON_CATEGORY 0x7f
62#define IEC958_AES1_CON_GENERAL 0x00 62#define IEC958_AES1_CON_GENERAL 0x00
63#define IEC958_AES1_CON_EXPERIMENTAL 0x40
64#define IEC958_AES1_CON_SOLIDMEM_MASK 0x0f
65#define IEC958_AES1_CON_SOLIDMEM_ID 0x08
66#define IEC958_AES1_CON_BROADCAST1_MASK 0x07
67#define IEC958_AES1_CON_BROADCAST1_ID 0x04
68#define IEC958_AES1_CON_DIGDIGCONV_MASK 0x07
69#define IEC958_AES1_CON_DIGDIGCONV_ID 0x02
70#define IEC958_AES1_CON_ADC_COPYRIGHT_MASK 0x1f
71#define IEC958_AES1_CON_ADC_COPYRIGHT_ID 0x06
72#define IEC958_AES1_CON_ADC_MASK 0x1f
73#define IEC958_AES1_CON_ADC_ID 0x16
74#define IEC958_AES1_CON_BROADCAST2_MASK 0x0f
75#define IEC958_AES1_CON_BROADCAST2_ID 0x0e
76#define IEC958_AES1_CON_LASEROPT_MASK 0x07 63#define IEC958_AES1_CON_LASEROPT_MASK 0x07
77#define IEC958_AES1_CON_LASEROPT_ID 0x01 64#define IEC958_AES1_CON_LASEROPT_ID 0x01
78#define IEC958_AES1_CON_MUSICAL_MASK 0x07
79#define IEC958_AES1_CON_MUSICAL_ID 0x05
80#define IEC958_AES1_CON_MAGNETIC_MASK 0x07
81#define IEC958_AES1_CON_MAGNETIC_ID 0x03
82#define IEC958_AES1_CON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x00) 65#define IEC958_AES1_CON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x00)
83#define IEC958_AES1_CON_NON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x08) 66#define IEC958_AES1_CON_NON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x08)
67#define IEC958_AES1_CON_MINI_DISC (IEC958_AES1_CON_LASEROPT_ID|0x48)
68#define IEC958_AES1_CON_DVD (IEC958_AES1_CON_LASEROPT_ID|0x18)
69#define IEC958_AES1_CON_LASTEROPT_OTHER (IEC958_AES1_CON_LASEROPT_ID|0x78)
70#define IEC958_AES1_CON_DIGDIGCONV_MASK 0x07
71#define IEC958_AES1_CON_DIGDIGCONV_ID 0x02
84#define IEC958_AES1_CON_PCM_CODER (IEC958_AES1_CON_DIGDIGCONV_ID|0x00) 72#define IEC958_AES1_CON_PCM_CODER (IEC958_AES1_CON_DIGDIGCONV_ID|0x00)
85#define IEC958_AES1_CON_SAMPLER (IEC958_AES1_CON_DIGDIGCONV_ID|0x20)
86#define IEC958_AES1_CON_MIXER (IEC958_AES1_CON_DIGDIGCONV_ID|0x10) 73#define IEC958_AES1_CON_MIXER (IEC958_AES1_CON_DIGDIGCONV_ID|0x10)
87#define IEC958_AES1_CON_RATE_CONVERTER (IEC958_AES1_CON_DIGDIGCONV_ID|0x18) 74#define IEC958_AES1_CON_RATE_CONVERTER (IEC958_AES1_CON_DIGDIGCONV_ID|0x18)
88#define IEC958_AES1_CON_SYNTHESIZER (IEC958_AES1_CON_MUSICAL_ID|0x00) 75#define IEC958_AES1_CON_SAMPLER (IEC958_AES1_CON_DIGDIGCONV_ID|0x20)
89#define IEC958_AES1_CON_MICROPHONE (IEC958_AES1_CON_MUSICAL_ID|0x08) 76#define IEC958_AES1_CON_DSP (IEC958_AES1_CON_DIGDIGCONV_ID|0x28)
77#define IEC958_AES1_CON_DIGDIGCONV_OTHER (IEC958_AES1_CON_DIGDIGCONV_ID|0x78)
78#define IEC958_AES1_CON_MAGNETIC_MASK 0x07
79#define IEC958_AES1_CON_MAGNETIC_ID 0x03
90#define IEC958_AES1_CON_DAT (IEC958_AES1_CON_MAGNETIC_ID|0x00) 80#define IEC958_AES1_CON_DAT (IEC958_AES1_CON_MAGNETIC_ID|0x00)
91#define IEC958_AES1_CON_VCR (IEC958_AES1_CON_MAGNETIC_ID|0x08) 81#define IEC958_AES1_CON_VCR (IEC958_AES1_CON_MAGNETIC_ID|0x08)
82#define IEC958_AES1_CON_DCC (IEC958_AES1_CON_MAGNETIC_ID|0x40)
83#define IEC958_AES1_CON_MAGNETIC_DISC (IEC958_AES1_CON_MAGNETIC_ID|0x18)
84#define IEC958_AES1_CON_MAGNETIC_OTHER (IEC958_AES1_CON_MAGNETIC_ID|0x78)
85#define IEC958_AES1_CON_BROADCAST1_MASK 0x07
86#define IEC958_AES1_CON_BROADCAST1_ID 0x04
87#define IEC958_AES1_CON_DAB_JAPAN (IEC958_AES1_CON_BROADCAST1_ID|0x00)
88#define IEC958_AES1_CON_DAB_EUROPE (IEC958_AES1_CON_BROADCAST1_ID|0x08)
89#define IEC958_AES1_CON_DAB_USA (IEC958_AES1_CON_BROADCAST1_ID|0x60)
90#define IEC958_AES1_CON_SOFTWARE (IEC958_AES1_CON_BROADCAST1_ID|0x40)
91#define IEC958_AES1_CON_IEC62105 (IEC958_AES1_CON_BROADCAST1_ID|0x20)
92#define IEC958_AES1_CON_BROADCAST1_OTHER (IEC958_AES1_CON_BROADCAST1_ID|0x78)
93#define IEC958_AES1_CON_BROADCAST2_MASK 0x0f
94#define IEC958_AES1_CON_BROADCAST2_ID 0x0e
95#define IEC958_AES1_CON_MUSICAL_MASK 0x07
96#define IEC958_AES1_CON_MUSICAL_ID 0x05
97#define IEC958_AES1_CON_SYNTHESIZER (IEC958_AES1_CON_MUSICAL_ID|0x00)
98#define IEC958_AES1_CON_MICROPHONE (IEC958_AES1_CON_MUSICAL_ID|0x08)
99#define IEC958_AES1_CON_MUSICAL_OTHER (IEC958_AES1_CON_MUSICAL_ID|0x78)
100#define IEC958_AES1_CON_ADC_MASK 0x1f
101#define IEC958_AES1_CON_ADC_ID 0x06
102#define IEC958_AES1_CON_ADC (IEC958_AES1_CON_ADC_ID|0x00)
103#define IEC958_AES1_CON_ADC_OTHER (IEC958_AES1_CON_ADC_ID|0x60)
104#define IEC958_AES1_CON_ADC_COPYRIGHT_MASK 0x1f
105#define IEC958_AES1_CON_ADC_COPYRIGHT_ID 0x16
106#define IEC958_AES1_CON_ADC_COPYRIGHT (IEC958_AES1_CON_ADC_COPYRIGHT_ID|0x00)
107#define IEC958_AES1_CON_ADC_COPYRIGHT_OTHER (IEC958_AES1_CON_ADC_COPYRIGHT_ID|0x60)
108#define IEC958_AES1_CON_SOLIDMEM_MASK 0x0f
109#define IEC958_AES1_CON_SOLIDMEM_ID 0x08
110#define IEC958_AES1_CON_SOLIDMEM_DIGITAL_RECORDER_PLAYER (IEC958_AES1_CON_SOLIDMEM_ID|0x00)
111#define IEC958_AES1_CON_SOLIDMEM_OTHER (IEC958_AES1_CON_SOLIDMEM_ID|0x70)
112#define IEC958_AES1_CON_EXPERIMENTAL 0x40
92#define IEC958_AES1_CON_ORIGINAL (1<<7) /* this bits depends on the category code */ 113#define IEC958_AES1_CON_ORIGINAL (1<<7) /* this bits depends on the category code */
93#define IEC958_AES2_PRO_SBITS (7<<0) /* mask - sample bits */ 114#define IEC958_AES2_PRO_SBITS (7<<0) /* mask - sample bits */
94#define IEC958_AES2_PRO_SBITS_20 (2<<0) /* 20-bit - coordination */ 115#define IEC958_AES2_PRO_SBITS_20 (2<<0) /* 20-bit - coordination */
@@ -106,8 +127,16 @@
106#define IEC958_AES2_CON_CHANNEL_UNSPEC (0<<4) /* unspecified */ 127#define IEC958_AES2_CON_CHANNEL_UNSPEC (0<<4) /* unspecified */
107#define IEC958_AES3_CON_FS (15<<0) /* mask - sample frequency */ 128#define IEC958_AES3_CON_FS (15<<0) /* mask - sample frequency */
108#define IEC958_AES3_CON_FS_44100 (0<<0) /* 44.1kHz */ 129#define IEC958_AES3_CON_FS_44100 (0<<0) /* 44.1kHz */
130#define IEC958_AES3_CON_FS_NOTID (1<<0) /* non indicated */
109#define IEC958_AES3_CON_FS_48000 (2<<0) /* 48kHz */ 131#define IEC958_AES3_CON_FS_48000 (2<<0) /* 48kHz */
110#define IEC958_AES3_CON_FS_32000 (3<<0) /* 32kHz */ 132#define IEC958_AES3_CON_FS_32000 (3<<0) /* 32kHz */
133#define IEC958_AES3_CON_FS_22050 (4<<0) /* 22.05kHz */
134#define IEC958_AES3_CON_FS_24000 (6<<0) /* 24kHz */
135#define IEC958_AES3_CON_FS_88200 (8<<0) /* 88.2kHz */
136#define IEC958_AES3_CON_FS_768000 (9<<0) /* 768kHz */
137#define IEC958_AES3_CON_FS_96000 (10<<0) /* 96kHz */
138#define IEC958_AES3_CON_FS_176400 (12<<0) /* 176.4kHz */
139#define IEC958_AES3_CON_FS_192000 (14<<0) /* 192kHz */
111#define IEC958_AES3_CON_CLOCK (3<<4) /* mask - clock accuracy */ 140#define IEC958_AES3_CON_CLOCK (3<<4) /* mask - clock accuracy */
112#define IEC958_AES3_CON_CLOCK_1000PPM (0<<4) /* 1000 ppm */ 141#define IEC958_AES3_CON_CLOCK_1000PPM (0<<4) /* 1000 ppm */
113#define IEC958_AES3_CON_CLOCK_50PPM (1<<4) /* 50 ppm */ 142#define IEC958_AES3_CON_CLOCK_50PPM (1<<4) /* 50 ppm */
@@ -120,6 +149,26 @@
120#define IEC958_AES4_CON_WORDLEN_23_19 (4<<1) /* 23-bit or 19-bit */ 149#define IEC958_AES4_CON_WORDLEN_23_19 (4<<1) /* 23-bit or 19-bit */
121#define IEC958_AES4_CON_WORDLEN_24_20 (5<<1) /* 24-bit or 20-bit */ 150#define IEC958_AES4_CON_WORDLEN_24_20 (5<<1) /* 24-bit or 20-bit */
122#define IEC958_AES4_CON_WORDLEN_21_17 (6<<1) /* 21-bit or 17-bit */ 151#define IEC958_AES4_CON_WORDLEN_21_17 (6<<1) /* 21-bit or 17-bit */
152#define IEC958_AES4_CON_ORIGFS (15<<4) /* mask - original sample frequency */
153#define IEC958_AES4_CON_ORIGFS_NOTID (0<<4) /* not indicated */
154#define IEC958_AES4_CON_ORIGFS_192000 (1<<4) /* 192kHz */
155#define IEC958_AES4_CON_ORIGFS_12000 (2<<4) /* 12kHz */
156#define IEC958_AES4_CON_ORIGFS_176400 (3<<4) /* 176.4kHz */
157#define IEC958_AES4_CON_ORIGFS_96000 (5<<4) /* 96kHz */
158#define IEC958_AES4_CON_ORIGFS_8000 (6<<4) /* 8kHz */
159#define IEC958_AES4_CON_ORIGFS_88200 (7<<4) /* 88.2kHz */
160#define IEC958_AES4_CON_ORIGFS_16000 (8<<4) /* 16kHz */
161#define IEC958_AES4_CON_ORIGFS_24000 (9<<4) /* 24kHz */
162#define IEC958_AES4_CON_ORIGFS_11025 (10<<4) /* 11.025kHz */
163#define IEC958_AES4_CON_ORIGFS_22050 (11<<4) /* 22.05kHz */
164#define IEC958_AES4_CON_ORIGFS_32000 (12<<4) /* 32kHz */
165#define IEC958_AES4_CON_ORIGFS_48000 (13<<4) /* 48kHz */
166#define IEC958_AES4_CON_ORIGFS_44100 (15<<4) /* 44.1kHz */
167#define IEC958_AES5_CON_CGMSA (3<<0) /* mask - CGMS-A */
168#define IEC958_AES5_CON_CGMSA_COPYFREELY (0<<0) /* copying is permitted without restriction */
169#define IEC958_AES5_CON_CGMSA_COPYONCE (1<<0) /* one generation of copies may be made */
170#define IEC958_AES5_CON_CGMSA_COPYNOMORE (2<<0) /* condition not be used */
171#define IEC958_AES5_CON_CGMSA_COPYNEVER (3<<0) /* no copying is permitted */
123 172
124/***************************************************************************** 173/*****************************************************************************
125 * * 174 * *
diff --git a/include/sound/core.h b/include/sound/core.h
index 821d5a59d28b..35424a971b7a 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -28,6 +28,7 @@
28#include <linux/rwsem.h> /* struct rw_semaphore */ 28#include <linux/rwsem.h> /* struct rw_semaphore */
29#include <linux/pm.h> /* pm_message_t */ 29#include <linux/pm.h> /* pm_message_t */
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/stringify.h>
31 32
32/* number of supported soundcards */ 33/* number of supported soundcards */
33#ifdef CONFIG_SND_DYNAMIC_MINORS 34#ifdef CONFIG_SND_DYNAMIC_MINORS
@@ -60,6 +61,7 @@ typedef int __bitwise snd_device_type_t;
60#define SNDRV_DEV_INFO ((__force snd_device_type_t) 0x1006) 61#define SNDRV_DEV_INFO ((__force snd_device_type_t) 0x1006)
61#define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007) 62#define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007)
62#define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008) 63#define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008)
64#define SNDRV_DEV_JACK ((__force snd_device_type_t) 0x1009)
63#define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000) 65#define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000)
64 66
65typedef int __bitwise snd_device_state_t; 67typedef int __bitwise snd_device_state_t;
@@ -111,7 +113,7 @@ struct snd_card {
111 char shortname[32]; /* short name of this soundcard */ 113 char shortname[32]; /* short name of this soundcard */
112 char longname[80]; /* name of this soundcard */ 114 char longname[80]; /* name of this soundcard */
113 char mixername[80]; /* mixer name */ 115 char mixername[80]; /* mixer name */
114 char components[80]; /* card components delimited with 116 char components[128]; /* card components delimited with
115 space */ 117 space */
116 struct module *module; /* top-level module */ 118 struct module *module; /* top-level module */
117 119
@@ -363,8 +365,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
363 365
364#ifdef CONFIG_SND_DEBUG 366#ifdef CONFIG_SND_DEBUG
365 367
366#define __ASTRING__(x) #x
367
368#ifdef CONFIG_SND_VERBOSE_PRINTK 368#ifdef CONFIG_SND_VERBOSE_PRINTK
369/** 369/**
370 * snd_printd - debug printk 370 * snd_printd - debug printk
@@ -379,33 +379,15 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
379#define snd_printd(fmt, args...) \ 379#define snd_printd(fmt, args...) \
380 printk(fmt ,##args) 380 printk(fmt ,##args)
381#endif 381#endif
382/** 382
383 * snd_assert - run-time assertion macro 383#define snd_BUG() WARN(1, "BUG?\n")
384 * @expr: expression 384#define snd_BUG_ON(cond) WARN((cond), "BUG? (%s)\n", __stringify(cond))
385 *
386 * This macro checks the expression in run-time and invokes the commands
387 * given in the rest arguments if the assertion is failed.
388 * When CONFIG_SND_DEBUG is not set, the expression is executed but
389 * not checked.
390 */
391#define snd_assert(expr, args...) do { \
392 if (unlikely(!(expr))) { \
393 snd_printk(KERN_ERR "BUG? (%s)\n", __ASTRING__(expr)); \
394 dump_stack(); \
395 args; \
396 } \
397} while (0)
398
399#define snd_BUG() do { \
400 snd_printk(KERN_ERR "BUG?\n"); \
401 dump_stack(); \
402} while (0)
403 385
404#else /* !CONFIG_SND_DEBUG */ 386#else /* !CONFIG_SND_DEBUG */
405 387
406#define snd_printd(fmt, args...) /* nothing */ 388#define snd_printd(fmt, args...) /* nothing */
407#define snd_assert(expr, args...) (void)(expr)
408#define snd_BUG() /* nothing */ 389#define snd_BUG() /* nothing */
390#define snd_BUG_ON(cond) ({/*(void)(cond);*/ 0;}) /* always false */
409 391
410#endif /* CONFIG_SND_DEBUG */ 392#endif /* CONFIG_SND_DEBUG */
411 393
diff --git a/include/sound/cs4231.h b/include/sound/cs4231.h
deleted file mode 100644
index f0785f9f4ae4..000000000000
--- a/include/sound/cs4231.h
+++ /dev/null
@@ -1,175 +0,0 @@
1#ifndef __SOUND_CS4231_H
2#define __SOUND_CS4231_H
3
4/*
5 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
6 * Definitions for CS4231 & InterWave chips & compatible chips
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#include "control.h"
26#include "pcm.h"
27#include "timer.h"
28
29#include "cs4231-regs.h"
30
31/* defines for codec.mode */
32
33#define CS4231_MODE_NONE 0x0000
34#define CS4231_MODE_PLAY 0x0001
35#define CS4231_MODE_RECORD 0x0002
36#define CS4231_MODE_TIMER 0x0004
37#define CS4231_MODE_OPEN (CS4231_MODE_PLAY|CS4231_MODE_RECORD|CS4231_MODE_TIMER)
38
39/* defines for codec.hardware */
40
41#define CS4231_HW_DETECT 0x0000 /* let CS4231 driver detect chip */
42#define CS4231_HW_DETECT3 0x0001 /* allow mode 3 */
43#define CS4231_HW_TYPE_MASK 0xff00 /* type mask */
44#define CS4231_HW_CS4231_MASK 0x0100 /* CS4231 serie */
45#define CS4231_HW_CS4231 0x0100 /* CS4231 chip */
46#define CS4231_HW_CS4231A 0x0101 /* CS4231A chip */
47#define CS4231_HW_AD1845 0x0102 /* AD1845 chip */
48#define CS4231_HW_CS4232_MASK 0x0200 /* CS4232 serie (has control ports) */
49#define CS4231_HW_CS4232 0x0200 /* CS4232 */
50#define CS4231_HW_CS4232A 0x0201 /* CS4232A */
51#define CS4231_HW_CS4236 0x0202 /* CS4236 */
52#define CS4231_HW_CS4236B_MASK 0x0400 /* CS4236B serie (has extended control regs) */
53#define CS4231_HW_CS4235 0x0400 /* CS4235 - Crystal Clear (tm) stereo enhancement */
54#define CS4231_HW_CS4236B 0x0401 /* CS4236B */
55#define CS4231_HW_CS4237B 0x0402 /* CS4237B - SRS 3D */
56#define CS4231_HW_CS4238B 0x0403 /* CS4238B - QSOUND 3D */
57#define CS4231_HW_CS4239 0x0404 /* CS4239 - Crystal Clear (tm) stereo enhancement */
58/* compatible, but clones */
59#define CS4231_HW_INTERWAVE 0x1000 /* InterWave chip */
60#define CS4231_HW_OPL3SA2 0x1101 /* OPL3-SA2 chip, similar to cs4231 */
61#define CS4231_HW_OPTI93X 0x1102 /* Opti 930/931/933 */
62
63/* defines for codec.hwshare */
64#define CS4231_HWSHARE_IRQ (1<<0)
65#define CS4231_HWSHARE_DMA1 (1<<1)
66#define CS4231_HWSHARE_DMA2 (1<<2)
67
68struct snd_cs4231 {
69 unsigned long port; /* base i/o port */
70 struct resource *res_port;
71 unsigned long cport; /* control base i/o port (CS4236) */
72 struct resource *res_cport;
73 int irq; /* IRQ line */
74 int dma1; /* playback DMA */
75 int dma2; /* record DMA */
76 unsigned short version; /* version of CODEC chip */
77 unsigned short mode; /* see to CS4231_MODE_XXXX */
78 unsigned short hardware; /* see to CS4231_HW_XXXX */
79 unsigned short hwshare; /* shared resources */
80 unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */
81 ebus_flag:1; /* SPARC: EBUS present */
82
83 struct snd_card *card;
84 struct snd_pcm *pcm;
85 struct snd_pcm_substream *playback_substream;
86 struct snd_pcm_substream *capture_substream;
87 struct snd_timer *timer;
88
89 unsigned char image[32]; /* registers image */
90 unsigned char eimage[32]; /* extended registers image */
91 unsigned char cimage[16]; /* control registers image */
92 int mce_bit;
93 int calibrate_mute;
94 int sw_3d_bit;
95 unsigned int p_dma_size;
96 unsigned int c_dma_size;
97
98 spinlock_t reg_lock;
99 struct mutex mce_mutex;
100 struct mutex open_mutex;
101
102 int (*rate_constraint) (struct snd_pcm_runtime *runtime);
103 void (*set_playback_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char pdfr);
104 void (*set_capture_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char cdfr);
105 void (*trigger) (struct snd_cs4231 *chip, unsigned int what, int start);
106#ifdef CONFIG_PM
107 void (*suspend) (struct snd_cs4231 *chip);
108 void (*resume) (struct snd_cs4231 *chip);
109#endif
110 void *dma_private_data;
111 int (*claim_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma);
112 int (*release_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma);
113};
114
115/* exported functions */
116
117void snd_cs4231_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val);
118unsigned char snd_cs4231_in(struct snd_cs4231 *chip, unsigned char reg);
119void snd_cs4236_ext_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val);
120unsigned char snd_cs4236_ext_in(struct snd_cs4231 *chip, unsigned char reg);
121void snd_cs4231_mce_up(struct snd_cs4231 *chip);
122void snd_cs4231_mce_down(struct snd_cs4231 *chip);
123
124void snd_cs4231_overrange(struct snd_cs4231 *chip);
125
126irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id);
127
128const char *snd_cs4231_chip_id(struct snd_cs4231 *chip);
129
130int snd_cs4231_create(struct snd_card *card,
131 unsigned long port,
132 unsigned long cport,
133 int irq, int dma1, int dma2,
134 unsigned short hardware,
135 unsigned short hwshare,
136 struct snd_cs4231 ** rchip);
137int snd_cs4231_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm);
138int snd_cs4231_timer(struct snd_cs4231 * chip, int device, struct snd_timer **rtimer);
139int snd_cs4231_mixer(struct snd_cs4231 * chip);
140
141int snd_cs4236_create(struct snd_card *card,
142 unsigned long port,
143 unsigned long cport,
144 int irq, int dma1, int dma2,
145 unsigned short hardware,
146 unsigned short hwshare,
147 struct snd_cs4231 ** rchip);
148int snd_cs4236_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm);
149int snd_cs4236_mixer(struct snd_cs4231 * chip);
150
151/*
152 * mixer library
153 */
154
155#define CS4231_SINGLE(xname, xindex, reg, shift, mask, invert) \
156{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
157 .info = snd_cs4231_info_single, \
158 .get = snd_cs4231_get_single, .put = snd_cs4231_put_single, \
159 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) }
160
161int snd_cs4231_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo);
162int snd_cs4231_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
163int snd_cs4231_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
164
165#define CS4231_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
166{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
167 .info = snd_cs4231_info_double, \
168 .get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \
169 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
170
171int snd_cs4231_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo);
172int snd_cs4231_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
173int snd_cs4231_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
174
175#endif /* __SOUND_CS4231_H */
diff --git a/include/sound/jack.h b/include/sound/jack.h
new file mode 100644
index 000000000000..b1b2b8b59adb
--- /dev/null
+++ b/include/sound/jack.h
@@ -0,0 +1,75 @@
1#ifndef __SOUND_JACK_H
2#define __SOUND_JACK_H
3
4/*
5 * Jack abstraction layer
6 *
7 * Copyright 2008 Wolfson Microelectronics plc
8 *
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26#include <sound/core.h>
27
28struct input_dev;
29
30/**
31 * Jack types which can be reported. These values are used as a
32 * bitmask.
33 */
34enum snd_jack_types {
35 SND_JACK_HEADPHONE = 0x0001,
36 SND_JACK_MICROPHONE = 0x0002,
37 SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE,
38};
39
40struct snd_jack {
41 struct input_dev *input_dev;
42 int registered;
43 int type;
44 const char *id;
45 char name[100];
46};
47
48#ifdef CONFIG_SND_JACK
49
50int snd_jack_new(struct snd_card *card, const char *id, int type,
51 struct snd_jack **jack);
52void snd_jack_set_parent(struct snd_jack *jack, struct device *parent);
53
54void snd_jack_report(struct snd_jack *jack, int status);
55
56#else
57
58static inline int snd_jack_new(struct snd_card *card, const char *id, int type,
59 struct snd_jack **jack)
60{
61 return 0;
62}
63
64static inline void snd_jack_set_parent(struct snd_jack *jack,
65 struct device *parent)
66{
67}
68
69static inline void snd_jack_report(struct snd_jack *jack, int status)
70{
71}
72
73#endif
74
75#endif
diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h
index 6a3e7558a7e6..7ccce94a5255 100644
--- a/include/sound/memalloc.h
+++ b/include/sound/memalloc.h
@@ -63,6 +63,11 @@ struct snd_dma_buffer {
63/* 63/*
64 * Scatter-Gather generic device pages 64 * Scatter-Gather generic device pages
65 */ 65 */
66void *snd_malloc_sgbuf_pages(struct device *device,
67 size_t size, struct snd_dma_buffer *dmab,
68 size_t *res_size);
69int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab);
70
66struct snd_sg_page { 71struct snd_sg_page {
67 void *buf; 72 void *buf;
68 dma_addr_t addr; 73 dma_addr_t addr;
@@ -90,9 +95,18 @@ static inline unsigned int snd_sgbuf_aligned_pages(size_t size)
90 */ 95 */
91static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset) 96static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset)
92{ 97{
93 return sgbuf->table[offset >> PAGE_SHIFT].addr + offset % PAGE_SIZE; 98 dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr;
99 addr &= PAGE_MASK;
100 return addr + offset % PAGE_SIZE;
94} 101}
95 102
103/*
104 * return the virtual address at the corresponding offset
105 */
106static inline void *snd_sgbuf_get_ptr(struct snd_sg_buf *sgbuf, size_t offset)
107{
108 return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE;
109}
96 110
97/* allocate/release a buffer */ 111/* allocate/release a buffer */
98int snd_dma_alloc_pages(int type, struct device *dev, size_t size, 112int snd_dma_alloc_pages(int type, struct device *dev, size_t size,
diff --git a/include/sound/minors.h b/include/sound/minors.h
index 46bcd2023ed8..a81798ab73ed 100644
--- a/include/sound/minors.h
+++ b/include/sound/minors.h
@@ -21,6 +21,8 @@
21 * 21 *
22 */ 22 */
23 23
24#define SNDRV_OS_MINORS 256
25
24#define SNDRV_MINOR_DEVICES 32 26#define SNDRV_MINOR_DEVICES 32
25#define SNDRV_MINOR_CARD(minor) ((minor) >> 5) 27#define SNDRV_MINOR_CARD(minor) ((minor) >> 5)
26#define SNDRV_MINOR_DEVICE(minor) ((minor) & 0x001f) 28#define SNDRV_MINOR_DEVICE(minor) ((minor) & 0x001f)
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 51d58ccda2d8..40c5a6fa6bcd 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -25,6 +25,7 @@
25 25
26#include <sound/asound.h> 26#include <sound/asound.h>
27#include <sound/memalloc.h> 27#include <sound/memalloc.h>
28#include <sound/minors.h>
28#include <linux/poll.h> 29#include <linux/poll.h>
29#include <linux/mm.h> 30#include <linux/mm.h>
30#include <linux/bitops.h> 31#include <linux/bitops.h>
@@ -84,7 +85,11 @@ struct snd_pcm_ops {
84 * 85 *
85 */ 86 */
86 87
87#define SNDRV_PCM_DEVICES 8 88#if defined(CONFIG_SND_DYNAMIC_MINORS)
89#define SNDRV_PCM_DEVICES (SNDRV_OS_MINORS-2)
90#else
91#define SNDRV_PCM_DEVICES 8
92#endif
88 93
89#define SNDRV_PCM_IOCTL1_FALSE ((void *)0) 94#define SNDRV_PCM_IOCTL1_FALSE ((void *)0)
90#define SNDRV_PCM_IOCTL1_TRUE ((void *)1) 95#define SNDRV_PCM_IOCTL1_TRUE ((void *)1)
@@ -416,7 +421,7 @@ struct snd_pcm_str {
416struct snd_pcm { 421struct snd_pcm {
417 struct snd_card *card; 422 struct snd_card *card;
418 struct list_head list; 423 struct list_head list;
419 unsigned int device; /* device number */ 424 int device; /* device number */
420 unsigned int info_flags; 425 unsigned int info_flags;
421 unsigned short dev_class; 426 unsigned short dev_class;
422 unsigned short dev_subclass; 427 unsigned short dev_subclass;
@@ -969,10 +974,30 @@ int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,
969int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size); 974int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size);
970int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream); 975int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream);
971 976
972#define snd_pcm_substream_sgbuf(substream) ((substream)->runtime->dma_buffer_p->private_data) 977/*
973#define snd_pcm_sgbuf_pages(size) snd_sgbuf_aligned_pages(size) 978 * SG-buffer handling
974#define snd_pcm_sgbuf_get_addr(sgbuf,ofs) snd_sgbuf_get_addr(sgbuf,ofs) 979 */
975struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigned long offset); 980#define snd_pcm_substream_sgbuf(substream) \
981 ((substream)->runtime->dma_buffer_p->private_data)
982
983static inline dma_addr_t
984snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs)
985{
986 struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream);
987 return snd_sgbuf_get_addr(sg, ofs);
988}
989
990static inline void *
991snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs)
992{
993 struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream);
994 return snd_sgbuf_get_ptr(sg, ofs);
995}
996
997struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream,
998 unsigned long offset);
999unsigned int snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream,
1000 unsigned int ofs, unsigned int size);
976 1001
977/* handle mmap counter - PCM mmap callback should handle this counter properly */ 1002/* handle mmap counter - PCM mmap callback should handle this counter properly */
978static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) 1003static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area)
@@ -1010,4 +1035,6 @@ static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
1010 (IEC958_AES1_CON_PCM_CODER<<8)|\ 1035 (IEC958_AES1_CON_PCM_CODER<<8)|\
1011 (IEC958_AES3_CON_FS_48000<<24)) 1036 (IEC958_AES3_CON_FS_48000<<24))
1012 1037
1038#define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime)
1039
1013#endif /* __SOUND_PCM_H */ 1040#endif /* __SOUND_PCM_H */
diff --git a/include/sound/pxa2xx-lib.h b/include/sound/pxa2xx-lib.h
new file mode 100644
index 000000000000..2fd3d251d9a5
--- /dev/null
+++ b/include/sound/pxa2xx-lib.h
@@ -0,0 +1,45 @@
1#ifndef PXA2XX_LIB_H
2#define PXA2XX_LIB_H
3
4#include <linux/platform_device.h>
5#include <sound/ac97_codec.h>
6
7/* PCM */
8
9struct pxa2xx_pcm_dma_params {
10 char *name; /* stream identifier */
11 u32 dcmd; /* DMA descriptor dcmd field */
12 volatile u32 *drcmr; /* the DMA request channel to use */
13 u32 dev_addr; /* device physical address for DMA */
14};
15
16extern int __pxa2xx_pcm_hw_params(struct snd_pcm_substream *substream,
17 struct snd_pcm_hw_params *params);
18extern int __pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream);
19extern int pxa2xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd);
20extern snd_pcm_uframes_t pxa2xx_pcm_pointer(struct snd_pcm_substream *substream);
21extern int __pxa2xx_pcm_prepare(struct snd_pcm_substream *substream);
22extern void pxa2xx_pcm_dma_irq(int dma_ch, void *dev_id);
23extern int __pxa2xx_pcm_open(struct snd_pcm_substream *substream);
24extern int __pxa2xx_pcm_close(struct snd_pcm_substream *substream);
25extern int pxa2xx_pcm_mmap(struct snd_pcm_substream *substream,
26 struct vm_area_struct *vma);
27extern int pxa2xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream);
28extern void pxa2xx_pcm_free_dma_buffers(struct snd_pcm *pcm);
29
30/* AC97 */
31
32extern unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
33extern void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val);
34
35extern bool pxa2xx_ac97_try_warm_reset(struct snd_ac97 *ac97);
36extern bool pxa2xx_ac97_try_cold_reset(struct snd_ac97 *ac97);
37extern void pxa2xx_ac97_finish_reset(struct snd_ac97 *ac97);
38
39extern int pxa2xx_ac97_hw_suspend(void);
40extern int pxa2xx_ac97_hw_resume(void);
41
42extern int pxa2xx_ac97_hw_probe(struct platform_device *dev);
43extern void pxa2xx_ac97_hw_remove(struct platform_device *dev);
44
45#endif
diff --git a/include/sound/sb.h b/include/sound/sb.h
index d0c9ed3546c8..85f93c5fe1e4 100644
--- a/include/sound/sb.h
+++ b/include/sound/sb.h
@@ -240,11 +240,15 @@ struct snd_sb {
240#define SB_DT019X_CAP_MAIN 0x07 240#define SB_DT019X_CAP_MAIN 0x07
241 241
242#define SB_ALS4000_MONO_IO_CTRL 0x4b 242#define SB_ALS4000_MONO_IO_CTRL 0x4b
243#define SB_ALS4000_OUT_MIXER_CTRL_2 0x4c
243#define SB_ALS4000_MIC_IN_GAIN 0x4d 244#define SB_ALS4000_MIC_IN_GAIN 0x4d
245#define SB_ALS4000_ANALOG_REFRNC_VOLT_CTRL 0x4e
244#define SB_ALS4000_FMDAC 0x4f 246#define SB_ALS4000_FMDAC 0x4f
245#define SB_ALS4000_3D_SND_FX 0x50 247#define SB_ALS4000_3D_SND_FX 0x50
246#define SB_ALS4000_3D_TIME_DELAY 0x51 248#define SB_ALS4000_3D_TIME_DELAY 0x51
247#define SB_ALS4000_3D_AUTO_MUTE 0x52 249#define SB_ALS4000_3D_AUTO_MUTE 0x52
250#define SB_ALS4000_ANALOG_BLOCK_CTRL 0x53
251#define SB_ALS4000_3D_DELAYLINE_PATTERN 0x54
248#define SB_ALS4000_QSOUND 0xdb 252#define SB_ALS4000_QSOUND 0xdb
249 253
250/* IRQ setting bitmap */ 254/* IRQ setting bitmap */
@@ -257,6 +261,7 @@ struct snd_sb {
257#define SB_IRQTYPE_8BIT 0x01 261#define SB_IRQTYPE_8BIT 0x01
258#define SB_IRQTYPE_16BIT 0x02 262#define SB_IRQTYPE_16BIT 0x02
259#define SB_IRQTYPE_MPUIN 0x04 263#define SB_IRQTYPE_MPUIN 0x04
264#define ALS4K_IRQTYPE_CR1E_DMA 0x20
260 265
261/* DMA setting bitmap */ 266/* DMA setting bitmap */
262#define SB_DMASETUP_DMA0 0x01 267#define SB_DMASETUP_DMA0 0x01
diff --git a/include/sound/snd_wavefront.h b/include/sound/snd_wavefront.h
index 9688d4be918e..fa149ca77e4b 100644
--- a/include/sound/snd_wavefront.h
+++ b/include/sound/snd_wavefront.h
@@ -1,7 +1,6 @@
1#ifndef __SOUND_SND_WAVEFRONT_H__ 1#ifndef __SOUND_SND_WAVEFRONT_H__
2#define __SOUND_SND_WAVEFRONT_H__ 2#define __SOUND_SND_WAVEFRONT_H__
3 3
4#include "cs4231.h"
5#include "mpu401.h" 4#include "mpu401.h"
6#include "hwdep.h" 5#include "hwdep.h"
7#include "rawmidi.h" 6#include "rawmidi.h"
diff --git a/include/sound/soc-of-simple.h b/include/sound/soc-of-simple.h
new file mode 100644
index 000000000000..a064e1934a56
--- /dev/null
+++ b/include/sound/soc-of-simple.h
@@ -0,0 +1,25 @@
1/*
2 * OF helpers for ALSA SoC
3 *
4 * Copyright (C) 2008, Secret Lab Technologies Ltd.
5 */
6
7#ifndef _INCLUDE_SOC_OF_H_
8#define _INCLUDE_SOC_OF_H_
9
10#if defined(CONFIG_SND_SOC_OF_SIMPLE) || defined(CONFIG_SND_SOC_OF_SIMPLE_MODULE)
11
12#include <linux/of.h>
13#include <sound/soc.h>
14
15int of_snd_soc_register_codec(struct snd_soc_codec_device *codec_dev,
16 void *codec_data, struct snd_soc_dai *dai,
17 struct device_node *node);
18
19int of_snd_soc_register_platform(struct snd_soc_platform *platform,
20 struct device_node *node,
21 struct snd_soc_dai *cpu_dai);
22
23#endif
24
25#endif /* _INCLUDE_SOC_OF_H_ */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 1890d87c5204..a1e0357a84d7 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -26,10 +26,12 @@
26/* 26/*
27 * Convenience kcontrol builders 27 * Convenience kcontrol builders
28 */ 28 */
29#define SOC_SINGLE_VALUE(reg, shift, max, invert) ((reg) | ((shift) << 8) |\ 29#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \
30 ((shift) << 12) | ((max) << 16) | ((invert) << 24)) 30 ((unsigned long)&(struct soc_mixer_control) \
31#define SOC_SINGLE_VALUE_EXT(reg, max, invert) ((reg) | ((max) << 16) |\ 31 {.reg = xreg, .shift = xshift, .max = xmax, .invert = xinvert})
32 ((invert) << 31)) 32#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
33 ((unsigned long)&(struct soc_mixer_control) \
34 {.reg = xreg, .max = xmax, .invert = xinvert})
33#define SOC_SINGLE(xname, reg, shift, max, invert) \ 35#define SOC_SINGLE(xname, reg, shift, max, invert) \
34{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 36{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
35 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 37 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
@@ -43,64 +45,68 @@
43 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 45 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
44 .put = snd_soc_put_volsw, \ 46 .put = snd_soc_put_volsw, \
45 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 47 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
46#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \ 48#define SOC_DOUBLE(xname, xreg, shift_left, shift_right, xmax, xinvert) \
47{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 49{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
48 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ 50 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
49 .put = snd_soc_put_volsw, \ 51 .put = snd_soc_put_volsw, \
50 .private_value = (reg) | ((shift_left) << 8) | \ 52 .private_value = (unsigned long)&(struct soc_mixer_control) \
51 ((shift_right) << 12) | ((max) << 16) | ((invert) << 24) } 53 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \
52#define SOC_DOUBLE_R(xname, reg_left, reg_right, shift, max, invert) \ 54 .max = xmax, .invert = xinvert} }
55#define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
53{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 56{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
54 .info = snd_soc_info_volsw_2r, \ 57 .info = snd_soc_info_volsw_2r, \
55 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ 58 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
56 .private_value = (reg_left) | ((shift) << 8) | \ 59 .private_value = (unsigned long)&(struct soc_mixer_control) \
57 ((max) << 12) | ((invert) << 20) | ((reg_right) << 24) } 60 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
58#define SOC_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, tlv_array) \ 61 .max = xmax, .invert = xinvert} }
62#define SOC_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert, tlv_array) \
59{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 63{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
60 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 64 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
61 SNDRV_CTL_ELEM_ACCESS_READWRITE,\ 65 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
62 .tlv.p = (tlv_array), \ 66 .tlv.p = (tlv_array), \
63 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ 67 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
64 .put = snd_soc_put_volsw, \ 68 .put = snd_soc_put_volsw, \
65 .private_value = (reg) | ((shift_left) << 8) | \ 69 .private_value = (unsigned long)&(struct soc_mixer_control) \
66 ((shift_right) << 12) | ((max) << 16) | ((invert) << 24) } 70 {.reg = xreg, .shift = shift_left, .rshift = shift_right,\
67#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, shift, max, invert, tlv_array) \ 71 .max = xmax, .invert = xinvert} }
72#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
68{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 73{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
69 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 74 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
70 SNDRV_CTL_ELEM_ACCESS_READWRITE,\ 75 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
71 .tlv.p = (tlv_array), \ 76 .tlv.p = (tlv_array), \
72 .info = snd_soc_info_volsw_2r, \ 77 .info = snd_soc_info_volsw_2r, \
73 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ 78 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
74 .private_value = (reg_left) | ((shift) << 8) | \ 79 .private_value = (unsigned long)&(struct soc_mixer_control) \
75 ((max) << 12) | ((invert) << 20) | ((reg_right) << 24) } 80 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
76#define SOC_DOUBLE_S8_TLV(xname, reg, min, max, tlv_array) \ 81 .max = xmax, .invert = xinvert} }
82#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
77{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 83{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
78 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 84 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
79 SNDRV_CTL_ELEM_ACCESS_READWRITE, \ 85 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
80 .tlv.p = (tlv_array), \ 86 .tlv.p = (tlv_array), \
81 .info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \ 87 .info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \
82 .put = snd_soc_put_volsw_s8, \ 88 .put = snd_soc_put_volsw_s8, \
83 .private_value = (reg) | (((signed char)max) << 16) | \ 89 .private_value = (unsigned long)&(struct soc_mixer_control) \
84 (((signed char)min) << 24) } 90 {.reg = xreg, .min = xmin, .max = xmax} }
85#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \ 91#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \
86{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 92{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
87 .mask = xmask, .texts = xtexts } 93 .max = xmax, .texts = xtexts }
88#define SOC_ENUM_SINGLE(xreg, xshift, xmask, xtexts) \ 94#define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \
89 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xtexts) 95 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts)
90#define SOC_ENUM_SINGLE_EXT(xmask, xtexts) \ 96#define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \
91{ .mask = xmask, .texts = xtexts } 97{ .max = xmax, .texts = xtexts }
92#define SOC_ENUM(xname, xenum) \ 98#define SOC_ENUM(xname, xenum) \
93{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\ 99{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
94 .info = snd_soc_info_enum_double, \ 100 .info = snd_soc_info_enum_double, \
95 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \ 101 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
96 .private_value = (unsigned long)&xenum } 102 .private_value = (unsigned long)&xenum }
97#define SOC_SINGLE_EXT(xname, xreg, xshift, xmask, xinvert,\ 103#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
98 xhandler_get, xhandler_put) \ 104 xhandler_get, xhandler_put) \
99{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 105{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
100 .info = snd_soc_info_volsw, \ 106 .info = snd_soc_info_volsw, \
101 .get = xhandler_get, .put = xhandler_put, \ 107 .get = xhandler_get, .put = xhandler_put, \
102 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmask, xinvert) } 108 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
103#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmask, xinvert,\ 109#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
104 xhandler_get, xhandler_put, tlv_array) \ 110 xhandler_get, xhandler_put, tlv_array) \
105{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 111{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
106 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 112 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
@@ -108,7 +114,7 @@
108 .tlv.p = (tlv_array), \ 114 .tlv.p = (tlv_array), \
109 .info = snd_soc_info_volsw, \ 115 .info = snd_soc_info_volsw, \
110 .get = xhandler_get, .put = xhandler_put, \ 116 .get = xhandler_get, .put = xhandler_put, \
111 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmask, xinvert) } 117 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
112#define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \ 118#define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
113{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 119{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
114 .info = snd_soc_info_bool_ext, \ 120 .info = snd_soc_info_bool_ext, \
@@ -410,6 +416,8 @@ struct snd_soc_codec {
410 void *control_data; /* codec control (i2c/3wire) data */ 416 void *control_data; /* codec control (i2c/3wire) data */
411 unsigned int (*read)(struct snd_soc_codec *, unsigned int); 417 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
412 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); 418 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
419 int (*display_register)(struct snd_soc_codec *, char *,
420 size_t, unsigned int);
413 hw_write_t hw_write; 421 hw_write_t hw_write;
414 hw_read_t hw_read; 422 hw_read_t hw_read;
415 void *reg_cache; 423 void *reg_cache;
@@ -516,13 +524,19 @@ struct snd_soc_pcm_runtime {
516 struct snd_soc_device *socdev; 524 struct snd_soc_device *socdev;
517}; 525};
518 526
527/* mixer control */
528struct soc_mixer_control {
529 int min, max;
530 unsigned int reg, rreg, shift, rshift, invert;
531};
532
519/* enumerated kcontrol */ 533/* enumerated kcontrol */
520struct soc_enum { 534struct soc_enum {
521 unsigned short reg; 535 unsigned short reg;
522 unsigned short reg2; 536 unsigned short reg2;
523 unsigned char shift_l; 537 unsigned char shift_l;
524 unsigned char shift_r; 538 unsigned char shift_r;
525 unsigned int mask; 539 unsigned int max;
526 const char **texts; 540 const char **texts;
527 void *dapm; 541 void *dapm;
528}; 542};
diff --git a/include/sound/version.h b/include/sound/version.h
index 6b78aff273a8..4aafeda88634 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h */ 1/* include/version.h */
2#define CONFIG_SND_VERSION "1.0.17" 2#define CONFIG_SND_VERSION "1.0.18rc3"
3#define CONFIG_SND_DATE "" 3#define CONFIG_SND_DATE ""
diff --git a/include/sound/vx_core.h b/include/sound/vx_core.h
index 4830651cc4cf..5456343ebe4c 100644
--- a/include/sound/vx_core.h
+++ b/include/sound/vx_core.h
@@ -235,37 +235,31 @@ irqreturn_t snd_vx_irq_handler(int irq, void *dev);
235 */ 235 */
236static inline int vx_test_and_ack(struct vx_core *chip) 236static inline int vx_test_and_ack(struct vx_core *chip)
237{ 237{
238 snd_assert(chip->ops->test_and_ack, return -ENXIO);
239 return chip->ops->test_and_ack(chip); 238 return chip->ops->test_and_ack(chip);
240} 239}
241 240
242static inline void vx_validate_irq(struct vx_core *chip, int enable) 241static inline void vx_validate_irq(struct vx_core *chip, int enable)
243{ 242{
244 snd_assert(chip->ops->validate_irq, return);
245 chip->ops->validate_irq(chip, enable); 243 chip->ops->validate_irq(chip, enable);
246} 244}
247 245
248static inline unsigned char snd_vx_inb(struct vx_core *chip, int reg) 246static inline unsigned char snd_vx_inb(struct vx_core *chip, int reg)
249{ 247{
250 snd_assert(chip->ops->in8, return 0);
251 return chip->ops->in8(chip, reg); 248 return chip->ops->in8(chip, reg);
252} 249}
253 250
254static inline unsigned int snd_vx_inl(struct vx_core *chip, int reg) 251static inline unsigned int snd_vx_inl(struct vx_core *chip, int reg)
255{ 252{
256 snd_assert(chip->ops->in32, return 0);
257 return chip->ops->in32(chip, reg); 253 return chip->ops->in32(chip, reg);
258} 254}
259 255
260static inline void snd_vx_outb(struct vx_core *chip, int reg, unsigned char val) 256static inline void snd_vx_outb(struct vx_core *chip, int reg, unsigned char val)
261{ 257{
262 snd_assert(chip->ops->out8, return);
263 chip->ops->out8(chip, reg, val); 258 chip->ops->out8(chip, reg, val);
264} 259}
265 260
266static inline void snd_vx_outl(struct vx_core *chip, int reg, unsigned int val) 261static inline void snd_vx_outl(struct vx_core *chip, int reg, unsigned int val)
267{ 262{
268 snd_assert(chip->ops->out32, return);
269 chip->ops->out32(chip, reg, val); 263 chip->ops->out32(chip, reg, val);
270} 264}
271 265
@@ -276,7 +270,6 @@ static inline void snd_vx_outl(struct vx_core *chip, int reg, unsigned int val)
276 270
277static inline void vx_reset_dsp(struct vx_core *chip) 271static inline void vx_reset_dsp(struct vx_core *chip)
278{ 272{
279 snd_assert(chip->ops->reset_dsp, return);
280 chip->ops->reset_dsp(chip); 273 chip->ops->reset_dsp(chip);
281} 274}
282 275
@@ -304,14 +297,12 @@ int snd_vx_check_reg_bit(struct vx_core *chip, int reg, int mask, int bit, int t
304static inline void vx_pseudo_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime, 297static inline void vx_pseudo_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime,
305 struct vx_pipe *pipe, int count) 298 struct vx_pipe *pipe, int count)
306{ 299{
307 snd_assert(chip->ops->dma_write, return);
308 chip->ops->dma_write(chip, runtime, pipe, count); 300 chip->ops->dma_write(chip, runtime, pipe, count);
309} 301}
310 302
311static inline void vx_pseudo_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime, 303static inline void vx_pseudo_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime,
312 struct vx_pipe *pipe, int count) 304 struct vx_pipe *pipe, int count)
313{ 305{
314 snd_assert(chip->ops->dma_read, return);
315 chip->ops->dma_read(chip, runtime, pipe, count); 306 chip->ops->dma_read(chip, runtime, pipe, count);
316} 307}
317 308
diff --git a/include/sound/wss.h b/include/sound/wss.h
new file mode 100644
index 000000000000..fd01f22825cd
--- /dev/null
+++ b/include/sound/wss.h
@@ -0,0 +1,235 @@
1#ifndef __SOUND_WSS_H
2#define __SOUND_WSS_H
3
4/*
5 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
6 * Definitions for CS4231 & InterWave chips & compatible chips
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#include "control.h"
26#include "pcm.h"
27#include "timer.h"
28
29#include "cs4231-regs.h"
30
31/* defines for codec.mode */
32
33#define WSS_MODE_NONE 0x0000
34#define WSS_MODE_PLAY 0x0001
35#define WSS_MODE_RECORD 0x0002
36#define WSS_MODE_TIMER 0x0004
37#define WSS_MODE_OPEN (WSS_MODE_PLAY|WSS_MODE_RECORD|WSS_MODE_TIMER)
38
39/* defines for codec.hardware */
40
41#define WSS_HW_DETECT 0x0000 /* let CS4231 driver detect chip */
42#define WSS_HW_DETECT3 0x0001 /* allow mode 3 */
43#define WSS_HW_TYPE_MASK 0xff00 /* type mask */
44#define WSS_HW_CS4231_MASK 0x0100 /* CS4231 serie */
45#define WSS_HW_CS4231 0x0100 /* CS4231 chip */
46#define WSS_HW_CS4231A 0x0101 /* CS4231A chip */
47#define WSS_HW_AD1845 0x0102 /* AD1845 chip */
48#define WSS_HW_CS4232_MASK 0x0200 /* CS4232 serie (has control ports) */
49#define WSS_HW_CS4232 0x0200 /* CS4232 */
50#define WSS_HW_CS4232A 0x0201 /* CS4232A */
51#define WSS_HW_CS4236 0x0202 /* CS4236 */
52#define WSS_HW_CS4236B_MASK 0x0400 /* CS4236B serie (has extended control regs) */
53#define WSS_HW_CS4235 0x0400 /* CS4235 - Crystal Clear (tm) stereo enhancement */
54#define WSS_HW_CS4236B 0x0401 /* CS4236B */
55#define WSS_HW_CS4237B 0x0402 /* CS4237B - SRS 3D */
56#define WSS_HW_CS4238B 0x0403 /* CS4238B - QSOUND 3D */
57#define WSS_HW_CS4239 0x0404 /* CS4239 - Crystal Clear (tm) stereo enhancement */
58#define WSS_HW_AD1848_MASK 0x0800 /* AD1848 serie (half duplex) */
59#define WSS_HW_AD1847 0x0801 /* AD1847 chip */
60#define WSS_HW_AD1848 0x0802 /* AD1848 chip */
61#define WSS_HW_CS4248 0x0803 /* CS4248 chip */
62#define WSS_HW_CMI8330 0x0804 /* CMI8330 chip */
63#define WSS_HW_THINKPAD 0x0805 /* Thinkpad 360/750/755 */
64/* compatible, but clones */
65#define WSS_HW_INTERWAVE 0x1000 /* InterWave chip */
66#define WSS_HW_OPL3SA2 0x1101 /* OPL3-SA2 chip, similar to cs4231 */
67#define WSS_HW_OPTI93X 0x1102 /* Opti 930/931/933 */
68
69/* defines for codec.hwshare */
70#define WSS_HWSHARE_IRQ (1<<0)
71#define WSS_HWSHARE_DMA1 (1<<1)
72#define WSS_HWSHARE_DMA2 (1<<2)
73
74/* IBM Thinkpad specific stuff */
75#define AD1848_THINKPAD_CTL_PORT1 0x15e8
76#define AD1848_THINKPAD_CTL_PORT2 0x15e9
77#define AD1848_THINKPAD_CS4248_ENABLE_BIT 0x02
78
79struct snd_wss {
80 unsigned long port; /* base i/o port */
81 struct resource *res_port;
82 unsigned long cport; /* control base i/o port (CS4236) */
83 struct resource *res_cport;
84 int irq; /* IRQ line */
85 int dma1; /* playback DMA */
86 int dma2; /* record DMA */
87 unsigned short version; /* version of CODEC chip */
88 unsigned short mode; /* see to WSS_MODE_XXXX */
89 unsigned short hardware; /* see to WSS_HW_XXXX */
90 unsigned short hwshare; /* shared resources */
91 unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit */
92 /* daughter board) or dma1 == dma2 */
93 ebus_flag:1, /* SPARC: EBUS present */
94 thinkpad_flag:1; /* Thinkpad CS4248 needs extra help */
95
96 struct snd_card *card;
97 struct snd_pcm *pcm;
98 struct snd_pcm_substream *playback_substream;
99 struct snd_pcm_substream *capture_substream;
100 struct snd_timer *timer;
101
102 unsigned char image[32]; /* registers image */
103 unsigned char eimage[32]; /* extended registers image */
104 unsigned char cimage[16]; /* control registers image */
105 int mce_bit;
106 int calibrate_mute;
107 int sw_3d_bit;
108 unsigned int p_dma_size;
109 unsigned int c_dma_size;
110
111 spinlock_t reg_lock;
112 struct mutex mce_mutex;
113 struct mutex open_mutex;
114
115 int (*rate_constraint) (struct snd_pcm_runtime *runtime);
116 void (*set_playback_format) (struct snd_wss *chip,
117 struct snd_pcm_hw_params *hw_params,
118 unsigned char pdfr);
119 void (*set_capture_format) (struct snd_wss *chip,
120 struct snd_pcm_hw_params *hw_params,
121 unsigned char cdfr);
122 void (*trigger) (struct snd_wss *chip, unsigned int what, int start);
123#ifdef CONFIG_PM
124 void (*suspend) (struct snd_wss *chip);
125 void (*resume) (struct snd_wss *chip);
126#endif
127 void *dma_private_data;
128 int (*claim_dma) (struct snd_wss *chip,
129 void *dma_private_data, int dma);
130 int (*release_dma) (struct snd_wss *chip,
131 void *dma_private_data, int dma);
132};
133
134/* exported functions */
135
136void snd_wss_out(struct snd_wss *chip, unsigned char reg, unsigned char val);
137unsigned char snd_wss_in(struct snd_wss *chip, unsigned char reg);
138void snd_cs4236_ext_out(struct snd_wss *chip,
139 unsigned char reg, unsigned char val);
140unsigned char snd_cs4236_ext_in(struct snd_wss *chip, unsigned char reg);
141void snd_wss_mce_up(struct snd_wss *chip);
142void snd_wss_mce_down(struct snd_wss *chip);
143
144void snd_wss_overrange(struct snd_wss *chip);
145
146irqreturn_t snd_wss_interrupt(int irq, void *dev_id);
147
148const char *snd_wss_chip_id(struct snd_wss *chip);
149
150int snd_wss_create(struct snd_card *card,
151 unsigned long port,
152 unsigned long cport,
153 int irq, int dma1, int dma2,
154 unsigned short hardware,
155 unsigned short hwshare,
156 struct snd_wss **rchip);
157int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm);
158int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer);
159int snd_wss_mixer(struct snd_wss *chip);
160
161const struct snd_pcm_ops *snd_wss_get_pcm_ops(int direction);
162
163int snd_cs4236_create(struct snd_card *card,
164 unsigned long port,
165 unsigned long cport,
166 int irq, int dma1, int dma2,
167 unsigned short hardware,
168 unsigned short hwshare,
169 struct snd_wss **rchip);
170int snd_cs4236_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm);
171int snd_cs4236_mixer(struct snd_wss *chip);
172
173/*
174 * mixer library
175 */
176
177#define WSS_SINGLE(xname, xindex, reg, shift, mask, invert) \
178{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
179 .name = xname, \
180 .index = xindex, \
181 .info = snd_wss_info_single, \
182 .get = snd_wss_get_single, \
183 .put = snd_wss_put_single, \
184 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) }
185
186int snd_wss_info_single(struct snd_kcontrol *kcontrol,
187 struct snd_ctl_elem_info *uinfo);
188int snd_wss_get_single(struct snd_kcontrol *kcontrol,
189 struct snd_ctl_elem_value *ucontrol);
190int snd_wss_put_single(struct snd_kcontrol *kcontrol,
191 struct snd_ctl_elem_value *ucontrol);
192
193#define WSS_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \
194{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
195 .name = xname, \
196 .index = xindex, \
197 .info = snd_wss_info_double, \
198 .get = snd_wss_get_double, \
199 .put = snd_wss_put_double, \
200 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | \
201 (shift_right << 19) | (mask << 24) | (invert << 22) }
202
203#define WSS_SINGLE_TLV(xname, xindex, reg, shift, mask, invert, xtlv) \
204{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
205 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \
206 .name = xname, \
207 .index = xindex, \
208 .info = snd_wss_info_single, \
209 .get = snd_wss_get_single, \
210 .put = snd_wss_put_single, \
211 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24), \
212 .tlv = { .p = (xtlv) } }
213
214#define WSS_DOUBLE_TLV(xname, xindex, left_reg, right_reg, \
215 shift_left, shift_right, mask, invert, xtlv) \
216{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
217 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \
218 .name = xname, \
219 .index = xindex, \
220 .info = snd_wss_info_double, \
221 .get = snd_wss_get_double, \
222 .put = snd_wss_put_double, \
223 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | \
224 (shift_right << 19) | (mask << 24) | (invert << 22), \
225 .tlv = { .p = (xtlv) } }
226
227
228int snd_wss_info_double(struct snd_kcontrol *kcontrol,
229 struct snd_ctl_elem_info *uinfo);
230int snd_wss_get_double(struct snd_kcontrol *kcontrol,
231 struct snd_ctl_elem_value *ucontrol);
232int snd_wss_put_double(struct snd_kcontrol *kcontrol,
233 struct snd_ctl_elem_value *ucontrol);
234
235#endif /* __SOUND_WSS_H */