Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1142192ybc; Tue, 12 Nov 2019 15:11:37 -0800 (PST) X-Google-Smtp-Source: APXvYqxeMCZs1yVgIXBmrS+LzWFU4g3E1c53ccO3odXt36Hl6m/ET1pdz3iCfuJBGt5OjEIL5u+m X-Received: by 2002:a17:906:86ca:: with SMTP id j10mr14948689ejy.200.1573600297105; Tue, 12 Nov 2019 15:11:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573600297; cv=none; d=google.com; s=arc-20160816; b=ngun7lRp/KPnlZOHtZsA/j43JTsvGzH6NdfcEicf3VSWBIg4jhrSiPlC6yFtwpI6N8 YqShPqVoTwsujgZR0vkJ5Tl4iIB8eKfvZsG6HkcRfLglFCaqS9+NJbk9LrWTqbmd3EDS 6e5r/6Osof6Y9DSlDgEisH3bdssB1m5dsJbsdwwYZdL5fyUd6IaRP3lH/s2/b/sva5IP 1sIuWoQuJxToDpXR1RamEfz+wk7sy6kH3PySQUqfq9gWbUR2qbrbzQ0ROCBOrEVA+Tpz FWhQ86Z6NtomMo64BrW8Sti63m1XV6ly86xVGcN81wHknySWbNepjUAYtS65G4Fz4cRH EbMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DQ6XcZg7xLQAjI50kff+ffMiPWugeYruhnhm0kHYgB8=; b=oUWBXFmfjjJgtKAwQzvxCayEGrX6bVP5f2m4B1PFcHVfa9Iovs7Rx+tdQsGCf38gAC WDa9Fru2P7/7tyP+EM6w9oNnWwyLtselUv5EA4Y71q415tWqAWKLCSKEsia4CAhbB5bp 8fwB+ba8aPR8fRWo3N1GHS1BsomU2MwaheCFBiF+qe0xoRi76ly5CYF5t7HyPRHvbhXY idpnIMoDt3GPsyR+uZIPYs47pzM1QA8NUHf8VwC0ibt+ytpiqyCsqJVO7g0ARpJqIJaE pXskxwHGsbuKeeOeGeKkbdqyMPZP+khEgF2VbH9zJZQt3ax4QvS8t1rvcXly6QzqiOD3 HSlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BoQzFM4B; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p8si35689edq.55.2019.11.12.15.11.13; Tue, 12 Nov 2019 15:11:37 -0800 (PST) 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; dkim=pass header.i=@chromium.org header.s=google header.b=BoQzFM4B; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727283AbfKLXKQ (ORCPT + 99 others); Tue, 12 Nov 2019 18:10:16 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:40721 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727223AbfKLXKP (ORCPT ); Tue, 12 Nov 2019 18:10:15 -0500 Received: by mail-pg1-f196.google.com with SMTP id 15so1952pgt.7 for ; Tue, 12 Nov 2019 15:10:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DQ6XcZg7xLQAjI50kff+ffMiPWugeYruhnhm0kHYgB8=; b=BoQzFM4B5Luxo3/N/T7knT9+4U9Utp13yw6bmxoP775K884BbudvlNvPgIHTy8RU/R RI3maQl8QjSK5cmE8QVCdkJ1mWeBrD7olWFye0ljk5gRRi+CDnUDRLYT3q4m2vHeLnBr 6+p8lGrqa57zqKmalvdN0Qdqb5Hv6iObSW1aU= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=DQ6XcZg7xLQAjI50kff+ffMiPWugeYruhnhm0kHYgB8=; b=dxsF0iYbvl/XVmE6t3v/vOtSAdLREfAjjyuRjdhW/HlfcQ+YccFx7T/z/1WyAwZ5jK l+OF56VZriCAEMJn4DUGqyp2vIedjJnBUDiLTnsSE9C3RqyPck4bDm6TZDtwsIuru56u 5mFrl8vCpxPSJt2dlwRpix81pmySyru0dGUafrcGidwzMu3aYzK55fU3Y0fxa41+Ja1K sAWnfGnDvpzfSbxXkTm192HOWlbAFk3Hi2kUo1Fxe8pqrANZTBOgqtu/x8EMQ2fgy/Ff ektF50dytZiWJGu2U+ZoahrJROIMUDNYAiBTDCliWcKwIlG1X4/qnGZkElQoy+w2fvc7 ZnRg== X-Gm-Message-State: APjAAAVHVXLX754Vk0locrPDOqx81O8sP5pytDKdquNSRf1sv5KFddEA 3Qf89pL8NQDRADE+s+24Lzs39w== X-Received: by 2002:a63:e009:: with SMTP id e9mr55518pgh.222.1573600211829; Tue, 12 Nov 2019 15:10:11 -0800 (PST) Received: from apsdesk.mtv.corp.google.com ([2620:15c:202:1:e09a:8d06:a338:aafb]) by smtp.gmail.com with ESMTPSA id w27sm67694pgc.20.2019.11.12.15.10.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2019 15:10:10 -0800 (PST) From: Abhishek Pandit-Subedi To: Marcel Holtmann , Johan Hedberg , Rob Herring Cc: linux-bluetooth@vger.kernel.org, dianders@chromium.org, Abhishek Pandit-Subedi , linux-kernel@vger.kernel.org Subject: [PATCH v4 2/4] Bluetooth: btbcm: Support pcm configuration Date: Tue, 12 Nov 2019 15:09:42 -0800 Message-Id: <20191112230944.48716-3-abhishekpandit@chromium.org> X-Mailer: git-send-email 2.24.0.rc1.363.gb1bccd3e3d-goog In-Reply-To: <20191112230944.48716-1-abhishekpandit@chromium.org> References: <20191112230944.48716-1-abhishekpandit@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add BCM vendor specific command to configure PCM parameters. The new vendor opcode allows us to set the sco routing, the pcm interface rate, and a few other pcm specific options (frame sync, sync mode, and clock mode). See broadcom-bluetooth.txt in Documentation for more information about valid values for those settings. Here is an example trace where this opcode was used to configure a BCM4354: < HCI Command: Vendor (0x3f|0x001c) plen 5 01 02 00 01 01 > HCI Event: Command Complete (0x0e) plen 4 Vendor (0x3f|0x001c) ncmd 1 Status: Success (0x00) Signed-off-by: Abhishek Pandit-Subedi --- Changes in v4: None Changes in v3: None Changes in v2: None drivers/bluetooth/btbcm.c | 18 ++++++++++++++++++ drivers/bluetooth/btbcm.h | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index 2d2e6d862068..d22a2025f7e1 100644 --- a/drivers/bluetooth/btbcm.c +++ b/drivers/bluetooth/btbcm.c @@ -105,6 +105,24 @@ int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) } EXPORT_SYMBOL_GPL(btbcm_set_bdaddr); +int btbcm_set_pcm_int_params(struct hci_dev *hdev, + const struct bcm_set_pcm_int_params *int_params) +{ + struct sk_buff *skb; + int err; + + skb = __hci_cmd_sync(hdev, 0xfc1c, 5, int_params, HCI_INIT_TIMEOUT); + if (IS_ERR(skb)) { + err = PTR_ERR(skb); + bt_dev_err(hdev, "BCM: Set PCM int params failed (%d)", err); + return err; + } + kfree_skb(skb); + + return 0; +} +EXPORT_SYMBOL_GPL(btbcm_set_pcm_int_params); + int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw) { const struct hci_command_hdr *cmd; diff --git a/drivers/bluetooth/btbcm.h b/drivers/bluetooth/btbcm.h index d204be8a84bf..bf9d86924787 100644 --- a/drivers/bluetooth/btbcm.h +++ b/drivers/bluetooth/btbcm.h @@ -54,6 +54,8 @@ struct bcm_set_pcm_format_params { int btbcm_check_bdaddr(struct hci_dev *hdev); int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr); int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw); +int btbcm_set_pcm_int_params(struct hci_dev *hdev, + const struct bcm_set_pcm_int_params *int_params); int btbcm_setup_patchram(struct hci_dev *hdev); int btbcm_setup_apple(struct hci_dev *hdev); @@ -74,6 +76,12 @@ static inline int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) return -EOPNOTSUPP; } +int btbcm_set_pcm_int_params(struct hci_dev *hdev, + const struct bcm_set_pcm_int_params *int_params) +{ + return -EOPNOTSUPP; +} + static inline int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw) { return -EOPNOTSUPP; -- 2.24.0.rc1.363.gb1bccd3e3d-goog