Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1673907ybx; Thu, 7 Nov 2019 15:28:38 -0800 (PST) X-Google-Smtp-Source: APXvYqy64EFAgwNx4rMhxD2d5XLkKPxn1LBNIxXVOUnI/7kyCo2fMr3EXLtciN9SVOFjZZPk96+p X-Received: by 2002:a50:c3c5:: with SMTP id i5mr6806739edf.137.1573169318113; Thu, 07 Nov 2019 15:28:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573169318; cv=none; d=google.com; s=arc-20160816; b=Vqy8U6A9FzGWyEtzmQ+yCFHvj7mJ9EifaA4PhYQzhM4dh/mwrjbpy1S1bfrfhhsSp5 8e+NbgOzvTtn5KEct0wiOzKPV0JTEk9M5t0WEbZ3CgYx0qLgFJW8eeeMceZo3oxaS1Vo 7YW06kF7SgkBCK3Tbv3jKqe5Ge4Vl+E51TdhmK+U+LF25AqNcwhhSk+zKe/gLzu00q2n 8RomKooGzrPXdiLr6exUZ5jJRrJ6kBJqguPjhCNDvgB06t+CavzcB0OCR7rPMuYERZsE PrkAQgTfh8DndNnDeHh+BR5DdhTIGF0LXpLeOccyp8dB/XbRjJBhbM3U1weDiRQt3LNz GoMA== 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=09lhMrDrNWC/JXB2teKaEq/BNqZ941erzzvQPS9vkhg=; b=F5HAAj8Q26kks1wRYQejHnmFUR9RgNhmZCvrZarurCv8zHDsYEK0c8kL1eeACMkJle GsQWgWjmKL14UPrNoN2CYn9ICZFjmVyoCNR2Khbs7w6V256cKFPCjSSazwiX7RvvVIuH Ny+BLUsOLLmF/jTj2yJ5YXFtX3qC3V5oU54yZruqfvMOsGo1XLAy88mqBKJP79VWQ4Os g74LTXw9e525d8Inu5cQ/D2zZooWtiEUZ7Z4HKedWAqLzNUBW3KygA+MSaaytQtBUnOn +zdk6tzF9RzRHTsjkVbNSOmv7yX1RIfpnCP0C6WIxL9t6ys2f99bJ9BAS+4zDB1QROaQ wtLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lKgysL54; 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 a24si2904219eda.446.2019.11.07.15.28.07; Thu, 07 Nov 2019 15:28:38 -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=lKgysL54; 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 S1728053AbfKGX1w (ORCPT + 99 others); Thu, 7 Nov 2019 18:27:52 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:37340 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728021AbfKGX1v (ORCPT ); Thu, 7 Nov 2019 18:27:51 -0500 Received: by mail-pl1-f194.google.com with SMTP id p13so2701681pll.4 for ; Thu, 07 Nov 2019 15:27:51 -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=09lhMrDrNWC/JXB2teKaEq/BNqZ941erzzvQPS9vkhg=; b=lKgysL54GQ/ebY9znGF3RcGaKYH97LcM5oHg4tyOioOzTJmRHwlAaNP0CwCkzNPfLF H+uELDeS6WFsiUJeuL7zxEIUC4OoVhdTf+PMSQ1MPao3P6ZbXEqPi3h50iRXfaJR9n1n m0jIBM68sCVYLhANSezxEz9Fjz2xkEye4ezX8= 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=09lhMrDrNWC/JXB2teKaEq/BNqZ941erzzvQPS9vkhg=; b=IJEsvvowTkcLgunYOvDGOkUxhRw86mV3D3+14Ob57f/VimJpYHj8bWPG/HAYx+MrFg klfheiDYa8b5B93/2Nd62/xOl2VF3d20QLXOBVA+jrvmYkxWuPZmmDZ1DgVBmDN/BUYj 3tCqqglAwsLjyjbXVT1Stgc4mCK4EVfnPb8MWFMqwFLAOe6Ivcvtc+G/1ayJULa7ypo1 v92P+wjSpoa4g2KIzWmWujrjO7SVmeRiliwPmftQdArHevpDJakjkKbbrMEYHoU5u8Kv LUM2m7n1KxC7Cdlk04XcXb0f5FW+XELPy++4amAEYMvvX0cYNmUq4iLGVmh7YHJbBOjx QGEQ== X-Gm-Message-State: APjAAAW+Aq3d/BsLoSmp58P1oFz5L/Mz4kw/wEGIftkHlOC7gtMVUqhp KwxjVLs0QW+4Fh40jQXK8rjfvg== X-Received: by 2002:a17:90a:c004:: with SMTP id p4mr4205712pjt.104.1573169270701; Thu, 07 Nov 2019 15:27:50 -0800 (PST) Received: from apsdesk.mtv.corp.google.com ([2620:15c:202:1:e09a:8d06:a338:aafb]) by smtp.gmail.com with ESMTPSA id h3sm2857579pji.16.2019.11.07.15.27.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 15:27:50 -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 v2 3/4] Bluetooth: hci_bcm: Support pcm params in dts Date: Thu, 7 Nov 2019 15:27:11 -0800 Message-Id: <20191107232713.48577-4-abhishekpandit@chromium.org> X-Mailer: git-send-email 2.24.0.rc1.363.gb1bccd3e3d-goog In-Reply-To: <20191107232713.48577-1-abhishekpandit@chromium.org> References: <20191107232713.48577-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 BCM chips may require configuration of PCM to operate correctly and there is a vendor specific HCI command to do this. Add support in the hci_bcm driver to parse this from devicetree and configure the chip. Signed-off-by: Abhishek Pandit-Subedi --- Changes in v2: None drivers/bluetooth/hci_bcm.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c index 2114df607cb3..46e4793fc234 100644 --- a/drivers/bluetooth/hci_bcm.c +++ b/drivers/bluetooth/hci_bcm.c @@ -79,6 +79,8 @@ * @hu: pointer to HCI UART controller struct, * used to disable flow control during runtime suspend and system sleep * @is_suspended: whether flow control is currently disabled + * @has_pcm_params: whether PCM parameters need to be configured + * @pcm_params: PCM and routing parameters */ struct bcm_device { /* Must be the first member, hci_serdev.c expects this. */ @@ -112,6 +114,9 @@ struct bcm_device { struct hci_uart *hu; bool is_suspended; #endif + + bool has_pcm_params; + struct bcm_set_pcm_int_params pcm_params; }; /* generic bcm uart resources */ @@ -576,6 +581,17 @@ static int bcm_setup(struct hci_uart *hu) host_set_baudrate(hu, speed); } + /* PCM parameters if any*/ + if (bcm->dev && bcm->dev->has_pcm_params) { + err = btbcm_set_pcm_params(hu->hdev, &bcm->dev->pcm_params, + NULL); + + if (err) { + bt_dev_info(hu->hdev, "BCM: Set pcm params failed (%d)", + err); + } + } + finalize: release_firmware(fw); @@ -1112,7 +1128,24 @@ static int bcm_acpi_probe(struct bcm_device *dev) static int bcm_of_probe(struct bcm_device *bdev) { + int err; + device_property_read_u32(bdev->dev, "max-speed", &bdev->oper_speed); + + err = device_property_read_u8(bdev->dev, "brcm,sco-routing", + &bdev->pcm_params.routing); + if (!err) + bdev->has_pcm_params = true; + + device_property_read_u8(bdev->dev, "brcm,pcm-interface-rate", + &bdev->pcm_params.rate); + device_property_read_u8(bdev->dev, "brcm,pcm-frame-type", + &bdev->pcm_params.frame_sync); + device_property_read_u8(bdev->dev, "brcm,pcm-sync-mode", + &bdev->pcm_params.sync_mode); + device_property_read_u8(bdev->dev, "brcm,pcm-clock-mode", + &bdev->pcm_params.clock_mode); + return 0; } -- 2.24.0.rc1.363.gb1bccd3e3d-goog