From patchwork Sun Apr 14 11:13:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roope Salmi X-Patchwork-Id: 10899803 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C1A1A1515 for ; Sun, 14 Apr 2019 11:14:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C7C428AAE for ; Sun, 14 Apr 2019 11:14:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9094128ABA; Sun, 14 Apr 2019 11:14:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2831F28AAE for ; Sun, 14 Apr 2019 11:14:22 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5AF47853; Sun, 14 Apr 2019 13:13:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5AF47853 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1555240460; bh=2mAFYV7pPpU1ul6j6RZiseLOd335WvRucZYy2mntCW4=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=SHlmF6w8Da+v5B9K8G2s+NB+H+7MT4pMFK7CnFzjSWcROEZoMYGS72dysodcacsYD T5RimMedmXVI25NPBL0xd+2+fRjydtViwrGbSSoMU9NqQW1vy9ngmZ/zAHzljO1cfD O4b7LrJSyWria8YQ+7JMGxc59HwwS1NZaPSQ36qI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id CBE6BF896E3; Sun, 14 Apr 2019 13:13:29 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4BCF1F896E4; Sun, 14 Apr 2019 13:13:28 +0200 (CEST) Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AEC68F806ED; Sun, 14 Apr 2019 13:13:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AEC68F806ED Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ny7KpgCt" Received: by mail-ed1-x543.google.com with SMTP id j20so1889125edq.10; Sun, 14 Apr 2019 04:13:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=V3H4LqzXLO9MKtnrKVxIJyWJVHpG7lJuUCZ0v2X4xYw=; b=ny7KpgCtngiopA4w/FeXS09xbkxYZu+0Qnpzl0whu6Pr8Vv3y/9An1UflLJLH/TYE1 cChJrD4x801Guf+UE8p8YGE8xFFSM9NVJezw86IDkbac2PtK9a3oMTGAduhRJ24qP8OP 1oH00P4l7pzUcf0rorOsRaYD/2jy/iFvrwCMBr9t4EddrVEEvZGebG2n9PvspecOrJfH PC1N7pSlz4WG52zSvhq8IGORTzF9kP/DcY8WFChG7+j0rhbz8XwWXBRpdhmIX03gBEvy UiVt7SSYYrXGW4yra4AeGoxOter/Otjoa3/arA9/uaCxGMFomI8Z8oXVh+fNE+PiHQ8F CwqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=V3H4LqzXLO9MKtnrKVxIJyWJVHpG7lJuUCZ0v2X4xYw=; b=jfhratJxuvnHQhPpjsQ3G1s9DbAkhG3VSGMTLC8NgAcB/9iDgXrbgnAocZCFqryMww r1xq1cc4BPv7WWZzC3xdtTlyVNSM8FKre7+Fb81tffC+7Kq5NU2/aeZ7Nklhv1t8f1tG xjGlPg5UR4HvuUxXz50sWyND9/WkwnrG/X1E+mpn4eDVG0hSEXQxa/AqMTcB3huidV8z j2wU1NYbUUCD3VFD81YhV+PcUjevsfsVB4ESudb5Fritj95FD3Ksw8WxvJW5mzVwlfVU yMsL/+FRBtZ1gSvMbHXSQaUn4/ukolfaTobhvU611OXUP4OCJz+UraMwEWOHXQct4dih lYwg== X-Gm-Message-State: APjAAAW6fJvAbb34lfHTgkMFywB2hfST16TdyWo3S+i5YE0OEzo3L15W wTtUPNwkLthOMphxMWdsxC7w4LGyIpgSuQ== X-Google-Smtp-Source: APXvYqwM9mqlTe/oMGV7CaTHrtEvO1GIp+xD0NM4Ydx5FIdXaX0HrxzS2fyHEcTejrCyKtR6gg/9Jw== X-Received: by 2002:aa7:cb4a:: with SMTP id w10mr34037239edt.246.1555240403642; Sun, 14 Apr 2019 04:13:23 -0700 (PDT) Received: from localhost.localdomain (ollpu.fi. [188.166.85.219]) by smtp.gmail.com with ESMTPSA id z3sm7202888eja.32.2019.04.14.04.13.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Apr 2019 04:13:23 -0700 (PDT) From: Roope Salmi To: patch@alsa-project.org Date: Sun, 14 Apr 2019 14:13:06 +0300 Message-Id: <20190414111306.6376-1-rpsalmi@gmail.com> X-Mailer: git-send-email 2.17.1 Cc: alsa-devel@alsa-project.org, Roope Salmi Subject: [alsa-devel] [PATCH] ALSA: usb-audio: Add quirk for Focusrite Scarlett Solo X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP The device reports Synch: Synchronous on the playback interface. This causes regular audible napping on sample rates that are not multiples of 1 kHz. Fix to Synch: Asynchronous. Specifically observed on Focusrite Scarlett Solo 2nd generation. I assume the first generation model has a different device ID. A first generation Scarlett 2i2 I was able to test advertised Synch: Asynchronous by default. For example, with a sample rate of 44100 Hz, a silent sample is played every 40.96 seconds (likely 44.0 samples instead of 44.1 transmitted per USB frame on average, 4096 being the size of some internal buffer). There may be some other bug at play here since this doesn't happen on other platforms. However, a feedback endpoint is listed and using it fixes the issue. That is the only change in the quirk, but I didn't find a way to declare only it. Tested on two units and on two different computers. Signed-off-by: Roope Salmi diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h index 86e80916a..5525f9043 100644 --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h @@ -2770,6 +2770,90 @@ YAMAHA_DEVICE(0x7010, "UB99"), .type = QUIRK_MIDI_NOVATION } }, +{ + /* + * Focusrite Scarlett Solo 2nd generation + * Reports that playback should use Synch: Synchronous + * while still providing a feedback endpoint. Synchronous causes + * snapping on some sample rates. + * Force it to use Synch: Asynchronous. + */ + USB_DEVICE(0x1235, 0x8205), + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { + .ifnum = QUIRK_ANY_INTERFACE, + .type = QUIRK_COMPOSITE, + .data = (const struct snd_usb_audio_quirk[]) { + { + .ifnum = 1, + .type = QUIRK_AUDIO_FIXED_ENDPOINT, + .data = & (const struct audioformat) { + .formats = SNDRV_PCM_FMTBIT_S32_LE, + .channels = 2, + .iface = 1, + .altsetting = 1, + .altset_idx = 1, + .attributes = 0, + .endpoint = 0x01, + .ep_attr = USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC, + .protocol = UAC_VERSION_2, + .rates = SNDRV_PCM_RATE_44100 | + SNDRV_PCM_RATE_48000 | + SNDRV_PCM_RATE_88200 | + SNDRV_PCM_RATE_96000 | + SNDRV_PCM_RATE_176400 | + SNDRV_PCM_RATE_192000, + .rate_min = 44100, + .rate_max = 192000, + .nr_rates = 6, + .rate_table = (unsigned int[]) { + 44100, 48000, 88200, + 96000, 176400, 192000 + }, + .clock = 41 + } + }, + { + .ifnum = 2, + .type = QUIRK_AUDIO_FIXED_ENDPOINT, + .data = & (const struct audioformat) { + .formats = SNDRV_PCM_FMTBIT_S32_LE, + .channels = 2, + .iface = 2, + .altsetting = 1, + .altset_idx = 1, + .attributes = 0, + .endpoint = 0x82, + .ep_attr = USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC | + USB_ENDPOINT_USAGE_IMPLICIT_FB, + .protocol = UAC_VERSION_2, + .rates = SNDRV_PCM_RATE_44100 | + SNDRV_PCM_RATE_48000 | + SNDRV_PCM_RATE_88200 | + SNDRV_PCM_RATE_96000 | + SNDRV_PCM_RATE_176400 | + SNDRV_PCM_RATE_192000, + .rate_min = 44100, + .rate_max = 192000, + .nr_rates = 6, + .rate_table = (unsigned int[]) { + 44100, 48000, 88200, + 96000, 176400, 192000 + }, + .clock = 41 + } + }, + { + .ifnum = 3, + .type = QUIRK_IGNORE_INTERFACE + }, + { + .ifnum = -1 + } + } + } +}, /* Access Music devices */ {