From patchwork Tue Nov 22 09:02:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "K, Kiran" X-Patchwork-Id: 628068 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02480C433FE for ; Tue, 22 Nov 2022 08:53:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232355AbiKVIxb (ORCPT ); Tue, 22 Nov 2022 03:53:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232102AbiKVIxa (ORCPT ); Tue, 22 Nov 2022 03:53:30 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67EB010B6F for ; Tue, 22 Nov 2022 00:53:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669107209; x=1700643209; h=from:to:cc:subject:date:message-id; bh=qiltSLMTb8npvmMquLgjAxBzu1BxxDUvT4WAtEgtcOA=; b=I7n+0jnikJGKMaGWIh9C3DGSAe1cGkopcKlvw1uz9//9zY482VMdNBhX XLuIM+FyRgmqve6CunuBm7F6AohvexjVTcASC6HrEseqCYDdtQ8Qsxmpv 88BPphIi3SNzy8xtJeEeHsXM5ytfnSWsn0j2LGEyNQKwki5rXgOfS8+P0 jjSnPq/kQ7aR9B1dxMFZDm89VzDKMoOW7XXC+I795ePXBGIG1eg2oQGml wdE5mvknbAtTzT1YESjytw2Ca+008JoE7DYrfe1xGln5L/l4YAMsneDeP 3espKLcT17pRYBr0DHqsu7tSju7m+4MOQ5sydhhIqX3w3dl3nITXpGkNy w==; X-IronPort-AV: E=McAfee;i="6500,9779,10538"; a="340635754" X-IronPort-AV: E=Sophos;i="5.96,183,1665471600"; d="scan'208";a="340635754" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2022 00:53:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10538"; a="816029132" X-IronPort-AV: E=Sophos;i="5.96,183,1665471600"; d="scan'208";a="816029132" Received: from intel-lenovo-legion-y540-15irh-pg0.iind.intel.com ([10.224.186.95]) by orsmga005.jf.intel.com with ESMTP; 22 Nov 2022 00:53:27 -0800 From: Kiran K To: linux-bluetooth@vger.kernel.org Cc: ravishankar.srivatsa@intel.com, Chethan T N , Kiran K Subject: [PATCH v3 1/2] Bluetooth: Remove codec id field in vendor codec definition Date: Tue, 22 Nov 2022 14:32:56 +0530 Message-Id: <20221122090257.26564-1-kiran.k@intel.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Chethan T N As per the specfication vendor codec id is defined. BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E page 2127 Fixes: 9ae664028a9e ("Bluetooth: Add support for Read Local Supported Codecs V2") Signed-off-by: Chethan T N Signed-off-by: Kiran K --- changes in v3: Add "Fixes" tag in commit message changes in v2: Fix typo in commit message include/net/bluetooth/hci.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 7a8a19bef92c..8d773b042c85 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -1455,7 +1455,6 @@ struct hci_std_codecs_v2 { } __packed; struct hci_vnd_codec_v2 { - __u8 id; __le16 cid; __le16 vid; __u8 transport; From patchwork Tue Nov 22 09:02:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "K, Kiran" X-Patchwork-Id: 627607 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 151F8C433FE for ; Tue, 22 Nov 2022 08:53:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232575AbiKVIxe (ORCPT ); Tue, 22 Nov 2022 03:53:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232102AbiKVIxc (ORCPT ); Tue, 22 Nov 2022 03:53:32 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25C626312 for ; Tue, 22 Nov 2022 00:53:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669107211; x=1700643211; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=VdNSJ4+DvnIiQ5O3FAm82fPJcD7pWNhA55fS3VLRpHI=; b=eQzW2jaVC5xwTUa5CQFfmOrER1FvBRF3lT/OmBOI7tW9cvLJfyiFtlEk Lz4N70WzFxVsIBgqV1KUPuv4pEuwe6m7AUorgixbnSIONmEj7veGq/GlG bvrEHDrFjEBPbVmq0KNPZzfWtIH6MLLi7L6LsLxG5iWW+3u68jD442FrX Eqmwe0sBffmRQgtWAvva4bJhpQazjN27/h3XiNTaufigAeQzm/w37bVXN tteO6Cx9wfSykFoJbOL2K8uYByDTcmdUt+7BbCtqKE2UbodujTuaAp6mV rCfyMON3419UZ79opZYbhNm3QMUFb7sqN1Ep1SSMq20oqnEgLFp3k+zIz g==; X-IronPort-AV: E=McAfee;i="6500,9779,10538"; a="340635758" X-IronPort-AV: E=Sophos;i="5.96,183,1665471600"; d="scan'208";a="340635758" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2022 00:53:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10538"; a="816029138" X-IronPort-AV: E=Sophos;i="5.96,183,1665471600"; d="scan'208";a="816029138" Received: from intel-lenovo-legion-y540-15irh-pg0.iind.intel.com ([10.224.186.95]) by orsmga005.jf.intel.com with ESMTP; 22 Nov 2022 00:53:29 -0800 From: Kiran K To: linux-bluetooth@vger.kernel.org Cc: ravishankar.srivatsa@intel.com, Chethan T N , Kiran K Subject: [PATCH v3 2/2] Bluetooth: Fix support for Read Local Supported Codecs V2 Date: Tue, 22 Nov 2022 14:32:57 +0530 Message-Id: <20221122090257.26564-2-kiran.k@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221122090257.26564-1-kiran.k@intel.com> References: <20221122090257.26564-1-kiran.k@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Chethan T N Handling of Read Local Supported Codecs was broken during the HCI serialization design change patches. Fixes: d0b137062b2d ("Bluetooth: hci_sync: Rework init stages") Signed-off-by: Chethan T N Signed-off-by: Kiran K --- changes in v3: No change changes in v2: Fix typo in commit message net/bluetooth/hci_codec.c | 19 ++++++++++--------- net/bluetooth/hci_sync.c | 10 ++++++---- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/net/bluetooth/hci_codec.c b/net/bluetooth/hci_codec.c index 38201532f58e..3cc135bb1d30 100644 --- a/net/bluetooth/hci_codec.c +++ b/net/bluetooth/hci_codec.c @@ -72,9 +72,8 @@ static void hci_read_codec_capabilities(struct hci_dev *hdev, __u8 transport, continue; } - skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_CODEC_CAPS, - sizeof(*cmd), cmd, - HCI_CMD_TIMEOUT); + skb = __hci_cmd_sync_sk(hdev, HCI_OP_READ_LOCAL_CODEC_CAPS, + sizeof(*cmd), cmd, 0, HCI_CMD_TIMEOUT, NULL); if (IS_ERR(skb)) { bt_dev_err(hdev, "Failed to read codec capabilities (%ld)", PTR_ERR(skb)); @@ -127,8 +126,8 @@ void hci_read_supported_codecs(struct hci_dev *hdev) struct hci_op_read_local_codec_caps caps; __u8 i; - skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_CODECS, 0, NULL, - HCI_CMD_TIMEOUT); + skb = __hci_cmd_sync_sk(hdev, HCI_OP_READ_LOCAL_CODECS, 0, NULL, + 0, HCI_CMD_TIMEOUT, NULL); if (IS_ERR(skb)) { bt_dev_err(hdev, "Failed to read local supported codecs (%ld)", @@ -158,7 +157,8 @@ void hci_read_supported_codecs(struct hci_dev *hdev) for (i = 0; i < std_codecs->num; i++) { caps.id = std_codecs->codec[i]; caps.direction = 0x00; - hci_read_codec_capabilities(hdev, LOCAL_CODEC_ACL_MASK, &caps); + hci_read_codec_capabilities(hdev, + LOCAL_CODEC_ACL_MASK | LOCAL_CODEC_SCO_MASK, &caps); } skb_pull(skb, flex_array_size(std_codecs, codec, std_codecs->num) @@ -178,7 +178,8 @@ void hci_read_supported_codecs(struct hci_dev *hdev) caps.cid = vnd_codecs->codec[i].cid; caps.vid = vnd_codecs->codec[i].vid; caps.direction = 0x00; - hci_read_codec_capabilities(hdev, LOCAL_CODEC_ACL_MASK, &caps); + hci_read_codec_capabilities(hdev, + LOCAL_CODEC_ACL_MASK | LOCAL_CODEC_SCO_MASK, &caps); } error: @@ -194,8 +195,8 @@ void hci_read_supported_codecs_v2(struct hci_dev *hdev) struct hci_op_read_local_codec_caps caps; __u8 i; - skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_CODECS_V2, 0, NULL, - HCI_CMD_TIMEOUT); + skb = __hci_cmd_sync_sk(hdev, HCI_OP_READ_LOCAL_CODECS_V2, 0, NULL, + 0, HCI_CMD_TIMEOUT, NULL); if (IS_ERR(skb)) { bt_dev_err(hdev, "Failed to read local supported codecs (%ld)", diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index d36d72352059..9e2d7e4b850c 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -12,6 +12,7 @@ #include #include "hci_request.h" +#include "hci_codec.h" #include "hci_debugfs.h" #include "smp.h" #include "eir.h" @@ -4257,11 +4258,12 @@ static int hci_set_event_mask_page_2_sync(struct hci_dev *hdev) /* Read local codec list if the HCI command is supported */ static int hci_read_local_codecs_sync(struct hci_dev *hdev) { - if (!(hdev->commands[29] & 0x20)) - return 0; + if (hdev->commands[45] & 0x04) + hci_read_supported_codecs_v2(hdev); + else if (hdev->commands[29] & 0x20) + hci_read_supported_codecs(hdev); - return __hci_cmd_sync_status(hdev, HCI_OP_READ_LOCAL_CODECS, 0, NULL, - HCI_CMD_TIMEOUT); + return 0; } /* Read local pairing options if the HCI command is supported */