Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6864055ybx; Mon, 11 Nov 2019 16:21:53 -0800 (PST) X-Google-Smtp-Source: APXvYqzxAYgZ2Kneno/sl+zsH1Jt6wrHaXFAeLpoWs7J2S+QOBjqXiYJsqd6RrgUH77zyYk3cQU8 X-Received: by 2002:a17:906:bce5:: with SMTP id op5mr25718216ejb.325.1573518113477; Mon, 11 Nov 2019 16:21:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573518113; cv=none; d=google.com; s=arc-20160816; b=HMI2FDOShKvdicbPHu8/uMARApSk9ZF9poinrU1enJQKEx3G34PlhRYyi8hYIlmVLf Ar3lCLSrh7LSbLcGFaL8TnenYgaOJQ1EVEJ4fTaDezJ6/xILK0szeR1mP/Cd3iUHvL0e d8xgWCfmRPK0MAYsmi/4bSgVLFmrHvPZ6Rn06g4WBUekJIGqiML8P0Os46RajPGqB7ZC 1H/JOdxqP7ZDq24tbZGeyzyfnFrDbw3rKJ1ISRqVukM2MkL/SrGrmAlYnoRJ4ztf/Iqt C/PIxo2ho1047gzaPNPZFK1Vez4+Q9NwhBUt+GWf+fgfKbMemDmtKv+mL6cunIeR9TTa me8g== 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=JHJkzninaEtOyameVUdA9keEfY/C9TTgTXRicsa2Xt0=; b=oqg5bSzvlmLaRe8kHv9f78Mib3NMwNWNvtBoW6Y+cGmGo/+CSrbgklj3MYoXuRgVrl lZSSaFavWByewmRi7QuGjvf261CgcjWJahoZxEu7SCLDpJ99+b7qf4nd/XnndlmNqEOi R+Bw1s43FSm7IG8Ditb6kOMjuedtpyfJuHz8v+ymSJNHwLoipvw/04O5roYpsJSGvXfP gLEzRJPl22ijTszguaUK5hRYno8hlYbsIc+Sf9a2x5NmvJjZGJRt8WI1ceU/zW4KOZPz 3UHrWoKd82vYMXciS4icGtOQttn0xGkqGpZ7qQ9MwE0Z866W9xrfEPP36/mUYZF0/p2o UAlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=k26X6ZXw; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-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 fy15si10123471ejb.432.2019.11.11.16.21.28; Mon, 11 Nov 2019 16:21:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-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=k26X6ZXw; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-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 S1727238AbfKLAUE (ORCPT + 99 others); Mon, 11 Nov 2019 19:20:04 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:38265 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727222AbfKLAUD (ORCPT ); Mon, 11 Nov 2019 19:20:03 -0500 Received: by mail-pg1-f196.google.com with SMTP id 15so10587737pgh.5 for ; Mon, 11 Nov 2019 16:20:03 -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=JHJkzninaEtOyameVUdA9keEfY/C9TTgTXRicsa2Xt0=; b=k26X6ZXw6ris/hiRTOFqgwaSgTym9xQB0dF4oe0NtiSe78Zqp48G6D88LwbqFgKbD3 2LMDIiU2fTcYQL35L/CmkEUV20ll7RC2uc2TyGrnRcbNtzcLrrzk+XAa4fJaxrl5uUtN UJkJVkQj8WLUk1YyGyELo9c5neu1on72Ul01k= 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=JHJkzninaEtOyameVUdA9keEfY/C9TTgTXRicsa2Xt0=; b=Bfbqo1xOZLCnl0R/+WKj/wU16wCwSw4jBnTaXAXpMkJCHC7ElyjcAEuF1yh5CWFTEh imkiuEa++IcRSC8FwJejrOkrxuw6sSbDmEMmwam723QC74ek5XQOY/MLxp6t6NBeOyi9 VwZF21/Db7jZaJYu+LZTDZLBo3cuJpucDOkL9xxRgjY4chR+aDQxldeQ8qmSHN6C7nGZ NMQ/PJaUrVvhdNyCODEVyF999yzZzv2nOi/WOvYIUVLFUIbsPd8QJQVk4Q00od5OhD/R iE/HwVPQCpi8aUG+ubt3fGxYTtIJ81E/pNxWD8ar/wECNmjx7MAb+d43+rGe0j8dg8+2 BJ+Q== X-Gm-Message-State: APjAAAXbkl2+cb0A+ozfS2In3kreVdjl7izNnUTSJTT/mZPU25Tfi7XD 7+VcZsElLWsF0P0nX3bwKsw4jQ== X-Received: by 2002:a65:6145:: with SMTP id o5mr30910464pgv.38.1573518002861; Mon, 11 Nov 2019 16:20:02 -0800 (PST) Received: from apsdesk.mtv.corp.google.com ([2620:15c:202:1:e09a:8d06:a338:aafb]) by smtp.gmail.com with ESMTPSA id h23sm8430898pgg.58.2019.11.11.16.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Nov 2019 16:20:02 -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 v3 2/4] Bluetooth: btbcm: Support pcm configuration Date: Mon, 11 Nov 2019 16:19:47 -0800 Message-Id: <20191112001949.136377-3-abhishekpandit@chromium.org> X-Mailer: git-send-email 2.24.0.rc1.363.gb1bccd3e3d-goog In-Reply-To: <20191112001949.136377-1-abhishekpandit@chromium.org> References: <20191112001949.136377-1-abhishekpandit@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@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 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