2019-10-28 23:32:23 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
|
|
|
|
#ifndef __CPUIDLE_PSCI_H
|
|
|
|
#define __CPUIDLE_PSCI_H
|
|
|
|
|
2020-07-07 20:58:02 +08:00
|
|
|
struct device;
|
cpuidle: psci: Add support for PM domains by using genpd
When the hierarchical CPU topology layout is used in DT and the PSCI OSI
mode is supported by the PSCI FW, let's initialize a corresponding PM
domain topology by using genpd. This enables a CPU and a group of CPUs,
when attached to the topology, to be power-managed accordingly.
To trigger the attempt to initialize the genpd data structures let's use a
subsys_initcall, which should be early enough to allow CPUs, but also other
devices to be attached.
The initialization consists of parsing the PSCI OF node for the topology
and the "domain idle states" DT bindings. In case the idle states are
compatible with "domain-idle-state", the initialized genpd becomes
responsible of selecting an idle state for the PM domain, via assigning it
a genpd governor.
Note that, a successful initialization of the genpd data structures, is
followed by a call to psci_set_osi_mode(), as to try to enable the OSI mode
in the PSCI FW. In case this fails, we fall back into a degraded mode
rather than bailing out and returning error codes.
Co-developed-by: Lina Iyer <lina.iyer@linaro.org>
Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2019-10-10 18:01:48 +08:00
|
|
|
struct device_node;
|
|
|
|
|
|
|
|
void psci_set_domain_state(u32 state);
|
2020-07-07 20:58:02 +08:00
|
|
|
int psci_dt_parse_state_node(struct device_node *np, u32 *state);
|
cpuidle: psci: Add support for PM domains by using genpd
When the hierarchical CPU topology layout is used in DT and the PSCI OSI
mode is supported by the PSCI FW, let's initialize a corresponding PM
domain topology by using genpd. This enables a CPU and a group of CPUs,
when attached to the topology, to be power-managed accordingly.
To trigger the attempt to initialize the genpd data structures let's use a
subsys_initcall, which should be early enough to allow CPUs, but also other
devices to be attached.
The initialization consists of parsing the PSCI OF node for the topology
and the "domain idle states" DT bindings. In case the idle states are
compatible with "domain-idle-state", the initialized genpd becomes
responsible of selecting an idle state for the PM domain, via assigning it
a genpd governor.
Note that, a successful initialization of the genpd data structures, is
followed by a call to psci_set_osi_mode(), as to try to enable the OSI mode
in the PSCI FW. In case this fails, we fall back into a degraded mode
rather than bailing out and returning error codes.
Co-developed-by: Lina Iyer <lina.iyer@linaro.org>
Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: Rafael J. Wysocki <rafael@kernel.org>
2019-10-10 18:01:48 +08:00
|
|
|
|
2020-07-07 20:58:00 +08:00
|
|
|
#ifdef CONFIG_ARM_PSCI_CPUIDLE_DOMAIN
|
2022-02-10 13:49:44 +08:00
|
|
|
|
|
|
|
#include "dt_idle_genpd.h"
|
|
|
|
|
|
|
|
static inline struct device *psci_dt_attach_cpu(int cpu)
|
|
|
|
{
|
|
|
|
return dt_idle_attach_cpu(cpu, "psci");
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void psci_dt_detach_cpu(struct device *dev)
|
|
|
|
{
|
|
|
|
dt_idle_detach_cpu(dev);
|
|
|
|
}
|
|
|
|
|
2019-10-28 23:32:23 +08:00
|
|
|
#else
|
2020-07-07 20:58:02 +08:00
|
|
|
static inline struct device *psci_dt_attach_cpu(int cpu) { return NULL; }
|
|
|
|
static inline void psci_dt_detach_cpu(struct device *dev) { }
|
2019-10-28 23:32:23 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __CPUIDLE_PSCI_H */
|