From patchwork Tue Mar 12 12:22:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harish Bandi X-Patchwork-Id: 10849159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 612F06C2 for ; Tue, 12 Mar 2019 12:23:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48CC12955C for ; Tue, 12 Mar 2019 12:23:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3934329561; Tue, 12 Mar 2019 12:23:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7180B2955C for ; Tue, 12 Mar 2019 12:23:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726748AbfCLMXl (ORCPT ); Tue, 12 Mar 2019 08:23:41 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:54156 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725957AbfCLMXh (ORCPT ); Tue, 12 Mar 2019 08:23:37 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id DD63F60CF1; Tue, 12 Mar 2019 12:23:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1552393415; bh=Hg8D0z8ZKsZParmeqwPRRHpEZJ17D4WoBZwC3Tyew2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oRA/xiIuNgCWMHCTAIayi4DIgk1TTOTgufPuwiSVwlPkW2z/RJXSqBdr1OMdR2Mab tZUQfeBjCpo5/DdmdsZR6g/9osrBuwpmIiorgENiYJuapWbrg+Q68OPy5hQmK7E+2B 7Mpt/xXEKSmX/FMmyapzBl6Qp4K0H3WPIhKSeXnA= Received: from c-hbandi-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: c-hbandi@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id DB9D660ACE; Tue, 12 Mar 2019 12:23:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1552393414; bh=Hg8D0z8ZKsZParmeqwPRRHpEZJ17D4WoBZwC3Tyew2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TXtZL4b2SZMQtE64iWU2pkUiyz/eU35cO5wQyulWWHaVdtoRxepzr20XzNXOGUOtI x5XdeuymGaxFxiJxqM7PXqwUpNKT/TXRdb4PN6G4uLH24I8j6gAeiiTM5Nh62HKdal 4Neg8MZjQGXjzi7B2m9jVuzerZnlELzGDk6SrvCk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org DB9D660ACE Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=c-hbandi@codeaurora.org From: Harish Bandi To: marcel@holtmann.org, johan.hedberg@gmail.com Cc: mka@chromium.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, hemantg@codeaurora.org, linux-arm-msm@vger.kernel.org, bgodavar@codeaurora.org, anubhavg@codeaurora.org, Harish Bandi Subject: [PATCH v3 1/2] Bluetooth: hci_qca: Added support for wcn3998 Date: Tue, 12 Mar 2019 17:52:58 +0530 Message-Id: <1552393379-26330-2-git-send-email-c-hbandi@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1552393379-26330-1-git-send-email-c-hbandi@codeaurora.org> References: <1552393379-26330-1-git-send-email-c-hbandi@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Added new compatible for wcn3998 and corresponding voltage and current values to wcn3998 compatible. Changed driver code to support wcn3998 Signed-off-by: Harish Bandi --- changes in v3: - updated to latest code base. --- drivers/bluetooth/btqca.c | 4 ++-- drivers/bluetooth/btqca.h | 3 ++- drivers/bluetooth/hci_qca.c | 40 ++++++++++++++++++++++++++-------------- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c index 6122685..70cab13 100644 --- a/drivers/bluetooth/btqca.c +++ b/drivers/bluetooth/btqca.c @@ -344,7 +344,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, /* Download rampatch file */ config.type = TLV_TYPE_PATCH; - if (soc_type == QCA_WCN3990) { + if (soc_type >= QCA_WCN3990) { /* Firmware files to download are based on ROM version. * ROM version is derived from last two bytes of soc_ver. */ @@ -365,7 +365,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, /* Download NVM configuration */ config.type = TLV_TYPE_NVM; - if (soc_type == QCA_WCN3990) + if (soc_type >= QCA_WCN3990) snprintf(config.fwname, sizeof(config.fwname), "qca/crnv%02x.bin", rom_ver); else diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h index c72c56e..f03d96e 100644 --- a/drivers/bluetooth/btqca.h +++ b/drivers/bluetooth/btqca.h @@ -132,7 +132,8 @@ enum qca_btsoc_type { QCA_INVALID = -1, QCA_AR3002, QCA_ROME, - QCA_WCN3990 + QCA_WCN3990, + QCA_WCN3998 }; #if IS_ENABLED(CONFIG_BT_QCA) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 4ea995d..1221f5a 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -521,7 +521,7 @@ static int qca_open(struct hci_uart *hu) if (hu->serdev) { qcadev = serdev_device_get_drvdata(hu->serdev); - if (qcadev->btsoc_type != QCA_WCN3990) { + if (qcadev->btsoc_type == QCA_ROME) { gpiod_set_value_cansleep(qcadev->bt_en, 1); } else { hu->init_speed = qcadev->init_speed; @@ -627,7 +627,7 @@ static int qca_close(struct hci_uart *hu) if (hu->serdev) { qcadev = serdev_device_get_drvdata(hu->serdev); - if (qcadev->btsoc_type == QCA_WCN3990) + if (qcadev->btsoc_type >= QCA_WCN3990) qca_power_shutdown(hu); else gpiod_set_value_cansleep(qcadev->bt_en, 0); @@ -1008,7 +1008,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate) msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS)); /* Give the controller time to process the request */ - if (qca_soc_type(hu) == QCA_WCN3990) + if (qca_soc_type(hu) >= QCA_WCN3990) msleep(10); else msleep(300); @@ -1084,7 +1084,7 @@ static unsigned int qca_get_speed(struct hci_uart *hu, static int qca_check_speeds(struct hci_uart *hu) { - if (qca_soc_type(hu) == QCA_WCN3990) { + if (qca_soc_type(hu) >= QCA_WCN3990) { if (!qca_get_speed(hu, QCA_INIT_SPEED) && !qca_get_speed(hu, QCA_OPER_SPEED)) return -EINVAL; @@ -1116,7 +1116,7 @@ static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type) /* Disable flow control for wcn3990 to deassert RTS while * changing the baudrate of chip and host. */ - if (soc_type == QCA_WCN3990) + if (soc_type >= QCA_WCN3990) hci_uart_set_flow_control(hu, true); qca_baudrate = qca_get_baudrate_value(speed); @@ -1128,7 +1128,7 @@ static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type) host_set_baudrate(hu, speed); error: - if (soc_type == QCA_WCN3990) + if (soc_type >= QCA_WCN3990) hci_uart_set_flow_control(hu, false); } @@ -1201,7 +1201,7 @@ static int qca_setup(struct hci_uart *hu) /* Patch downloading has to be done without IBS mode */ clear_bit(STATE_IN_BAND_SLEEP_ENABLED, &qca->flags); - if (soc_type == QCA_WCN3990) { + if (soc_type >= QCA_WCN3990) { bt_dev_info(hdev, "setting up wcn3990"); /* Enable NON_PERSISTENT_SETUP QUIRK to ensure to execute @@ -1232,7 +1232,7 @@ static int qca_setup(struct hci_uart *hu) qca_baudrate = qca_get_baudrate_value(speed); } - if (soc_type != QCA_WCN3990) { + if (soc_type == QCA_ROME) { /* Get QCA version information */ ret = qca_read_soc_version(hdev, &soc_ver); if (ret) @@ -1257,7 +1257,7 @@ static int qca_setup(struct hci_uart *hu) } /* Setup bdaddr */ - if (soc_type == QCA_WCN3990) + if (soc_type >= QCA_WCN3990) hu->hdev->set_bdaddr = qca_set_bdaddr; else hu->hdev->set_bdaddr = qca_set_bdaddr_rome; @@ -1280,7 +1280,7 @@ static int qca_setup(struct hci_uart *hu) .dequeue = qca_dequeue, }; -static const struct qca_vreg_data qca_soc_data = { +static const struct qca_vreg_data qca_soc_data_wcn3990 = { .soc_type = QCA_WCN3990, .vregs = (struct qca_vreg []) { { "vddio", 1800000, 1900000, 15000 }, @@ -1291,6 +1291,17 @@ static int qca_setup(struct hci_uart *hu) .num_vregs = 4, }; +static const struct qca_vreg_data qca_soc_data_wcn3998 = { + .soc_type = QCA_WCN3998, + .vregs = (struct qca_vreg []) { + { "vddio", 1800000, 1900000, 10000 }, + { "vddxo", 1800000, 1900000, 80000 }, + { "vddrf", 1300000, 1352000, 300000 }, + { "vddch0", 3300000, 3300000, 450000 }, + }, + .num_vregs = 4, +}; + static void qca_power_shutdown(struct hci_uart *hu) { struct qca_data *qca = hu->priv; @@ -1424,8 +1435,8 @@ static int qca_serdev_probe(struct serdev_device *serdev) qcadev->serdev_hu.serdev = serdev; data = of_device_get_match_data(&serdev->dev); serdev_device_set_drvdata(serdev, qcadev); - if (data && data->soc_type == QCA_WCN3990) { - qcadev->btsoc_type = QCA_WCN3990; + if (data && data->soc_type >= QCA_WCN3990) { + qcadev->btsoc_type = data->soc_type; qcadev->bt_power = devm_kzalloc(&serdev->dev, sizeof(struct qca_power), GFP_KERNEL); @@ -1489,7 +1500,7 @@ static void qca_serdev_remove(struct serdev_device *serdev) { struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev); - if (qcadev->btsoc_type == QCA_WCN3990) + if (qcadev->btsoc_type >= QCA_WCN3990) qca_power_shutdown(&qcadev->serdev_hu); else clk_disable_unprepare(qcadev->susclk); @@ -1499,7 +1510,8 @@ static void qca_serdev_remove(struct serdev_device *serdev) static const struct of_device_id qca_bluetooth_of_match[] = { { .compatible = "qcom,qca6174-bt" }, - { .compatible = "qcom,wcn3990-bt", .data = &qca_soc_data}, + { .compatible = "qcom,wcn3990-bt", .data = &qca_soc_data_wcn3990}, + { .compatible = "qcom,wcn3998-bt", .data = &qca_soc_data_wcn3998}, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, qca_bluetooth_of_match); From patchwork Tue Mar 12 12:22:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harish Bandi X-Patchwork-Id: 10849157 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 561966C2 for ; Tue, 12 Mar 2019 12:23:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 433292955C for ; Tue, 12 Mar 2019 12:23:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 36FA629560; Tue, 12 Mar 2019 12:23:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA1D02955C for ; Tue, 12 Mar 2019 12:23:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726581AbfCLMXk (ORCPT ); Tue, 12 Mar 2019 08:23:40 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:54276 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726733AbfCLMXk (ORCPT ); Tue, 12 Mar 2019 08:23:40 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 640A960E40; Tue, 12 Mar 2019 12:23:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1552393419; bh=2/fq+sA34++wkQig1JAiEDuSvwjnAyOWoqHEb9iMlFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aSmhBkP0ega2mgfekK3h7P9FX61qQTDS/E0YKSaSd2o2iX4URlpWAhFH32uvJeTJI aObawLIxNQzixHD7rGrD4VVlF53mu6h4Juu7tdyrYe01T7uClNfsFN0eAnt0bMdxaA flDXzNDWw6hz8mVigtaEkf8Y8VUCYu/MSWDJVEy4= Received: from c-hbandi-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: c-hbandi@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 403AA60DB3; Tue, 12 Mar 2019 12:23:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1552393418; bh=2/fq+sA34++wkQig1JAiEDuSvwjnAyOWoqHEb9iMlFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=moz+ipj0T3NxCCAt7yO0itA31YcveLRYbfcaR4eiUV5V4y3UjuhbEBME1w7UGnkLc AxGdZo216GMnoUwtnJiKWf25iBwWSX3y09Tan54vmQde0gm5LUP30ihmakKFc9UnN2 st4SLP7PeP/vdlhDHUVXWYcapHFFtUlI9NRVI0MM= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 403AA60DB3 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=c-hbandi@codeaurora.org From: Harish Bandi To: marcel@holtmann.org, johan.hedberg@gmail.com Cc: mka@chromium.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, hemantg@codeaurora.org, linux-arm-msm@vger.kernel.org, bgodavar@codeaurora.org, anubhavg@codeaurora.org, Harish Bandi Subject: [PATCH v3 2/2] dt-bindings: net: bluetooth: Add device tree bindings for QTI chip wcn3998 Date: Tue, 12 Mar 2019 17:52:59 +0530 Message-Id: <1552393379-26330-3-git-send-email-c-hbandi@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1552393379-26330-1-git-send-email-c-hbandi@codeaurora.org> References: <1552393379-26330-1-git-send-email-c-hbandi@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch enables regulators for the Qualcomm Bluetooth wcn3998 controller. Signed-off-by: Harish Bandi --- changes in v3: - updated to latest code base. --- .../devicetree/bindings/net/qualcomm-bluetooth.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt index 824c0e2..1221535 100644 --- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt @@ -53,3 +53,18 @@ serial@898000 { max-speed = <3200000>; }; }; + +&blsp1_uart3 { + pinctrl-names = "default"; + pinctrl-0 = <&blsp1_uart3_default>; + status = "okay"; + + bluetooth: wcn3998-bt { + compatible = "qcom,wcn3998-bt"; + vddio-supply = <&vreg_l6_1p8>; + vddxo-supply = <&vreg_l5_1p8>; + vddrf-supply = <&vreg_s5_1p35>; + vddch0-supply = <&vdd_ch0_3p3>; + max-speed = <3200000>; + }; +}; \ No newline at end of file