ALSA: scarlett2: fix two small issues
cover ALSA: scarlett2: fix two small issues
Fix two small issues with the scarlett2 mixer driver.
Not applicable to stable.
Geoffrey D. Bennett (2):
ALSA: scarlett2: Fix pad count for 18i8 Gen 3
ALSA: scarlett2: Fix scarlett2_*_ctl_put() return values again
sound/usb/mixer_scarlett_gen2.c | 40 ++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 10 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/2 ALSA: scarlett2: Fix pad count for 18i8 Gen 3
The 18i8 Gen 3 has 4 inputs with a pad control, not 2. Update s18i8_gen3_info.pad_input_count.
--- sound/usb/mixer_scarlett_gen2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/mixer_scarlett_gen2.c +1 -1
@@ -702,7 +702,7 @@ static const struct scarlett2_device_info s18i8_gen3_info = { .line_out_hw_vol = 1, .has_speaker_switching = 1, .level_input_count = 2, - .pad_input_count = 2, + .pad_input_count = 4, .air_input_count = 4, .phantom_count = 2, .inputs_per_phantom = 2,
Signature · 1 line
2.31.1
PATCH 2/2 ALSA: scarlett2: Fix scarlett2_*_ctl_put() return values again
In reply to Geoffrey D. BennettMixer control put callbacks should return 1 if the value is changed. Fix the mute, air, phantom, direct monitor, speaker switch, talkback, and MSD controls accordingly.
Fix scarlett2_speaker_switch_enable() to not ignore the return value of scarlett2_sw_hw_change().
--- sound/usb/mixer_scarlett_gen2.c | 38 +++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 9 deletions(-)
sound/usb/mixer_scarlett_gen2.c +29 -9
@@ -1880,6 +1880,8 @@ static int scarlett2_mute_ctl_put(struct snd_kcontrol *kctl,/* Send mute change to the device */ err =scarlett2_usb_set_config (mixer,SCARLETT2_CONFIG_MUTE_SWITCH , index, val); +if (err ==0 ) + err =1 ; unlock:mutex_unlock (&private->data_mutex);
@@ -2246,6 +2248,8 @@ static int scarlett2_air_ctl_put(struct snd_kcontrol *kctl,/* Send switch change to the device */ err =scarlett2_usb_set_config (mixer,SCARLETT2_CONFIG_AIR_SWITCH , index, val); +if (err ==0 ) + err =1 ; unlock:mutex_unlock (&private->data_mutex);
@@ -2302,6 +2306,8 @@ static int scarlett2_phantom_ctl_put(struct snd_kcontrol *kctl,/* Send switch change to the device */ err =scarlett2_usb_set_config (mixer,SCARLETT2_CONFIG_PHANTOM_SWITCH , index, val); +if (err ==0 ) + err =1 ; unlock:mutex_unlock (&private->data_mutex);
@@ -2351,6 +2357,8 @@ static int scarlett2_phantom_persistence_ctl_put(/* Send switch change to the device */ err =scarlett2_usb_set_config ( mixer,SCARLETT2_CONFIG_PHANTOM_PERSISTENCE , index, val); +if (err ==0 ) + err =1 ; unlock:mutex_unlock (&private->data_mutex);
@@ -2475,6 +2483,8 @@ static int scarlett2_direct_monitor_ctl_put(/* Send switch change to the device */ err =scarlett2_usb_set_config ( mixer,SCARLETT2_CONFIG_DIRECT_MONITOR , index, val); +if (err ==0 ) + err =1 ; unlock:mutex_unlock (&private->data_mutex);
@@ -2556,18 +2566,21 @@ static int scarlett2_speaker_switch_enum_ctl_get(/* when speaker switching gets enabled, switch the main/alt speakers * to HW volume and disable those controls */ -static void scarlett2_speaker_switch_enable (struct usb_mixer_interface *mixer) +static int scarlett2_speaker_switch_enable (struct usb_mixer_interface *mixer) {struct snd_card *card = mixer->chip->card;struct scarlett2_data *private = mixer->private_data; -int i; +int i, err;for (i =0 ; i <4 ; i++) {int index =line_out_remap (private, i);/* switch the main/alt speakers to HW volume */ -if (!private->vol_sw_hw_switch[index]) -scarlett2_sw_hw_change (private->mixer, i,1 ); +if (!private->vol_sw_hw_switch[index]) { + err =scarlett2_sw_hw_change (private->mixer, i,1 ); +if (err <0 ) +return err; + }/* disable the line out SW/HW switch */ scarlett2_sw_hw_ctl_ro (private, i);
@@ -2579,6 +2592,8 @@ static void scarlett2_speaker_switch_enable(struct usb_mixer_interface *mixer)* configuration */ private->speaker_switching_switched =1 ; + +return 0 ; }/* when speaker switching gets disabled, reenable the hw/sw controls
@@ -2638,10 +2653,13 @@ static int scarlett2_speaker_switch_enum_ctl_put(/* update controls if speaker switching gets enabled or disabled */ if (!oval && val) -scarlett2_speaker_switch_enable (mixer); + err =scarlett2_speaker_switch_enable (mixer);else if (oval && !val)scarlett2_speaker_switch_disable (mixer); +if (err ==0 ) + err =1 ; + unlock:mutex_unlock (&private->data_mutex);return err;
@@ -2728,8 +2746,8 @@ static int scarlett2_talkback_enum_ctl_put( err =scarlett2_usb_set_config ( mixer,SCARLETT2_CONFIG_MONITOR_OTHER_SWITCH ,1 , val ==2 ); -if (err <0 ) - goto unlock; +if (err ==0 ) + err =1 ; unlock:mutex_unlock (&private->data_mutex);
@@ -2787,8 +2805,8 @@ static int scarlett2_talkback_map_ctl_put(/* Send updated bitmap to the device */ err =scarlett2_usb_set_config (mixer,SCARLETT2_CONFIG_TALKBACK_MAP ,0 , bitmap); -if (err <0 ) - goto unlock; +if (err ==0 ) + err =1 ; unlock:mutex_unlock (&private->data_mutex);
@@ -3402,6 +3420,8 @@ static int scarlett2_msd_ctl_put(struct snd_kcontrol *kctl,/* Send switch change to the device */ err =scarlett2_usb_set_config (mixer,SCARLETT2_CONFIG_MSD_SWITCH ,0 , val); +if (err ==0 ) + err =1 ; unlock:mutex_unlock (&private->data_mutex);
Signature · 1 line
2.31.1
Takashi Iwai
AppliedQuoted 8 lines · Geoffrey D. Bennett
Fix two small issues with the scarlett2 mixer driver.
Not applicable to stable.
Geoffrey D. Bennett (2):
ALSA: scarlett2: Fix pad count for 18i8 Gen 3
ALSA: scarlett2: Fix scarlett2_*_ctl_put() return values again
Applied both patches now. Thanks.
Takashi