ALSA: usb-audio: Fix Scarlett 6i6 Gen 2 port data
diff mbox series

Message ID 20191111054133.GA1817@b4.vu
State New
Headers show
Series
  • ALSA: usb-audio: Fix Scarlett 6i6 Gen 2 port data
Related show

Commit Message

Geoffrey D. Bennett Nov. 11, 2019, 5:41 a.m. UTC
The s6i6_gen2_info.ports[] array had the Mixer and PCM port type
entries in the wrong place. Use designators to explicitly specify the
array elements being set.

Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface")
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Reported-by: Jonas Berlin <kernel@xkr47.space>
Tested-by: Alex Fellows <alex.fellows@gmail.com>
---
Hi Takashi,

Is there something special I need to do to mark this as a bug fix and
request this go into 5.4?

Thanks,
Geoffrey.

 sound/usb/mixer_scarlett_gen2.c | 36 ++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 18 deletions(-)

Comments

Markus Schroetter Nov. 21, 2019, 8:52 a.m. UTC | #1
> The s6i6_gen2_info.ports[] array had the Mixer and PCM port type
> entries in the wrong place. Use designators to explicitly specify the
> array elements being set.
>
> Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface")
> Signed-off-by: Geoffrey D. Bennett <g at b4.vu <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
> Reported-by: Jonas Berlin <kernel at xkr47.space <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
> Tested-by: Alex Fellows <alex.fellows at gmail.com <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
Tested-by: Markus Schroetter <project.m.schroetter@gmail.com>
> ---
> Hi Takashi,
>
> Is there something special I need to do to mark this as a bug fix and
> request this go into 5.4?
>
> Thanks,
> Geoffrey.
>
>  sound/usb/mixer_scarlett_gen2.c | 36 ++++++++++++++++-----------------
>  1 file changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c
> index 7d460b1f1735..94b903d95afa 100644
> --- a/sound/usb/mixer_scarlett_gen2.c
> +++ b/sound/usb/mixer_scarlett_gen2.c
> @@ -261,34 +261,34 @@ static const struct scarlett2_device_info s6i6_gen2_info = {
>  	},
>  
>  	.ports = {
> -		{
> +		[SCARLETT2_PORT_TYPE_NONE] = {
>  			.id = 0x000,
>  			.num = { 1, 0, 8, 8, 8 },
>  			.src_descr = "Off",
>  			.src_num_offset = 0,
>  		},
> -		{
> +		[SCARLETT2_PORT_TYPE_ANALOGUE] = {
>  			.id = 0x080,
>  			.num = { 4, 4, 4, 4, 4 },
>  			.src_descr = "Analogue %d",
>  			.src_num_offset = 1,
>  			.dst_descr = "Analogue Output %02d Playback"
>  		},
> -		{
> +		[SCARLETT2_PORT_TYPE_SPDIF] = {
>  			.id = 0x180,
>  			.num = { 2, 2, 2, 2, 2 },
>  			.src_descr = "S/PDIF %d",
>  			.src_num_offset = 1,
>  			.dst_descr = "S/PDIF Output %d Playback"
>  		},
> -		{
> +		[SCARLETT2_PORT_TYPE_MIX] = {
>  			.id = 0x300,
>  			.num = { 10, 18, 18, 18, 18 },
>  			.src_descr = "Mix %c",
>  			.src_num_offset = 65,
>  			.dst_descr = "Mixer Input %02d Capture"
>  		},
> -		{
> +		[SCARLETT2_PORT_TYPE_PCM] = {
>  			.id = 0x600,
>  			.num = { 6, 6, 6, 6, 6 },
>  			.src_descr = "PCM %d",
> @@ -317,44 +317,44 @@ static const struct scarlett2_device_info s18i8_gen2_info = {
>  	},
>  
>  	.ports = {
> -		{
> +		[SCARLETT2_PORT_TYPE_NONE] = {
>  			.id = 0x000,
>  			.num = { 1, 0, 8, 8, 4 },
>  			.src_descr = "Off",
>  			.src_num_offset = 0,
>  		},
> -		{
> +		[SCARLETT2_PORT_TYPE_ANALOGUE] = {
>  			.id = 0x080,
>  			.num = { 8, 6, 6, 6, 6 },
>  			.src_descr = "Analogue %d",
>  			.src_num_offset = 1,
>  			.dst_descr = "Analogue Output %02d Playback"
>  		},
> -		{
> +		[SCARLETT2_PORT_TYPE_SPDIF] = {
> +			.id = 0x180,
>  			/* S/PDIF outputs aren't available at 192KHz
>  			 * but are included in the USB mux I/O
>  			 * assignment message anyway
>  			 */
> -			.id = 0x180,
>  			.num = { 2, 2, 2, 2, 2 },
>  			.src_descr = "S/PDIF %d",
>  			.src_num_offset = 1,
>  			.dst_descr = "S/PDIF Output %d Playback"
>  		},
> -		{
> +		[SCARLETT2_PORT_TYPE_ADAT] = {
>  			.id = 0x200,
>  			.num = { 8, 0, 0, 0, 0 },
>  			.src_descr = "ADAT %d",
>  			.src_num_offset = 1,
>  		},
> -		{
> +		[SCARLETT2_PORT_TYPE_MIX] = {
>  			.id = 0x300,
>  			.num = { 10, 18, 18, 18, 18 },
>  			.src_descr = "Mix %c",
>  			.src_num_offset = 65,
>  			.dst_descr = "Mixer Input %02d Capture"
>  		},
> -		{
> +		[SCARLETT2_PORT_TYPE_PCM] = {
>  			.id = 0x600,
>  			.num = { 20, 18, 18, 14, 10 },
>  			.src_descr = "PCM %d",
> @@ -387,20 +387,20 @@ static const struct scarlett2_device_info s18i20_gen2_info = {
>  	},
>  
>  	.ports = {
> -		{
> +		[SCARLETT2_PORT_TYPE_NONE] = {
>  			.id = 0x000,
>  			.num = { 1, 0, 8, 8, 6 },
>  			.src_descr = "Off",
>  			.src_num_offset = 0,
>  		},
> -		{
> +		[SCARLETT2_PORT_TYPE_ANALOGUE] = {
>  			.id = 0x080,
>  			.num = { 8, 10, 10, 10, 10 },
>  			.src_descr = "Analogue %d",
>  			.src_num_offset = 1,
>  			.dst_descr = "Analogue Output %02d Playback"
>  		},
> -		{
> +		[SCARLETT2_PORT_TYPE_SPDIF] = {
>  			/* S/PDIF outputs aren't available at 192KHz
>  			 * but are included in the USB mux I/O
>  			 * assignment message anyway
> @@ -411,21 +411,21 @@ static const struct scarlett2_device_info s18i20_gen2_info = {
>  			.src_num_offset = 1,
>  			.dst_descr = "S/PDIF Output %d Playback"
>  		},
> -		{
> +		[SCARLETT2_PORT_TYPE_ADAT] = {
>  			.id = 0x200,
>  			.num = { 8, 8, 8, 4, 0 },
>  			.src_descr = "ADAT %d",
>  			.src_num_offset = 1,
>  			.dst_descr = "ADAT Output %d Playback"
>  		},
> -		{
> +		[SCARLETT2_PORT_TYPE_MIX] = {
>  			.id = 0x300,
>  			.num = { 10, 18, 18, 18, 18 },
>  			.src_descr = "Mix %c",
>  			.src_num_offset = 65,
>  			.dst_descr = "Mixer Input %02d Capture"
>  		},
> -		{
> +		[SCARLETT2_PORT_TYPE_PCM] = {
>  			.id = 0x600,
>  			.num = { 20, 18, 18, 14, 10 },
>  			.src_descr = "PCM %d",
> -- 
> 2.20.1
Takashi Iwai Nov. 21, 2019, 4:06 p.m. UTC | #2
On Thu, 21 Nov 2019 09:52:10 +0100,
Markus Schroetter wrote:
> 
> > The s6i6_gen2_info.ports[] array had the Mixer and PCM port type
> > entries in the wrong place. Use designators to explicitly specify the
> > array elements being set.
> >
> > Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface")
> > Signed-off-by: Geoffrey D. Bennett <g at b4.vu <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
> > Reported-by: Jonas Berlin <kernel at xkr47.space <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
> > Tested-by: Alex Fellows <alex.fellows at gmail.com <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
> Tested-by: Markus Schroetter <project.m.schroetter@gmail.com>

Oh this wasn't taken yet.  Now merged for 5.5.


thanks,

Takashi


> > ---
> > Hi Takashi,
> >
> > Is there something special I need to do to mark this as a bug fix and
> > request this go into 5.4?
> >
> > Thanks,
> > Geoffrey.
> >
> >  sound/usb/mixer_scarlett_gen2.c | 36 ++++++++++++++++-----------------
> >  1 file changed, 18 insertions(+), 18 deletions(-)
> >
> > diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c
> > index 7d460b1f1735..94b903d95afa 100644
> > --- a/sound/usb/mixer_scarlett_gen2.c
> > +++ b/sound/usb/mixer_scarlett_gen2.c
> > @@ -261,34 +261,34 @@ static const struct scarlett2_device_info s6i6_gen2_info = {
> >  	},
> >  
> >  	.ports = {
> > -		{
> > +		[SCARLETT2_PORT_TYPE_NONE] = {
> >  			.id = 0x000,
> >  			.num = { 1, 0, 8, 8, 8 },
> >  			.src_descr = "Off",
> >  			.src_num_offset = 0,
> >  		},
> > -		{
> > +		[SCARLETT2_PORT_TYPE_ANALOGUE] = {
> >  			.id = 0x080,
> >  			.num = { 4, 4, 4, 4, 4 },
> >  			.src_descr = "Analogue %d",
> >  			.src_num_offset = 1,
> >  			.dst_descr = "Analogue Output %02d Playback"
> >  		},
> > -		{
> > +		[SCARLETT2_PORT_TYPE_SPDIF] = {
> >  			.id = 0x180,
> >  			.num = { 2, 2, 2, 2, 2 },
> >  			.src_descr = "S/PDIF %d",
> >  			.src_num_offset = 1,
> >  			.dst_descr = "S/PDIF Output %d Playback"
> >  		},
> > -		{
> > +		[SCARLETT2_PORT_TYPE_MIX] = {
> >  			.id = 0x300,
> >  			.num = { 10, 18, 18, 18, 18 },
> >  			.src_descr = "Mix %c",
> >  			.src_num_offset = 65,
> >  			.dst_descr = "Mixer Input %02d Capture"
> >  		},
> > -		{
> > +		[SCARLETT2_PORT_TYPE_PCM] = {
> >  			.id = 0x600,
> >  			.num = { 6, 6, 6, 6, 6 },
> >  			.src_descr = "PCM %d",
> > @@ -317,44 +317,44 @@ static const struct scarlett2_device_info s18i8_gen2_info = {
> >  	},
> >  
> >  	.ports = {
> > -		{
> > +		[SCARLETT2_PORT_TYPE_NONE] = {
> >  			.id = 0x000,
> >  			.num = { 1, 0, 8, 8, 4 },
> >  			.src_descr = "Off",
> >  			.src_num_offset = 0,
> >  		},
> > -		{
> > +		[SCARLETT2_PORT_TYPE_ANALOGUE] = {
> >  			.id = 0x080,
> >  			.num = { 8, 6, 6, 6, 6 },
> >  			.src_descr = "Analogue %d",
> >  			.src_num_offset = 1,
> >  			.dst_descr = "Analogue Output %02d Playback"
> >  		},
> > -		{
> > +		[SCARLETT2_PORT_TYPE_SPDIF] = {
> > +			.id = 0x180,
> >  			/* S/PDIF outputs aren't available at 192KHz
> >  			 * but are included in the USB mux I/O
> >  			 * assignment message anyway
> >  			 */
> > -			.id = 0x180,
> >  			.num = { 2, 2, 2, 2, 2 },
> >  			.src_descr = "S/PDIF %d",
> >  			.src_num_offset = 1,
> >  			.dst_descr = "S/PDIF Output %d Playback"
> >  		},
> > -		{
> > +		[SCARLETT2_PORT_TYPE_ADAT] = {
> >  			.id = 0x200,
> >  			.num = { 8, 0, 0, 0, 0 },
> >  			.src_descr = "ADAT %d",
> >  			.src_num_offset = 1,
> >  		},
> > -		{
> > +		[SCARLETT2_PORT_TYPE_MIX] = {
> >  			.id = 0x300,
> >  			.num = { 10, 18, 18, 18, 18 },
> >  			.src_descr = "Mix %c",
> >  			.src_num_offset = 65,
> >  			.dst_descr = "Mixer Input %02d Capture"
> >  		},
> > -		{
> > +		[SCARLETT2_PORT_TYPE_PCM] = {
> >  			.id = 0x600,
> >  			.num = { 20, 18, 18, 14, 10 },
> >  			.src_descr = "PCM %d",
> > @@ -387,20 +387,20 @@ static const struct scarlett2_device_info s18i20_gen2_info = {
> >  	},
> >  
> >  	.ports = {
> > -		{
> > +		[SCARLETT2_PORT_TYPE_NONE] = {
> >  			.id = 0x000,
> >  			.num = { 1, 0, 8, 8, 6 },
> >  			.src_descr = "Off",
> >  			.src_num_offset = 0,
> >  		},
> > -		{
> > +		[SCARLETT2_PORT_TYPE_ANALOGUE] = {
> >  			.id = 0x080,
> >  			.num = { 8, 10, 10, 10, 10 },
> >  			.src_descr = "Analogue %d",
> >  			.src_num_offset = 1,
> >  			.dst_descr = "Analogue Output %02d Playback"
> >  		},
> > -		{
> > +		[SCARLETT2_PORT_TYPE_SPDIF] = {
> >  			/* S/PDIF outputs aren't available at 192KHz
> >  			 * but are included in the USB mux I/O
> >  			 * assignment message anyway
> > @@ -411,21 +411,21 @@ static const struct scarlett2_device_info s18i20_gen2_info = {
> >  			.src_num_offset = 1,
> >  			.dst_descr = "S/PDIF Output %d Playback"
> >  		},
> > -		{
> > +		[SCARLETT2_PORT_TYPE_ADAT] = {
> >  			.id = 0x200,
> >  			.num = { 8, 8, 8, 4, 0 },
> >  			.src_descr = "ADAT %d",
> >  			.src_num_offset = 1,
> >  			.dst_descr = "ADAT Output %d Playback"
> >  		},
> > -		{
> > +		[SCARLETT2_PORT_TYPE_MIX] = {
> >  			.id = 0x300,
> >  			.num = { 10, 18, 18, 18, 18 },
> >  			.src_descr = "Mix %c",
> >  			.src_num_offset = 65,
> >  			.dst_descr = "Mixer Input %02d Capture"
> >  		},
> > -		{
> > +		[SCARLETT2_PORT_TYPE_PCM] = {
> >  			.id = 0x600,
> >  			.num = { 20, 18, 18, 14, 10 },
> >  			.src_descr = "PCM %d",
> > -- 
> > 2.20.1
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
Geoffrey D. Bennett Nov. 22, 2019, 12:24 a.m. UTC | #3
On Thu, Nov 21, 2019 at 05:06:42PM +0100, Takashi Iwai wrote:
> On Thu, 21 Nov 2019 09:52:10 +0100,
> Markus Schroetter wrote:
> > 
> > > The s6i6_gen2_info.ports[] array had the Mixer and PCM port type
> > > entries in the wrong place. Use designators to explicitly specify the
> > > array elements being set.
> > >
> > > Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface")
> > > Signed-off-by: Geoffrey D. Bennett <g at b4.vu <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
> > > Reported-by: Jonas Berlin <kernel at xkr47.space <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
> > > Tested-by: Alex Fellows <alex.fellows at gmail.com <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
> > Tested-by: Markus Schroetter <project.m.schroetter@gmail.com>
> 
> Oh this wasn't taken yet.  Now merged for 5.5.

Thanks for that! Is it possible to get it included in 5.4.1 as well?
Without this patch, the 6i6 support is unusable.

Thanks,
Geoffrey.
Takashi Iwai Nov. 22, 2019, 1:28 p.m. UTC | #4
On Fri, 22 Nov 2019 01:24:27 +0100,
Geoffrey D. Bennett wrote:
> 
> On Thu, Nov 21, 2019 at 05:06:42PM +0100, Takashi Iwai wrote:
> > On Thu, 21 Nov 2019 09:52:10 +0100,
> > Markus Schroetter wrote:
> > > 
> > > > The s6i6_gen2_info.ports[] array had the Mixer and PCM port type
> > > > entries in the wrong place. Use designators to explicitly specify the
> > > > array elements being set.
> > > >
> > > > Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface")
> > > > Signed-off-by: Geoffrey D. Bennett <g at b4.vu <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
> > > > Reported-by: Jonas Berlin <kernel at xkr47.space <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
> > > > Tested-by: Alex Fellows <alex.fellows at gmail.com <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
> > > Tested-by: Markus Schroetter <project.m.schroetter@gmail.com>
> > 
> > Oh this wasn't taken yet.  Now merged for 5.5.
> 
> Thanks for that! Is it possible to get it included in 5.4.1 as well?

Yes, once when merged to Linus tree, it'll be picked up.


Takashi
Geoffrey D. Bennett Dec. 2, 2019, 7:11 a.m. UTC | #5
Hi Takashi,

On Thu, Nov 21, 2019 at 05:06:42PM +0100, Takashi Iwai wrote:
> On Thu, 21 Nov 2019 09:52:10 +0100,
> Markus Schroetter wrote:
> > 
> > > The s6i6_gen2_info.ports[] array had the Mixer and PCM port type
> > > entries in the wrong place. Use designators to explicitly specify the
> > > array elements being set.
> > >
> > > Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface")
> > > Signed-off-by: Geoffrey D. Bennett <g at b4.vu <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
> > > Reported-by: Jonas Berlin <kernel at xkr47.space <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
> > > Tested-by: Alex Fellows <alex.fellows at gmail.com <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
> > Tested-by: Markus Schroetter <project.m.schroetter@gmail.com>
> 
> Oh this wasn't taken yet.  Now merged for 5.5.

Thanks, I see it appeared in 5.4.1. Is it too late to get the commit
message fixed for 5.5? It's missing the Reported-by line above:

Reported-by: Jonas Berlin <kernel@xkr47.space>

Thanks,
Geoffrey.
Takashi Iwai Dec. 2, 2019, 7:40 a.m. UTC | #6
On Mon, 02 Dec 2019 08:11:21 +0100,
Geoffrey D. Bennett wrote:
> 
> Hi Takashi,
> 
> On Thu, Nov 21, 2019 at 05:06:42PM +0100, Takashi Iwai wrote:
> > On Thu, 21 Nov 2019 09:52:10 +0100,
> > Markus Schroetter wrote:
> > > 
> > > > The s6i6_gen2_info.ports[] array had the Mixer and PCM port type
> > > > entries in the wrong place. Use designators to explicitly specify the
> > > > array elements being set.
> > > >
> > > > Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface")
> > > > Signed-off-by: Geoffrey D. Bennett <g at b4.vu <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
> > > > Reported-by: Jonas Berlin <kernel at xkr47.space <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
> > > > Tested-by: Alex Fellows <alex.fellows at gmail.com <https://mailman.alsa-project.org/mailman/listinfo/alsa-devel>>
> > > Tested-by: Markus Schroetter <project.m.schroetter@gmail.com>
> > 
> > Oh this wasn't taken yet.  Now merged for 5.5.
> 
> Thanks, I see it appeared in 5.4.1. Is it too late to get the commit
> message fixed for 5.5?

Yes, you can't change the commit log any longer.

> It's missing the Reported-by line above:
> 
> Reported-by: Jonas Berlin <kernel@xkr47.space>

... but people can refer to the ML archive from the link in the commit
log, so it's still worth to mention here.


thanks,

Takashi

Patch
diff mbox series

diff --git a/sound/usb/mixer_scarlett_gen2.c b/sound/usb/mixer_scarlett_gen2.c
index 7d460b1f1735..94b903d95afa 100644
--- a/sound/usb/mixer_scarlett_gen2.c
+++ b/sound/usb/mixer_scarlett_gen2.c
@@ -261,34 +261,34 @@  static const struct scarlett2_device_info s6i6_gen2_info = {
 	},
 
 	.ports = {
-		{
+		[SCARLETT2_PORT_TYPE_NONE] = {
 			.id = 0x000,
 			.num = { 1, 0, 8, 8, 8 },
 			.src_descr = "Off",
 			.src_num_offset = 0,
 		},
-		{
+		[SCARLETT2_PORT_TYPE_ANALOGUE] = {
 			.id = 0x080,
 			.num = { 4, 4, 4, 4, 4 },
 			.src_descr = "Analogue %d",
 			.src_num_offset = 1,
 			.dst_descr = "Analogue Output %02d Playback"
 		},
-		{
+		[SCARLETT2_PORT_TYPE_SPDIF] = {
 			.id = 0x180,
 			.num = { 2, 2, 2, 2, 2 },
 			.src_descr = "S/PDIF %d",
 			.src_num_offset = 1,
 			.dst_descr = "S/PDIF Output %d Playback"
 		},
-		{
+		[SCARLETT2_PORT_TYPE_MIX] = {
 			.id = 0x300,
 			.num = { 10, 18, 18, 18, 18 },
 			.src_descr = "Mix %c",
 			.src_num_offset = 65,
 			.dst_descr = "Mixer Input %02d Capture"
 		},
-		{
+		[SCARLETT2_PORT_TYPE_PCM] = {
 			.id = 0x600,
 			.num = { 6, 6, 6, 6, 6 },
 			.src_descr = "PCM %d",
@@ -317,44 +317,44 @@  static const struct scarlett2_device_info s18i8_gen2_info = {
 	},
 
 	.ports = {
-		{
+		[SCARLETT2_PORT_TYPE_NONE] = {
 			.id = 0x000,
 			.num = { 1, 0, 8, 8, 4 },
 			.src_descr = "Off",
 			.src_num_offset = 0,
 		},
-		{
+		[SCARLETT2_PORT_TYPE_ANALOGUE] = {
 			.id = 0x080,
 			.num = { 8, 6, 6, 6, 6 },
 			.src_descr = "Analogue %d",
 			.src_num_offset = 1,
 			.dst_descr = "Analogue Output %02d Playback"
 		},
-		{
+		[SCARLETT2_PORT_TYPE_SPDIF] = {
+			.id = 0x180,
 			/* S/PDIF outputs aren't available at 192KHz
 			 * but are included in the USB mux I/O
 			 * assignment message anyway
 			 */
-			.id = 0x180,
 			.num = { 2, 2, 2, 2, 2 },
 			.src_descr = "S/PDIF %d",
 			.src_num_offset = 1,
 			.dst_descr = "S/PDIF Output %d Playback"
 		},
-		{
+		[SCARLETT2_PORT_TYPE_ADAT] = {
 			.id = 0x200,
 			.num = { 8, 0, 0, 0, 0 },
 			.src_descr = "ADAT %d",
 			.src_num_offset = 1,
 		},
-		{
+		[SCARLETT2_PORT_TYPE_MIX] = {
 			.id = 0x300,
 			.num = { 10, 18, 18, 18, 18 },
 			.src_descr = "Mix %c",
 			.src_num_offset = 65,
 			.dst_descr = "Mixer Input %02d Capture"
 		},
-		{
+		[SCARLETT2_PORT_TYPE_PCM] = {
 			.id = 0x600,
 			.num = { 20, 18, 18, 14, 10 },
 			.src_descr = "PCM %d",
@@ -387,20 +387,20 @@  static const struct scarlett2_device_info s18i20_gen2_info = {
 	},
 
 	.ports = {
-		{
+		[SCARLETT2_PORT_TYPE_NONE] = {
 			.id = 0x000,
 			.num = { 1, 0, 8, 8, 6 },
 			.src_descr = "Off",
 			.src_num_offset = 0,
 		},
-		{
+		[SCARLETT2_PORT_TYPE_ANALOGUE] = {
 			.id = 0x080,
 			.num = { 8, 10, 10, 10, 10 },
 			.src_descr = "Analogue %d",
 			.src_num_offset = 1,
 			.dst_descr = "Analogue Output %02d Playback"
 		},
-		{
+		[SCARLETT2_PORT_TYPE_SPDIF] = {
 			/* S/PDIF outputs aren't available at 192KHz
 			 * but are included in the USB mux I/O
 			 * assignment message anyway
@@ -411,21 +411,21 @@  static const struct scarlett2_device_info s18i20_gen2_info = {
 			.src_num_offset = 1,
 			.dst_descr = "S/PDIF Output %d Playback"
 		},
-		{
+		[SCARLETT2_PORT_TYPE_ADAT] = {
 			.id = 0x200,
 			.num = { 8, 8, 8, 4, 0 },
 			.src_descr = "ADAT %d",
 			.src_num_offset = 1,
 			.dst_descr = "ADAT Output %d Playback"
 		},
-		{
+		[SCARLETT2_PORT_TYPE_MIX] = {
 			.id = 0x300,
 			.num = { 10, 18, 18, 18, 18 },
 			.src_descr = "Mix %c",
 			.src_num_offset = 65,
 			.dst_descr = "Mixer Input %02d Capture"
 		},
-		{
+		[SCARLETT2_PORT_TYPE_PCM] = {
 			.id = 0x600,
 			.num = { 20, 18, 18, 14, 10 },
 			.src_descr = "PCM %d",