<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/drivers/regulator/core.c, branch v5.19</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>Merge remote-tracking branch 'regulator/for-5.19' into regulator-next</title>
<updated>2022-05-17T15:59:05+00:00</updated>
<author>
<name>Mark Brown</name>
<email>broonie@kernel.org</email>
</author>
<published>2022-05-17T15:59:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=a5b8e4a5ceec0ab6453176bc7f5eceafa78bf8a9'/>
<id>a5b8e4a5ceec0ab6453176bc7f5eceafa78bf8a9</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>regulator: core: Fix enable_count imbalance with EXCLUSIVE_GET</title>
<updated>2022-05-05T14:13:06+00:00</updated>
<author>
<name>Zev Weiss</name>
<email>zev@bewilderbeest.net</email>
</author>
<published>2022-05-05T04:31:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c3e3ca05dae37f8f74bb80358efd540911cbc2c8'/>
<id>c3e3ca05dae37f8f74bb80358efd540911cbc2c8</id>
<content type='text'>
Since the introduction of regulator-&gt;enable_count, a driver that did
an exclusive get on an already-enabled regulator would end up with
enable_count initialized to 0 but rdev-&gt;use_count initialized to 1.
With that starting point the regulator is effectively stuck enabled,
because if the driver attempted to disable it it would fail the
enable_count underflow check in _regulator_handle_consumer_disable().

The EXCLUSIVE_GET path in _regulator_get() now initializes
enable_count along with rdev-&gt;use_count so that the regulator can be
disabled without underflowing the former.

Signed-off-by: Zev Weiss &lt;zev@bewilderbeest.net&gt;
Fixes: 5451781dadf85 ("regulator: core: Only count load for enabled consumers")
Link: https://lore.kernel.org/r/20220505043152.12933-1-zev@bewilderbeest.net
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since the introduction of regulator-&gt;enable_count, a driver that did
an exclusive get on an already-enabled regulator would end up with
enable_count initialized to 0 but rdev-&gt;use_count initialized to 1.
With that starting point the regulator is effectively stuck enabled,
because if the driver attempted to disable it it would fail the
enable_count underflow check in _regulator_handle_consumer_disable().

The EXCLUSIVE_GET path in _regulator_get() now initializes
enable_count along with rdev-&gt;use_count so that the regulator can be
disabled without underflowing the former.

Signed-off-by: Zev Weiss &lt;zev@bewilderbeest.net&gt;
Fixes: 5451781dadf85 ("regulator: core: Only count load for enabled consumers")
Link: https://lore.kernel.org/r/20220505043152.12933-1-zev@bewilderbeest.net
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>regulator: core: Add error flags to sysfs attributes</title>
<updated>2022-05-04T14:31:26+00:00</updated>
<author>
<name>Zev Weiss</name>
<email>zev@bewilderbeest.net</email>
</author>
<published>2022-05-04T06:52:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=0f2d636e7d1fd76f704dd3ea5089ce29a8aee049'/>
<id>0f2d636e7d1fd76f704dd3ea5089ce29a8aee049</id>
<content type='text'>
If a regulator provides a get_error_flags() operation, its sysfs
attributes will now include an entry for each defined
REGULATOR_ERROR_* flag.

Signed-off-by: Zev Weiss &lt;zev@bewilderbeest.net&gt;
Link: https://lore.kernel.org/r/20220504065252.6955-3-zev@bewilderbeest.net
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If a regulator provides a get_error_flags() operation, its sysfs
attributes will now include an entry for each defined
REGULATOR_ERROR_* flag.

Signed-off-by: Zev Weiss &lt;zev@bewilderbeest.net&gt;
Link: https://lore.kernel.org/r/20220504065252.6955-3-zev@bewilderbeest.net
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>regulator: core: Sleep (not delay) in set_voltage()</title>
<updated>2022-04-21T13:18:06+00:00</updated>
<author>
<name>Brian Norris</name>
<email>briannorris@chromium.org</email>
</author>
<published>2022-04-20T21:22:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=062920d2464715ef5cbba52a8573ba12cc882b8f'/>
<id>062920d2464715ef5cbba52a8573ba12cc882b8f</id>
<content type='text'>
These delays can be relatively large (e.g., hundreds of microseconds to
several milliseconds on RK3399 Gru systems). Per
Documentation/timers/timers-howto.rst, that should usually use a
sleeping delay. Let's use the existing regulator delay helper to handle
both large and small delays appropriately. This avoids burning a bunch
of CPU time and hurting scheduling latencies when hitting regulators a
lot (e.g., during cpufreq).

The sleep vs. delay issue choice has been made differently over time --
early versions of RK3399 Gru PWM-regulator support used usleep_range()
in pwm-regulator.c. More of this got moved into the regulator core,
in commits like:

73e705bf81ce regulator: core: Add set_voltage_time op

At the same time, the sleep turned into a delay.

It's OK to sleep in _regulator_do_set_voltage(), as we aren't in an
atomic context. (All our callers grab various mutexes already.)

I avoid using fsleep() because it uses a usleep_range() of [N to N*2],
and usleep_range() very commonly biases to the high end of the range. We
don't want to double the expected delay, especially for long delays.

Signed-off-by: Brian Norris &lt;briannorris@chromium.org&gt;
Reviewed-by: Matthias Kaehlcke &lt;mka@chromium.org&gt;
Link: https://lore.kernel.org/r/20220420141511.v2.2.If0fc61a894f537b052ca41572aff098cf8e7e673@changeid
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These delays can be relatively large (e.g., hundreds of microseconds to
several milliseconds on RK3399 Gru systems). Per
Documentation/timers/timers-howto.rst, that should usually use a
sleeping delay. Let's use the existing regulator delay helper to handle
both large and small delays appropriately. This avoids burning a bunch
of CPU time and hurting scheduling latencies when hitting regulators a
lot (e.g., during cpufreq).

The sleep vs. delay issue choice has been made differently over time --
early versions of RK3399 Gru PWM-regulator support used usleep_range()
in pwm-regulator.c. More of this got moved into the regulator core,
in commits like:

73e705bf81ce regulator: core: Add set_voltage_time op

At the same time, the sleep turned into a delay.

It's OK to sleep in _regulator_do_set_voltage(), as we aren't in an
atomic context. (All our callers grab various mutexes already.)

I avoid using fsleep() because it uses a usleep_range() of [N to N*2],
and usleep_range() very commonly biases to the high end of the range. We
don't want to double the expected delay, especially for long delays.

Signed-off-by: Brian Norris &lt;briannorris@chromium.org&gt;
Reviewed-by: Matthias Kaehlcke &lt;mka@chromium.org&gt;
Link: https://lore.kernel.org/r/20220420141511.v2.2.If0fc61a894f537b052ca41572aff098cf8e7e673@changeid
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>regulator: core: Rename _regulator_enable_delay()</title>
<updated>2022-04-21T13:18:05+00:00</updated>
<author>
<name>Brian Norris</name>
<email>briannorris@chromium.org</email>
</author>
<published>2022-04-20T21:22:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=a38dce4cb1f1bcc4f6ef7f11e54b6507a4043ebe'/>
<id>a38dce4cb1f1bcc4f6ef7f11e54b6507a4043ebe</id>
<content type='text'>
I want to use it in other contexts besides _regulator_do_enable().

Signed-off-by: Brian Norris &lt;briannorris@chromium.org&gt;
Link: https://lore.kernel.org/r/20220420141511.v2.1.I31ef0014c9597d53722ab513890f839f357fdfb3@changeid
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I want to use it in other contexts besides _regulator_do_enable().

Signed-off-by: Brian Norris &lt;briannorris@chromium.org&gt;
Link: https://lore.kernel.org/r/20220420141511.v2.1.I31ef0014c9597d53722ab513890f839f357fdfb3@changeid
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>regulator: Flag uncontrollable regulators as always_on</title>
<updated>2022-04-04T07:51:07+00:00</updated>
<author>
<name>Mark Brown</name>
<email>broonie@kernel.org</email>
</author>
<published>2022-03-25T14:46:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=261f06315cf7c3744731e36bfd8d4434949e3389'/>
<id>261f06315cf7c3744731e36bfd8d4434949e3389</id>
<content type='text'>
While we currently assume that regulators with no control available are
just uncontionally enabled this isn't always as clearly displayed to
users as is desirable, for example the code for disabling unused
regulators will log that it is about to disable them. Clean this up a
bit by setting always_on during constraint evaluation if we have no
available mechanism for controlling the regualtor so things that check
the constraint will do the right thing.

Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Link: https://lore.kernel.org/r/20220325144637.1543496-1-broonie@kernel.org
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While we currently assume that regulators with no control available are
just uncontionally enabled this isn't always as clearly displayed to
users as is desirable, for example the code for disabling unused
regulators will log that it is about to disable them. Clean this up a
bit by setting always_on during constraint evaluation if we have no
available mechanism for controlling the regualtor so things that check
the constraint will do the right thing.

Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Link: https://lore.kernel.org/r/20220325144637.1543496-1-broonie@kernel.org
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>regulator: core: fix false positive in regulator_late_cleanup()</title>
<updated>2022-02-08T13:37:48+00:00</updated>
<author>
<name>Oliver Barta</name>
<email>oliver.barta@aptiv.com</email>
</author>
<published>2022-02-08T08:46:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=4e2a354e3775870ca823f1fb29bbbffbe11059a6'/>
<id>4e2a354e3775870ca823f1fb29bbbffbe11059a6</id>
<content type='text'>
The check done by regulator_late_cleanup() to detect whether a regulator
is on was inconsistent with the check done by _regulator_is_enabled().
While _regulator_is_enabled() takes the enable GPIO into account,
regulator_late_cleanup() was not doing that.

This resulted in a false positive, e.g. when a GPIO-controlled fixed
regulator was used, which was not enabled at boot time, e.g.

reg_disp_1v2: reg_disp_1v2 {
	compatible = "regulator-fixed";
	regulator-name = "display_1v2";
	regulator-min-microvolt = &lt;1200000&gt;;
	regulator-max-microvolt = &lt;1200000&gt;;
	gpio = &lt;&amp;tlmm 148 0&gt;;
	enable-active-high;
};

Such regulator doesn't have an is_enabled() operation. Nevertheless
it's state can be determined based on the enable GPIO. The check in
regulator_late_cleanup() wrongly assumed that the regulator is on and
tried to disable it.

Signed-off-by: Oliver Barta &lt;oliver.barta@aptiv.com&gt;
Link: https://lore.kernel.org/r/20220208084645.8686-1-oliver.barta@aptiv.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The check done by regulator_late_cleanup() to detect whether a regulator
is on was inconsistent with the check done by _regulator_is_enabled().
While _regulator_is_enabled() takes the enable GPIO into account,
regulator_late_cleanup() was not doing that.

This resulted in a false positive, e.g. when a GPIO-controlled fixed
regulator was used, which was not enabled at boot time, e.g.

reg_disp_1v2: reg_disp_1v2 {
	compatible = "regulator-fixed";
	regulator-name = "display_1v2";
	regulator-min-microvolt = &lt;1200000&gt;;
	regulator-max-microvolt = &lt;1200000&gt;;
	gpio = &lt;&amp;tlmm 148 0&gt;;
	enable-active-high;
};

Such regulator doesn't have an is_enabled() operation. Nevertheless
it's state can be determined based on the enable GPIO. The check in
regulator_late_cleanup() wrongly assumed that the regulator is on and
tried to disable it.

Signed-off-by: Oliver Barta &lt;oliver.barta@aptiv.com&gt;
Link: https://lore.kernel.org/r/20220208084645.8686-1-oliver.barta@aptiv.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge tag 'regulator-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator</title>
<updated>2021-11-02T02:04:47+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2021-11-02T02:04:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=1260d242d94ae423c585050bbaabe9064741f419'/>
<id>1260d242d94ae423c585050bbaabe9064741f419</id>
<content type='text'>
Pull regulator updates from Mark Brown:
 "Thanks to the removal of the unused TPS80021 driver the regulator
  updates for this cycle actually have a negative diffstat.

  Otherwise it's been quite a quiet release, lots of fixes and small
  improvements with the biggest individual changes being several
  conversions of DT bindings to YAML format"

* tag 'regulator-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (34 commits)
  regulator: Don't error out fixed regulator in regulator_sync_voltage()
  regulator: tps80031: Remove driver
  regulator: Fix SY7636A breakage
  regulator: uniphier: Add binding for NX1 SoC
  regulator: uniphier: Add USB-VBUS compatible string for NX1 SoC
  regulator: qcom,rpmh: Add compatible for PM6350
  regulator: qcom-rpmh: Add PM6350 regulators
  regulator: sy7636a: Remove requirement on sy7636a mfd
  regulator: tps62360: replacing legacy gpio interface for gpiod
  regulator: lp872x: Remove lp872x_dvs_state
  regulator: lp872x: replacing legacy gpio interface for gpiod
  regulator: dt-bindings: samsung,s5m8767: convert to dtschema
  regulator: dt-bindings: samsung,s2mpa01: convert to dtschema
  regulator: dt-bindings: samsung,s2m: convert to dtschema
  dt-bindings: clock: samsung,s2mps11: convert to dtschema
  regulator: dt-bindings: samsung,s5m8767: correct s5m8767,pmic-buck-default-dvs-idx property
  regulator: s5m8767: do not use reset value as DVS voltage if GPIO DVS is disabled
  regulator: dt-bindings: maxim,max8973: convert to dtschema
  regulator: dt-bindings: maxim,max8997: convert to dtschema
  regulator: dt-bindings: maxim,max8952: convert to dtschema
  ...
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull regulator updates from Mark Brown:
 "Thanks to the removal of the unused TPS80021 driver the regulator
  updates for this cycle actually have a negative diffstat.

  Otherwise it's been quite a quiet release, lots of fixes and small
  improvements with the biggest individual changes being several
  conversions of DT bindings to YAML format"

* tag 'regulator-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (34 commits)
  regulator: Don't error out fixed regulator in regulator_sync_voltage()
  regulator: tps80031: Remove driver
  regulator: Fix SY7636A breakage
  regulator: uniphier: Add binding for NX1 SoC
  regulator: uniphier: Add USB-VBUS compatible string for NX1 SoC
  regulator: qcom,rpmh: Add compatible for PM6350
  regulator: qcom-rpmh: Add PM6350 regulators
  regulator: sy7636a: Remove requirement on sy7636a mfd
  regulator: tps62360: replacing legacy gpio interface for gpiod
  regulator: lp872x: Remove lp872x_dvs_state
  regulator: lp872x: replacing legacy gpio interface for gpiod
  regulator: dt-bindings: samsung,s5m8767: convert to dtschema
  regulator: dt-bindings: samsung,s2mpa01: convert to dtschema
  regulator: dt-bindings: samsung,s2m: convert to dtschema
  dt-bindings: clock: samsung,s2mps11: convert to dtschema
  regulator: dt-bindings: samsung,s5m8767: correct s5m8767,pmic-buck-default-dvs-idx property
  regulator: s5m8767: do not use reset value as DVS voltage if GPIO DVS is disabled
  regulator: dt-bindings: maxim,max8973: convert to dtschema
  regulator: dt-bindings: maxim,max8997: convert to dtschema
  regulator: dt-bindings: maxim,max8952: convert to dtschema
  ...
</pre>
</div>
</content>
</entry>
<entry>
<title>regulator: Don't error out fixed regulator in regulator_sync_voltage()</title>
<updated>2021-10-23T13:21:11+00:00</updated>
<author>
<name>Dmitry Osipenko</name>
<email>digetx@gmail.com</email>
</author>
<published>2021-10-21T18:33:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=400d5a5da43c0e84e5aa75151082ea91f0fae3c9'/>
<id>400d5a5da43c0e84e5aa75151082ea91f0fae3c9</id>
<content type='text'>
Fixed regulator can't change voltage and regulator_sync_voltage()
returns -EINVAL in this case. Make regulator_sync_voltage() to succeed
for regulators that are incapable to change voltage.

On NVIDIA Tegra power management driver needs to sync voltage and we have
one device (Trimslice) that uses fixed regulator which is getting synced.
The syncing error isn't treated as fatal, but produces a noisy error
message. This patch silences that error.

Signed-off-by: Dmitry Osipenko &lt;digetx@gmail.com&gt;
Link: https://lore.kernel.org/r/20211021183308.27786-1-digetx@gmail.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixed regulator can't change voltage and regulator_sync_voltage()
returns -EINVAL in this case. Make regulator_sync_voltage() to succeed
for regulators that are incapable to change voltage.

On NVIDIA Tegra power management driver needs to sync voltage and we have
one device (Trimslice) that uses fixed regulator which is getting synced.
The syncing error isn't treated as fatal, but produces a noisy error
message. This patch silences that error.

Signed-off-by: Dmitry Osipenko &lt;digetx@gmail.com&gt;
Link: https://lore.kernel.org/r/20211021183308.27786-1-digetx@gmail.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>regulator: Lower priority of logging when setting supply</title>
<updated>2021-09-30T12:26:07+00:00</updated>
<author>
<name>Mark Brown</name>
<email>broonie@kernel.org</email>
</author>
<published>2021-09-29T14:07:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=35d114699b90c8b2c568c48f78adeb913d81bcc1'/>
<id>35d114699b90c8b2c568c48f78adeb913d81bcc1</id>
<content type='text'>
We lowered all the other constraint related log messages to debug level so
lower the logging of what supplies we're configuring to debug level too.

Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Link: https://lore.kernel.org/r/20210929140717.3769-1-broonie@kernel.org
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We lowered all the other constraint related log messages to debug level so
lower the logging of what supplies we're configuring to debug level too.

Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Link: https://lore.kernel.org/r/20210929140717.3769-1-broonie@kernel.org
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
