Lines Matching +full:asi +full:- +full:format

1 // SPDX-License-Identifier: GPL-2.0-only
41 * snd_printddd - very verbose debug printk
42 * @format: format string
48 #define snd_printddd(format, args...) \ argument
49 __snd_printk(3, __FILE__, __LINE__, format, ##args)
51 #define snd_printddd(format, args...) do { } while (0) argument
54 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* index 0-MAX */
150 struct hpi_format format; member
279 snd_printdd(" samplerate=%dHz channels=%d format=%d subformat=%d\n", in print_hwparams()
291 #define INVALID_FORMAT (__force snd_pcm_format_t)(-1)
310 /* ALSA can't handle 3 byte sample size together with power-of-2
311 * constraint on buffer_bytes, so disable this format
323 u16 format; in snd_card_asihpi_format_alsa2hpi() local
325 for (format = HPI_FORMAT_PCM8_UNSIGNED; in snd_card_asihpi_format_alsa2hpi()
326 format <= HPI_FORMAT_PCM24_SIGNED; format++) { in snd_card_asihpi_format_alsa2hpi()
327 if (hpi_to_alsa_formats[format] == alsa_format) { in snd_card_asihpi_format_alsa2hpi()
328 *hpi_format = format; in snd_card_asihpi_format_alsa2hpi()
333 snd_printd(KERN_WARNING "failed match for alsa format %d\n", in snd_card_asihpi_format_alsa2hpi()
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()
437 u16 format; in snd_card_asihpi_pcm_hw_params() local
442 err = snd_card_asihpi_format_alsa2hpi(params_format(params), &format); in snd_card_asihpi_pcm_hw_params()
446 hpi_handle_error(hpi_format_create(&dpcm->format, in snd_card_asihpi_pcm_hw_params()
448 format, params_rate(params), 0, 0)); 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 __snd_pcm_set_state(s->runtime, 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()
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()
737 struct snd_card_asihpi_pcm *ds = s->runtime->private_data; in snd_card_asihpi_timer_function()
738 runtime = s->runtime; in snd_card_asihpi_timer_function()
744 if (substream->stream != s->stream) in snd_card_asihpi_timer_function()
748 ds->h_stream, &state, in snd_card_asihpi_timer_function()
752 /* number of bytes in on-card buffer */ in snd_card_asihpi_timer_function()
753 runtime->delay = on_card_bytes; in snd_card_asihpi_timer_function()
755 if (!card->can_dma) in snd_card_asihpi_timer_function()
758 if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_card_asihpi_timer_function()
759 pcm_buf_dma_ofs = ds->pcm_buf_host_rw_ofs - bytes_avail; in snd_card_asihpi_timer_function()
762 hpi_handle_error(hpi_stream_start(ds->h_stream)); in snd_card_asihpi_timer_function()
763 snd_printdd("P%d start\n", s->number); in snd_card_asihpi_timer_function()
764 ds->drained_count = 0; in snd_card_asihpi_timer_function()
768 s->number); in snd_card_asihpi_timer_function()
769 ds->drained_count++; in snd_card_asihpi_timer_function()
770 if (ds->drained_count > 20) { in snd_card_asihpi_timer_function()
775 ds->drained_count = 0; in snd_card_asihpi_timer_function()
778 pcm_buf_dma_ofs = bytes_avail + ds->pcm_buf_host_rw_ofs; in snd_card_asihpi_timer_function()
783 newdata = (pcm_buf_dma_ofs - ds->pcm_buf_elapsed_dma_ofs) % ds->buffer_bytes; in snd_card_asihpi_timer_function()
789 (pcm_buf_dma_ofs - ds->pcm_buf_elapsed_dma_ofs) % ds->buffer_bytes, in snd_card_asihpi_timer_function()
795 name, s->number, state, in snd_card_asihpi_timer_function()
796 ds->pcm_buf_elapsed_dma_ofs, in snd_card_asihpi_timer_function()
797 ds->pcm_buf_host_rw_ofs, in snd_card_asihpi_timer_function()
802 buffer_size-bytes_avail, in snd_card_asihpi_timer_function()
804 runtime->status->hw_ptr), in snd_card_asihpi_timer_function()
806 runtime->control->appl_ptr) in snd_card_asihpi_timer_function()
811 remdata = newdata % dpcm->period_bytes; in snd_card_asihpi_timer_function()
812 xfercount = newdata - remdata; /* a multiple of period_bytes */ in snd_card_asihpi_timer_function()
817 if (xfercount && (on_card_bytes > dpcm->period_bytes)) in snd_card_asihpi_timer_function()
818 next_jiffies = ((on_card_bytes - dpcm->period_bytes) * HZ / dpcm->bytes_per_sec); in snd_card_asihpi_timer_function()
820 next_jiffies = ((dpcm->period_bytes - remdata) * HZ / dpcm->bytes_per_sec); in snd_card_asihpi_timer_function()
823 dpcm->timer.expires = jiffies + next_jiffies; in snd_card_asihpi_timer_function()
828 struct snd_card_asihpi_pcm *ds = s->runtime->private_data; in snd_card_asihpi_timer_function()
831 if (substream->stream != s->stream) in snd_card_asihpi_timer_function()
835 ds->pcm_buf_dma_ofs = pcm_buf_dma_ofs; in snd_card_asihpi_timer_function()
839 ((on_card_bytes <= ds->period_bytes) || in snd_card_asihpi_timer_function()
840 (s->stream == SNDRV_PCM_STREAM_CAPTURE))) in snd_card_asihpi_timer_function()
844 unsigned int buf_ofs = ds->pcm_buf_host_rw_ofs % ds->buffer_bytes; in snd_card_asihpi_timer_function()
846 char *pd = &s->runtime->dma_area[buf_ofs]; in snd_card_asihpi_timer_function()
848 if (card->can_dma) { /* buffer wrap is handled at lower level */ in snd_card_asihpi_timer_function()
852 xfer1 = min(xfercount, ds->buffer_bytes - buf_ofs); in snd_card_asihpi_timer_function()
853 xfer2 = xfercount - xfer1; in snd_card_asihpi_timer_function()
856 if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_card_asihpi_timer_function()
858 s->number, xfer1, buf_ofs); in snd_card_asihpi_timer_function()
861 ds->h_stream, pd, xfer1, in snd_card_asihpi_timer_function()
862 &ds->format)); in snd_card_asihpi_timer_function()
865 pd = s->runtime->dma_area; in snd_card_asihpi_timer_function()
868 s->number, in snd_card_asihpi_timer_function()
869 xfercount - xfer1, buf_ofs); in snd_card_asihpi_timer_function()
872 ds->h_stream, pd, in snd_card_asihpi_timer_function()
873 xfercount - xfer1, in snd_card_asihpi_timer_function()
874 &ds->format)); in snd_card_asihpi_timer_function()
878 s->number, xfer1); in snd_card_asihpi_timer_function()
881 ds->h_stream, in snd_card_asihpi_timer_function()
884 pd = s->runtime->dma_area; in snd_card_asihpi_timer_function()
886 s->number, xfer2); in snd_card_asihpi_timer_function()
889 ds->h_stream, in snd_card_asihpi_timer_function()
894 ds->pcm_buf_host_rw_ofs += xfercount; in snd_card_asihpi_timer_function()
895 ds->pcm_buf_elapsed_dma_ofs += xfercount; in snd_card_asihpi_timer_function()
900 if (!card->hpi->interrupt_mode && dpcm->respawn_timer) in snd_card_asihpi_timer_function()
901 add_timer(&dpcm->timer); in snd_card_asihpi_timer_function()
908 WARN_ON(!a || !a->snd_card || !a->snd_card->private_data); in snd_card_asihpi_isr()
909 asihpi = (struct snd_card_asihpi *)a->snd_card->private_data; in snd_card_asihpi_isr()
910 if (asihpi->llmode_streampriv) in snd_card_asihpi_isr()
912 &asihpi->llmode_streampriv->timer); in snd_card_asihpi_isr()
919 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_playback_prepare()
920 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; in snd_card_asihpi_playback_prepare()
922 snd_printdd("P%d prepare\n", substream->number); in snd_card_asihpi_playback_prepare()
924 hpi_handle_error(hpi_outstream_reset(dpcm->h_stream)); in snd_card_asihpi_playback_prepare()
925 dpcm->pcm_buf_host_rw_ofs = 0; in snd_card_asihpi_playback_prepare()
926 dpcm->pcm_buf_dma_ofs = 0; in snd_card_asihpi_playback_prepare()
927 dpcm->pcm_buf_elapsed_dma_ofs = 0; in snd_card_asihpi_playback_prepare()
934 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_playback_pointer()
935 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; in snd_card_asihpi_playback_pointer()
940 ptr = bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->buffer_bytes); in snd_card_asihpi_playback_pointer()
949 u16 format; in snd_card_asihpi_playback_formats() local
958 err = hpi_mixer_get_control(asihpi->h_mixer, in snd_card_asihpi_playback_formats()
966 for (format = HPI_FORMAT_PCM8_UNSIGNED; in snd_card_asihpi_playback_formats()
967 format <= HPI_FORMAT_PCM24_SIGNED; format++) { in snd_card_asihpi_playback_formats()
968 err = hpi_format_create(&hpi_format, asihpi->out_max_chans, in snd_card_asihpi_playback_formats()
969 format, sample_rate, 128000, 0); in snd_card_asihpi_playback_formats()
972 if (!err && (hpi_to_alsa_formats[format] != INVALID_FORMAT)) in snd_card_asihpi_playback_formats()
973 formats |= pcm_format_to_bits(hpi_to_alsa_formats[format]); in snd_card_asihpi_playback_formats()
980 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_playback_open()
988 return -ENOMEM; in snd_card_asihpi_playback_open()
990 err = hpi_outstream_open(card->hpi->adapter->index, in snd_card_asihpi_playback_open()
991 substream->number, &dpcm->h_stream); in snd_card_asihpi_playback_open()
996 return -EBUSY; in snd_card_asihpi_playback_open()
998 return -EIO; in snd_card_asihpi_playback_open()
1005 timer_setup(&dpcm->timer, snd_card_asihpi_timer_function, 0); in snd_card_asihpi_playback_open()
1006 dpcm->substream = substream; in snd_card_asihpi_playback_open()
1007 runtime->private_data = dpcm; in snd_card_asihpi_playback_open()
1008 runtime->private_free = snd_card_asihpi_runtime_free; in snd_card_asihpi_playback_open()
1011 if (!card->hpi->interrupt_mode) { in snd_card_asihpi_playback_open()
1018 size_t pbmin = card->update_interval_frames * in snd_card_asihpi_playback_open()
1019 card->out_max_chans; in snd_card_asihpi_playback_open()
1028 snd_card_asihpi_playback.channels_max = card->out_max_chans; in snd_card_asihpi_playback_open()
1029 snd_card_asihpi_playback.channels_min = card->out_min_chans; in snd_card_asihpi_playback_open()
1031 snd_card_asihpi_playback_formats(card, dpcm->h_stream); in snd_card_asihpi_playback_open()
1043 if (card->support_grouping) { in snd_card_asihpi_playback_open()
1049 runtime->hw = snd_card_asihpi_playback; in snd_card_asihpi_playback_open()
1051 if (card->can_dma) in snd_card_asihpi_playback_open()
1058 card->update_interval_frames); in snd_card_asihpi_playback_open()
1061 card->update_interval_frames, UINT_MAX); in snd_card_asihpi_playback_open()
1070 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_playback_close()
1071 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; in snd_card_asihpi_playback_close()
1073 hpi_handle_error(hpi_outstream_close(dpcm->h_stream)); in snd_card_asihpi_playback_close()
1093 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_capture_pointer()
1094 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; in snd_card_asihpi_capture_pointer()
1098 snd_printddd("%s, pointer=%d\n", name, dpcm->pcm_buf_dma_ofs); in snd_card_asihpi_capture_pointer()
1103 return bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->buffer_bytes); in snd_card_asihpi_capture_pointer()
1108 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_capture_prepare()
1109 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; in snd_card_asihpi_capture_prepare()
1111 hpi_handle_error(hpi_instream_reset(dpcm->h_stream)); in snd_card_asihpi_capture_prepare()
1112 dpcm->pcm_buf_host_rw_ofs = 0; in snd_card_asihpi_capture_prepare()
1113 dpcm->pcm_buf_dma_ofs = 0; in snd_card_asihpi_capture_prepare()
1114 dpcm->pcm_buf_elapsed_dma_ofs = 0; in snd_card_asihpi_capture_prepare()
1116 snd_printdd("Capture Prepare %d\n", substream->number); in snd_card_asihpi_capture_prepare()
1124 u16 format; in snd_card_asihpi_capture_formats() local
1132 err = hpi_mixer_get_control(asihpi->h_mixer, in snd_card_asihpi_capture_formats()
1140 for (format = HPI_FORMAT_PCM8_UNSIGNED; in snd_card_asihpi_capture_formats()
1141 format <= HPI_FORMAT_PCM24_SIGNED; format++) { in snd_card_asihpi_capture_formats()
1143 err = hpi_format_create(&hpi_format, asihpi->in_max_chans, in snd_card_asihpi_capture_formats()
1144 format, sample_rate, 128000, 0); in snd_card_asihpi_capture_formats()
1147 if (!err && (hpi_to_alsa_formats[format] != INVALID_FORMAT)) in snd_card_asihpi_capture_formats()
1148 formats |= pcm_format_to_bits(hpi_to_alsa_formats[format]); in snd_card_asihpi_capture_formats()
1155 struct snd_pcm_runtime *runtime = substream->runtime; in snd_card_asihpi_capture_open()
1163 return -ENOMEM; in snd_card_asihpi_capture_open()
1166 card->hpi->adapter->index, substream->number); in snd_card_asihpi_capture_open()
1169 hpi_instream_open(card->hpi->adapter->index, in snd_card_asihpi_capture_open()
1170 substream->number, &dpcm->h_stream)); in snd_card_asihpi_capture_open()
1174 return -EBUSY; in snd_card_asihpi_capture_open()
1176 return -EIO; in snd_card_asihpi_capture_open()
1178 timer_setup(&dpcm->timer, snd_card_asihpi_timer_function, 0); in snd_card_asihpi_capture_open()
1179 dpcm->substream = substream; in snd_card_asihpi_capture_open()
1180 runtime->private_data = dpcm; in snd_card_asihpi_capture_open()
1181 runtime->private_free = snd_card_asihpi_runtime_free; in snd_card_asihpi_capture_open()
1184 if (!card->hpi->interrupt_mode) { in snd_card_asihpi_capture_open()
1191 size_t pbmin = card->update_interval_frames * in snd_card_asihpi_capture_open()
1192 card->out_max_chans; in snd_card_asihpi_capture_open()
1200 snd_card_asihpi_capture.channels_max = card->in_max_chans; in snd_card_asihpi_capture_open()
1201 snd_card_asihpi_capture.channels_min = card->in_min_chans; in snd_card_asihpi_capture_open()
1203 snd_card_asihpi_capture_formats(card, dpcm->h_stream); in snd_card_asihpi_capture_open()
1209 if (card->support_grouping) in snd_card_asihpi_capture_open()
1212 runtime->hw = snd_card_asihpi_capture; in snd_card_asihpi_capture_open()
1214 if (card->can_dma) in snd_card_asihpi_capture_open()
1221 card->update_interval_frames); in snd_card_asihpi_capture_open()
1223 card->update_interval_frames, UINT_MAX); in snd_card_asihpi_capture_open()
1232 struct snd_card_asihpi_pcm *dpcm = substream->runtime->private_data; in snd_card_asihpi_capture_close()
1234 hpi_handle_error(hpi_instream_close(dpcm->h_stream)); in snd_card_asihpi_capture_close()
1255 err = hpi_adapter_get_info(asihpi->hpi->adapter->index, in snd_card_asihpi_pcm_new()
1259 err = snd_pcm_new(asihpi->card, "Asihpi PCM", device, in snd_card_asihpi_pcm_new()
1270 pcm->private_data = asihpi; in snd_card_asihpi_pcm_new()
1271 pcm->info_flags = 0; in snd_card_asihpi_pcm_new()
1272 strcpy(pcm->name, "Asihpi PCM"); in snd_card_asihpi_pcm_new()
1274 /*? do we want to emulate MMAP for non-BBM cards? in snd_card_asihpi_pcm_new()
1275 Jack doesn't work with ALSAs MMAP emulation - WHY NOT? */ in snd_card_asihpi_pcm_new()
1277 &asihpi->pci->dev, in snd_card_asihpi_pcm_new()
1299 "TV NTSC-M",
1330 "BLU-Link"
1335 (HPI_SOURCENODE_LAST_INDEX-HPI_SOURCENODE_NONE+1)),
1350 "BLU-Link"
1355 (HPI_DESTNODE_LAST_INDEX-HPI_DESTNODE_NONE+1)),
1367 dev_info(&asihpi->pci->dev, "added %s(%d)\n", ctl->name, ctl->index); in ctl_add()
1379 snd_control->name = hpi_ctl->name; in asihpi_ctl_init()
1380 snd_control->private_value = hpi_ctl->h_control; in asihpi_ctl_init()
1381 snd_control->iface = SNDRV_CTL_ELEM_IFACE_MIXER; in asihpi_ctl_init()
1382 snd_control->index = 0; in asihpi_ctl_init()
1384 if (hpi_ctl->src_node_type + HPI_SOURCENODE_NONE == HPI_SOURCENODE_CLOCK_SOURCE) in asihpi_ctl_init()
1386 else if (hpi_ctl->dst_node_type + HPI_DESTNODE_NONE == HPI_DESTNODE_ISTREAM) in asihpi_ctl_init()
1388 else if ((hpi_ctl->src_node_type + HPI_SOURCENODE_NONE != HPI_SOURCENODE_OSTREAM) && in asihpi_ctl_init()
1389 (!hpi_ctl->dst_node_type)) in asihpi_ctl_init()
1391 else if (hpi_ctl->src_node_type && in asihpi_ctl_init()
1392 (hpi_ctl->src_node_type + HPI_SOURCENODE_NONE != HPI_SOURCENODE_OSTREAM) && in asihpi_ctl_init()
1393 (hpi_ctl->dst_node_type)) in asihpi_ctl_init()
1398 if (hpi_ctl->src_node_type && hpi_ctl->dst_node_type) in asihpi_ctl_init()
1399 sprintf(hpi_ctl->name, "%s %d %s %d %s%s", in asihpi_ctl_init()
1400 asihpi_src_names[hpi_ctl->src_node_type], in asihpi_ctl_init()
1401 hpi_ctl->src_node_index, in asihpi_ctl_init()
1402 asihpi_dst_names[hpi_ctl->dst_node_type], in asihpi_ctl_init()
1403 hpi_ctl->dst_node_index, in asihpi_ctl_init()
1405 else if (hpi_ctl->dst_node_type) { in asihpi_ctl_init()
1406 sprintf(hpi_ctl->name, "%s %d %s%s", in asihpi_ctl_init()
1407 asihpi_dst_names[hpi_ctl->dst_node_type], in asihpi_ctl_init()
1408 hpi_ctl->dst_node_index, in asihpi_ctl_init()
1411 sprintf(hpi_ctl->name, "%s %d %s%s", in asihpi_ctl_init()
1412 asihpi_src_names[hpi_ctl->src_node_type], in asihpi_ctl_init()
1413 hpi_ctl->src_node_index, in asihpi_ctl_init()
1416 /* printk(KERN_INFO "Adding %s %d to %d ", hpi_ctl->name, in asihpi_ctl_init()
1417 hpi_ctl->wSrcNodeType, hpi_ctl->wDstNodeType); */ in asihpi_ctl_init()
1420 /*------------------------------------------------------------
1422 ------------------------------------------------------------*/
1427 u32 h_control = kcontrol->private_value; in snd_asihpi_volume_info()
1439 min_gain_mB = -10000; in snd_asihpi_volume_info()
1447 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_asihpi_volume_info()
1448 uinfo->count = count; in snd_asihpi_volume_info()
1449 uinfo->value.integer.min = min_gain_mB / VOL_STEP_mB; in snd_asihpi_volume_info()
1450 uinfo->value.integer.max = max_gain_mB / VOL_STEP_mB; in snd_asihpi_volume_info()
1451 uinfo->value.integer.step = step_gain_mB / VOL_STEP_mB; in snd_asihpi_volume_info()
1458 u32 h_control = kcontrol->private_value; in snd_asihpi_volume_get()
1462 ucontrol->value.integer.value[0] = an_gain_mB[0] / VOL_STEP_mB; in snd_asihpi_volume_get()
1463 ucontrol->value.integer.value[1] = an_gain_mB[1] / VOL_STEP_mB; in snd_asihpi_volume_get()
1471 u32 h_control = kcontrol->private_value; in snd_asihpi_volume_put()
1475 (ucontrol->value.integer.value[0]) * VOL_STEP_mB; in snd_asihpi_volume_put()
1477 (ucontrol->value.integer.value[1]) * VOL_STEP_mB; in snd_asihpi_volume_put()
1478 /* change = asihpi->mixer_volume[addr][0] != left || in snd_asihpi_volume_put()
1479 asihpi->mixer_volume[addr][1] != right; in snd_asihpi_volume_put()
1485 static const DECLARE_TLV_DB_SCALE(db_scale_100, -10000, VOL_STEP_mB, 0);
1492 u32 h_control = kcontrol->private_value; in snd_asihpi_volume_mute_get()
1496 ucontrol->value.integer.value[0] = mute ? 0 : 1; in snd_asihpi_volume_mute_get()
1504 u32 h_control = kcontrol->private_value; in snd_asihpi_volume_mute_put()
1508 int mute = ucontrol->value.integer.value[0] ? 0 : HPI_BITMASK_ALL_CHANNELS; in snd_asihpi_volume_mute_put()
1516 struct snd_card *card = asihpi->card; in snd_asihpi_volume_add()
1533 if (hpi_volume_get_mute(hpi_ctl->h_control, &mute) == 0) { in snd_asihpi_volume_add()
1544 /*------------------------------------------------------------
1546 ------------------------------------------------------------*/
1550 u32 h_control = kcontrol->private_value; in snd_asihpi_level_info()
1561 min_gain_mB = -1000; in snd_asihpi_level_info()
1565 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_asihpi_level_info()
1566 uinfo->count = 2; in snd_asihpi_level_info()
1567 uinfo->value.integer.min = min_gain_mB / HPI_UNITS_PER_dB; in snd_asihpi_level_info()
1568 uinfo->value.integer.max = max_gain_mB / HPI_UNITS_PER_dB; in snd_asihpi_level_info()
1569 uinfo->value.integer.step = step_gain_mB / HPI_UNITS_PER_dB; in snd_asihpi_level_info()
1576 u32 h_control = kcontrol->private_value; in snd_asihpi_level_get()
1580 ucontrol->value.integer.value[0] = in snd_asihpi_level_get()
1582 ucontrol->value.integer.value[1] = in snd_asihpi_level_get()
1592 u32 h_control = kcontrol->private_value; in snd_asihpi_level_put()
1596 (ucontrol->value.integer.value[0]) * HPI_UNITS_PER_dB; in snd_asihpi_level_put()
1598 (ucontrol->value.integer.value[1]) * HPI_UNITS_PER_dB; in snd_asihpi_level_put()
1599 /* change = asihpi->mixer_level[addr][0] != left || in snd_asihpi_level_put()
1600 asihpi->mixer_level[addr][1] != right; in snd_asihpi_level_put()
1607 static const DECLARE_TLV_DB_SCALE(db_scale_level, -1000, 100, 0);
1612 struct snd_card *card = asihpi->card; in snd_asihpi_level_add()
1627 /*------------------------------------------------------------
1629 ------------------------------------------------------------*/
1631 /* AESEBU format */
1645 u32 h_control = kcontrol->private_value; in snd_asihpi_aesebu_format_get()
1651 ucontrol->value.enumerated.item[0] = 0; in snd_asihpi_aesebu_format_get()
1656 ucontrol->value.enumerated.item[0] = 1; in snd_asihpi_aesebu_format_get()
1658 ucontrol->value.enumerated.item[0] = 2; in snd_asihpi_aesebu_format_get()
1667 u32 h_control = kcontrol->private_value; in snd_asihpi_aesebu_format_put()
1672 if (ucontrol->value.enumerated.item[0] == 1) in snd_asihpi_aesebu_format_put()
1674 if (ucontrol->value.enumerated.item[0] == 2) in snd_asihpi_aesebu_format_put()
1678 return -EINVAL; in snd_asihpi_aesebu_format_put()
1698 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_asihpi_aesebu_rxstatus_info()
1699 uinfo->count = 1; in snd_asihpi_aesebu_rxstatus_info()
1701 uinfo->value.integer.min = 0; in snd_asihpi_aesebu_rxstatus_info()
1702 uinfo->value.integer.max = 0X1F; in snd_asihpi_aesebu_rxstatus_info()
1703 uinfo->value.integer.step = 1; in snd_asihpi_aesebu_rxstatus_info()
1711 u32 h_control = kcontrol->private_value; in snd_asihpi_aesebu_rxstatus_get()
1716 ucontrol->value.integer.value[0] = status; in snd_asihpi_aesebu_rxstatus_get()
1723 struct snd_card *card = asihpi->card; in snd_asihpi_aesebu_rx_add()
1726 asihpi_ctl_init(&snd_control, hpi_ctl, "Format"); in snd_asihpi_aesebu_rx_add()
1734 return -EINVAL; in snd_asihpi_aesebu_rx_add()
1761 struct snd_card *card = asihpi->card; in snd_asihpi_aesebu_tx_add()
1764 asihpi_ctl_init(&snd_control, hpi_ctl, "Format"); in snd_asihpi_aesebu_tx_add()
1773 /*------------------------------------------------------------
1775 ------------------------------------------------------------*/
1782 u32 h_control = kcontrol->private_value; in snd_asihpi_tuner_gain_info()
1794 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_asihpi_tuner_gain_info()
1795 uinfo->count = 1; in snd_asihpi_tuner_gain_info()
1796 uinfo->value.integer.min = ((int)gain_range[0]) / HPI_UNITS_PER_dB; in snd_asihpi_tuner_gain_info()
1797 uinfo->value.integer.max = ((int)gain_range[1]) / HPI_UNITS_PER_dB; in snd_asihpi_tuner_gain_info()
1798 uinfo->value.integer.step = ((int) gain_range[2]) / HPI_UNITS_PER_dB; in snd_asihpi_tuner_gain_info()
1808 u32 h_control = kcontrol->private_value; in snd_asihpi_tuner_gain_get()
1812 ucontrol->value.integer.value[0] = gain / HPI_UNITS_PER_dB; in snd_asihpi_tuner_gain_get()
1823 u32 h_control = kcontrol->private_value; in snd_asihpi_tuner_gain_put()
1826 gain = (ucontrol->value.integer.value[0]) * HPI_UNITS_PER_dB; in snd_asihpi_tuner_gain_put()
1836 u32 h_control = kcontrol->private_value; in asihpi_tuner_band_query()
1848 return -EIO; in asihpi_tuner_band_query()
1871 u32 h_control = kcontrol->private_value; in snd_asihpi_tuner_band_get()
1884 ucontrol->value.enumerated.item[0] = -1; in snd_asihpi_tuner_band_get()
1887 ucontrol->value.enumerated.item[0] = idx; in snd_asihpi_tuner_band_get()
1900 u32 h_control = kcontrol->private_value; in snd_asihpi_tuner_band_put()
1909 idx = ucontrol->value.enumerated.item[0]; in snd_asihpi_tuner_band_put()
1911 idx = ARRAY_SIZE(tuner_bands) - 1; in snd_asihpi_tuner_band_put()
1923 u32 h_control = kcontrol->private_value; in snd_asihpi_tuner_freq_info()
1957 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_asihpi_tuner_freq_info()
1958 uinfo->count = 1; in snd_asihpi_tuner_freq_info()
1959 uinfo->value.integer.min = ((int)freq_range[0]); in snd_asihpi_tuner_freq_info()
1960 uinfo->value.integer.max = ((int)freq_range[1]); in snd_asihpi_tuner_freq_info()
1961 uinfo->value.integer.step = ((int)freq_range[2]); in snd_asihpi_tuner_freq_info()
1968 u32 h_control = kcontrol->private_value; in snd_asihpi_tuner_freq_get()
1972 ucontrol->value.integer.value[0] = freq; in snd_asihpi_tuner_freq_get()
1980 u32 h_control = kcontrol->private_value; in snd_asihpi_tuner_freq_put()
1983 freq = ucontrol->value.integer.value[0]; in snd_asihpi_tuner_freq_put()
1993 struct snd_card *card = asihpi->card; in snd_asihpi_tuner_add()
1996 snd_control.private_value = hpi_ctl->h_control; in snd_asihpi_tuner_add()
1999 if (!hpi_tuner_get_gain(hpi_ctl->h_control, NULL)) { in snd_asihpi_tuner_add()
2006 return -EINVAL; in snd_asihpi_tuner_add()
2015 return -EINVAL; in snd_asihpi_tuner_add()
2025 /*------------------------------------------------------------
2027 ------------------------------------------------------------*/
2031 u32 h_control = kcontrol->private_value; in snd_asihpi_meter_info()
2038 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_asihpi_meter_info()
2039 uinfo->count = count; in snd_asihpi_meter_info()
2040 uinfo->value.integer.min = 0; in snd_asihpi_meter_info()
2041 uinfo->value.integer.max = 0x7FFFFFFF; in snd_asihpi_meter_info()
2053 2147484, /* -60dB */
2055 214748, /* -80 */
2057 21475, /* -100 */
2071 u32 h_control = kcontrol->private_value; in snd_asihpi_meter_get()
2079 ucontrol->value.integer.value[i] = 0; in snd_asihpi_meter_get()
2081 ucontrol->value.integer.value[i] = in snd_asihpi_meter_get()
2084 /* -ve is log value in millibels < -60dB, in snd_asihpi_meter_get()
2087 ucontrol->value.integer.value[i] = in snd_asihpi_meter_get()
2088 log2lin[an_gain_mB[i] / -1000]; in snd_asihpi_meter_get()
2097 struct snd_card *card = asihpi->card; in snd_asihpi_meter_add()
2111 /*------------------------------------------------------------
2113 ------------------------------------------------------------*/
2116 u32 h_control = snd_control->private_value; in snd_card_asihpi_mux_count_sources()
2135 u32 h_control = kcontrol->private_value; in snd_asihpi_mux_info()
2137 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in snd_asihpi_mux_info()
2138 uinfo->count = 1; in snd_asihpi_mux_info()
2139 uinfo->value.enumerated.items = in snd_asihpi_mux_info()
2142 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) in snd_asihpi_mux_info()
2143 uinfo->value.enumerated.item = in snd_asihpi_mux_info()
2144 uinfo->value.enumerated.items - 1; in snd_asihpi_mux_info()
2147 uinfo->value.enumerated.item, in snd_asihpi_mux_info()
2150 sprintf(uinfo->value.enumerated.name, "%s %d", in snd_asihpi_mux_info()
2151 asihpi_src_names[src_node_type - HPI_SOURCENODE_NONE], in snd_asihpi_mux_info()
2159 u32 h_control = kcontrol->private_value; in snd_asihpi_mux_get()
2174 ucontrol->value.enumerated.item[0] = s; in snd_asihpi_mux_get()
2181 ucontrol->value.enumerated.item[0] = 0; in snd_asihpi_mux_get()
2189 u32 h_control = kcontrol->private_value; in snd_asihpi_mux_put()
2196 ucontrol->value.enumerated.item[0], in snd_asihpi_mux_put()
2209 struct snd_card *card = asihpi->card; in snd_asihpi_mux_add()
2222 /*------------------------------------------------------------
2224 ------------------------------------------------------------*/
2235 u32 h_control = kcontrol->private_value; in snd_asihpi_cmode_info()
2252 return -EINVAL; in snd_asihpi_cmode_info()
2260 u32 h_control = kcontrol->private_value; in snd_asihpi_cmode_get()
2266 ucontrol->value.enumerated.item[0] = mode - 1; in snd_asihpi_cmode_get()
2275 u32 h_control = kcontrol->private_value; in snd_asihpi_cmode_put()
2280 ucontrol->value.enumerated.item[0] + 1)); in snd_asihpi_cmode_put()
2288 struct snd_card *card = asihpi->card; in snd_asihpi_cmode_add()
2300 /*------------------------------------------------------------
2302 ------------------------------------------------------------*/
2306 "Prev Module", "BLU-Link",
2319 (struct snd_card_asihpi *)(kcontrol->private_data); in snd_asihpi_clksrc_info()
2320 struct clk_cache *clkcache = &asihpi->cc; in snd_asihpi_clksrc_info()
2321 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; in snd_asihpi_clksrc_info()
2322 uinfo->count = 1; in snd_asihpi_clksrc_info()
2323 uinfo->value.enumerated.items = clkcache->count; in snd_asihpi_clksrc_info()
2325 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) in snd_asihpi_clksrc_info()
2326 uinfo->value.enumerated.item = in snd_asihpi_clksrc_info()
2327 uinfo->value.enumerated.items - 1; in snd_asihpi_clksrc_info()
2329 strcpy(uinfo->value.enumerated.name, in snd_asihpi_clksrc_info()
2330 clkcache->s[uinfo->value.enumerated.item].name); in snd_asihpi_clksrc_info()
2338 (struct snd_card_asihpi *)(kcontrol->private_data); in snd_asihpi_clksrc_get()
2339 struct clk_cache *clkcache = &asihpi->cc; in snd_asihpi_clksrc_get()
2340 u32 h_control = kcontrol->private_value; in snd_asihpi_clksrc_get()
2344 ucontrol->value.enumerated.item[0] = 0; in snd_asihpi_clksrc_get()
2352 for (i = 0; i < clkcache->count; i++) in snd_asihpi_clksrc_get()
2353 if ((clkcache->s[i].source == source) && in snd_asihpi_clksrc_get()
2354 (clkcache->s[i].index == srcindex)) in snd_asihpi_clksrc_get()
2357 ucontrol->value.enumerated.item[0] = i; in snd_asihpi_clksrc_get()
2366 (struct snd_card_asihpi *)(kcontrol->private_data); in snd_asihpi_clksrc_put()
2367 struct clk_cache *clkcache = &asihpi->cc; in snd_asihpi_clksrc_put()
2370 u32 h_control = kcontrol->private_value; in snd_asihpi_clksrc_put()
2373 item = ucontrol->value.enumerated.item[0]; in snd_asihpi_clksrc_put()
2374 if (item >= clkcache->count) in snd_asihpi_clksrc_put()
2375 item = clkcache->count-1; in snd_asihpi_clksrc_put()
2378 h_control, clkcache->s[item].source)); in snd_asihpi_clksrc_put()
2380 if (clkcache->s[item].source == HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT) in snd_asihpi_clksrc_put()
2382 h_control, clkcache->s[item].index)); in snd_asihpi_clksrc_put()
2386 /*------------------------------------------------------------
2388 ------------------------------------------------------------*/
2393 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_asihpi_clklocal_info()
2394 uinfo->count = 1; in snd_asihpi_clklocal_info()
2395 uinfo->value.integer.min = 8000; in snd_asihpi_clklocal_info()
2396 uinfo->value.integer.max = 192000; in snd_asihpi_clklocal_info()
2397 uinfo->value.integer.step = 100; in snd_asihpi_clklocal_info()
2405 u32 h_control = kcontrol->private_value; in snd_asihpi_clklocal_get()
2411 ucontrol->value.integer.value[0] = rate; in snd_asihpi_clklocal_get()
2413 ucontrol->value.integer.value[0] = 0; in snd_asihpi_clklocal_get()
2421 u32 h_control = kcontrol->private_value; in snd_asihpi_clklocal_put()
2423 /* change = asihpi->mixer_clkrate[addr][0] != left || in snd_asihpi_clklocal_put()
2424 asihpi->mixer_clkrate[addr][1] != right; in snd_asihpi_clklocal_put()
2428 ucontrol->value.integer.value[0])); in snd_asihpi_clklocal_put()
2435 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_asihpi_clkrate_info()
2436 uinfo->count = 1; in snd_asihpi_clkrate_info()
2437 uinfo->value.integer.min = 8000; in snd_asihpi_clkrate_info()
2438 uinfo->value.integer.max = 192000; in snd_asihpi_clkrate_info()
2439 uinfo->value.integer.step = 100; in snd_asihpi_clkrate_info()
2447 u32 h_control = kcontrol->private_value; in snd_asihpi_clkrate_get()
2453 ucontrol->value.integer.value[0] = rate; in snd_asihpi_clkrate_get()
2455 ucontrol->value.integer.value[0] = 0; in snd_asihpi_clkrate_get()
2466 u32 hSC = hpi_ctl->h_control; in snd_asihpi_sampleclock_add()
2472 return -EINVAL; in snd_asihpi_sampleclock_add()
2473 card = asihpi->card; in snd_asihpi_sampleclock_add()
2474 clkcache = &asihpi->cc; in snd_asihpi_sampleclock_add()
2475 snd_control.private_value = hpi_ctl->h_control; in snd_asihpi_sampleclock_add()
2477 clkcache->has_local = 0; in snd_asihpi_sampleclock_add()
2483 clkcache->s[i].source = source; in snd_asihpi_sampleclock_add()
2484 clkcache->s[i].index = 0; in snd_asihpi_sampleclock_add()
2485 clkcache->s[i].name = sampleclock_sources[source]; in snd_asihpi_sampleclock_add()
2489 clkcache->has_local = 1; in snd_asihpi_sampleclock_add()
2498 clkcache->s[i].source = in snd_asihpi_sampleclock_add()
2500 clkcache->s[i].index = j; in snd_asihpi_sampleclock_add()
2501 clkcache->s[i].name = sampleclock_sources[ in snd_asihpi_sampleclock_add()
2505 clkcache->count = i; in snd_asihpi_sampleclock_add()
2513 return -EINVAL; in snd_asihpi_sampleclock_add()
2516 if (clkcache->has_local) { in snd_asihpi_sampleclock_add()
2525 return -EINVAL; in snd_asihpi_sampleclock_add()
2536 /*------------------------------------------------------------
2538 ------------------------------------------------------------*/
2549 return -EINVAL; in snd_card_asihpi_mixer_new()
2550 card = asihpi->card; in snd_card_asihpi_mixer_new()
2551 strcpy(card->mixername, "Asihpi Mixer"); in snd_card_asihpi_mixer_new()
2554 hpi_mixer_open(asihpi->hpi->adapter->index, in snd_card_asihpi_mixer_new()
2555 &asihpi->h_mixer); in snd_card_asihpi_mixer_new()
2558 return -err; in snd_card_asihpi_mixer_new()
2561 prev_ctl.control_type = -1; in snd_card_asihpi_mixer_new()
2565 asihpi->h_mixer, in snd_card_asihpi_mixer_new()
2576 dev_info(&asihpi->pci->dev, in snd_card_asihpi_mixer_new()
2585 hpi_ctl.src_node_type -= HPI_SOURCENODE_NONE; in snd_card_asihpi_mixer_new()
2586 hpi_ctl.dst_node_type -= HPI_DESTNODE_NONE; in snd_card_asihpi_mixer_new()
2641 dev_info(&asihpi->pci->dev, in snd_card_asihpi_mixer_new()
2657 dev_info(&asihpi->pci->dev, "%d mixer controls found\n", idx); in snd_card_asihpi_mixer_new()
2662 /*------------------------------------------------------------
2664 ------------------------------------------------------------*/
2670 struct snd_card_asihpi *asihpi = entry->private_data; in snd_asihpi_proc_read()
2685 hpi_handle_error(hpi_adapter_get_info(asihpi->hpi->adapter->index, in snd_asihpi_proc_read()
2690 "Adapter type ASI%4X\nHardware Index %d\n" in snd_asihpi_proc_read()
2692 type, asihpi->hpi->adapter->index, in snd_asihpi_proc_read()
2700 err = hpi_mixer_get_control(asihpi->h_mixer, in snd_asihpi_proc_read()
2716 snd_card_ro_proc_new(asihpi->card, "info", asihpi, in snd_asihpi_proc_init()
2720 /*------------------------------------------------------------
2722 ------------------------------------------------------------*/
2729 return -ENODEV; in snd_asihpi_hpi_open()
2738 return -ENODEV; in snd_asihpi_hpi_release()
2747 return -ENODEV; in snd_asihpi_hpi_ioctl()
2752 also /proc/asound/hwdep will contain '#-00: asihpi (HPI) for each card'
2759 err = snd_hwdep_new(asihpi->card, "HPI", device, &hw); in snd_asihpi_hpi_new()
2762 strcpy(hw->name, "asihpi (HPI)"); in snd_asihpi_hpi_new()
2763 hw->iface = SNDRV_HWDEP_IFACE_LAST; in snd_asihpi_hpi_new()
2764 hw->ops.open = snd_asihpi_hpi_open; in snd_asihpi_hpi_new()
2765 hw->ops.ioctl = snd_asihpi_hpi_ioctl; in snd_asihpi_hpi_new()
2766 hw->ops.release = snd_asihpi_hpi_release; in snd_asihpi_hpi_new()
2767 hw->private_data = asihpi; in snd_asihpi_hpi_new()
2771 /*------------------------------------------------------------
2773 ------------------------------------------------------------*/
2788 return -ENODEV; in snd_asihpi_probe()
2790 /* Should this be enable[hpi->index] ? */ in snd_asihpi_probe()
2793 return -ENOENT; in snd_asihpi_probe()
2796 /* Initialise low-level HPI driver */ in snd_asihpi_probe()
2802 adapter_index = hpi->adapter->index; in snd_asihpi_probe()
2804 err = snd_card_new(&pci_dev->dev, adapter_index, id[adapter_index], in snd_asihpi_probe()
2808 err = snd_card_new(&pci_dev->dev, index[dev], id[dev], in snd_asihpi_probe()
2813 dev_warn(&pci_dev->dev, "Adapter index %d->ALSA index %d\n", in snd_asihpi_probe()
2814 adapter_index, card->number); in snd_asihpi_probe()
2817 asihpi = card->private_data; in snd_asihpi_probe()
2818 asihpi->card = card; in snd_asihpi_probe()
2819 asihpi->pci = pci_dev; in snd_asihpi_probe()
2820 asihpi->hpi = hpi; in snd_asihpi_probe()
2821 hpi->snd_card = card; in snd_asihpi_probe()
2825 NULL, &asihpi->support_grouping); in snd_asihpi_probe()
2827 asihpi->support_grouping = 0; in snd_asihpi_probe()
2831 &asihpi->support_mrx, NULL); in snd_asihpi_probe()
2833 asihpi->support_mrx = 0; in snd_asihpi_probe()
2837 NULL, &asihpi->update_interval_frames); in snd_asihpi_probe()
2839 asihpi->update_interval_frames = 512; in snd_asihpi_probe()
2841 if (hpi->interrupt_mode) { in snd_asihpi_probe()
2842 asihpi->pcm_start = snd_card_asihpi_pcm_int_start; in snd_asihpi_probe()
2843 asihpi->pcm_stop = snd_card_asihpi_pcm_int_stop; in snd_asihpi_probe()
2844 hpi->interrupt_callback = snd_card_asihpi_isr; in snd_asihpi_probe()
2846 asihpi->pcm_start = snd_card_asihpi_pcm_timer_start; in snd_asihpi_probe()
2847 asihpi->pcm_stop = snd_card_asihpi_pcm_timer_stop; in snd_asihpi_probe()
2854 asihpi->can_dma = (!err); in snd_asihpi_probe()
2858 if (!asihpi->can_dma) in snd_asihpi_probe()
2859 asihpi->update_interval_frames *= 2; in snd_asihpi_probe()
2863 &asihpi->in_max_chans, &asihpi->out_max_chans); in snd_asihpi_probe()
2865 asihpi->in_max_chans = 2; in snd_asihpi_probe()
2866 asihpi->out_max_chans = 2; in snd_asihpi_probe()
2869 if (asihpi->out_max_chans > 2) { /* assume LL mode */ in snd_asihpi_probe()
2870 asihpi->out_min_chans = asihpi->out_max_chans; in snd_asihpi_probe()
2871 asihpi->in_min_chans = asihpi->in_max_chans; in snd_asihpi_probe()
2872 asihpi->support_grouping = 0; in snd_asihpi_probe()
2874 asihpi->out_min_chans = 1; in snd_asihpi_probe()
2875 asihpi->in_min_chans = 1; in snd_asihpi_probe()
2878 dev_info(&pci_dev->dev, "Has dma:%d, grouping:%d, mrx:%d, uif:%d\n", in snd_asihpi_probe()
2879 asihpi->can_dma, in snd_asihpi_probe()
2880 asihpi->support_grouping, in snd_asihpi_probe()
2881 asihpi->support_mrx, in snd_asihpi_probe()
2882 asihpi->update_interval_frames in snd_asihpi_probe()
2887 dev_err(&pci_dev->dev, "pcm_new failed\n"); in snd_asihpi_probe()
2892 dev_err(&pci_dev->dev, "mixer_new failed\n"); in snd_asihpi_probe()
2896 err = hpi_mixer_get_control(asihpi->h_mixer, in snd_asihpi_probe()
2910 strcpy(card->driver, "ASIHPI"); in snd_asihpi_probe()
2912 sprintf(card->shortname, "AudioScience ASI%4X", in snd_asihpi_probe()
2913 asihpi->hpi->adapter->type); in snd_asihpi_probe()
2914 sprintf(card->longname, "%s %i", in snd_asihpi_probe()
2915 card->shortname, adapter_index); in snd_asihpi_probe()
2924 dev_err(&pci_dev->dev, "snd_asihpi_probe error %d\n", err); in snd_asihpi_probe()
2934 if (hpi->interrupt_mode) { in snd_asihpi_remove()
2935 hpi->interrupt_callback = NULL; in snd_asihpi_remove()
2936 hpi_handle_error(hpi_adapter_set_property(hpi->adapter->index, in snd_asihpi_remove()
2940 snd_card_free(hpi->snd_card); in snd_asihpi_remove()
2941 hpi->snd_card = NULL; in snd_asihpi_remove()