24 #include <linux/time.h>
30 #define VORTEX_PCM_TYPE(x) (x->name[40])
115 static unsigned int au8830_channels[3] = {
121 .list = au8830_channels,
126 static void vortex_notify_pcm_vol_change(
struct snd_card *
card,
161 runtime->
hw = snd_vortex_playback_hw_a3d;
165 runtime->
hw = snd_vortex_playback_hw_spdif;
180 runtime->
hw = snd_vortex_playback_hw_adb;
185 runtime->
hw.channels_max = 4;
188 &hw_constraints_au8830_channels);
195 runtime->
hw = snd_vortex_playback_hw_wt;
237 spin_lock_irq(&chip->
lock);
243 vortex_adb_allocroute(chip, stream->
dma,
249 vortex_adb_allocroute(chip, -1,
254 spin_unlock_irq(&chip->
lock);
260 vortex_adbdma_setbuffers(chip, dma,
261 params_period_bytes(hw_params),
265 vortex_notify_pcm_vol_change(chip->
card,
273 vortex_wt_allocroute(chip, substream->
number,
275 stream = substream->
runtime->private_data =
279 vortex_wtdma_setbuffers(chip, substream->
number,
280 params_period_bytes(hw_params),
284 spin_unlock_irq(&chip->
lock);
294 spin_lock_irq(&chip->
lock);
297 if (stream !=
NULL) {
300 vortex_notify_pcm_vol_change(chip->
card,
304 vortex_adb_allocroute(chip, stream->
dma,
313 vortex_wt_allocroute(chip, stream->
dma, 0);
317 spin_unlock_irq(&chip->
lock);
335 fmt = vortex_alsafmt_aspfmt(runtime->
format);
336 spin_lock_irq(&chip->
lock);
338 vortex_adbdma_setmode(chip,
dma, 1,
dir,
fmt,
340 vortex_adbdma_setstartbuffer(chip,
dma, 0);
342 vortex_adb_setsrc(chip,
dma, runtime->
rate,
dir);
346 vortex_wtdma_setmode(chip,
dma, 1,
fmt, 0, 0);
348 vortex_wtdma_setstartbuffer(chip,
dma, 0);
351 spin_unlock_irq(&chip->
lock);
362 spin_lock(&chip->
lock);
369 vortex_adbdma_resetup(chip,
dma);
370 vortex_adbdma_startfifo(chip,
dma);
375 vortex_wtdma_startfifo(chip,
dma);
384 vortex_adbdma_stopfifo(chip,
dma);
388 vortex_wtdma_stopfifo(chip,
dma);
395 vortex_adbdma_pausefifo(chip,
dma);
398 vortex_wtdma_pausefifo(chip,
dma);
404 vortex_adbdma_resumefifo(chip,
dma);
407 vortex_wtdma_resumefifo(chip,
dma);
411 spin_unlock(&chip->
lock);
414 spin_unlock(&chip->
lock);
426 spin_lock(&chip->
lock);
428 current_ptr = vortex_adbdma_getlinearpos(chip,
dma);
431 current_ptr = vortex_wtdma_getlinearpos(chip,
dma);
434 spin_unlock(&chip->
lock);
435 return (bytes_to_frames(substream->
runtime, current_ptr));
439 static struct snd_pcm_ops snd_vortex_playback_ops = {
440 .
open = snd_vortex_pcm_open,
441 .close = snd_vortex_pcm_close,
443 .hw_params = snd_vortex_pcm_hw_params,
444 .hw_free = snd_vortex_pcm_hw_free,
445 .prepare = snd_vortex_pcm_prepare,
446 .trigger = snd_vortex_pcm_trigger,
447 .pointer = snd_vortex_pcm_pointer,
481 ucontrol->
value.iec958.status[0] = 0xff;
482 ucontrol->
value.iec958.status[1] = 0xff;
483 ucontrol->
value.iec958.status[2] = 0xff;
491 ucontrol->
value.iec958.status[0] = 0x00;
493 ucontrol->
value.iec958.status[2] = 0x00;
505 int spdif_sr = 48000;
514 vortex_spdif_init(vortex, vortex->
spdif_sr, 1);
523 .info = snd_vortex_spdif_info,
524 .get = snd_vortex_spdif_get,
525 .put = snd_vortex_spdif_put,
531 .info = snd_vortex_spdif_info,
532 .get = snd_vortex_spdif_mask_get
538 static int snd_vortex_pcm_vol_info(
struct snd_kcontrol *kcontrol,
549 static int snd_vortex_pcm_vol_get(
struct snd_kcontrol *kcontrol,
554 int subdev = kcontrol->
id.subdevice;
557 for (i = 0; i < max_chn; i++)
558 ucontrol->
value.integer.value[i] = p->
vol[i];
562 static int snd_vortex_pcm_vol_put(
struct snd_kcontrol *kcontrol,
570 int subdev = kcontrol->
id.subdevice;
573 for (i = 0; i < max_chn; i++) {
574 if (p->
vol[i] != ucontrol->
value.integer.value[i]) {
583 mixin = p->
mixin[(i < 2) ? i : (i - 2)];
590 vortex_mix_setinputvolumebyte(vortex,
603 .name =
"PCM Playback Volume",
607 .info = snd_vortex_pcm_vol_info,
608 .get = snd_vortex_pcm_vol_get,
609 .put = snd_vortex_pcm_vol_put,
610 .tlv = { .p = vortex_pcm_vol_db_scale },
642 &snd_vortex_playback_ops);
645 &snd_vortex_playback_ops);
654 for (i = 0; i <
ARRAY_SIZE(snd_vortex_mixer_spdif); i++) {
663 for (i = 0; i <
NR_PCM; i++) {
671 kctl->
id.subdevice =
i;