Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1631392 > unrolled thread
| Started by | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| First post | 2017-04-26 13:00 +0200 |
| Last post | 2017-04-26 13:00 +0200 |
| Articles | 16 — 5 participants |
Back to article view | Back to linux.kernel
[PATCH V6 0/9] PM / Domains: Implement domain performance states Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-26 13:00 +0200
[PATCH V6 8/9] PM / Domain: Add struct device to genpd Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-26 13:00 +0200
[PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-26 13:00 +0200
Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property Rob Herring <robh@kernel.org> - 2017-04-28 22:50 +0200
Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property Sudeep Holla <sudeep.holla@arm.com> - 2017-05-03 13:40 +0200
Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property Kevin Hilman <khilman@baylibre.com> - 2017-05-06 23:50 +0200
Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property Sudeep Holla <sudeep.holla@arm.com> - 2017-05-08 15:50 +0200
Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property Viresh Kumar <viresh.kumar@linaro.org> - 2017-05-08 09:20 +0200
Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property Sudeep Holla <sudeep.holla@arm.com> - 2017-05-08 16:00 +0200
Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property Viresh Kumar <viresh.kumar@linaro.org> - 2017-05-09 07:30 +0200
Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property Kevin Hilman <khilman@baylibre.com> - 2017-05-06 23:50 +0200
Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property Viresh Kumar <viresh.kumar@linaro.org> - 2017-05-08 06:20 +0200
Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property Rajendra Nayak <rnayak@codeaurora.org> - 2017-05-08 07:40 +0200
Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property Viresh Kumar <viresh.kumar@linaro.org> - 2017-05-08 09:20 +0200
[PATCH V6 7/9] PM / domain: Register PM QOS performance notifier Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-26 13:00 +0200
[PATCH V6 5/9] PM / OPP: Add support to parse "power-domain-opp" property Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-26 13:00 +0200
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2017-04-26 13:00 +0200 |
| Subject | [PATCH V6 0/9] PM / Domains: Implement domain performance states |
| Message-ID | <tAsPT-197-3@gated-at.bofh.it> |
Hi,
Here is the 6th version of the series, which incorporates feedback from
Kevin and Sudeep:
- Use freq/voltage in OPP table as it is for power domain and don't
create "domain-performance-level" property
- Take care of domain providers that provide multiple domains
Here is a brief summary of the problem I am trying to solve.
Some platforms have the capability to configure the performance state of
their power domains. The process of configuring the performance state is
pretty much platform dependent and we may need to work with a wide range
of configurables. For some platforms, like Qcom, it can be a positive
integer value alone, while in other cases it can be voltage levels, etc.
The power-domain framework until now was only designed for the idle
state management of the device and this needs to change in order to
reuse the power-domain framework for active state management of the
devices.
This series adapts the genpd and OPP frameworks to allow OPP tables to
be used for the genpd devices as well.
The first 2 patches update the DT bindings of the power-domains and OPP
tables. And the other 7 patches implement the details in QoS, genpd and
OPP frameworks.
This is tested currently by hacking the kernel a bit with virtual
power-domains for the dual A15 exynos platform. The earlier version of
patches was also tested by Rajendra Nayak (Qcom) on *real* Qualcomm
hardware for which this work is getting done. Hope this version should
work as well.
Here is sample DT and C code we need to write for platforms:
DT:
---
/ {
domain_opp_table: opp_table0 {
compatible = "operating-points-v2";
domain_opp_1: opp-1 {
opp-hz = /bits/ 64 <1>;
opp-microvolt = <975000 970000 985000>;
};
domain_opp_2: opp-2 {
opp-hz = /bits/ 64 <2>;
opp-microvolt = <1075000 1000000 1085000>;
};
};
foo_domain: power-controller@12340000 {
compatible = "foo,power-controller";
reg = <0x12340000 0x1000>;
#power-domain-cells = <0>;
operating-points-v2 = <&domain_opp_table>;
}
cpu0_opp_table: opp_table1 {
compatible = "operating-points-v2";
opp-shared;
opp-1000000000 {
opp-hz = /bits/ 64 <1000000000>;
power-domain-opp = <&domain_opp_1>;
};
opp-1100000000 {
opp-hz = /bits/ 64 <1100000000>;
power-domain-opp = <&domain_opp_2>;
};
opp-1200000000 {
opp-hz = /bits/ 64 <1200000000>;
power-domain-opp = <&domain_opp_2>;
};
};
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu@0 {
compatible = "arm,cortex-a9";
reg = <0>;
clocks = <&clk_controller 0>;
clock-names = "cpu";
operating-points-v2 = <&cpu0_opp_table>;
power-domains = <&foo_domain>;
};
};
};
Driver code:
------------
static int pd_performance(struct generic_pm_domain *domain, unsigned int state)
{
struct dev_pm_opp *opp;
opp = dev_pm_opp_find_freq_exact(&domain->dev, state, true);
/* Use OPP and state in platform specific way */
return 0;
}
static const struct of_device_id pm_domain_of_match[] __initconst = {
{ .compatible = "foo,genpd", },
{ },
};
static int __init genpd_test_init(void)
{
struct device *dev = get_cpu_device(0);
struct device_node *np;
const struct of_device_id *match;
int n;
int ret;
for_each_matching_node_and_match(np, pm_domain_of_match, &match) {
pd.name = kstrdup_const(strrchr(np->full_name, '/') + 1,
GFP_KERNEL);
if (!pd.name) {
of_node_put(np);
return -ENOMEM;
}
pd.set_performance_state = pd_performance;
pm_genpd_init(&pd, NULL, false);
of_genpd_add_provider_simple(np, &pd);
}
ret = dev_pm_domain_attach(dev, false);
return ret;
}
Pushed here as well:
https://git.linaro.org/people/viresh.kumar/linux.git/log/?h=opp/genpd-performance-state
V5->V6:
- Use freq/voltage in OPP table as it is for power domain and don't
create "domain-performance-level" property
- Create new "power-domain-opp" property for the devices.
- Take care of domain providers that provide multiple domains and extend
"operating-points-v2" property to contain a list of phandles
- Update code according to those bindings.
V4->V5:
- Only 3 patches were resent and 2 of them are Acked from Ulf.
V3->V4:
- Use OPP table for genpd devices as well.
- Add struct device to genpd, in order to reuse OPP infrastructure.
- Based over: https://marc.info/?l=linux-kernel&m=148972988002317&w=2
- Fixed examples in DT document to have voltage in target,min,max order.
V2->V3:
- Based over latest pm/linux-next
- Bindings and code are merged together
- Lots of updates in bindings
- the performance-states node is present within the power-domain now,
instead of its phandle.
- performance-level property is replaced by "reg".
- domain-performance-state property of the consumers contain an
integer value now instead of phandle.
- Lots of updates to the code as well
- Patch "PM / QOS: Add default case to the switch" is merged with
other patches and the code is changed a bit as well.
- Don't pass 'type' to dev_pm_qos_add_notifier(), rather handle all
notifiers with a single list. A new patch is added for that.
- The OPP framework patch can be applied now and has proper SoB from
me.
- Dropped "PM / domain: Save/restore performance state at runtime
suspend/resume".
- Drop all WARN().
- Tested-by Rajendra nayak.
V1->V2:
- Based over latest pm/linux-next
- It is mostly a resend of what is sent earlier as this series hasn't
got any reviews so far and Rafael suggested that its better I resend
it.
- Only the 4/6 patch got an update, which was shared earlier as reply to
V1 as well. It has got several fixes for taking care of power domain
hierarchy, etc.
--
viresh
Viresh Kumar (9):
PM / OPP: Introduce "power-domain-opp" property
PM / Domains: Allow OPP table to be used for power-domains
PM / QOS: Keep common notifier list for genpd constraints
PM / QOS: Add DEV_PM_QOS_PERFORMANCE request
PM / OPP: Add support to parse "power-domain-opp" property
PM / OPP: Implement dev_pm_opp_of_add_table_indexed()
PM / domain: Register PM QOS performance notifier
PM / Domain: Add struct device to genpd
PM / Domain: Add support to parse domain's OPP table
Documentation/devicetree/bindings/opp/opp.txt | 74 ++++++-
.../devicetree/bindings/power/power_domain.txt | 106 ++++++++++
Documentation/power/pm_qos_interface.txt | 2 +-
drivers/base/power/domain.c | 222 +++++++++++++++++++--
drivers/base/power/opp/core.c | 72 +++++++
drivers/base/power/opp/debugfs.c | 3 +
drivers/base/power/opp/of.c | 123 +++++++++++-
drivers/base/power/opp/opp.h | 12 ++
drivers/base/power/qos.c | 36 +++-
include/linux/pm_domain.h | 6 +
include/linux/pm_opp.h | 6 +
include/linux/pm_qos.h | 16 ++
kernel/power/qos.c | 2 +-
13 files changed, 641 insertions(+), 39 deletions(-)
--
2.12.0.432.g71c3a4f4ba37
[toc] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2017-04-26 13:00 +0200 |
| Subject | [PATCH V6 8/9] PM / Domain: Add struct device to genpd |
| Message-ID | <tAsPV-197-31@gated-at.bofh.it> |
| In reply to | #1631392 |
The power-domain core would be using the OPP core going forward and the
OPP core has the basic requirement of a device structure for its working.
Add a struct device to the genpd structure and also add a genpd bus type
for the devices.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/base/power/domain.c | 37 +++++++++++++++++++++++++++++++++++++
include/linux/pm_domain.h | 1 +
2 files changed, 38 insertions(+)
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 7d35dafe8c97..85365611b258 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1546,6 +1546,10 @@ static void genpd_lock_init(struct generic_pm_domain *genpd)
}
}
+static struct bus_type genpd_bus_type = {
+ .name = "genpd",
+};
+
/**
* pm_genpd_init - Initialize a generic I/O PM domain object.
* @genpd: PM domain object to initialize.
@@ -1602,6 +1606,18 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
return ret;
}
+ genpd->dev.bus = &genpd_bus_type;
+ device_initialize(&genpd->dev);
+ dev_set_name(&genpd->dev, "%s", genpd->name);
+
+ ret = device_add(&genpd->dev);
+ if (ret) {
+ dev_err(&genpd->dev, "failed to add device: %d\n", ret);
+ put_device(&genpd->dev);
+ kfree(genpd->free);
+ return ret;
+ }
+
mutex_lock(&gpd_list_lock);
list_add(&genpd->gpd_list_node, &gpd_list);
mutex_unlock(&gpd_list_lock);
@@ -1639,6 +1655,7 @@ static int genpd_remove(struct generic_pm_domain *genpd)
list_del(&genpd->gpd_list_node);
genpd_unlock(genpd);
+ device_del(&genpd->dev);
cancel_work_sync(&genpd->power_off_work);
kfree(genpd->free);
pr_debug("%s: removed %s\n", __func__, genpd->name);
@@ -1806,6 +1823,7 @@ int of_genpd_add_provider_simple(struct device_node *np,
if (!ret) {
genpd->provider = &np->fwnode;
genpd->has_provider = true;
+ genpd->dev.of_node = np;
}
}
@@ -1839,6 +1857,7 @@ int of_genpd_add_provider_onecell(struct device_node *np,
data->domains[i]->provider = &np->fwnode;
data->domains[i]->has_provider = true;
+ data->domains[i]->dev.of_node = np;
}
ret = genpd_add_provider(np, genpd_xlate_onecell, data);
@@ -2421,3 +2440,21 @@ static void __exit pm_genpd_debug_exit(void)
}
__exitcall(pm_genpd_debug_exit);
#endif /* CONFIG_DEBUG_FS */
+
+static int __init pm_genpd_core_init(void)
+{
+ int ret;
+
+ ret = bus_register(&genpd_bus_type);
+ if (ret)
+ pr_err("bus_register failed (%d)\n", ret);
+
+ return ret;
+}
+pure_initcall(pm_genpd_core_init);
+
+static void __exit pm_genpd_core_exit(void)
+{
+ bus_unregister(&genpd_bus_type);
+}
+__exitcall(pm_genpd_core_exit);
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 84ee474e66d0..c01f12b370d2 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -48,6 +48,7 @@ struct genpd_power_state {
struct genpd_lock_ops;
struct generic_pm_domain {
+ struct device dev;
struct dev_pm_domain domain; /* PM domain operations */
struct list_head gpd_list_node; /* Node in the global PM domains list */
struct list_head master_links; /* Links with PM domain as a master */
--
2.12.0.432.g71c3a4f4ba37
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2017-04-26 13:00 +0200 |
| Subject | [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property |
| Message-ID | <tAsPV-197-35@gated-at.bofh.it> |
| In reply to | #1631392 |
Power-domains need to express their active states in DT and the devices
within the power-domain need to express their dependency on those active
states. The power-domains can use the OPP tables without any
modifications to the bindings.
Add a new property "power-domain-opp", which will contain phandle to the
OPP node of the parent power domain. This is required for devices which
have dependency on the configured active state of the power domain for
their working.
For some platforms the actual frequency and voltages of the power
domains are managed by the firmware and are so hidden from the high
level operating system. The "opp-hz" property is relaxed a bit to
contain indexes instead of actual frequency values to support such
platforms.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
Documentation/devicetree/bindings/opp/opp.txt | 74 ++++++++++++++++++++++++++-
1 file changed, 73 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt
index 63725498bd20..6e30cae2a936 100644
--- a/Documentation/devicetree/bindings/opp/opp.txt
+++ b/Documentation/devicetree/bindings/opp/opp.txt
@@ -77,7 +77,10 @@ This defines voltage-current-frequency combinations along with other related
properties.
Required properties:
-- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer.
+- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. In some
+ cases the exact frequency in Hz may be hidden from the OS by the firmware and
+ this field may contain values that represent the frequency in a firmware
+ dependent way, for example an index of an array in the firmware.
Optional properties:
- opp-microvolt: voltage in micro Volts.
@@ -154,6 +157,13 @@ properties.
- status: Marks the node enabled/disabled.
+- power-domain-opp: Phandle to the OPP node of the parent power-domain. The
+ parent power-domain should be configured to the OPP whose node is pointed by
+ the phandle, in order to configure the device for the OPP node that contains
+ this property. The order in which the device and power domain should be
+ configured is implementation defined. The OPP table of a device can set this
+ property only if the device node contains "power-domains" property.
+
Example 1: Single cluster Dual-core ARM cortex A9, switch DVFS states together.
/ {
@@ -528,3 +538,65 @@ Example 5: opp-supported-hw
};
};
};
+
+Example 7: Power domains with their own OPP tables:
+(example: For 1GHz device require domain state 1 and for 1.1 & 1.2 GHz device require state 2)
+
+/ {
+ domain_opp_table: opp_table0 {
+ compatible = "operating-points-v2";
+
+ /*
+ * NOTE: Actual frequency is managed by firmware and is hidden
+ * from HLOS, so we simply use index in the opp-hz field to
+ * select the OPP.
+ */
+ domain_opp_1: opp-1 {
+ opp-hz = /bits/ 64 <1>;
+ opp-microvolt = <975000 970000 985000>;
+ };
+ domain_opp_2: opp-2 {
+ opp-hz = /bits/ 64 <2>;
+ opp-microvolt = <1075000 1000000 1085000>;
+ };
+ };
+
+ foo_domain: power-controller@12340000 {
+ compatible = "foo,power-controller";
+ reg = <0x12340000 0x1000>;
+ #power-domain-cells = <0>;
+ operating-points-v2 = <&domain_opp_table>;
+ }
+
+ cpu0_opp_table: opp_table1 {
+ compatible = "operating-points-v2";
+ opp-shared;
+
+ opp-1000000000 {
+ opp-hz = /bits/ 64 <1000000000>;
+ power-domain-opp = <&domain_opp_1>;
+ };
+ opp-1100000000 {
+ opp-hz = /bits/ 64 <1100000000>;
+ power-domain-opp = <&domain_opp_2>;
+ };
+ opp-1200000000 {
+ opp-hz = /bits/ 64 <1200000000>;
+ power-domain-opp = <&domain_opp_2>;
+ };
+ };
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ cpu@0 {
+ compatible = "arm,cortex-a9";
+ reg = <0>;
+ clocks = <&clk_controller 0>;
+ clock-names = "cpu";
+ operating-points-v2 = <&cpu0_opp_table>;
+ power-domains = <&foo_domain>;
+ };
+ };
+};
--
2.12.0.432.g71c3a4f4ba37
[toc] | [prev] | [next] | [standalone]
| From | Rob Herring <robh@kernel.org> |
|---|---|
| Date | 2017-04-28 22:50 +0200 |
| Subject | Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property |
| Message-ID | <tBkZY-4ij-13@gated-at.bofh.it> |
| In reply to | #1631395 |
On Wed, Apr 26, 2017 at 04:27:05PM +0530, Viresh Kumar wrote: > Power-domains need to express their active states in DT and the devices > within the power-domain need to express their dependency on those active > states. The power-domains can use the OPP tables without any > modifications to the bindings. > > Add a new property "power-domain-opp", which will contain phandle to the > OPP node of the parent power domain. This is required for devices which > have dependency on the configured active state of the power domain for > their working. > > For some platforms the actual frequency and voltages of the power > domains are managed by the firmware and are so hidden from the high > level operating system. The "opp-hz" property is relaxed a bit to > contain indexes instead of actual frequency values to support such > platforms. > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > --- > Documentation/devicetree/bindings/opp/opp.txt | 74 ++++++++++++++++++++++++++- > 1 file changed, 73 insertions(+), 1 deletion(-) > > diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt > index 63725498bd20..6e30cae2a936 100644 > --- a/Documentation/devicetree/bindings/opp/opp.txt > +++ b/Documentation/devicetree/bindings/opp/opp.txt > @@ -77,7 +77,10 @@ This defines voltage-current-frequency combinations along with other related > properties. > > Required properties: > -- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. > +- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. In some > + cases the exact frequency in Hz may be hidden from the OS by the firmware and > + this field may contain values that represent the frequency in a firmware > + dependent way, for example an index of an array in the firmware. Not really sure OPP binding makes sense here. What about all the other properties. We expose voltage, but not freq? > > Optional properties: > - opp-microvolt: voltage in micro Volts. > @@ -154,6 +157,13 @@ properties. > > - status: Marks the node enabled/disabled. > > +- power-domain-opp: Phandle to the OPP node of the parent power-domain. The > + parent power-domain should be configured to the OPP whose node is pointed by > + the phandle, in order to configure the device for the OPP node that contains > + this property. The order in which the device and power domain should be > + configured is implementation defined. The OPP table of a device can set this > + property only if the device node contains "power-domains" property. > + I don't even know what to say on this. The continual evolution of OPP bindings continues. This seems like further abuse of DT power-domains (being a region in a chip that can be powergated) with Linux PM domains. Rob
[toc] | [prev] | [next] | [standalone]
| From | Sudeep Holla <sudeep.holla@arm.com> |
|---|---|
| Date | 2017-05-03 13:40 +0200 |
| Subject | Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property |
| Message-ID | <tD0Ns-4I5-3@gated-at.bofh.it> |
| In reply to | #1633152 |
On 28/04/17 21:48, Rob Herring wrote: > On Wed, Apr 26, 2017 at 04:27:05PM +0530, Viresh Kumar wrote: >> Power-domains need to express their active states in DT and the devices >> within the power-domain need to express their dependency on those active >> states. The power-domains can use the OPP tables without any >> modifications to the bindings. >> >> Add a new property "power-domain-opp", which will contain phandle to the >> OPP node of the parent power domain. This is required for devices which >> have dependency on the configured active state of the power domain for >> their working. >> >> For some platforms the actual frequency and voltages of the power >> domains are managed by the firmware and are so hidden from the high >> level operating system. The "opp-hz" property is relaxed a bit to >> contain indexes instead of actual frequency values to support such >> platforms. >> >> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> >> --- >> Documentation/devicetree/bindings/opp/opp.txt | 74 ++++++++++++++++++++++++++- >> 1 file changed, 73 insertions(+), 1 deletion(-) >> >> diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt >> index 63725498bd20..6e30cae2a936 100644 >> --- a/Documentation/devicetree/bindings/opp/opp.txt >> +++ b/Documentation/devicetree/bindings/opp/opp.txt >> @@ -77,7 +77,10 @@ This defines voltage-current-frequency combinations along with other related >> properties. >> >> Required properties: >> -- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. >> +- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. In some >> + cases the exact frequency in Hz may be hidden from the OS by the firmware and >> + this field may contain values that represent the frequency in a firmware >> + dependent way, for example an index of an array in the firmware. > > Not really sure OPP binding makes sense here. What about all the other > properties. We expose voltage, but not freq? > I completely agree with that and I have been pushing this to be represented as just regulators[0]. Mark B seem to dislike that idea [1] -- Regards, Sudeep [0] http://www.spinics.net/lists/devicetree/msg174725.html [1] http://www.spinics.net/lists/devicetree/msg175113.html
[toc] | [prev] | [next] | [standalone]
| From | Kevin Hilman <khilman@baylibre.com> |
|---|---|
| Date | 2017-05-06 23:50 +0200 |
| Subject | Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property |
| Message-ID | <tEfKp-4Y7-5@gated-at.bofh.it> |
| In reply to | #1634898 |
Sudeep Holla <sudeep.holla@arm.com> writes: > On 28/04/17 21:48, Rob Herring wrote: >> On Wed, Apr 26, 2017 at 04:27:05PM +0530, Viresh Kumar wrote: >>> Power-domains need to express their active states in DT and the devices >>> within the power-domain need to express their dependency on those active >>> states. The power-domains can use the OPP tables without any >>> modifications to the bindings. >>> >>> Add a new property "power-domain-opp", which will contain phandle to the >>> OPP node of the parent power domain. This is required for devices which >>> have dependency on the configured active state of the power domain for >>> their working. >>> >>> For some platforms the actual frequency and voltages of the power >>> domains are managed by the firmware and are so hidden from the high >>> level operating system. The "opp-hz" property is relaxed a bit to >>> contain indexes instead of actual frequency values to support such >>> platforms. >>> >>> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> >>> --- >>> Documentation/devicetree/bindings/opp/opp.txt | 74 ++++++++++++++++++++++++++- >>> 1 file changed, 73 insertions(+), 1 deletion(-) >>> >>> diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt >>> index 63725498bd20..6e30cae2a936 100644 >>> --- a/Documentation/devicetree/bindings/opp/opp.txt >>> +++ b/Documentation/devicetree/bindings/opp/opp.txt >>> @@ -77,7 +77,10 @@ This defines voltage-current-frequency combinations along with other related >>> properties. >>> >>> Required properties: >>> -- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. >>> +- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. In some >>> + cases the exact frequency in Hz may be hidden from the OS by the firmware and >>> + this field may contain values that represent the frequency in a firmware >>> + dependent way, for example an index of an array in the firmware. >> >> Not really sure OPP binding makes sense here. What about all the other >> properties. We expose voltage, but not freq? >> > > I completely agree with that and I have been pushing this to be > represented as just regulators[0]. Mark B seem to dislike that > idea [1] And Mark is right, because what's being described is not (simply) a voltage regultor. While it might be "just" voltage on some SoCs (for now), it is clearly about performance (a.k.a. OPP) on others. Kevin
[toc] | [prev] | [next] | [standalone]
| From | Sudeep Holla <sudeep.holla@arm.com> |
|---|---|
| Date | 2017-05-08 15:50 +0200 |
| Subject | Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property |
| Message-ID | <tERd0-4yE-23@gated-at.bofh.it> |
| In reply to | #1636997 |
On 06/05/17 10:39, Kevin Hilman wrote: > Sudeep Holla <sudeep.holla@arm.com> writes: > >> On 28/04/17 21:48, Rob Herring wrote: >>> On Wed, Apr 26, 2017 at 04:27:05PM +0530, Viresh Kumar wrote: >>>> Power-domains need to express their active states in DT and the devices >>>> within the power-domain need to express their dependency on those active >>>> states. The power-domains can use the OPP tables without any >>>> modifications to the bindings. >>>> >>>> Add a new property "power-domain-opp", which will contain phandle to the >>>> OPP node of the parent power domain. This is required for devices which >>>> have dependency on the configured active state of the power domain for >>>> their working. >>>> >>>> For some platforms the actual frequency and voltages of the power >>>> domains are managed by the firmware and are so hidden from the high >>>> level operating system. The "opp-hz" property is relaxed a bit to >>>> contain indexes instead of actual frequency values to support such >>>> platforms. >>>> >>>> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> >>>> --- >>>> Documentation/devicetree/bindings/opp/opp.txt | 74 ++++++++++++++++++++++++++- >>>> 1 file changed, 73 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt >>>> index 63725498bd20..6e30cae2a936 100644 >>>> --- a/Documentation/devicetree/bindings/opp/opp.txt >>>> +++ b/Documentation/devicetree/bindings/opp/opp.txt >>>> @@ -77,7 +77,10 @@ This defines voltage-current-frequency combinations along with other related >>>> properties. >>>> >>>> Required properties: >>>> -- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. >>>> +- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. In some >>>> + cases the exact frequency in Hz may be hidden from the OS by the firmware and >>>> + this field may contain values that represent the frequency in a firmware >>>> + dependent way, for example an index of an array in the firmware. >>> >>> Not really sure OPP binding makes sense here. What about all the other >>> properties. We expose voltage, but not freq? >>> >> >> I completely agree with that and I have been pushing this to be >> represented as just regulators[0]. Mark B seem to dislike that >> idea [1] > > And Mark is right, because what's being described is not (simply) a > voltage regultor. While it might be "just" voltage on some SoCs (for > now), it is clearly about performance (a.k.a. OPP) on others. > Agreed. What I was against in this particular case was it was just voltage for the domain and the devices had their own OPP with clocks described which looks really weird when both are represented as OPPs. I am fine with OPP representation in all such cases provide the bindings are well defined especially if they are hierarchical, what takes precedence, ...etc. -- Regards, Sudeep
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2017-05-08 09:20 +0200 |
| Subject | Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property |
| Message-ID | <tEL7A-P9-21@gated-at.bofh.it> |
| In reply to | #1634898 |
On 03-05-17, 12:29, Sudeep Holla wrote: > > > On 28/04/17 21:48, Rob Herring wrote: > > On Wed, Apr 26, 2017 at 04:27:05PM +0530, Viresh Kumar wrote: > >> Power-domains need to express their active states in DT and the devices > >> within the power-domain need to express their dependency on those active > >> states. The power-domains can use the OPP tables without any > >> modifications to the bindings. > >> > >> Add a new property "power-domain-opp", which will contain phandle to the > >> OPP node of the parent power domain. This is required for devices which > >> have dependency on the configured active state of the power domain for > >> their working. > >> > >> For some platforms the actual frequency and voltages of the power > >> domains are managed by the firmware and are so hidden from the high > >> level operating system. The "opp-hz" property is relaxed a bit to > >> contain indexes instead of actual frequency values to support such > >> platforms. > >> > >> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > >> --- > >> Documentation/devicetree/bindings/opp/opp.txt | 74 ++++++++++++++++++++++++++- > >> 1 file changed, 73 insertions(+), 1 deletion(-) > >> > >> diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt > >> index 63725498bd20..6e30cae2a936 100644 > >> --- a/Documentation/devicetree/bindings/opp/opp.txt > >> +++ b/Documentation/devicetree/bindings/opp/opp.txt > >> @@ -77,7 +77,10 @@ This defines voltage-current-frequency combinations along with other related > >> properties. > >> > >> Required properties: > >> -- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. > >> +- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. In some > >> + cases the exact frequency in Hz may be hidden from the OS by the firmware and > >> + this field may contain values that represent the frequency in a firmware > >> + dependent way, for example an index of an array in the firmware. > > > > Not really sure OPP binding makes sense here. What about all the other > > properties. We expose voltage, but not freq? > > > > I completely agree with that and I have been pushing this to be > represented as just regulators[0]. Mark B seem to dislike that > idea [1] Just as an update, Rajendra confirmed (offline) that for some of the implementations, the microcontroller handles both frequency and voltages of a device. So it isn't just a regulator anymore and as me and Kevin were saying, we need a complete OPP here. -- viresh
[toc] | [prev] | [next] | [standalone]
| From | Sudeep Holla <sudeep.holla@arm.com> |
|---|---|
| Date | 2017-05-08 16:00 +0200 |
| Subject | Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property |
| Message-ID | <tERmG-4Cr-19@gated-at.bofh.it> |
| In reply to | #1637260 |
On 08/05/17 08:13, Viresh Kumar wrote: > On 03-05-17, 12:29, Sudeep Holla wrote: >> >> >> On 28/04/17 21:48, Rob Herring wrote: >>> On Wed, Apr 26, 2017 at 04:27:05PM +0530, Viresh Kumar wrote: >>>> Power-domains need to express their active states in DT and the devices >>>> within the power-domain need to express their dependency on those active >>>> states. The power-domains can use the OPP tables without any >>>> modifications to the bindings. >>>> >>>> Add a new property "power-domain-opp", which will contain phandle to the >>>> OPP node of the parent power domain. This is required for devices which >>>> have dependency on the configured active state of the power domain for >>>> their working. >>>> >>>> For some platforms the actual frequency and voltages of the power >>>> domains are managed by the firmware and are so hidden from the high >>>> level operating system. The "opp-hz" property is relaxed a bit to >>>> contain indexes instead of actual frequency values to support such >>>> platforms. >>>> >>>> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> >>>> --- >>>> Documentation/devicetree/bindings/opp/opp.txt | 74 ++++++++++++++++++++++++++- >>>> 1 file changed, 73 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt >>>> index 63725498bd20..6e30cae2a936 100644 >>>> --- a/Documentation/devicetree/bindings/opp/opp.txt >>>> +++ b/Documentation/devicetree/bindings/opp/opp.txt >>>> @@ -77,7 +77,10 @@ This defines voltage-current-frequency combinations along with other related >>>> properties. >>>> >>>> Required properties: >>>> -- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. >>>> +- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. In some >>>> + cases the exact frequency in Hz may be hidden from the OS by the firmware and >>>> + this field may contain values that represent the frequency in a firmware >>>> + dependent way, for example an index of an array in the firmware. >>> >>> Not really sure OPP binding makes sense here. What about all the other >>> properties. We expose voltage, but not freq? >>> >> >> I completely agree with that and I have been pushing this to be >> represented as just regulators[0]. Mark B seem to dislike that >> idea [1] > > Just as an update, Rajendra confirmed (offline) that for some of the > implementations, the microcontroller handles both frequency and > voltages of a device. So it isn't just a regulator anymore and as me > and Kevin were saying, we need a complete OPP here. > Yes, I followed the thread and figured that out. But Rajendra also raised "What if the microcontroller firmware maps the performance-index to voltage but expects linux to scale the frequency? There is no way to specify a performance-index *and* a frequency for a OPP now I guess? So this needs to be addressd now IIUC. So as Kevin pointed out, we need to experiment and look at all possibilities before finalizing the bindings. Better to have examples for all these and describe how bindings are be used including how to distinguish between these use-case from the bindings if it's not implicit. -- Regards, Sudeep
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2017-05-09 07:30 +0200 |
| Subject | Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property |
| Message-ID | <tF5SF-5H8-1@gated-at.bofh.it> |
| In reply to | #1637456 |
On 08-05-17, 14:57, Sudeep Holla wrote: > Yes, I followed the thread and figured that out. But Rajendra also > raised "What if the microcontroller firmware maps the performance-index > to voltage but expects linux to scale the frequency? There is no way to > specify a performance-index *and* a frequency for a OPP now I guess? So > this needs to be addressd now IIUC. No, he misunderstood it. He was saying that the domain needs a performance-index and the device needs freq-scaling, how do we do that? He thought that there will be just one OPP table for the device here, but we will actually have two and that would work. > So as Kevin pointed out, we need to experiment and look at all > possibilities before finalizing the bindings. Better to have examples > for all these and describe how bindings are be used including how to > distinguish between these use-case from the bindings if it's not implicit. Yeah, I have some doubts on how we are going to implement that and looking for more input from him. -- viresh
[toc] | [prev] | [next] | [standalone]
| From | Kevin Hilman <khilman@baylibre.com> |
|---|---|
| Date | 2017-05-06 23:50 +0200 |
| Subject | Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property |
| Message-ID | <tEfKp-4Y7-1@gated-at.bofh.it> |
| In reply to | #1633152 |
Rob Herring <robh@kernel.org> writes: > On Wed, Apr 26, 2017 at 04:27:05PM +0530, Viresh Kumar wrote: >> Power-domains need to express their active states in DT and the devices >> within the power-domain need to express their dependency on those active >> states. The power-domains can use the OPP tables without any >> modifications to the bindings. >> >> Add a new property "power-domain-opp", which will contain phandle to the >> OPP node of the parent power domain. This is required for devices which >> have dependency on the configured active state of the power domain for >> their working. >> >> For some platforms the actual frequency and voltages of the power >> domains are managed by the firmware and are so hidden from the high >> level operating system. The "opp-hz" property is relaxed a bit to >> contain indexes instead of actual frequency values to support such >> platforms. >> >> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> >> --- >> Documentation/devicetree/bindings/opp/opp.txt | 74 ++++++++++++++++++++++++++- >> 1 file changed, 73 insertions(+), 1 deletion(-) >> >> diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt >> index 63725498bd20..6e30cae2a936 100644 >> --- a/Documentation/devicetree/bindings/opp/opp.txt >> +++ b/Documentation/devicetree/bindings/opp/opp.txt >> @@ -77,7 +77,10 @@ This defines voltage-current-frequency combinations along with other related >> properties. >> >> Required properties: >> -- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. >> +- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. In some >> + cases the exact frequency in Hz may be hidden from the OS by the firmware and >> + this field may contain values that represent the frequency in a firmware >> + dependent way, for example an index of an array in the firmware. > > Not really sure OPP binding makes sense here. I think OPP makes perfect sense here, because microcontroller firmware is managaging OPPs in hardware. We just may not know the exact voltage and/or frequency (and the firmware/hardware may even be doing AVS for micro-adjustments.) > What about all the other properties. We expose voltage, but not freq? I had the same question. Seems the same comment about an abstract "index" is needed for voltage also. >> >> Optional properties: >> - opp-microvolt: voltage in micro Volts. >> @@ -154,6 +157,13 @@ properties. >> >> - status: Marks the node enabled/disabled. >> >> +- power-domain-opp: Phandle to the OPP node of the parent power-domain. The >> + parent power-domain should be configured to the OPP whose node is pointed by >> + the phandle, in order to configure the device for the OPP node that contains >> + this property. The order in which the device and power domain should be >> + configured is implementation defined. The OPP table of a device can set this >> + property only if the device node contains "power-domains" property. >> + I do understand the need to map a device OPP to a parent power-domain OPP, but I really don't like another phandle. First, just because a device OPP changes does not mean that a power-domain OPP has to change. What really needs to be specified is a minimum requirement, not an exact OPP. IOW, if a device changes OPP, the power-domain OPP has to be *at least* an OPP that can guarantee that level of performance, but could also be a more performant OPP, right? Also, the parent power-domain driver will have a list of all its devices, and be able to get OPPs from those devices. IMO, we should do the first (few) implementations of this feature from the power-domain driver itself, and not try to figure out how to define this for everyone in DT until we have a better handle on it (pun intended) ;) > I don't even know what to say on this. The continual evolution of > OPP bindings continues. This seems like further abuse of DT > power-domains (being a region in a chip that can be powergated) with > Linux PM domains. Agreed. Kevin
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2017-05-08 06:20 +0200 |
| Subject | Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property |
| Message-ID | <tEIjn-7gc-1@gated-at.bofh.it> |
| In reply to | #1636996 |
On 06-05-17, 11:58, Kevin Hilman wrote: > Rob Herring <robh@kernel.org> writes: > > > On Wed, Apr 26, 2017 at 04:27:05PM +0530, Viresh Kumar wrote: > >> Power-domains need to express their active states in DT and the devices > >> within the power-domain need to express their dependency on those active > >> states. The power-domains can use the OPP tables without any > >> modifications to the bindings. > >> > >> Add a new property "power-domain-opp", which will contain phandle to the > >> OPP node of the parent power domain. This is required for devices which > >> have dependency on the configured active state of the power domain for > >> their working. > >> > >> For some platforms the actual frequency and voltages of the power > >> domains are managed by the firmware and are so hidden from the high > >> level operating system. The "opp-hz" property is relaxed a bit to > >> contain indexes instead of actual frequency values to support such > >> platforms. > >> > >> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > >> --- > >> Documentation/devicetree/bindings/opp/opp.txt | 74 ++++++++++++++++++++++++++- > >> 1 file changed, 73 insertions(+), 1 deletion(-) > >> > >> diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt > >> index 63725498bd20..6e30cae2a936 100644 > >> --- a/Documentation/devicetree/bindings/opp/opp.txt > >> +++ b/Documentation/devicetree/bindings/opp/opp.txt > >> @@ -77,7 +77,10 @@ This defines voltage-current-frequency combinations along with other related > >> properties. > >> > >> Required properties: > >> -- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. > >> +- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. In some > >> + cases the exact frequency in Hz may be hidden from the OS by the firmware and > >> + this field may contain values that represent the frequency in a firmware > >> + dependent way, for example an index of an array in the firmware. > > > > Not really sure OPP binding makes sense here. > > I think OPP makes perfect sense here, because microcontroller firmware > is managaging OPPs in hardware. We just may not know the exact voltage > and/or frequency (and the firmware/hardware may even be doing AVS for > micro-adjustments.) Yes, AVS is being done for the Qcom SoC as well. > > What about all the other properties. We expose voltage, but not freq? > > I had the same question. Seems the same comment about an abstract > "index" is needed for voltage also. Why should we do that? Here are the cases that I had in mind while writing this: - DT only contains the performance-index and nothing else (i.e. voltages aren't exposed). We wouldn't be required to fill the microvolt property as it is optional. - DT contains both performance-index and voltages. The microvolts property will contain the actual voltages and opp-hz will contain the index. I don't see why would we like to put some index value in the microvolts property. We are setting the index value in the opp-hz property to avoid adding extra fields and making sure opp-hz is still the unique property for the nodes. > >> > >> Optional properties: > >> - opp-microvolt: voltage in micro Volts. > >> @@ -154,6 +157,13 @@ properties. > >> > >> - status: Marks the node enabled/disabled. > >> > >> +- power-domain-opp: Phandle to the OPP node of the parent power-domain. The > >> + parent power-domain should be configured to the OPP whose node is pointed by > >> + the phandle, in order to configure the device for the OPP node that contains > >> + this property. The order in which the device and power domain should be > >> + configured is implementation defined. The OPP table of a device can set this > >> + property only if the device node contains "power-domains" property. > >> + > > I do understand the need to map a device OPP to a parent power-domain > OPP, but I really don't like another phandle. > > First, just because a device OPP changes does not mean that a > power-domain OPP has to change. What really needs to be specified is a > minimum requirement, not an exact OPP. IOW, if a device changes OPP, > the power-domain OPP has to be *at least* an OPP that can guarantee that > level of performance, but could also be a more performant OPP, right? Right and that's how the code is interpreting it right now. Yes, the description above should have been more clear on that though. > Also, the parent power-domain driver will have a list of all its > devices, and be able to get OPPs from those devices. > > IMO, we should do the first (few) implementations of this feature from > the power-domain driver itself, and not try to figure out how to define > this for everyone in DT until we have a better handle on it (pun > intended) ;) Hmm, I am not sure how things are going to work in that case. The opp-hz value read from the phandle is passed to the QoS framework in this series, which makes sure that we select the highest requested performance point for a particular power-domain. The index value is required to be present with the OPP framework to make it all work, at least based on the way I have designed it for now. -- viresh
[toc] | [prev] | [next] | [standalone]
| From | Rajendra Nayak <rnayak@codeaurora.org> |
|---|---|
| Date | 2017-05-08 07:40 +0200 |
| Subject | Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property |
| Message-ID | <tEJyN-80c-7@gated-at.bofh.it> |
| In reply to | #1637201 |
On 05/08/2017 09:45 AM, Viresh Kumar wrote: > On 06-05-17, 11:58, Kevin Hilman wrote: >> Rob Herring <robh@kernel.org> writes: >> >>> On Wed, Apr 26, 2017 at 04:27:05PM +0530, Viresh Kumar wrote: >>>> Power-domains need to express their active states in DT and the devices >>>> within the power-domain need to express their dependency on those active >>>> states. The power-domains can use the OPP tables without any >>>> modifications to the bindings. >>>> >>>> Add a new property "power-domain-opp", which will contain phandle to the >>>> OPP node of the parent power domain. This is required for devices which >>>> have dependency on the configured active state of the power domain for >>>> their working. >>>> >>>> For some platforms the actual frequency and voltages of the power >>>> domains are managed by the firmware and are so hidden from the high >>>> level operating system. The "opp-hz" property is relaxed a bit to >>>> contain indexes instead of actual frequency values to support such >>>> platforms. >>>> >>>> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> >>>> --- >>>> Documentation/devicetree/bindings/opp/opp.txt | 74 ++++++++++++++++++++++++++- >>>> 1 file changed, 73 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt >>>> index 63725498bd20..6e30cae2a936 100644 >>>> --- a/Documentation/devicetree/bindings/opp/opp.txt >>>> +++ b/Documentation/devicetree/bindings/opp/opp.txt >>>> @@ -77,7 +77,10 @@ This defines voltage-current-frequency combinations along with other related >>>> properties. >>>> >>>> Required properties: >>>> -- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. >>>> +- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. In some >>>> + cases the exact frequency in Hz may be hidden from the OS by the firmware and >>>> + this field may contain values that represent the frequency in a firmware >>>> + dependent way, for example an index of an array in the firmware. >>> >>> Not really sure OPP binding makes sense here. >> >> I think OPP makes perfect sense here, because microcontroller firmware >> is managaging OPPs in hardware. We just may not know the exact voltage >> and/or frequency (and the firmware/hardware may even be doing AVS for >> micro-adjustments.) > > Yes, AVS is being done for the Qcom SoC as well. > >>> What about all the other properties. We expose voltage, but not freq? >> >> I had the same question. Seems the same comment about an abstract >> "index" is needed for voltage also. > > Why should we do that? Here are the cases that I had in mind while writing this: > > - DT only contains the performance-index and nothing else (i.e. voltages aren't > exposed). > > We wouldn't be required to fill the microvolt property as it is optional. So the performance-index is specified in opp-hz property? What if the microcontroller firmware maps the performance-index to voltage but expects linux to scale the frequency? There is no way to specify a performance-index *and* a frequency for a OPP now I guess? > > - DT contains both performance-index and voltages. > > The microvolts property will contain the actual voltages and opp-hz will > contain the index. So this is for cases where the performance-index maps to a freq managed by the microcontroller and voltages managed by linux? I have a case of exact opposite and I don't see now how to handle it now with these bindings. > > I don't see why would we like to put some index value in the microvolts > property. We are setting the index value in the opp-hz property to avoid adding > extra fields and making sure opp-hz is still the unique property for the nodes. Maybe to handle the case like what I described above? -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2017-05-08 09:20 +0200 |
| Subject | Re: [PATCH V6 1/9] PM / OPP: Introduce "power-domain-opp" property |
| Message-ID | <tEL7z-P9-3@gated-at.bofh.it> |
| In reply to | #1637217 |
I had a long chat with Rajendra offline and clarified few things.. On 08-05-17, 11:06, Rajendra Nayak wrote: > On 05/08/2017 09:45 AM, Viresh Kumar wrote: > > On 06-05-17, 11:58, Kevin Hilman wrote: > >> I had the same question. Seems the same comment about an abstract > >> "index" is needed for voltage also. > > > > Why should we do that? Here are the cases that I had in mind while writing this: > > > > - DT only contains the performance-index and nothing else (i.e. voltages aren't > > exposed). > > > > We wouldn't be required to fill the microvolt property as it is optional. > > So the performance-index is specified in opp-hz property? Yes, but in the OPP table of the power-domain and not the device. The device can still have its own OPP table with normal freq/voltage values (for a separate regulator). > What if the microcontroller firmware maps the performance-index to voltage but > expects linux to scale the frequency? As you clarified on the chat, you were talking about the device here. It isn't a problem as we will have two separate tables here, one for the device and one for the domain. -- viresh
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2017-04-26 13:00 +0200 |
| Subject | [PATCH V6 7/9] PM / domain: Register PM QOS performance notifier |
| Message-ID | <tAsPV-197-47@gated-at.bofh.it> |
| In reply to | #1631392 |
Some platforms have the capability to configure the performance state of
their Power Domains. The performance levels are identified by positive
integer values, a lower value represents lower performance state. The
power domain driver should be able to retrieve all information required
to configure the performance state of the power domain, with the help of
the performance constraint's target value.
This patch implements performance state management in PM domain core.
The performance QOS uses the common QOS notifier list and we call
__performance_notifier() if the notifier is issued for performance
constraint.
This also allows the power domain drivers to implement a
->set_performance_state() callback, which will be called by the power
domain core from within the notifier routine. If a domain doesn't
implement ->set_performance_state() callback, then it is assumed that
its parents are responsible for performance state configuration. Both
devices and sub-domains are accounted for while finding the highest
performance state requested.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/base/power/domain.c | 77 +++++++++++++++++++++++++++++++++++++++++++++
include/linux/pm_domain.h | 4 +++
2 files changed, 81 insertions(+)
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index f6f616ac5cc2..7d35dafe8c97 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -462,6 +462,79 @@ static int genpd_latency_notifier(struct generic_pm_domain_data *gpd_data,
return NOTIFY_DONE;
}
+static void __update_domain_performance_state(struct generic_pm_domain *genpd,
+ int depth)
+{
+ struct generic_pm_domain_data *pd_data;
+ struct generic_pm_domain *subdomain;
+ struct pm_domain_data *pdd;
+ unsigned int state = 0;
+ struct gpd_link *link;
+
+ /* Traverse all devices within the domain */
+ list_for_each_entry(pdd, &genpd->dev_list, list_node) {
+ pd_data = to_gpd_data(pdd);
+
+ if (pd_data->performance_state > state)
+ state = pd_data->performance_state;
+ }
+
+ /* Traverse all subdomains within the domain */
+ list_for_each_entry(link, &genpd->master_links, master_node) {
+ subdomain = link->slave;
+
+ if (subdomain->performance_state > state)
+ state = subdomain->performance_state;
+ }
+
+ if (genpd->performance_state == state)
+ return;
+
+ genpd->performance_state = state;
+
+ if (genpd->set_performance_state) {
+ genpd->set_performance_state(genpd, state);
+ return;
+ }
+
+ /* Propagate to parent power domains */
+ list_for_each_entry(link, &genpd->slave_links, slave_node) {
+ struct generic_pm_domain *master = link->master;
+
+ genpd_lock_nested(master, depth + 1);
+ __update_domain_performance_state(master, depth + 1);
+ genpd_unlock(master);
+ }
+}
+
+static int __performance_notifier(struct generic_pm_domain_data *gpd_data,
+ unsigned long val)
+{
+ struct generic_pm_domain *genpd = ERR_PTR(-ENODATA);
+ struct device *dev = gpd_data->base.dev;
+ struct pm_domain_data *pdd;
+
+ spin_lock_irq(&dev->power.lock);
+
+ pdd = dev->power.subsys_data ?
+ dev->power.subsys_data->domain_data : NULL;
+
+ if (pdd && pdd->dev)
+ genpd = dev_to_genpd(dev);
+
+ spin_unlock_irq(&dev->power.lock);
+
+ if (IS_ERR(genpd))
+ return NOTIFY_DONE;
+
+ genpd_lock(genpd);
+ gpd_data->performance_state = val;
+ __update_domain_performance_state(genpd, 0);
+ genpd_unlock(genpd);
+
+ return NOTIFY_DONE;
+}
+
static int genpd_dev_pm_qos_notifier(struct notifier_block *nb,
unsigned long val, void *ptr)
{
@@ -474,6 +547,9 @@ static int genpd_dev_pm_qos_notifier(struct notifier_block *nb,
if (dev_pm_qos_is_resume_latency(dev, ptr))
return genpd_latency_notifier(gpd_data, val);
+ if (dev_pm_qos_is_performance(dev, ptr))
+ return __performance_notifier(gpd_data, val);
+
dev_err(dev, "%s: Unexpected notifier call\n", __func__);
return NOTIFY_BAD;
}
@@ -1168,6 +1244,7 @@ static struct generic_pm_domain_data *genpd_alloc_dev_data(struct device *dev,
gpd_data->td.constraint_changed = true;
gpd_data->td.effective_constraint_ns = -1;
gpd_data->nb.notifier_call = genpd_dev_pm_qos_notifier;
+ gpd_data->performance_state = 0;
spin_lock_irq(&dev->power.lock);
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index b7803a251044..84ee474e66d0 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -63,8 +63,11 @@ struct generic_pm_domain {
unsigned int device_count; /* Number of devices */
unsigned int suspended_count; /* System suspend device counter */
unsigned int prepared_count; /* Suspend counter of prepared devices */
+ unsigned int performance_state; /* Max requested performance state */
int (*power_off)(struct generic_pm_domain *domain);
int (*power_on)(struct generic_pm_domain *domain);
+ int (*set_performance_state)(struct generic_pm_domain *domain,
+ unsigned int state);
struct gpd_dev_ops dev_ops;
s64 max_off_time_ns; /* Maximum allowed "suspended" time. */
bool max_off_time_changed;
@@ -118,6 +121,7 @@ struct generic_pm_domain_data {
struct pm_domain_data base;
struct gpd_timing_data td;
struct notifier_block nb;
+ unsigned int performance_state;
void *data;
};
--
2.12.0.432.g71c3a4f4ba37
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2017-04-26 13:00 +0200 |
| Subject | [PATCH V6 5/9] PM / OPP: Add support to parse "power-domain-opp" property |
| Message-ID | <tAsPV-197-43@gated-at.bofh.it> |
| In reply to | #1631392 |
The devices can specify phandle to their power-domain's OPP node in
their OPP nodes under the "power-domain-opp" property. This patch
updates the OPP core to parse it.
The OPP nodes are allowed to have the "power-domain-opp" property, only
if the device node contains the "power-domains" property. The OPP nodes
aren't allowed to contain this property partially, i.e. Either all OPP
nodes in the OPP table have the "power-domain-opp" property or none of
them have it.
The QoS framework represents the request values by s32 type variables
and so we are forced to convert the 64 bit values read from DT (from the
"opp-hz" property) into s32. It shouldn't be a problem unless someone
uses real frequency values in "opp-hz" property for the power domains. A
comment is added in the code to take a note of that. We can fix that
later once we have real platforms that want it.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/base/power/opp/core.c | 72 +++++++++++++++++++++++++++++++++++++
drivers/base/power/opp/debugfs.c | 3 ++
drivers/base/power/opp/of.c | 77 ++++++++++++++++++++++++++++++++++++++++
drivers/base/power/opp/opp.h | 12 +++++++
4 files changed, 164 insertions(+)
diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c
index dae61720b314..dc8b7bc0061a 100644
--- a/drivers/base/power/opp/core.c
+++ b/drivers/base/power/opp/core.c
@@ -543,6 +543,62 @@ _generic_set_opp_clk_only(struct device *dev, struct clk *clk,
return ret;
}
+static int _update_pm_qos_request(struct device *dev,
+ struct dev_pm_qos_request *req, int perf)
+{
+ int ret;
+
+ if (likely(dev_pm_qos_request_active(req)))
+ ret = dev_pm_qos_update_request(req, perf);
+ else
+ ret = dev_pm_qos_add_request(dev, req, DEV_PM_QOS_PERFORMANCE,
+ perf);
+
+ if (ret < 0)
+ return ret;
+
+ return 0;
+}
+
+static int _generic_set_opp_domain(struct device *dev, struct clk *clk,
+ struct dev_pm_qos_request *req,
+ unsigned long old_freq, unsigned long freq,
+ int old_dfreq, int new_dfreq)
+{
+ int ret;
+
+ /* Scaling up? Scale voltage before frequency */
+ if (freq > old_freq) {
+ ret = _update_pm_qos_request(dev, req, new_dfreq);
+ if (ret)
+ return ret;
+ }
+
+ /* Change frequency */
+ ret = _generic_set_opp_clk_only(dev, clk, old_freq, freq);
+ if (ret)
+ goto restore_dfreq;
+
+ /* Scaling down? Scale voltage after frequency */
+ if (freq < old_freq) {
+ ret = _update_pm_qos_request(dev, req, new_dfreq);
+ if (ret)
+ goto restore_freq;
+ }
+
+ return 0;
+
+restore_freq:
+ if (_generic_set_opp_clk_only(dev, clk, freq, old_freq))
+ dev_err(dev, "%s: failed to restore old-freq (%lu Hz)\n",
+ __func__, old_freq);
+restore_dfreq:
+ if (old_dfreq != -1)
+ _update_pm_qos_request(dev, req, old_dfreq);
+
+ return ret;
+}
+
static int _generic_set_opp(struct dev_pm_set_opp_data *data)
{
struct dev_pm_opp_supply *old_supply = data->old_opp.supplies;
@@ -663,6 +719,19 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
regulators = opp_table->regulators;
+ /* Need to configure power domain performance state */
+ if (opp_table->has_domain_opp) {
+ int old_dfreq = -1, new_dfreq;
+ struct dev_pm_qos_request *req = &opp_table->qos_request;
+
+ new_dfreq = opp->domain_rate;
+ if (!IS_ERR(old_opp))
+ old_dfreq = old_opp->domain_rate;
+
+ return _generic_set_opp_domain(dev, clk, req, old_freq, freq,
+ old_dfreq, new_dfreq);
+ }
+
/* Only frequency scaling */
if (!regulators) {
ret = _generic_set_opp_clk_only(dev, clk, old_freq, freq);
@@ -808,6 +877,9 @@ static void _opp_table_kref_release(struct kref *kref)
struct opp_table *opp_table = container_of(kref, struct opp_table, kref);
struct opp_device *opp_dev;
+ if (dev_pm_qos_request_active(&opp_table->qos_request))
+ dev_pm_qos_remove_request(&opp_table->qos_request);
+
/* Release clk */
if (!IS_ERR(opp_table->clk))
clk_put(opp_table->clk);
diff --git a/drivers/base/power/opp/debugfs.c b/drivers/base/power/opp/debugfs.c
index 95f433db4ac7..4b7eb379c84f 100644
--- a/drivers/base/power/opp/debugfs.c
+++ b/drivers/base/power/opp/debugfs.c
@@ -104,6 +104,9 @@ int opp_debug_create_one(struct dev_pm_opp *opp, struct opp_table *opp_table)
if (!debugfs_create_ulong("rate_hz", S_IRUGO, d, &opp->rate))
return -ENOMEM;
+ if (!debugfs_create_u32("domain_rate", S_IRUGO, d, &opp->domain_rate))
+ return -ENOMEM;
+
if (!opp_debug_create_supplies(opp, opp_table, d))
return -ENOMEM;
diff --git a/drivers/base/power/opp/of.c b/drivers/base/power/opp/of.c
index 779428676f63..77693ba3ed55 100644
--- a/drivers/base/power/opp/of.c
+++ b/drivers/base/power/opp/of.c
@@ -254,6 +254,70 @@ struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev)
}
EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_opp_desc_node);
+static int _parse_domain_opp(struct dev_pm_opp *opp,
+ struct opp_table *opp_table, struct device *dev,
+ struct device_node *np)
+{
+ struct device_node *dnp;
+ u64 rate;
+ int ret;
+
+ if (!of_find_property(np, "power-domain-opp", NULL)) {
+ if (unlikely(opp_table->has_domain_opp == 1)) {
+ dev_err(dev, "%s: Not all OPP nodes have power-domain-opp\n",
+ __func__);
+ return -EINVAL;
+ }
+
+ /* overwrite to avoid conditional statement */
+ opp_table->has_domain_opp = 0;
+ return 0;
+ }
+
+ if (unlikely(!opp_table->has_domain)) {
+ dev_err(dev, "%s: OPP node can't have power-domain-opp property without power domain\n",
+ __func__);
+ return -EINVAL;
+ }
+
+ if (unlikely(!opp_table->has_domain_opp)) {
+ dev_err(dev, "%s: Not all OPP nodes have power-domain-opp\n",
+ __func__);
+ return -EINVAL;
+ }
+
+ dnp = of_parse_phandle(np, "power-domain-opp", 0);
+ if (unlikely(!dnp)) {
+ dev_err(dev, "%s: Unable to parse phandle of power-domain-opp\n",
+ __func__);
+ return -EINVAL;
+ }
+
+ /* Read opp-hz from domain's OPP table */
+ ret = of_property_read_u64(dnp, "opp-hz", &rate);
+ if (ret < 0) {
+ dev_err(dev, "%s: opp-hz not found in domain's node\n",
+ __func__);
+ goto put_node;
+ }
+
+ /*
+ * The "domain_rate" field is directly passed to the QoS APIs and they
+ * accept s32 values only. Will check this again once we have platforms
+ * that really keep u64 values for power domains.
+ */
+ opp->domain_rate = (int)rate;
+
+ /* overwrite to avoid conditional statement */
+ opp_table->has_domain_opp = 1;
+
+ ret = 0;
+
+put_node:
+ of_node_put(dnp);
+ return ret;
+}
+
/**
* _opp_add_static_v2() - Allocate static OPPs (As per 'v2' DT bindings)
* @opp_table: OPP table
@@ -296,6 +360,10 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev,
goto free_opp;
}
+ ret = _parse_domain_opp(new_opp, opp_table, dev, np);
+ if (ret)
+ goto free_opp;
+
/*
* Rate is defined as an unsigned long in clk API, and so casting
* explicitly to its type. Must be fixed once rate is 64 bit
@@ -375,6 +443,15 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np)
if (!opp_table)
return -ENOMEM;
+ /*
+ * Only devices with parent power-domains can have "power-domain-opp"
+ * property.
+ */
+ if (of_find_property(dev->of_node, "power-domains", NULL)) {
+ opp_table->has_domain = true;
+ opp_table->has_domain_opp = -1;
+ }
+
/* We have opp-table node now, iterate over it and add OPPs */
for_each_available_child_of_node(opp_np, np) {
count++;
diff --git a/drivers/base/power/opp/opp.h b/drivers/base/power/opp/opp.h
index 166eef990599..5350eb4eedd0 100644
--- a/drivers/base/power/opp/opp.h
+++ b/drivers/base/power/opp/opp.h
@@ -20,6 +20,7 @@
#include <linux/list.h>
#include <linux/limits.h>
#include <linux/pm_opp.h>
+#include <linux/pm_qos.h>
#include <linux/notifier.h>
struct clk;
@@ -59,6 +60,7 @@ extern struct list_head opp_tables;
* @turbo: true if turbo (boost) OPP
* @suspend: true if suspend OPP
* @rate: Frequency in hertz
+ * @domain_rate: Copy of domain's rate
* @supplies: Power supplies voltage/current values
* @clock_latency_ns: Latency (in nanoseconds) of switching to this OPP's
* frequency from any other OPP's frequency.
@@ -77,6 +79,7 @@ struct dev_pm_opp {
bool turbo;
bool suspend;
unsigned long rate;
+ int domain_rate;
struct dev_pm_opp_supply *supplies;
@@ -137,6 +140,11 @@ enum opp_table_access {
* @regulator_count: Number of power supply regulators
* @set_opp: Platform specific set_opp callback
* @set_opp_data: Data to be passed to set_opp callback
+ * @has_domain: True if the device node contains "power-domain" property
+ * @has_domain_opp: Can have value of 0, 1 or -1. -1 means uninitialized state,
+ * 0 means that OPP nodes don't have "power-domain-opp" property and 1 means
+ * that OPP nodes have it.
+ * @qos_request: Qos request.
* @dentry: debugfs dentry pointer of the real device directory (not links).
* @dentry_name: Name of the real dentry.
*
@@ -174,6 +182,10 @@ struct opp_table {
int (*set_opp)(struct dev_pm_set_opp_data *data);
struct dev_pm_set_opp_data *set_opp_data;
+ bool has_domain;
+ int has_domain_opp;
+ struct dev_pm_qos_request qos_request;
+
#ifdef CONFIG_DEBUG_FS
struct dentry *dentry;
char dentry_name[NAME_MAX];
--
2.12.0.432.g71c3a4f4ba37
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web