Lines Matching +full:tlv +full:- +full:layout
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Quirks and vendor-specific extensions for mixer interfaces
31 #include <sound/tlv.h>
50 * See the quirks for M-Audio FTUs or Ebox-44.
51 * If you don't want to set a TLV callback pass NULL.
70 return -ENOMEM;
72 snd_usb_mixer_elem_init_std(&cval->head, mixer, unitid);
73 cval->val_type = val_type;
74 cval->channels = 1;
75 cval->control = control;
76 cval->cmask = cmask;
77 cval->idx_off = idx_off;
80 * so provide a short-cut for booleans */
81 cval->min = 0;
82 cval->max = 1;
83 cval->res = 0;
84 cval->dBmin = 0;
85 cval->dBmax = 0;
91 return -ENOMEM;
95 snprintf(kctl->id.name, sizeof(kctl->id.name), name);
96 kctl->private_free = snd_usb_mixer_elem_free;
98 /* set TLV */
100 kctl->tlv.c = tlv_callback;
101 kctl->vd[0].access |=
106 return snd_usb_mixer_add_control(&cval->head, kctl);
129 while (t->name != NULL) {
130 err = snd_create_std_mono_ctl(mixer, t->unitid, t->control,
131 t->cmask, t->val_type, t->name, t->tlv_callback);
151 return -ENOMEM;
154 list->mixer = mixer;
155 list->id = id;
156 list->resume = resume;
160 return -ENOMEM;
162 kctl->private_free = snd_usb_mixer_elem_free;
173 * Live! 24-bit: 06 80 xx yy 22 83
186 { USB_ID(0x041e, 0x3040), 2, 2, 6, 6, 2, 0x6e91 }, /* Live! 24-bit */
187 { USB_ID(0x041e, 0x3042), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 */
188 { USB_ID(0x041e, 0x30df), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */
189 { USB_ID(0x041e, 0x3237), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */
190 { USB_ID(0x041e, 0x3263), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */
196 struct usb_mixer_interface *mixer = urb->context;
197 const struct rc_config *rc = mixer->rc_cfg;
200 if (urb->status < 0 || urb->actual_length < rc->min_packet_length)
203 code = mixer->rc_buffer[rc->offset];
204 if (rc->length == 2)
205 code |= mixer->rc_buffer[rc->offset + 1] << 8;
208 if (code == rc->mute_code)
209 snd_usb_mixer_notify_id(mixer, rc->mute_mixer_id);
210 mixer->rc_code = code;
212 wake_up(&mixer->rc_waitq);
218 struct usb_mixer_interface *mixer = hw->private_data;
223 return -EINVAL;
224 err = wait_event_interruptible(mixer->rc_waitq,
225 (rc_code = xchg(&mixer->rc_code, 0)) != 0);
238 struct usb_mixer_interface *mixer = hw->private_data;
240 poll_wait(file, &mixer->rc_waitq, wait);
241 return mixer->rc_code ? EPOLLIN | EPOLLRDNORM : 0;
250 if (rc_configs[i].usb_id == mixer->chip->usb_id)
254 mixer->rc_cfg = &rc_configs[i];
256 len = mixer->rc_cfg->packet_length;
258 init_waitqueue_head(&mixer->rc_waitq);
259 err = snd_hwdep_new(mixer->chip->card, "SB remote control", 0, &hwdep);
262 snprintf(hwdep->name, sizeof(hwdep->name),
263 "%s remote control", mixer->chip->card->shortname);
264 hwdep->iface = SNDRV_HWDEP_IFACE_SB_RC;
265 hwdep->private_data = mixer;
266 hwdep->ops.read = snd_usb_sbrc_hwdep_read;
267 hwdep->ops.poll = snd_usb_sbrc_hwdep_poll;
268 hwdep->exclusive = 1;
270 mixer->rc_urb = usb_alloc_urb(0, GFP_KERNEL);
271 if (!mixer->rc_urb)
272 return -ENOMEM;
273 mixer->rc_setup_packet = kmalloc(sizeof(*mixer->rc_setup_packet), GFP_KERNEL);
274 if (!mixer->rc_setup_packet) {
275 usb_free_urb(mixer->rc_urb);
276 mixer->rc_urb = NULL;
277 return -ENOMEM;
279 mixer->rc_setup_packet->bRequestType =
281 mixer->rc_setup_packet->bRequest = UAC_GET_MEM;
282 mixer->rc_setup_packet->wValue = cpu_to_le16(0);
283 mixer->rc_setup_packet->wIndex = cpu_to_le16(0);
284 mixer->rc_setup_packet->wLength = cpu_to_le16(len);
285 usb_fill_control_urb(mixer->rc_urb, mixer->chip->dev,
286 usb_rcvctrlpipe(mixer->chip->dev, 0),
287 (u8*)mixer->rc_setup_packet, mixer->rc_buffer, len,
296 ucontrol->value.integer.value[0] = kcontrol->private_value >> 8;
303 struct snd_usb_audio *chip = mixer->chip;
310 if (chip->usb_id == USB_ID(0x041e, 0x3042))
311 err = snd_usb_ctl_msg(chip->dev,
312 usb_sndctrlpipe(chip->dev, 0), 0x24,
315 /* USB X-Fi S51 Pro */
316 if (chip->usb_id == USB_ID(0x041e, 0x30df))
317 err = snd_usb_ctl_msg(chip->dev,
318 usb_sndctrlpipe(chip->dev, 0), 0x24,
322 err = snd_usb_ctl_msg(chip->dev,
323 usb_sndctrlpipe(chip->dev, 0), 0x24,
334 struct usb_mixer_interface *mixer = list->mixer;
335 int index = kcontrol->private_value & 0xff;
336 unsigned int value = ucontrol->value.integer.value[0];
337 int old_value = kcontrol->private_value >> 8;
341 return -EINVAL;
344 kcontrol->private_value = (value << 8) | index;
351 int priv_value = list->kctl->private_value;
353 return snd_audigy2nx_led_update(list->mixer, priv_value >> 8,
378 /* USB X-Fi S51 doesn't have a CMSS LED */
379 if ((mixer->chip->usb_id == USB_ID(0x041e, 0x3042)) && i == 0)
381 /* USB X-Fi S51 Pro doesn't have one either */
382 if ((mixer->chip->usb_id == USB_ID(0x041e, 0x30df)) && i == 0)
385 (mixer->chip->usb_id == USB_ID(0x041e, 0x3040) ||
386 mixer->chip->usb_id == USB_ID(0x041e, 0x3042) ||
387 mixer->chip->usb_id == USB_ID(0x041e, 0x30df) ||
388 mixer->chip->usb_id == USB_ID(0x041e, 0x3048)))
414 {-1, NULL}
419 {-1, NULL}
422 struct usb_mixer_interface *mixer = entry->private_data;
426 snd_iprintf(buffer, "%s jacks\n\n", mixer->chip->card->shortname);
427 if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020))
429 else if (mixer->chip->usb_id == USB_ID(0x041e, 0x3040) ||
430 mixer->chip->usb_id == USB_ID(0x041e, 0x3048))
437 err = snd_usb_lock_shutdown(mixer->chip);
440 err = snd_usb_ctl_msg(mixer->chip->dev,
441 usb_rcvctrlpipe(mixer->chip->dev, 0),
445 snd_usb_unlock_shutdown(mixer->chip);
465 ucontrol->value.enumerated.item[0] = kcontrol->private_value;
472 struct snd_usb_audio *chip = mixer->chip;
482 err = snd_usb_ctl_msg(chip->dev,
483 usb_sndctrlpipe(chip->dev, 0), UAC_SET_CUR,
494 struct usb_mixer_interface *mixer = list->mixer;
495 unsigned int value = ucontrol->value.enumerated.item[0];
499 return -EINVAL;
501 if (value == kcontrol->private_value)
504 kcontrol->private_value = value;
511 return snd_emu0204_ch_switch_update(list->mixer,
512 list->kctl->private_value);
536 ucontrol->value.integer.value[0] = !!(kcontrol->private_value & 0x02);
543 struct snd_usb_audio *chip = mixer->chip;
549 err = snd_usb_ctl_msg(chip->dev,
550 usb_sndctrlpipe(chip->dev, 0), 0x08,
564 old_status = kcontrol->private_value;
565 if (ucontrol->value.integer.value[0])
572 kcontrol->private_value = new_status;
573 err = snd_xonar_u1_switch_update(list->mixer, new_status);
579 return snd_xonar_u1_switch_update(list->mixer,
580 list->kctl->private_value);
608 err = snd_usb_ctl_msg(chip->dev,
609 usb_rcvctrlpipe(chip->dev, 0), 0x81,
623 /* 2 possibilities: Internal -> expects sample rate
624 * S/PDIF sync -> expects rate = 0
633 return snd_usb_ctl_msg(chip->dev,
634 usb_sndctrlpipe(chip->dev, 0), 0x1,
641 /* Hardware gives 2 possibilities: ANALOG Source -> 0x01
642 * S/PDIF Source -> 0x02
648 err = snd_usb_ctl_msg(chip->dev,
649 usb_rcvctrlpipe(chip->dev, 0), 0x81,
662 * Hardware expects 2 possibilities: ANALOG Source -> 0x01
663 * S/PDIF Source -> 0x02
670 return snd_usb_ctl_msg(chip->dev,
671 usb_sndctrlpipe(chip->dev, 0), 0x1,
682 struct snd_usb_audio *chip = list->mixer->chip;
693 kctl->private_value = err;
695 ucontrol->value.enumerated.item[0] = kctl->private_value;
703 struct snd_usb_audio *chip = mixer->chip;
733 struct usb_mixer_interface *mixer = list->mixer;
737 cur_val = kctl->private_value;
738 new_val = ucontrol->value.enumerated.item[0];
742 kctl->private_value = new_val;
760 return snd_mbox1_clk_switch_update(list->mixer, list->kctl->private_value);
768 ucontrol->value.enumerated.item[0] = kctl->private_value;
774 struct snd_usb_audio *chip = mixer->chip;
803 struct usb_mixer_interface *mixer = list->mixer;
807 cur_val = kctl->private_value;
808 new_val = ucontrol->value.enumerated.item[0];
812 kctl->private_value = new_val;
830 return snd_mbox1_src_switch_update(list->mixer, list->kctl->private_value);
876 struct usb_device *dev = mixer->chip->dev;
877 unsigned int pval = kctl->private_value;
886 dev_err(&dev->dev,
891 kctl->private_value |= ((unsigned int)value << 24);
898 ucontrol->value.integer.value[0] = kcontrol->private_value >> 24;
904 struct snd_usb_audio *chip = list->mixer->chip;
905 unsigned int pval = list->kctl->private_value;
911 err = usb_control_msg(chip->dev, usb_sndctrlpipe(chip->dev, 0),
923 u8 oldval = (kcontrol->private_value >> 24) & 0xff;
924 u8 newval = ucontrol->value.integer.value[0];
930 kcontrol->private_value &= ~(0xff << 24);
931 kcontrol->private_value |= (unsigned int)newval << 24;
1014 snd_ni_control_init_val(mixer, list->kctl);
1020 /* M-Audio FastTrack Ultra quirks */
1036 struct usb_device *dev = mixer->chip->dev;
1037 unsigned int pval = kctl->private_value;
1047 snd_usb_ctrl_intf(mixer->hostif) | ((pval & 0xff) << 8),
1052 kctl->private_value |= (unsigned int)value[0] << 24;
1059 ucontrol->value.enumerated.item[0] = kctl->private_value >> 24;
1065 struct snd_usb_audio *chip = list->mixer->chip;
1066 unsigned int pval = list->kctl->private_value;
1076 err = snd_usb_ctl_msg(chip->dev,
1077 usb_sndctrlpipe(chip->dev, 0),
1081 snd_usb_ctrl_intf(list->mixer->hostif) | ((pval & 0xff) << 8),
1091 unsigned int pval = list->kctl->private_value;
1095 new_val = ucontrol->value.enumerated.item[0];
1099 kctl->private_value &= ~(0xff << 24);
1100 kctl->private_value |= new_val << 24;
1125 list->kctl->private_value = (validx << 8) | bUnitID;
1126 snd_ftu_eff_switch_init(mixer, list->kctl);
1145 "AIn%d - Out%d Capture Volume",
1156 "DIn%d - Out%d Playback Volume",
1157 in - 7, out + 1);
1255 "Effect Send DIn%d Volume", ch - 7);
1307 list_for_each_entry(mixer, &chip->mixer_list, list) {
1308 if (mixer->id_elems[unitid]) {
1309 cval = mixer_elem_list_to_info(mixer->id_elems[unitid]);
1311 cval->control << 8,
1319 /* M-Audio Fast Track C400/C600 */
1333 switch (mixer->chip->usb_id) {
1348 "PCM%d-Out%d Playback Volume",
1352 "In%d-Out%d Playback Volume",
1353 chan - num_outs + 1, out + 1);
1356 cmask = (out == 0) ? 0 : BIT(out - 1);
1420 switch (mixer->chip->usb_id) {
1439 chan - num_outs + 1);
1442 cmask = (chan == 0) ? 0 : BIT(chan - 1);
1465 switch (mixer->chip->usb_id) {
1484 BIT(chan + (chan % 2) * num_outs - 1);
1531 * The mixer units for Ebox-44 are corrupt, and even where they
1608 * AES0: [0 0 0 0 2.3 2.2 2.1 2.0] - default 0x00
1609 * AES1: [3.3 3.2.3.1.3.0 2.7 2.6 2.5 2.4] - default: 0x01
1611 * AES3: [0 0 0 0 0 0 x 0] - 'x' bit is set basing on standard usb request
1623 * 0 - on (0x28 register value)
1624 * 1 - off (0x2a register value)
1630 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
1631 uinfo->count = 1;
1639 struct snd_usb_audio *chip = list->mixer->chip;
1651 ucontrol->value.iec958.status[0] = kcontrol->private_value & 0xff;
1652 ucontrol->value.iec958.status[1] = (kcontrol->private_value >> 8) & 0xff;
1653 ucontrol->value.iec958.status[2] = 0x00;
1656 iface = usb_ifnum_to_if(chip->dev, 1);
1657 if (!iface || iface->num_altsetting < 2) {
1658 err = -EINVAL;
1661 alts = &iface->altsetting[1];
1662 if (get_iface_desc(alts)->bNumEndpoints < 1) {
1663 err = -EINVAL;
1666 ep = get_endpoint(alts, 0)->bEndpointAddress;
1668 err = snd_usb_ctl_msg(chip->dev,
1669 usb_rcvctrlpipe(chip->dev, 0),
1680 ucontrol->value.iec958.status[3] = (rate == 48000) ?
1691 struct snd_usb_audio *chip = list->mixer->chip;
1692 unsigned int pval = list->kctl->private_value;
1701 err = snd_usb_ctl_msg(chip->dev,
1702 usb_sndctrlpipe(chip->dev, 0),
1714 err = snd_usb_ctl_msg(chip->dev,
1715 usb_sndctrlpipe(chip->dev, 0),
1737 pval = pval_old = kcontrol->private_value;
1739 pval |= (ucontrol->value.iec958.status[1] & 0x0f) << 8;
1740 pval |= (ucontrol->value.iec958.status[0] & 0x0f);
1743 pval |= (ucontrol->value.iec958.status[1] & 0xf0) << 8;
1752 kcontrol->private_value = pval;
1760 ucontrol->value.iec958.status[0] = 0x0f;
1761 ucontrol->value.iec958.status[1] = 0xff;
1762 ucontrol->value.iec958.status[2] = 0x00;
1763 ucontrol->value.iec958.status[3] = 0x00;
1771 ucontrol->value.integer.value[0] = !(kcontrol->private_value & 0x02);
1778 struct snd_usb_audio *chip = list->mixer->chip;
1779 u8 reg = list->kctl->private_value;
1786 err = snd_usb_ctl_msg(chip->dev,
1787 usb_sndctrlpipe(chip->dev, 0),
1806 reg = ucontrol->value.integer.value[0] ? 0x28 : 0x2a;
1807 if (reg != list->kctl->private_value)
1810 kcontrol->private_value = reg;
1867 ucontrol->value.integer.value[0] = kcontrol->private_value;
1874 struct snd_usb_audio *chip = mixer->chip;
1884 err = snd_usb_ctl_msg(chip->dev,
1885 usb_sndctrlpipe(chip->dev, 0), HID_REQ_SET_REPORT,
1896 unsigned char value = !!ucontrol->value.integer.value[0];
1899 if (kcontrol->private_value == value)
1901 kcontrol->private_value = value;
1902 err = snd_soundblaster_e1_switch_update(list->mixer, value);
1908 return snd_soundblaster_e1_switch_update(list->mixer,
1909 list->kctl->private_value);
1945 * vendor-type USB messages.
1970 struct usb_device *dev = chip->dev;
1980 struct usb_device *dev = chip->dev;
2002 struct usb_mixer_elem_info *cval = kcontrol->private_data;
2003 struct snd_usb_audio *chip = cval->head.mixer->chip;
2004 u32 pv = kcontrol->private_value;
2041 ucontrol->value.integer.value[0] = presence;
2055 snd_ctl_notify(list->mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
2056 &list->kctl->id);
2068 return -ENOMEM;
2069 snd_usb_mixer_elem_init_std(&cval->head, mixer,
2071 cval->head.resume = realtek_resume_jack;
2072 cval->val_type = USB_MIXER_BOOLEAN;
2073 cval->channels = 1;
2074 cval->min = 0;
2075 cval->max = 1;
2079 return -ENOMEM;
2081 kctl->private_value = val;
2082 strscpy(kctl->id.name, name, sizeof(kctl->id.name));
2083 kctl->private_free = snd_usb_mixer_elem_free;
2084 return snd_usb_mixer_add_control(&cval->head, kctl);
2090 struct usb_device *dev = mixer->chip->dev;
2093 realtek_hda_set(mixer->chip,
2121 struct snd_usb_audio *chip = mixer->chip;
2124 snd_usb_ctl_msg(chip->dev, usb_sndctrlpipe(chip->dev, 0), UAC_SET_CUR,
2127 snd_usb_ctrl_intf(mixer->hostif) | (id << 8),
2202 struct usb_device *dev = chip->dev;
2211 dev_err(&dev->dev,
2221 struct snd_usb_audio *chip = list->mixer->chip;
2243 switch (kcontrol->private_value) {
2260 return -EINVAL;
2262 ucontrol->value.integer.value[0] = rate;
2276 switch (kcontrol->private_value) {
2290 return -EINVAL;
2292 ucontrol->value.enumerated.item[0] = idx;
2305 ucontrol->value.enumerated.item[0] = SND_RME_SPDIF_IF(status1);
2318 ucontrol->value.enumerated.item[0] = SND_RME_SPDIF_FORMAT(status1);
2331 ucontrol->value.enumerated.item[0] = SND_RME_CLK_SYNC(status1);
2339 struct snd_usb_audio *chip = list->mixer->chip;
2357 ucontrol->value.integer.value[0] = freq;
2367 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
2368 uinfo->count = 1;
2369 switch (kcontrol->private_value) {
2371 uinfo->value.integer.min = 32000;
2372 uinfo->value.integer.max = 800000;
2377 uinfo->value.integer.min = 0;
2378 uinfo->value.integer.max = 200000;
2380 uinfo->value.integer.step = 0;
2521 * Volume control is linear, from -inf (dec. 0) to +6dB (dec. 65536) with
2550 #define SND_BBFPRO_MIXER_VAL_MIN 0 // -inf
2570 struct snd_usb_audio *chip = mixer->chip;
2591 err = snd_usb_ctl_msg(chip->dev,
2592 usb_sndctrlpipe(chip->dev, 0), usb_req,
2606 pv = kcontrol->private_value;
2609 val = kcontrol->private_value >> SND_BBFPRO_CTL_VAL_SHIFT;
2616 ucontrol->value.enumerated.item[0] = val;
2618 ucontrol->value.integer.value[0] = val;
2629 pv = kcontrol->private_value;
2644 "-10dBV",
2650 uinfo->count = 1;
2651 uinfo->value.integer.min = 0;
2652 uinfo->value.integer.max = 1;
2653 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
2665 struct usb_mixer_interface *mixer = list->mixer;
2667 pv = kcontrol->private_value;
2677 val = ucontrol->value.enumerated.item[0];
2679 val = ucontrol->value.integer.value[0];
2683 return -EINVAL;
2688 kcontrol->private_value = reg
2701 pv = list->kctl->private_value;
2706 return snd_bbfpro_ctl_update(list->mixer, reg, idx, value);
2713 struct snd_usb_audio *chip = mixer->chip;
2716 // XLR preamp: 3-bit fine, 5-bit coarse; special case >60
2727 err = snd_usb_ctl_msg(chip->dev,
2728 usb_sndctrlpipe(chip->dev, 0),
2740 int value = kcontrol->private_value & SND_BBFPRO_GAIN_VAL_MASK;
2742 ucontrol->value.integer.value[0] = value;
2751 pv = kcontrol->private_value;
2755 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
2756 uinfo->count = 1;
2757 uinfo->value.integer.min = SND_BBFPRO_GAIN_VAL_MIN;
2760 uinfo->value.integer.max = SND_BBFPRO_GAIN_VAL_MIC_MAX;
2762 uinfo->value.integer.max = SND_BBFPRO_GAIN_VAL_LINE_MAX;
2773 struct usb_mixer_interface *mixer = list->mixer;
2775 pv = kcontrol->private_value;
2779 value = ucontrol->value.integer.value[0];
2782 return -EINVAL;
2786 return -EINVAL;
2789 return -EINVAL;
2799 kcontrol->private_value =
2807 struct snd_kcontrol *kctl = list->kctl;
2809 pv = kctl->private_value;
2814 return snd_bbfpro_gain_update(list->mixer, channel, value);
2820 struct snd_usb_audio *chip = mixer->chip;
2836 err = snd_usb_ctl_msg(chip->dev,
2837 usb_sndctrlpipe(chip->dev, 0),
2850 ucontrol->value.integer.value[0] =
2851 kcontrol->private_value >> SND_BBFPRO_MIXER_VAL_SHIFT;
2858 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
2859 uinfo->count = 1;
2860 uinfo->value.integer.min = SND_BBFPRO_MIXER_VAL_MIN;
2861 uinfo->value.integer.max = SND_BBFPRO_MIXER_VAL_MAX;
2872 struct usb_mixer_interface *mixer = list->mixer;
2874 uvalue = ucontrol->value.integer.value[0];
2875 idx = kcontrol->private_value & SND_BBFPRO_MIXER_IDX_MASK;
2876 old_value = kcontrol->private_value >> SND_BBFPRO_MIXER_VAL_SHIFT;
2879 return -EINVAL;
2886 kcontrol->private_value = idx
2895 int pv = list->kctl->private_value;
2899 return snd_bbfpro_vol_update(list->mixer, idx, val);
2985 "%s-%s-%s Playback Volume",
2994 "PCM-%s-%s Playback Volume",
3005 snprintf(name, sizeof(name), "Main-Out %s", output[i]);
3017 snprintf(name, sizeof(name), "Mic-%s Gain", input[i]);
3019 snprintf(name, sizeof(name), "Line-%s Gain", input[i]);
3054 "Mic-AN1 48V");
3060 "Mic-AN2 48V");
3066 "Line-IN3 Sens.");
3072 "Line-IN4 Sens.");
3078 "Mic-AN1 PAD");
3084 "Mic-AN2 PAD");
3108 /* Reg is overloaded, 0-7 for status halfwords or 16 or 18 for control registers */
3113 #define field_get(_mask, _reg) (((_reg) & (_mask)) >> (ffs(_mask) - 1))
3114 #define field_prep(_mask, _val) (((_val) << (ffs(_mask) - 1)) & (_mask))
3119 struct snd_usb_audio *chip = list->mixer->chip;
3120 struct usb_device *dev = chip->dev;
3128 dev_err(&dev->dev,
3137 struct snd_usb_audio *chip = list->mixer->chip;
3138 struct usb_device *dev = chip->dev;
3148 dev_err(&dev->dev,
3162 bool invert = kcontrol->private_value & RME_DIGIFACE_INVERT;
3163 u8 reg = (kcontrol->private_value >> 16) & 0xff;
3164 u16 mask = kcontrol->private_value & 0xffff;
3182 return -EINVAL;
3204 return -EIO;
3206 ucontrol->value.integer.value[0] = snd_rme_rate_table[freq];
3218 ucontrol->value.enumerated.item[0] = val;
3225 bool invert = kcontrol->private_value & RME_DIGIFACE_INVERT;
3226 u8 reg = (kcontrol->private_value >> 16) & 0xff;
3227 u16 mask = kcontrol->private_value & 0xffff;
3228 u16 val = field_prep(mask, ucontrol->value.enumerated.item[0]);
3242 if (ucontrol->value.enumerated.item[0] == 7)
3243 ucontrol->value.enumerated.item[0] = 0;
3259 valid = status[0] & BIT(kcontrol->private_value);
3260 sync = status[0] & BIT(5 + kcontrol->private_value);
3263 ucontrol->value.enumerated.item[0] = SND_RME_CLOCK_NOLOCK;
3265 ucontrol->value.enumerated.item[0] = SND_RME_CLOCK_LOCK;
3267 ucontrol->value.enumerated.item[0] = SND_RME_CLOCK_SYNC;
3298 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
3299 uinfo->count = 1;
3300 uinfo->value.integer.min = 0;
3301 uinfo->value.integer.max = 200000;
3302 uinfo->value.integer.step = 0;
3465 * stand-alone operation when the PCM is closed.
3503 * These devices generally have options for soft-switching the playback and
3545 // kcontrol->private_value layout
3592 case 0x0000: return "-19dB";
3593 case 0x0100: return "-15dB";
3594 case 0x0200: return "-10dB";
3595 case 0x0300: return "-5dB";
3600 // The DJM-A9 has different capture levels than other, older models
3641 // The DJM-850 has different values for CD/LINE and LINE capture
3693 // DJM-250MK2
3718 // DJM-450
3743 // DJM-750
3762 // DJM-850
3781 // DJM-900NXS2
3802 // DJM-750MK2
3832 // DJM-A9
3868 unsigned long private_value = kctl->private_value;
3876 if (ctl_idx >= device->ncontrols)
3877 return -EINVAL;
3879 ctl = &device->controls[ctl_idx];
3880 noptions = ctl->noptions;
3881 if (info->value.enumerated.item >= noptions)
3882 info->value.enumerated.item = noptions - 1;
3885 ctl->options[info->value.enumerated.item],
3886 ctl->wIndex);
3888 return -EINVAL;
3890 strscpy(info->value.enumerated.name, name, sizeof(info->value.enumerated.name));
3891 info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3892 info->count = 1;
3893 info->value.enumerated.items = noptions;
3903 if ((group >= device->ncontrols) || value >= device->controls[group].noptions)
3904 return -EINVAL;
3906 err = snd_usb_lock_shutdown(mixer->chip);
3911 mixer->chip->dev, usb_sndctrlpipe(mixer->chip->dev, 0),
3914 device->controls[group].options[value],
3915 device->controls[group].wIndex,
3918 snd_usb_unlock_shutdown(mixer->chip);
3925 elem->value.enumerated.item[0] = kctl->private_value & SND_DJM_VALUE_MASK;
3932 struct usb_mixer_interface *mixer = list->mixer;
3933 unsigned long private_value = kctl->private_value;
3937 u16 value = elem->value.enumerated.item[0];
3939 kctl->private_value = (((unsigned long)device << SND_DJM_DEVICE_SHIFT) |
3948 unsigned long private_value = list->kctl->private_value;
3953 return snd_djm_controls_update(list->mixer, device, group, value);
3973 for (i = 0; i < device->ncontrols; i++) {
3974 value = device->controls[i].default_value;
3975 knew.name = device->controls[i].name;
3999 switch (mixer->chip->usb_id) {
4000 /* Tascam US-16x08 */
4012 snd_card_ro_proc_new(mixer->chip->card, "audigy2nx",
4021 case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */
4022 case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C400 */
4026 case USB_ID(0x0763, 0x2080): /* M-Audio Fast Track Ultra */
4027 case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */
4057 case USB_ID(0x200c, 0x1018): /* Electrix Ebox-44 */
4106 case USB_ID(0x2a39, 0x3fd2): /* RME ADI-2 Pro */
4107 case USB_ID(0x2a39, 0x3fd3): /* RME ADI-2 DAC */
4122 case USB_ID(0x2b73, 0x0017): /* Pioneer DJ DJM-250MK2 */
4125 case USB_ID(0x2b73, 0x0013): /* Pioneer DJ DJM-450 */
4128 case USB_ID(0x08e4, 0x017f): /* Pioneer DJ DJM-750 */
4131 case USB_ID(0x2b73, 0x001b): /* Pioneer DJ DJM-750MK2 */
4134 case USB_ID(0x08e4, 0x0163): /* Pioneer DJ DJM-850 */
4137 case USB_ID(0x2b73, 0x000a): /* Pioneer DJ DJM-900NXS2 */
4140 case USB_ID(0x2b73, 0x003c): /* Pioneer DJ / AlphaTheta DJM-A9 */
4150 switch (mixer->chip->usb_id) {
4160 if (!mixer->rc_cfg)
4165 mixer->rc_urb->dev = mixer->chip->dev;
4166 usb_submit_urb(mixer->rc_urb, GFP_ATOMIC);
4173 /* live24ext: 4 = line-in jack */
4174 case 3: /* hp-out jack (may actuate Mute) */
4175 if (mixer->chip->usb_id == USB_ID(0x041e, 0x3040) ||
4176 mixer->chip->usb_id == USB_ID(0x041e, 0x3048))
4177 snd_usb_mixer_notify_id(mixer, mixer->rc_cfg->mute_mixer_id);
4180 usb_audio_dbg(mixer->chip, "memory change in unknown unit %d\n", unitid);
4192 0, 1, TLV_DB_MINMAX_ITEM(-5300, -4970),
4193 2, 5, TLV_DB_MINMAX_ITEM(-4710, -4160),
4194 6, 7, TLV_DB_MINMAX_ITEM(-3884, -3710),
4195 8, 14, TLV_DB_MINMAX_ITEM(-3443, -2560),
4196 15, 16, TLV_DB_MINMAX_ITEM(-2475, -2324),
4197 17, 19, TLV_DB_MINMAX_ITEM(-2228, -2031),
4198 20, 26, TLV_DB_MINMAX_ITEM(-1910, -1393),
4199 27, 31, TLV_DB_MINMAX_ITEM(-1322, -1032),
4200 32, 40, TLV_DB_MINMAX_ITEM(-968, -490),
4201 41, 50, TLV_DB_MINMAX_ITEM(-441, 0),
4204 if (cval->min == 0 && cval->max == 50) {
4205 usb_audio_info(mixer->chip, "applying DragonFly dB scale quirk (0-50 variant)\n");
4206 kctl->tlv.p = scale;
4207 kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
4208 kctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK;
4210 } else if (cval->min == 0 && cval->max <= 1000) {
4214 usb_audio_info(mixer->chip, "ignoring too narrow dB range on a DragonFly device");
4215 kctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK;
4223 switch (mixer->chip->usb_id) {
4225 if (unitid == 7 && cval->control == UAC_FU_VOLUME)
4229 case USB_ID(0x0d8c, 0x000c): /* C-Media */
4230 case USB_ID(0x0d8c, 0x0014): /* C-Media */
4231 case USB_ID(0x19f7, 0x0003): /* RODE NT-USB */
4232 if (strstr(kctl->id.name, "Playback"))
4233 cval->min_mute = 1;