Lines Matching full:mixer

22 /* Mixer Interface for the Focusrite Scarlett 6i6/18i8/18i20 Gen 2 audio
35 * This ALSA mixer gives access to:
36 * - input, output, mixer-matrix muxes
37 * - 18x10 mixer-matrix gain stages
58 * | | Mixer | | |
103 #include "mixer.h"
114 /* mixer range from -80dB to +6dB in 0.5dB steps */
121 /* map from (dB + 80) * 2 to mixer value
148 /* Maximum number of inputs to the mixer */
151 /* Maximum number of outputs from the mixer */
169 * - Mixer I/O
204 * - dst_descr: printf format string for mixer controls
224 struct usb_mixer_interface *mixer; member
289 .dst_descr = "Mixer Input %02d Capture"
355 .dst_descr = "Mixer Input %02d Capture"
426 .dst_descr = "Mixer Input %02d Capture"
587 struct usb_mixer_interface *mixer, u32 cmd, in scarlett2_usb() argument
590 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_usb()
617 err = snd_usb_ctl_msg(mixer->chip->dev, in scarlett2_usb()
618 usb_sndctrlpipe(mixer->chip->dev, 0), in scarlett2_usb()
628 mixer->chip, in scarlett2_usb()
637 err = snd_usb_ctl_msg(mixer->chip->dev, in scarlett2_usb()
638 usb_sndctrlpipe(mixer->chip->dev, 0), in scarlett2_usb()
650 mixer->chip, in scarlett2_usb()
663 mixer->chip, in scarlett2_usb()
688 static void scarlett2_config_save(struct usb_mixer_interface *mixer) in scarlett2_config_save() argument
692 scarlett2_usb(mixer, SCARLETT2_USB_DATA_CMD, in scarlett2_config_save()
703 scarlett2_config_save(private->mixer); in scarlett2_config_save_work()
710 struct usb_mixer_interface *mixer, in scarlett2_usb_set_config() argument
722 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_usb_set_config()
731 err = scarlett2_usb(mixer, SCARLETT2_USB_SET_DATA, in scarlett2_usb_set_config()
739 err = scarlett2_usb(mixer, SCARLETT2_USB_DATA_CMD, in scarlett2_usb_set_config()
752 struct usb_mixer_interface *mixer, in scarlett2_usb_get() argument
762 return scarlett2_usb(mixer, SCARLETT2_USB_GET_DATA, in scarlett2_usb_get()
768 struct usb_mixer_interface *mixer, in scarlett2_usb_get_config() argument
775 return scarlett2_usb_get(mixer, config_item.offset, buf, size); in scarlett2_usb_get_config()
780 struct usb_mixer_interface *mixer, in scarlett2_usb_get_volume_status() argument
783 return scarlett2_usb_get(mixer, SCARLETT2_USB_VOLUME_STATUS_OFFSET, in scarlett2_usb_get_volume_status()
790 static int scarlett2_usb_set_mix(struct usb_mixer_interface *mixer, in scarlett2_usb_set_mix() argument
793 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_usb_set_mix()
812 return scarlett2_usb(mixer, SCARLETT2_USB_SET_MIX, in scarlett2_usb_set_mix()
836 static int scarlett2_usb_set_mux(struct usb_mixer_interface *mixer) in scarlett2_usb_set_mux() argument
838 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_usb_set_mux()
899 err = scarlett2_usb(mixer, SCARLETT2_USB_SET_MUX, in scarlett2_usb_set_mux()
910 static int scarlett2_usb_get_meter_levels(struct usb_mixer_interface *mixer, in scarlett2_usb_get_meter_levels() argument
924 err = scarlett2_usb(mixer, SCARLETT2_USB_GET_METER_LEVELS, in scarlett2_usb_get_meter_levels()
939 static int scarlett2_add_new_ctl(struct usb_mixer_interface *mixer, in scarlett2_add_new_ctl() argument
952 elem->head.mixer = mixer; in scarlett2_add_new_ctl()
981 static int scarlett2_update_volumes(struct usb_mixer_interface *mixer) in scarlett2_update_volumes() argument
983 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_update_volumes()
992 err = scarlett2_usb_get_volume_status(mixer, &volume_status); in scarlett2_update_volumes()
1028 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_master_volume_ctl_get() local
1029 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_master_volume_ctl_get()
1033 scarlett2_update_volumes(mixer); in scarlett2_master_volume_ctl_get()
1045 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_volume_ctl_get() local
1046 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_volume_ctl_get()
1051 scarlett2_update_volumes(mixer); in scarlett2_volume_ctl_get()
1063 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_volume_ctl_put() local
1064 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_volume_ctl_put()
1077 err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_LINE_OUT_VOLUME, in scarlett2_volume_ctl_put()
1130 struct scarlett2_mixer_data *private = elem->head.mixer->private_data; in scarlett2_sw_hw_enum_ctl_get()
1141 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_sw_hw_enum_ctl_put() local
1142 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_sw_hw_enum_ctl_put()
1172 mixer, SCARLETT2_CONFIG_LINE_OUT_VOLUME, in scarlett2_sw_hw_enum_ctl_put()
1178 snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_INFO, in scarlett2_sw_hw_enum_ctl_put()
1182 err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_SW_HW_SWITCH, in scarlett2_sw_hw_enum_ctl_put()
1214 struct scarlett2_mixer_data *private = elem->head.mixer->private_data; in scarlett2_level_enum_ctl_get()
1225 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_level_enum_ctl_put() local
1226 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_level_enum_ctl_put()
1242 err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_LEVEL_SWITCH, in scarlett2_level_enum_ctl_put()
1264 struct scarlett2_mixer_data *private = elem->head.mixer->private_data; in scarlett2_pad_ctl_get()
1275 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_pad_ctl_put() local
1276 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_pad_ctl_put()
1292 err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_PAD_SWITCH, in scarlett2_pad_ctl_put()
1314 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_button_ctl_get() local
1315 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_button_ctl_get()
1319 scarlett2_update_volumes(mixer); in scarlett2_button_ctl_get()
1331 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_button_ctl_put() local
1332 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_button_ctl_put()
1348 err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_BUTTONS, in scarlett2_button_ctl_put()
1366 static int scarlett2_add_line_out_ctls(struct usb_mixer_interface *mixer) in scarlett2_add_line_out_ctls() argument
1368 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_add_line_out_ctls()
1379 err = scarlett2_add_new_ctl(mixer, in scarlett2_add_line_out_ctls()
1398 err = scarlett2_add_new_ctl(mixer, in scarlett2_add_line_out_ctls()
1414 err = scarlett2_add_new_ctl(mixer, in scarlett2_add_line_out_ctls()
1424 err = scarlett2_add_new_ctl(mixer, &scarlett2_button_ctl, in scarlett2_add_line_out_ctls()
1436 static int scarlett2_add_line_in_ctls(struct usb_mixer_interface *mixer) in scarlett2_add_line_in_ctls() argument
1438 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_add_line_in_ctls()
1446 err = scarlett2_add_new_ctl(mixer, &scarlett2_level_enum_ctl, in scarlett2_add_line_in_ctls()
1455 err = scarlett2_add_new_ctl(mixer, &scarlett2_pad_ctl, in scarlett2_add_line_in_ctls()
1464 /*** Mixer Volume Controls ***/
1483 struct scarlett2_mixer_data *private = elem->head.mixer->private_data; in scarlett2_mixer_ctl_get()
1493 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_mixer_ctl_put() local
1494 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_mixer_ctl_put()
1510 err = scarlett2_usb_set_mix(mixer, mix_num); in scarlett2_mixer_ctl_put()
1537 static int scarlett2_add_mixer_ctls(struct usb_mixer_interface *mixer) in scarlett2_add_mixer_ctls() argument
1539 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_add_mixer_ctls()
1553 err = scarlett2_add_new_ctl(mixer, &scarlett2_mixer_ctl, in scarlett2_add_mixer_ctls()
1569 struct scarlett2_mixer_data *private = elem->head.mixer->private_data; in scarlett2_mux_src_enum_ctl_info()
1601 struct scarlett2_mixer_data *private = elem->head.mixer->private_data; in scarlett2_mux_src_enum_ctl_get()
1611 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_mux_src_enum_ctl_put() local
1612 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_mux_src_enum_ctl_put()
1626 err = scarlett2_usb_set_mux(mixer); in scarlett2_mux_src_enum_ctl_put()
1643 static int scarlett2_add_mux_enums(struct usb_mixer_interface *mixer) in scarlett2_add_mux_enums() argument
1645 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_add_mux_enums()
1662 err = scarlett2_add_new_ctl(mixer, in scarlett2_add_mux_enums()
1695 err = scarlett2_usb_get_meter_levels(elem->head.mixer, meter_levels); in scarlett2_meter_ctl_get()
1713 static int scarlett2_add_meter_ctl(struct usb_mixer_interface *mixer) in scarlett2_add_meter_ctl() argument
1715 return scarlett2_add_new_ctl(mixer, &scarlett2_meter_ctl, in scarlett2_add_meter_ctl()
1722 static void scarlett2_private_free(struct usb_mixer_interface *mixer) in scarlett2_private_free() argument
1724 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_private_free()
1728 mixer->private_data = NULL; in scarlett2_private_free()
1731 static void scarlett2_private_suspend(struct usb_mixer_interface *mixer) in scarlett2_private_suspend() argument
1733 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_private_suspend()
1736 scarlett2_config_save(private->mixer); in scarlett2_private_suspend()
1807 static int scarlett2_init_private(struct usb_mixer_interface *mixer, in scarlett2_init_private() argument
1822 private->mixer = mixer; in scarlett2_init_private()
1823 mixer->private_data = private; in scarlett2_init_private()
1824 mixer->private_free = scarlett2_private_free; in scarlett2_init_private()
1825 mixer->private_suspend = scarlett2_private_suspend; in scarlett2_init_private()
1831 return scarlett2_usb(mixer, SCARLETT2_USB_INIT_SEQ, NULL, 0, NULL, 0); in scarlett2_init_private()
1835 static int scarlett2_read_configs(struct usb_mixer_interface *mixer) in scarlett2_read_configs() argument
1837 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_read_configs()
1849 mixer, in scarlett2_read_configs()
1861 mixer, in scarlett2_read_configs()
1871 err = scarlett2_usb_get_volume_status(mixer, &volume_status); in scarlett2_read_configs()
1902 struct usb_mixer_interface *mixer) in scarlett2_mixer_interrupt_vol_change() argument
1904 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_mixer_interrupt_vol_change()
1912 snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE, in scarlett2_mixer_interrupt_vol_change()
1918 snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE, in scarlett2_mixer_interrupt_vol_change()
1925 struct usb_mixer_interface *mixer) in scarlett2_mixer_interrupt_button_change() argument
1927 struct scarlett2_mixer_data *private = mixer->private_data; in scarlett2_mixer_interrupt_button_change()
1933 snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE, in scarlett2_mixer_interrupt_button_change()
1940 struct usb_mixer_interface *mixer = urb->context; in scarlett2_mixer_interrupt() local
1951 scarlett2_mixer_interrupt_vol_change(mixer); in scarlett2_mixer_interrupt()
1953 scarlett2_mixer_interrupt_button_change(mixer); in scarlett2_mixer_interrupt()
1955 usb_audio_err(mixer->chip, in scarlett2_mixer_interrupt()
1956 "scarlett mixer interrupt length %d\n", len); in scarlett2_mixer_interrupt()
1963 urb->dev = mixer->chip->dev; in scarlett2_mixer_interrupt()
1968 static int scarlett2_mixer_status_create(struct usb_mixer_interface *mixer) in scarlett2_mixer_status_create() argument
1970 struct usb_device *dev = mixer->chip->dev; in scarlett2_mixer_status_create()
1975 if (mixer->urb) { in scarlett2_mixer_status_create()
1976 usb_audio_err(mixer->chip, in scarlett2_mixer_status_create()
1977 "%s: mixer urb already in use!\n", __func__); in scarlett2_mixer_status_create()
1984 mixer->urb = usb_alloc_urb(0, GFP_KERNEL); in scarlett2_mixer_status_create()
1985 if (!mixer->urb) in scarlett2_mixer_status_create()
1992 usb_fill_int_urb(mixer->urb, dev, pipe, in scarlett2_mixer_status_create()
1994 scarlett2_mixer_interrupt, mixer, in scarlett2_mixer_status_create()
1997 return usb_submit_urb(mixer->urb, GFP_KERNEL); in scarlett2_mixer_status_create()
2001 int snd_scarlett_gen2_controls_create(struct usb_mixer_interface *mixer) in snd_scarlett_gen2_controls_create() argument
2007 if (!mixer->protocol) in snd_scarlett_gen2_controls_create()
2010 switch (mixer->chip->usb_id) { in snd_scarlett_gen2_controls_create()
2024 if (!(mixer->chip->setup & SCARLETT2_ENABLE)) { in snd_scarlett_gen2_controls_create()
2025 usb_audio_err(mixer->chip, in snd_scarlett_gen2_controls_create()
2026 "Focusrite Scarlett Gen 2 Mixer Driver disabled; " in snd_scarlett_gen2_controls_create()
2033 err = scarlett2_init_private(mixer, info); in snd_scarlett_gen2_controls_create()
2038 err = scarlett2_read_configs(mixer); in snd_scarlett_gen2_controls_create()
2043 err = scarlett2_add_line_out_ctls(mixer); in snd_scarlett_gen2_controls_create()
2048 err = scarlett2_add_line_in_ctls(mixer); in snd_scarlett_gen2_controls_create()
2052 /* Create the input, output, and mixer mux input selections */ in snd_scarlett_gen2_controls_create()
2053 err = scarlett2_add_mux_enums(mixer); in snd_scarlett_gen2_controls_create()
2057 /* Create the matrix mixer controls */ in snd_scarlett_gen2_controls_create()
2058 err = scarlett2_add_mixer_ctls(mixer); in snd_scarlett_gen2_controls_create()
2063 err = scarlett2_add_meter_ctl(mixer); in snd_scarlett_gen2_controls_create()
2069 err = scarlett2_mixer_status_create(mixer); in snd_scarlett_gen2_controls_create()