24 #include <linux/module.h>
26 #include <linux/device.h>
30 #include <linux/pci.h>
32 #include <asm/delay.h>
46 #define AUDIO_SRAM_CHANNEL SRAM_CH07
48 #define dprintk(level, fmt, arg...) if (audio_debug >= level) \
49 printk(KERN_INFO "%s: " fmt, chip->dev->name , ## arg)
51 #define dprintk_core(level, fmt, arg...) if (audio_debug >= level) \
52 printk(KERN_DEBUG "%s: " fmt, chip->dev->name , ## arg)
58 static unsigned int disable_analog_audio;
62 static unsigned int audio_debug;
71 #define AUD_INT_DN_RISCI1 (1 << 0)
72 #define AUD_INT_UP_RISCI1 (1 << 1)
73 #define AUD_INT_RDS_DN_RISCI1 (1 << 2)
74 #define AUD_INT_DN_RISCI2 (1 << 4)
75 #define AUD_INT_UP_RISCI2 (1 << 5)
76 #define AUD_INT_RDS_DN_RISCI2 (1 << 6)
77 #define AUD_INT_DN_SYNC (1 << 12)
78 #define AUD_INT_UP_SYNC (1 << 13)
79 #define AUD_INT_RDS_DN_SYNC (1 << 14)
80 #define AUD_INT_OPC_ERR (1 << 16)
81 #define AUD_INT_BER_IRQ (1 << 20)
82 #define AUD_INT_MCHG_IRQ (1 << 21)
83 #define GP_COUNT_CONTROL_RESET 0x3
115 dprintk(1,
"Start audio DMA, %d B/line, %d lines/FIFO, %d periods, %d "
145 dprintk(1,
"Stopping audio DMA\n");
169 if (0 == (status & mask))
183 dprintk(1,
"Downstream sync error\n");
201 dprintk(2,
"Freeing buffer\n");
220 #define DEFAULT_FIFO_SIZE 4096
240 .buffer_bytes_max = (1024*1024),
254 " Can't proceed with open\n");
265 runtime->
hw = snd_cx23885_digital_hw;
269 unsigned int bpl = chip->
dev->
272 runtime->
hw.period_bytes_min = bpl;
273 runtime->
hw.period_bytes_max = bpl;
278 dprintk(1,
"Error opening PCM!\n");
302 if (substream->
runtime->dma_area) {
303 dsp_buffer_free(chip);
307 chip->
period_size = params_period_bytes(hw_params);
346 substream->
runtime->dma_addr = 0;
363 if (substream->
runtime->dma_area) {
364 dsp_buffer_free(chip);
389 spin_lock(&chip->
lock);
393 err = cx23885_start_audio_dma(chip);
396 err = cx23885_stop_audio_dma(chip);
403 spin_unlock(&chip->
lock);
437 .
open = snd_cx23885_pcm_open,
438 .close = snd_cx23885_close,
440 .hw_params = snd_cx23885_hw_params,
441 .hw_free = snd_cx23885_hw_free,
442 .prepare = snd_cx23885_prepare,
443 .trigger = snd_cx23885_card_trigger,
444 .pointer = snd_cx23885_pointer,
445 .page = snd_cx23885_page,
481 if (disable_analog_audio)
486 "for analog TV Audio\n", __func__);
503 err = snd_cx23885_pcm(chip, 0,
"CX23885 Digital");
515 dprintk(0,
"registered ALSA audio device\n");
522 "audio adapter\n", __func__);