Lines Matching +full:avb +full:- +full:algorithm
1 // SPDX-License-Identifier: GPL-2.0-only
41 * snd_printddd - very verbose debug printk
54 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* index 0-MAX */
291 #define INVALID_FORMAT (__force snd_pcm_format_t)(-1)
310 /* ALSA can't handle 3 byte sample size together with power-of-2
336 return -EINVAL; in snd_card_asihpi_format_alsa2hpi()
350 if (asihpi->support_mrx) { in snd_card_asihpi_pcm_samplerates()
358 err = hpi_mixer_get_control(asihpi->h_mixer, in snd_card_asihpi_pcm_samplerates()
362 dev_err(&asihpi->pci->dev, in snd_card_asihpi_pcm_samplerates()
366 for (idx = -1; idx < 100; idx++) { in snd_card_asihpi_pcm_samplerates()
367 if (idx == -1) { in snd_card_asihpi_pcm_samplerates()
425 pcmhw->rates = rates; in snd_card_asihpi_pcm_samplerates()
426 pcmhw->rate_min = rate_min; in snd_card_asihpi_pcm_samplerates()
427 pcmhw->rate_max = rate_max; in snd_card_asihpi_pcm_samplerates()
433 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_pcm_hw_params()
434 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; in snd_card_asihpi_pcm_hw_params()
446 hpi_handle_error(hpi_format_create(&dpcm->format, in snd_card_asihpi_pcm_hw_params()
450 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { in snd_card_asihpi_pcm_hw_params()
451 if (hpi_instream_reset(dpcm->h_stream) != 0) in snd_card_asihpi_pcm_hw_params()
452 return -EINVAL; in snd_card_asihpi_pcm_hw_params()
455 dpcm->h_stream, &dpcm->format) != 0) in snd_card_asihpi_pcm_hw_params()
456 return -EINVAL; in snd_card_asihpi_pcm_hw_params()
459 dpcm->hpi_buffer_attached = 0; in snd_card_asihpi_pcm_hw_params()
460 if (card->can_dma) { in snd_card_asihpi_pcm_hw_params()
461 err = hpi_stream_host_buffer_attach(dpcm->h_stream, in snd_card_asihpi_pcm_hw_params()
462 params_buffer_bytes(params), runtime->dma_addr); in snd_card_asihpi_pcm_hw_params()
467 (unsigned long)runtime->dma_addr); in snd_card_asihpi_pcm_hw_params()
471 return -ENOMEM; in snd_card_asihpi_pcm_hw_params()
474 err = hpi_stream_get_info_ex(dpcm->h_stream, NULL, in snd_card_asihpi_pcm_hw_params()
475 &dpcm->hpi_buffer_attached, NULL, NULL, NULL); in snd_card_asihpi_pcm_hw_params()
482 return -EINVAL; in snd_card_asihpi_pcm_hw_params()
484 dpcm->bytes_per_sec = bytes_per_sec; in snd_card_asihpi_pcm_hw_params()
485 dpcm->buffer_bytes = params_buffer_bytes(params); in snd_card_asihpi_pcm_hw_params()
486 dpcm->period_bytes = params_period_bytes(params); in snd_card_asihpi_pcm_hw_params()
494 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_hw_free()
495 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; in snd_card_asihpi_hw_free()
496 if (dpcm->hpi_buffer_attached) in snd_card_asihpi_hw_free()
497 hpi_stream_host_buffer_detach(dpcm->h_stream); in snd_card_asihpi_hw_free()
504 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; in snd_card_asihpi_runtime_free()
511 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_pcm_timer_start()
512 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; in snd_card_asihpi_pcm_timer_start()
518 mod_timer(&dpcm->timer, jiffies + expiry); in snd_card_asihpi_pcm_timer_start()
519 dpcm->respawn_timer = 1; in snd_card_asihpi_pcm_timer_start()
524 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_pcm_timer_stop()
525 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; in snd_card_asihpi_pcm_timer_stop()
527 dpcm->respawn_timer = 0; in snd_card_asihpi_pcm_timer_stop()
528 del_timer(&dpcm->timer); in snd_card_asihpi_pcm_timer_stop()
536 dpcm = (struct snd_card_asihpi_pcm *)substream->runtime->private_data; in snd_card_asihpi_pcm_int_start()
540 card->llmode_streampriv = dpcm; in snd_card_asihpi_pcm_int_start()
542 hpi_handle_error(hpi_adapter_set_property(card->hpi->adapter->index, in snd_card_asihpi_pcm_int_start()
544 card->update_interval_frames, 0)); in snd_card_asihpi_pcm_int_start()
553 hpi_handle_error(hpi_adapter_set_property(card->hpi->adapter->index, in snd_card_asihpi_pcm_int_stop()
556 card->llmode_streampriv = NULL; in snd_card_asihpi_pcm_int_stop()
562 struct snd_card_asihpi_pcm *dpcm = substream->runtime->private_data; in snd_card_asihpi_trigger()
574 struct snd_pcm_runtime *runtime = s->runtime; in snd_card_asihpi_trigger()
575 struct snd_card_asihpi_pcm *ds = runtime->private_data; in snd_card_asihpi_trigger()
581 if (substream->stream != s->stream) in snd_card_asihpi_trigger()
584 ds->drained_count = 0; in snd_card_asihpi_trigger()
585 if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_card_asihpi_trigger()
592 unsigned int preload = ds->period_bytes * 1; in snd_card_asihpi_trigger()
593 snd_printddd("%d preload %d\n", s->number, preload); in snd_card_asihpi_trigger()
595 ds->h_stream, in snd_card_asihpi_trigger()
596 &runtime->dma_area[0], in snd_card_asihpi_trigger()
598 &ds->format)); in snd_card_asihpi_trigger()
599 ds->pcm_buf_host_rw_ofs = preload; in snd_card_asihpi_trigger()
602 if (card->support_grouping) { in snd_card_asihpi_trigger()
603 snd_printdd("%d group\n", s->number); in snd_card_asihpi_trigger()
605 dpcm->h_stream, in snd_card_asihpi_trigger()
606 ds->h_stream); in snd_card_asihpi_trigger()
617 card->pcm_start(substream); in snd_card_asihpi_trigger()
618 if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE) || in snd_card_asihpi_trigger()
619 !card->can_dma) in snd_card_asihpi_trigger()
620 hpi_handle_error(hpi_stream_start(dpcm->h_stream)); in snd_card_asihpi_trigger()
625 card->pcm_stop(substream); in snd_card_asihpi_trigger()
630 if (substream->stream != s->stream) in snd_card_asihpi_trigger()
635 s->runtime->status->state = SNDRV_PCM_STATE_SETUP; in snd_card_asihpi_trigger()
637 if (card->support_grouping) { in snd_card_asihpi_trigger()
638 snd_printdd("%d group\n", s->number); in snd_card_asihpi_trigger()
645 hpi_handle_error(hpi_stream_stop(dpcm->h_stream)); in snd_card_asihpi_trigger()
646 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in snd_card_asihpi_trigger()
648 hpi_outstream_reset(dpcm->h_stream)); in snd_card_asihpi_trigger()
650 if (card->support_grouping) in snd_card_asihpi_trigger()
651 hpi_handle_error(hpi_stream_group_reset(dpcm->h_stream)); in snd_card_asihpi_trigger()
656 card->pcm_start(substream); in snd_card_asihpi_trigger()
657 hpi_handle_error(hpi_stream_start(dpcm->h_stream)); in snd_card_asihpi_trigger()
661 card->pcm_stop(substream); in snd_card_asihpi_trigger()
662 hpi_handle_error(hpi_stream_stop(dpcm->h_stream)); in snd_card_asihpi_trigger()
666 return -EINVAL; in snd_card_asihpi_trigger()
672 /*algorithm outline
685 s->pcm_buf_dma_ofs = min_buf_pos;
707 if (((a-b) % modulus) < (modulus/2)) in modulo_min()
720 struct snd_pcm_substream *substream = dpcm->substream; in snd_card_asihpi_timer_function()
738 struct snd_card_asihpi_pcm *ds = s->runtime->private_data; in snd_card_asihpi_timer_function()
739 runtime = s->runtime; in snd_card_asihpi_timer_function()
745 if (substream->stream != s->stream) in snd_card_asihpi_timer_function()
749 ds->h_stream, &state, in snd_card_asihpi_timer_function()
753 /* number of bytes in on-card buffer */ in snd_card_asihpi_timer_function()
754 runtime->delay = on_card_bytes; in snd_card_asihpi_timer_function()
756 if (!card->can_dma) in snd_card_asihpi_timer_function()
759 if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_card_asihpi_timer_function()
760 pcm_buf_dma_ofs = ds->pcm_buf_host_rw_ofs - bytes_avail; in snd_card_asihpi_timer_function()
763 hpi_handle_error(hpi_stream_start(ds->h_stream)); in snd_card_asihpi_timer_function()
764 snd_printdd("P%d start\n", s->number); in snd_card_asihpi_timer_function()
765 ds->drained_count = 0; in snd_card_asihpi_timer_function()
769 s->number); in snd_card_asihpi_timer_function()
770 ds->drained_count++; in snd_card_asihpi_timer_function()
771 if (ds->drained_count > 20) { in snd_card_asihpi_timer_function()
776 ds->drained_count = 0; in snd_card_asihpi_timer_function()
779 pcm_buf_dma_ofs = bytes_avail + ds->pcm_buf_host_rw_ofs; in snd_card_asihpi_timer_function()
784 newdata = (pcm_buf_dma_ofs - ds->pcm_buf_elapsed_dma_ofs) % ds->buffer_bytes; in snd_card_asihpi_timer_function()
790 (pcm_buf_dma_ofs - ds->pcm_buf_elapsed_dma_ofs) % ds->buffer_bytes, in snd_card_asihpi_timer_function()
796 name, s->number, state, in snd_card_asihpi_timer_function()
797 ds->pcm_buf_elapsed_dma_ofs, in snd_card_asihpi_timer_function()
798 ds->pcm_buf_host_rw_ofs, in snd_card_asihpi_timer_function()
803 buffer_size-bytes_avail, in snd_card_asihpi_timer_function()
805 runtime->status->hw_ptr), in snd_card_asihpi_timer_function()
807 runtime->control->appl_ptr) in snd_card_asihpi_timer_function()
813 remdata = newdata % dpcm->period_bytes; in snd_card_asihpi_timer_function()
814 xfercount = newdata - remdata; /* a multiple of period_bytes */ in snd_card_asihpi_timer_function()
819 if (xfercount && (on_card_bytes > dpcm->period_bytes)) in snd_card_asihpi_timer_function()
820 next_jiffies = ((on_card_bytes - dpcm->period_bytes) * HZ / dpcm->bytes_per_sec); in snd_card_asihpi_timer_function()
822 next_jiffies = ((dpcm->period_bytes - remdata) * HZ / dpcm->bytes_per_sec); in snd_card_asihpi_timer_function()
825 dpcm->timer.expires = jiffies + next_jiffies; in snd_card_asihpi_timer_function()
830 struct snd_card_asihpi_pcm *ds = s->runtime->private_data; in snd_card_asihpi_timer_function()
833 if (substream->stream != s->stream) in snd_card_asihpi_timer_function()
837 ds->pcm_buf_dma_ofs = pcm_buf_dma_ofs; in snd_card_asihpi_timer_function()
841 ((on_card_bytes <= ds->period_bytes) || in snd_card_asihpi_timer_function()
842 (s->stream == SNDRV_PCM_STREAM_CAPTURE))) in snd_card_asihpi_timer_function()
846 unsigned int buf_ofs = ds->pcm_buf_host_rw_ofs % ds->buffer_bytes; in snd_card_asihpi_timer_function()
848 char *pd = &s->runtime->dma_area[buf_ofs]; in snd_card_asihpi_timer_function()
850 if (card->can_dma) { /* buffer wrap is handled at lower level */ in snd_card_asihpi_timer_function()
854 xfer1 = min(xfercount, ds->buffer_bytes - buf_ofs); in snd_card_asihpi_timer_function()
855 xfer2 = xfercount - xfer1; in snd_card_asihpi_timer_function()
858 if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_card_asihpi_timer_function()
860 s->number, xfer1, buf_ofs); in snd_card_asihpi_timer_function()
863 ds->h_stream, pd, xfer1, in snd_card_asihpi_timer_function()
864 &ds->format)); in snd_card_asihpi_timer_function()
867 pd = s->runtime->dma_area; in snd_card_asihpi_timer_function()
870 s->number, in snd_card_asihpi_timer_function()
871 xfercount - xfer1, buf_ofs); in snd_card_asihpi_timer_function()
874 ds->h_stream, pd, in snd_card_asihpi_timer_function()
875 xfercount - xfer1, in snd_card_asihpi_timer_function()
876 &ds->format)); in snd_card_asihpi_timer_function()
880 s->number, xfer1); in snd_card_asihpi_timer_function()
883 ds->h_stream, in snd_card_asihpi_timer_function()
886 pd = s->runtime->dma_area; in snd_card_asihpi_timer_function()
888 s->number, xfer2); in snd_card_asihpi_timer_function()
891 ds->h_stream, in snd_card_asihpi_timer_function()
896 ds->pcm_buf_host_rw_ofs += xfercount; in snd_card_asihpi_timer_function()
897 ds->pcm_buf_elapsed_dma_ofs += xfercount; in snd_card_asihpi_timer_function()
902 if (!card->hpi->interrupt_mode && dpcm->respawn_timer) in snd_card_asihpi_timer_function()
903 add_timer(&dpcm->timer); in snd_card_asihpi_timer_function()
910 WARN_ON(!a || !a->snd_card || !a->snd_card->private_data); in snd_card_asihpi_isr()
911 asihpi = (struct snd_card_asihpi *)a->snd_card->private_data; in snd_card_asihpi_isr()
912 if (asihpi->llmode_streampriv) in snd_card_asihpi_isr()
914 &asihpi->llmode_streampriv->timer); in snd_card_asihpi_isr()
921 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_playback_prepare()
922 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; in snd_card_asihpi_playback_prepare()
924 snd_printdd("P%d prepare\n", substream->number); in snd_card_asihpi_playback_prepare()
926 hpi_handle_error(hpi_outstream_reset(dpcm->h_stream)); in snd_card_asihpi_playback_prepare()
927 dpcm->pcm_buf_host_rw_ofs = 0; in snd_card_asihpi_playback_prepare()
928 dpcm->pcm_buf_dma_ofs = 0; in snd_card_asihpi_playback_prepare()
929 dpcm->pcm_buf_elapsed_dma_ofs = 0; in snd_card_asihpi_playback_prepare()
936 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_playback_pointer()
937 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; in snd_card_asihpi_playback_pointer()
942 ptr = bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->buffer_bytes); in snd_card_asihpi_playback_pointer()
960 err = hpi_mixer_get_control(asihpi->h_mixer, in snd_card_asihpi_playback_formats()
970 err = hpi_format_create(&hpi_format, asihpi->out_max_chans, in snd_card_asihpi_playback_formats()
982 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_playback_open()
990 return -ENOMEM; in snd_card_asihpi_playback_open()
992 err = hpi_outstream_open(card->hpi->adapter->index, in snd_card_asihpi_playback_open()
993 substream->number, &dpcm->h_stream); in snd_card_asihpi_playback_open()
998 return -EBUSY; in snd_card_asihpi_playback_open()
1000 return -EIO; in snd_card_asihpi_playback_open()
1007 timer_setup(&dpcm->timer, snd_card_asihpi_timer_function, 0); in snd_card_asihpi_playback_open()
1008 dpcm->substream = substream; in snd_card_asihpi_playback_open()
1009 runtime->private_data = dpcm; in snd_card_asihpi_playback_open()
1010 runtime->private_free = snd_card_asihpi_runtime_free; in snd_card_asihpi_playback_open()
1013 if (!card->hpi->interrupt_mode) { in snd_card_asihpi_playback_open()
1020 size_t pbmin = card->update_interval_frames * in snd_card_asihpi_playback_open()
1021 card->out_max_chans; in snd_card_asihpi_playback_open()
1030 snd_card_asihpi_playback.channels_max = card->out_max_chans; in snd_card_asihpi_playback_open()
1031 snd_card_asihpi_playback.channels_min = card->out_min_chans; in snd_card_asihpi_playback_open()
1033 snd_card_asihpi_playback_formats(card, dpcm->h_stream); in snd_card_asihpi_playback_open()
1045 if (card->support_grouping) { in snd_card_asihpi_playback_open()
1051 runtime->hw = snd_card_asihpi_playback; in snd_card_asihpi_playback_open()
1053 if (card->can_dma) in snd_card_asihpi_playback_open()
1060 card->update_interval_frames); in snd_card_asihpi_playback_open()
1063 card->update_interval_frames, UINT_MAX); in snd_card_asihpi_playback_open()
1072 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_playback_close()
1073 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; in snd_card_asihpi_playback_close()
1075 hpi_handle_error(hpi_outstream_close(dpcm->h_stream)); in snd_card_asihpi_playback_close()
1095 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_capture_pointer()
1096 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; in snd_card_asihpi_capture_pointer()
1100 snd_printddd("%s, pointer=%d\n", name, dpcm->pcm_buf_dma_ofs); in snd_card_asihpi_capture_pointer()
1105 return bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->buffer_bytes); in snd_card_asihpi_capture_pointer()
1110 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_capture_prepare()
1111 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; in snd_card_asihpi_capture_prepare()
1113 hpi_handle_error(hpi_instream_reset(dpcm->h_stream)); in snd_card_asihpi_capture_prepare()
1114 dpcm->pcm_buf_host_rw_ofs = 0; in snd_card_asihpi_capture_prepare()
1115 dpcm->pcm_buf_dma_ofs = 0; in snd_card_asihpi_capture_prepare()
1116 dpcm->pcm_buf_elapsed_dma_ofs = 0; in snd_card_asihpi_capture_prepare()
1118 snd_printdd("Capture Prepare %d\n", substream->number); in snd_card_asihpi_capture_prepare()
1134 err = hpi_mixer_get_control(asihpi->h_mixer, in snd_card_asihpi_capture_formats()
1145 err = hpi_format_create(&hpi_format, asihpi->in_max_chans, in snd_card_asihpi_capture_formats()
1157 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_capture_open()
1165 return -ENOMEM; in snd_card_asihpi_capture_open()
1168 card->hpi->adapter->index, substream->number); in snd_card_asihpi_capture_open()
1171 hpi_instream_open(card->hpi->adapter->index, in snd_card_asihpi_capture_open()
1172 substream->number, &dpcm->h_stream)); in snd_card_asihpi_capture_open()
1176 return -EBUSY; in snd_card_asihpi_capture_open()
1178 return -EIO; in snd_card_asihpi_capture_open()
1180 timer_setup(&dpcm->timer, snd_card_asihpi_timer_function, 0); in snd_card_asihpi_capture_open()
1181 dpcm->substream = substream; in snd_card_asihpi_capture_open()
1182 runtime->private_data = dpcm; in snd_card_asihpi_capture_open()
1183 runtime->private_free = snd_card_asihpi_runtime_free; in snd_card_asihpi_capture_open()
1186 if (!card->hpi->interrupt_mode) { in snd_card_asihpi_capture_open()
1193 size_t pbmin = card->update_interval_frames * in snd_card_asihpi_capture_open()
1194 card->out_max_chans; in snd_card_asihpi_capture_open()
1202 snd_card_asihpi_capture.channels_max = card->in_max_chans; in snd_card_asihpi_capture_open()
1203 snd_card_asihpi_capture.channels_min = card->in_min_chans; in snd_card_asihpi_capture_open()
1205 snd_card_asihpi_capture_formats(card, dpcm->h_stream); in snd_card_asihpi_capture_open()
1211 if (card->support_grouping) in snd_card_asihpi_capture_open()
1214 runtime->hw = snd_card_asihpi_capture; in snd_card_asihpi_capture_open()
1216 if (card->can_dma) in snd_card_asihpi_capture_open()
1223 card->update_interval_frames); in snd_card_asihpi_capture_open()
1225 card->update_interval_frames, UINT_MAX); in snd_card_asihpi_capture_open()
1234 struct snd_card_asihpi_pcm *dpcm = substream->runtime->private_data; in snd_card_asihpi_capture_close()
1236 hpi_handle_error(hpi_instream_close(dpcm->h_stream)); in snd_card_asihpi_capture_close()
1257 err = hpi_adapter_get_info(asihpi->hpi->adapter->index, in snd_card_asihpi_pcm_new()
1261 err = snd_pcm_new(asihpi->card, "Asihpi PCM", device, in snd_card_asihpi_pcm_new()
1272 pcm->private_data = asihpi; in snd_card_asihpi_pcm_new()
1273 pcm->info_flags = 0; in snd_card_asihpi_pcm_new()
1274 strcpy(pcm->name, "Asihpi PCM"); in snd_card_asihpi_pcm_new()
1276 /*? do we want to emulate MMAP for non-BBM cards? in snd_card_asihpi_pcm_new()
1277 Jack doesn't work with ALSAs MMAP emulation - WHY NOT? */ in snd_card_asihpi_pcm_new()
1279 &asihpi->pci->dev, in snd_card_asihpi_pcm_new()
1301 "TV NTSC-M",
1331 "AVB",
1332 "BLU-Link"
1337 (HPI_SOURCENODE_LAST_INDEX-HPI_SOURCENODE_NONE+1)),
1350 "AVB",
1352 "BLU-Link"
1357 (HPI_DESTNODE_LAST_INDEX-HPI_DESTNODE_NONE+1)),
1369 dev_info(&asihpi->pci->dev, "added %s(%d)\n", ctl->name, ctl->index); in ctl_add()
1381 snd_control->name = hpi_ctl->name; in asihpi_ctl_init()
1382 snd_control->private_value = hpi_ctl->h_control; in asihpi_ctl_init()
1383 snd_control->iface = SNDRV_CTL_ELEM_IFACE_MIXER; in asihpi_ctl_init()
1384 snd_control->index = 0; in asihpi_ctl_init()
1386 if (hpi_ctl->src_node_type + HPI_SOURCENODE_NONE == HPI_SOURCENODE_CLOCK_SOURCE) in asihpi_ctl_init()
1388 else if (hpi_ctl->dst_node_type + HPI_DESTNODE_NONE == HPI_DESTNODE_ISTREAM) in asihpi_ctl_init()
1390 else if ((hpi_ctl->src_node_type + HPI_SOURCENODE_NONE != HPI_SOURCENODE_OSTREAM) && in asihpi_ctl_init()
1391 (!hpi_ctl->dst_node_type)) in asihpi_ctl_init()
1393 else if (hpi_ctl->src_node_type && in asihpi_ctl_init()
1394 (hpi_ctl->src_node_type + HPI_SOURCENODE_NONE != HPI_SOURCENODE_OSTREAM) && in asihpi_ctl_init()
1395 (hpi_ctl->dst_node_type)) in asihpi_ctl_init()
1400 if (hpi_ctl->src_node_type && hpi_ctl->dst_node_type) in asihpi_ctl_init()
1401 sprintf(hpi_ctl->name, "%s %d %s %d %s%s", in asihpi_ctl_init()
1402 asihpi_src_names[hpi_ctl->src_node_type], in asihpi_ctl_init()
1403 hpi_ctl->src_node_index, in asihpi_ctl_init()
1404 asihpi_dst_names[hpi_ctl->dst_node_type], in asihpi_ctl_init()
1405 hpi_ctl->dst_node_index, in asihpi_ctl_init()
1407 else if (hpi_ctl->dst_node_type) { in asihpi_ctl_init()
1408 sprintf(hpi_ctl->name, "%s %d %s%s", in asihpi_ctl_init()
1409 asihpi_dst_names[hpi_ctl->dst_node_type], in asihpi_ctl_init()
1410 hpi_ctl->dst_node_index, in asihpi_ctl_init()
1413 sprintf(hpi_ctl->name, "%s %d %s%s", in asihpi_ctl_init()
1414 asihpi_src_names[hpi_ctl->src_node_type], in asihpi_ctl_init()
1415 hpi_ctl->src_node_index, in asihpi_ctl_init()
1418 /* printk(KERN_INFO "Adding %s %d to %d ", hpi_ctl->name, in asihpi_ctl_init()
1419 hpi_ctl->wSrcNodeType, hpi_ctl->wDstNodeType); */ in asihpi_ctl_init()
1422 /*------------------------------------------------------------
1424 ------------------------------------------------------------*/
1429 u32 h_control = kcontrol->private_value; in snd_asihpi_volume_info()
1441 min_gain_mB = -10000; in snd_asihpi_volume_info()
1449 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_asihpi_volume_info()
1450 uinfo->count = count; in snd_asihpi_volume_info()
1451 uinfo->value.integer.min = min_gain_mB / VOL_STEP_mB; in snd_asihpi_volume_info()
1452 uinfo->value.integer.max = max_gain_mB / VOL_STEP_mB; in snd_asihpi_volume_info()
1453 uinfo->value.integer.step = step_gain_mB / VOL_STEP_mB; in snd_asihpi_volume_info()
1460 u32 h_control = kcontrol->private_value; in snd_asihpi_volume_get()
1464 ucontrol->value.integer.value[0] = an_gain_mB[0] / VOL_STEP_mB; in snd_asihpi_volume_get()
1465 ucontrol->value.integer.value[1] = an_gain_mB[1] / VOL_STEP_mB; in snd_asihpi_volume_get()
1473 u32 h_control = kcontrol->private_value; in snd_asihpi_volume_put()
1477 (ucontrol->value.integer.value[0]) * VOL_STEP_mB; in snd_asihpi_volume_put()
1479 (ucontrol->value.integer.value[1]) * VOL_STEP_mB; in snd_asihpi_volume_put()
1480 /* change = asihpi->mixer_volume[addr][0] != left || in snd_asihpi_volume_put()
1481 asihpi->mixer_volume[addr][1] != right; in snd_asihpi_volume_put()
1487 static const DECLARE_TLV_DB_SCALE(db_scale_100, -10000, VOL_STEP_mB, 0);
1494 u32 h_control = kcontrol->private_value; in snd_asihpi_volume_mute_get()
1498 ucontrol->value.integer.value[0] = mute ? 0 : 1; in snd_asihpi_volume_mute_get()
1506 u32 h_control = kcontrol->private_value; in snd_asihpi_volume_mute_put()
1510 int mute = ucontrol->value.integer.value[0] ? 0 : HPI_BITMASK_ALL_CHANNELS; in snd_asihpi_volume_mute_put()
1518 struct snd_card *card = asihpi->card; in snd_asihpi_volume_add()
1535 if (hpi_volume_get_mute(hpi_ctl->h_control, &mute) == 0) { in snd_asihpi_volume_add()
1546 /*------------------------------------------------------------
1548 ------------------------------------------------------------*/
1552 u32 h_control = kcontrol->private_value; in snd_asihpi_level_info()
1563 min_gain_mB = -1000; in snd_asihpi_level_info()
1567 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_asihpi_level_info()
1568 uinfo->count = 2; in snd_asihpi_level_info()
1569 uinfo->value.integer.min = min_gain_mB / HPI_UNITS_PER_dB; in snd_asihpi_level_info()
1570 uinfo->value.integer.max = max_gain_mB / HPI_UNITS_PER_dB; in snd_asihpi_level_info()
1571 uinfo->value.integer.step = step_gain_mB / HPI_UNITS_PER_dB; in snd_asihpi_level_info()
1578 u32 h_control = kcontrol->private_value; in snd_asihpi_level_get()
1582 ucontrol->value.integer.value[0] = in snd_asihpi_level_get()
1584 ucontrol->value.integer.value[1] = in snd_asihpi_level_get()
1594 u32 h_control = kcontrol->private_value; in snd_asihpi_level_put()
1598 (ucontrol->value.integer.value[0]) * HPI_UNITS_PER_dB; in snd_asihpi_level_put()
1600 (ucontrol->value.integer.value[1]) * HPI_UNITS_PER_dB; in snd_asihpi_level_put()
1601 /* change = asihpi->mixer_level[addr][0] != left || in snd_asihpi_level_put()
1602 asihpi->mixer_level[addr][1] != right; in snd_asihpi_level_put()
1609 static const DECLARE_TLV_DB_SCALE(db_scale_level, -1000, 100, 0);
1614 struct snd_card *card = asihpi->card; in snd_asihpi_level_add()
1629 /*------------------------------------------------------------
1631 ------------------------------------------------------------*/
1647 u32 h_control = kcontrol->private_value; in snd_asihpi_aesebu_format_get()
1653 ucontrol->value.enumerated.item[0] = 0; in snd_asihpi_aesebu_format_get()
1658 ucontrol->value.enumerated.item[0] = 1; in snd_asihpi_aesebu_format_get()
1660 ucontrol->value.enumerated.item[0] = 2; in snd_asihpi_aesebu_format_get()
1669 u32 h_control = kcontrol->private_value; in snd_asihpi_aesebu_format_put()
1674 if (ucontrol->value.enumerated.item[0] == 1) in snd_asihpi_aesebu_format_put()
1676 if (ucontrol->value.enumerated.item[0] == 2) in snd_asihpi_aesebu_format_put()
1680 return -EINVAL; in snd_asihpi_aesebu_format_put()
1700 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_asihpi_aesebu_rxstatus_info()
1701 uinfo->count = 1; in snd_asihpi_aesebu_rxstatus_info()
1703 uinfo->value.integer.min = 0; in snd_asihpi_aesebu_rxstatus_info()
1704 uinfo->value.integer.max = 0X1F; in snd_asihpi_aesebu_rxstatus_info()
1705 uinfo->value.integer.step = 1; in snd_asihpi_aesebu_rxstatus_info()
1713 u32 h_control = kcontrol->private_value; in snd_asihpi_aesebu_rxstatus_get()
1718 ucontrol->value.integer.value[0] = status; in snd_asihpi_aesebu_rxstatus_get()
1725 struct snd_card *card = asihpi->card; in snd_asihpi_aesebu_rx_add()
1736 return -EINVAL; in snd_asihpi_aesebu_rx_add()
1763 struct snd_card *card = asihpi->card; in snd_asihpi_aesebu_tx_add()
1775 /*------------------------------------------------------------
1777 ------------------------------------------------------------*/
1784 u32 h_control = kcontrol->private_value; in snd_asihpi_tuner_gain_info()
1796 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_asihpi_tuner_gain_info()
1797 uinfo->count = 1; in snd_asihpi_tuner_gain_info()
1798 uinfo->value.integer.min = ((int)gain_range[0]) / HPI_UNITS_PER_dB; in snd_asihpi_tuner_gain_info()
1799 uinfo->value.integer.max = ((int)gain_range[1]) / HPI_UNITS_PER_dB; in snd_asihpi_tuner_gain_info()
1800 uinfo->value.integer.step = ((int) gain_range[2]) / HPI_UNITS_PER_dB; in snd_asihpi_tuner_gain_info()
1810 u32 h_control = kcontrol->private_value; in snd_asihpi_tuner_gain_get()
1814 ucontrol->value.integer.value[0] = gain / HPI_UNITS_PER_dB; in snd_asihpi_tuner_gain_get()
1825 u32 h_control = kcontrol->private_value; in snd_asihpi_tuner_gain_put()
1828 gain = (ucontrol->value.integer.value[0]) * HPI_UNITS_PER_dB; in snd_asihpi_tuner_gain_put()
1838 u32 h_control = kcontrol->private_value; in asihpi_tuner_band_query()
1850 return -EIO; in asihpi_tuner_band_query()
1873 u32 h_control = kcontrol->private_value; in snd_asihpi_tuner_band_get()
1886 ucontrol->value.enumerated.item[0] = -1; in snd_asihpi_tuner_band_get()
1889 ucontrol->value.enumerated.item[0] = idx; in snd_asihpi_tuner_band_get()
1902 u32 h_control = kcontrol->private_value; in snd_asihpi_tuner_band_put()
1911 idx = ucontrol->value.enumerated.item[0]; in snd_asihpi_tuner_band_put()
1913 idx = ARRAY_SIZE(tuner_bands) - 1; in snd_asihpi_tuner_band_put()
1925 u32 h_control = kcontrol->private_value; in snd_asihpi_tuner_freq_info()
1959 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_asihpi_tuner_freq_info()
1960 uinfo->count = 1; in snd_asihpi_tuner_freq_info()
1961 uinfo->value.integer.min = ((int)freq_range[0]); in snd_asihpi_tuner_freq_info()
1962 uinfo->value.integer.max = ((int)freq_range[1]); in snd_asihpi_tuner_freq_info()
1963 uinfo->value.integer.step = ((int)freq_range[2]); in snd_asihpi_tuner_freq_info()
1970 u32 h_control = kcontrol->private_value; in snd_asihpi_tuner_freq_get()
1974 ucontrol->value.integer.value[0] = freq; in snd_asihpi_tuner_freq_get()
1982 u32 h_control = kcontrol->private_value; in snd_asihpi_tuner_freq_put()
1985 freq = ucontrol->value.integer.value[0]; in snd_asihpi_tuner_freq_put()
1995 struct snd_card *card = asihpi->card; in snd_asihpi_tuner_add()
1998 snd_control.private_value = hpi_ctl->h_control; in snd_asihpi_tuner_add()
2001 if (!hpi_tuner_get_gain(hpi_ctl->h_control, NULL)) { in snd_asihpi_tuner_add()
2008 return -EINVAL; in snd_asihpi_tuner_add()
2017 return -EINVAL; in snd_asihpi_tuner_add()
2027 /*------------------------------------------------------------
2029 ------------------------------------------------------------*/
2033 u32 h_control = kcontrol->private_value; in snd_asihpi_meter_info()
2040 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_asihpi_meter_info()
2041 uinfo->count = count; in snd_asihpi_meter_info()
2042 uinfo->value.integer.min = 0; in snd_asihpi_meter_info()
2043 uinfo->value.integer.max = 0x7FFFFFFF; in snd_asihpi_meter_info()
2055 2147484, /* -60dB */
2057 214748, /* -80 */
2059 21475, /* -100 */
2073 u32 h_control = kcontrol->private_value; in snd_asihpi_meter_get()
2081 ucontrol->value.integer.value[i] = 0; in snd_asihpi_meter_get()
2083 ucontrol->value.integer.value[i] = in snd_asihpi_meter_get()
2086 /* -ve is log value in millibels < -60dB, in snd_asihpi_meter_get()
2089 ucontrol->value.integer.value[i] = in snd_asihpi_meter_get()
2090 log2lin[an_gain_mB[i] / -1000]; in snd_asihpi_meter_get()
2099 struct snd_card *card = asihpi->card; in snd_asihpi_meter_add()
2113 /*------------------------------------------------------------
2115 ------------------------------------------------------------*/
2118 u32 h_control = snd_control->private_value; in snd_card_asihpi_mux_count_sources()
2137 u32 h_control = kcontrol->private_value; in snd_asihpi_mux_info()
2139 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in snd_asihpi_mux_info()
2140 uinfo->count = 1; in snd_asihpi_mux_info()
2141 uinfo->value.enumerated.items = in snd_asihpi_mux_info()
2144 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) in snd_asihpi_mux_info()
2145 uinfo->value.enumerated.item = in snd_asihpi_mux_info()
2146 uinfo->value.enumerated.items - 1; in snd_asihpi_mux_info()
2149 uinfo->value.enumerated.item, in snd_asihpi_mux_info()
2152 sprintf(uinfo->value.enumerated.name, "%s %d", in snd_asihpi_mux_info()
2153 asihpi_src_names[src_node_type - HPI_SOURCENODE_NONE], in snd_asihpi_mux_info()
2161 u32 h_control = kcontrol->private_value; in snd_asihpi_mux_get()
2176 ucontrol->value.enumerated.item[0] = s; in snd_asihpi_mux_get()
2183 ucontrol->value.enumerated.item[0] = 0; in snd_asihpi_mux_get()
2191 u32 h_control = kcontrol->private_value; in snd_asihpi_mux_put()
2198 ucontrol->value.enumerated.item[0], in snd_asihpi_mux_put()
2211 struct snd_card *card = asihpi->card; in snd_asihpi_mux_add()
2224 /*------------------------------------------------------------
2226 ------------------------------------------------------------*/
2237 u32 h_control = kcontrol->private_value; in snd_asihpi_cmode_info()
2254 return -EINVAL; in snd_asihpi_cmode_info()
2262 u32 h_control = kcontrol->private_value; in snd_asihpi_cmode_get()
2268 ucontrol->value.enumerated.item[0] = mode - 1; in snd_asihpi_cmode_get()
2277 u32 h_control = kcontrol->private_value; in snd_asihpi_cmode_put()
2282 ucontrol->value.enumerated.item[0] + 1)); in snd_asihpi_cmode_put()
2290 struct snd_card *card = asihpi->card; in snd_asihpi_cmode_add()
2302 /*------------------------------------------------------------
2304 ------------------------------------------------------------*/
2308 "Prev Module", "BLU-Link",
2321 (struct snd_card_asihpi *)(kcontrol->private_data); in snd_asihpi_clksrc_info()
2322 struct clk_cache *clkcache = &asihpi->cc; in snd_asihpi_clksrc_info()
2323 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in snd_asihpi_clksrc_info()
2324 uinfo->count = 1; in snd_asihpi_clksrc_info()
2325 uinfo->value.enumerated.items = clkcache->count; in snd_asihpi_clksrc_info()
2327 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) in snd_asihpi_clksrc_info()
2328 uinfo->value.enumerated.item = in snd_asihpi_clksrc_info()
2329 uinfo->value.enumerated.items - 1; in snd_asihpi_clksrc_info()
2331 strcpy(uinfo->value.enumerated.name, in snd_asihpi_clksrc_info()
2332 clkcache->s[uinfo->value.enumerated.item].name); in snd_asihpi_clksrc_info()
2340 (struct snd_card_asihpi *)(kcontrol->private_data); in snd_asihpi_clksrc_get()
2341 struct clk_cache *clkcache = &asihpi->cc; in snd_asihpi_clksrc_get()
2342 u32 h_control = kcontrol->private_value; in snd_asihpi_clksrc_get()
2346 ucontrol->value.enumerated.item[0] = 0; in snd_asihpi_clksrc_get()
2354 for (i = 0; i < clkcache->count; i++) in snd_asihpi_clksrc_get()
2355 if ((clkcache->s[i].source == source) && in snd_asihpi_clksrc_get()
2356 (clkcache->s[i].index == srcindex)) in snd_asihpi_clksrc_get()
2359 ucontrol->value.enumerated.item[0] = i; in snd_asihpi_clksrc_get()
2368 (struct snd_card_asihpi *)(kcontrol->private_data); in snd_asihpi_clksrc_put()
2369 struct clk_cache *clkcache = &asihpi->cc; in snd_asihpi_clksrc_put()
2372 u32 h_control = kcontrol->private_value; in snd_asihpi_clksrc_put()
2375 item = ucontrol->value.enumerated.item[0]; in snd_asihpi_clksrc_put()
2376 if (item >= clkcache->count) in snd_asihpi_clksrc_put()
2377 item = clkcache->count-1; in snd_asihpi_clksrc_put()
2380 h_control, clkcache->s[item].source)); in snd_asihpi_clksrc_put()
2382 if (clkcache->s[item].source == HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT) in snd_asihpi_clksrc_put()
2384 h_control, clkcache->s[item].index)); in snd_asihpi_clksrc_put()
2388 /*------------------------------------------------------------
2390 ------------------------------------------------------------*/
2395 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_asihpi_clklocal_info()
2396 uinfo->count = 1; in snd_asihpi_clklocal_info()
2397 uinfo->value.integer.min = 8000; in snd_asihpi_clklocal_info()
2398 uinfo->value.integer.max = 192000; in snd_asihpi_clklocal_info()
2399 uinfo->value.integer.step = 100; in snd_asihpi_clklocal_info()
2407 u32 h_control = kcontrol->private_value; in snd_asihpi_clklocal_get()
2413 ucontrol->value.integer.value[0] = rate; in snd_asihpi_clklocal_get()
2415 ucontrol->value.integer.value[0] = 0; in snd_asihpi_clklocal_get()
2423 u32 h_control = kcontrol->private_value; in snd_asihpi_clklocal_put()
2425 /* change = asihpi->mixer_clkrate[addr][0] != left || in snd_asihpi_clklocal_put()
2426 asihpi->mixer_clkrate[addr][1] != right; in snd_asihpi_clklocal_put()
2430 ucontrol->value.integer.value[0])); in snd_asihpi_clklocal_put()
2437 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_asihpi_clkrate_info()
2438 uinfo->count = 1; in snd_asihpi_clkrate_info()
2439 uinfo->value.integer.min = 8000; in snd_asihpi_clkrate_info()
2440 uinfo->value.integer.max = 192000; in snd_asihpi_clkrate_info()
2441 uinfo->value.integer.step = 100; in snd_asihpi_clkrate_info()
2449 u32 h_control = kcontrol->private_value; in snd_asihpi_clkrate_get()
2455 ucontrol->value.integer.value[0] = rate; in snd_asihpi_clkrate_get()
2457 ucontrol->value.integer.value[0] = 0; in snd_asihpi_clkrate_get()
2468 u32 hSC = hpi_ctl->h_control; in snd_asihpi_sampleclock_add()
2474 return -EINVAL; in snd_asihpi_sampleclock_add()
2475 card = asihpi->card; in snd_asihpi_sampleclock_add()
2476 clkcache = &asihpi->cc; in snd_asihpi_sampleclock_add()
2477 snd_control.private_value = hpi_ctl->h_control; in snd_asihpi_sampleclock_add()
2479 clkcache->has_local = 0; in snd_asihpi_sampleclock_add()
2485 clkcache->s[i].source = source; in snd_asihpi_sampleclock_add()
2486 clkcache->s[i].index = 0; in snd_asihpi_sampleclock_add()
2487 clkcache->s[i].name = sampleclock_sources[source]; in snd_asihpi_sampleclock_add()
2491 clkcache->has_local = 1; in snd_asihpi_sampleclock_add()
2500 clkcache->s[i].source = in snd_asihpi_sampleclock_add()
2502 clkcache->s[i].index = j; in snd_asihpi_sampleclock_add()
2503 clkcache->s[i].name = sampleclock_sources[ in snd_asihpi_sampleclock_add()
2507 clkcache->count = i; in snd_asihpi_sampleclock_add()
2515 return -EINVAL; in snd_asihpi_sampleclock_add()
2518 if (clkcache->has_local) { in snd_asihpi_sampleclock_add()
2527 return -EINVAL; in snd_asihpi_sampleclock_add()
2538 /*------------------------------------------------------------
2540 ------------------------------------------------------------*/
2551 return -EINVAL; in snd_card_asihpi_mixer_new()
2552 card = asihpi->card; in snd_card_asihpi_mixer_new()
2553 strcpy(card->mixername, "Asihpi Mixer"); in snd_card_asihpi_mixer_new()
2556 hpi_mixer_open(asihpi->hpi->adapter->index, in snd_card_asihpi_mixer_new()
2557 &asihpi->h_mixer); in snd_card_asihpi_mixer_new()
2560 return -err; in snd_card_asihpi_mixer_new()
2563 prev_ctl.control_type = -1; in snd_card_asihpi_mixer_new()
2567 asihpi->h_mixer, in snd_card_asihpi_mixer_new()
2578 dev_info(&asihpi->pci->dev, in snd_card_asihpi_mixer_new()
2587 hpi_ctl.src_node_type -= HPI_SOURCENODE_NONE; in snd_card_asihpi_mixer_new()
2588 hpi_ctl.dst_node_type -= HPI_DESTNODE_NONE; in snd_card_asihpi_mixer_new()
2643 dev_info(&asihpi->pci->dev, in snd_card_asihpi_mixer_new()
2659 dev_info(&asihpi->pci->dev, "%d mixer controls found\n", idx); in snd_card_asihpi_mixer_new()
2664 /*------------------------------------------------------------
2666 ------------------------------------------------------------*/
2672 struct snd_card_asihpi *asihpi = entry->private_data; in snd_asihpi_proc_read()
2687 hpi_handle_error(hpi_adapter_get_info(asihpi->hpi->adapter->index, in snd_asihpi_proc_read()
2694 type, asihpi->hpi->adapter->index, in snd_asihpi_proc_read()
2702 err = hpi_mixer_get_control(asihpi->h_mixer, in snd_asihpi_proc_read()
2718 snd_card_ro_proc_new(asihpi->card, "info", asihpi, in snd_asihpi_proc_init()
2722 /*------------------------------------------------------------
2724 ------------------------------------------------------------*/
2731 return -ENODEV; in snd_asihpi_hpi_open()
2740 return -ENODEV; in snd_asihpi_hpi_release()
2749 return -ENODEV; in snd_asihpi_hpi_ioctl()
2754 also /proc/asound/hwdep will contain '#-00: asihpi (HPI) for each card'
2761 err = snd_hwdep_new(asihpi->card, "HPI", device, &hw); in snd_asihpi_hpi_new()
2764 strcpy(hw->name, "asihpi (HPI)"); in snd_asihpi_hpi_new()
2765 hw->iface = SNDRV_HWDEP_IFACE_LAST; in snd_asihpi_hpi_new()
2766 hw->ops.open = snd_asihpi_hpi_open; in snd_asihpi_hpi_new()
2767 hw->ops.ioctl = snd_asihpi_hpi_ioctl; in snd_asihpi_hpi_new()
2768 hw->ops.release = snd_asihpi_hpi_release; in snd_asihpi_hpi_new()
2769 hw->private_data = asihpi; in snd_asihpi_hpi_new()
2773 /*------------------------------------------------------------
2775 ------------------------------------------------------------*/
2790 return -ENODEV; in snd_asihpi_probe()
2792 /* Should this be enable[hpi->index] ? */ in snd_asihpi_probe()
2795 return -ENOENT; in snd_asihpi_probe()
2798 /* Initialise low-level HPI driver */ in snd_asihpi_probe()
2804 adapter_index = hpi->adapter->index; in snd_asihpi_probe()
2806 err = snd_card_new(&pci_dev->dev, adapter_index, id[adapter_index], in snd_asihpi_probe()
2810 err = snd_card_new(&pci_dev->dev, index[dev], id[dev], in snd_asihpi_probe()
2815 dev_warn(&pci_dev->dev, "Adapter index %d->ALSA index %d\n", in snd_asihpi_probe()
2816 adapter_index, card->number); in snd_asihpi_probe()
2819 asihpi = card->private_data; in snd_asihpi_probe()
2820 asihpi->card = card; in snd_asihpi_probe()
2821 asihpi->pci = pci_dev; in snd_asihpi_probe()
2822 asihpi->hpi = hpi; in snd_asihpi_probe()
2823 hpi->snd_card = card; in snd_asihpi_probe()
2827 NULL, &asihpi->support_grouping); in snd_asihpi_probe()
2829 asihpi->support_grouping = 0; in snd_asihpi_probe()
2833 &asihpi->support_mrx, NULL); in snd_asihpi_probe()
2835 asihpi->support_mrx = 0; in snd_asihpi_probe()
2839 NULL, &asihpi->update_interval_frames); in snd_asihpi_probe()
2841 asihpi->update_interval_frames = 512; in snd_asihpi_probe()
2843 if (hpi->interrupt_mode) { in snd_asihpi_probe()
2844 asihpi->pcm_start = snd_card_asihpi_pcm_int_start; in snd_asihpi_probe()
2845 asihpi->pcm_stop = snd_card_asihpi_pcm_int_stop; in snd_asihpi_probe()
2846 hpi->interrupt_callback = snd_card_asihpi_isr; in snd_asihpi_probe()
2848 asihpi->pcm_start = snd_card_asihpi_pcm_timer_start; in snd_asihpi_probe()
2849 asihpi->pcm_stop = snd_card_asihpi_pcm_timer_stop; in snd_asihpi_probe()
2856 asihpi->can_dma = (!err); in snd_asihpi_probe()
2860 if (!asihpi->can_dma) in snd_asihpi_probe()
2861 asihpi->update_interval_frames *= 2; in snd_asihpi_probe()
2865 &asihpi->in_max_chans, &asihpi->out_max_chans); in snd_asihpi_probe()
2867 asihpi->in_max_chans = 2; in snd_asihpi_probe()
2868 asihpi->out_max_chans = 2; in snd_asihpi_probe()
2871 if (asihpi->out_max_chans > 2) { /* assume LL mode */ in snd_asihpi_probe()
2872 asihpi->out_min_chans = asihpi->out_max_chans; in snd_asihpi_probe()
2873 asihpi->in_min_chans = asihpi->in_max_chans; in snd_asihpi_probe()
2874 asihpi->support_grouping = 0; in snd_asihpi_probe()
2876 asihpi->out_min_chans = 1; in snd_asihpi_probe()
2877 asihpi->in_min_chans = 1; in snd_asihpi_probe()
2880 dev_info(&pci_dev->dev, "Has dma:%d, grouping:%d, mrx:%d, uif:%d\n", in snd_asihpi_probe()
2881 asihpi->can_dma, in snd_asihpi_probe()
2882 asihpi->support_grouping, in snd_asihpi_probe()
2883 asihpi->support_mrx, in snd_asihpi_probe()
2884 asihpi->update_interval_frames in snd_asihpi_probe()
2889 dev_err(&pci_dev->dev, "pcm_new failed\n"); in snd_asihpi_probe()
2894 dev_err(&pci_dev->dev, "mixer_new failed\n"); in snd_asihpi_probe()
2898 err = hpi_mixer_get_control(asihpi->h_mixer, in snd_asihpi_probe()
2912 strcpy(card->driver, "ASIHPI"); in snd_asihpi_probe()
2914 sprintf(card->shortname, "AudioScience ASI%4X", in snd_asihpi_probe()
2915 asihpi->hpi->adapter->type); in snd_asihpi_probe()
2916 sprintf(card->longname, "%s %i", in snd_asihpi_probe()
2917 card->shortname, adapter_index); in snd_asihpi_probe()
2926 dev_err(&pci_dev->dev, "snd_asihpi_probe error %d\n", err); in snd_asihpi_probe()
2936 if (hpi->interrupt_mode) { in snd_asihpi_remove()
2937 hpi->interrupt_callback = NULL; in snd_asihpi_remove()
2938 hpi_handle_error(hpi_adapter_set_property(hpi->adapter->index, in snd_asihpi_remove()
2942 snd_card_free(hpi->snd_card); in snd_asihpi_remove()
2943 hpi->snd_card = NULL; in snd_asihpi_remove()