public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicola Lunghi <nick83ola@gmail.com>
To: alsa-devel@alsa-project.org
Cc: info@jensverwiebe.de, Nicola Lunghi <nick83ola@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Allison Randal <allison@lohutok.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Richard Fontana <rfontana@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jussi Laako <jussi@sonarnerd.net>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] ALSA: usb-audio: fix Line6 Helix audio format rates
Date: Tue,  2 Jul 2019 01:43:14 +0100	[thread overview]
Message-ID: <20190702004439.30131-1-nick83ola@gmail.com> (raw)

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 <nick83ola@gmail.com>
---
 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


             reply	other threads:[~2019-07-02  0:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-02  0:43 Nicola Lunghi [this message]
2019-07-02 14:37 ` [PATCH] ALSA: usb-audio: fix Line6 Helix audio format rates Takashi Iwai
2019-07-02 15:52   ` [alsa-devel] " Wasko, Michal
2019-07-02 15:57     ` Takashi Iwai
     [not found]       ` <CABPh3UMttE1s7oNt0-JLNm2N3wxb-JXBTLzMYZM42ENiy9NC9Q@mail.gmail.com>
2019-07-03  7:49         ` Takashi Iwai
2019-07-03  8:26           ` Wasko, Michal
2019-07-03  8:32             ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190702004439.30131-1-nick83ola@gmail.com \
    --to=nick83ola@gmail.com \
    --cc=allison@lohutok.net \
    --cc=alsa-devel@alsa-project.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=info@jensverwiebe.de \
    --cc=jussi@sonarnerd.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=rfontana@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox