linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
Cc: marcel@holtmann.org, johan.hedberg@gmail.com, mka@chromium.org,
	linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org,
	robh@kernel.org, hemantg@codeaurora.org,
	linux-arm-msm@vger.kernel.org, bgodavar@codeaurora.org,
	tientzu@chromium.org, seanpaul@chromium.org,
	rjliao@codeaurora.org, yshavit@google.com
Subject: Re: [PATCH v2 1/2] Bluetooth: hci_qca: Enable clocks required for BT SOC
Date: Mon, 3 Feb 2020 11:56:32 -0800	[thread overview]
Message-ID: <20200203195632.GM3948@builder> (raw)
In-Reply-To: <1580456335-7317-1-git-send-email-gubbaven@codeaurora.org>

On Thu 30 Jan 23:38 PST 2020, Venkata Lakshmi Narayana Gubba wrote:

> Instead of relying on other subsytem to turn ON clocks
> required for BT SoC to operate, voting them from the driver.
> 
> Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
> ---
> v2:
>    * addressed forward declarations
>    * updated with devm_clk_get_optional()
>  
> ---
>  drivers/bluetooth/hci_qca.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index d6e0c99..73706f3 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -1738,6 +1738,15 @@ static int qca_power_off(struct hci_dev *hdev)
>  	return 0;
>  }
>  
> +static int qca_setup_clock(struct clk *clk, bool enable)
> +{
> +	if (enable)
> +		return clk_prepare_enable(clk);
> +
> +	clk_disable_unprepare(clk);
> +	return 0;
> +}

As Marcel requested, inline these.

> +
>  static int qca_regulator_enable(struct qca_serdev *qcadev)
>  {
>  	struct qca_power *power = qcadev->bt_power;
> @@ -1755,6 +1764,13 @@ static int qca_regulator_enable(struct qca_serdev *qcadev)
>  
>  	power->vregs_on = true;
>  
> +	ret = qca_setup_clock(qcadev->susclk, true);
> +	if (ret) {
> +		/* Turn off regulators to overcome power leakage */

You can omit this comment as well, as the name of the function you call
is aptly named.

> +		qca_regulator_disable(qcadev);
> +		return ret;

Just return ret below instead.

> +	}
> +
>  	return 0;
>  }
>  
> @@ -1773,6 +1789,9 @@ static void qca_regulator_disable(struct qca_serdev *qcadev)
>  
>  	regulator_bulk_disable(power->num_vregs, power->vreg_bulk);
>  	power->vregs_on = false;
> +
> +	if (qcadev->susclk)

In the enable path you (correctly) rely on passing NULL to the clock
code, so do the same here.

Regards,
Bjorn

  parent reply	other threads:[~2020-02-03 19:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31  7:38 [PATCH v2 1/2] Bluetooth: hci_qca: Enable clocks required for BT SOC Venkata Lakshmi Narayana Gubba
2020-01-31  7:38 ` [PATCH v2 2/2] dt-bindings: net: bluetooth: Add device tree bindings for QTI chip WCN3991 Venkata Lakshmi Narayana Gubba
2020-01-31 22:36   ` Matthias Kaehlcke
2020-02-03  8:23     ` gubbaven
2020-01-31 19:51 ` [PATCH v2 1/2] Bluetooth: hci_qca: Enable clocks required for BT SOC Marcel Holtmann
2020-02-03  7:27   ` gubbaven
2020-02-03 19:56 ` Bjorn Andersson [this message]
2020-02-04  9:04   ` Marcel Holtmann
2020-02-05 10:37     ` gubbaven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200203195632.GM3948@builder \
    --to=bjorn.andersson@linaro.org \
    --cc=bgodavar@codeaurora.org \
    --cc=gubbaven@codeaurora.org \
    --cc=hemantg@codeaurora.org \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=mka@chromium.org \
    --cc=rjliao@codeaurora.org \
    --cc=robh@kernel.org \
    --cc=seanpaul@chromium.org \
    --cc=tientzu@chromium.org \
    --cc=yshavit@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).