From patchwork Thu Mar 7 12:16:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harish Bandi X-Patchwork-Id: 10842735 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 C5D4C14DE for ; Thu, 7 Mar 2019 12:17:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B286B2E6F4 for ; Thu, 7 Mar 2019 12:17:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A69912E70E; Thu, 7 Mar 2019 12:17:23 +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 27CFE2E6F4 for ; Thu, 7 Mar 2019 12:17:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726294AbfCGMRQ (ORCPT ); Thu, 7 Mar 2019 07:17:16 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:59058 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726101AbfCGMRQ (ORCPT ); Thu, 7 Mar 2019 07:17:16 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 4478C60C72; Thu, 7 Mar 2019 12:17:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1551961035; bh=4cepUczBnUTSTvYFMcspE8zX17l8chzMZZmcnbq0GBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZEGmPm5kovfQOlKmqbsbceMT+a7v9T+X/FZ7yFtkNHwXODXmz265Tw9odCY6WMRoR WHKt7RNPkPH49aBF69460mAofTn/dKHoed4goe7loJ0hWKRWYICziTLNqSfM3avos5 gi84b3gloA4Q8PAdkwJw3W2ga8QcQcKQvQONoXxU= 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 2405E60909; Thu, 7 Mar 2019 12:17:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1551961034; bh=4cepUczBnUTSTvYFMcspE8zX17l8chzMZZmcnbq0GBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rfm6QepVI3WZV9yWI1WUkcIJ92pqcXZoczCeCSdh1PNvgHnABSrtWTjwWqxXRn8XH xbAfeU9892Qwwyz7f4Bd/DLv/km6HdGLCi+XYdVl1qm36xRmdFLe3lo1EMob4719JQ XHv/s5DGFEvamkXwUplumUZtmPMW2DIYNuGzUEP4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2405E60909 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 v1 1/2] Bluetooth: hci_qca: Added support to read the regulator values from DTS Date: Thu, 7 Mar 2019 17:46:51 +0530 Message-Id: <1551961012-23898-2-git-send-email-c-hbandi@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1551961012-23898-1-git-send-email-c-hbandi@codeaurora.org> References: <1551961012-23898-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 wcn3990 as base chip. based on wcn3990 we have multiple bt chip sets, with enhanced power numbers. So every chip set will have its own power numbers, but the functionality is same as wcn3990. With this change we read the regulator values from DTS in driver initialization time. While initializing the regulators, it will set the those current and voltage values. If no values set in DTS, it will read the default values and set those values only. This change will help in supporting multiple platforms. Signed-off-by: Harish Bandi --- drivers/bluetooth/hci_qca.c | 76 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 68 insertions(+), 8 deletions(-) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 237aea3..402336a7 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -155,7 +155,7 @@ struct qca_vreg_data { */ struct qca_power { struct device *dev; - const struct qca_vreg_data *vreg_data; + struct qca_vreg_data *vreg_data; struct regulator_bulk_data *vreg_bulk; bool vregs_on; }; @@ -1387,10 +1387,48 @@ static int qca_power_setup(struct hci_uart *hu, bool on) return ret; } +/* + * Read function to get the voltage and current values + * for regulators from DTS. + */ +static void qca_regulator_get_voltage_current(struct device *dev, + struct qca_vreg *vregs) +{ + char prop_name[32]; /* 32 is max size of property name */ + + snprintf(prop_name, 32, "%s-current", vregs->name); + BT_DBG("Looking up %s from device tree\n", prop_name); + + if (device_property_read_bool(dev, prop_name)) + device_property_read_u32(dev, prop_name, &vregs->load_uA); + + snprintf(prop_name, 32, "%s-min-voltage", vregs->name); + BT_DBG("Looking up %s from device tree\n", prop_name); + + if (device_property_read_bool(dev, prop_name)) + device_property_read_u32(dev, prop_name, &vregs->min_uV); + + snprintf(prop_name, 32, "%s-max-voltage", vregs->name); + BT_DBG("Looking up %s from device tree\n", prop_name); + + if (device_property_read_bool(dev, prop_name)) + device_property_read_u32(dev, prop_name, &vregs->max_uV); + + BT_DBG("current %duA selected for regulator %s", vregs->load_uA, + vregs->name); + BT_DBG("min voltage %duA selected for regulator %s", vregs->min_uV, + vregs->name); + BT_DBG("max voltage %duA selected for regulator %s", vregs->max_uV, + vregs->name); +} + static int qca_init_regulators(struct qca_power *qca, - const struct qca_vreg *vregs, size_t num_vregs) + const struct qca_vreg_data *data) { - int i; + int i, num_vregs; + int load_uA; + + num_vregs = data->num_vregs; qca->vreg_bulk = devm_kcalloc(qca->dev, num_vregs, sizeof(struct regulator_bulk_data), @@ -1398,8 +1436,32 @@ static int qca_init_regulators(struct qca_power *qca, if (!qca->vreg_bulk) return -ENOMEM; - for (i = 0; i < num_vregs; i++) - qca->vreg_bulk[i].supply = vregs[i].name; + qca->vreg_data = devm_kzalloc(qca->dev, sizeof(struct qca_vreg_data), + GFP_KERNEL); + if (!qca->vreg_data) + return -ENOMEM; + + qca->vreg_data->num_vregs = num_vregs; + + qca->vreg_data->vregs = devm_kzalloc(qca->dev, num_vregs * + sizeof(struct qca_vreg_data), + GFP_KERNEL); + + if (!qca->vreg_data->vregs) + return -ENOMEM; + + for (i = 0; i < num_vregs; i++) { + /* copy regulator name, min voltage, max voltage */ + qca->vreg_data->vregs[i].name = data->vregs[i].name; + qca->vreg_data->vregs[i].min_uV = data->vregs[i].min_uV; + qca->vreg_data->vregs[i].max_uV = data->vregs[i].max_uV; + load_uA = data->vregs[i].load_uA; + qca->vreg_data->vregs[i].load_uA = load_uA; + qca_regulator_get_voltage_current(qca->dev, + &qca->vreg_data->vregs[i]); + + qca->vreg_bulk[i].supply = qca->vreg_data->vregs[i].name; + } return devm_regulator_bulk_get(qca->dev, num_vregs, qca->vreg_bulk); } @@ -1426,9 +1488,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) return -ENOMEM; qcadev->bt_power->dev = &serdev->dev; - qcadev->bt_power->vreg_data = data; - err = qca_init_regulators(qcadev->bt_power, data->vregs, - data->num_vregs); + err = qca_init_regulators(qcadev->bt_power, data); if (err) { BT_ERR("Failed to init regulators:%d", err); goto out; From patchwork Thu Mar 7 12:16:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harish Bandi X-Patchwork-Id: 10842737 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 4C4D417E4 for ; Thu, 7 Mar 2019 12:17:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 396312E6F4 for ; Thu, 7 Mar 2019 12:17:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D4302E70E; Thu, 7 Mar 2019 12:17:30 +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 C1E152E6F4 for ; Thu, 7 Mar 2019 12:17:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726286AbfCGMRW (ORCPT ); Thu, 7 Mar 2019 07:17:22 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:59242 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726101AbfCGMRW (ORCPT ); Thu, 7 Mar 2019 07:17:22 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id A5ADC60ADE; Thu, 7 Mar 2019 12:17:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1551961041; bh=RXtIsSNq0sPOCGtmzN0HRVRPkiHYebUNXhndZ5vXhMo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n5hW/mRFf6SBZZ+M7ILC1BF8N1X3+rFdWOUK1VZ7fYoVYSHsc5ZnsXIzROYDD0a3e OM0E/Q9kTZ1arJ3sc4Q5ygf859TWXadWzyrA9qmTz1xxcI+yozm1xHjhxcdebAog3b Wync9TA5G/1LZM0ebUw3Dq4dpo62XWqznLacqIuE= 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 E67F060ADE; Thu, 7 Mar 2019 12:17:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1551961038; bh=RXtIsSNq0sPOCGtmzN0HRVRPkiHYebUNXhndZ5vXhMo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e5d/QFfzrQ5KDCmKKO1jV1n3Y4OVwUukPCGAYBRNWpixrZBIuvozswJbLvwYfZLFD 0ZRrUaUUlo8iMhBi3UTcaa7yJvm5n1HGW2RDnAStkUTdS9JwUQTpJAskkakcpOHvKV NB9+tkUYlOuwjZcnecq/Z1VZskg5iZcRsMRAopGI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E67F060ADE 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 v1 2/2] dt-bindings: net: bluetooth: Add device tree bindings for QTI chip wcn3990 Date: Thu, 7 Mar 2019 17:46:52 +0530 Message-Id: <1551961012-23898-3-git-send-email-c-hbandi@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1551961012-23898-1-git-send-email-c-hbandi@codeaurora.org> References: <1551961012-23898-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 wcn3990 controller. Added entry for regulator currents, min and max voltages Signed-off-by: Harish Bandi --- Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt index 824c0e2..6aed68e 100644 --- a/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt +++ b/Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt @@ -50,6 +50,18 @@ serial@898000 { vddxo-supply = <&vreg_l7a_1p8>; vddrf-supply = <&vreg_l17a_1p3>; vddch0-supply = <&vreg_l25a_3p3>; + vddio-current = <15000>; + vddxo-current = <80000>; + vddrf-current = <300000>; + vddch0-current = <450000>; + vddio-min-voltage = <1800000>; + vddxo-min-voltage = <1800000>; + vddrf-min-voltage = <1300000>; + vddch0-min-voltage = <3300000>; + vddio-max-voltage = <1900000>; + vddxo-max-voltage = <1900000>; + vddrf-max-voltage = <1350000>; + vddch0-max-voltage = <3400000>; max-speed = <3200000>; }; };