All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ALSA: scarlett2: fix two small issues
@ 2021-06-27 13:22 Geoffrey D. Bennett
  2021-06-27 13:22 ` [PATCH 1/2] ALSA: scarlett2: Fix pad count for 18i8 Gen 3 Geoffrey D. Bennett
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Geoffrey D. Bennett @ 2021-06-27 13:22 UTC (permalink / raw
  To: alsa-devel, Takashi Iwai; +Cc: Aaron Wolf, Hin-Tak Leung, Vladimir Sadovnikov

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(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] ALSA: scarlett2: Fix pad count for 18i8 Gen 3
  2021-06-27 13:22 [PATCH 0/2] ALSA: scarlett2: fix two small issues Geoffrey D. Bennett
@ 2021-06-27 13:22 ` Geoffrey D. Bennett
  2021-06-27 13:22 ` [PATCH 2/2] ALSA: scarlett2: Fix scarlett2_*_ctl_put() return values again Geoffrey D. Bennett
  2021-07-01  6:35 ` [PATCH 0/2] ALSA: scarlett2: fix two small issues Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Geoffrey D. Bennett @ 2021-06-27 13:22 UTC (permalink / raw
  To: alsa-devel, Takashi Iwai; +Cc: Aaron Wolf, Hin-Tak Leung, Vladimir Sadovnikov

The 18i8 Gen 3 has 4 inputs with a pad control, not 2. Update
s18i8_gen3_info.pad_input_count.

Reported-by: Aaron Wolf <aaron@wolftune.com>
Tested-by: Aaron Wolf <aaron@wolftune.com>
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
---
 sound/usb/mixer_scarlett_gen2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c
index fcba682cd422..a6387d5c1888 100644
--- a/sound/usb/mixer_scarlett_gen2.c
+++ b/sound/usb/mixer_scarlett_gen2.c
@@ -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,
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ALSA: scarlett2: Fix scarlett2_*_ctl_put() return values again
  2021-06-27 13:22 [PATCH 0/2] ALSA: scarlett2: fix two small issues Geoffrey D. Bennett
  2021-06-27 13:22 ` [PATCH 1/2] ALSA: scarlett2: Fix pad count for 18i8 Gen 3 Geoffrey D. Bennett
@ 2021-06-27 13:22 ` Geoffrey D. Bennett
  2021-07-01  6:35 ` [PATCH 0/2] ALSA: scarlett2: fix two small issues Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Geoffrey D. Bennett @ 2021-06-27 13:22 UTC (permalink / raw
  To: alsa-devel, Takashi Iwai; +Cc: Aaron Wolf, Hin-Tak Leung, Vladimir Sadovnikov

Mixer 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().

Reported-by: Aaron Wolf <aaron@wolftune.com>
Tested-by: Aaron Wolf <aaron@wolftune.com>
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
---
 sound/usb/mixer_scarlett_gen2.c | 38 +++++++++++++++++++++++++--------
 1 file changed, 29 insertions(+), 9 deletions(-)

diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c
index a6387d5c1888..346551599dd6 100644
--- a/sound/usb/mixer_scarlett_gen2.c
+++ b/sound/usb/mixer_scarlett_gen2.c
@@ -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);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] ALSA: scarlett2: fix two small issues
  2021-06-27 13:22 [PATCH 0/2] ALSA: scarlett2: fix two small issues Geoffrey D. Bennett
  2021-06-27 13:22 ` [PATCH 1/2] ALSA: scarlett2: Fix pad count for 18i8 Gen 3 Geoffrey D. Bennett
  2021-06-27 13:22 ` [PATCH 2/2] ALSA: scarlett2: Fix scarlett2_*_ctl_put() return values again Geoffrey D. Bennett
@ 2021-07-01  6:35 ` Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2021-07-01  6:35 UTC (permalink / raw
  To: Geoffrey D. Bennett
  Cc: Aaron Wolf, Hin-Tak Leung, alsa-devel, Vladimir Sadovnikov

On Sun, 27 Jun 2021 15:22:14 +0200,
Geoffrey D. Bennett wrote:
> 
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-01  6:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-27 13:22 [PATCH 0/2] ALSA: scarlett2: fix two small issues Geoffrey D. Bennett
2021-06-27 13:22 ` [PATCH 1/2] ALSA: scarlett2: Fix pad count for 18i8 Gen 3 Geoffrey D. Bennett
2021-06-27 13:22 ` [PATCH 2/2] ALSA: scarlett2: Fix scarlett2_*_ctl_put() return values again Geoffrey D. Bennett
2021-07-01  6:35 ` [PATCH 0/2] ALSA: scarlett2: fix two small issues Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.