Skip to contentSkip to conversation

ALSA: usb-audio: fix Line6 Helix audio format rates

PATCH Superseded Nicola Lunghi 3 participants 8 messages Jul 2, 2019 – Jul 3, 2019 Sound

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: usb-audio: fix Line6 Helix audio format rates

Line6 Helix and HX stomp don't support retrieving
the number of clock sample rate.

Add a quirk to return the default value of 48Khz.

---
 sound/usb/format.c | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)
sound/usb/format.c +25 -3
index c02b51a82775..05442f6ada62 100644
@@ -313,10 +313,32 @@ static int parse_audio_format_rates_v2v3(struct snd_usb_audio *chip,
 			      tmp, sizeof(tmp));
 
 	if (ret < 0) {
-		dev_err(&dev->dev,
-			"%s(): unable to retrieve number of sample rates (clock %d)\n",
+		switch (chip->usb_id) {
+		/* LINE 6 HX pedals don't support getting the clock sample rate.
+		 * Set the framerate to 48khz by default
+		 */
+		case USB_ID(0x0E41, 0x4244): /* HELIX */
+		case USB_ID(0x0E41, 0x4246): /* HX STOMP */
+			dev_warn(&dev->dev,
+				"%s(): line6 helix: unable to retrieve number of sample rates. Set it to default value (clock %d).\n",
 				__func__, clock);
-		goto err;
+			fp->nr_rates = 1;
+			fp->rate_min = 48000;
+			fp->rate_max = 48000;
+			fp->rates = SNDRV_PCM_RATE_48000;
+			fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL);
+			if (!fp->rate_table) {
+				ret = -ENOMEM;
+				goto err_free;
+			}
+			fp->rate_table[0] = 48000;
+			return 0;
+		default:
+			dev_err(&dev->dev,
+				"%s(): unable to retrieve number of sample rates (clock %d)\n",
+					__func__, clock);
+			goto err;
+		}
 	}
 
 	nr_triplets = (tmp[1] << 8) | tmp[0];
Signature · 1 line
2.19.1
#1 lore raw
Quoted 7 lines · Nicola Lunghi

Line6 Helix and HX stomp don't support retrieving
the number of clock sample rate.

Add a quirk to return the default value of 48Khz.

It's not particularly good place to put a quirk, but there seems no other better place, unfortunately. Is this specific to certain unit or all I/Os on the device suffer from this problem?

In anyway, if the behavior is expected, we don't need to use dev_warn() to annoy users unnecessarily. Replace it with dev_info().

Also, the code that creates a single 48k entry would be better to be put into a function for readability.

Could you resubmit with that change?

Thanks!

Takashi

Quoted 48 lines
---
 sound/usb/format.c | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)
sound/usb/format.c +25 -3
index c02b51a82775..05442f6ada62 100644
@@ -313,10 +313,32 @@ static int parse_audio_format_rates_v2v3(struct snd_usb_audio *chip,
 			      tmp, sizeof(tmp));
 
 	if (ret < 0) {
-		dev_err(&dev->dev,
-			"%s(): unable to retrieve number of sample rates (clock %d)\n",
+		switch (chip->usb_id) {
+		/* LINE 6 HX pedals don't support getting the clock sample rate.
+		 * Set the framerate to 48khz by default
+		 */
+		case USB_ID(0x0E41, 0x4244): /* HELIX */
+		case USB_ID(0x0E41, 0x4246): /* HX STOMP */
+			dev_warn(&dev->dev,
+				"%s(): line6 helix: unable to retrieve number of sample rates. Set it to default value (clock %d).\n",
 				__func__, clock);
-		goto err;
+			fp->nr_rates = 1;
+			fp->rate_min = 48000;
+			fp->rate_max = 48000;
+			fp->rates = SNDRV_PCM_RATE_48000;
+			fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL);
+			if (!fp->rate_table) {
+				ret = -ENOMEM;
+				goto err_free;
+			}
+			fp->rate_table[0] = 48000;
+			return 0;
+		default:
+			dev_err(&dev->dev,
+				"%s(): unable to retrieve number of sample rates (clock %d)\n",
+					__func__, clock);
+			goto err;
+		}
 	}
 
 	nr_triplets = (tmp[1] << 8) | tmp[0];
Signature · 1 line
2.19.1
#2 lore raw
Quoted 18 lines · Takashi Iwai
Quoted 6 lines · Nicola Lunghi

Line6 Helix and HX stomp don't support retrieving
the number of clock sample rate.

Add a quirk to return the default value of 48Khz.

It's not particularly good place to put a quirk, but there seems no other better place, unfortunately. Is this specific to certain unit or all I/Os on the device suffer from this problem?

In anyway, if the behavior is expected, we don't need to use dev_warn() to annoy users unnecessarily. Replace it with dev_info().

Also, the code that creates a single 48k entry would be better to be put into a function for readability.

Quoted 6 lines

Could you resubmit with that change?

Thanks!

Takashi

If the listed USB devices do not support sample rate format retrieval then maybe it would be a better idea to perform below check before sending message?

Have you also considered new function or macro that check device support? This would separate formatfunctionality code from routine that identifies applicable devices- in case if in future more devices will require quirk.

Michal W.

Quoted 53 lines
Quoted 48 lines
---
  sound/usb/format.c | 28 +++++++++++++++++++++++++---
  1 file changed, 25 insertions(+), 3 deletions(-)
sound/usb/format.c +25 -3
index c02b51a82775..05442f6ada62 100644
@@ -313,10 +313,32 @@ static int parse_audio_format_rates_v2v3(struct snd_usb_audio *chip,
  			      tmp, sizeof(tmp));
 
  	if (ret < 0) {
-		dev_err(&dev->dev,
-			"%s(): unable to retrieve number of sample rates (clock %d)\n",
+		switch (chip->usb_id) {
+		/* LINE 6 HX pedals don't support getting the clock sample rate.
+		 * Set the framerate to 48khz by default
+		 */
+		case USB_ID(0x0E41, 0x4244): /* HELIX */
+		case USB_ID(0x0E41, 0x4246): /* HX STOMP */
+			dev_warn(&dev->dev,
+				"%s(): line6 helix: unable to retrieve number of sample rates. Set it to default value (clock %d).\n",
  				__func__, clock);
-		goto err;
+			fp->nr_rates = 1;
+			fp->rate_min = 48000;
+			fp->rate_max = 48000;
+			fp->rates = SNDRV_PCM_RATE_48000;
+			fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL);
+			if (!fp->rate_table) {
+				ret = -ENOMEM;
+				goto err_free;
+			}
+			fp->rate_table[0] = 48000;
+			return 0;
+		default:
+			dev_err(&dev->dev,
+				"%s(): unable to retrieve number of sample rates (clock %d)\n",
+					__func__, clock);
+			goto err;
+		}
  	}
 
  	nr_triplets = (tmp[1] << 8) | tmp[0];
Signature · 1 line
2.19.1

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#3 lore raw
Quoted 23 lines · Michal
Quoted 21 lines · Takashi Iwai
Quoted 6 lines · Nicola Lunghi

Line6 Helix and HX stomp don't support retrieving
the number of clock sample rate.

Add a quirk to return the default value of 48Khz.

It's not particularly good place to put a quirk, but there seems no other better place, unfortunately. Is this specific to certain unit or all I/Os on the device suffer from this problem?

In anyway, if the behavior is expected, we don't need to use dev_warn() to annoy users unnecessarily. Replace it with dev_info().

Also, the code that creates a single 48k entry would be better to be put into a function for readability.

Could you resubmit with that change?

Quoted 7 lines
Quoted 3 lines

Thanks!

Takashi

If the listed USB devices do not support sample rate format retrieval then maybe it would be a better idea to perform below check before sending message?

Yes, if we know that it always fails, we don't need to query.

Quoted 4 lines

Have you also considered new function or macro that check device support? This would separate formatfunctionality code from routine that identifies applicable devices- in case if in future more devices will require quirk.

The split can be done later. It's always hard to know what kind of quirk would be needed in future. If any more devices show the same problem, we can reorganize the quirk in a saner way.

thanks,

Takashi

Quoted 55 lines

Michal W.

Quoted 51 lines
Quoted 46 lines
---
  sound/usb/format.c | 28 +++++++++++++++++++++++++---
  1 file changed, 25 insertions(+), 3 deletions(-)
sound/usb/format.c +25 -3
index c02b51a82775..05442f6ada62 100644
@@ -313,10 +313,32 @@ static int parse_audio_format_rates_v2v3(struct snd_usb_audio *chip,
  			      tmp, sizeof(tmp));
    	if (ret < 0) {
-		dev_err(&dev->dev,
-			"%s(): unable to retrieve number of sample rates (clock %d)\n",
+		switch (chip->usb_id) {
+		/* LINE 6 HX pedals don't support getting the clock sample rate.
+		 * Set the framerate to 48khz by default
+		 */
+		case USB_ID(0x0E41, 0x4244): /* HELIX */
+		case USB_ID(0x0E41, 0x4246): /* HX STOMP */
+			dev_warn(&dev->dev,
+				"%s(): line6 helix: unable to retrieve number of sample rates. Set it to default value (clock %d).\n",
  				__func__, clock);
-		goto err;
+			fp->nr_rates = 1;
+			fp->rate_min = 48000;
+			fp->rate_max = 48000;
+			fp->rates = SNDRV_PCM_RATE_48000;
+			fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL);
+			if (!fp->rate_table) {
+				ret = -ENOMEM;
+				goto err_free;
+			}
+			fp->rate_table[0] = 48000;
+			return 0;
+		default:
+			dev_err(&dev->dev,
+				"%s(): unable to retrieve number of sample rates (clock %d)\n",
+					__func__, clock);
+			goto err;
+		}
  	}
    	nr_triplets = (tmp[1] << 8) | tmp[0];
Signature · 1 line
2.19.1

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author
#4 lore raw
Quoted 6 lines · On Tue 2 Jul 2019, 16:57 Takashi Iwai, <[email protected]> wrote:
Quoted 4 lines · Michal
Quoted 2 lines · Takashi Iwai

On Tue, 02 Jul 2019 02:43:14 +0200,
Nicola Lunghi wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

Line6 Helix and HX stomp don't support retrieving
the number of clock sample rate.

Add a quirk to return the default value of 48Khz.

It's not particularly good place to put a quirk, but there seems no other better place, unfortunately.

If you prefer I can add a function to quirk.c

Is this specific to certain unit

Quoted 2 lines
Quoted 1 line
Quoted 1 line

or all I/Os on the device suffer from this problem?

This is specific to the helix line of line6
There are currently 4 devices in that line that I think shared their firmware more or less.
Unfortunately I have only one device to test here (but maybe someone else can add the others)

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

In anyway, if the behavior is expected, we don't need to use dev_warn() to annoy users unnecessarily. Replace it with dev_info().

Ok

Quoted 6 lines
Quoted 5 lines

Also, the code that creates a single 48k entry would be better to be

Quoted 4 lines

put into a function for readability.

Could you resubmit with that change?

Yes (in quirks.c or here?)

Also I suspect that there' s a way to get the clock rates because windows driver supports getting the rates and switching (and in Mac the device has the same problem without a custom driver only supports 48khz)

Quoted 6 lines
Quoted 5 lines
Quoted 4 lines

Thanks!

Takashi

Thank you

Quoted 6 lines

If the listed USB devices do not support sample rate format retrieval

Quoted 2 lines

then maybe it would be a better idea to perform below check before sending message?

Yes, if we know that it always fails, we don't need to query.

Sorry I don't understand this :-)

My idea is that if line6 in the future fixes their code (they are quite active on the helix line) the call will not fail and we get a proper device without quirks.
But If the driver fail to get the clock this settings works as a "failsafe" and get the device working.
I also tried to contact their support but they don't care a lot about Linux for now :-(

I will clean this better and resubmit
Thank you
Nick

Quoted 79 lines
Quoted 5 lines

Have you also considered new function or macro that check device support? This would separate formatfunctionality code from routine that identifies applicable devices- in case if in future more devices will require quirk.

The split can be done later. It's always hard to know what kind of quirk would be needed in future. If any more devices show the same problem, we can reorganize the quirk in a saner way.

thanks,

Takashi

Quoted 7 lines

Michal W.

Quoted 4 lines
Quoted 4 lines
---
  sound/usb/format.c | 28 +++++++++++++++++++++++++---
  1 file changed, 25 insertions(+), 3 deletions(-)
Quoted 5 lines
Quoted 5 lines

sound/usb/format.c static int parse_audio_format_rates_v2v3(struct

Quoted 5 lines
sound/usb/format.c +0 -0
index c02b51a82775..05442f6ada62 100644
@@ -313,10 +313,32 @@ static int parse_audio_format_rates_v2v3(struct

snd_usb_audio *chip,

Quoted 4 lines
Quoted 4 lines

sound/usb/format.c static int parse_audio_format_rates_v2v3(struct snd_usb_audio *chip,

Quoted 4 lines
sound/usb/format.c +0 -2
                         tmp, sizeof(tmp));
           if (ret < 0) {
-          dev_err(&dev->dev,
-                  "%s(): unable to retrieve number of sample rates

(clock %d)\n",

Quoted 2 lines
Quoted 2 lines

sound/usb/format.c static int parse_audio_format_rates_v2v3(struct · line 316

Quoted 2 lines
sound/usb/format.c +2 -0
+          switch (chip->usb_id) {
+          /* LINE 6 HX pedals don't support getting the clock sample

rate.

Quoted 6 lines
Quoted 6 lines

sound/usb/format.c static int parse_audio_format_rates_v2v3(struct snd_usb_audio *chip,

Quoted 6 lines
sound/usb/format.c +6 -0
+           * Set the framerate to 48khz by default
+           */
+          case USB_ID(0x0E41, 0x4244): /* HELIX */
+          case USB_ID(0x0E41, 0x4246): /* HX STOMP */
+                  dev_warn(&dev->dev,
+                          "%s(): line6 helix: unable to retrieve

number of sample rates. Set it to default value (clock %d).\n",

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
sound/usb/format.c +6 -1
                           __func__, clock);
-          goto err;
+                  fp->nr_rates = 1;
+                  fp->rate_min = 48000;
+                  fp->rate_max = 48000;
+                  fp->rates = SNDRV_PCM_RATE_48000;
+                  fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL);
+                  if (!fp->rate_table) {
Quoted 8 lines
Quoted 8 lines

sound/usb/format.c static int parse_audio_format_rates_v2v3(struct snd_usb_audio *chip,

Quoted 8 lines
sound/usb/format.c +8 -0
+                          ret = -ENOMEM;
+                          goto err_free;
+                  }
+                  fp->rate_table[0] = 48000;
+                  return 0;
+          default:
+                  dev_err(&dev->dev,
+                          "%s(): unable to retrieve number of sample

rates (clock %d)\n",

Quoted 15 lines
Quoted 14 lines
Quoted 9 lines
sound/usb/format.c +3 -1
+                                  __func__, clock);
+                  goto err;
+          }
   }
           nr_triplets = (tmp[1] << 8) | tmp[0];
--

2.19.1

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#5 lore raw
Quoted 12 lines · On Wed, 03 Jul 2019 09:41:00 +0200, nick83ola wrote:

On Tue 2 Jul 2019, 16:57 Takashi Iwai, <[email protected]> wrote:

On Tue, 02 Jul 2019 17:52:01 +0200,
Wasko, Michal wrote:
>
> On 7/2/2019 4:37 PM, Takashi Iwai wrote:
> > On Tue, 02 Jul 2019 02:43:14 +0200,
> > Nicola Lunghi wrote:
> >> Line6 Helix and HX stomp don't support retrieving > >> the number of clock sample rate.
> >>

Quoted 7 lines

> >> Add a quirk to return the default value of 48Khz.
> >>
> >> Signed-off-by: Nicola Lunghi <[email protected]>
> > It's not particularly good place to put a quirk, but there seems no > > other better place, unfortunately.

If you prefer I can add a function to quirk.c

It's OK to place in format.c as a start.

Quoted 8 lines

Is this specific to certain unit
> > or all I/Os on the device suffer from this problem?

This is specific to the helix line of line6
There are currently 4 devices in that line that I think shared their firmware more or less.
Unfortunately I have only one device to test here (but maybe someone else can add the others)

Ah sorry I wasn't clear enough. What I meant as "unit" is the USB descriptor unit (aka widget), a feature unit, a terminal, whatever. Does this error appear only once at parsing, or does it hit multiple times per device?

Quoted 10 lines
Quoted 4 lines
Quoted 4 lines

In anyway, if the behavior is expected, we don't need to use dev_warn() to annoy users unnecessarily.  Replace it with dev_info().

Ok

Quoted 3 lines
Quoted 3 lines

Also, the code that creates a single 48k entry would be better to be put into a function for readability.

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

Could you resubmit with that change?

Yes (in quirks.c or here?)

Also I suspect that there' s a way to get the clock rates because windows driver supports getting the rates and switching (and in Mac the device has the same problem without a custom driver only supports 48khz)

It might be some fixed list without inquiries?

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

Thanks!

Takashi

Thank you

Quoted 7 lines
Quoted 3 lines

If the listed USB devices do not support sample rate format retrieval then maybe it would be a better idea to perform below check before sending message?

Yes, if we know that it always fails, we don't need to query.

Sorry I don't understand this :-)

Well, the error happens always on your device in the very same way, right? Then we don't have to send the specific command that leads to an error, but takes the fixed 48k from the beginning.

Quoted 7 lines

My idea is that if line6 in the future fixes their code (they are quite active on the helix line) the call will not fail and we get a proper device without quirks.
But If the driver fail to get the clock this settings works as a "failsafe" and get the device working.
I also tried to contact their support but they don't care a lot about Linux for now :-(

The fallback might be good, but I'm not sure whether there are many devices that hit the same problem. If we encounter more, let's try to make it as a fallback.

thanks,

Takashi

Quoted 80 lines

I will clean this better and resubmit
Thank you
Nick

Quoted 4 lines

Have you also considered new function or macro that check device support? This would separate formatfunctionality code from routine that identifies applicable devices- in case if in future more devices will require quirk.

    The split can be done later.  It's always hard to know what kind of
    quirk would be needed in future.  If any more devices show the same
    problem, we can reorganize the quirk in a saner way.

    thanks,
   
    Takashi

    >
    > Michal W.
    >
    > >> ---
    > >>   sound/usb/format.c | 28 +++++++++++++++++++++++++---
    > >>   1 file changed, 25 insertions(+), 3 deletions(-)
    > >>
    > >> diff --git a/sound/usb/format.c b/sound/usb/format.c
    > >> index c02b51a82775..05442f6ada62 100644
    > >> --- a/sound/usb/format.c
    > >> +++ b/sound/usb/format.c
    > >> @@ -313,10 +313,32 @@ static int parse_audio_format_rates_v2v3(struct
    snd_usb_audio *chip,
    > >>                          tmp, sizeof(tmp));
    > >>            if (ret < 0) {
    > >> -          dev_err(&dev->dev,
    > >> -                  "%s(): unable to retrieve number of sample rates
    (clock %d)\n",
    > >> +          switch (chip->usb_id) {
    > >> +          /* LINE 6 HX pedals don't support getting the clock sample
    rate.
    > >> +           * Set the framerate to 48khz by default
    > >> +           */
    > >> +          case USB_ID(0x0E41, 0x4244): /* HELIX */
    > >> +          case USB_ID(0x0E41, 0x4246): /* HX STOMP */
    > >> +                  dev_warn(&dev->dev,
    > >> +                          "%s(): line6 helix: unable to retrieve
    number of sample rates. Set it to default value (clock %d).\n",
    > >>                            __func__, clock);
    > >> -          goto err;
    > >> +                  fp->nr_rates = 1;
    > >> +                  fp->rate_min = 48000;
    > >> +                  fp->rate_max = 48000;
    > >> +                  fp->rates = SNDRV_PCM_RATE_48000;
    > >> +                  fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL);
    > >> +                  if (!fp->rate_table) {
    > >> +                          ret = -ENOMEM;
    > >> +                          goto err_free;
    > >> +                  }
    > >> +                  fp->rate_table[0] = 48000;
    > >> +                  return 0;
    > >> +          default:
    > >> +                  dev_err(&dev->dev,
    > >> +                          "%s(): unable to retrieve number of sample
    rates (clock %d)\n",
    > >> +                                  __func__, clock);
    > >> +                  goto err;
    > >> +          }
    > >>    }
    > >>            nr_triplets = (tmp[1] << 8) | tmp[0];
    > >> --
    > >> 2.19.1
    > >>
    > >>
    > > _______________________________________________
    > > Alsa-devel mailing list
    > > [email protected]
    > > https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
    > >
    >
#6 lore raw
Quoted 83 lines · Takashi Iwai
Quoted 17 lines · On Wed, 03 Jul 2019 09:41:00 +0200, nick83ola wrote:

On Tue 2 Jul 2019, 16:57 Takashi Iwai, <[email protected]> wrote:

On Tue, 02 Jul 2019 17:52:01 +0200,
Wasko, Michal wrote:
>
> On 7/2/2019 4:37 PM, Takashi Iwai wrote:
> > On Tue, 02 Jul 2019 02:43:14 +0200,
> > Nicola Lunghi wrote:
> >> Line6 Helix and HX stomp don't support retrieving
> >> the number of clock sample rate.
> >>
> >> Add a quirk to return the default value of 48Khz.
> >>
> >> Signed-off-by: Nicola Lunghi <[email protected]>
> > It's not particularly good place to put a quirk, but there seems no > > other better place, unfortunately.

Quoted 1 line

If you prefer I can add a function to quirk.c

It's OK to place in format.c as a start.

Quoted 8 lines

Is this specific to certain unit
> > or all I/Os on the device suffer from this problem?

This is specific to the helix line of line6
There are currently 4 devices in that line that I think shared their firmware more or less.
Unfortunately I have only one device to test here (but maybe someone else can add the others)

Ah sorry I wasn't clear enough. What I meant as "unit" is the USB descriptor unit (aka widget), a feature unit, a terminal, whatever. Does this error appear only once at parsing, or does it hit multiple times per device?

Quoted 13 lines

> >
> > In anyway, if the behavior is expected, we don't need to use > > dev_warn() to annoy users unnecessarily.  Replace it with dev_info(). > >

Ok

> > Also, the code that creates a single 48k entry would be better to be > > put into a function for readability.
> >
> > Could you resubmit with that change?
> >

Quoted 5 lines

Yes (in quirks.c or here?)

Also I suspect that there' s a way to get the clock rates because windows driver supports getting the rates and switching (and in Mac the device has the same problem without a custom driver only supports 48khz)

It might be some fixed list without inquiries?

Quoted 8 lines
     > >
     > > Thanks!
     > >
     > > Takashi
     >

Thank you

Quoted 7 lines

> If the listed USB devices do not support sample rate format retrieval > then maybe it would be a better idea to perform below check before > sending message?

Yes, if we know that it always fails, we don't need to query.

Sorry I don't understand this :-)

Well, the error happens always on your device in the very same way, right? Then we don't have to send the specific command that leads to an error, but takes the fixed 48k from the beginning.

Quoted 7 lines

My idea is that if line6 in the future fixes their code (they are quite active on the helix line) the call will not fail and we get a proper device without quirks.
But If the driver fail to get the clock this settings works as a "failsafe" and get the device working.
I also tried to contact their support but they don't care a lot about Linux for now :-(

Quoted 6 lines

The fallback might be good, but I'm not sure whether there are many devices that hit the same problem. If we encounter more, let's try to make it as a fallback.
thanks,

Takashi

Since there is a chance that the issue will be addressed in USB device FW thanthe fallback mechanism will make sense. It would cover eventual future scenario withdevices that will have the issue fixed.

Michal W.

Quoted 83 lines
Quoted 69 lines

I will clean this better and resubmit
Thank you
Nick

     > Have you also considered new function or macro that check device
     > support? This would separate formatfunctionality code from routine
     > that identifies applicable devices- in case if in future more devices
     > will require quirk.
    
     The split can be done later.  It's always hard to know what kind of
     quirk would be needed in future.  If any more devices show the same
     problem, we can reorganize the quirk in a saner way.

     thanks,
    
     Takashi

     >
     > Michal W.
     >
     > >> ---
     > >>   sound/usb/format.c | 28 +++++++++++++++++++++++++---
     > >>   1 file changed, 25 insertions(+), 3 deletions(-)
     > >>
     > >> diff --git a/sound/usb/format.c b/sound/usb/format.c
     > >> index c02b51a82775..05442f6ada62 100644
     > >> --- a/sound/usb/format.c
     > >> +++ b/sound/usb/format.c
     > >> @@ -313,10 +313,32 @@ static int parse_audio_format_rates_v2v3(struct
     snd_usb_audio *chip,
     > >>                          tmp, sizeof(tmp));
     > >>            if (ret < 0) {
     > >> -          dev_err(&dev->dev,
     > >> -                  "%s(): unable to retrieve number of sample rates
     (clock %d)\n",
     > >> +          switch (chip->usb_id) {
     > >> +          /* LINE 6 HX pedals don't support getting the clock sample
     rate.
     > >> +           * Set the framerate to 48khz by default
     > >> +           */
     > >> +          case USB_ID(0x0E41, 0x4244): /* HELIX */
     > >> +          case USB_ID(0x0E41, 0x4246): /* HX STOMP */
     > >> +                  dev_warn(&dev->dev,
     > >> +                          "%s(): line6 helix: unable to retrieve
     number of sample rates. Set it to default value (clock %d).\n",
     > >>                            __func__, clock);
     > >> -          goto err;
     > >> +                  fp->nr_rates = 1;
     > >> +                  fp->rate_min = 48000;
     > >> +                  fp->rate_max = 48000;
     > >> +                  fp->rates = SNDRV_PCM_RATE_48000;
     > >> +                  fp->rate_table = kmalloc(sizeof(int), GFP_KERNEL);
     > >> +                  if (!fp->rate_table) {
     > >> +                          ret = -ENOMEM;
     > >> +                          goto err_free;
     > >> +                  }
     > >> +                  fp->rate_table[0] = 48000;
     > >> +                  return 0;
     > >> +          default:
     > >> +                  dev_err(&dev->dev,
     > >> +                          "%s(): unable to retrieve number of sample
     rates (clock %d)\n",
     > >> +                                  __func__, clock);
     > >> +                  goto err;
     > >> +          }
     > >>    }
     > >>            nr_triplets = (tmp[1] << 8) | tmp[0];
     > >> --
     > >> 2.19.1
Quoted 10 lines
     > >>
     > >>
     > > _______________________________________________
     > > Alsa-devel mailing list
     > > [email protected]
     > > https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
     > >
     >

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#7 lore raw
Quoted 13 lines · Michal
Quoted 13 lines
Quoted 8 lines

My idea is that if line6 in the future fixes their code (they are quite active on the helix line) the call will not fail and we get a proper device without quirks.
But If the driver fail to get the clock this settings works as a "failsafe" and get the device working.
I also tried to contact their support but they don't care a lot about Linux for now :-(

The fallback might be good, but I'm not sure whether there are many devices that hit the same problem. If we encounter more, let's try to make it as a fallback.
thanks,

Quoted 4 lines
Quoted 1 line

Takashi

Since there is a chance that the issue will be addressed in USB device FW thanthe fallback mechanism will make sense. It would cover eventual future scenario withdevices that will have the issue fixed.

Fair enough. Let's handle it as fallback, then.

thanks,

Takashi