diff options
Diffstat (limited to 'include/sound/cs4231.h')
-rw-r--r-- | include/sound/cs4231.h | 113 |
1 files changed, 36 insertions, 77 deletions
diff --git a/include/sound/cs4231.h b/include/sound/cs4231.h index d7f90823778a..ac6a5d882088 100644 --- a/include/sound/cs4231.h +++ b/include/sound/cs4231.h | |||
@@ -26,21 +26,6 @@ | |||
26 | #include "pcm.h" | 26 | #include "pcm.h" |
27 | #include "timer.h" | 27 | #include "timer.h" |
28 | 28 | ||
29 | #ifdef CONFIG_SBUS | ||
30 | #define SBUS_SUPPORT | ||
31 | #include <asm/sbus.h> | ||
32 | #endif | ||
33 | |||
34 | #if defined(CONFIG_PCI) && defined(CONFIG_SPARC64) | ||
35 | #define EBUS_SUPPORT | ||
36 | #include <linux/pci.h> | ||
37 | #include <asm/ebus.h> | ||
38 | #endif | ||
39 | |||
40 | #if !defined(SBUS_SUPPORT) && !defined(EBUS_SUPPORT) | ||
41 | #define LEGACY_SUPPORT | ||
42 | #endif | ||
43 | |||
44 | /* IO ports */ | 29 | /* IO ports */ |
45 | 30 | ||
46 | #define CS4231P(x) (c_d_c_CS4231##x) | 31 | #define CS4231P(x) (c_d_c_CS4231##x) |
@@ -232,18 +217,14 @@ | |||
232 | #define CS4231_HWSHARE_DMA1 (1<<1) | 217 | #define CS4231_HWSHARE_DMA1 (1<<1) |
233 | #define CS4231_HWSHARE_DMA2 (1<<2) | 218 | #define CS4231_HWSHARE_DMA2 (1<<2) |
234 | 219 | ||
235 | typedef struct _snd_cs4231 cs4231_t; | 220 | struct snd_cs4231 { |
236 | |||
237 | struct _snd_cs4231 { | ||
238 | unsigned long port; /* base i/o port */ | 221 | unsigned long port; /* base i/o port */ |
239 | #ifdef LEGACY_SUPPORT | ||
240 | struct resource *res_port; | 222 | struct resource *res_port; |
241 | unsigned long cport; /* control base i/o port (CS4236) */ | 223 | unsigned long cport; /* control base i/o port (CS4236) */ |
242 | struct resource *res_cport; | 224 | struct resource *res_cport; |
243 | int irq; /* IRQ line */ | 225 | int irq; /* IRQ line */ |
244 | int dma1; /* playback DMA */ | 226 | int dma1; /* playback DMA */ |
245 | int dma2; /* record DMA */ | 227 | int dma2; /* record DMA */ |
246 | #endif | ||
247 | unsigned short version; /* version of CODEC chip */ | 228 | unsigned short version; /* version of CODEC chip */ |
248 | unsigned short mode; /* see to CS4231_MODE_XXXX */ | 229 | unsigned short mode; /* see to CS4231_MODE_XXXX */ |
249 | unsigned short hardware; /* see to CS4231_HW_XXXX */ | 230 | unsigned short hardware; /* see to CS4231_HW_XXXX */ |
@@ -251,29 +232,11 @@ struct _snd_cs4231 { | |||
251 | unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */ | 232 | unsigned short single_dma:1, /* forced single DMA mode (GUS 16-bit daughter board) or dma1 == dma2 */ |
252 | ebus_flag:1; /* SPARC: EBUS present */ | 233 | ebus_flag:1; /* SPARC: EBUS present */ |
253 | 234 | ||
254 | #ifdef EBUS_SUPPORT | 235 | struct snd_card *card; |
255 | struct ebus_dma_info eb2c; | 236 | struct snd_pcm *pcm; |
256 | struct ebus_dma_info eb2p; | 237 | struct snd_pcm_substream *playback_substream; |
257 | #endif | 238 | struct snd_pcm_substream *capture_substream; |
258 | 239 | struct snd_timer *timer; | |
259 | #if defined(SBUS_SUPPORT) || defined(EBUS_SUPPORT) | ||
260 | union { | ||
261 | #ifdef SBUS_SUPPORT | ||
262 | struct sbus_dev *sdev; | ||
263 | #endif | ||
264 | #ifdef EBUS_SUPPORT | ||
265 | struct pci_dev *pdev; | ||
266 | #endif | ||
267 | } dev_u; | ||
268 | unsigned int p_periods_sent; | ||
269 | unsigned int c_periods_sent; | ||
270 | #endif | ||
271 | |||
272 | snd_card_t *card; | ||
273 | snd_pcm_t *pcm; | ||
274 | snd_pcm_substream_t *playback_substream; | ||
275 | snd_pcm_substream_t *capture_substream; | ||
276 | snd_timer_t *timer; | ||
277 | 240 | ||
278 | unsigned char image[32]; /* registers image */ | 241 | unsigned char image[32]; /* registers image */ |
279 | unsigned char eimage[32]; /* extended registers image */ | 242 | unsigned char eimage[32]; /* extended registers image */ |
@@ -281,63 +244,59 @@ struct _snd_cs4231 { | |||
281 | int mce_bit; | 244 | int mce_bit; |
282 | int calibrate_mute; | 245 | int calibrate_mute; |
283 | int sw_3d_bit; | 246 | int sw_3d_bit; |
284 | #ifdef LEGACY_SUPPORT | ||
285 | unsigned int p_dma_size; | 247 | unsigned int p_dma_size; |
286 | unsigned int c_dma_size; | 248 | unsigned int c_dma_size; |
287 | #endif | ||
288 | 249 | ||
289 | spinlock_t reg_lock; | 250 | spinlock_t reg_lock; |
290 | struct semaphore mce_mutex; | 251 | struct semaphore mce_mutex; |
291 | struct semaphore open_mutex; | 252 | struct semaphore open_mutex; |
292 | 253 | ||
293 | int (*rate_constraint) (snd_pcm_runtime_t *runtime); | 254 | int (*rate_constraint) (struct snd_pcm_runtime *runtime); |
294 | void (*set_playback_format) (cs4231_t *chip, snd_pcm_hw_params_t *hw_params, unsigned char pdfr); | 255 | void (*set_playback_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char pdfr); |
295 | void (*set_capture_format) (cs4231_t *chip, snd_pcm_hw_params_t *hw_params, unsigned char cdfr); | 256 | void (*set_capture_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char cdfr); |
296 | void (*trigger) (cs4231_t *chip, unsigned int what, int start); | 257 | void (*trigger) (struct snd_cs4231 *chip, unsigned int what, int start); |
297 | #ifdef CONFIG_PM | 258 | #ifdef CONFIG_PM |
298 | void (*suspend) (cs4231_t *chip); | 259 | void (*suspend) (struct snd_cs4231 *chip); |
299 | void (*resume) (cs4231_t *chip); | 260 | void (*resume) (struct snd_cs4231 *chip); |
300 | #endif | 261 | #endif |
301 | void *dma_private_data; | 262 | void *dma_private_data; |
302 | #ifdef LEGACY_SUPPORT | 263 | int (*claim_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma); |
303 | int (*claim_dma) (cs4231_t *chip, void *dma_private_data, int dma); | 264 | int (*release_dma) (struct snd_cs4231 *chip, void *dma_private_data, int dma); |
304 | int (*release_dma) (cs4231_t *chip, void *dma_private_data, int dma); | ||
305 | #endif | ||
306 | }; | 265 | }; |
307 | 266 | ||
308 | /* exported functions */ | 267 | /* exported functions */ |
309 | 268 | ||
310 | void snd_cs4231_out(cs4231_t *chip, unsigned char reg, unsigned char val); | 269 | void snd_cs4231_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val); |
311 | unsigned char snd_cs4231_in(cs4231_t *chip, unsigned char reg); | 270 | unsigned char snd_cs4231_in(struct snd_cs4231 *chip, unsigned char reg); |
312 | void snd_cs4236_ext_out(cs4231_t *chip, unsigned char reg, unsigned char val); | 271 | void snd_cs4236_ext_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val); |
313 | unsigned char snd_cs4236_ext_in(cs4231_t *chip, unsigned char reg); | 272 | unsigned char snd_cs4236_ext_in(struct snd_cs4231 *chip, unsigned char reg); |
314 | void snd_cs4231_mce_up(cs4231_t *chip); | 273 | void snd_cs4231_mce_up(struct snd_cs4231 *chip); |
315 | void snd_cs4231_mce_down(cs4231_t *chip); | 274 | void snd_cs4231_mce_down(struct snd_cs4231 *chip); |
316 | 275 | ||
317 | irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id, struct pt_regs *regs); | 276 | irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id, struct pt_regs *regs); |
318 | 277 | ||
319 | const char *snd_cs4231_chip_id(cs4231_t *chip); | 278 | const char *snd_cs4231_chip_id(struct snd_cs4231 *chip); |
320 | 279 | ||
321 | int snd_cs4231_create(snd_card_t * card, | 280 | int snd_cs4231_create(struct snd_card *card, |
322 | unsigned long port, | 281 | unsigned long port, |
323 | unsigned long cport, | 282 | unsigned long cport, |
324 | int irq, int dma1, int dma2, | 283 | int irq, int dma1, int dma2, |
325 | unsigned short hardware, | 284 | unsigned short hardware, |
326 | unsigned short hwshare, | 285 | unsigned short hwshare, |
327 | cs4231_t ** rchip); | 286 | struct snd_cs4231 ** rchip); |
328 | int snd_cs4231_pcm(cs4231_t * chip, int device, snd_pcm_t **rpcm); | 287 | int snd_cs4231_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm); |
329 | int snd_cs4231_timer(cs4231_t * chip, int device, snd_timer_t **rtimer); | 288 | int snd_cs4231_timer(struct snd_cs4231 * chip, int device, struct snd_timer **rtimer); |
330 | int snd_cs4231_mixer(cs4231_t * chip); | 289 | int snd_cs4231_mixer(struct snd_cs4231 * chip); |
331 | 290 | ||
332 | int snd_cs4236_create(snd_card_t * card, | 291 | int snd_cs4236_create(struct snd_card *card, |
333 | unsigned long port, | 292 | unsigned long port, |
334 | unsigned long cport, | 293 | unsigned long cport, |
335 | int irq, int dma1, int dma2, | 294 | int irq, int dma1, int dma2, |
336 | unsigned short hardware, | 295 | unsigned short hardware, |
337 | unsigned short hwshare, | 296 | unsigned short hwshare, |
338 | cs4231_t ** rchip); | 297 | struct snd_cs4231 ** rchip); |
339 | int snd_cs4236_pcm(cs4231_t * chip, int device, snd_pcm_t **rpcm); | 298 | int snd_cs4236_pcm(struct snd_cs4231 * chip, int device, struct snd_pcm **rpcm); |
340 | int snd_cs4236_mixer(cs4231_t * chip); | 299 | int snd_cs4236_mixer(struct snd_cs4231 * chip); |
341 | 300 | ||
342 | /* | 301 | /* |
343 | * mixer library | 302 | * mixer library |
@@ -349,9 +308,9 @@ int snd_cs4236_mixer(cs4231_t * chip); | |||
349 | .get = snd_cs4231_get_single, .put = snd_cs4231_put_single, \ | 308 | .get = snd_cs4231_get_single, .put = snd_cs4231_put_single, \ |
350 | .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } | 309 | .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } |
351 | 310 | ||
352 | int snd_cs4231_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo); | 311 | int snd_cs4231_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); |
353 | int snd_cs4231_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); | 312 | int snd_cs4231_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); |
354 | int snd_cs4231_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); | 313 | int snd_cs4231_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); |
355 | 314 | ||
356 | #define CS4231_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ | 315 | #define CS4231_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ |
357 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ | 316 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
@@ -359,8 +318,8 @@ int snd_cs4231_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucon | |||
359 | .get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \ | 318 | .get = snd_cs4231_get_double, .put = snd_cs4231_put_double, \ |
360 | .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } | 319 | .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } |
361 | 320 | ||
362 | int snd_cs4231_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo); | 321 | int snd_cs4231_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); |
363 | int snd_cs4231_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); | 322 | int snd_cs4231_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); |
364 | int snd_cs4231_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol); | 323 | int snd_cs4231_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); |
365 | 324 | ||
366 | #endif /* __SOUND_CS4231_H */ | 325 | #endif /* __SOUND_CS4231_H */ |