<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/opp/core.c, branch linux-5.10.y</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>OPP: Fix passing 0 to PTR_ERR in _opp_attach_genpd()</title>
<updated>2023-09-19T10:20:07+00:00</updated>
<author>
<name>Manivannan Sadhasivam</name>
<email>manivannan.sadhasivam@linaro.org</email>
</author>
<published>2023-07-21T12:46:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=3ee719b3a026495892d0dd1e8e20e155f52a5fcb'/>
<id>3ee719b3a026495892d0dd1e8e20e155f52a5fcb</id>
<content type='text'>
[ Upstream commit d920920f85a82c1c806a4143871a0e8f534732f2 ]

If dev_pm_domain_attach_by_name() returns NULL, then 0 will be passed to
PTR_ERR() as reported by the smatch warning below:

drivers/opp/core.c:2456 _opp_attach_genpd() warn: passing zero to 'PTR_ERR'

Fix it by checking for the non-NULL virt_dev pointer before passing it to
PTR_ERR. Otherwise return -ENODEV.

Fixes: 4ea9496cbc95 ("opp: Fix error check in dev_pm_opp_attach_genpd()")
Signed-off-by: Manivannan Sadhasivam &lt;manivannan.sadhasivam@linaro.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit d920920f85a82c1c806a4143871a0e8f534732f2 ]

If dev_pm_domain_attach_by_name() returns NULL, then 0 will be passed to
PTR_ERR() as reported by the smatch warning below:

drivers/opp/core.c:2456 _opp_attach_genpd() warn: passing zero to 'PTR_ERR'

Fix it by checking for the non-NULL virt_dev pointer before passing it to
PTR_ERR. Otherwise return -ENODEV.

Fixes: 4ea9496cbc95 ("opp: Fix error check in dev_pm_opp_attach_genpd()")
Signed-off-by: Manivannan Sadhasivam &lt;manivannan.sadhasivam@linaro.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>opp: Fix error check in dev_pm_opp_attach_genpd()</title>
<updated>2022-08-21T13:16:04+00:00</updated>
<author>
<name>Tang Bin</name>
<email>tangbin@cmss.chinamobile.com</email>
</author>
<published>2022-05-24T12:31:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=e2a4e46f52584e43cd0d9866752b51f588cc1173'/>
<id>e2a4e46f52584e43cd0d9866752b51f588cc1173</id>
<content type='text'>
[ Upstream commit 4ea9496cbc959eb5c78f3e379199aca9ef4e386b ]

dev_pm_domain_attach_by_name() may return NULL in some cases,
so IS_ERR() doesn't meet the requirements. Thus fix it.

Fixes: 6319aee10e53 ("opp: Attach genpds to devices from within OPP core")
Signed-off-by: Tang Bin &lt;tangbin@cmss.chinamobile.com&gt;
[ Viresh: Replace ENODATA with ENODEV ]
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 4ea9496cbc959eb5c78f3e379199aca9ef4e386b ]

dev_pm_domain_attach_by_name() may return NULL in some cases,
so IS_ERR() doesn't meet the requirements. Thus fix it.

Fixes: 6319aee10e53 ("opp: Attach genpds to devices from within OPP core")
Signed-off-by: Tang Bin &lt;tangbin@cmss.chinamobile.com&gt;
[ Viresh: Replace ENODATA with ENODEV ]
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>opp: Call the missing clk_put() on error</title>
<updated>2021-01-06T13:56:49+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2020-12-28T05:21:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=1a58c171a523d2224fe12fb26fc459231f245b0d'/>
<id>1a58c171a523d2224fe12fb26fc459231f245b0d</id>
<content type='text'>
commit 0e1d9ca1766f5d95fb881f57b6c4a1ffa63d4648 upstream.

Fix the clock reference counting by calling the missing clk_put() in the
error path.

Cc: v5.10 &lt;stable@vger.kernel.org&gt; # v5.10
Fixes: dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER")
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 0e1d9ca1766f5d95fb881f57b6c4a1ffa63d4648 upstream.

Fix the clock reference counting by calling the missing clk_put() in the
error path.

Cc: v5.10 &lt;stable@vger.kernel.org&gt; # v5.10
Fixes: dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER")
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>opp: fix memory leak in _allocate_opp_table</title>
<updated>2021-01-06T13:56:49+00:00</updated>
<author>
<name>Quanyang Wang</name>
<email>quanyang.wang@windriver.com</email>
</author>
<published>2020-12-24T10:49:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=e8322837a2e56d6b8d4b87d81292805948991e2c'/>
<id>e8322837a2e56d6b8d4b87d81292805948991e2c</id>
<content type='text'>
commit 976509bb310b913d30577f15b58bdd30effb0542 upstream.

In function _allocate_opp_table, opp_dev is allocated and referenced
by opp_table via _add_opp_dev. But in the case that the subsequent calls
return -EPROBE_DEFER, it will jump to err label and opp_table will be
freed. Then opp_dev becomes an unreferenced object to cause memory leak.
So let's call _remove_opp_dev to do the cleanup.

This fixes the following kmemleak report:

unreferenced object 0xffff000801524a00 (size 128):
  comm "swapper/0", pid 1, jiffies 4294892465 (age 84.616s)
  hex dump (first 32 bytes):
    40 00 56 01 08 00 ff ff 40 00 56 01 08 00 ff ff  @.V.....@.V.....
    b8 52 77 7f 08 00 ff ff 00 3c 4c 00 08 00 ff ff  .Rw......&lt;L.....
  backtrace:
    [&lt;00000000b1289fb1&gt;] kmemleak_alloc+0x30/0x40
    [&lt;0000000056da48f0&gt;] kmem_cache_alloc+0x3d4/0x588
    [&lt;00000000a84b3b0e&gt;] _add_opp_dev+0x2c/0x88
    [&lt;0000000062a380cd&gt;] _add_opp_table_indexed+0x124/0x268
    [&lt;000000008b4c8f1f&gt;] dev_pm_opp_of_add_table+0x20/0x1d8
    [&lt;00000000e5316798&gt;] dev_pm_opp_of_cpumask_add_table+0x48/0xf0
    [&lt;00000000db0a8ec2&gt;] dt_cpufreq_probe+0x20c/0x448
    [&lt;0000000030a3a26c&gt;] platform_probe+0x68/0xd8
    [&lt;00000000c618e78d&gt;] really_probe+0xd0/0x3a0
    [&lt;00000000642e856f&gt;] driver_probe_device+0x58/0xb8
    [&lt;00000000f10f5307&gt;] device_driver_attach+0x74/0x80
    [&lt;0000000004f254b8&gt;] __driver_attach+0x58/0xe0
    [&lt;0000000009d5d19e&gt;] bus_for_each_dev+0x70/0xc8
    [&lt;0000000000d22e1c&gt;] driver_attach+0x24/0x30
    [&lt;0000000001d4e952&gt;] bus_add_driver+0x14c/0x1f0
    [&lt;0000000089928aaa&gt;] driver_register+0x64/0x120

Cc: v5.10 &lt;stable@vger.kernel.org&gt; # v5.10
Fixes: dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER")
Signed-off-by: Quanyang Wang &lt;quanyang.wang@windriver.com&gt;
[ Viresh: Added the stable tag ]
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 976509bb310b913d30577f15b58bdd30effb0542 upstream.

In function _allocate_opp_table, opp_dev is allocated and referenced
by opp_table via _add_opp_dev. But in the case that the subsequent calls
return -EPROBE_DEFER, it will jump to err label and opp_table will be
freed. Then opp_dev becomes an unreferenced object to cause memory leak.
So let's call _remove_opp_dev to do the cleanup.

This fixes the following kmemleak report:

unreferenced object 0xffff000801524a00 (size 128):
  comm "swapper/0", pid 1, jiffies 4294892465 (age 84.616s)
  hex dump (first 32 bytes):
    40 00 56 01 08 00 ff ff 40 00 56 01 08 00 ff ff  @.V.....@.V.....
    b8 52 77 7f 08 00 ff ff 00 3c 4c 00 08 00 ff ff  .Rw......&lt;L.....
  backtrace:
    [&lt;00000000b1289fb1&gt;] kmemleak_alloc+0x30/0x40
    [&lt;0000000056da48f0&gt;] kmem_cache_alloc+0x3d4/0x588
    [&lt;00000000a84b3b0e&gt;] _add_opp_dev+0x2c/0x88
    [&lt;0000000062a380cd&gt;] _add_opp_table_indexed+0x124/0x268
    [&lt;000000008b4c8f1f&gt;] dev_pm_opp_of_add_table+0x20/0x1d8
    [&lt;00000000e5316798&gt;] dev_pm_opp_of_cpumask_add_table+0x48/0xf0
    [&lt;00000000db0a8ec2&gt;] dt_cpufreq_probe+0x20c/0x448
    [&lt;0000000030a3a26c&gt;] platform_probe+0x68/0xd8
    [&lt;00000000c618e78d&gt;] really_probe+0xd0/0x3a0
    [&lt;00000000642e856f&gt;] driver_probe_device+0x58/0xb8
    [&lt;00000000f10f5307&gt;] device_driver_attach+0x74/0x80
    [&lt;0000000004f254b8&gt;] __driver_attach+0x58/0xe0
    [&lt;0000000009d5d19e&gt;] bus_for_each_dev+0x70/0xc8
    [&lt;0000000000d22e1c&gt;] driver_attach+0x24/0x30
    [&lt;0000000001d4e952&gt;] bus_add_driver+0x14c/0x1f0
    [&lt;0000000089928aaa&gt;] driver_register+0x64/0x120

Cc: v5.10 &lt;stable@vger.kernel.org&gt; # v5.10
Fixes: dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER")
Signed-off-by: Quanyang Wang &lt;quanyang.wang@windriver.com&gt;
[ Viresh: Added the stable tag ]
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>opp: Reduce the size of critical section in _opp_table_kref_release()</title>
<updated>2020-10-27T07:51:03+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2020-10-22T06:56:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=e0df59de670b48a923246fae1f972317b84b2764'/>
<id>e0df59de670b48a923246fae1f972317b84b2764</id>
<content type='text'>
There is a lot of stuff here which can be done outside of the big
opp_table_lock, do that. This helps avoiding few circular dependency
lockdeps around debugfs and interconnects.

Reported-by: Rob Clark &lt;robdclark@gmail.com&gt;
Reported-by: Dmitry Osipenko &lt;digetx@gmail.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There is a lot of stuff here which can be done outside of the big
opp_table_lock, do that. This helps avoiding few circular dependency
lockdeps around debugfs and interconnects.

Reported-by: Rob Clark &lt;robdclark@gmail.com&gt;
Reported-by: Dmitry Osipenko &lt;digetx@gmail.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>opp: Fix early exit from dev_pm_opp_register_set_opp_helper()</title>
<updated>2020-10-27T05:08:28+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2020-10-20T10:33:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=47efcbcb340cca5d3b3d515964f09e1fec599a29'/>
<id>47efcbcb340cca5d3b3d515964f09e1fec599a29</id>
<content type='text'>
We returned earlier by mistake even when there were no failures. Fix it.

Fixes: dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER")
Reported-by: Naresh Kamboju &lt;naresh.kamboju@linaro.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Tested-by: Naresh Kamboju &lt;naresh.kamboju@linaro.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We returned earlier by mistake even when there were no failures. Fix it.

Fixes: dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER")
Reported-by: Naresh Kamboju &lt;naresh.kamboju@linaro.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Tested-by: Naresh Kamboju &lt;naresh.kamboju@linaro.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'opp/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm</title>
<updated>2020-10-05T11:31:32+00:00</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2020-10-05T11:31:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=757e282188f0138a06ebf925c950995feb7bd666'/>
<id>757e282188f0138a06ebf925c950995feb7bd666</id>
<content type='text'>
Pull opertaing performance points (OPP) framework fixes for 5.10-rc1
from Viresh Kumar:

"- Return -EPROBE_DEFER properly from dev_pm_opp_get_opp_table()
   (Stephan Gerhold).

 - Minor cleanups around required-opps (Stephan Gerhold).

 - Extends opp-supported-hw property to contain multiple versions
   (Viresh Kumar).

 - Multiple cleanups around dev_pm_opp_attach_genpd() (Viresh Kumar).

 - Multiple fixes, cleanups in the OPP core for overall better design
   (Viresh Kumar)."

* 'opp/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm:
  opp: Allow opp-level to be set to 0
  opp: Prevent memory leak in dev_pm_opp_attach_genpd()
  ARM: tegra: Pass multiple versions in opp-supported-hw property
  opp: Allow opp-supported-hw to contain multiple versions
  dt-bindings: opp: Allow opp-supported-hw to contain multiple versions
  opp: Set required OPPs in reverse order when scaling down
  opp: Reduce code duplication in _set_required_opps()
  opp: Drop unnecessary check from dev_pm_opp_attach_genpd()
  opp: Handle multiple calls for same OPP table in _of_add_opp_table_v1()
  opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER
  opp: Remove _dev_pm_opp_find_and_remove_table() wrapper
  opp: Split out _opp_set_rate_zero()
  opp: Reuse the enabled flag in !target_freq path
  opp: Rename regulator_enabled and use it as status of all resources
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull opertaing performance points (OPP) framework fixes for 5.10-rc1
from Viresh Kumar:

"- Return -EPROBE_DEFER properly from dev_pm_opp_get_opp_table()
   (Stephan Gerhold).

 - Minor cleanups around required-opps (Stephan Gerhold).

 - Extends opp-supported-hw property to contain multiple versions
   (Viresh Kumar).

 - Multiple cleanups around dev_pm_opp_attach_genpd() (Viresh Kumar).

 - Multiple fixes, cleanups in the OPP core for overall better design
   (Viresh Kumar)."

* 'opp/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm:
  opp: Allow opp-level to be set to 0
  opp: Prevent memory leak in dev_pm_opp_attach_genpd()
  ARM: tegra: Pass multiple versions in opp-supported-hw property
  opp: Allow opp-supported-hw to contain multiple versions
  dt-bindings: opp: Allow opp-supported-hw to contain multiple versions
  opp: Set required OPPs in reverse order when scaling down
  opp: Reduce code duplication in _set_required_opps()
  opp: Drop unnecessary check from dev_pm_opp_attach_genpd()
  opp: Handle multiple calls for same OPP table in _of_add_opp_table_v1()
  opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER
  opp: Remove _dev_pm_opp_find_and_remove_table() wrapper
  opp: Split out _opp_set_rate_zero()
  opp: Reuse the enabled flag in !target_freq path
  opp: Rename regulator_enabled and use it as status of all resources
</pre>
</div>
</content>
</entry>
<entry>
<title>opp: Allow opp-level to be set to 0</title>
<updated>2020-09-16T08:32:34+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2020-09-11T09:26:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=a5663c9b1e31c00e0bdfaf4d92eb51358fc3950f'/>
<id>a5663c9b1e31c00e0bdfaf4d92eb51358fc3950f</id>
<content type='text'>
The DT bindings don't put such a constraint, nor should the kernel. It
is perfectly fine for opp-level to be set to 0, if we need to put the
performance state votes for a domain for a particular OPP.

Reported-by: Stephan Gerhold &lt;stephan@gerhold.net&gt;
Tested-by: Stephan Gerhold &lt;stephan@gerhold.net&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The DT bindings don't put such a constraint, nor should the kernel. It
is perfectly fine for opp-level to be set to 0, if we need to put the
performance state votes for a domain for a particular OPP.

Reported-by: Stephan Gerhold &lt;stephan@gerhold.net&gt;
Tested-by: Stephan Gerhold &lt;stephan@gerhold.net&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>opp: Prevent memory leak in dev_pm_opp_attach_genpd()</title>
<updated>2020-09-16T08:32:33+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2020-08-31T05:52:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=cb60e9602cce1593eb1e9cdc8ee562815078a354'/>
<id>cb60e9602cce1593eb1e9cdc8ee562815078a354</id>
<content type='text'>
If dev_pm_opp_attach_genpd() is called multiple times (once for each CPU
sharing the table), then it would result in unwanted behavior like
memory leak, attaching the domain multiple times, etc.

Handle that by checking and returning earlier if the domains are already
attached. Now that dev_pm_opp_detach_genpd() can get called multiple
times as well, we need to protect that too.

Note that the virtual device pointers aren't returned in this case, as
they may become unavailable to some callers during the middle of the
operation.

Reported-by: Stephan Gerhold &lt;stephan@gerhold.net&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If dev_pm_opp_attach_genpd() is called multiple times (once for each CPU
sharing the table), then it would result in unwanted behavior like
memory leak, attaching the domain multiple times, etc.

Handle that by checking and returning earlier if the domains are already
attached. Now that dev_pm_opp_detach_genpd() can get called multiple
times as well, we need to protect that too.

Note that the virtual device pointers aren't returned in this case, as
they may become unavailable to some callers during the middle of the
operation.

Reported-by: Stephan Gerhold &lt;stephan@gerhold.net&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>opp: Set required OPPs in reverse order when scaling down</title>
<updated>2020-09-16T08:32:33+00:00</updated>
<author>
<name>Stephan Gerhold</name>
<email>stephan@gerhold.net</email>
</author>
<published>2020-07-30T08:01:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=2c59138c22f17c1da027d3c90dbcdd6995c77414'/>
<id>2c59138c22f17c1da027d3c90dbcdd6995c77414</id>
<content type='text'>
The OPP core already has well-defined semantics to ensure required
OPPs/regulators are set before/after the frequency change, depending
on if we scale up or down.

Similar requirements might exist for the order of required OPPs
when multiple power domains need to be scaled for a frequency change.

For example, on Qualcomm platforms using CPR (Core Power Reduction),
we need to scale the VDDMX and CPR power domain. When scaling up,
MX should be scaled up before CPR. When scaling down, CPR should be
scaled down before MX.

In general, if there are multiple "required-opps" in the device tree
I would expect that the order is either irrelevant, or there is some
dependency between the power domains. In that case, the power domains
should be scaled down in reverse order.

This commit updates _set_required_opps() to set required OPPs in
reverse order when scaling down.

Signed-off-by: Stephan Gerhold &lt;stephan@gerhold.net&gt;
[ Viresh: Fix rebase conflict and minor rearrangement of the code ]
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The OPP core already has well-defined semantics to ensure required
OPPs/regulators are set before/after the frequency change, depending
on if we scale up or down.

Similar requirements might exist for the order of required OPPs
when multiple power domains need to be scaled for a frequency change.

For example, on Qualcomm platforms using CPR (Core Power Reduction),
we need to scale the VDDMX and CPR power domain. When scaling up,
MX should be scaled up before CPR. When scaling down, CPR should be
scaled down before MX.

In general, if there are multiple "required-opps" in the device tree
I would expect that the order is either irrelevant, or there is some
dependency between the power domains. In that case, the power domains
should be scaled down in reverse order.

This commit updates _set_required_opps() to set required OPPs in
reverse order when scaling down.

Signed-off-by: Stephan Gerhold &lt;stephan@gerhold.net&gt;
[ Viresh: Fix rebase conflict and minor rearrangement of the code ]
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
