26 #include <linux/pci.h>
58 .period_bytes_min = 64,
59 .period_bytes_max = (64*1024 - 16),
85 .period_bytes_min = 64,
86 .period_bytes_max = (64*1024 - 16),
98 runtime->
hw = snd_cs5535audio_playback;
115 #define CS5535AUDIO_DESC_LIST_SIZE \
116 PAGE_ALIGN(CS5535AUDIO_MAX_DESCRIPTORS * sizeof(struct cs5535audio_dma_desc))
118 static int cs5535audio_build_dma_packets(
struct cs5535audio *cs5535au,
122 unsigned int period_bytes)
125 u32 addr, desc_addr, jmpprd_addr;
147 for (i = 0; i < periods; i++) {
154 addr += period_bytes;
168 dma->
ops->disable_dma(cs5535au);
169 dma->
ops->setup_prd(cs5535au, jmpprd_addr);
170 spin_unlock_irq(&cs5535au->
reg_lock);
174 static void cs5535audio_playback_enable_dma(
struct cs5535audio *cs5535au)
179 static void cs5535audio_playback_disable_dma(
struct cs5535audio *cs5535au)
184 static void cs5535audio_playback_pause_dma(
struct cs5535audio *cs5535au)
189 static void cs5535audio_playback_setup_prd(
struct cs5535audio *cs5535au,
195 static u32 cs5535audio_playback_read_prd(
struct cs5535audio *cs5535au)
200 static u32 cs5535audio_playback_read_dma_pntr(
struct cs5535audio *cs5535au)
205 static void cs5535audio_capture_enable_dma(
struct cs5535audio *cs5535au)
210 static void cs5535audio_capture_disable_dma(
struct cs5535audio *cs5535au)
215 static void cs5535audio_capture_pause_dma(
struct cs5535audio *cs5535au)
220 static void cs5535audio_capture_setup_prd(
struct cs5535audio *cs5535au,
226 static u32 cs5535audio_capture_read_prd(
struct cs5535audio *cs5535au)
231 static u32 cs5535audio_capture_read_dma_pntr(
struct cs5535audio *cs5535au)
236 static void cs5535audio_clear_dma_packets(
struct cs5535audio *cs5535au,
259 err = cs5535audio_build_dma_packets(cs5535au, dma, substream,
261 params_period_bytes(hw_params));
275 snd_ac97_update_power(cs5535au->
ac97,
278 snd_ac97_update_power(cs5535au->
ac97,
282 cs5535audio_clear_dma_packets(cs5535au, dma, substream);
302 dma->
ops->pause_dma(cs5535au);
305 dma->
ops->enable_dma(cs5535au);
308 dma->
ops->enable_dma(cs5535au);
311 dma->
ops->enable_dma(cs5535au);
314 dma->
ops->disable_dma(cs5535au);
317 dma->
ops->disable_dma(cs5535au);
335 dma = substream->
runtime->private_data;
336 curdma = dma->
ops->read_dma_pntr(cs5535au);
348 return bytes_to_frames(substream->
runtime, curdma);
357 runtime->
hw = snd_cs5535audio_capture;
365 olpc_capture_open(cs5535au->
ac97);
372 olpc_capture_close(cs5535au->
ac97);
383 static struct snd_pcm_ops snd_cs5535audio_playback_ops = {
384 .open = snd_cs5535audio_playback_open,
385 .close = snd_cs5535audio_playback_close,
387 .hw_params = snd_cs5535audio_hw_params,
388 .hw_free = snd_cs5535audio_hw_free,
389 .prepare = snd_cs5535audio_playback_prepare,
390 .trigger = snd_cs5535audio_trigger,
391 .pointer = snd_cs5535audio_pcm_pointer,
394 static struct snd_pcm_ops snd_cs5535audio_capture_ops = {
395 .open = snd_cs5535audio_capture_open,
396 .close = snd_cs5535audio_capture_close,
398 .hw_params = snd_cs5535audio_hw_params,
399 .hw_free = snd_cs5535audio_hw_free,
400 .prepare = snd_cs5535audio_capture_prepare,
401 .trigger = snd_cs5535audio_trigger,
402 .pointer = snd_cs5535audio_pcm_pointer,
407 .enable_dma = cs5535audio_playback_enable_dma,
408 .disable_dma = cs5535audio_playback_disable_dma,
409 .setup_prd = cs5535audio_playback_setup_prd,
410 .read_prd = cs5535audio_playback_read_prd,
411 .pause_dma = cs5535audio_playback_pause_dma,
412 .read_dma_pntr = cs5535audio_playback_read_dma_pntr,
417 .enable_dma = cs5535audio_capture_enable_dma,
418 .disable_dma = cs5535audio_capture_disable_dma,
419 .setup_prd = cs5535audio_capture_setup_prd,
420 .read_prd = cs5535audio_capture_read_prd,
421 .pause_dma = cs5535audio_capture_pause_dma,
422 .read_dma_pntr = cs5535audio_capture_read_dma_pntr,
435 &snd_cs5535audio_playback_dma_ops;
437 &snd_cs5535audio_capture_dma_ops;
439 &snd_cs5535audio_playback_ops);
441 &snd_cs5535audio_capture_ops);