linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harish Bandi <c-hbandi@codeaurora.org>
To: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Balakrishna Godavarthi <bgodavar@codeaurora.org>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jeffrey Hugo <jeffrey.l.hugo@gmail.com>,
	linux-arm-msm@vger.kernel.org,
	linux-bluetooth-owner@vger.kernel.org
Subject: Re: [PATCH 1/4] Bluetooth: hci_qca: Update regulator_set_load() usage
Date: Fri, 18 Oct 2019 16:48:15 +0530	[thread overview]
Message-ID: <57129e239e5e7717c00aa73e28094b4a@codeaurora.org> (raw)
In-Reply-To: <20191018052405.3693555-2-bjorn.andersson@linaro.org>

On 2019-10-18 10:54, Bjorn Andersson wrote:
> Since the introduction of '5451781dadf8 ("regulator: core: Only count
> load for enabled consumers")' in v5.0, the requested load of a 
> regulator
> consumer is only accounted for when said consumer is voted enabled.
> 
> So there's no need to vote for load ever time the regulator is
> enabled or disabled.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
>  drivers/bluetooth/hci_qca.c | 33 ++++++++++++++++++---------------
>  1 file changed, 18 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index e3164c200eac..c07c529b0d81 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -1393,13 +1393,6 @@ static int qca_enable_regulator(struct qca_vreg 
> vregs,
>  	if (ret)
>  		return ret;
> 
> -	if (vregs.load_uA)
> -		ret = regulator_set_load(regulator,
> -					 vregs.load_uA);
> -
> -	if (ret)
> -		return ret;
> -
>  	return regulator_enable(regulator);
> 
>  }
> @@ -1409,8 +1402,6 @@ static void qca_disable_regulator(struct qca_vreg 
> vregs,
>  {
>  	regulator_disable(regulator);
>  	regulator_set_voltage(regulator, 0, vregs.max_uV);
> -	if (vregs.load_uA)
> -		regulator_set_load(regulator, 0);
> 
>  }
> 
> @@ -1462,18 +1453,30 @@ static int qca_power_setup(struct hci_uart *hu, 
> bool on)
>  static int qca_init_regulators(struct qca_power *qca,
>  				const struct qca_vreg *vregs, size_t num_vregs)
>  {
> +	struct regulator_bulk_data *bulk;
> +	int ret;
>  	int i;
> 
> -	qca->vreg_bulk = devm_kcalloc(qca->dev, num_vregs,
> -				      sizeof(struct regulator_bulk_data),
> -				      GFP_KERNEL);
> -	if (!qca->vreg_bulk)
> +	bulk = devm_kcalloc(qca->dev, num_vregs, sizeof(*bulk), GFP_KERNEL);
> +	if (!bulk)
>  		return -ENOMEM;
> 
>  	for (i = 0; i < num_vregs; i++)
> -		qca->vreg_bulk[i].supply = vregs[i].name;
> +		bulk[i].supply = vregs[i].name;
> +
> +	ret = devm_regulator_bulk_get(qca->dev, num_vregs, bulk);
> +	if (ret < 0)
> +		return ret;
> 
> -	return devm_regulator_bulk_get(qca->dev, num_vregs, qca->vreg_bulk);
> +	for (i = 0; i < num_vregs; i++) {
> +		ret = regulator_set_load(bulk[i].consumer, vregs[i].load_uA);
> +		if (ret)
> +			return ret;
> +	}
> +
> +	qca->vreg_bulk = bulk;
> +
> +	return 0;
>  }
> 
>  static int qca_serdev_probe(struct serdev_device *serdev)

  reply	other threads:[~2019-10-18 11:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18  5:24 [PATCH 0/4] Bluetooth: hci_qca: Regulator usage cleanup Bjorn Andersson
2019-10-18  5:24 ` [PATCH 1/4] Bluetooth: hci_qca: Update regulator_set_load() usage Bjorn Andersson
2019-10-18 11:18   ` Harish Bandi [this message]
2019-10-18  5:24 ` [PATCH 2/4] Bluetooth: hci_qca: Don't vote for specific voltage Bjorn Andersson
2019-10-18 11:18   ` Harish Bandi
2019-10-18 18:22   ` Matthias Kaehlcke
2019-10-21  6:37     ` Harish Bandi
2019-10-22  6:05       ` Balakrishna Godavarthi
2019-10-22 17:15         ` Matthias Kaehlcke
2019-10-30  6:18           ` Balakrishna Godavarthi
2019-10-18  5:24 ` [PATCH 3/4] Bluetooth: hci_qca: Use regulator bulk enable/disable Bjorn Andersson
2019-10-18 11:18   ` Harish Bandi
2019-10-18  5:24 ` [PATCH 4/4] Bluetooth: hci_qca: Split qca_power_setup() Bjorn Andersson
2019-10-18 11:19   ` Harish Bandi
2019-10-18  7:59 ` [PATCH 0/4] Bluetooth: hci_qca: Regulator usage cleanup Marcel Holtmann
2019-10-18 14:52   ` Jeffrey Hugo
2019-10-18 11:17 ` Harish Bandi

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=57129e239e5e7717c00aa73e28094b4a@codeaurora.org \
    --to=c-hbandi@codeaurora.org \
    --cc=bgodavar@codeaurora.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=jeffrey.l.hugo@gmail.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-bluetooth-owner@vger.kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /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).