<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/opp, branch v4.20</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.20</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.20'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2018-11-23T05:17:21Z</updated>
<entry>
<title>OPP: Fix parsing of multiple phandles in "operating-points-v2" property</title>
<updated>2018-11-23T05:17:21Z</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2018-11-23T05:06:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3e27c79c4b121a64e85f26ab8957e5d0a09ff28e'/>
<id>urn:sha1:3e27c79c4b121a64e85f26ab8957e5d0a09ff28e</id>
<content type='text'>
We currently return error if more than one phandle is present in the
"operating-points-v2" property, which is incorrect. We only want to
check the count of phandles here and set index to 0 if only one phandle
is present.

Fix it.

Fixes: 5ed4cecd75e9 ("OPP: Pass OPP table to _of_add_opp_table_v{1|2}()")
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>opp: ti-opp-supply: Fix platform_no_drv_owner.cocci warnings</title>
<updated>2018-11-22T06:16:02Z</updated>
<author>
<name>YueHaibing</name>
<email>yuehaibing@huawei.com</email>
</author>
<published>2018-11-22T03:41:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bf21c6e455539a495ce6d2877da2f9e364a89062'/>
<id>urn:sha1:bf21c6e455539a495ce6d2877da2f9e364a89062</id>
<content type='text'>
Remove .owner field if calls are used which set it automatically
Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

Signed-off-by: YueHaibing &lt;yuehaibing@huawei.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>opp: ti-opp-supply: Correct the supply in _get_optimal_vdd_voltage call</title>
<updated>2018-11-13T04:10:29Z</updated>
<author>
<name>Keerthy</name>
<email>j-keerthy@ti.com</email>
</author>
<published>2018-11-07T04:34:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=622fecbccfe86a8052dea6b512d3821dcce29994'/>
<id>urn:sha1:622fecbccfe86a8052dea6b512d3821dcce29994</id>
<content type='text'>
_get_optimal_vdd_voltage call provides new_supply_vbb-&gt;u_volt
as the reference voltage while it should be really new_supply_vdd-&gt;u_volt.

Cc: 4.16+ &lt;stable@vger.kernel.org&gt; # v4.16+
Fixes: 9a835fa6e47 ("PM / OPP: Add ti-opp-supply driver")
Signed-off-by: Keerthy &lt;j-keerthy@ti.com&gt;
Acked-by: Dave Gerlach &lt;d-gerlach@ti.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>opp: ti-opp-supply: Dynamically update u_volt_min</title>
<updated>2018-11-13T04:09:54Z</updated>
<author>
<name>Keerthy</name>
<email>j-keerthy@ti.com</email>
</author>
<published>2018-11-07T04:34:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ba038546ff9e15d54d1134b5c5d2355648c00dec'/>
<id>urn:sha1:ba038546ff9e15d54d1134b5c5d2355648c00dec</id>
<content type='text'>
The voltage range (min, max) provided in the device tree is from
the data manual and is pretty big, catering to a wide range of devices.
On a i2c read/write failure the regulator_set_voltage_triplet function
falls back to set voltage between min and max. The min value from Device
Tree can be lesser than the optimal value and in that case that can lead
to a hang or crash. Hence set the u_volt_min dynamically to the optimal
voltage value.

Cc: 4.16+ &lt;stable@vger.kernel.org&gt; # v4.16+
Fixes: 9a835fa6e47 ("PM / OPP: Add ti-opp-supply driver")
Signed-off-by: Keerthy &lt;j-keerthy@ti.com&gt;
Acked-by: Dave Gerlach &lt;d-gerlach@ti.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>PM / OPP: _of_add_opp_table_v2(): increment count only if OPP is added</title>
<updated>2018-10-04T03:51:36Z</updated>
<author>
<name>Dave Gerlach</name>
<email>d-gerlach@ti.com</email>
</author>
<published>2018-10-03T10:43:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=deac8703da5faafce96be3f91c668dcd5da931a5'/>
<id>urn:sha1:deac8703da5faafce96be3f91c668dcd5da931a5</id>
<content type='text'>
Currently the _of_add_opp_table_v2 call loops through the OPP nodes in
the operating-points-v2 table in the device tree and calls
_opp_add_static_v2 for each to add them to the table. It counts each
iteration through this loop as an added OPP, however there are cases
where _opp_add_static_v2() returns 0 but no new OPP is added to the
list.

This can happen while adding duplicate OPP or if the OPP isn't supported
by hardware.

Because of this the count variable will contain the number of OPP nodes
in the table in device tree but not necessarily the ones that are
actually added.

As this count value is what is checked to determine if there are any
valid OPPs, if a platform has an operating-points-v2 table with all OPP
nodes containing opp-supported-hw values that are not currently
supported, then _of_add_opp_table_v2 will fail to abort as it should due
to an empty table.

Additionally, since commit 3ba98324e81a ("PM / OPP: Get
performance state using genpd helper"), the same count variable is
compared against the number of OPPs containing performance states and
requires that either all or none have pstates set, however in the case
of any opp table that has any entries that do not get added by
_opp_add_static_v2 due to incompatible opp-supported-hw fields, these
numbers will not match and _of_add_opp_table_v2 will incorrectly fail.

We need to clearly identify all the three cases (success, failure,
unsupported/duplicate OPPs) and then increment count only on success
case. Change return type of _opp_add_static_v2() to return the pointer
to the newly added OPP instead of an integer. This routine now returns a
valid pointer if the OPP is really added, NULL for unsupported or
duplicate OPPs, and error value cased as a pointer on errors.

Ideally the fixes tag in this commit should point back to the commit
that introduced OPP v2 initially, as that's where we started incorrectly
accounting for duplicate OPPs:

commit 274659029c9d ("PM / OPP: Add support to parse "operating-points-v2" bindings")

But it wasn't a real problem until recently as the count was only used
to check if any OPPs are added or not. And so this commit points to a
rather recent commit where we added more code that depends on the value
of "count".

Fixes: 3ba98324e81a ("PM / OPP: Get performance state using genpd helper")
Reported-by: Dave Gerlach &lt;d-gerlach@ti.com&gt;
Reported-by: Niklas Cassel &lt;niklas.cassel@linaro.org&gt;
Tested-by: Niklas Cassel &lt;niklas.cassel@linaro.org&gt;
Signed-off-by: Dave Gerlach &lt;d-gerlach@ti.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: Return error on error from dev_pm_opp_get_opp_count()</title>
<updated>2018-10-04T03:40:56Z</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2018-10-03T09:52:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=09f662f95306f3e3d47ab6842bc4b0bb868a80ad'/>
<id>urn:sha1:09f662f95306f3e3d47ab6842bc4b0bb868a80ad</id>
<content type='text'>
Return error number instead of 0 on failures.

Fixes: a1e8c13600bf ("PM / OPP: "opp-hz" is optional for power domains")
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: Improve error handling in dev_pm_opp_of_cpumask_add_table()</title>
<updated>2018-10-04T03:40:56Z</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2018-10-03T09:42:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=50b6b87c8484da8bb5dcce00f84ec80aee8fc2bd'/>
<id>urn:sha1:50b6b87c8484da8bb5dcce00f84ec80aee8fc2bd</id>
<content type='text'>
The error handling wasn't appropriate in
dev_pm_opp_of_cpumask_add_table(). For example it returns 0 on success
and also for the case where cpumask is empty or cpu_device wasn't found
for any of the CPUs.

It should really return error on such cases, so that the callers can be
aware of the outcome.

Fix it.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: Pass OPP table to _of_add_opp_table_v{1|2}()</title>
<updated>2018-10-01T09:30:34Z</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2018-09-12T05:51:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5ed4cecd75e90232a19afa502cf477925854561e'/>
<id>urn:sha1:5ed4cecd75e90232a19afa502cf477925854561e</id>
<content type='text'>
Both _of_add_opp_table_v1() and _of_add_opp_table_v2() contain similar
code to get the OPP table and their parent routine also parses the DT to
find the OPP table's node pointer. This can be simplified by getting the
OPP table in advance and then passing it as argument to these routines.

Tested-by: Niklas Cassel &lt;niklas.cassel@linaro.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: Prevent creating multiple OPP tables for devices sharing OPP nodes</title>
<updated>2018-10-01T09:30:31Z</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2018-09-07T03:31:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=283d55e68d8a0f302057f57dcbd4d2e000c2ac85'/>
<id>urn:sha1:283d55e68d8a0f302057f57dcbd4d2e000c2ac85</id>
<content type='text'>
When two or more devices are sharing their clock and voltage rails, they
share the same OPP table. But there are some corner cases where the OPP
core incorrectly creates separate OPP tables for them.

For example, CPU 0 and 1 share clock/voltage rails. The platform
specific code calls dev_pm_opp_set_regulators() for CPU0 and the OPP
core creates an OPP table for it (the individual OPPs aren't initialized
as of now). The same is repeated for CPU1 then. Because
_opp_get_opp_table() doesn't compare DT node pointers currently, it
fails to find the link between CPU0 and CPU1 and so creates a new OPP
table.

Fix this by calling _managed_opp() from _opp_get_opp_table().
_managed_opp() gain an additional argument (index) to get the right node
pointer. This resulted in simplifying code in _of_add_opp_table_v2() as
well.

Tested-by: Niklas Cassel &lt;niklas.cassel@linaro.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: Use a single mechanism to free the OPP table</title>
<updated>2018-09-19T21:56:46Z</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2018-09-12T07:05:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cdd6ed90cdb6c2fd982909501f0a109274147fb4'/>
<id>urn:sha1:cdd6ed90cdb6c2fd982909501f0a109274147fb4</id>
<content type='text'>
Currently there are two separate ways to free the OPP table based on how
it is created in the first place.

We call _dev_pm_opp_remove_table() to free the static and/or dynamic
OPP, OPP list devices, etc. This is done for the case where the OPP
table is added while initializing the OPPs, like via the path
dev_pm_opp_of_add_table().

We also call dev_pm_opp_put_opp_table() in some cases which eventually
frees the OPP table structure once the reference count reaches 0. This
is used by the first case as well as other cases like
dev_pm_opp_set_regulators() where the OPPs aren't necessarily
initialized at this point.

This whole thing is a bit unclear and messy and obstruct any further
cleanup/fixup of OPP core.

This patch tries to streamline this by keeping a single path for OPP
table destruction, i.e. dev_pm_opp_put_opp_table().

All the cleanup happens in _opp_table_kref_release() now after the
reference count reaches 0. _dev_pm_opp_remove_table() is removed as it
isn't required anymore.

We don't drop the reference to the OPP table after creating it from
_of_add_opp_table_v{1|2}() anymore and the same is dropped only when we
try to remove them.

Tested-by: Niklas Cassel &lt;niklas.cassel@linaro.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
</feed>
