From patchwork Wed Oct 6 03:54:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 515278 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp155142imy; Tue, 5 Oct 2021 20:54:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNvDkwvpXjqFkMS0TTf3duj/wZf4UPguTFuiMkxsvhAowqN8q51WEGjHX4ER7kkXTIIlXJ X-Received: by 2002:a05:6402:1d15:: with SMTP id dg21mr8246707edb.96.1633492483962; Tue, 05 Oct 2021 20:54:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633492483; cv=none; d=google.com; s=arc-20160816; b=L9OtxmvI09OUTSUgJh/TcOHsSatNB9LJCflY3bZifJ/xqL5ylOvectd4xEK46b58gN EoItAghp/DtwLBIxBta9hIo3877H/KUcCxbn9eC2JNBZhssAsl/hm91fW4bgFOapT3uu QLAIzz6xCFnS+0gk1HuPH/2f7Dv4bpeK5cO/Cb1vFc7SYhpR/hXURYxC5f92eEwBoJRr uoOdfsdUb8Fk4m9zChK8s2aEYb70CshZlR5LxYBS6MVWDYGbWu8NKSsc0GkjSGD6VdT9 oGz2/wva49FYZ7pv3YXqWQVjl4uwVQNqE58Rc2/GRcpnIJupEPDO5i11MN+xuvqSvcTC Gzmg== 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=gLxBTtcfVl4dtJ5J9RXz2IWihrIE1icg8208P8LI768=; b=nfDKncDmItj0r2/PLM4/T5Qykmmr1Cl1OncKTJgC5XwrGJeodzppuZ/uK5f3b5CLZM 6wq542IJ/uuo1nY8BR9RM/ulZzShwa0yiOw9XM12wWUpa0LYkkMv+AS/y48TwGzWe8Eg SQP5AyE+Yse4jLmVjRakwYkmGEQ1aYf7OfndutVpwyNzi3uHCWFdmG0lYOF3Tqa9eVLm RWZ4uzzRGINNwJOROe9ljvqzgqyXnyrmlULSarA0srGUeMeu8tzVjp5LIs48PYsPcSWw 6bNe5sJd0qRBfNv+uJPEDvT8oSfQ6RAW0FsoIoQjl1PgfKE+1uJO4x7rD4saAW/6/SzS qjZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="o7/Ze/q0"; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-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 w11si28825141edc.191.2021.10.05.20.54.43; Tue, 05 Oct 2021 20:54:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-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="o7/Ze/q0"; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-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 S237615AbhJFD4d (ORCPT + 1 other); Tue, 5 Oct 2021 23:56:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237436AbhJFD4N (ORCPT ); Tue, 5 Oct 2021 23:56:13 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 405EDC061767 for ; Tue, 5 Oct 2021 20:54:22 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id y23so4776855lfb.0 for ; Tue, 05 Oct 2021 20:54:22 -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=gLxBTtcfVl4dtJ5J9RXz2IWihrIE1icg8208P8LI768=; b=o7/Ze/q0htXc3MD9r6CcG3LU411fiLFkjclIYt5gxydc/GKQKyTk+c7fhvbcoYtnXY 7/e9Y6P+WvNC7PaRnuR6Fs8f/HGSu4cm8HPQMOPF+D42Ao70Z9MCpH+fqsIDFK5zJkDR R6gWSvzoe/3HsUDPDcO1qFwjWV7xhaNAeaxJGZ4Ca0smcF2WjV7pCfl0Im0ofCDBFxmf ZqpC8OxUr+Gjxy55TUUZGalgayt6UEOiDNBvCOqr7z2uJPL94ZyCRoG6wWTIlDvMj9/F Fom9EcqTv3xJHX1Gutf93jM/YB4tttS/qRFlfCz1mTrwIXBMkWVUSeIxW/9VKgUMzgNQ ExTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gLxBTtcfVl4dtJ5J9RXz2IWihrIE1icg8208P8LI768=; b=Gq0xErN/MIauQcrfeQ0kyGDXDCZqqROwq+vvKukSs0pCJ7mlge3VMJ+dHZV04dzWxZ zUH8hbltVZPGoUF0fAb/xXZxzbwR/cFAbbfwKxIo/iUvyGiM69q9pjiqwshTlGGs49wu TW42hSogDqVHYLRUZRaIr+l/iaw2MCGIvduRd7uZ9YwWYBVkFkLB5n76q1EaxV+rofQm nngG5cRsfxV1P6Ssfgenu+V5nGGPEUz+Jp4z/sZCbdhIvNAfHvKdB+1x57AAV/If/PJu o9sJJeEsarLfgtGy27SiRF8yXFs2/RaRB7Enw1omElQq4dq/KMl4OvMtmHv731Rf3QIv YsyQ== X-Gm-Message-State: AOAM53222FSyK+DYEKrXWT6S3zKZ7vwB6wTAprB//HSrPcmXWANu8C0h OmE3G3ItusOoFsdhlQpPUycPFA== X-Received: by 2002:ac2:4c51:: with SMTP id o17mr7353777lfk.457.1633492460649; Tue, 05 Oct 2021 20:54:20 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id s4sm2142967lfd.103.2021.10.05.20.54.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 20:54:19 -0700 (PDT) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Ulf Hansson , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , Kalle Valo , "David S. Miller" , Jakub Kicinski , Stanimir Varbanov Cc: linux-arm-msm@vger.kernel.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v1 10/15] ath10k: add support for pwrseq sequencing Date: Wed, 6 Oct 2021 06:54:02 +0300 Message-Id: <20211006035407.1147909-11-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211006035407.1147909-1-dmitry.baryshkov@linaro.org> References: <20211006035407.1147909-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Power sequencing for Qualcomm WiFi+BT chipsets are being reworked to use pwrseq rather than individually handling all the regulators. Add support for pwrseq to ath10k SNOC driver. Signed-off-by: Dmitry Baryshkov --- drivers/net/wireless/ath/ath10k/snoc.c | 45 +++++++++++++------------- drivers/net/wireless/ath/ath10k/snoc.h | 4 +-- 2 files changed, 25 insertions(+), 24 deletions(-) -- 2.33.0 diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index ea00fbb15601..8578c56982df 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "ce.h" #include "coredump.h" @@ -41,14 +42,6 @@ static char *const ce_name[] = { "WLAN_CE_11", }; -static const char * const ath10k_regulators[] = { - "vdd-0.8-cx-mx", - "vdd-1.8-xo", - "vdd-1.3-rfa", - "vdd-3.3-ch0", - "vdd-3.3-ch1", -}; - static const char * const ath10k_clocks[] = { "cxo_ref_clk_pin", "qdss", }; @@ -1010,10 +1003,14 @@ static int ath10k_hw_power_on(struct ath10k *ar) ath10k_dbg(ar, ATH10K_DBG_SNOC, "soc power on\n"); - ret = regulator_bulk_enable(ar_snoc->num_vregs, ar_snoc->vregs); + ret = pwrseq_full_power_on(ar_snoc->pwrseq); if (ret) return ret; + ret = regulator_enable(ar_snoc->vreg_cx_mx); + if (ret) + goto vreg_pwrseq_off; + ret = clk_bulk_prepare_enable(ar_snoc->num_clks, ar_snoc->clks); if (ret) goto vreg_off; @@ -1021,11 +1018,14 @@ static int ath10k_hw_power_on(struct ath10k *ar) return ret; vreg_off: - regulator_bulk_disable(ar_snoc->num_vregs, ar_snoc->vregs); + regulator_disable(ar_snoc->vreg_cx_mx); +vreg_pwrseq_off: + pwrseq_power_off(ar_snoc->pwrseq); + return ret; } -static int ath10k_hw_power_off(struct ath10k *ar) +static void ath10k_hw_power_off(struct ath10k *ar) { struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); @@ -1033,7 +1033,9 @@ static int ath10k_hw_power_off(struct ath10k *ar) clk_bulk_disable_unprepare(ar_snoc->num_clks, ar_snoc->clks); - return regulator_bulk_disable(ar_snoc->num_vregs, ar_snoc->vregs); + regulator_disable(ar_snoc->vreg_cx_mx); + + pwrseq_power_off(ar_snoc->pwrseq); } static void ath10k_snoc_wlan_disable(struct ath10k *ar) @@ -1691,20 +1693,19 @@ static int ath10k_snoc_probe(struct platform_device *pdev) goto err_release_resource; } - ar_snoc->num_vregs = ARRAY_SIZE(ath10k_regulators); - ar_snoc->vregs = devm_kcalloc(&pdev->dev, ar_snoc->num_vregs, - sizeof(*ar_snoc->vregs), GFP_KERNEL); - if (!ar_snoc->vregs) { - ret = -ENOMEM; + ar_snoc->pwrseq = devm_pwrseq_get(&pdev->dev, "wifi"); + if (IS_ERR(ar_snoc->pwrseq)) { + ret = PTR_ERR(ar_snoc->pwrseq); + if (ret != -EPROBE_DEFER) + ath10k_warn(ar, "failed to acquire pwrseq: %d\n", ret); goto err_free_irq; } - for (i = 0; i < ar_snoc->num_vregs; i++) - ar_snoc->vregs[i].supply = ath10k_regulators[i]; - ret = devm_regulator_bulk_get(&pdev->dev, ar_snoc->num_vregs, - ar_snoc->vregs); - if (ret < 0) + ar_snoc->vreg_cx_mx = devm_regulator_get(&pdev->dev, "vdd-0.8-cx-mx"); + if (IS_ERR(ar_snoc->vreg_cx_mx)) { + ret = PTR_ERR(ar_snoc->vreg_cx_mx); goto err_free_irq; + } ar_snoc->num_clks = ARRAY_SIZE(ath10k_clocks); ar_snoc->clks = devm_kcalloc(&pdev->dev, ar_snoc->num_clks, diff --git a/drivers/net/wireless/ath/ath10k/snoc.h b/drivers/net/wireless/ath/ath10k/snoc.h index 5095d1893681..5188d6f6f850 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.h +++ b/drivers/net/wireless/ath/ath10k/snoc.h @@ -70,10 +70,10 @@ struct ath10k_snoc { struct ath10k_snoc_ce_irq ce_irqs[CE_COUNT_MAX]; struct ath10k_ce ce; struct timer_list rx_post_retry; - struct regulator_bulk_data *vregs; - size_t num_vregs; + struct regulator *vreg_cx_mx; struct clk_bulk_data *clks; size_t num_clks; + struct pwrseq *pwrseq; struct ath10k_qmi *qmi; unsigned long flags; bool xo_cal_supported;