Lines Matching full:mixer
46 * Support for loading mixer volume and mux configuration from the
59 * This ALSA mixer gives access to (model-dependent):
60 * - input, output, mixer-matrix muxes
61 * - mixer-matrix gain stages
86 * | | Mixer | | |
139 #include "mixer.h"
153 /* mixer range from -80dB to +6dB in 0.5dB steps */
161 /* map from (dB + 80) * 2 to mixer value
190 /* Maximum number of inputs to the mixer */
193 /* Maximum number of outputs from the mixer */
220 * - Mixer I/O
255 * - dst_descr: printf format string for mixer controls
291 .dst_descr = "Mixer Input %02d Capture"
387 struct usb_mixer_interface *mixer; member
1028 /* Devices without a mixer (Gen 3 Solo and 2i2) */
1183 struct usb_mixer_interface *mixer, u32 cmd, in scarlett2_usb() argument
1186 struct scarlett2_data *private = mixer->private_data; in scarlett2_usb()
1187 struct usb_device *dev = mixer->chip->dev; in scarlett2_usb()
1219 mixer->chip, in scarlett2_usb()
1236 mixer->chip, in scarlett2_usb()
1254 mixer->chip, in scarlett2_usb()
1280 struct usb_mixer_interface *mixer, in scarlett2_usb_get() argument
1290 return scarlett2_usb(mixer, SCARLETT2_USB_GET_DATA, in scarlett2_usb_get()
1296 struct usb_mixer_interface *mixer, in scarlett2_usb_get_config() argument
1299 struct scarlett2_data *private = mixer->private_data; in scarlett2_usb_get_config()
1310 err = scarlett2_usb_get(mixer, config_item->offset, buf, size); in scarlett2_usb_get_config()
1323 err = scarlett2_usb_get(mixer, config_item->offset, &value, 1); in scarlett2_usb_get_config()
1336 static void scarlett2_config_save(struct usb_mixer_interface *mixer) in scarlett2_config_save() argument
1340 scarlett2_usb(mixer, SCARLETT2_USB_DATA_CMD, in scarlett2_config_save()
1351 scarlett2_config_save(private->mixer); in scarlett2_config_save_work()
1356 struct usb_mixer_interface *mixer, in scarlett2_usb_set_config() argument
1359 struct scarlett2_data *private = mixer->private_data; in scarlett2_usb_set_config()
1391 scarlett2_usb_get(mixer, offset, &tmp, 1); in scarlett2_usb_set_config()
1404 err = scarlett2_usb(mixer, SCARLETT2_USB_SET_DATA, in scarlett2_usb_set_config()
1412 err = scarlett2_usb(mixer, SCARLETT2_USB_DATA_CMD, in scarlett2_usb_set_config()
1426 struct usb_mixer_interface *mixer, in scarlett2_usb_get_sync_status() argument
1432 err = scarlett2_usb(mixer, SCARLETT2_USB_GET_SYNC, in scarlett2_usb_get_sync_status()
1443 struct usb_mixer_interface *mixer, in scarlett2_usb_get_volume_status() argument
1446 return scarlett2_usb_get(mixer, SCARLETT2_USB_VOLUME_STATUS_OFFSET, in scarlett2_usb_get_volume_status()
1453 static int scarlett2_usb_get_mix(struct usb_mixer_interface *mixer, in scarlett2_usb_get_mix() argument
1456 struct scarlett2_data *private = mixer->private_data; in scarlett2_usb_get_mix()
1473 err = scarlett2_usb(mixer, SCARLETT2_USB_GET_MIX, in scarlett2_usb_get_mix()
1496 static int scarlett2_usb_set_mix(struct usb_mixer_interface *mixer, in scarlett2_usb_set_mix() argument
1499 struct scarlett2_data *private = mixer->private_data; in scarlett2_usb_set_mix()
1518 return scarlett2_usb(mixer, SCARLETT2_USB_SET_MIX, in scarlett2_usb_set_mix()
1578 usb_audio_err(private->mixer->chip, in scarlett2_usb_populate_mux()
1590 usb_audio_err(private->mixer->chip, in scarlett2_usb_populate_mux()
1600 static int scarlett2_usb_get_mux(struct usb_mixer_interface *mixer) in scarlett2_usb_get_mux() argument
1602 struct scarlett2_data *private = mixer->private_data; in scarlett2_usb_get_mux()
1618 err = scarlett2_usb(mixer, SCARLETT2_USB_GET_MUX, in scarlett2_usb_get_mux()
1631 static int scarlett2_usb_set_mux(struct usb_mixer_interface *mixer) in scarlett2_usb_set_mux() argument
1633 struct scarlett2_data *private = mixer->private_data; in scarlett2_usb_set_mux()
1686 err = scarlett2_usb(mixer, SCARLETT2_USB_SET_MUX, in scarlett2_usb_set_mux()
1697 static int scarlett2_usb_get_meter_levels(struct usb_mixer_interface *mixer, in scarlett2_usb_get_meter_levels() argument
1711 err = scarlett2_usb(mixer, SCARLETT2_USB_GET_METER, in scarlett2_usb_get_meter_levels()
1726 static int scarlett2_add_new_ctl(struct usb_mixer_interface *mixer, in scarlett2_add_new_ctl() argument
1739 /* We set USB_MIXER_BESPOKEN type, so that the core USB mixer code in scarlett2_add_new_ctl()
1743 elem->head.mixer = mixer; in scarlett2_add_new_ctl()
1773 static int scarlett2_update_sync(struct usb_mixer_interface *mixer) in scarlett2_update_sync() argument
1775 struct scarlett2_data *private = mixer->private_data; in scarlett2_update_sync()
1778 return scarlett2_usb_get_sync_status(mixer, &private->sync); in scarlett2_update_sync()
1794 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_sync_ctl_get() local
1795 struct scarlett2_data *private = mixer->private_data; in scarlett2_sync_ctl_get()
1799 scarlett2_update_sync(mixer); in scarlett2_sync_ctl_get()
1814 static int scarlett2_add_sync_ctl(struct usb_mixer_interface *mixer) in scarlett2_add_sync_ctl() argument
1816 struct scarlett2_data *private = mixer->private_data; in scarlett2_add_sync_ctl()
1818 /* devices without a mixer also don't support reporting sync status */ in scarlett2_add_sync_ctl()
1822 return scarlett2_add_new_ctl(mixer, &scarlett2_sync_ctl, in scarlett2_add_sync_ctl()
1831 static int scarlett2_update_volumes(struct usb_mixer_interface *mixer) in scarlett2_update_volumes() argument
1833 struct scarlett2_data *private = mixer->private_data; in scarlett2_update_volumes()
1844 err = scarlett2_usb_get_volume_status(mixer, &volume_status); in scarlett2_update_volumes()
1884 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_master_volume_ctl_get() local
1885 struct scarlett2_data *private = mixer->private_data; in scarlett2_master_volume_ctl_get()
1889 scarlett2_update_volumes(mixer); in scarlett2_master_volume_ctl_get()
1909 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_volume_ctl_get() local
1910 struct scarlett2_data *private = mixer->private_data; in scarlett2_volume_ctl_get()
1915 scarlett2_update_volumes(mixer); in scarlett2_volume_ctl_get()
1926 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_volume_ctl_put() local
1927 struct scarlett2_data *private = mixer->private_data; in scarlett2_volume_ctl_put()
1940 err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_LINE_OUT_VOLUME, in scarlett2_volume_ctl_put()
1983 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_mute_ctl_get() local
1984 struct scarlett2_data *private = mixer->private_data; in scarlett2_mute_ctl_get()
1989 scarlett2_update_volumes(mixer); in scarlett2_mute_ctl_get()
2000 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_mute_ctl_put() local
2001 struct scarlett2_data *private = mixer->private_data; in scarlett2_mute_ctl_put()
2016 err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_MUTE_SWITCH, in scarlett2_mute_ctl_put()
2062 struct scarlett2_data *private = elem->head.mixer->private_data; in scarlett2_sw_hw_enum_ctl_get()
2069 static void scarlett2_vol_ctl_set_writable(struct usb_mixer_interface *mixer, in scarlett2_vol_ctl_set_writable() argument
2072 struct scarlett2_data *private = mixer->private_data; in scarlett2_vol_ctl_set_writable()
2073 struct snd_card *card = mixer->chip->card; in scarlett2_vol_ctl_set_writable()
2097 static int scarlett2_sw_hw_change(struct usb_mixer_interface *mixer, in scarlett2_sw_hw_change() argument
2100 struct scarlett2_data *private = mixer->private_data; in scarlett2_sw_hw_change()
2109 scarlett2_vol_ctl_set_writable(mixer, ctl_index, !val); in scarlett2_sw_hw_change()
2117 mixer, SCARLETT2_CONFIG_LINE_OUT_VOLUME, in scarlett2_sw_hw_change()
2124 mixer, SCARLETT2_CONFIG_MUTE_SWITCH, in scarlett2_sw_hw_change()
2130 return scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_SW_HW_SWITCH, in scarlett2_sw_hw_change()
2138 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_sw_hw_enum_ctl_put() local
2139 struct scarlett2_data *private = mixer->private_data; in scarlett2_sw_hw_enum_ctl_put()
2152 err = scarlett2_sw_hw_change(mixer, ctl_index, val); in scarlett2_sw_hw_enum_ctl_put()
2171 static int scarlett2_update_input_other(struct usb_mixer_interface *mixer) in scarlett2_update_input_other() argument
2173 struct scarlett2_data *private = mixer->private_data; in scarlett2_update_input_other()
2180 mixer, SCARLETT2_CONFIG_LEVEL_SWITCH, in scarlett2_update_input_other()
2189 mixer, SCARLETT2_CONFIG_PAD_SWITCH, in scarlett2_update_input_other()
2197 mixer, SCARLETT2_CONFIG_AIR_SWITCH, in scarlett2_update_input_other()
2205 mixer, SCARLETT2_CONFIG_PHANTOM_SWITCH, in scarlett2_update_input_other()
2211 mixer, SCARLETT2_CONFIG_PHANTOM_PERSISTENCE, in scarlett2_update_input_other()
2234 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_level_enum_ctl_get() local
2235 struct scarlett2_data *private = mixer->private_data; in scarlett2_level_enum_ctl_get()
2242 scarlett2_update_input_other(mixer); in scarlett2_level_enum_ctl_get()
2253 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_level_enum_ctl_put() local
2254 struct scarlett2_data *private = mixer->private_data; in scarlett2_level_enum_ctl_put()
2271 err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_LEVEL_SWITCH, in scarlett2_level_enum_ctl_put()
2295 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_pad_ctl_get() local
2296 struct scarlett2_data *private = mixer->private_data; in scarlett2_pad_ctl_get()
2300 scarlett2_update_input_other(mixer); in scarlett2_pad_ctl_get()
2312 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_pad_ctl_put() local
2313 struct scarlett2_data *private = mixer->private_data; in scarlett2_pad_ctl_put()
2329 err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_PAD_SWITCH, in scarlett2_pad_ctl_put()
2353 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_air_ctl_get() local
2354 struct scarlett2_data *private = mixer->private_data; in scarlett2_air_ctl_get()
2358 scarlett2_update_input_other(mixer); in scarlett2_air_ctl_get()
2369 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_air_ctl_put() local
2370 struct scarlett2_data *private = mixer->private_data; in scarlett2_air_ctl_put()
2386 err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_AIR_SWITCH, in scarlett2_air_ctl_put()
2410 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_phantom_ctl_get() local
2411 struct scarlett2_data *private = mixer->private_data; in scarlett2_phantom_ctl_get()
2415 scarlett2_update_input_other(mixer); in scarlett2_phantom_ctl_get()
2427 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_phantom_ctl_put() local
2428 struct scarlett2_data *private = mixer->private_data; in scarlett2_phantom_ctl_put()
2444 err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_PHANTOM_SWITCH, in scarlett2_phantom_ctl_put()
2468 struct scarlett2_data *private = elem->head.mixer->private_data; in scarlett2_phantom_persistence_ctl_get()
2478 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_phantom_persistence_ctl_put() local
2479 struct scarlett2_data *private = mixer->private_data; in scarlett2_phantom_persistence_ctl_put()
2496 mixer, SCARLETT2_CONFIG_PHANTOM_PERSISTENCE, index, val); in scarlett2_phantom_persistence_ctl_put()
2515 static int scarlett2_update_monitor_other(struct usb_mixer_interface *mixer) in scarlett2_update_monitor_other() argument
2517 struct scarlett2_data *private = mixer->private_data; in scarlett2_update_monitor_other()
2535 mixer, SCARLETT2_CONFIG_DIRECT_MONITOR, in scarlett2_update_monitor_other()
2545 mixer, SCARLETT2_CONFIG_MONITOR_OTHER_ENABLE, in scarlett2_update_monitor_other()
2551 mixer, SCARLETT2_CONFIG_MONITOR_OTHER_SWITCH, in scarlett2_update_monitor_other()
2574 err = scarlett2_usb_get_config(mixer, in scarlett2_update_monitor_other()
2590 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_direct_monitor_ctl_get() local
2591 struct scarlett2_data *private = elem->head.mixer->private_data; in scarlett2_direct_monitor_ctl_get()
2595 scarlett2_update_monitor_other(mixer); in scarlett2_direct_monitor_ctl_get()
2606 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_direct_monitor_ctl_put() local
2607 struct scarlett2_data *private = mixer->private_data; in scarlett2_direct_monitor_ctl_put()
2624 mixer, SCARLETT2_CONFIG_DIRECT_MONITOR, index, val); in scarlett2_direct_monitor_ctl_put()
2663 static int scarlett2_add_direct_monitor_ctl(struct usb_mixer_interface *mixer) in scarlett2_add_direct_monitor_ctl() argument
2665 struct scarlett2_data *private = mixer->private_data; in scarlett2_add_direct_monitor_ctl()
2677 mixer, &scarlett2_direct_monitor_ctl[info->direct_monitor - 1], in scarlett2_add_direct_monitor_ctl()
2697 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_speaker_switch_enum_ctl_get() local
2698 struct scarlett2_data *private = mixer->private_data; in scarlett2_speaker_switch_enum_ctl_get()
2702 scarlett2_update_monitor_other(mixer); in scarlett2_speaker_switch_enum_ctl_get()
2712 static int scarlett2_speaker_switch_enable(struct usb_mixer_interface *mixer) in scarlett2_speaker_switch_enable() argument
2714 struct snd_card *card = mixer->chip->card; in scarlett2_speaker_switch_enable()
2715 struct scarlett2_data *private = mixer->private_data; in scarlett2_speaker_switch_enable()
2723 err = scarlett2_sw_hw_change(private->mixer, i, 1); in scarlett2_speaker_switch_enable()
2747 static void scarlett2_speaker_switch_disable(struct usb_mixer_interface *mixer) in scarlett2_speaker_switch_disable() argument
2749 struct snd_card *card = mixer->chip->card; in scarlett2_speaker_switch_disable()
2750 struct scarlett2_data *private = mixer->private_data; in scarlett2_speaker_switch_disable()
2770 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_speaker_switch_enum_ctl_put() local
2771 struct scarlett2_data *private = mixer->private_data; in scarlett2_speaker_switch_enum_ctl_put()
2787 mixer, SCARLETT2_CONFIG_MONITOR_OTHER_ENABLE, in scarlett2_speaker_switch_enum_ctl_put()
2794 mixer, SCARLETT2_CONFIG_MONITOR_OTHER_SWITCH, in scarlett2_speaker_switch_enum_ctl_put()
2801 err = scarlett2_speaker_switch_enable(mixer); in scarlett2_speaker_switch_enum_ctl_put()
2803 scarlett2_speaker_switch_disable(mixer); in scarlett2_speaker_switch_enum_ctl_put()
2822 struct usb_mixer_interface *mixer) in scarlett2_add_speaker_switch_ctl() argument
2824 struct scarlett2_data *private = mixer->private_data; in scarlett2_add_speaker_switch_ctl()
2831 mixer, &scarlett2_speaker_switch_enum_ctl, in scarlett2_add_speaker_switch_ctl()
2852 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_talkback_enum_ctl_get() local
2853 struct scarlett2_data *private = mixer->private_data; in scarlett2_talkback_enum_ctl_get()
2857 scarlett2_update_monitor_other(mixer); in scarlett2_talkback_enum_ctl_get()
2868 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_talkback_enum_ctl_put() local
2869 struct scarlett2_data *private = mixer->private_data; in scarlett2_talkback_enum_ctl_put()
2885 mixer, SCARLETT2_CONFIG_MONITOR_OTHER_ENABLE, in scarlett2_talkback_enum_ctl_put()
2892 mixer, SCARLETT2_CONFIG_MONITOR_OTHER_SWITCH, in scarlett2_talkback_enum_ctl_put()
2914 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_talkback_map_ctl_get() local
2915 struct scarlett2_data *private = mixer->private_data; in scarlett2_talkback_map_ctl_get()
2927 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_talkback_map_ctl_put() local
2928 struct scarlett2_data *private = mixer->private_data; in scarlett2_talkback_map_ctl_put()
2951 err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_TALKBACK_MAP, in scarlett2_talkback_map_ctl_put()
2970 struct usb_mixer_interface *mixer) in scarlett2_add_talkback_ctls() argument
2972 struct scarlett2_data *private = mixer->private_data; in scarlett2_add_talkback_ctls()
2983 mixer, &scarlett2_talkback_enum_ctl, in scarlett2_add_talkback_ctls()
2992 err = scarlett2_add_new_ctl(mixer, &scarlett2_talkback_map_ctl, in scarlett2_add_talkback_ctls()
3007 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_dim_mute_ctl_get() local
3008 struct scarlett2_data *private = mixer->private_data; in scarlett2_dim_mute_ctl_get()
3012 scarlett2_update_volumes(mixer); in scarlett2_dim_mute_ctl_get()
3023 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_dim_mute_ctl_put() local
3024 struct scarlett2_data *private = mixer->private_data; in scarlett2_dim_mute_ctl_put()
3044 err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_DIM_MUTE, in scarlett2_dim_mute_ctl_put()
3055 snd_ctl_notify(mixer->chip->card, in scarlett2_dim_mute_ctl_put()
3076 static int scarlett2_add_line_out_ctls(struct usb_mixer_interface *mixer) in scarlett2_add_line_out_ctls() argument
3078 struct scarlett2_data *private = mixer->private_data; in scarlett2_add_line_out_ctls()
3089 err = scarlett2_add_new_ctl(mixer, in scarlett2_add_line_out_ctls()
3109 err = scarlett2_add_new_ctl(mixer, in scarlett2_add_line_out_ctls()
3119 err = scarlett2_add_new_ctl(mixer, in scarlett2_add_line_out_ctls()
3130 scarlett2_vol_ctl_set_writable(mixer, i, 0); in scarlett2_add_line_out_ctls()
3137 err = scarlett2_add_new_ctl(mixer, in scarlett2_add_line_out_ctls()
3156 mixer, &scarlett2_dim_mute_ctl, in scarlett2_add_line_out_ctls()
3168 static int scarlett2_add_line_in_ctls(struct usb_mixer_interface *mixer) in scarlett2_add_line_in_ctls() argument
3170 struct scarlett2_data *private = mixer->private_data; in scarlett2_add_line_in_ctls()
3181 err = scarlett2_add_new_ctl(mixer, &scarlett2_level_enum_ctl, in scarlett2_add_line_in_ctls()
3190 err = scarlett2_add_new_ctl(mixer, &scarlett2_pad_ctl, in scarlett2_add_line_in_ctls()
3199 err = scarlett2_add_new_ctl(mixer, &scarlett2_air_ctl, in scarlett2_add_line_in_ctls()
3211 mixer, &scarlett2_phantom_ctl, in scarlett2_add_line_in_ctls()
3224 mixer, &scarlett2_phantom_ctl, in scarlett2_add_line_in_ctls()
3232 mixer, &scarlett2_phantom_persistence_ctl, 0, 1, in scarlett2_add_line_in_ctls()
3241 /*** Mixer Volume Controls ***/
3260 struct scarlett2_data *private = elem->head.mixer->private_data; in scarlett2_mixer_ctl_get()
3270 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_mixer_ctl_put() local
3271 struct scarlett2_data *private = mixer->private_data; in scarlett2_mixer_ctl_put()
3288 err = scarlett2_usb_set_mix(mixer, mix_num); in scarlett2_mixer_ctl_put()
3315 static int scarlett2_add_mixer_ctls(struct usb_mixer_interface *mixer) in scarlett2_add_mixer_ctls() argument
3317 struct scarlett2_data *private = mixer->private_data; in scarlett2_add_mixer_ctls()
3334 err = scarlett2_add_new_ctl(mixer, &scarlett2_mixer_ctl, in scarlett2_add_mixer_ctls()
3349 struct scarlett2_data *private = elem->head.mixer->private_data; in scarlett2_mux_src_enum_ctl_info()
3384 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_mux_src_enum_ctl_get() local
3385 struct scarlett2_data *private = mixer->private_data; in scarlett2_mux_src_enum_ctl_get()
3397 scarlett2_usb_get_mux(mixer); in scarlett2_mux_src_enum_ctl_get()
3408 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_mux_src_enum_ctl_put() local
3409 struct scarlett2_data *private = mixer->private_data; in scarlett2_mux_src_enum_ctl_put()
3430 err = scarlett2_usb_set_mux(mixer); in scarlett2_mux_src_enum_ctl_put()
3447 static int scarlett2_add_mux_enums(struct usb_mixer_interface *mixer) in scarlett2_add_mux_enums() argument
3449 struct scarlett2_data *private = mixer->private_data; in scarlett2_add_mux_enums()
3468 err = scarlett2_add_new_ctl(mixer, in scarlett2_add_mux_enums()
3502 err = scarlett2_usb_get_meter_levels(elem->head.mixer, elem->channels, in scarlett2_meter_ctl_get()
3521 static int scarlett2_add_meter_ctl(struct usb_mixer_interface *mixer) in scarlett2_add_meter_ctl() argument
3523 struct scarlett2_data *private = mixer->private_data; in scarlett2_add_meter_ctl()
3525 /* devices without a mixer also don't support reporting levels */ in scarlett2_add_meter_ctl()
3529 return scarlett2_add_new_ctl(mixer, &scarlett2_meter_ctl, in scarlett2_add_meter_ctl()
3540 struct scarlett2_data *private = elem->head.mixer->private_data; in scarlett2_msd_ctl_get()
3550 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_msd_ctl_put() local
3551 struct scarlett2_data *private = mixer->private_data; in scarlett2_msd_ctl_put()
3566 err = scarlett2_usb_set_config(mixer, SCARLETT2_CONFIG_MSD_SWITCH, in scarlett2_msd_ctl_put()
3584 static int scarlett2_add_msd_ctl(struct usb_mixer_interface *mixer) in scarlett2_add_msd_ctl() argument
3586 struct scarlett2_data *private = mixer->private_data; in scarlett2_add_msd_ctl()
3593 if (!private->msd_switch && !(mixer->chip->setup & SCARLETT2_MSD_ENABLE)) in scarlett2_add_msd_ctl()
3597 return scarlett2_add_new_ctl(mixer, &scarlett2_msd_ctl, in scarlett2_add_msd_ctl()
3607 struct scarlett2_data *private = elem->head.mixer->private_data; in scarlett2_standalone_ctl_get()
3617 struct usb_mixer_interface *mixer = elem->head.mixer; in scarlett2_standalone_ctl_put() local
3618 struct scarlett2_data *private = mixer->private_data; in scarlett2_standalone_ctl_put()
3633 err = scarlett2_usb_set_config(mixer, in scarlett2_standalone_ctl_put()
3652 static int scarlett2_add_standalone_ctl(struct usb_mixer_interface *mixer) in scarlett2_add_standalone_ctl() argument
3654 struct scarlett2_data *private = mixer->private_data; in scarlett2_add_standalone_ctl()
3660 return scarlett2_add_new_ctl(mixer, &scarlett2_standalone_ctl, in scarlett2_add_standalone_ctl()
3666 static void scarlett2_private_free(struct usb_mixer_interface *mixer) in scarlett2_private_free() argument
3668 struct scarlett2_data *private = mixer->private_data; in scarlett2_private_free()
3672 mixer->private_data = NULL; in scarlett2_private_free()
3675 static void scarlett2_private_suspend(struct usb_mixer_interface *mixer) in scarlett2_private_suspend() argument
3677 struct scarlett2_data *private = mixer->private_data; in scarlett2_private_suspend()
3680 scarlett2_config_save(private->mixer); in scarlett2_private_suspend()
3735 static int scarlett2_init_private(struct usb_mixer_interface *mixer, in scarlett2_init_private() argument
3748 mixer->private_data = private; in scarlett2_init_private()
3749 mixer->private_free = scarlett2_private_free; in scarlett2_init_private()
3750 mixer->private_suspend = scarlett2_private_suspend; in scarlett2_init_private()
3755 private->mixer = mixer; in scarlett2_init_private()
3757 return scarlett2_find_fc_interface(mixer->chip->dev, private); in scarlett2_init_private()
3761 static int scarlett2_usb_init(struct usb_mixer_interface *mixer) in scarlett2_usb_init() argument
3763 struct usb_device *dev = mixer->chip->dev; in scarlett2_usb_init()
3764 struct scarlett2_data *private = mixer->private_data; in scarlett2_usb_init()
3779 err = scarlett2_usb(mixer, SCARLETT2_USB_INIT_1, NULL, 0, NULL, 0); in scarlett2_usb_init()
3785 return scarlett2_usb(mixer, SCARLETT2_USB_INIT_2, NULL, 0, NULL, 84); in scarlett2_usb_init()
3789 static int scarlett2_read_configs(struct usb_mixer_interface *mixer) in scarlett2_read_configs() argument
3791 struct scarlett2_data *private = mixer->private_data; in scarlett2_read_configs()
3803 mixer, SCARLETT2_CONFIG_MSD_SWITCH, in scarlett2_read_configs()
3813 err = scarlett2_update_input_other(mixer); in scarlett2_read_configs()
3817 err = scarlett2_update_monitor_other(mixer); in scarlett2_read_configs()
3821 /* the rest of the configuration is for devices with a mixer */ in scarlett2_read_configs()
3826 mixer, SCARLETT2_CONFIG_STANDALONE_SWITCH, in scarlett2_read_configs()
3831 err = scarlett2_update_sync(mixer); in scarlett2_read_configs()
3835 err = scarlett2_usb_get_volume_status(mixer, &volume_status); in scarlett2_read_configs()
3868 err = scarlett2_usb_get_mix(mixer, i); in scarlett2_read_configs()
3873 return scarlett2_usb_get_mux(mixer); in scarlett2_read_configs()
3878 struct usb_mixer_interface *mixer) in scarlett2_notify_sync() argument
3880 struct scarlett2_data *private = mixer->private_data; in scarlett2_notify_sync()
3884 snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE, in scarlett2_notify_sync()
3890 struct usb_mixer_interface *mixer) in scarlett2_notify_monitor() argument
3892 struct snd_card *card = mixer->chip->card; in scarlett2_notify_monitor()
3893 struct scarlett2_data *private = mixer->private_data; in scarlett2_notify_monitor()
3906 snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE, in scarlett2_notify_monitor()
3917 struct usb_mixer_interface *mixer) in scarlett2_notify_dim_mute() argument
3919 struct snd_card *card = mixer->chip->card; in scarlett2_notify_dim_mute()
3920 struct scarlett2_data *private = mixer->private_data; in scarlett2_notify_dim_mute()
3944 struct usb_mixer_interface *mixer) in scarlett2_notify_input_other() argument
3946 struct snd_card *card = mixer->chip->card; in scarlett2_notify_input_other()
3947 struct scarlett2_data *private = mixer->private_data; in scarlett2_notify_input_other()
3971 struct usb_mixer_interface *mixer) in scarlett2_notify_monitor_other() argument
3973 struct snd_card *card = mixer->chip->card; in scarlett2_notify_monitor_other()
3974 struct scarlett2_data *private = mixer->private_data; in scarlett2_notify_monitor_other()
3999 scarlett2_notify_dim_mute(mixer); in scarlett2_notify_monitor_other()
4013 struct usb_mixer_interface *mixer = urb->context; in scarlett2_notify() local
4023 scarlett2_notify_sync(mixer); in scarlett2_notify()
4025 scarlett2_notify_monitor(mixer); in scarlett2_notify()
4027 scarlett2_notify_dim_mute(mixer); in scarlett2_notify()
4029 scarlett2_notify_input_other(mixer); in scarlett2_notify()
4031 scarlett2_notify_monitor_other(mixer); in scarlett2_notify()
4037 urb->dev = mixer->chip->dev; in scarlett2_notify()
4042 static int scarlett2_init_notify(struct usb_mixer_interface *mixer) in scarlett2_init_notify() argument
4044 struct usb_device *dev = mixer->chip->dev; in scarlett2_init_notify()
4045 struct scarlett2_data *private = mixer->private_data; in scarlett2_init_notify()
4049 if (mixer->urb) { in scarlett2_init_notify()
4050 usb_audio_err(mixer->chip, in scarlett2_init_notify()
4051 "%s: mixer urb already in use!\n", __func__); in scarlett2_init_notify()
4058 mixer->urb = usb_alloc_urb(0, GFP_KERNEL); in scarlett2_init_notify()
4059 if (!mixer->urb) in scarlett2_init_notify()
4066 usb_fill_int_urb(mixer->urb, dev, pipe, in scarlett2_init_notify()
4068 scarlett2_notify, mixer, private->bInterval); in scarlett2_init_notify()
4070 return usb_submit_urb(mixer->urb, GFP_KERNEL); in scarlett2_init_notify()
4073 static int snd_scarlett_gen2_controls_create(struct usb_mixer_interface *mixer) in snd_scarlett_gen2_controls_create() argument
4079 while (*info && (*info)->usb_id != mixer->chip->usb_id) in snd_scarlett_gen2_controls_create()
4085 err = scarlett2_init_private(mixer, *info); in snd_scarlett_gen2_controls_create()
4090 err = scarlett2_usb_init(mixer); in snd_scarlett_gen2_controls_create()
4095 err = scarlett2_read_configs(mixer); in snd_scarlett_gen2_controls_create()
4100 err = scarlett2_add_msd_ctl(mixer); in snd_scarlett_gen2_controls_create()
4105 if (((struct scarlett2_data *)mixer->private_data)->msd_switch) in snd_scarlett_gen2_controls_create()
4109 err = scarlett2_add_line_out_ctls(mixer); in snd_scarlett_gen2_controls_create()
4114 err = scarlett2_add_line_in_ctls(mixer); in snd_scarlett_gen2_controls_create()
4118 /* Create the input, output, and mixer mux input selections */ in snd_scarlett_gen2_controls_create()
4119 err = scarlett2_add_mux_enums(mixer); in snd_scarlett_gen2_controls_create()
4123 /* Create the matrix mixer controls */ in snd_scarlett_gen2_controls_create()
4124 err = scarlett2_add_mixer_ctls(mixer); in snd_scarlett_gen2_controls_create()
4129 err = scarlett2_add_meter_ctl(mixer); in snd_scarlett_gen2_controls_create()
4134 err = scarlett2_add_sync_ctl(mixer); in snd_scarlett_gen2_controls_create()
4139 err = scarlett2_add_direct_monitor_ctl(mixer); in snd_scarlett_gen2_controls_create()
4144 err = scarlett2_add_speaker_switch_ctl(mixer); in snd_scarlett_gen2_controls_create()
4149 err = scarlett2_add_talkback_ctls(mixer); in snd_scarlett_gen2_controls_create()
4154 err = scarlett2_add_standalone_ctl(mixer); in snd_scarlett_gen2_controls_create()
4159 err = scarlett2_init_notify(mixer); in snd_scarlett_gen2_controls_create()
4166 int snd_scarlett_gen2_init(struct usb_mixer_interface *mixer) in snd_scarlett_gen2_init() argument
4168 struct snd_usb_audio *chip = mixer->chip; in snd_scarlett_gen2_init()
4172 if (!mixer->protocol) in snd_scarlett_gen2_init()
4177 "Focusrite Scarlett Gen 2/3 Mixer Driver disabled; " in snd_scarlett_gen2_init()
4187 "Focusrite Scarlett Gen 2/3 Mixer Driver enabled pid=0x%04x", in snd_scarlett_gen2_init()
4190 err = snd_scarlett_gen2_controls_create(mixer); in snd_scarlett_gen2_init()
4192 usb_audio_err(mixer->chip, in snd_scarlett_gen2_init()
4193 "Error initialising Scarlett Mixer Driver: %d", in snd_scarlett_gen2_init()