Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3222117ybc; Mon, 25 Nov 2019 10:54:21 -0800 (PST) X-Google-Smtp-Source: APXvYqx+L7A97joFIhkGzz75c42cePnvMMi1iGHQRjvbkGw7r26YT15OU+tdVck2+CihdFgFKoPd X-Received: by 2002:a50:becf:: with SMTP id e15mr20531030edk.135.1574708061220; Mon, 25 Nov 2019 10:54:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574708061; cv=none; d=google.com; s=arc-20160816; b=MUhWFza7HjaV4UVQKQahajOCokf5cW4L8Yl9vKa13ShCpCA0Db2pgJsWaAkgK5wK3p uqXYsd+2RCRX+OldH/ogLLUneI+glSzkpfsTgfLCizLNENO1g4/zgPVSwvurtuoALoWt oLeQtRMOG9+NFJTQ0ZM3ppqWLt6PhHQwx1BhUC3TW07E9intlm9Byvlcdanba3j+wELx o5TA+awq1NqzTa+90ioBPMafHz0J6IttPYTrQ3AzScG8gaC1HuP2OWgeUJ/rpB/ONogP 49vhfGv3RWF48/dXz3XH5CtFOvx8yGCcJRhKZC/lafThRTCDy8yqNNBiGMaZSMHzCfVz Q+hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=lifq7rlkhN8DDjDxz8g2eqEQ9IL7TbQm7yDoGDvSi0U=; b=JT2aMERJHpD1KMdxYOEm0Qw5IJ5tyXAdbvO5fSy+cSaaZm+NLJWkmfbX+tjLBXvW61 TciNACzp3mHlSwZESBuoHkQD/DETEzGfrOhpbBgotCbrJYTr4Kjpd66DdlKfZg7vGhEh TZ6/KnVogF91VeA3k5Zxz8ZQu1zB6K6Yza5vkf51cufkNS28FjT1SOToea90wRl5YVw5 IZOqZvRXWHYllDKmRaK9maBxXdzT3bx8jJON3djjDDyzrsZIY+dZRwyL+FfNSCXL/Lx5 F5Oum+VmA62j5zGB/3vO4Bis/nXz5sOFUqaRYqxNiC1nEfksVXm6c6oMk9UJdHVwLKUD XRJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BKBQL8S5; 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 n13si5743847edr.73.2019.11.25.10.53.55; Mon, 25 Nov 2019 10:54:21 -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=BKBQL8S5; 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 S1727842AbfKYSOR (ORCPT + 99 others); Mon, 25 Nov 2019 13:14:17 -0500 Received: from mail-qv1-f68.google.com ([209.85.219.68]:43115 "EHLO mail-qv1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727832AbfKYSOQ (ORCPT ); Mon, 25 Nov 2019 13:14:16 -0500 Received: by mail-qv1-f68.google.com with SMTP id cg2so6114986qvb.10 for ; Mon, 25 Nov 2019 10:14:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lifq7rlkhN8DDjDxz8g2eqEQ9IL7TbQm7yDoGDvSi0U=; b=BKBQL8S5znAgq3xwtWnJicfD/xkpk2KVs2+fvMWlOrL3G4Hccd6X2KLuBg8HWDkx3a FeYR91DsaRI4YzIJJLjFTyjrQmEDPsh3zIPQqggf5mhYgSv0JNRMBpopyUHPk9bCIhcV wlTiEg8QIz0J7gVXIMo7laSQz3uLJBPF5Cxmo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lifq7rlkhN8DDjDxz8g2eqEQ9IL7TbQm7yDoGDvSi0U=; b=mH0KKyy5KBJMXEvdrsL8xIUBImlyD8uOBPjcDOnRtd3T7QE/hg43dX0ZzRSBKgHtcM xH69vRsxIvYkkAkquMQaxQBlzQp6wDkb00vOrdhwNXQZ423pB8TeqfPMzcYrASrtS67a g/GkCrZcaQsYEI021JbWyTD4g/yNHc7Mr698E7I/vmiBUZHXUVkfe31aams/eYc1hdWg Wzfjct4vepCyxsAXnoVVoM+Ddib+q22tyciLQGvXrFRFBtQaq8KrD9tYDIAskIJTMkq0 xxVz15P+K3sQ7juRGovwBHVi9fpIaLkbJUs/LFA1bXf+HXU3OHOI7vujqa7hbV7OtBZv kqwA== X-Gm-Message-State: APjAAAXyl0XEP4Sdke5+RO4ZZmmzW61CrJQzm8H6CdCPU+L/AV/FE6eZ kjxOAEc8n+L2kwSDXXk3mHqiQPCSzcRBGTPwlMAyZn/7 X-Received: by 2002:a0c:d09b:: with SMTP id z27mr28709989qvg.168.1574705655332; Mon, 25 Nov 2019 10:14:15 -0800 (PST) MIME-Version: 1.0 References: <20191123100111.219190-2-marcel@holtmann.org> In-Reply-To: <20191123100111.219190-2-marcel@holtmann.org> From: Abhishek Pandit-Subedi Date: Mon, 25 Nov 2019 10:14:04 -0800 Message-ID: Subject: Re: [PATCH 2/4] Bluetooth: btbcm: Support pcm configuration To: Marcel Holtmann Cc: linux-bluetooth@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Sat, Nov 23, 2019 at 2:01 AM Marcel Holtmann wrote: > > From: Abhishek Pandit-Subedi > > 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) > > We can read back the values as well with ocf 0x001d to confirm the > values that were set: > $ hcitool cmd 0x3f 0x001d > < HCI Command: ogf 0x3f, ocf 0x001d, plen 0 > > HCI Event: 0x0e plen 9 > 01 1D FC 00 01 02 00 01 01 > > Signed-off-by: Abhishek Pandit-Subedi > Signed-off-by: Marcel Holtmann > --- > drivers/bluetooth/btbcm.c | 46 +++++++++++++++++++++++++++++++++++++++ > drivers/bluetooth/btbcm.h | 16 ++++++++++++++ > 2 files changed, 62 insertions(+) > > diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c > index 8e05706fe5d9..0795a49edfae 100644 > --- a/drivers/bluetooth/btbcm.c > +++ b/drivers/bluetooth/btbcm.c > @@ -107,6 +107,52 @@ int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) > } > EXPORT_SYMBOL_GPL(btbcm_set_bdaddr); > > +int btbcm_read_pcm_int_params(struct hci_dev *hdev, > + struct bcm_set_pcm_int_params *params) > +{ > + struct sk_buff *skb; > + int err = 0; > + > + skb = __hci_cmd_sync(hdev, 0xfc1d, 0, NULL, HCI_INIT_TIMEOUT); > + if (IS_ERR(skb)) { > + err = PTR_ERR(skb); > + bt_dev_err(hdev, "BCM: Read PCM int params failed (%d)", err); > + return err; > + } > + > + if (skb->len != 6 || skb->data[0]) { > + bt_dev_err(hdev, "BCM: Read PCM int params length mismatch"); > + kfree_skb(skb); > + return -EIO; > + } > + > + if (params) > + memcpy(params, skb->data + 1, 5); > + > + kfree_skb(skb); > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(btbcm_read_pcm_int_params); > + > +int btbcm_write_pcm_int_params(struct hci_dev *hdev, > + const struct bcm_set_pcm_int_params *params) > +{ > + struct sk_buff *skb; > + int err; > + > + skb = __hci_cmd_sync(hdev, 0xfc1c, 5, params, HCI_INIT_TIMEOUT); > + if (IS_ERR(skb)) { > + err = PTR_ERR(skb); > + bt_dev_err(hdev, "BCM: Write PCM int params failed (%d)", err); > + return err; > + } > + kfree_skb(skb); > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(btbcm_write_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..3c7dd0765837 100644 > --- a/drivers/bluetooth/btbcm.h > +++ b/drivers/bluetooth/btbcm.h > @@ -54,6 +54,10 @@ 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_read_pcm_int_params(struct hci_dev *hdev, > + struct bcm_set_pcm_int_params *params); > +int btbcm_write_pcm_int_params(struct hci_dev *hdev, > + const struct bcm_set_pcm_int_params *params); > > int btbcm_setup_patchram(struct hci_dev *hdev); > int btbcm_setup_apple(struct hci_dev *hdev); > @@ -74,6 +78,18 @@ static inline int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) > return -EOPNOTSUPP; > } > > +int btbcm_read_pcm_int_params(struct hci_dev *hdev, > + struct bcm_set_pcm_int_params *params) > +{ > + return -EOPNOTSUPP; > +} > + > +int btbcm_write_pcm_int_params(struct hci_dev *hdev, > + const struct bcm_set_pcm_int_params *params) > +{ > + return -EOPNOTSUPP; > +} > + > static inline int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw) > { > return -EOPNOTSUPP; > -- > 2.23.0 > Looks good to me.