From patchwork Tue Aug 17 00:55:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 498106 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp606513jab; Mon, 16 Aug 2021 17:55:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxT3sW//mnfASJINEjTqB+HrpwuEBxbMlY01OGU26FYu5RUWM4E8xvWHykq/dKnlWz0lMTJ X-Received: by 2002:a05:6402:424c:: with SMTP id g12mr1005322edb.121.1629161744335; Mon, 16 Aug 2021 17:55:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629161744; cv=none; d=google.com; s=arc-20160816; b=OVRgIzisCKDZIzkb5DVdTDNpnu2HYnFPPfySWJDFOy8y2jJkUrw2/D+p+IhIni/NQY 0T69GJlg7zJbtHvmjNu1YWXScge4pHUjCQ8OitU9cdSoSy7mVXp3YzycgFJhVW1R42ce vx64Wwg1KIM5PsRl4hDASs4PRApGgkjQDa1q9L0D2rqN7nR+Q5TSDu7Gj4lxtj0ab9zJ zSr1z9l2WmOEeHZP70XkKh1Q3TzPMmYdyMFVtnx4oxfhO8HM0MfczjwR9XLLyFm1/k/o SQzSJKXC+bmHvV5fPoQM8spOnrl7Ig/jFtiT+FbHKuuMkxnvRP2HZErI2eRL6nFc4n3r 6fwQ== 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=osWd7o/rbNiDPvWTS+l0GmKDa+5+wAZOkcYrzBBA3b8=; b=kfdtWSotSKJgggZyhfiwt/IFCWihZo+3mYUp3B6U233tQk2c5YzNQImR3Jrr0KJKq6 z1WJLT5IVJLyGzaFkHICylnG2rrri5tvjuJ+mX7pDazdcup5IToLlV5UD8iVjYTuu4En uGd2PmNnyewBXuFDvjJwqEQBoZlRGDH/ymirmrf7Sq5iWXLl0c4p3k1SrJuFOA+BJY6U 5C0pb5lBMPz2eE3GF7IWT2EyCYJWQw9Kl0ZPaZNZZlREpxt3XgLJXtSGRH7+0FWAHt4F caVGJwV7upGpjhivGi3GMaQQOSkQmKuJtO70d7D9KzTIB2h+OriXj3bWm0WtcWN7oQeH cFPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lT5ChW9T; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 p10si530183ejl.495.2021.08.16.17.55.44; Mon, 16 Aug 2021 17:55:44 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-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=lT5ChW9T; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S233159AbhHQA4O (ORCPT + 8 others); Mon, 16 Aug 2021 20:56:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236098AbhHQAzy (ORCPT ); Mon, 16 Aug 2021 20:55:54 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FD9FC061796 for ; Mon, 16 Aug 2021 17:55:22 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id s3so1080171ljp.11 for ; Mon, 16 Aug 2021 17:55: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=osWd7o/rbNiDPvWTS+l0GmKDa+5+wAZOkcYrzBBA3b8=; b=lT5ChW9T1u195uYv4Esr58dfWbudSm+C+kKwpf9Lruop4z4jZ6yU7Ttg9iNOslMEl1 oBIrCmYc74WXZoj21FXZG3tPQJyveSrh3Y0P5uLh9Yzj81tKblayMrjJH11cc3CMi8iY 6JCW94lFgA93lhEAZuZJbU5TlePL3EYs9PoOfiJv2rXd1rb9Dqbj4ZhlTpm1uAkMnDCZ 2ria0E26+y7SN+qI5WoqxXgtjfINcQftMJIonKwmrtKYVykoASrT298MBPclrLJuia9V moSbwQz/KefZctVj3YxvN0y4HmHsoKXCExcUs1nfkKesvsCiD+WzeSBD9/2LPA64+n7u hLZg== 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=osWd7o/rbNiDPvWTS+l0GmKDa+5+wAZOkcYrzBBA3b8=; b=NU4lel9vIecDmWf60EkeEBxqa1Ts/FHyfbSFdwlLgGFJNRezcHKvl+ezlalEKl+Zdf XQfnsAD+4qZbnCjBRtJl2QS+1wTeGroJuCpn1dCl7N2cCx4KmmLfxkvuWIQs4tTV1hvQ woU3tmEfaAOPcVQYja89GkHzzgyk/jnfJTH7Tt2c7y63/cZ2cNrQfj68CiH/DnRonFQ7 /oZHNG/RP9z3e5yPLNUVaDmwTospzmv3fkIs7TaZNwJaheWBUPLRp/MUBM9znPVdt381 jL/QB9jbKkwl87bs7KYHlUh76mQCbbGrXkFGc8G+tms36FXVQMG70gB9MMpmOwMtRp9e K7kw== X-Gm-Message-State: AOAM5301baqwADll2OBSbS9JIMKDTz61SRLeIzBln3wVF46v4WJwE/OP +XxIr1/2e3Q24rMW5FR7v63Wyg== X-Received: by 2002:a2e:9a50:: with SMTP id k16mr793082ljj.308.1629161720605; Mon, 16 Aug 2021 17:55:20 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id z6sm40719lfb.251.2021.08.16.17.55.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Aug 2021 17:55:20 -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: [RFC PATCH 09/15] Bluetooth: hci_qca: add support for pwrseq Date: Tue, 17 Aug 2021 03:55:01 +0300 Message-Id: <20210817005507.1507580-10-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210817005507.1507580-1-dmitry.baryshkov@linaro.org> References: <20210817005507.1507580-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Support using pwrseq for powering up and down the QCA BT chips. Signed-off-by: Dmitry Baryshkov --- drivers/bluetooth/hci_qca.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) -- 2.30.2 diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 2d23e8a3ca14..a908a952c0ef 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -211,6 +212,7 @@ struct qca_serdev { struct gpio_desc *sw_ctrl; struct clk *susclk; enum qca_btsoc_type btsoc_type; + struct pwrseq *pwrseq; struct regulator_bulk_data *vreg_bulk; int num_vregs; bool vregs_on; @@ -1602,7 +1604,10 @@ static int qca_power_on(struct hci_dev *hdev) */ qcadev = serdev_device_get_drvdata(hu->serdev); serdev_device_close(hu->serdev); - ret = qca_regulator_enable(qcadev); + if (qcadev->pwrseq) + ret = pwrseq_full_power_on(qcadev->pwrseq); + else + ret = qca_regulator_enable(qcadev); if (ret) return ret; @@ -1863,7 +1868,10 @@ static void qca_power_shutdown(struct hci_uart *hu) host_set_baudrate(hu, 2400); qca_send_power_pulse(hu, false); } - qca_regulator_disable(qcadev); + if (qcadev->pwrseq) + pwrseq_power_off(qcadev->pwrseq); + else + qca_regulator_disable(qcadev); set_bit(QCA_BT_OFF, &qca->flags); } @@ -2015,7 +2023,15 @@ static int qca_serdev_probe(struct serdev_device *serdev) else qcadev->btsoc_type = QCA_ROME; - if (data && data->num_vregs) { + qcadev->pwrseq = devm_pwrseq_get_optional(&serdev->dev, "bt"); + if (IS_ERR(qcadev->pwrseq)) { + err = PTR_ERR(qcadev->pwrseq); + BT_ERR("Failed to init regulators:%d", err); + return err; + + } + + if (!qcadev->pwrseq && data && data->num_vregs) { err = qca_init_regulators(qcadev, &serdev->dev, data->vregs, data->num_vregs); if (err) {