Thread (23 messages) 23 messages, 6 authors, 2021-05-12

Re: [PATCH 3/3] i2c: i2c-qcom-geni: Add support for 'assigned-performance-states'

From: Ulf Hansson <hidden>
Date: 2021-01-19 11:18:18
Also in: linux-arm-msm, linux-i2c, linux-pm, lkml

On Mon, 18 Jan 2021 at 06:36, Rajendra Nayak [off-list ref] wrote:

On 1/15/2021 8:13 PM, Bjorn Andersson wrote:
quoted
On Thu 24 Dec 05:12 CST 2020, Roja Rani Yarubandi wrote:
quoted
@@ -629,6 +658,16 @@ static int __maybe_unused geni_i2c_runtime_suspend(struct device *dev)
     struct geni_i2c_dev *gi2c = dev_get_drvdata(dev);

     disable_irq(gi2c->irq);
+
+    /* Drop the assigned performance state */
+    if (gi2c->assigned_pstate) {
+            ret = dev_pm_genpd_set_performance_state(dev, 0);
+            if (ret) {
+                    dev_err(dev, "Failed to set performance state\n");
+                    return ret;
+            }
+    }
+
Ulf, Viresh, I think we discussed this at the time of introducing the
performance states.

The client's state does not affect if its performance_state should
be included in the calculation of the aggregated performance_state, so
each driver that needs to keep some minimum performance state needs to
have these two snippets.

Would it not make sense to on enable/disable re-evaluate the
performance_state and potentially reconfigure the hardware
automatically?
I agree, this will be repeated across multiple drivers which would
need some minimal vote while they are active, handling this during
genpd enable/disable in genpd core makes sense.
Initially that's what we tried out, but we realized that it was
difficult to deal with this internally in genpd, but more importantly
it also removed some flexibility from consumers and providers. See
commit 68de2fe57a8f ("PM / Domains: Make genpd performance states
orthogonal to the idlestates").

As a matter of fact this was quite recently discussed [1], which also
pointed out some issues when using the "required-opps" in combination,
but perhaps that got resolved? Viresh?

My concern is, if we would make this kind of change to the internals
of genpd, it would lead to the following limitation: A consumer driver
can no longer make its vote for its device to stick around, when the
device becomes runtime suspended - and how do we know that we never
need to support such a case?
quoted
Regards,
Bjorn
quoted
     ret = geni_se_resources_off(&gi2c->se);
     if (ret) {
             enable_irq(gi2c->irq);
@@ -654,6 +693,16 @@ static int __maybe_unused geni_i2c_runtime_resume(struct device *dev)
     if (ret)
             return ret;

+    /* Set the assigned performance state */
+    if (gi2c->assigned_pstate) {
+            ret = dev_pm_genpd_set_performance_state(dev,
+                                                     gi2c->assigned_pstate);
+            if (ret) {
+                    dev_err(dev, "Failed to set performance state\n");
+                    return ret;
+            }
+    }
+
     enable_irq(gi2c->irq);
     gi2c->suspended = 0;
     return 0;
Kind regards
Uffe

[1]
https://lkml.org/lkml/2020/9/11/230
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help