580{
581 struct snd_mixart *chip = snd_pcm_substream_chip(subs);
582 struct mixart_mgr *mgr = chip->mgr;
583 struct mixart_stream *stream = subs->runtime->private_data;
584 snd_pcm_format_t format;
585 int err;
586 int channels;
587
588
589 channels = params_channels(hw);
590
591
592 format = params_format(hw);
593
594 mutex_lock(&mgr->setup_mutex);
595
596
597 if( stream->pcm_number <= MIXART_PCM_DIGITAL ) {
598 int is_aes = stream->pcm_number > MIXART_PCM_ANALOG;
599 if( subs->stream == SNDRV_PCM_STREAM_PLAYBACK )
600 mixart_update_playback_stream_level(chip, is_aes, subs->number);
601 else
602 mixart_update_capture_stream_level( chip, is_aes);
603 }
604
605 stream->channels = channels;
606
607
608 err = mixart_set_format(stream, format);
609 if(err < 0) {
610 return err;
611 }
612
613
614 err = snd_pcm_lib_malloc_pages(subs, params_buffer_bytes(hw));
615
616 if (err > 0) {
617 struct mixart_bufferinfo *bufferinfo;
618 int i = (chip->chip_idx * MIXART_MAX_STREAM_PER_CARD) + (stream->pcm_number * (MIXART_PLAYBACK_STREAMS+MIXART_CAPTURE_STREAMS)) + subs->number;
619 if( subs->stream == SNDRV_PCM_STREAM_CAPTURE ) {
620 i += MIXART_PLAYBACK_STREAMS;