From: Maciej Purski <m.purski@samsung.com>
To: Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Liam Girdwood <lgirdwood@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [PATCH v3 4/4] regulator: core: Balance coupled regulators voltages
Date: Wed, 13 Dec 2017 10:25:00 +0100 [thread overview]
Message-ID: <0bca0d20-1ca8-be4c-a60e-bbc0c640ae41@samsung.com> (raw)
In-Reply-To: <20171212115427.GG16323@sirena.org.uk>
On 12/12/2017 12:54 PM, Mark Brown wrote:
> On Thu, Dec 07, 2017 at 10:46:15AM +0100, Maciej Purski wrote:
>
>> @@ -2447,10 +2482,9 @@ static int _regulator_is_enabled(struct regulator_dev *rdev)
>> return rdev->desc->ops->is_enabled(rdev);
>> }
>>
>> -static int _regulator_list_voltage(struct regulator *regulator,
>> - unsigned selector, int lock)
>> +static int _regulator_list_voltage(struct regulator_dev *rdev,
>> + unsigned selector, int lock)
>> {
>
> Please split this refactoring of _list_voltage() into a separate patch
> for ease of review. It can go in separately which will make this change
> smaller and easier to review.
>
>> @@ -2928,6 +2961,35 @@ static int regulator_set_voltage_unlocked(struct regulator *regulator,
>> if (ret < 0)
>> goto out2;
>>
>> + /*
>> + * If the regulator is not coupled just set voltage normally, else
>> + * return after changing consumer demands without changing voltage.
>> + * This will be handled outside the function
>> + * by regulator_balance_coupled()
>> + */
>> + if (!rdev->coupling_desc) {
>> + ret = regulator_set_voltage_rdev(regulator->rdev,
>> + min_uV, max_uV);
>> + if (ret < 0)
>> + goto out2;
>> + }
>
> As I think I said on the previous version I'm not enthusiastic about
> having two separate code paths for setting the voltage, it makes it much
> more likely that things will break especially given how rare coupled
> regulators are. It would be cleaner to make uncoupled regulators just
> be a special case of coupled regulators, that way more of the code is
> shared. To that end I'd adjust the code so that we always have a
> coupling descriptor and then handle the case where there's only one
> regulator described in there.
>
Do you have any suggestion, how should I implement that path? The thing which
makes it more complicated is locking, because set_voltage_unlocked is done under
one regulator's mutex and its suppliers, while balance procedure locks every
coupled regulator without its suppliers. The suppliers for a single regulator
are locked when setting a single regulator's voltage takes place.
next prev parent reply other threads:[~2017-12-13 9:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20171207094720eucas1p1eb1c8c2d0e222082ce6918807c4ad492@eucas1p1.samsung.com>
2017-12-07 9:46 ` [PATCH v3 0/4] Add coupled regulators mechanism Maciej Purski
[not found] ` <CGME20171207094751eucas1p1c10de599329e2c7ece77c8a5ed939401@eucas1p1.samsung.com>
2017-12-07 9:46 ` [PATCH v3 1/4] regulator: core: Move of_find_regulator_by_node() to of_regulator.c Maciej Purski
2018-01-26 17:35 ` Applied "regulator: core: Move of_find_regulator_by_node() to of_regulator.c" to the regulator tree Mark Brown
[not found] ` <CGME20171207094753eucas1p27b835787f92a1da8c46b9a2692376288@eucas1p2.samsung.com>
2017-12-07 9:46 ` [PATCH v3 3/4] regulator: core: Parse coupled regulators properties Maciej Purski
[not found] ` <1512639975-22241-4-git-send-email-m.purski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-12-12 11:35 ` Mark Brown
2017-12-21 10:08 ` Maciej Purski
[not found] ` <4866dd1c-e9bb-24e4-9b4a-294d01edde78-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-12-21 12:02 ` Mark Brown
[not found] ` <CGME20171207094752eucas1p2ca38d1197d8057cb92b33a81a9942915@eucas1p2.samsung.com>
[not found] ` <1512639975-22241-1-git-send-email-m.purski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-12-07 9:46 ` [PATCH v3 2/4] regulator: bindings: Add properties for coupled regulators Maciej Purski
2017-12-07 23:30 ` Rob Herring
2018-03-02 12:55 ` Applied "regulator: bindings: Add properties for coupled regulators" to the regulator tree Mark Brown
2017-12-07 9:46 ` [PATCH v3 4/4] regulator: core: Balance coupled regulators voltages Maciej Purski
[not found] ` <1512639975-22241-5-git-send-email-m.purski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-12-12 11:54 ` Mark Brown
2017-12-13 9:25 ` Maciej Purski [this message]
2017-12-15 15:19 ` Mark Brown
2017-12-21 13:29 ` Maciej Purski
[not found] ` <d7555270-5be3-a104-233c-ac0e6383f41b-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-12-21 13:34 ` Mark Brown
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=0bca0d20-1ca8-be4c-a60e-bbc0c640ae41@samsung.com \
--to=m.purski@samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.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).