From patchwork Mon Jun 21 22:31:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 464716 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E954C48BE5 for ; Mon, 21 Jun 2021 22:31:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 653296134F for ; Mon, 21 Jun 2021 22:31:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232216AbhFUWeE (ORCPT ); Mon, 21 Jun 2021 18:34:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232048AbhFUWeC (ORCPT ); Mon, 21 Jun 2021 18:34:02 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC39AC061760 for ; Mon, 21 Jun 2021 15:31:46 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id a11so19666156lfg.11 for ; Mon, 21 Jun 2021 15:31:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wWkLC+6IHo1LkiZQZtpwJkfJ4H3Gk2cOkMI7a3h8YO8=; b=AHJoQMSyw2F26sqRP070Z2DonSPoTif5Q8B2lrDRcKW5F1+eFXYk4G946n7T7XovwA HWzV6sHthnzp2WCvluiMwRQVU7N3PtyOt3lBX6SgjbPvYtoo4fiMlBcMnKum4WwDaI+p mFwAxgmEFRw9yZ6eP43t1a+EfWr/ttIxBCOrWwMbwVSh45YzlalARMd5D6Rxu58jij/y SMxp+75C/iJgqwx3HpSkseiqqbXWRWiQzCbfEN4KONNn0+tzR0NjTnUF1Y9KVSqiuQAz cO3+Voo+knC88V8IQQ97O+xQkgTEf+SGHeruwkZ1mD9CYv9CvNlWMWyCFLPpV5J+m2+L +cVA== 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=wWkLC+6IHo1LkiZQZtpwJkfJ4H3Gk2cOkMI7a3h8YO8=; b=GOfFsp5e3FkmUoKSl35ffOJ8ZNuNROealb4ukCgtbweqze/RdzHcQrAvA/LyQeVUR4 CKCnhxrh2y+PqABUnTxtDdgv0KErhpPmo4MdBF1EP5giAp1HGRh2zl1bdALr5wNONrWT Rodpd55dewGdtp5pJSfK3wdSoreHQGSaE7fF50ab2PqedPJGXny+f8MSsStbEqTSJDd+ N2Hf34gnTLtJAZpUpbiFGDr1AUO6oLlMW1OL9BwzsIl4MKaxEVlDGboLvzpTgWBffDCu OVQ1f2amz81k9aPxlXN07xc11ensnuz4QA+L4KGvIpkMLRx0kCJwUUNTPDzK6tcZ2gZU Wa4Q== X-Gm-Message-State: AOAM530sceOcXCiD2NMbXgN5h0g6qqWvFs7g9mWCDuP92QSk1Ykw1POK s1S49FdyKNpgL45usAqNw+6yyA== X-Google-Smtp-Source: ABdhPJxNpj4TgpZnpnlnxK/ZfqRpJ5ypI+6K9fjZQ0FuhIKOSIAj00srWAvfDxSh7VPDODP1pi+Ikg== X-Received: by 2002:a19:ad44:: with SMTP id s4mr363796lfd.563.1624314705160; Mon, 21 Jun 2021 15:31:45 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id b10sm2516025ljf.72.2021.06.21.15.31.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jun 2021 15:31:44 -0700 (PDT) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Rob Herring , Liam Girdwood , Mark Brown , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: linux-arm-msm@vger.kernel.org, Manivannan Sadhasivam , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org Subject: [PATCH v3 1/7] dt-bindings: regulator: qcom, qca6390: add binding for QCA6390 device Date: Tue, 22 Jun 2021 01:31:35 +0300 Message-Id: <20210621223141.1638189-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210621223141.1638189-1-dmitry.baryshkov@linaro.org> References: <20210621223141.1638189-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Qualcomm QCA6390/1 is a family of WiFi + Bluetooth SoCs, with BT part being controlled through the UART and WiFi being present on PCIe bus. Both blocks share common power sources. Add binding to describe power sequencing required to power up this device. Signed-off-by: Dmitry Baryshkov --- .../bindings/regulator/qcom,qca6390.yaml | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/qcom,qca6390.yaml diff --git a/Documentation/devicetree/bindings/regulator/qcom,qca6390.yaml b/Documentation/devicetree/bindings/regulator/qcom,qca6390.yaml new file mode 100644 index 000000000000..35315c521041 --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/qcom,qca6390.yaml @@ -0,0 +1,70 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/regulator/qcom,qca6390.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Qualcomm QCA6390 WiFi + Bluetoot SoC bindings + +maintainers: + - Andy Gross + - Bjorn Andersson + +description: | + This binding describes thes Qualcomm QCA6390 or QCA6391 power supplies and + enablement pins. + +properties: + compatible: + const: qcom,qca6390 + + vddaon-supply: + description: + 0.95V always-on LDO power input + + vddpmu-supply: + description: + 0.95V LDO power input to PMU + + vddrfa1-supply: + description: + 0.95V LDO power input to RFA + + vddrfa2-supply: + description: + 1.25V LDO power input to RFA + + vddrfa3-supply: + description: + 2V LDO power input to RFA + + vddpcie1-supply: + description: + 1.25V LDO power input to PCIe part + + vddpcie2-supply: + description: + 2V LDO power input to PCIe part + + vddio-supply: + description: + 1.8V VIO input + +additionalProperties: false + +examples: + - | + #include + qca6390: qca6390 { + compatible = "qcom,qca6390"; + + vddaon-supply = <&vreg_s6a_0p95>; + vddpmu-supply = <&vreg_s2f_0p95>; + vddrfa1-supply = <&vreg_s2f_0p95>; + vddrfa2-supply = <&vreg_s8c_1p3>; + vddrfa3-supply = <&vreg_s5a_1p9>; + vddpcie1-supply = <&vreg_s8c_1p3>; + vddpcie2-supply = <&vreg_s5a_1p9>; + vddio-supply = <&vreg_s4a_1p8>; + }; +... From patchwork Mon Jun 21 22:31:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 464606 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp64338jao; Mon, 21 Jun 2021 15:31:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpp7vedFAMOD4adN4p0e0u0PBP+I/khSpwSz1/ti6AkgY3skULnM6D4dvfjH8ellj4stcY X-Received: by 2002:a05:6402:1111:: with SMTP id u17mr791619edv.87.1624314719514; Mon, 21 Jun 2021 15:31:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624314719; cv=none; d=google.com; s=arc-20160816; b=eydsyGPwrP5E7G2bzItXLm8UVdtK4H81tcdUleJGARtfmsUU8adq2HGCHKnU6tezsV vOpAqsAzQWJpNegdJ/LC428C3Aeh99F0JgAuxRGEwETSGM+DnTTrBttrVRuqQUb2TOM6 K0zVdNSn3oFvJvRrK5XyFAnvPzlp965LSD6hQyEcCUkYP8jErJ6g8Lmq2nWJ/H6PtSkB kBUh7zTIo+X5JjPnkf4dwIypflrT5B8oFef1eKgtzTw9xYn9ePu5JXEC9D68JyovsVKI 7JU4o5UO4dR47aQ7APb7xEIDjvU+S/ux2Jq/K5zibP17ZzegwIMyAVt+5BwbvsuCEbKz j1dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QHx4lPVuLgrkbYf8vHia5iLzhseB4SWEXJbfsdqWkv8=; b=Ix4Z44qRqRdxPTRalE6X7a6auL8ll2JN4SVwNd+Vy2Tc3/9cDHbH223MDdDasKxNkT +CKMmaha5JncePF5Xr35HXrbsgNplNsnWW6VtmkPfjDzxEyCfUb+3aJZZeYFcGFP75lM NxymzRF5m8D+4iYtCfBjfjDuQXmKpFPx87FCljUmLGxtpm4wTcdnPe2SnU48BS76PBJo B9mf4PoS5JyEL5UjJq57ZZIlJXShcPht9vvmh71DiqVjzG1dHktVlQeOypA4KbOJnzKV kgR5DOHI6yAni9xr9REEfzBk5OvcVGQpNrJ42cTIEk5ec7TqzREJ/KDjUKwdurjSszlr fWTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TU2PbbIf; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lv23si13558627ejb.467.2021.06.21.15.31.59; Mon, 21 Jun 2021 15:31:59 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TU2PbbIf; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232185AbhFUWeD (ORCPT + 7 others); Mon, 21 Jun 2021 18:34:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbhFUWeD (ORCPT ); Mon, 21 Jun 2021 18:34:03 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96A9DC061768 for ; Mon, 21 Jun 2021 15:31:47 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id p7so32563428lfg.4 for ; Mon, 21 Jun 2021 15:31:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QHx4lPVuLgrkbYf8vHia5iLzhseB4SWEXJbfsdqWkv8=; b=TU2PbbIf7czYnoGY2jhObwIuRV669cWODpa4obBiKhfbq+paEHe2fDx2tBXoZgmMuu isGcF8UFk50IbKCENjFiRFImY/cJ/sj2EqAgJbyjBD8JRs95N/KOn866SynmbnBWaYq6 Ssos/lcKbUBntpLuCFSyikx6gvGjjqq5xx/Bmr1eNPs8CQwpisQkgSagxODUeJGa8gDW 56Idk1jWqOmAgu93x/e/SDVGezVpMyUIROCJOn8jazqIDfmqs4um27iLdcPwoH59wcTi tRosi115cReiQ4P3j7Xg9i//rJxWVh+RRuwDztOud/SaG692S/pdrjXeEv6JTY9Pm/Ob p0fQ== 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=QHx4lPVuLgrkbYf8vHia5iLzhseB4SWEXJbfsdqWkv8=; b=iVnUzcQ/dN15UUttnXmcoXVy0/0LhR0YHXhk4RJLax5aLSFmO7HR9CDZlE2MfG8u2Y hH+N0YMUe4ThNb2DAhddDKzUCUs17z0vqrY/ujrGsj+winaqVxG7Om0M2cjLtLaZym16 FZPZ/7zeX5GRfe7oGQS5nKIeWA1QN9ag2SBC5EKePh8qzF/9XCYJDsyayMYnsNW43vLW kOTi0ga5bCaMB7RdGC7gNIIBcHz2kEeMjMC5sblLSqm1H7TuDPes/UjNGOJDs8kfVECd MMymXf44umwEVblMAto/9RYmg32lECkBEKkc/fi0GxyTrGUwYudUiPmmKtgRu6plaovL Zx5A== X-Gm-Message-State: AOAM532FIHxQL3ZJsY1gwUvPoRGi49OiZaV/KcroTxmbCtrKh32NBJ82 aGPOHqHLN9ImMQf4Yi0eXoDD4Q== X-Received: by 2002:ac2:4d81:: with SMTP id g1mr381309lfe.319.1624314705927; Mon, 21 Jun 2021 15:31:45 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id b10sm2516025ljf.72.2021.06.21.15.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jun 2021 15:31:45 -0700 (PDT) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Rob Herring , Liam Girdwood , Mark Brown , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: linux-arm-msm@vger.kernel.org, Manivannan Sadhasivam , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org Subject: [PATCH v3 2/7] regulator: qca6390: add support for QCA639x powerup sequence Date: Tue, 22 Jun 2021 01:31:36 +0300 Message-Id: <20210621223141.1638189-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210621223141.1638189-1-dmitry.baryshkov@linaro.org> References: <20210621223141.1638189-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Qualcomm QCA6390/1 is a family of WiFi + Bluetooth SoCs, with BT part being controlled through the UART and WiFi being present on PCIe bus. Both blocks share common power sources. Add device driver handling power sequencing of QCA6390/1. Signed-off-by: Dmitry Baryshkov --- drivers/regulator/Kconfig | 13 +++ drivers/regulator/Makefile | 1 + drivers/regulator/qcom-qca639x.c | 157 +++++++++++++++++++++++++++++++ 3 files changed, 171 insertions(+) create mode 100644 drivers/regulator/qcom-qca639x.c -- 2.30.2 diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 3e7a38525cb3..7a560cddea7a 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -909,6 +909,19 @@ config REGULATOR_PWM This driver supports PWM controlled voltage regulators. PWM duty cycle can increase or decrease the voltage. +config REGULATOR_QCOM_QCA639X + tristate "Qualcomm QCA639x WiFi/Bluetooth module support" + help + If you say yes to this option, support will be included for Qualcomm + QCA639x family of WiFi and Bluetooth SoCs. Note, this driver supports + only power control for this SoC, you still have to enable individual + Bluetooth and WiFi drivers. This driver is only necessary on ARM + platforms with this chip. PCIe cards handle power sequencing on their + own. + + Say M here if you want to include support for QCA639x chips as a + module. This will build a module called "qcom-qca639x". + config REGULATOR_QCOM_RPM tristate "Qualcomm RPM regulator driver" depends on MFD_QCOM_RPM diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 580b015296ea..129c2110b78d 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -99,6 +99,7 @@ obj-$(CONFIG_REGULATOR_MT6380) += mt6380-regulator.o obj-$(CONFIG_REGULATOR_MT6397) += mt6397-regulator.o obj-$(CONFIG_REGULATOR_MTK_DVFSRC) += mtk-dvfsrc-regulator.o obj-$(CONFIG_REGULATOR_QCOM_LABIBB) += qcom-labibb-regulator.o +obj-$(CONFIG_REGULATOR_QCOM_QCA639X) += qcom-qca639x.o obj-$(CONFIG_REGULATOR_QCOM_RPM) += qcom_rpm-regulator.o obj-$(CONFIG_REGULATOR_QCOM_RPMH) += qcom-rpmh-regulator.o obj-$(CONFIG_REGULATOR_QCOM_SMD_RPM) += qcom_smd-regulator.o diff --git a/drivers/regulator/qcom-qca639x.c b/drivers/regulator/qcom-qca639x.c new file mode 100644 index 000000000000..a2c78c0f8baa --- /dev/null +++ b/drivers/regulator/qcom-qca639x.c @@ -0,0 +1,157 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2021, Linaro Limited + */ +#include +#include +#include +#include +#include +#include +#include + +#define MAX_NUM_REGULATORS 8 + +static struct vreg { + const char *name; + unsigned int load_uA; +} vregs[MAX_NUM_REGULATORS] = { + /* 2.0 V */ + { "vddpcie2", 15000 }, + { "vddrfa3", 400000 }, + + /* 0.95 V */ + { "vddaon", 100000 }, + { "vddpmu", 1250000 }, + { "vddrfa1", 200000 }, + + /* 1.35 V */ + { "vddrfa2", 400000 }, + { "vddpcie1", 35000 }, + + /* 1.8 V */ + { "vddio", 20000 }, +}; + +struct qca6390_data { + struct device *dev; + struct regulator_bulk_data regulators[MAX_NUM_REGULATORS]; + size_t num_vregs; + + struct regulator_desc desc; + struct regulator_dev *regulator_dev; + unsigned int enable_counter; +}; + +#define domain_to_data(domain) container_of(domain, struct qca6390_data, pd) + +static int qca6390_enable(struct regulator_dev *rdev) +{ + struct qca6390_data *data = rdev_get_drvdata(rdev); + int ret; + + ret = regulator_bulk_enable(data->num_vregs, data->regulators); + if (ret) { + dev_err(data->dev, "Failed to enable regulators"); + return ret; + } + + /* Wait for 1ms before toggling enable pins. */ + usleep_range(1000, 2000); + + data->enable_counter++; + + return 0; +} + +static int qca6390_disable(struct regulator_dev *rdev) +{ + struct qca6390_data *data = rdev_get_drvdata(rdev); + + regulator_bulk_disable(data->num_vregs, data->regulators); + + data->enable_counter--; + + return 0; +} + +static int qca6390_is_enabled(struct regulator_dev *rdev) +{ + struct qca6390_data *data = rdev_get_drvdata(rdev); + + return data->enable_counter > 0; +} + +static const struct regulator_ops qca6390_ops = { + .enable = qca6390_enable, + .disable = qca6390_disable, + .is_enabled = qca6390_is_enabled, +}; + +static int qca6390_probe(struct platform_device *pdev) +{ + struct qca6390_data *data; + struct device *dev = &pdev->dev; + struct regulator_config cfg = { }; + int i, ret; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->dev = dev; + data->num_vregs = ARRAY_SIZE(vregs); + + for (i = 0; i < data->num_vregs; i++) + data->regulators[i].supply = vregs[i].name; + + ret = devm_regulator_bulk_get(dev, data->num_vregs, data->regulators); + if (ret < 0) + return ret; + + for (i = 0; i < data->num_vregs; i++) { + ret = regulator_set_load(data->regulators[i].consumer, vregs[i].load_uA); + if (ret) + return ret; + } + + data->desc.name = devm_kstrdup(dev, dev_name(dev), GFP_KERNEL); + if (!data->desc.name) + return -ENOMEM; + + data->desc.type = REGULATOR_VOLTAGE; + data->desc.owner = THIS_MODULE; + data->desc.ops = &qca6390_ops; + + cfg.dev = dev; + cfg.of_node = dev->of_node; + cfg.driver_data = data; + cfg.init_data = of_get_regulator_init_data(dev, dev->of_node, &data->desc); + + data->regulator_dev = devm_regulator_register(dev, &data->desc, &cfg); + if (IS_ERR(data->regulator_dev)) { + ret = PTR_ERR(data->regulator_dev); + return ret; + } + + platform_set_drvdata(pdev, data); + + return 0; +} + +static const struct of_device_id qca6390_of_match[] = { + { .compatible = "qcom,qca6390" }, +}; + +static struct platform_driver qca6390_driver = { + .probe = qca6390_probe, + .driver = { + .name = "qca6390", + .of_match_table = qca6390_of_match, + }, +}; + +module_platform_driver(qca6390_driver); +MODULE_AUTHOR("Dmitry Baryshkov "); +MODULE_DESCRIPTION("Power control for Qualcomm QCA6390/1 BT/WiFi chip"); +MODULE_LICENSE("GPL v2"); From patchwork Mon Jun 21 22:31:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 464714 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D16CDC48BE5 for ; Mon, 21 Jun 2021 22:32:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C09C86128C for ; Mon, 21 Jun 2021 22:32:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232174AbhFUWeO (ORCPT ); Mon, 21 Jun 2021 18:34:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232351AbhFUWeJ (ORCPT ); Mon, 21 Jun 2021 18:34:09 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC3ACC061280 for ; Mon, 21 Jun 2021 15:31:50 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id q23so16931888ljh.0 for ; Mon, 21 Jun 2021 15:31:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Pl85yJPQ8UWWXJ4GoZSz05OqJVvyRpSXlOX5oJ9CbE0=; b=zIZNEtQC22piu1oOY/ASJ6inohtioGWMbhHGNwKmnkg+6S/zgVXtgw3YYIm6KRmP7D 2yQ+iV2uCIm7l2AsLFnTvfAptHFR7kZGrn47hI61YYqso7ykfC0HB6FlLPh7WTjbgJUu lA27VdWWiL5tFBNCvlEGIYuvH1FYQqSwllKOQtjzoRkIHRiuJkTNV9LEiJZuKLspFiv1 +XxMW6ymZVbLE+RC+aKxtEFjpUXZwG+6uvo6kfJECwE9jgE5A8gK3fdFrkzUypwirFYW u0CyisCXrQiw1gQpxDWdumJ3GCAWqi9X31v2gYEgXFNfRqqGOEuutu89S3R72hsZkt+G W96g== 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=Pl85yJPQ8UWWXJ4GoZSz05OqJVvyRpSXlOX5oJ9CbE0=; b=NBbTxcOHjIj2cXa6ZF1fXbvqMsTEU/CvQGUaWU7GWdFGxTkxqIEBiesfMFcp0/T0Xu ph9QQDRgCufKiWkuyrEVJ/e7T1yPI9LBjygCOga76tbYWSjb2yG/q3vRNdU/aSQo+yY+ tiNbgd4xruf66Yu9wrNjfIsjMagfCR0NRs9Bysn+gUkcPMS0F53JkcIqXX79xgJmqcCZ pZ0REHuy9nEuFCEgxA31J5gyYc77ViPvOwwHWtwv3IXZtj8UC3mwvCdVk/Jx2f0d1GNZ l6TchRTcvwTW+ifbk4p/LXOZwT4XfKqt/Ow8gatQJOWOnR+3vqXzxYNYCtp6Pa6s1Xrs RWhw== X-Gm-Message-State: AOAM533vJmZ6ylkNQ8j4b/33t49xnwMNJdoz2TxIUCxTV96oa2SntTap 1miThEnfgRMfqXZNGlXAV1lAVA== X-Google-Smtp-Source: ABdhPJxjoVCplwPuJvjbPzknCoMLW1t50J1MCoASlafBc+Ph6ulmOtfGcOvFbeHinnh6DsqSmvnOig== X-Received: by 2002:a2e:2a41:: with SMTP id q62mr372448ljq.371.1624314708998; Mon, 21 Jun 2021 15:31:48 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id b10sm2516025ljf.72.2021.06.21.15.31.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jun 2021 15:31:48 -0700 (PDT) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Rob Herring , Liam Girdwood , Mark Brown , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: linux-arm-msm@vger.kernel.org, Manivannan Sadhasivam , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org Subject: [PATCH v3 6/7] Bluetooth: hci_qca: add power sequencer support to qca6390 Date: Tue, 22 Jun 2021 01:31:40 +0300 Message-Id: <20210621223141.1638189-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210621223141.1638189-1-dmitry.baryshkov@linaro.org> References: <20210621223141.1638189-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org QCA6390 uses on-chip power sequencer (and power management unit) to supply power to both WiFi and BT parts. Since this sequencer is supported by a separate driver, use it as a single "vin" regulator. Signed-off-by: Dmitry Baryshkov --- drivers/bluetooth/hci_qca.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index bb04da08468a..deea38033248 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -1856,7 +1856,10 @@ static const struct qca_device_data qca_soc_data_wcn3998 = { static const struct qca_device_data qca_soc_data_qca6390 = { .soc_type = QCA_QCA6390, - .num_vregs = 0, + .vregs = (struct qca_vreg []) { + { "vin", 1000 }, + }, + .num_vregs = 1, .capabilities = QCA_CAP_NEEDS_BT_ENABLE, .name = "qca6390", }; From patchwork Mon Jun 21 22:31:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 464610 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp64421jao; Mon, 21 Jun 2021 15:32:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8iVYTrDZ2U3Sa3WgBX1+5r9+QyQ2j0a3N6kiGIskWpcGzgCMQlskT/8AH+hLlbp8KBiJj X-Received: by 2002:a17:906:4b43:: with SMTP id j3mr423340ejv.414.1624314724977; Mon, 21 Jun 2021 15:32:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624314724; cv=none; d=google.com; s=arc-20160816; b=elwHamZ/N5TDP1OfKsvEIGHB1ydtSfF5NhX+0MPLBgQ+1sJempUOygBOJaymEjtsfE qexp2oG3Xunzv2915UA+mIY1zgKsgMbDeZtoDfPT5sK9w3KSQs/81mF81iYMZVgkut5X gwIc4UxMiUtucl5DPkl2ZMXh2+uridODjJzd29YC0MzWJFhqi39NnJoBdCjabkQiipvH npiAwyIldhslT8ik4H3vnD1CNnRewWVSJUOfh0AK2iuPMQECsAtHYUqulVRgb+PeFBpt 2dQubAB8lWB/oCpPYlHSZcn16GchUlx7Cly2o8vMBWrIBDhKJOshW9g+q56EFWN6w1bl Qwlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6CNpdcs1A6Q97e0oT9ww9wqzNC5IQArK/FZR7yxSl3Q=; b=hFDYasaYFJ4xdO7xWVfCJsKGSTxqCj54qUf508ggr7rGQD5sfhadJRWcoNSFRdbb+J G2xOMOhupPjSvlwA9fXRSO+6RATL5pYgKHMX6Ylz+2Ouq2XKek3Ir7m84emxoMkYX2DQ EcGGYJXPtne7mGgjpkSeN6oKbQR81aAjppe5e2Hn/9aCApBtb1ftgzU40YNto2saL7hQ b3ZqDxpXl7cq8byg62s8LOBqy4v85Kp8IzNZESVH1ULfG7yLBy5q/H2FrgGI/zmfnVlZ KF7+cpMdgPUR0Elx2XUWAGjKcVFdV2MalqA5Aj/OH+rVUTm7qs+YndiLuFDqP/vB3AQJ QxDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Yb6TbXKO; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lv23si13558627ejb.467.2021.06.21.15.32.04; Mon, 21 Jun 2021 15:32:04 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Yb6TbXKO; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232263AbhFUWeM (ORCPT + 7 others); Mon, 21 Jun 2021 18:34:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232056AbhFUWeI (ORCPT ); Mon, 21 Jun 2021 18:34:08 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75CF9C061226 for ; Mon, 21 Jun 2021 15:31:51 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id x24so32693126lfr.10 for ; Mon, 21 Jun 2021 15:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6CNpdcs1A6Q97e0oT9ww9wqzNC5IQArK/FZR7yxSl3Q=; b=Yb6TbXKOmrz4ik8ZOHs5A5XBs/DumXbi/piHmfu4F6taHqLktXZ23ufzbl5R2xUvuI bbFWP6u8lvtFl5BQPtJKSDrUN+tXCWaULLkACjOWYoKYiD+b5nXWqiPz/EEySRYHf8vb 1MPdLXmHA9IHuYpJHIoEpP3abBeh2NdEHp3e9vs9q8g04vH+YNPagCVd9C7zxh81lHNs IGd5wfJ18zOeNytbtygNpSLVNmT7mEP5w38StMYaGH4FGDYonQyRo1jv+ukp6t7u6XO9 j98Vq0syVYhH9XX9rlNtuYDD431x3lhrGyw4qnsPCAShK18DLGicrmM/pBzjX9W8PJ3Y djdA== 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=6CNpdcs1A6Q97e0oT9ww9wqzNC5IQArK/FZR7yxSl3Q=; b=dArTOknlbdI/ZO/wz0/pJBSr9XLZrSqFGYskH8JaQ+pCxb2HOiKKGCLbK3dvIyEc23 zQiqmmbC0HTUHvlXhyt8ir1xH2+8tjXNr0j/gsNHag+P6UDRfsjEDJBJn9HGVJP6F2Pi Fn2pJP8at+ZbrA8NVkkHpPHu624NXIxxeqj7BU+oXpZQVxEGarpD7FGPaxTlgTjDChjy Z6hFnJz2x0umTGtH4rRlg1K4FsVVD3JgAGrokuXBLRA4amUmnqSMVXu9Mo1rO55zg4hs 2CcmkyU50HtN5kmy9P71pBN1fPU6byPD8v4stYWtg1KE0ioqnYaebqDfVR6yfDyUfdEH wmxw== X-Gm-Message-State: AOAM530Btv305z1Q3JWkrYfWKMorA89fN+S2VFlfekNnaTT0QXIS7xcI HSY70jNmL7qjOH33IyivhU9G8Q== X-Received: by 2002:ac2:533c:: with SMTP id f28mr419456lfh.268.1624314709764; Mon, 21 Jun 2021 15:31:49 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id b10sm2516025ljf.72.2021.06.21.15.31.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jun 2021 15:31:49 -0700 (PDT) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Rob Herring , Liam Girdwood , Mark Brown , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: linux-arm-msm@vger.kernel.org, Manivannan Sadhasivam , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org Subject: [PATCH v3 7/7] arm64: dts: qcom: qrb5165-rb5: add QCA6391 WiFi+BT SoC Date: Tue, 22 Jun 2021 01:31:41 +0300 Message-Id: <20210621223141.1638189-8-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210621223141.1638189-1-dmitry.baryshkov@linaro.org> References: <20210621223141.1638189-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Describe the onboard WiFi+BT SoC QCA6391. It is connected to uart6 to provide Bluetooth functionality (QCA) and to PCIe to provide WiFi (ath11k). A separate power sequencer device node is used to describe on-SoC power management unit common to both WiFi and BT parts. Signed-off-by: Dmitry Baryshkov --- arch/arm64/boot/dts/qcom/qrb5165-rb5.dts | 56 ++++++++++++++++++++++++ 1 file changed, 56 insertions(+) -- 2.30.2 diff --git a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts index 5f41de20aa22..f968208b1947 100644 --- a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts +++ b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts @@ -20,6 +20,7 @@ / { aliases { serial0 = &uart12; + serial1 = &uart6; sdhc2 = &sdhc_2; }; @@ -223,6 +224,28 @@ vreg_s4a_1p8: vreg-s4a-1p8 { regulator-max-microvolt = <1800000>; regulator-always-on; }; + + qca6391: qca6391 { + compatible = "qcom,qca6390"; + + vddaon-supply = <&vreg_s6a_0p95>; + vddpmu-supply = <&vreg_s2f_0p95>; + vddrfa1-supply = <&vreg_s2f_0p95>; + vddrfa2-supply = <&vreg_s8c_1p3>; + vddrfa3-supply = <&vreg_s5a_1p9>; + vddpcie1-supply = <&vreg_s8c_1p3>; + vddpcie2-supply = <&vreg_s5a_1p9>; + vddio-supply = <&vreg_s4a_1p8>; + }; + + vreg_wlan: vreg-wlan { + compatible = "regulator-fixed"; + regulator-name = "vreg-wlan"; + + vin-supply = <&qca6391>; + gpio = <&tlmm 20 GPIO_ACTIVE_LOW>; + enable-active-high; + }; }; &adsp { @@ -668,6 +691,8 @@ &pcie0 { wake-gpio = <&tlmm 81 GPIO_ACTIVE_HIGH>; pinctrl-names = "default"; pinctrl-0 = <&pcie0_default_state>; + + vddpe-3v3-supply = <&vreg_wlan>; }; &pcie0_phy { @@ -811,6 +836,26 @@ lt9611_rst_pin: lt9611-rst-pin { }; }; +&qup_uart6_default { + ctsrx { + pins = "gpio16", "gpio19"; + drive-strength = <2>; + bias-disable; + }; + + rts { + pins = "gpio17"; + drive-strength = <2>; + bias-disable; + }; + + tx { + pins = "gpio18"; + drive-strength = <2>; + bias-pull-up; + }; +}; + &qupv3_id_0 { status = "okay"; }; @@ -1275,6 +1320,17 @@ sdc2_card_det_n: sd-card-det-n { }; }; +&uart6 { + status = "okay"; + bluetooth { + compatible = "qcom,qca6390-bt"; + vin-supply = <&qca6391>; + clocks = <&sleep_clk>; + + enable-gpios = <&tlmm 21 GPIO_ACTIVE_HIGH>; + }; +}; + &uart12 { status = "okay"; };