Skip to contentSkip to conversation

rename s1810c* to presonus_studio to get s1824c working

PATCH In review Amin Dandache 3 participants 4 messages Feb 27, 2025 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rename s1810c* to presonus_studio to get s1824c working

---
 sound/usb/Makefile                            |   2 +-
 sound/usb/format.c                            |  12 +-
 ...mixer_s1810c.c => mixer_presonus_studio.c} | 247 +++++++++---------
 sound/usb/mixer_presonus_studio.h             |   8 +
 sound/usb/mixer_quirks.c                      |  12 +-
 sound/usb/mixer_s1810c.h                      |   7 -
 sound/usb/quirks.c                            |   9 +-
 7 files changed, 161 insertions(+), 136 deletions(-)
 rename sound/usb/{mixer_s1810c.c => mixer_presonus_studio.c} (59%)
 create mode 100644 sound/usb/mixer_presonus_studio.h
 delete mode 100644 sound/usb/mixer_s1810c.h
sound/usb/Makefile +1 -1
index 0532499dbc6d..ed3a7d49b553 100644
@@ -14,7 +14,7 @@ snd-usb-audio-y := 	card.o \
 			mixer_scarlett.o \
 			mixer_scarlett2.o \
 			mixer_us16x08.o \
-			mixer_s1810c.o \
+			mixer_presonus_studio.o \
 			pcm.o \
 			power.o \
 			proc.o \
sound/usb/format.c +8 -4
index 6049d957694c..2bebcb6f3ef5 100644
@@ -280,8 +280,8 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
  * The list of supported rates per altsetting (set of available
  * I/O channels) is described in the owner's manual, section 2.2.
  */
-static bool s1810c_valid_sample_rate(struct audioformat *fp,
-				     unsigned int rate)
+static bool presonus_studio_valid_sample_rate(struct audioformat *fp,
+					      unsigned int rate)
 {
 	switch (fp->altsetting) {
 	case 1:
@@ -382,8 +382,12 @@ static int parse_uac2_sample_rate_range(struct snd_usb_audio *chip,
 
 			/* Filter out invalid rates on Presonus Studio 1810c */
 			if (chip->usb_id == USB_ID(0x194f, 0x010c) &&
-			    !s1810c_valid_sample_rate(fp, rate))
+			    !presonus_studio_valid_sample_rate(fp, rate))
 				goto skip_rate;
+                        /* Filter out invalid rates on Presonus Studio 1824c */
+                        if (chip->usb_id == USB_ID(0x194f, 0x010d) &&
+                            !presonus_studio_valid_sample_rate(fp, rate))
+                                goto skip_rate;
 
 			/* Filter out invalid rates on Focusrite devices */
 			if (USB_ID_VENDOR(chip->usb_id) == 0x1235 &&
@@ -398,7 +402,7 @@ static int parse_uac2_sample_rate_range(struct snd_usb_audio *chip,
 				break;
 			}
 
-skip_rate:
+			skip_rate:
 			/* avoid endless loop */
 			if (res == 0)
 				break;
sound/usb/mixer_presonus_studio.c renamed from sound/usb/mixer_s1810c.c +128 -119

547 lines not on this page · raw message

sound/usb/mixer_presonus_studio.h new file +8 -0
new file mode 100644
index 000000000000..211d35eef1f0
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Presonus Studio [1810c, 1824c] driver for ALSA
+ * Copyright (C) 2019 Nick Kossifidis <[email protected]>
+ * Copyright (C) 2025 Amin Dandache <[email protected]>
+ */
+
+int snd_presonus_studio_init_mixer(struct usb_mixer_interface *mixer, int device_idx);
sound/usb/mixer_quirks.c +10 -2
index 23fcd680167d..d346dba1c98d 100644
@@ -36,7 +36,7 @@
 #include "mixer_scarlett.h"
 #include "mixer_scarlett2.h"
 #include "mixer_us16x08.h"
-#include "mixer_s1810c.h"
+#include "mixer_presonus_studio.h"
 #include "helper.h"
 
 struct std_mono_table {
@@ -3988,6 +3988,10 @@ static int snd_djm_controls_create(struct usb_mixer_interface *mixer,
 	return 0;
 }
 
+// Presonus Studio
+#define SND_S1810C_IDX		0x0
+#define SND_S1824C_IDX		0x1
+
 int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 {
 	int err = 0;
@@ -4110,8 +4114,12 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
 		break;
 
 	case USB_ID(0x194f, 0x010c): /* Presonus Studio 1810c */
-		err = snd_sc1810_init_mixer(mixer);
+		err = snd_presonus_studio_init_mixer(mixer, SND_S1810C_IDX);
 		break;
+	case USB_ID(0x194f, 0x010d): /* Presonus Studio 1824c */
+ 		err = snd_presonus_studio_init_mixer(mixer, SND_S1824C_IDX);
+ 		break;
+
 	case USB_ID(0x2a39, 0x3fb0): /* RME Babyface Pro FS */
 		err = snd_bbfpro_controls_create(mixer);
 		break;
sound/usb/mixer_s1810c.h deleted +0 -7
deleted file mode 100644
index a79a3743cff3..000000000000
@@ -1,7 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Presonus Studio 1810c driver for ALSA
- * Copyright (C) 2019 Nick Kossifidis <[email protected]>
- */
-
-int snd_sc1810_init_mixer(struct usb_mixer_interface *mixer);
sound/usb/quirks.c +6 -3
index 8ba0aff8be2e..c70ac7ed43f0 100644
@@ -1551,8 +1551,8 @@ static int fasttrackpro_skip_setting_quirk(struct snd_usb_audio *chip,
 	return 0; /* keep this altsetting */
 }
 
-static int s1810c_skip_setting_quirk(struct snd_usb_audio *chip,
-					   int iface, int altno)
+static int presonus_studio_skip_setting_quirk(struct snd_usb_audio *chip,
+					      int iface, int altno)
 {
 	/*
 	 * Altno settings:
@@ -1598,7 +1598,10 @@ int snd_usb_apply_interface_quirk(struct snd_usb_audio *chip,
 		return fasttrackpro_skip_setting_quirk(chip, iface, altno);
 	/* presonus studio 1810c: skip altsets incompatible with device_setup */
 	if (chip->usb_id == USB_ID(0x194f, 0x010c))
-		return s1810c_skip_setting_quirk(chip, iface, altno);
+		return presonus_studio_skip_setting_quirk(chip, iface, altno);
+        /* presonus studio 1824c: skip altsets incompatible with device_setup */
+        if (chip->usb_id == USB_ID(0x194f, 0x010d))
+                return presonus_studio_skip_setting_quirk(chip, iface, altno);
 
 
 	return 0;
Signature · 1 line
2.43.0
#1 lore raw
Quoted 13 lines · Amin Dandache
---
 sound/usb/Makefile                            |   2 +-
 sound/usb/format.c                            |  12 +-
 ...mixer_s1810c.c => mixer_presonus_studio.c} | 247 +++++++++---------
 sound/usb/mixer_presonus_studio.h             |   8 +
 sound/usb/mixer_quirks.c                      |  12 +-
 sound/usb/mixer_s1810c.h                      |   7 -
 sound/usb/quirks.c                            |   9 +-
 7 files changed, 161 insertions(+), 136 deletions(-)
 rename sound/usb/{mixer_s1810c.c => mixer_presonus_studio.c} (59%)
 create mode 100644 sound/usb/mixer_presonus_studio.h
 delete mode 100644 sound/usb/mixer_s1810c.h

First off, could you give the reason why you must rename the whole stuff? Is it just to add the support of a new device ID 194f:010d? If so, we don't have to rename everything, but just keep using the same function as is. You can put simply a comment that the function supports both devices, instead.

And, the patch should be formatted properly. You need a proper subject prefix (e.g. "ALSA: usb-audio: ....."), then put more detailed patch description texts.

Last but not least, most importantly, we need your Signed-off-by tag. It's a legal requirement.

Could you address the above and resubmit?

thanks,

Takashi

#2 lore raw

Hi,

Yes, the previous file was named after the exact model 1810c.
I would not like to put the 1824c into the file as it suggest its just one model. It feels like monkey patching for me.

Also it's the same series: Presonus Studio.

And yes it's just a new device ID, but there are some features missing like SPDIF which i could not test yet, also if every function is adopted by the 1810c.

I just tested the basic functionality and it works perfect for analog signals.

In the future there could be some differences in the handling for the models, so i tried to prepare that and rename it to a global name that supports more devices inside and more cases for the devices. like the mixer_scarlett.c which supports all focusrite scarlett devices in one file.

I will refactor the proper subject and try put the signed-off-by tag, as this is my first commit i have to learn a little bit new.

Best Regards,
Amin

Quoted 33 lines · Takashi Iwai
Quoted 9 lines · Amin Dandache
---
  sound/usb/Makefile                            |   2 +-
  sound/usb/format.c                            |  12 +-
  ...mixer_s1810c.c => mixer_presonus_studio.c} | 247 +++++++++---------
  sound/usb/mixer_presonus_studio.h             |   8 +
  sound/usb/mixer_quirks.c                      |  12 +-
  sound/usb/mixer_s1810c.h                      |   7 -
  sound/usb/quirks.c                            |   9 +-
  7 files changed, 161 insertions(+), 136 deletions(-)
Quoted 3 lines

rename sound/usb/{mixer_s1810c.c => mixer_presonus_studio.c} (59%) create mode 100644 sound/usb/mixer_presonus_studio.h delete mode 100644 sound/usb/mixer_s1810c.h

First off, could you give the reason why you must rename the whole stuff? Is it just to add the support of a new device ID 194f:010d? If so, we don't have to rename everything, but just keep using the same function as is. You can put simply a comment that the function supports both devices, instead.

And, the patch should be formatted properly. You need a proper subject prefix (e.g. "ALSA: usb-audio: ....."), then put more detailed patch description texts.

Last but not least, most importantly, we need your Signed-off-by tag. It's a legal requirement.

Could you address the above and resubmit?

thanks,

Takashi

#3 lore raw
Quoted 10 lines · Amin Dandache

Hi,

Yes, the previous file was named after the exact model 1810c. I would not like to put the 1824c into the file as it suggest its just one model.
It feels like monkey patching for me.

Also it's the same series: Presonus Studio.

Heh, and who knows that the name will keep in the next model? ;)

Don't get me wrong: if there will be more handful new models with completely different names in future, we should think of renaming, indeed. Or, if the code varies significantly depending on the model, or if we need some fundamental changes, we can take a drastic change, sure.

But, a case like yours would need only a small bit of actual code change, while the whole renaming makes really hard to see what the actual change is.

So, don't mix up two things. If a rename is mandatory, do only rename but nothing else. Then apply another fix (a new device ID support) afterwards -- or vice versa.

thanks,

Takashi

Quoted 54 lines

And yes it's just a new device ID, but there are some features missing like SPDIF which i could not test yet, also if every function is adopted by the 1810c.

I just tested the basic functionality and it works perfect for analog signals.

In the future there could be some differences in the handling for the models, so i tried to prepare that and rename it to a global name that supports more devices inside and more cases for the devices. like the mixer_scarlett.c which supports all focusrite scarlett devices in one file.

I will refactor the proper subject and try put the signed-off-by tag, as this is my first commit i have to learn a little bit new.

Best Regards,
Amin

Quoted 33 lines · Takashi Iwai
Quoted 9 lines · Amin Dandache
---
  sound/usb/Makefile                            |   2 +-
  sound/usb/format.c                            |  12 +-
  ...mixer_s1810c.c => mixer_presonus_studio.c} | 247 +++++++++---------
  sound/usb/mixer_presonus_studio.h             |   8 +
  sound/usb/mixer_quirks.c                      |  12 +-
  sound/usb/mixer_s1810c.h                      |   7 -
  sound/usb/quirks.c                            |   9 +-
  7 files changed, 161 insertions(+), 136 deletions(-)
Quoted 3 lines

rename sound/usb/{mixer_s1810c.c => mixer_presonus_studio.c} (59%) create mode 100644 sound/usb/mixer_presonus_studio.h delete mode 100644 sound/usb/mixer_s1810c.h

First off, could you give the reason why you must rename the whole stuff? Is it just to add the support of a new device ID 194f:010d? If so, we don't have to rename everything, but just keep using the same function as is. You can put simply a comment that the function supports both devices, instead.

And, the patch should be formatted properly. You need a proper subject prefix (e.g. "ALSA: usb-audio: ....."), then put more detailed patch description texts.

Last but not least, most importantly, we need your Signed-off-by tag. It's a legal requirement.

Could you address the above and resubmit?

thanks,

Takashi