2 * Driver for audio on multifunction CS5535 companion device
3 * Copyright (C) Jaya Kumar
5 * Based on Jaroslav Kysela and Takashi Iwai's examples.
6 * This work was sponsored by CIS(M) Sdn Bhd.
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
22 * todo: add be fmt support, spdif, pm
25 #include <linux/init.h>
26 #include <linux/slab.h>
27 #include <linux/pci.h>
28 #include <sound/core.h>
29 #include <sound/control.h>
30 #include <sound/initval.h>
31 #include <sound/asoundef.h>
32 #include <sound/pcm.h>
33 #include <sound/pcm_params.h>
34 #include <sound/ac97_codec.h>
35 #include "cs5535audio.h"
37 static struct snd_pcm_hardware snd_cs5535audio_playback
=
41 SNDRV_PCM_INFO_INTERLEAVED
|
42 SNDRV_PCM_INFO_BLOCK_TRANSFER
|
43 SNDRV_PCM_INFO_MMAP_VALID
|
44 SNDRV_PCM_INFO_PAUSE
|
48 SNDRV_PCM_FMTBIT_S16_LE
51 SNDRV_PCM_RATE_CONTINUOUS
|
52 SNDRV_PCM_RATE_8000_48000
58 .buffer_bytes_max
= (128*1024),
59 .period_bytes_min
= 16,
60 .period_bytes_max
= (64*1024 - 16),
62 .periods_max
= CS5535AUDIO_MAX_DESCRIPTORS
,
66 static struct snd_pcm_hardware snd_cs5535audio_capture
=
70 SNDRV_PCM_INFO_INTERLEAVED
|
71 SNDRV_PCM_INFO_BLOCK_TRANSFER
|
72 SNDRV_PCM_INFO_MMAP_VALID
75 SNDRV_PCM_FMTBIT_S16_LE
78 SNDRV_PCM_RATE_CONTINUOUS
|
79 SNDRV_PCM_RATE_8000_48000
85 .buffer_bytes_max
= (128*1024),
86 .period_bytes_min
= 16384,
87 .period_bytes_max
= (64*1024 - 16),
89 .periods_max
= CS5535AUDIO_MAX_DESCRIPTORS
/ 3,
93 static int snd_cs5535audio_playback_open(struct snd_pcm_substream
*substream
)
96 struct cs5535audio
*cs5535au
= snd_pcm_substream_chip(substream
);
97 struct snd_pcm_runtime
*runtime
= substream
->runtime
;
99 runtime
->hw
= snd_cs5535audio_playback
;
100 runtime
->hw
.rates
= cs5535au
->ac97
->rates
[AC97_RATES_FRONT_DAC
];
101 snd_pcm_limit_hw_rates(runtime
);
102 cs5535au
->playback_substream
= substream
;
103 runtime
->private_data
= &(cs5535au
->dmas
[CS5535AUDIO_DMA_PLAYBACK
]);
104 if ((err
= snd_pcm_hw_constraint_integer(runtime
,
105 SNDRV_PCM_HW_PARAM_PERIODS
)) < 0)
111 static int snd_cs5535audio_playback_close(struct snd_pcm_substream
*substream
)
116 #define CS5535AUDIO_DESC_LIST_SIZE \
117 PAGE_ALIGN(CS5535AUDIO_MAX_DESCRIPTORS * sizeof(struct cs5535audio_dma_desc))
119 static int cs5535audio_build_dma_packets(struct cs5535audio
*cs5535au
,
120 struct cs5535audio_dma
*dma
,
121 struct snd_pcm_substream
*substream
,
122 unsigned int periods
,
123 unsigned int period_bytes
,
124 unsigned int dma_channels
,
125 unsigned short dma_stereo
)
127 unsigned int i
, j
, descr
, stereo
, period_bytes_channel
;
128 u32 addr
, desc_addr
, jmpprd_addr
[4];
129 struct cs5535audio_dma_desc
*lastdesc
;
132 if (periods
> CS5535AUDIO_MAX_DESCRIPTORS
/ 3)
136 printk(KERN_INFO
"cs5535audio_build_dma_packets: %u periods, %u period_bytes\n",
137 periods
, period_bytes
);
138 printk(KERN_INFO
"cs5535audio_build_dma_packets: addr = %x (%u)\n",
139 (u32
)substream
->runtime
->dma_addr
, (u32
)substream
->runtime
->dma_bytes
);
140 printk(KERN_INFO
"cs5535audio_build_dma_packets: runtime channels = %u\n",
141 substream
->runtime
->channels
);
142 printk(KERN_INFO
"cs5535audio_build_dma_packets: runtime frame bits = %u\n",
143 substream
->runtime
->frame_bits
);
144 printk(KERN_INFO
"cs5535audio_build_dma_packets: runtime sample bits = %u\n",
145 substream
->runtime
->sample_bits
);
146 printk(KERN_INFO
"cs5535audio_build_dma_packets: runtime format = %u\n",
147 (unsigned)substream
->runtime
->format
);
148 printk(KERN_INFO
"cs5535audio_build_dma_packets: dma channels = %u\n",
152 if (dma
->desc_buf
.area
== NULL
) {
153 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV
,
154 snd_dma_pci_data(cs5535au
->pci
),
155 CS5535AUDIO_DESC_LIST_SIZE
+1,
158 dma
->period_bytes
= dma
->periods
= 0;
161 if (dma
->periods
== periods
&& dma
->period_bytes
== period_bytes
)
164 dma
->dma_stereo
= dma_stereo
;
165 /* the u32 cast is okay because in snd*create we successfully told
166 pci alloc that we're only 32 bit capable so the uppper will be 0 */
167 addr
= (u32
) substream
->runtime
->dma_addr
;
168 desc_addr
= (u32
) dma
->desc_buf
.addr
;
170 dma_area
= substream
->runtime
->dma_area
;
171 for (j
= 0; j
< dma_channels
; j
++) {
172 stereo
= dma_stereo
& 1;
174 dma
->dma_start
[j
] = dma_area
;
175 jmpprd_addr
[j
] = cpu_to_le32(desc_addr
);
176 if (dma_channels
> 1)
177 period_bytes_channel
= stereo
? (period_bytes
/ 2) : (period_bytes
/ 4);
179 period_bytes_channel
= period_bytes
;
181 printk(KERN_INFO
"cs5535audio_build_dma_packets: dma channel %u (stereo: %u) at %x, size %u\n",
182 j
, stereo
, jmpprd_addr
[j
], period_bytes_channel
);
184 for (i
= 0; i
< periods
; i
++) {
185 struct cs5535audio_dma_desc
*desc
=
186 &((struct cs5535audio_dma_desc
*) dma
->desc_buf
.area
)[descr
++];
187 desc
->addr
= cpu_to_le32(addr
);
188 desc
->size
= cpu_to_le32(period_bytes_channel
);
189 desc
->ctlreserved
= cpu_to_le32(PRD_EOP
);
191 printk(KERN_INFO
"cs5535audio_build_dma_packets: building descriptor %d at %x -> %x (%x)\n",
192 descr
-1, desc_addr
, addr
, (unsigned)dma_area
);
194 desc_addr
+= sizeof(struct cs5535audio_dma_desc
);
195 addr
+= period_bytes_channel
;
196 dma_area
+= period_bytes_channel
;
198 /* we reserved one dummy descriptor at the end to do the PRD jump */
199 lastdesc
= &((struct cs5535audio_dma_desc
*) dma
->desc_buf
.area
)[descr
++];
200 lastdesc
->addr
= jmpprd_addr
[j
];
202 lastdesc
->ctlreserved
= cpu_to_le32(PRD_JMP
);
203 desc_addr
+= sizeof(struct cs5535audio_dma_desc
);
206 dma
->substream
= substream
;
207 dma
->period_bytes
= period_bytes
;
208 dma
->periods
= periods
;
209 spin_lock_irq(&cs5535au
->reg_lock
);
210 dma
->ops
->disable_dma(cs5535au
);
211 dma
->ops
->setup_prd(cs5535au
, jmpprd_addr
);
212 spin_unlock_irq(&cs5535au
->reg_lock
);
216 static void cs5535audio_playback_enable_dma(struct cs5535audio
*cs5535au
)
218 cs_writeb(cs5535au
, ACC_BM0_CMD
, BM_CTL_EN
);
221 static void cs5535audio_playback_disable_dma(struct cs5535audio
*cs5535au
)
223 cs_writeb(cs5535au
, ACC_BM0_CMD
, 0);
226 static void cs5535audio_playback_pause_dma(struct cs5535audio
*cs5535au
)
228 cs_writeb(cs5535au
, ACC_BM0_CMD
, BM_CTL_PAUSE
);
231 static void cs5535audio_playback_setup_prd(struct cs5535audio
*cs5535au
,
234 cs_writel(cs5535au
, ACC_BM0_PRD
, prd_addr
[0]);
237 static u32
cs5535audio_playback_read_prd(struct cs5535audio
*cs5535au
)
239 return cs_readl(cs5535au
, ACC_BM0_PRD
);
242 static u32
cs5535audio_playback_read_dma_pntr(struct cs5535audio
*cs5535au
)
244 return cs_readl(cs5535au
, ACC_BM0_PNTR
);
247 static void cs5535audio_capture_enable_dma(struct cs5535audio
*cs5535au
)
249 cs_writeb(cs5535au
, ACC_BM1_CMD
, BM_CTL_EN
);
250 cs_writeb(cs5535au
, ACC_BM3_CMD
, BM_CTL_EN
);
251 cs_writeb(cs5535au
, ACC_BM5_CMD
, BM_CTL_EN
);
254 static void cs5535audio_capture_disable_dma(struct cs5535audio
*cs5535au
)
256 cs_writeb(cs5535au
, ACC_BM1_CMD
, 0);
257 cs_writeb(cs5535au
, ACC_BM3_CMD
, 0);
258 cs_writeb(cs5535au
, ACC_BM5_CMD
, 0);
261 static void cs5535audio_capture_pause_dma(struct cs5535audio
*cs5535au
)
263 cs_writeb(cs5535au
, ACC_BM1_CMD
, BM_CTL_PAUSE
);
264 cs_writeb(cs5535au
, ACC_BM3_CMD
, BM_CTL_PAUSE
);
265 cs_writeb(cs5535au
, ACC_BM5_CMD
, BM_CTL_PAUSE
);
268 static void cs5535audio_capture_setup_prd(struct cs5535audio
*cs5535au
,
271 cs_writel(cs5535au
, ACC_BM1_PRD
, prd_addr
[0]);
272 cs_writel(cs5535au
, ACC_BM3_PRD
, prd_addr
[1]);
273 cs_writel(cs5535au
, ACC_BM5_PRD
, prd_addr
[2]);
276 static u32
cs5535audio_capture_read_prd(struct cs5535audio
*cs5535au
)
278 return cs_readl(cs5535au
, ACC_BM1_PRD
);
281 static u32
cs5535audio_capture_read_dma_pntr(struct cs5535audio
*cs5535au
)
283 u32 pntr
= cs_readl(cs5535au
, ACC_BM1_PNTR
);
287 static void cs5535audio_clear_dma_packets(struct cs5535audio
*cs5535au
,
288 struct cs5535audio_dma
*dma
,
289 struct snd_pcm_substream
*substream
)
291 snd_dma_free_pages(&dma
->desc_buf
);
292 dma
->desc_buf
.area
= NULL
;
293 dma
->substream
= NULL
;
296 static int snd_cs5535audio_hw_params(struct snd_pcm_substream
*substream
,
297 struct snd_pcm_hw_params
*hw_params
)
299 struct cs5535audio
*cs5535au
= snd_pcm_substream_chip(substream
);
300 struct cs5535audio_dma
*dma
= substream
->runtime
->private_data
;
303 err
= snd_pcm_lib_malloc_pages(substream
,
304 params_buffer_bytes(hw_params
));
307 dma
->buf_addr
= substream
->runtime
->dma_addr
;
308 dma
->buf_bytes
= params_buffer_bytes(hw_params
);
310 err
= cs5535audio_build_dma_packets(cs5535au
, dma
, substream
,
311 params_periods(hw_params
),
312 params_period_bytes(hw_params
), 1, 1);
314 dma
->pcm_open_flag
= 1;
318 static int snd_cs5535audio_hw_params_muldma(struct snd_pcm_substream
*substream
,
319 struct snd_pcm_hw_params
*hw_params
)
321 struct cs5535audio
*cs5535au
= snd_pcm_substream_chip(substream
);
322 struct cs5535audio_dma
*dma
= substream
->runtime
->private_data
;
325 err
= snd_pcm_lib_malloc_pages(substream
,
326 params_buffer_bytes(hw_params
)*4);
329 dma
->buf_addr
= substream
->runtime
->dma_addr
;
330 dma
->buf_bytes
= params_buffer_bytes(hw_params
) * 4;
332 err
= cs5535audio_build_dma_packets(cs5535au
, dma
, substream
,
333 params_periods(hw_params
),
334 params_period_bytes(hw_params
), 3, 1);
338 static int snd_cs5535audio_hw_free(struct snd_pcm_substream
*substream
)
340 struct cs5535audio
*cs5535au
= snd_pcm_substream_chip(substream
);
341 struct cs5535audio_dma
*dma
= substream
->runtime
->private_data
;
343 if (dma
->pcm_open_flag
) {
344 if (substream
== cs5535au
->playback_substream
)
345 snd_ac97_update_power(cs5535au
->ac97
,
346 AC97_PCM_FRONT_DAC_RATE
, 0);
348 snd_ac97_update_power(cs5535au
->ac97
,
349 AC97_PCM_LR_ADC_RATE
, 0);
350 dma
->pcm_open_flag
= 0;
352 cs5535audio_clear_dma_packets(cs5535au
, dma
, substream
);
353 return snd_pcm_lib_free_pages(substream
);
356 static int snd_cs5535audio_hw_free_muldma(struct snd_pcm_substream
*substream
)
358 struct cs5535audio
*cs5535au
= snd_pcm_substream_chip(substream
);
359 struct cs5535audio_dma
*dma
= substream
->runtime
->private_data
;
361 cs5535audio_clear_dma_packets(cs5535au
, dma
, substream
);
362 return snd_pcm_lib_free_pages(substream
);
365 static int snd_cs5535audio_playback_prepare(struct snd_pcm_substream
*substream
)
367 struct cs5535audio
*cs5535au
= snd_pcm_substream_chip(substream
);
368 return snd_ac97_set_rate(cs5535au
->ac97
, AC97_PCM_FRONT_DAC_RATE
,
369 substream
->runtime
->rate
);
372 static int snd_cs5535audio_trigger(struct snd_pcm_substream
*substream
, int cmd
)
374 struct cs5535audio
*cs5535au
= snd_pcm_substream_chip(substream
);
375 struct cs5535audio_dma
*dma
= substream
->runtime
->private_data
;
378 spin_lock(&cs5535au
->reg_lock
);
380 case SNDRV_PCM_TRIGGER_PAUSE_PUSH
:
381 dma
->ops
->pause_dma(cs5535au
);
383 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE
:
384 dma
->ops
->enable_dma(cs5535au
);
386 case SNDRV_PCM_TRIGGER_START
:
387 dma
->ops
->enable_dma(cs5535au
);
389 case SNDRV_PCM_TRIGGER_RESUME
:
390 dma
->ops
->enable_dma(cs5535au
);
392 case SNDRV_PCM_TRIGGER_STOP
:
393 dma
->ops
->disable_dma(cs5535au
);
395 case SNDRV_PCM_TRIGGER_SUSPEND
:
396 dma
->ops
->disable_dma(cs5535au
);
399 snd_printk(KERN_ERR
"unhandled trigger\n");
403 spin_unlock(&cs5535au
->reg_lock
);
407 static snd_pcm_uframes_t
snd_cs5535audio_playback_pcm_pointer(struct snd_pcm_substream
410 struct cs5535audio
*cs5535au
= snd_pcm_substream_chip(substream
);
412 struct cs5535audio_dma
*dma
;
414 dma
= substream
->runtime
->private_data
;
415 curdma
= dma
->ops
->read_dma_pntr(cs5535au
);
416 if (curdma
< dma
->buf_addr
) {
417 snd_printk(KERN_ERR
"curdma=%x < %x bufaddr.\n",
418 curdma
, dma
->buf_addr
);
421 curdma
-= dma
->buf_addr
;
422 if (curdma
>= dma
->buf_bytes
) {
423 snd_printk(KERN_ERR
"diff=%x >= %x buf_bytes.\n",
424 curdma
, dma
->buf_bytes
);
427 return bytes_to_frames(substream
->runtime
, curdma
);
431 static snd_pcm_uframes_t
snd_cs5535audio_capture_pcm_pointer(struct snd_pcm_substream
434 struct cs5535audio
*cs5535au
= snd_pcm_substream_chip(substream
);
436 struct cs5535audio_dma
*dma
;
438 dma
= substream
->runtime
->private_data
;
439 curdma
= dma
->ops
->read_dma_pntr(cs5535au
);
440 if (curdma
< dma
->buf_addr
) {
441 snd_printk(KERN_ERR
"curdma=%x < %x bufaddr.\n",
442 curdma
, dma
->buf_addr
);
446 printk(KERN_INFO
"snd_cs5535audio_pcm_pointer: %x (%u)\n", curdma
, curdma
- dma
->buf_addr
);
448 curdma
-= dma
->buf_addr
;
449 if (curdma
>= dma
->buf_bytes
) {
450 snd_printk(KERN_ERR
"diff=%x >= %x buf_bytes.\n",
451 curdma
, dma
->buf_bytes
);
455 printk(KERN_INFO
"snd_cs5535audio_pcm_pointer: bytes_to_frames: %u (x2 = %u)\n",
456 (unsigned)bytes_to_frames(substream
->runtime
, curdma
),
457 (unsigned)bytes_to_frames(substream
->runtime
, curdma
) * 2);
459 return bytes_to_frames(substream
->runtime
, curdma
) * 2;
462 static int snd_cs5535audio_capture_open(struct snd_pcm_substream
*substream
)
465 struct cs5535audio
*cs5535au
= snd_pcm_substream_chip(substream
);
466 struct snd_pcm_runtime
*runtime
= substream
->runtime
;
469 printk(KERN_INFO
"snd_cs5535audio_capture_open\n");
471 runtime
->hw
= snd_cs5535audio_capture
;
472 runtime
->hw
.rates
= cs5535au
->ac97
->rates
[AC97_RATES_ADC
];
473 snd_pcm_limit_hw_rates(runtime
);
474 cs5535au
->capture_substream
= substream
;
475 runtime
->private_data
= &(cs5535au
->dmas
[CS5535AUDIO_DMA_CAPTURE
]);
476 if ((err
= snd_pcm_hw_constraint_integer(runtime
,
477 SNDRV_PCM_HW_PARAM_PERIODS
)) < 0)
479 olpc_capture_open(cs5535au
->ac97
);
483 static int snd_cs5535audio_capture_close(struct snd_pcm_substream
*substream
)
485 struct cs5535audio
*cs5535au
= snd_pcm_substream_chip(substream
);
486 olpc_capture_close(cs5535au
->ac97
);
490 static int snd_cs5535audio_capture_prepare(struct snd_pcm_substream
*substream
)
492 struct cs5535audio
*cs5535au
= snd_pcm_substream_chip(substream
);
493 return snd_ac97_set_rate(cs5535au
->ac97
, AC97_PCM_LR_ADC_RATE
,
494 substream
->runtime
->rate
);
497 static int snd_cs5535audio_capture_copy(struct snd_pcm_substream
*substream
,
498 int channel
, snd_pcm_uframes_t hwoff
,
499 void __user
*ubuf
, snd_pcm_uframes_t frames
)
501 struct snd_pcm_runtime
*runtime
= substream
->runtime
;
502 struct cs5535audio_dma
*dma
= (struct cs5535audio_dma
*)runtime
->private_data
;
503 char *buffer
= ((struct cs5535audio
*)substream
->pcm
->card
->private_data
)->
504 channel_rebuild_buffer
;
506 int i
, j
, frame_offset
, frame_size
;
508 //CG: dont know what to do? do this really fail? lol
509 /* snd_assert(runtime->dma_area, return -EFAULT); */
510 /* snd_assert(channel == -1, return -EFAULT); */
513 printk(KERN_INFO
"snd_cs5535audio_capture_copy: channel %d, frames %u, hwoff: %u\n",
514 channel
, (unsigned)frames
, (unsigned)hwoff
);
515 printk(KERN_INFO
"snd_cs5535audio_capture_copy: frame size is %u, will copy %u bytes\n",
516 (unsigned)frames_to_bytes(runtime
, 1), (unsigned)frames_to_bytes(runtime
, frames
));
519 if (frames
* 8 > 64*1024 - 16) {
520 printk(KERN_ERR
"channel_rebuild_buffer overrun (%u > %u)\n",
521 (unsigned)(frames
* 8), (unsigned)(64*1024 - 16));
525 memset(buffer
, 0, frames_to_bytes(runtime
, frames
));
528 for (j
= 0; j
< 3; j
++) {
529 if (dma
->dma_stereo
>> j
)
533 hwbuf
= (char*)(dma
->dma_start
[j
] + hwoff
* frame_size
);
535 printk(KERN_INFO
"snd_cs5535audio_capture_copy: copying dma channel %d (%d:%d) from %x\n",
536 j
, frame_size
, frame_offset
, (unsigned)hwbuf
);
538 for (i
= 0; i
< frames
; i
++) {
539 memcpy(buffer
+ frame_offset
+ i
*8, hwbuf
+ i
*frame_size
, frame_size
);
541 frame_offset
+= frame_size
;
544 if (copy_to_user(ubuf
, buffer
, frames_to_bytes(runtime
, frames
)))
550 static struct snd_pcm_ops snd_cs5535audio_playback_ops
= {
551 .open
= snd_cs5535audio_playback_open
,
552 .close
= snd_cs5535audio_playback_close
,
553 .ioctl
= snd_pcm_lib_ioctl
,
554 .hw_params
= snd_cs5535audio_hw_params
,
555 .hw_free
= snd_cs5535audio_hw_free
,
556 .prepare
= snd_cs5535audio_playback_prepare
,
557 .trigger
= snd_cs5535audio_trigger
,
558 .pointer
= snd_cs5535audio_playback_pcm_pointer
,
561 static struct snd_pcm_ops snd_cs5535audio_capture_ops
= {
562 .open
= snd_cs5535audio_capture_open
,
563 .close
= snd_cs5535audio_capture_close
,
564 .ioctl
= snd_pcm_lib_ioctl
,
565 .hw_params
= snd_cs5535audio_hw_params_muldma
,
566 .hw_free
= snd_cs5535audio_hw_free_muldma
,
567 .prepare
= snd_cs5535audio_capture_prepare
,
568 .trigger
= snd_cs5535audio_trigger
,
569 .pointer
= snd_cs5535audio_capture_pcm_pointer
,
570 .copy
= snd_cs5535audio_capture_copy
,
573 static struct cs5535audio_dma_ops snd_cs5535audio_playback_dma_ops
= {
574 .type
= CS5535AUDIO_DMA_PLAYBACK
,
575 .enable_dma
= cs5535audio_playback_enable_dma
,
576 .disable_dma
= cs5535audio_playback_disable_dma
,
577 .setup_prd
= cs5535audio_playback_setup_prd
,
578 .read_prd
= cs5535audio_playback_read_prd
,
579 .pause_dma
= cs5535audio_playback_pause_dma
,
580 .read_dma_pntr
= cs5535audio_playback_read_dma_pntr
,
583 static struct cs5535audio_dma_ops snd_cs5535audio_capture_dma_ops
= {
584 .type
= CS5535AUDIO_DMA_CAPTURE
,
585 .enable_dma
= cs5535audio_capture_enable_dma
,
586 .disable_dma
= cs5535audio_capture_disable_dma
,
587 .setup_prd
= cs5535audio_capture_setup_prd
,
588 .read_prd
= cs5535audio_capture_read_prd
,
589 .pause_dma
= cs5535audio_capture_pause_dma
,
590 .read_dma_pntr
= cs5535audio_capture_read_dma_pntr
,
593 int __devinit
snd_cs5535audio_pcm(struct cs5535audio
*cs5535au
)
598 err
= snd_pcm_new(cs5535au
->card
, "CS5535 Audio", 0, 1, 1, &pcm
);
602 cs5535au
->dmas
[CS5535AUDIO_DMA_PLAYBACK
].ops
=
603 &snd_cs5535audio_playback_dma_ops
;
604 cs5535au
->dmas
[CS5535AUDIO_DMA_CAPTURE
].ops
=
605 &snd_cs5535audio_capture_dma_ops
;
606 snd_pcm_set_ops(pcm
, SNDRV_PCM_STREAM_PLAYBACK
,
607 &snd_cs5535audio_playback_ops
);
608 snd_pcm_set_ops(pcm
, SNDRV_PCM_STREAM_CAPTURE
,
609 &snd_cs5535audio_capture_ops
);
611 pcm
->private_data
= cs5535au
;
613 strcpy(pcm
->name
, "CS5535 Audio");
615 snd_pcm_lib_preallocate_pages_for_all(pcm
, SNDRV_DMA_TYPE_DEV
,
616 snd_dma_pci_data(cs5535au
->pci
),