<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/base/power/opp, branch v4.14.85</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.14.85</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.14.85'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2018-07-03T09:24:47+00:00</updated>
<entry>
<title>PM / OPP: Update voltage in case freq == old_freq</title>
<updated>2018-07-03T09:24:47+00:00</updated>
<author>
<name>Waldemar Rymarkiewicz</name>
<email>waldemar.rymarkiewicz@gmail.com</email>
</author>
<published>2018-06-14T13:56:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8b03376580c9c2b4d239bc43527bb9a35dc2078e'/>
<id>urn:sha1:8b03376580c9c2b4d239bc43527bb9a35dc2078e</id>
<content type='text'>
commit c5c2a97b3ac7d1ec19e7cff9e38caca6afefc3de upstream.

This commit fixes a rare but possible case when the clk rate is updated
without update of the regulator voltage.

At boot up, CPUfreq checks if the system is running at the right freq. This
is a sanity check in case a bootloader set clk rate that is outside of freq
table present with cpufreq core. In such cases system can be unstable so
better to change it to a freq that is preset in freq-table.

The CPUfreq takes next freq that is &gt;= policy-&gt;cur and this is our
target_freq that needs to be set now.

dev_pm_opp_set_rate(dev, target_freq) checks the target_freq and the
old_freq (a current rate). If these are equal it returns early. If not,
it searches for OPP (old_opp) that fits best to old_freq (not listed in
the table) and updates old_freq (!).

Here, we can end up with old_freq = old_opp.rate = target_freq, which
is not handled in _generic_set_opp_regulator(). It's supposed to update
voltage only when freq &gt; old_freq  || freq &gt; old_freq.

if (freq &gt; old_freq) {
		ret = _set_opp_voltage(dev, reg, new_supply);
[...]
if (freq &lt; old_freq) {
		ret = _set_opp_voltage(dev, reg, new_supply);
		if (ret)

It results in, no voltage update while clk rate is updated.

Example:
freq-table = {
	1000MHz   1.15V
	 666MHZ   1.10V
	 333MHz   1.05V
}
boot-up-freq        = 800MHz   # not listed in freq-table
freq = target_freq  = 1GHz
old_freq            = 800Mhz
old_opp = _find_freq_ceil(opp_table, &amp;old_freq);  #(old_freq is modified!)
old_freq            = 1GHz

Fixes: 6a0712f6f199 ("PM / OPP: Add dev_pm_opp_set_rate()")
Cc: 4.6+ &lt;stable@vger.kernel.org&gt; # v4.6+
Signed-off-by: Waldemar Rymarkiewicz &lt;waldemar.rymarkiewicz@gmail.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>PM / OPP: Move error message to debug level</title>
<updated>2017-12-25T13:26:26+00:00</updated>
<author>
<name>Fabio Estevam</name>
<email>fabio.estevam@nxp.com</email>
</author>
<published>2017-09-29T17:39:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=349384cd7028affdb23634b56d10da015b080cba'/>
<id>urn:sha1:349384cd7028affdb23634b56d10da015b080cba</id>
<content type='text'>
[ Upstream commit 035ed07208dc501d023873447113f3f178592156 ]

On some i.MX6 platforms which do not have speed grading
check, opp table will not be created in platform code,
so cpufreq driver prints the following error message:

cpu cpu0: dev_pm_opp_get_opp_count: OPP table not found (-19)

However, this is not really an error in this case because the
imx6q-cpufreq driver first calls dev_pm_opp_get_opp_count()
and if it fails, it means that platform code does not provide
OPP and then dev_pm_opp_of_add_table() will be called.

In order to avoid such confusing error message, move it to
debug level.

It is up to the caller of dev_pm_opp_get_opp_count() to check its
return value and decide if it will print an error or not.

Signed-off-by: Fabio Estevam &lt;fabio.estevam@nxp.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>PM / OPP: Add missing of_node_put(np)</title>
<updated>2017-11-30T08:40:41+00:00</updated>
<author>
<name>Tobias Jordan</name>
<email>Tobias.Jordan@elektrobit.com</email>
</author>
<published>2017-10-04T06:05:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7b4c6a3b394f86f6b78a688c092d8dcea976a59c'/>
<id>urn:sha1:7b4c6a3b394f86f6b78a688c092d8dcea976a59c</id>
<content type='text'>
commit 7978db344719dab1e56d05e6fc04aaaddcde0a5e upstream.

The for_each_available_child_of_node() loop in _of_add_opp_table_v2()
doesn't drop the reference to "np" on errors. Fix that.

Fixes: 274659029c9d (PM / OPP: Add support to parse "operating-points-v2" bindings)
Signed-off-by: Tobias Jordan &lt;Tobias.Jordan@elektrobit.com&gt;
[ VK: Improved commit log. ]
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Reviewed-by: Stephen Boyd &lt;sboyd@codeaurora.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>PM / OPP: Call notifier without holding opp_table-&gt;lock</title>
<updated>2017-09-25T22:44:32+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2017-09-21T17:44:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e4d8ae00169f7686e1da5a62e5cf797d12bf8822'/>
<id>urn:sha1:e4d8ae00169f7686e1da5a62e5cf797d12bf8822</id>
<content type='text'>
The notifier callbacks may want to call some OPP helper routines which
may try to take the same opp_table-&gt;lock again and cause a deadlock. One
such usecase was reported by Chanwoo Choi, where calling
dev_pm_opp_disable() leads us to the devfreq's OPP notifier handler,
which further calls dev_pm_opp_find_freq_floor() and it deadlocks.

We don't really need the opp_table-&gt;lock to be held across the notifier
call though, all we want to make sure is that the 'opp' doesn't get
freed while being used from within the notifier chain. We can do it with
help of dev_pm_opp_get/put() as well. Let's do it.

Cc: 4.11+ &lt;stable@vger.kernel.org&gt; # 4.11+
Fixes: 5b650b388844 "PM / OPP: Take kref from _find_opp_table()"
Reported-by: Chanwoo Choi &lt;cw00.choi@samsung.com&gt;
Tested-by: Chanwoo Choi &lt;cw00.choi@samsung.com&gt;
Reviewed-by: Stephen Boyd &lt;sboyd@codeaurora.org&gt;
Reviewed-by: Chanwoo Choi &lt;cw00.choi@samsung.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM / OPP: Fix get sharing CPUs when hotplug is used</title>
<updated>2017-08-01T12:10:55+00:00</updated>
<author>
<name>Waldemar Rymarkiewicz</name>
<email>waldemarx.rymarkiewicz@intel.com</email>
</author>
<published>2017-07-27T10:01:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=762792913f8c71fb4807b25540347e4ace1b5b95'/>
<id>urn:sha1:762792913f8c71fb4807b25540347e4ace1b5b95</id>
<content type='text'>
We fail dev_pm_opp_of_get_sharing_cpus() when possible CPU device does
not exist. This can happen on platforms where not all possible CPUs
are available at start up ie. hotplugged out.  The CPU device is not
registered in the system so we are not able to check struct device to
set the sharing CPUs bitmask properly.

Example (real use case):
2 physical MIPS cores, 4 VPE, cpu0/2 run Linux and cpu1/3 are not
available for Linux at boot up. cpufreq-dt driver + OPP v2 fail to
register opp_table due to the fact there is no struct device for
cpu1 (remains offline at
bootup).

To solve the bug, stop using device struct to check device_node.
Instead get CPU device_node directly from device tree with
of_get_cpu_node().

Signed-off-by: Waldemar Rymarkiewicz &lt;waldemarx.rymarkiewicz@intel.com&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Reviewed-by: Stephen Boyd &lt;sboyd@codeaurora.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM / OPP: OF: Use pr_debug() instead of pr_err() while adding OPP table</title>
<updated>2017-07-16T00:24:33+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2017-07-12T03:51:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5b60697cd89cf5a438b2984e11859228e5ec1c6b'/>
<id>urn:sha1:5b60697cd89cf5a438b2984e11859228e5ec1c6b</id>
<content type='text'>
Some platforms add the OPPs dynamically from platform specific drivers
instead of getting them statically from DT. The cpufreq-dt driver
already ignores the return value of dev_pm_opp_of_cpumask_add_table() to
not error out for such cases, but we still end up printing error message
from that routine. That's not nice.

Convert the print message to use pr_debug() instead.

Reported-by: Mason &lt;slash.tmp@free.fr&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Reviewed-by: Stephen Boyd &lt;sboyd@codeaurora.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM / OPP: Add dev_pm_opp_{set|put}_clkname()</title>
<updated>2017-06-23T23:41:55+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2017-06-21T04:59:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=829a4e8c0e9aab17bcfe2ddb070388b8ada26292'/>
<id>urn:sha1:829a4e8c0e9aab17bcfe2ddb070388b8ada26292</id>
<content type='text'>
In order to support OPP switching, OPP layer needs to get pointer to the
clock for the device. Simple cases work fine without using the routines
added by this patch (i.e.  by passing connection-id as NULL), but for a
device with multiple clocks available, the OPP core needs to know the
exact name of the clk to use.

Add a new set of APIs to get that done.

Tested-by: Rajendra Nayak &lt;rnayak@codeaurora.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Reviewed-by: Stephen Boyd &lt;sboyd@codeaurora.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM / OPP: Don't create debugfs "supply-0" directory unnecessarily</title>
<updated>2017-06-22T01:15:30+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2017-05-23T04:02:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1fae788ed640e2a961c2edab54bfd56c73e2506a'/>
<id>urn:sha1:1fae788ed640e2a961c2edab54bfd56c73e2506a</id>
<content type='text'>
We create "supply-0" debugfs directory even if the device doesn't do
voltage scaling. That looks confusing, as if the regulator is found but
we never managed to get voltage levels for it.

Avoid creating such a directory unnecessarily.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Reviewed-by: Stephen Boyd &lt;sboyd@codeaurora.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM / OPP: opp-microvolt is not optional if regulators are set</title>
<updated>2017-06-22T01:15:30+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2017-05-23T04:02:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=688a48b0d27000167e0450bc1243e29a560395ca'/>
<id>urn:sha1:688a48b0d27000167e0450bc1243e29a560395ca</id>
<content type='text'>
If dev_pm_opp_set_regulators() is called for a device and its regulators
are set in the OPP core, the OPP nodes for the device must contain the
"opp-microvolt" property, otherwise there is something wrong and we
better error out.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Reviewed-by: Stephen Boyd &lt;sboyd@codeaurora.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>PM / OPP: Don't create copy of regulators unnecessarily</title>
<updated>2017-06-22T01:15:30+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2017-05-23T04:02:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=478256bddb0323898694bd22acdf42a70d4ff024'/>
<id>urn:sha1:478256bddb0323898694bd22acdf42a70d4ff024</id>
<content type='text'>
This code was required while the OPP core was managed with help of RCUs,
but not anymore. Get rid of unnecessary alloc/memcpy operations.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Reviewed-by: Stephen Boyd &lt;sboyd@codeaurora.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
</feed>
