2 * Driver for Digigram VX soundcards
6 * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <sound/driver.h>
24 #include <linux/delay.h>
25 #include <linux/slab.h>
26 #include <linux/interrupt.h>
27 #include <linux/init.h>
28 #include <linux/device.h>
29 #include <linux/firmware.h>
30 #include <sound/core.h>
31 #include <sound/pcm.h>
32 #include <sound/asoundef.h>
33 #include <sound/info.h>
35 #include <sound/vx_core.h>
38 MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
39 MODULE_DESCRIPTION("Common routines for Digigram VX drivers");
40 MODULE_LICENSE("GPL");
44 * vx_check_reg_bit - wait for the specified bit is set/reset on a register
45 * @reg: register to check
47 * @bit: resultant bit to be checked
48 * @time: time-out of loop in msec
50 * returns zero if a bit matches, or a negative error code.
52 int snd_vx_check_reg_bit(struct vx_core
*chip
, int reg
, int mask
, int bit
, int time
)
54 unsigned long end_time
= jiffies
+ (time
* HZ
+ 999) / 1000;
55 #ifdef CONFIG_SND_DEBUG
56 static char *reg_names
[VX_REG_MAX
] = {
57 "ICR", "CVR", "ISR", "IVR", "RXH", "RXM", "RXL",
58 "DMA", "CDSP", "RFREQ", "RUER/V2", "DATA", "MEMIRQ",
59 "ACQ", "BIT0", "BIT1", "MIC0", "MIC1", "MIC2",
60 "MIC3", "INTCSR", "CNTRL", "GPIOC",
61 "LOFREQ", "HIFREQ", "CSUER", "RUER"
65 if ((snd_vx_inb(chip
, reg
) & mask
) == bit
)
68 } while (time_after_eq(end_time
, jiffies
));
69 snd_printd(KERN_DEBUG
"vx_check_reg_bit: timeout, reg=%s, mask=0x%x, val=0x%x\n", reg_names
[reg
], mask
, snd_vx_inb(chip
, reg
));
74 * vx_send_irq_dsp - set command irq bit
75 * @num: the requested IRQ type, IRQ_XXX
77 * this triggers the specified IRQ request
78 * returns 0 if successful, or a negative error code.
81 static int vx_send_irq_dsp(struct vx_core
*chip
, int num
)
86 if (snd_vx_check_reg_bit(chip
, VX_CVR
, CVR_HC
, 0, 200) < 0)
90 if (vx_has_new_dsp(chip
))
91 nirq
+= VXP_IRQ_OFFSET
;
92 vx_outb(chip
, CVR
, (nirq
>> 1) | CVR_HC
);
98 * vx_reset_chk - reset CHK bit on ISR
100 * returns 0 if successful, or a negative error code.
102 static int vx_reset_chk(struct vx_core
*chip
)
105 if (vx_send_irq_dsp(chip
, IRQ_RESET_CHK
) < 0)
107 /* Wait until CHK = 0 */
108 if (vx_check_isr(chip
, ISR_CHK
, 0, 200) < 0)
114 * vx_transfer_end - terminate message transfer
115 * @cmd: IRQ message to send (IRQ_MESS_XXX_END)
117 * returns 0 if successful, or a negative error code.
118 * the error code can be VX-specific, retrieved via vx_get_error().
119 * NB: call with spinlock held!
121 static int vx_transfer_end(struct vx_core
*chip
, int cmd
)
125 if ((err
= vx_reset_chk(chip
)) < 0)
128 /* irq MESS_READ/WRITE_END */
129 if ((err
= vx_send_irq_dsp(chip
, cmd
)) < 0)
133 if ((err
= vx_wait_isr_bit(chip
, ISR_CHK
)) < 0)
136 /* If error, Read RX */
137 if ((err
= vx_inb(chip
, ISR
)) & ISR_ERR
) {
138 if ((err
= vx_wait_for_rx_full(chip
)) < 0) {
139 snd_printd(KERN_DEBUG
"transfer_end: error in rx_full\n");
142 err
= vx_inb(chip
, RXH
) << 16;
143 err
|= vx_inb(chip
, RXM
) << 8;
144 err
|= vx_inb(chip
, RXL
);
145 snd_printd(KERN_DEBUG
"transfer_end: error = 0x%x\n", err
);
146 return -(VX_ERR_MASK
| err
);
152 * vx_read_status - return the status rmh
153 * @rmh: rmh record to store the status
155 * returns 0 if successful, or a negative error code.
156 * the error code can be VX-specific, retrieved via vx_get_error().
157 * NB: call with spinlock held!
159 static int vx_read_status(struct vx_core
*chip
, struct vx_rmh
*rmh
)
161 int i
, err
, val
, size
;
163 /* no read necessary? */
164 if (rmh
->DspStat
== RMH_SSIZE_FIXED
&& rmh
->LgStat
== 0)
167 /* Wait for RX full (with timeout protection)
168 * The first word of status is in RX
170 err
= vx_wait_for_rx_full(chip
);
175 val
= vx_inb(chip
, RXH
) << 16;
176 val
|= vx_inb(chip
, RXM
) << 8;
177 val
|= vx_inb(chip
, RXL
);
179 /* If status given by DSP, let's decode its size */
180 switch (rmh
->DspStat
) {
183 rmh
->Stat
[0] = val
& 0xffff00;
184 rmh
->LgStat
= size
+ 1;
187 /* Let's count the arg numbers from a mask */
195 rmh
->LgStat
= size
+ 1;
198 /* else retrieve the status length given by the driver */
200 rmh
->Stat
[0] = val
; /* Val is the status 1st word */
201 size
--; /* hence adjust remaining length */
207 snd_assert(size
<= SIZE_MAX_STATUS
, return -EINVAL
);
209 for (i
= 1; i
<= size
; i
++) {
210 /* trigger an irq MESS_WRITE_NEXT */
211 err
= vx_send_irq_dsp(chip
, IRQ_MESS_WRITE_NEXT
);
214 /* Wait for RX full (with timeout protection) */
215 err
= vx_wait_for_rx_full(chip
);
218 rmh
->Stat
[i
] = vx_inb(chip
, RXH
) << 16;
219 rmh
->Stat
[i
] |= vx_inb(chip
, RXM
) << 8;
220 rmh
->Stat
[i
] |= vx_inb(chip
, RXL
);
223 return vx_transfer_end(chip
, IRQ_MESS_WRITE_END
);
227 #define MASK_MORE_THAN_1_WORD_COMMAND 0x00008000
228 #define MASK_1_WORD_COMMAND 0x00ff7fff
231 * vx_send_msg_nolock - send a DSP message and read back the status
232 * @rmh: the rmh record to send and receive
234 * returns 0 if successful, or a negative error code.
235 * the error code can be VX-specific, retrieved via vx_get_error().
237 * this function doesn't call spinlock at all.
239 int vx_send_msg_nolock(struct vx_core
*chip
, struct vx_rmh
*rmh
)
243 if (chip
->chip_status
& VX_STAT_IS_STALE
)
246 if ((err
= vx_reset_chk(chip
)) < 0) {
247 snd_printd(KERN_DEBUG
"vx_send_msg: vx_reset_chk error\n");
252 printk(KERN_DEBUG
"rmh: cmd = 0x%06x, length = %d, stype = %d\n",
253 rmh
->Cmd
[0], rmh
->LgCmd
, rmh
->DspStat
);
254 if (rmh
->LgCmd
> 1) {
255 printk(KERN_DEBUG
" ");
256 for (i
= 1; i
< rmh
->LgCmd
; i
++)
257 printk("0x%06x ", rmh
->Cmd
[i
]);
261 /* Check bit M is set according to length of the command */
263 rmh
->Cmd
[0] |= MASK_MORE_THAN_1_WORD_COMMAND
;
265 rmh
->Cmd
[0] &= MASK_1_WORD_COMMAND
;
267 /* Wait for TX empty */
268 if ((err
= vx_wait_isr_bit(chip
, ISR_TX_EMPTY
)) < 0) {
269 snd_printd(KERN_DEBUG
"vx_send_msg: wait tx empty error\n");
274 vx_outb(chip
, TXH
, (rmh
->Cmd
[0] >> 16) & 0xff);
275 vx_outb(chip
, TXM
, (rmh
->Cmd
[0] >> 8) & 0xff);
276 vx_outb(chip
, TXL
, rmh
->Cmd
[0] & 0xff);
278 /* Trigger irq MESSAGE */
279 if ((err
= vx_send_irq_dsp(chip
, IRQ_MESSAGE
)) < 0) {
280 snd_printd(KERN_DEBUG
"vx_send_msg: send IRQ_MESSAGE error\n");
284 /* Wait for CHK = 1 */
285 if ((err
= vx_wait_isr_bit(chip
, ISR_CHK
)) < 0)
288 /* If error, get error value from RX */
289 if (vx_inb(chip
, ISR
) & ISR_ERR
) {
290 if ((err
= vx_wait_for_rx_full(chip
)) < 0) {
291 snd_printd(KERN_DEBUG
"vx_send_msg: rx_full read error\n");
294 err
= vx_inb(chip
, RXH
) << 16;
295 err
|= vx_inb(chip
, RXM
) << 8;
296 err
|= vx_inb(chip
, RXL
);
297 snd_printd(KERN_DEBUG
"msg got error = 0x%x at cmd[0]\n", err
);
298 err
= -(VX_ERR_MASK
| err
);
302 /* Send the other words */
303 if (rmh
->LgCmd
> 1) {
304 for (i
= 1; i
< rmh
->LgCmd
; i
++) {
305 /* Wait for TX ready */
306 if ((err
= vx_wait_isr_bit(chip
, ISR_TX_READY
)) < 0) {
307 snd_printd(KERN_DEBUG
"vx_send_msg: tx_ready error\n");
312 vx_outb(chip
, TXH
, (rmh
->Cmd
[i
] >> 16) & 0xff);
313 vx_outb(chip
, TXM
, (rmh
->Cmd
[i
] >> 8) & 0xff);
314 vx_outb(chip
, TXL
, rmh
->Cmd
[i
] & 0xff);
316 /* Trigger irq MESS_READ_NEXT */
317 if ((err
= vx_send_irq_dsp(chip
, IRQ_MESS_READ_NEXT
)) < 0) {
318 snd_printd(KERN_DEBUG
"vx_send_msg: IRQ_READ_NEXT error\n");
322 /* Wait for TX empty */
323 if ((err
= vx_wait_isr_bit(chip
, ISR_TX_READY
)) < 0) {
324 snd_printd(KERN_DEBUG
"vx_send_msg: TX_READY error\n");
327 /* End of transfer */
328 err
= vx_transfer_end(chip
, IRQ_MESS_READ_END
);
333 return vx_read_status(chip
, rmh
);
338 * vx_send_msg - send a DSP message with spinlock
339 * @rmh: the rmh record to send and receive
341 * returns 0 if successful, or a negative error code.
342 * see vx_send_msg_nolock().
344 int vx_send_msg(struct vx_core
*chip
, struct vx_rmh
*rmh
)
349 spin_lock_irqsave(&chip
->lock
, flags
);
350 err
= vx_send_msg_nolock(chip
, rmh
);
351 spin_unlock_irqrestore(&chip
->lock
, flags
);
357 * vx_send_rih_nolock - send an RIH to xilinx
358 * @cmd: the command to send
360 * returns 0 if successful, or a negative error code.
361 * the error code can be VX-specific, retrieved via vx_get_error().
363 * this function doesn't call spinlock at all.
365 * unlike RMH, no command is sent to DSP.
367 int vx_send_rih_nolock(struct vx_core
*chip
, int cmd
)
371 if (chip
->chip_status
& VX_STAT_IS_STALE
)
375 printk(KERN_DEBUG
"send_rih: cmd = 0x%x\n", cmd
);
377 if ((err
= vx_reset_chk(chip
)) < 0)
380 if ((err
= vx_send_irq_dsp(chip
, cmd
)) < 0)
383 if ((err
= vx_wait_isr_bit(chip
, ISR_CHK
)) < 0)
385 /* If error, read RX */
386 if (vx_inb(chip
, ISR
) & ISR_ERR
) {
387 if ((err
= vx_wait_for_rx_full(chip
)) < 0)
389 err
= vx_inb(chip
, RXH
) << 16;
390 err
|= vx_inb(chip
, RXM
) << 8;
391 err
|= vx_inb(chip
, RXL
);
392 return -(VX_ERR_MASK
| err
);
399 * vx_send_rih - send an RIH with spinlock
400 * @cmd: the command to send
402 * see vx_send_rih_nolock().
404 int vx_send_rih(struct vx_core
*chip
, int cmd
)
409 spin_lock_irqsave(&chip
->lock
, flags
);
410 err
= vx_send_rih_nolock(chip
, cmd
);
411 spin_unlock_irqrestore(&chip
->lock
, flags
);
415 #define END_OF_RESET_WAIT_TIME 500 /* us */
418 * snd_vx_boot_xilinx - boot up the xilinx interface
419 * @boot: the boot record to load
421 int snd_vx_load_boot_image(struct vx_core
*chip
, const struct firmware
*boot
)
424 int no_fillup
= vx_has_new_dsp(chip
);
426 /* check the length of boot image */
427 snd_assert(boot
->size
> 0, return -EINVAL
);
428 snd_assert(boot
->size
% 3 == 0, return -EINVAL
);
431 /* more strict check */
432 unsigned int c
= ((u32
)boot
->data
[0] << 16) | ((u32
)boot
->data
[1] << 8) | boot
->data
[2];
433 snd_assert(boot
->size
== (c
+ 2) * 3, return -EINVAL
);
440 udelay(END_OF_RESET_WAIT_TIME
); /* another wait? */
442 /* download boot strap */
443 for (i
= 0; i
< 0x600; i
+= 3) {
444 if (i
>= boot
->size
) {
447 if (vx_wait_isr_bit(chip
, ISR_TX_EMPTY
) < 0) {
448 snd_printk(KERN_ERR
"dsp boot failed at %d\n", i
);
451 vx_outb(chip
, TXH
, 0);
452 vx_outb(chip
, TXM
, 0);
453 vx_outb(chip
, TXL
, 0);
455 unsigned char *image
= boot
->data
+ i
;
456 if (vx_wait_isr_bit(chip
, ISR_TX_EMPTY
) < 0) {
457 snd_printk(KERN_ERR
"dsp boot failed at %d\n", i
);
460 vx_outb(chip
, TXH
, image
[0]);
461 vx_outb(chip
, TXM
, image
[1]);
462 vx_outb(chip
, TXL
, image
[2]);
469 * vx_test_irq_src - query the source of interrupts
471 * called from irq handler only
473 static int vx_test_irq_src(struct vx_core
*chip
, unsigned int *ret
)
477 vx_init_rmh(&chip
->irq_rmh
, CMD_TEST_IT
);
478 spin_lock(&chip
->lock
);
479 err
= vx_send_msg_nolock(chip
, &chip
->irq_rmh
);
483 *ret
= chip
->irq_rmh
.Stat
[0];
484 spin_unlock(&chip
->lock
);
490 * vx_interrupt - soft irq handler
492 static void vx_interrupt(unsigned long private_data
)
494 struct vx_core
*chip
= (struct vx_core
*) private_data
;
497 if (chip
->chip_status
& VX_STAT_IS_STALE
)
500 if (vx_test_irq_src(chip
, &events
) < 0)
504 if (events
& 0x000800)
505 printk(KERN_ERR
"DSP Stream underrun ! IRQ events = 0x%x\n", events
);
507 // printk(KERN_DEBUG "IRQ events = 0x%x\n", events);
509 /* We must prevent any application using this DSP
510 * and block any further request until the application
511 * either unregisters or reloads the DSP
513 if (events
& FATAL_DSP_ERROR
) {
514 snd_printk(KERN_ERR
"vx_core: fatal DSP error!!\n");
518 /* The start on time code conditions are filled (ie the time code
519 * received by the board is equal to one of those given to it).
521 if (events
& TIME_CODE_EVENT_PENDING
)
522 ; /* so far, nothing to do yet */
524 /* The frequency has changed on the board (UER mode). */
525 if (events
& FREQUENCY_CHANGE_EVENT_PENDING
)
526 vx_change_frequency(chip
);
528 /* update the pcm streams */
529 vx_pcm_update_intr(chip
, events
);
534 * snd_vx_irq_handler - interrupt handler
536 irqreturn_t
snd_vx_irq_handler(int irq
, void *dev
, struct pt_regs
*regs
)
538 struct vx_core
*chip
= dev
;
540 if (! (chip
->chip_status
& VX_STAT_CHIP_INIT
) ||
541 (chip
->chip_status
& VX_STAT_IS_STALE
))
543 if (! vx_test_and_ack(chip
))
544 tasklet_hi_schedule(&chip
->tq
);
551 static void vx_reset_board(struct vx_core
*chip
, int cold_reset
)
553 snd_assert(chip
->ops
->reset_board
, return);
555 /* current source, later sync'ed with target */
556 chip
->audio_source
= VX_AUDIO_SRC_LINE
;
558 chip
->audio_source_target
= chip
->audio_source
;
559 chip
->clock_source
= INTERNAL_QUARTZ
;
560 chip
->clock_mode
= VX_CLOCK_MODE_AUTO
;
562 chip
->uer_detected
= VX_UER_MODE_NOT_PRESENT
;
563 chip
->uer_bits
= SNDRV_PCM_DEFAULT_CON_SPDIF
;
566 chip
->ops
->reset_board(chip
, cold_reset
);
568 vx_reset_codec(chip
, cold_reset
);
570 vx_set_internal_clock(chip
, chip
->freq
);
575 if (vx_is_pcmcia(chip
)) {
576 /* Acknowledge any pending IRQ and reset the MEMIRQ flag. */
577 vx_test_and_ack(chip
);
578 vx_validate_irq(chip
, 1);
582 vx_set_iec958_status(chip
, chip
->uer_bits
);
590 static void vx_proc_read(struct snd_info_entry
*entry
, struct snd_info_buffer
*buffer
)
592 struct vx_core
*chip
= entry
->private_data
;
593 static char *audio_src_vxp
[] = { "Line", "Mic", "Digital" };
594 static char *audio_src_vx2
[] = { "Analog", "Analog", "Digital" };
595 static char *clock_mode
[] = { "Auto", "Internal", "External" };
596 static char *clock_src
[] = { "Internal", "External" };
597 static char *uer_type
[] = { "Consumer", "Professional", "Not Present" };
599 snd_iprintf(buffer
, "%s\n", chip
->card
->longname
);
600 snd_iprintf(buffer
, "Xilinx Firmware: %s\n",
601 chip
->chip_status
& VX_STAT_XILINX_LOADED
? "Loaded" : "No");
602 snd_iprintf(buffer
, "Device Initialized: %s\n",
603 chip
->chip_status
& VX_STAT_DEVICE_INIT
? "Yes" : "No");
604 snd_iprintf(buffer
, "DSP audio info:");
605 if (chip
->audio_info
& VX_AUDIO_INFO_REAL_TIME
)
606 snd_iprintf(buffer
, " realtime");
607 if (chip
->audio_info
& VX_AUDIO_INFO_OFFLINE
)
608 snd_iprintf(buffer
, " offline");
609 if (chip
->audio_info
& VX_AUDIO_INFO_MPEG1
)
610 snd_iprintf(buffer
, " mpeg1");
611 if (chip
->audio_info
& VX_AUDIO_INFO_MPEG2
)
612 snd_iprintf(buffer
, " mpeg2");
613 if (chip
->audio_info
& VX_AUDIO_INFO_LINEAR_8
)
614 snd_iprintf(buffer
, " linear8");
615 if (chip
->audio_info
& VX_AUDIO_INFO_LINEAR_16
)
616 snd_iprintf(buffer
, " linear16");
617 if (chip
->audio_info
& VX_AUDIO_INFO_LINEAR_24
)
618 snd_iprintf(buffer
, " linear24");
619 snd_iprintf(buffer
, "\n");
620 snd_iprintf(buffer
, "Input Source: %s\n", vx_is_pcmcia(chip
) ?
621 audio_src_vxp
[chip
->audio_source
] :
622 audio_src_vx2
[chip
->audio_source
]);
623 snd_iprintf(buffer
, "Clock Mode: %s\n", clock_mode
[chip
->clock_mode
]);
624 snd_iprintf(buffer
, "Clock Source: %s\n", clock_src
[chip
->clock_source
]);
625 snd_iprintf(buffer
, "Frequency: %d\n", chip
->freq
);
626 snd_iprintf(buffer
, "Detected Frequency: %d\n", chip
->freq_detected
);
627 snd_iprintf(buffer
, "Detected UER type: %s\n", uer_type
[chip
->uer_detected
]);
628 snd_iprintf(buffer
, "Min/Max/Cur IBL: %d/%d/%d (granularity=%d)\n",
629 chip
->ibl
.min_size
, chip
->ibl
.max_size
, chip
->ibl
.size
,
630 chip
->ibl
.granularity
);
633 static void vx_proc_init(struct vx_core
*chip
)
635 struct snd_info_entry
*entry
;
637 if (! snd_card_proc_new(chip
->card
, "vx-status", &entry
))
638 snd_info_set_text_ops(entry
, chip
, 1024, vx_proc_read
);
643 * snd_vx_dsp_boot - load the DSP boot
645 int snd_vx_dsp_boot(struct vx_core
*chip
, const struct firmware
*boot
)
648 int cold_reset
= !(chip
->chip_status
& VX_STAT_DEVICE_INIT
);
650 vx_reset_board(chip
, cold_reset
);
651 vx_validate_irq(chip
, 0);
653 if ((err
= snd_vx_load_boot_image(chip
, boot
)) < 0)
661 * snd_vx_dsp_load - load the DSP image
663 int snd_vx_dsp_load(struct vx_core
*chip
, const struct firmware
*dsp
)
667 unsigned int csum
= 0;
668 unsigned char *image
, *cptr
;
670 snd_assert(dsp
->size
% 3 == 0, return -EINVAL
);
672 vx_toggle_dac_mute(chip
, 1);
674 /* Transfert data buffer from PC to DSP */
675 for (i
= 0; i
< dsp
->size
; i
+= 3) {
676 image
= dsp
->data
+ i
;
677 /* Wait DSP ready for a new read */
678 if ((err
= vx_wait_isr_bit(chip
, ISR_TX_EMPTY
)) < 0) {
679 printk("dsp loading error at position %d\n", i
);
684 csum
= (csum
>> 24) | (csum
<< 8);
685 vx_outb(chip
, TXH
, *cptr
++);
687 csum
= (csum
>> 24) | (csum
<< 8);
688 vx_outb(chip
, TXM
, *cptr
++);
690 csum
= (csum
>> 24) | (csum
<< 8);
691 vx_outb(chip
, TXL
, *cptr
++);
693 snd_printdd(KERN_DEBUG
"checksum = 0x%08x\n", csum
);
697 if ((err
= vx_wait_isr_bit(chip
, ISR_CHK
)) < 0)
700 vx_toggle_dac_mute(chip
, 0);
702 vx_test_and_ack(chip
);
703 vx_validate_irq(chip
, 1);
712 int snd_vx_suspend(struct vx_core
*chip
, pm_message_t state
)
716 snd_power_change_state(chip
->card
, SNDRV_CTL_POWER_D3hot
);
717 chip
->chip_status
|= VX_STAT_IN_SUSPEND
;
718 for (i
= 0; i
< chip
->hw
->num_codecs
; i
++)
719 snd_pcm_suspend_all(chip
->pcm
[i
]);
727 int snd_vx_resume(struct vx_core
*chip
)
731 chip
->chip_status
&= ~VX_STAT_CHIP_INIT
;
733 for (i
= 0; i
< 4; i
++) {
734 if (! chip
->firmware
[i
])
736 err
= chip
->ops
->load_dsp(chip
, i
, chip
->firmware
[i
]);
738 snd_printk(KERN_ERR
"vx: firmware resume error at DSP %d\n", i
);
743 chip
->chip_status
|= VX_STAT_CHIP_INIT
;
744 chip
->chip_status
&= ~VX_STAT_IN_SUSPEND
;
746 snd_power_change_state(chip
->card
, SNDRV_CTL_POWER_D0
);
753 * snd_vx_create - constructor for struct vx_core
754 * @hw: hardware specific record
756 * this function allocates the instance and prepare for the hardware
759 * return the instance pointer if successful, NULL in error.
761 struct vx_core
*snd_vx_create(struct snd_card
*card
, struct snd_vx_hardware
*hw
,
762 struct snd_vx_ops
*ops
,
765 struct vx_core
*chip
;
767 snd_assert(card
&& hw
&& ops
, return NULL
);
769 chip
= kzalloc(sizeof(*chip
) + extra_size
, GFP_KERNEL
);
771 snd_printk(KERN_ERR
"vx_core: no memory\n");
774 spin_lock_init(&chip
->lock
);
775 spin_lock_init(&chip
->irq_lock
);
778 chip
->type
= hw
->type
;
780 tasklet_init(&chip
->tq
, vx_interrupt
, (unsigned long)chip
);
781 init_MUTEX(&chip
->mixer_mutex
);
784 card
->private_data
= chip
;
785 strcpy(card
->driver
, hw
->name
);
786 sprintf(card
->shortname
, "Digigram %s", hw
->name
);
796 static int __init
alsa_vx_core_init(void)
801 static void __exit
alsa_vx_core_exit(void)
805 module_init(alsa_vx_core_init
)
806 module_exit(alsa_vx_core_exit
)
811 EXPORT_SYMBOL(snd_vx_check_reg_bit
);
812 EXPORT_SYMBOL(snd_vx_create
);
813 EXPORT_SYMBOL(snd_vx_setup_firmware
);
814 EXPORT_SYMBOL(snd_vx_free_firmware
);
815 EXPORT_SYMBOL(snd_vx_irq_handler
);
816 EXPORT_SYMBOL(snd_vx_dsp_boot
);
817 EXPORT_SYMBOL(snd_vx_dsp_load
);
818 EXPORT_SYMBOL(snd_vx_load_boot_image
);
820 EXPORT_SYMBOL(snd_vx_suspend
);
821 EXPORT_SYMBOL(snd_vx_resume
);