Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2324848pxv; Sun, 11 Jul 2021 09:30:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBpbyi1Hz5xipL1w4kmhgU8GiR+tG+3jNM+Lsh+POYW7QoZszJUnzcIfDowjXNnQA9BwBU X-Received: by 2002:a5d:9c02:: with SMTP id 2mr23480656ioe.152.1626021037020; Sun, 11 Jul 2021 09:30:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1626021037; cv=pass; d=google.com; s=arc-20160816; b=Jkn99vdwDZ2SefsS8FwmaHQbyO+Xc7hcqKrSyL1JeeZ/To9v1TJFkF86I6Bc6TsCmI yRcKKFwzv6gzHMuxK/zHXBI1b9o14I4imHclYfaFq9hIGcJ5Kx55BOhA0Y/KRnEKZdds XURPJzoHqFc2b8vU4wq6Ay6OA3tw6br3Qhc4C0oMaMKu3Cn3ucwir+yp4sWliXDLkRhc KYYfbelGCAEfagnsNmzxjTnHv6UyTx6zgNX0eJ77WHP99OJ0mlbq/CNOr1MDPYnrKI1O BbP37OEaW8+yJwmWbLsjxt/L7K/Up+agSBSjldbUL9ZTv4s89r95iPEfdLquYdep3RKG whKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:to:from:subject:message-id :dkim-signature; bh=PDLZvLy8I83zvIaAmKV427EtcxLvFicAYPkS9ZW9J+s=; b=j+bSQxVtuefRFlVfYjimnY4kDoUv8Qrz40DFilsne1sG/4ibaNl/GdGYtvc4rVAkHo oz51S3kpsgPdLVXKJbFke5Dn1sEf7EM1vQMebo+503L437pAqkxfeJESZMKYbV2ok9FT yyDi4YPVFWF0vIg1xRx9GxxkpoCpa6jwD+7FAhGaW8i/DRHrbb3n0LDv7riahRKOr86Y BLuNykgBNyDew1pARjnaUOY82unuXlAOYG/L+6eRDkTJtgrZXZ6h0HX+0b9LpOvWrH5f CUGUjWwNhvvAwz+FMbYT+i7bhJA2qcldZnFWTZfGwG5cP0PfYhKR+kc5d94rSxFADG4u pbpA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@iki.fi header.s=lahtoruutu header.b=jgl59zvI; arc=pass (i=1); spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z10si12499897ilz.130.2021.07.11.09.30.25; Sun, 11 Jul 2021 09:30:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@iki.fi header.s=lahtoruutu header.b=jgl59zvI; arc=pass (i=1); spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236056AbhGKPg5 (ORCPT + 99 others); Sun, 11 Jul 2021 11:36:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236100AbhGKPg4 (ORCPT ); Sun, 11 Jul 2021 11:36:56 -0400 Received: from lahtoruutu.iki.fi (lahtoruutu.iki.fi [IPv6:2a0b:5c81:1c1::37]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91439C0613DD for ; Sun, 11 Jul 2021 08:34:08 -0700 (PDT) Received: from [192.168.1.195] (91-152-122-41.elisa-laajakaista.fi [91.152.122.41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pav@iki.fi) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 537791B00215 for ; Sun, 11 Jul 2021 18:34:04 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1626017644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PDLZvLy8I83zvIaAmKV427EtcxLvFicAYPkS9ZW9J+s=; b=jgl59zvIy25Cren37d72m6etKGOWf7gUvFBzaQKuPJ7J/0hhYaH0u8S04PTFwlg6TPATpY lrh58pouU2NMiF04sNCutA1nwtXckcC4ut5X5vopXVmT/fFoBoLN7sHvFVI2viwYCKRxZS 70p+kyrT6elHbP5qKHHsHurblHdOyHJ8u36xCAB0WKYMw5AH9eb/eEqTxnuMaomFOg5jFn K2rf5TXYx4Sh2E0ejHxwPtXyGZse32bouNYWGidNTWKWCss40IGuwFHz+mJ9aCzfGqi/s7 PxAA6yYrdKysmE76+vTVl2X7nrxQgWyGRhH01JWxiyhflvpj7yGbShc8VZbJYg== Message-ID: Subject: Re: [PATCH v2] Bluetooth: btusb: Add support USB ALT 3 for WBS From: Pauli Virtanen To: linux-bluetooth@vger.kernel.org Date: Sun, 11 Jul 2021 18:33:57 +0300 In-Reply-To: <20210514031901.2276-1-hildawu@realtek.com> References: <20210514031901.2276-1-hildawu@realtek.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.2 (3.40.2-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1626017644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PDLZvLy8I83zvIaAmKV427EtcxLvFicAYPkS9ZW9J+s=; b=bkT0ZL55ruf/cYbRkGz/fDxdH7Zm77v0NVeIuJLmDtjUj1e2eawlCLrmt5Ym1O01fdt9NU hwbMzt0G5tOJ40+arb5hSVTZq+RQdJivO9yLMCn4RA5LdKWr7MPjO7kdyG+vwi9MIxSuqQ TKIMOL55dQdorkXKLAyfzljhIvNLLlDZRqfEIgkyU5P6r1cCAmD/E9UvO6sqqVRnKcVNJh +6aRR5S03vK+yKojyjF6o2Nkp4MHMlugPkzzWMTUdNtDKESxBT2CBXZMku0PE8Nj+4hjXz wFQaXyoJbuv0norq+ZdwV61eFQ3QoDkXHLypO+p53oJTQNrfIMq47rpaET9Dqw== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=pav@iki.fi smtp.mailfrom=pav@iki.fi ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1626017644; a=rsa-sha256; cv=none; b=V5HviORjAiiKm1vly3YCxAd8SC+RfQplf09EFN5aeX8JbtIbphHOCbROH9/vtf7lXwKb+Z 7nqKm7dc0Qvn8EU+AtJd+Bfbd+5sqdhfxy0SQR5T3ifN4P/sX4p9glbRhCFwL0nqyGfLZ1 d6iGHLqTNvv1FeDQkF0g0oNGylpRPPmVjKMiyw/kwSexM+RxUOrQCb88GqskBQJ0H7oLZZ cDneI0FOeGhL3o2zBBYX2GHQhUSPRujAbE13zMrhS3tFXaWw1pia9o/lC9BssbBTf3rDhw dvDB3zMMMmAqQFh8mqqHbd2jgokFqHwop+mUJa/uV3BIohwm/E7NKiC4i/tLxA== Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi, pe, 2021-05-14 kello 11:19 +0800, hildawu@realtek.com kirjoitti: > From: Hilda Wu > > Because mSBC frames do not need to be aligned to the SCO packet > boundary. Using USB ALT 3 let HCI payload >= 60 bytes, let mSBC > data satisfy 60 Bytes avoid payload unaligned situation and fixed > some headset no voise issue. > > USB Alt 3 supported also need HFP support transparent MTU in 72 > Bytes. > > Signed-off-by: Hilda Wu > --- > Changes in v2: > - Updated signed off name. > - Adjusted coding style. > --- This change seemed to break msbc audio on some non-realtek adapters I have. Tested Pipewire on BCM20702A1 (0b05:17cb), CSR8510A10 (0a12:0001) -> no sound output and input appears garbled. Reverting this patch makes it work again. Indeed these adapters report SCO mtu=64 which is less than 72. On the other hand, with RTL8761BU (0bda:8771) msbc audio works fine with this patch out of the box, indeed reading/writing 72 byte packets to/from the sco socket. ALT 3 on RTL8761BU does appear to address garbled audio with some headsets. Maybe the altsetting should be determined based on a quirk, the mtu requirement be checked, or something similar? AFAIK, userspace can't do anything to fix this. Best, Pauli Virtanen > --- >  drivers/bluetooth/btusb.c | 7 +++++++ >  1 file changed, 7 insertions(+) > > diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c > index 6f253378e893..1e98f985740b 100644 > --- a/drivers/bluetooth/btusb.c > +++ b/drivers/bluetooth/btusb.c > @@ -1752,6 +1752,13 @@ static void btusb_work(struct work_struct > *work) >                          * which work with WBS at all. >                          */ >                         new_alts = btusb_find_altsetting(data, 6) ? 6 > : > 1; > +                       /* Because mSBC frames do not need to be > aligned to the > +                        * SCO packet boundary. If support the Alt 3, > use the > +                        * Alt 3 for HCI payload >= 60 Bytes let air > packet > +                        * data satisfy 60 bytes. > +                        */ > +                       if (new_alts == 1 && > btusb_find_altsetting(data, 3)) > +                               new_alts = 3; >                 } >   >                 if (btusb_switch_alt_setting(hdev, new_alts) < 0)