Commit 66946398 authored by Geoffrey D. Bennett's avatar Geoffrey D. Bennett Committed by Takashi Iwai
Browse files

ALSA: scarlett2: Rename DSP mux channels



The DSP mux channels are of type SCARLETT2_PORT_TYPE_MIX so the
ALSA controls would refer to them "Mix X" and "Mixer Input X". This
patch fixes them to be called "DSP X" and "DSP Input X".

Signed-off-by: default avatarGeoffrey D. Bennett <g@b4.vu>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/2d91d0a74d5c7f6179e950bed2c80a4498d16649.1703612638.git.g@b4.vu
parent 166e1dfb
Loading
Loading
Loading
Loading
+26 −6
Original line number Diff line number Diff line
@@ -583,6 +583,8 @@ struct scarlett2_port {
	const char * const src_descr;
	int src_num_offset;
	const char * const dst_descr;
	const char * const dsp_src_descr;
	const char * const dsp_dst_descr;
};

static const struct scarlett2_port scarlett2_ports[SCARLETT2_PORT_TYPE_COUNT] = {
@@ -612,7 +614,9 @@ static const struct scarlett2_port scarlett2_ports[SCARLETT2_PORT_TYPE_COUNT] =
		.id = 0x300,
		.src_descr = "Mix %c",
		.src_num_offset = 'A',
		.dst_descr = "Mixer Input %02d Capture"
		.dst_descr = "Mixer Input %02d Capture",
		.dsp_src_descr = "DSP %d",
		.dsp_dst_descr = "DSP Input %d Capture"
	},
	[SCARLETT2_PORT_TYPE_PCM] = {
		.id = 0x600,
@@ -5378,8 +5382,16 @@ static int scarlett2_mux_src_enum_ctl_info(struct snd_kcontrol *kctl,
			const struct scarlett2_port *port =
				&scarlett2_ports[port_type];

			if (port_type == SCARLETT2_PORT_TYPE_MIX &&
			    item >= private->num_mix_out)
				sprintf(uinfo->value.enumerated.name,
				port->src_descr, item + port->src_num_offset);
					port->dsp_src_descr,
					item - private->num_mix_out + 1);
			else
				sprintf(uinfo->value.enumerated.name,
					port->src_descr,
					item + port->src_num_offset);

			return 0;
		}
		item -= port_count[port_type][SCARLETT2_PORT_IN];
@@ -5472,10 +5484,18 @@ static int scarlett2_add_mux_enums(struct usb_mixer_interface *mixer)
		     channel++, i++) {
			int err;
			char s[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
			const char *const descr =
				scarlett2_ports[port_type].dst_descr;
			int channel_num = channel + 1;
			const struct scarlett2_port *port =
				&scarlett2_ports[port_type];
			const char *descr = port->dst_descr;

			if (port_type == SCARLETT2_PORT_TYPE_MIX &&
			    channel >= private->num_mix_in) {
				channel_num -= private->num_mix_in;
				descr = port->dsp_dst_descr;
			}

			snprintf(s, sizeof(s) - 5, descr, channel + 1);
			snprintf(s, sizeof(s) - 5, descr, channel_num);
			strcat(s, " Enum");

			err = scarlett2_add_new_ctl(mixer,