Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp586384ybi; Wed, 3 Jul 2019 01:27:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbTlbNbkocBuXg+QDGiWw+SiEoaDEL7S7joDC4DLbUaP3sosFHiY+Ww0VMsll+HkA/b7AB X-Received: by 2002:a17:902:28e9:: with SMTP id f96mr39195076plb.114.1562142439674; Wed, 03 Jul 2019 01:27:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562142439; cv=none; d=google.com; s=arc-20160816; b=GaTH3TKs3jKXhAOAjWpK05/wRq1Lpczyjii+XyOf/goAdUa/SJFiQp0UhLkQEvmJf+ EM1tWhOzVfPKziCW5OdnAloy6epumiVGB3X7vge3FTFUiWEpemOzxtoTKjjdoDA+cclr apwSrBWnylrIEMa0BDXt03wOi33K9V91LaAOPkWoknUbI30TiTXmmE7EXXnD5q7TgdQB /Wo5+n5tY09s76gXAXZRqgaZwaqxT4Mk//sVaxRLMLrjGflFfS1/UGw+mlPwDvKbxtig 9NLbwZbzmsxfGdkfoVXkovhBLAf2R4S/UlIiWGNy9DNFjQg/voHaDCyAxmvxU2y2i15T yPeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=vja9p+0CUN7mgTAInYReFHqzok5LJ5EiNpyPAxFEFhw=; b=wmyY5m7yLnVblRygfnkHPcO6DV5o+5RIr4Ra2DdsX/fiZSimKHpkt6OGpYhm53TOUu vaIvbLgvphddfZVwORpa4in2+gJmmYKProRXHDx67YiNox98SmMkEVuUpr8g/161Yqov dlydglXWoqRFlAXLYIazdiIiuQuC++uY5chKjua7nVOZTvGZLqyBkRqUDlFevL+ZWXaZ DrnB0XRm+drsh8dmrI5AzfmSuTArhp3nocpMjyTXeqrSsZaMXnx54ROlNCNt2Dq2Vr7M oYXUKcN2jVvpmmD1qiR2avSb3I5WB9jqOeVLQhqQheruUepR6M6+jod/TWEFUljt8QWe DC4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f131si1696236pgc.265.2019.07.03.01.27.04; Wed, 03 Jul 2019 01:27:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727227AbfGCI0h (ORCPT + 99 others); Wed, 3 Jul 2019 04:26:37 -0400 Received: from mga03.intel.com ([134.134.136.65]:8442 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726670AbfGCI0g (ORCPT ); Wed, 3 Jul 2019 04:26:36 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jul 2019 01:26:36 -0700 X-IronPort-AV: E=Sophos;i="5.63,446,1557212400"; d="scan'208";a="157893901" Received: from mwasko-mobl.ger.corp.intel.com (HELO [10.237.137.181]) ([10.237.137.181]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/AES256-SHA; 03 Jul 2019 01:26:33 -0700 Subject: Re: [alsa-devel] [PATCH] ALSA: usb-audio: fix Line6 Helix audio format rates To: Takashi Iwai , nick83ola Cc: alsa-devel@alsa-project.org, info@jensverwiebe.de, Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Richard Fontana , Jussi Laako , Thomas Gleixner , Allison Randal References: <20190702004439.30131-1-nick83ola@gmail.com> <4181a467-5332-c256-5124-513a0343ec70@linux.intel.com> From: "Wasko, Michal" Message-ID: <38462424-4e2b-bdbd-f7cc-ea94385924e0@linux.intel.com> Date: Wed, 3 Jul 2019 10:26:31 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/3/2019 9:49 AM, Takashi Iwai wrote: > On Wed, 03 Jul 2019 09:41:00 +0200, > nick83ola wrote: >> On Tue 2 Jul 2019, 16:57 Takashi Iwai, 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 >> > > 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. > >> 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? > >> > > >> > > 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? >> > > >> >> 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? > > >> > > >> > > Thanks! >> > > >> > > Takashi >> > >> >> Thank you >> >> > 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. > > >> 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 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. >> 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 >> > >> >> > >> >> > > _______________________________________________ >> > > Alsa-devel mailing list >> > > Alsa-devel@alsa-project.org >> > > https://mailman.alsa-project.org/mailman/listinfo/alsa-devel >> > > >> > >> >> > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > https://mailman.alsa-project.org/mailman/listinfo/alsa-devel