Lines Matching +full:num +full:- +full:channels

1 // SPDX-License-Identifier: GPL-2.0-only
3 * bebob_maudio.c - a part of driver for BeBoB based devices
5 * Copyright (c) 2013-2014 Takashi Sakamoto
24 * source is not SYT-Match (I note no devices use SYT-Match).
33 * write-transaction directly into a certain address. All of addresses for mixer
88 * For some M-Audio devices, this module just send cue to load firmware. After
107 * 'date' is not null-terminated. in snd_bebob_maudio_load_firmware()
110 dev_err(&unit->device, in snd_bebob_maudio_load_firmware()
112 return -ENXIO; in snd_bebob_maudio_load_firmware()
117 return -ENOMEM; in snd_bebob_maudio_load_firmware()
123 rcode = fw_run_transaction(device->card, TCODE_WRITE_BLOCK_REQUEST, in snd_bebob_maudio_load_firmware()
124 device->node_id, device->generation, in snd_bebob_maudio_load_firmware()
125 device->max_speed, BEBOB_ADDR_REG_REQ, in snd_bebob_maudio_load_firmware()
129 dev_err(&unit->device, in snd_bebob_maudio_load_firmware()
131 err = -EIO; in snd_bebob_maudio_load_firmware()
140 return snd_fw_transaction(bebob->unit, TCODE_READ_BLOCK_REQUEST, in get_meter()
153 return -ENOMEM; in check_clk_sync()
160 *sync = (buf[size - 2] != 0xff); in check_clk_sync()
175 struct special_params *params = bebob->maudio_special_quirk; in avc_maudio_set_special_clk()
179 if (amdtp_stream_running(&bebob->rx_stream) || in avc_maudio_set_special_clk()
180 amdtp_stream_running(&bebob->tx_stream)) in avc_maudio_set_special_clk()
181 return -EBUSY; in avc_maudio_set_special_clk()
185 return -ENOMEM; in avc_maudio_set_special_clk()
200 err = fcp_avc_transaction(bebob->unit, buf, 12, buf, 12, in avc_maudio_set_special_clk()
205 err = -EIO; in avc_maudio_set_special_clk()
207 err = -ENOSYS; in avc_maudio_set_special_clk()
209 err = -EINVAL; in avc_maudio_set_special_clk()
213 params->clk_src = buf[6]; in avc_maudio_set_special_clk()
214 params->dig_in_fmt = buf[7]; in avc_maudio_set_special_clk()
215 params->dig_out_fmt = buf[8]; in avc_maudio_set_special_clk()
216 params->clk_lock = buf[9]; in avc_maudio_set_special_clk()
218 if (params->ctl_id_sync) in avc_maudio_set_special_clk()
219 snd_ctl_notify(bebob->card, SNDRV_CTL_EVENT_MASK_VALUE, in avc_maudio_set_special_clk()
220 params->ctl_id_sync); in avc_maudio_set_special_clk()
238 struct special_params *params = bebob->maudio_special_quirk; in special_stream_formation_set()
241 max = SND_BEBOB_STRM_FMT_ENTRIES - 1; in special_stream_formation_set()
242 if (!params->is1814) in special_stream_formation_set()
243 max -= 2; in special_stream_formation_set()
246 bebob->tx_stream_formations[i + 1].pcm = in special_stream_formation_set()
247 ch_table[AMDTP_IN_STREAM][params->dig_in_fmt][i / 2]; in special_stream_formation_set()
248 bebob->tx_stream_formations[i + 1].midi = 1; in special_stream_formation_set()
250 bebob->rx_stream_formations[i + 1].pcm = in special_stream_formation_set()
251 ch_table[AMDTP_OUT_STREAM][params->dig_out_fmt][i / 2]; in special_stream_formation_set()
252 bebob->rx_stream_formations[i + 1].midi = 1; in special_stream_formation_set()
263 params = devm_kzalloc(&bebob->card->card_dev, in snd_bebob_maudio_special_discover()
266 return -ENOMEM; in snd_bebob_maudio_special_discover()
268 mutex_lock(&bebob->mutex); in snd_bebob_maudio_special_discover()
270 bebob->maudio_special_quirk = (void *)params; in snd_bebob_maudio_special_discover()
271 params->is1814 = is1814; in snd_bebob_maudio_special_discover()
274 bebob->rx_stream.context = ERR_PTR(-1); in snd_bebob_maudio_special_discover()
275 bebob->tx_stream.context = ERR_PTR(-1); in snd_bebob_maudio_special_discover()
278 dev_err(&bebob->unit->device, in snd_bebob_maudio_special_discover()
289 if (params->is1814) { in snd_bebob_maudio_special_discover()
290 bebob->midi_input_ports = 1; in snd_bebob_maudio_special_discover()
291 bebob->midi_output_ports = 1; in snd_bebob_maudio_special_discover()
293 bebob->midi_input_ports = 2; in snd_bebob_maudio_special_discover()
294 bebob->midi_output_ports = 2; in snd_bebob_maudio_special_discover()
297 mutex_unlock(&bebob->mutex); in snd_bebob_maudio_special_discover()
308 err = avc_general_get_sig_fmt(bebob->unit, rate, in special_get_rate()
310 } while (err == -EAGAIN && ++trials < 3); in special_get_rate()
316 struct special_params *params = bebob->maudio_special_quirk; in special_set_rate()
319 err = avc_general_set_sig_fmt(bebob->unit, rate, in special_set_rate()
330 err = avc_general_set_sig_fmt(bebob->unit, rate, in special_set_rate()
335 if (params->ctl_id_sync) in special_set_rate()
336 snd_ctl_notify(bebob->card, SNDRV_CTL_EVENT_MASK_VALUE, in special_set_rate()
337 params->ctl_id_sync); in special_set_rate()
351 struct special_params *params = bebob->maudio_special_quirk; in special_clk_get()
352 *id = params->clk_src; in special_clk_get()
371 struct special_params *params = bebob->maudio_special_quirk; in special_clk_ctl_get()
372 uval->value.enumerated.item[0] = params->clk_src; in special_clk_ctl_get()
379 struct special_params *params = bebob->maudio_special_quirk; in special_clk_ctl_put()
382 id = uval->value.enumerated.item[0]; in special_clk_ctl_put()
384 return -EINVAL; in special_clk_ctl_put()
386 mutex_lock(&bebob->mutex); in special_clk_ctl_put()
389 params->dig_in_fmt, in special_clk_ctl_put()
390 params->dig_out_fmt, in special_clk_ctl_put()
391 params->clk_lock); in special_clk_ctl_put()
392 mutex_unlock(&bebob->mutex); in special_clk_ctl_put()
412 einf->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; in special_sync_ctl_info()
413 einf->count = 1; in special_sync_ctl_info()
414 einf->value.integer.min = 0; in special_sync_ctl_info()
415 einf->value.integer.max = 1; in special_sync_ctl_info()
428 uval->value.integer.value[0] = synced; in special_sync_ctl_get()
455 struct special_params *params = bebob->maudio_special_quirk; in special_dig_in_iface_ctl_get()
459 mutex_lock(&bebob->mutex); in special_dig_in_iface_ctl_get()
461 err = avc_audio_get_selector(bebob->unit, 0x00, 0x04, in special_dig_in_iface_ctl_get()
464 dev_err(&bebob->unit->device, in special_dig_in_iface_ctl_get()
470 val = (params->dig_in_fmt << 1) | (dig_in_iface & 0x01); in special_dig_in_iface_ctl_get()
476 uval->value.enumerated.item[0] = val; in special_dig_in_iface_ctl_get()
478 mutex_unlock(&bebob->mutex); in special_dig_in_iface_ctl_get()
485 struct special_params *params = bebob->maudio_special_quirk; in special_dig_in_iface_ctl_set()
489 id = uval->value.enumerated.item[0]; in special_dig_in_iface_ctl_set()
491 return -EINVAL; in special_dig_in_iface_ctl_set()
497 mutex_lock(&bebob->mutex); in special_dig_in_iface_ctl_set()
500 params->clk_src, in special_dig_in_iface_ctl_set()
502 params->dig_out_fmt, in special_dig_in_iface_ctl_set()
503 params->clk_lock); in special_dig_in_iface_ctl_set()
508 if (params->dig_in_fmt > 0) { in special_dig_in_iface_ctl_set()
514 err = avc_audio_set_selector(bebob->unit, 0x00, 0x04, dig_in_iface); in special_dig_in_iface_ctl_set()
516 dev_err(&bebob->unit->device, in special_dig_in_iface_ctl_set()
521 mutex_unlock(&bebob->mutex); in special_dig_in_iface_ctl_set()
548 struct special_params *params = bebob->maudio_special_quirk; in special_dig_out_iface_ctl_get()
549 mutex_lock(&bebob->mutex); in special_dig_out_iface_ctl_get()
550 uval->value.enumerated.item[0] = params->dig_out_fmt; in special_dig_out_iface_ctl_get()
551 mutex_unlock(&bebob->mutex); in special_dig_out_iface_ctl_get()
558 struct special_params *params = bebob->maudio_special_quirk; in special_dig_out_iface_ctl_set()
562 id = uval->value.enumerated.item[0]; in special_dig_out_iface_ctl_set()
564 return -EINVAL; in special_dig_out_iface_ctl_set()
566 mutex_lock(&bebob->mutex); in special_dig_out_iface_ctl_set()
569 params->clk_src, in special_dig_out_iface_ctl_set()
570 params->dig_in_fmt, in special_dig_out_iface_ctl_set()
571 id, params->clk_lock); in special_dig_out_iface_ctl_set()
577 mutex_unlock(&bebob->mutex); in special_dig_out_iface_ctl_set()
592 struct special_params *params = bebob->maudio_special_quirk; in add_special_controls()
596 err = snd_ctl_add(bebob->card, kctl); in add_special_controls()
601 err = snd_ctl_add(bebob->card, kctl); in add_special_controls()
604 params->ctl_id_sync = &kctl->id; in add_special_controls()
607 err = snd_ctl_add(bebob->card, kctl); in add_special_controls()
612 err = snd_ctl_add(bebob->card, kctl); in add_special_controls()
632 unsigned int i, c, channels; in special_meter_get() local
635 channels = ARRAY_SIZE(special_meter_labels) * 2; in special_meter_get()
636 if (size < channels * sizeof(u32)) in special_meter_get()
637 return -EINVAL; in special_meter_get()
640 buf = kmalloc(METER_SIZE_SPECIAL - 4, GFP_KERNEL); in special_meter_get()
642 return -ENOMEM; in special_meter_get()
644 err = get_meter(bebob, (void *)buf, METER_SIZE_SPECIAL - 4); in special_meter_get()
648 /* Its format is u16 and some channels are unknown. */ in special_meter_get()
650 for (c = 2; c < channels + 2; c++) in special_meter_get()
690 const struct snd_bebob_meter_spec *spec = bebob->spec->meter; in normal_meter_get()
691 unsigned int c, channels; in normal_meter_get() local
694 channels = spec->num * 2; in normal_meter_get()
695 if (size < channels * sizeof(u32)) in normal_meter_get()
696 return -EINVAL; in normal_meter_get()
702 for (c = 0; c < channels; c++) in normal_meter_get()
705 /* swap stream channels because inverted */ in normal_meter_get()
706 if (spec->labels == solo_meter_labels) { in normal_meter_get()
720 .num = ARRAY_SIZE(special_clk_types),
725 .num = ARRAY_SIZE(special_meter_labels),
741 .num = ARRAY_SIZE(fw410_meter_labels),
753 .num = ARRAY_SIZE(audiophile_meter_labels),
765 .num = ARRAY_SIZE(solo_meter_labels),
777 .num = ARRAY_SIZE(ozonic_meter_labels),
789 .num = ARRAY_SIZE(nrv10_meter_labels),