You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
Merge branches 'pm-opp', 'pm-devfreq' and 'powercap'
Merge an operating performance points (OPP) update, devfreq updates and power capping updates for 5.17-rc1: - Update outdated OPP documentation (Tang Yizhou). - Reduce log severity for informative message regarding frequency transition failures in devfreq (Tzung-Bi Shih). - Add DRAM frequency controller devfreq driver for Allwinner sunXi SoCs (Samuel Holland). - Add missing COMMON_CLK dependency to the sun8i devfreq driver (Arnd Bergmann). - Add support for new layout of Psys PowerLimit Register on SPR to the Intel RAPL power capping driver (Zhang Rui). - Fix typo in a comment in idle_inject.c (Jason Wang). - Remove unused function definition from the DTPM (Dynamit Thermal Power Management) power capping framework (Daniel Lezcano). - Reduce DTPM trace verbosity (Daniel Lezcano). * pm-opp: Documentation: power: Update outdated contents in opp.rst * pm-devfreq: PM / devfreq: Reduce log severity for informative message PM / devfreq: sun8i: addd COMMON_CLK dependency PM / devfreq: Add a driver for the sun8i/sun50i MBUS * powercap: powercap/drivers/dtpm: Reduce trace verbosity powercap/drivers/dtpm: Remove unused function definition powercap: fix typo in a comment in idle_inject.c powercap: intel_rapl: support new layout of Psys PowerLimit Register on SPR
This commit is contained in:
@@ -48,9 +48,9 @@ We can represent these as three OPPs as the following {Hz, uV} tuples:
|
||||
OPP library provides a set of helper functions to organize and query the OPP
|
||||
information. The library is located in drivers/opp/ directory and the header
|
||||
is located in include/linux/pm_opp.h. OPP library can be enabled by enabling
|
||||
CONFIG_PM_OPP from power management menuconfig menu. OPP library depends on
|
||||
CONFIG_PM as certain SoCs such as Texas Instrument's OMAP framework allows to
|
||||
optionally boot at a certain OPP without needing cpufreq.
|
||||
CONFIG_PM_OPP from power management menuconfig menu. Certain SoCs such as Texas
|
||||
Instrument's OMAP framework allows to optionally boot at a certain OPP without
|
||||
needing cpufreq.
|
||||
|
||||
Typical usage of the OPP library is as follows::
|
||||
|
||||
@@ -75,8 +75,8 @@ operations until that OPP could be re-enabled if possible.
|
||||
|
||||
OPP library facilitates this concept in its implementation. The following
|
||||
operational functions operate only on available opps:
|
||||
opp_find_freq_{ceil, floor}, dev_pm_opp_get_voltage, dev_pm_opp_get_freq,
|
||||
dev_pm_opp_get_opp_count
|
||||
dev_pm_opp_find_freq_{ceil, floor}, dev_pm_opp_get_voltage, dev_pm_opp_get_freq,
|
||||
dev_pm_opp_get_opp_count.
|
||||
|
||||
dev_pm_opp_find_freq_exact is meant to be used to find the opp pointer
|
||||
which can then be used for dev_pm_opp_enable/disable functions to make an
|
||||
@@ -103,7 +103,7 @@ dev_pm_opp_add
|
||||
The OPP is defined using the frequency and voltage. Once added, the OPP
|
||||
is assumed to be available and control of its availability can be done
|
||||
with the dev_pm_opp_enable/disable functions. OPP library
|
||||
internally stores and manages this information in the opp struct.
|
||||
internally stores and manages this information in the dev_pm_opp struct.
|
||||
This function may be used by SoC framework to define a optimal list
|
||||
as per the demands of SoC usage environment.
|
||||
|
||||
@@ -247,7 +247,7 @@ dev_pm_opp_disable
|
||||
5. OPP Data Retrieval Functions
|
||||
===============================
|
||||
Since OPP library abstracts away the OPP information, a set of functions to pull
|
||||
information from the OPP structure is necessary. Once an OPP pointer is
|
||||
information from the dev_pm_opp structure is necessary. Once an OPP pointer is
|
||||
retrieved using the search functions, the following functions can be used by SoC
|
||||
framework to retrieve the information represented inside the OPP layer.
|
||||
|
||||
|
||||
@@ -132,6 +132,15 @@ config ARM_RK3399_DMC_DEVFREQ
|
||||
It sets the frequency for the memory controller and reads the usage counts
|
||||
from hardware.
|
||||
|
||||
config ARM_SUN8I_A33_MBUS_DEVFREQ
|
||||
tristate "sun8i/sun50i MBUS DEVFREQ Driver"
|
||||
depends on ARCH_SUNXI || COMPILE_TEST
|
||||
depends on COMMON_CLK
|
||||
select DEVFREQ_GOV_SIMPLE_ONDEMAND
|
||||
help
|
||||
This adds the DEVFREQ driver for the MBUS controller in some
|
||||
Allwinner sun8i (A33 through H3) and sun50i (A64 and H5) SoCs.
|
||||
|
||||
source "drivers/devfreq/event/Kconfig"
|
||||
|
||||
endif # PM_DEVFREQ
|
||||
|
||||
@@ -12,6 +12,7 @@ obj-$(CONFIG_ARM_EXYNOS_BUS_DEVFREQ) += exynos-bus.o
|
||||
obj-$(CONFIG_ARM_IMX_BUS_DEVFREQ) += imx-bus.o
|
||||
obj-$(CONFIG_ARM_IMX8M_DDRC_DEVFREQ) += imx8m-ddrc.o
|
||||
obj-$(CONFIG_ARM_RK3399_DMC_DEVFREQ) += rk3399_dmc.o
|
||||
obj-$(CONFIG_ARM_SUN8I_A33_MBUS_DEVFREQ) += sun8i-a33-mbus.o
|
||||
obj-$(CONFIG_ARM_TEGRA_DEVFREQ) += tegra30-devfreq.o
|
||||
|
||||
# DEVFREQ Event Drivers
|
||||
|
||||
@@ -382,8 +382,8 @@ static int devfreq_set_target(struct devfreq *devfreq, unsigned long new_freq,
|
||||
devfreq_notify_transition(devfreq, &freqs, DEVFREQ_POSTCHANGE);
|
||||
|
||||
if (devfreq_update_status(devfreq, new_freq))
|
||||
dev_err(&devfreq->dev,
|
||||
"Couldn't update frequency transition information.\n");
|
||||
dev_warn(&devfreq->dev,
|
||||
"Couldn't update frequency transition information.\n");
|
||||
|
||||
devfreq->previous_freq = new_freq;
|
||||
|
||||
|
||||
511
drivers/devfreq/sun8i-a33-mbus.c
Normal file
511
drivers/devfreq/sun8i-a33-mbus.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -382,7 +382,7 @@ void dtpm_unregister(struct dtpm *dtpm)
|
||||
{
|
||||
powercap_unregister_zone(pct, &dtpm->zone);
|
||||
|
||||
pr_info("Unregistered dtpm node '%s'\n", dtpm->zone.name);
|
||||
pr_debug("Unregistered dtpm node '%s'\n", dtpm->zone.name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -453,8 +453,8 @@ int dtpm_register(const char *name, struct dtpm *dtpm, struct dtpm *parent)
|
||||
dtpm->power_limit = dtpm->power_max;
|
||||
}
|
||||
|
||||
pr_info("Registered dtpm node '%s' / %llu-%llu uW, \n",
|
||||
dtpm->zone.name, dtpm->power_min, dtpm->power_max);
|
||||
pr_debug("Registered dtpm node '%s' / %llu-%llu uW, \n",
|
||||
dtpm->zone.name, dtpm->power_min, dtpm->power_max);
|
||||
|
||||
mutex_unlock(&dtpm_lock);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*
|
||||
* All of the kthreads used for idle injection are created at init time.
|
||||
*
|
||||
* Next, the users of the the idle injection framework provide a cpumask via
|
||||
* Next, the users of the idle injection framework provide a cpumask via
|
||||
* its register function. The kthreads will be synchronized with respect to
|
||||
* this cpumask.
|
||||
*
|
||||
|
||||
@@ -61,6 +61,20 @@
|
||||
#define PERF_STATUS_THROTTLE_TIME_MASK 0xffffffff
|
||||
#define PP_POLICY_MASK 0x1F
|
||||
|
||||
/*
|
||||
* SPR has different layout for Psys Domain PowerLimit registers.
|
||||
* There are 17 bits of PL1 and PL2 instead of 15 bits.
|
||||
* The Enable bits and TimeWindow bits are also shifted as a result.
|
||||
*/
|
||||
#define PSYS_POWER_LIMIT1_MASK 0x1FFFF
|
||||
#define PSYS_POWER_LIMIT1_ENABLE BIT(17)
|
||||
|
||||
#define PSYS_POWER_LIMIT2_MASK (0x1FFFFULL<<32)
|
||||
#define PSYS_POWER_LIMIT2_ENABLE BIT_ULL(49)
|
||||
|
||||
#define PSYS_TIME_WINDOW1_MASK (0x7FULL<<19)
|
||||
#define PSYS_TIME_WINDOW2_MASK (0x7FULL<<51)
|
||||
|
||||
/* Non HW constants */
|
||||
#define RAPL_PRIMITIVE_DERIVED BIT(1) /* not from raw data */
|
||||
#define RAPL_PRIMITIVE_DUMMY BIT(2)
|
||||
@@ -97,6 +111,7 @@ struct rapl_defaults {
|
||||
bool to_raw);
|
||||
unsigned int dram_domain_energy_unit;
|
||||
unsigned int psys_domain_energy_unit;
|
||||
bool spr_psys_bits;
|
||||
};
|
||||
static struct rapl_defaults *rapl_defaults;
|
||||
|
||||
@@ -669,12 +684,51 @@ static struct rapl_primitive_info rpi[] = {
|
||||
RAPL_DOMAIN_REG_PERF, TIME_UNIT, 0),
|
||||
PRIMITIVE_INFO_INIT(PRIORITY_LEVEL, PP_POLICY_MASK, 0,
|
||||
RAPL_DOMAIN_REG_POLICY, ARBITRARY_UNIT, 0),
|
||||
PRIMITIVE_INFO_INIT(PSYS_POWER_LIMIT1, PSYS_POWER_LIMIT1_MASK, 0,
|
||||
RAPL_DOMAIN_REG_LIMIT, POWER_UNIT, 0),
|
||||
PRIMITIVE_INFO_INIT(PSYS_POWER_LIMIT2, PSYS_POWER_LIMIT2_MASK, 32,
|
||||
RAPL_DOMAIN_REG_LIMIT, POWER_UNIT, 0),
|
||||
PRIMITIVE_INFO_INIT(PSYS_PL1_ENABLE, PSYS_POWER_LIMIT1_ENABLE, 17,
|
||||
RAPL_DOMAIN_REG_LIMIT, ARBITRARY_UNIT, 0),
|
||||
PRIMITIVE_INFO_INIT(PSYS_PL2_ENABLE, PSYS_POWER_LIMIT2_ENABLE, 49,
|
||||
RAPL_DOMAIN_REG_LIMIT, ARBITRARY_UNIT, 0),
|
||||
PRIMITIVE_INFO_INIT(PSYS_TIME_WINDOW1, PSYS_TIME_WINDOW1_MASK, 19,
|
||||
RAPL_DOMAIN_REG_LIMIT, TIME_UNIT, 0),
|
||||
PRIMITIVE_INFO_INIT(PSYS_TIME_WINDOW2, PSYS_TIME_WINDOW2_MASK, 51,
|
||||
RAPL_DOMAIN_REG_LIMIT, TIME_UNIT, 0),
|
||||
/* non-hardware */
|
||||
PRIMITIVE_INFO_INIT(AVERAGE_POWER, 0, 0, 0, POWER_UNIT,
|
||||
RAPL_PRIMITIVE_DERIVED),
|
||||
{NULL, 0, 0, 0},
|
||||
};
|
||||
|
||||
static enum rapl_primitives
|
||||
prim_fixups(struct rapl_domain *rd, enum rapl_primitives prim)
|
||||
{
|
||||
if (!rapl_defaults->spr_psys_bits)
|
||||
return prim;
|
||||
|
||||
if (rd->id != RAPL_DOMAIN_PLATFORM)
|
||||
return prim;
|
||||
|
||||
switch (prim) {
|
||||
case POWER_LIMIT1:
|
||||
return PSYS_POWER_LIMIT1;
|
||||
case POWER_LIMIT2:
|
||||
return PSYS_POWER_LIMIT2;
|
||||
case PL1_ENABLE:
|
||||
return PSYS_PL1_ENABLE;
|
||||
case PL2_ENABLE:
|
||||
return PSYS_PL2_ENABLE;
|
||||
case TIME_WINDOW1:
|
||||
return PSYS_TIME_WINDOW1;
|
||||
case TIME_WINDOW2:
|
||||
return PSYS_TIME_WINDOW2;
|
||||
default:
|
||||
return prim;
|
||||
}
|
||||
}
|
||||
|
||||
/* Read primitive data based on its related struct rapl_primitive_info.
|
||||
* if xlate flag is set, return translated data based on data units, i.e.
|
||||
* time, energy, and power.
|
||||
@@ -692,7 +746,8 @@ static int rapl_read_data_raw(struct rapl_domain *rd,
|
||||
enum rapl_primitives prim, bool xlate, u64 *data)
|
||||
{
|
||||
u64 value;
|
||||
struct rapl_primitive_info *rp = &rpi[prim];
|
||||
enum rapl_primitives prim_fixed = prim_fixups(rd, prim);
|
||||
struct rapl_primitive_info *rp = &rpi[prim_fixed];
|
||||
struct reg_action ra;
|
||||
int cpu;
|
||||
|
||||
@@ -738,7 +793,8 @@ static int rapl_write_data_raw(struct rapl_domain *rd,
|
||||
enum rapl_primitives prim,
|
||||
unsigned long long value)
|
||||
{
|
||||
struct rapl_primitive_info *rp = &rpi[prim];
|
||||
enum rapl_primitives prim_fixed = prim_fixups(rd, prim);
|
||||
struct rapl_primitive_info *rp = &rpi[prim_fixed];
|
||||
int cpu;
|
||||
u64 bits;
|
||||
struct reg_action ra;
|
||||
@@ -981,6 +1037,7 @@ static const struct rapl_defaults rapl_defaults_spr_server = {
|
||||
.compute_time_window = rapl_compute_time_window_core,
|
||||
.dram_domain_energy_unit = 15300,
|
||||
.psys_domain_energy_unit = 1000000000,
|
||||
.spr_psys_bits = true,
|
||||
};
|
||||
|
||||
static const struct rapl_defaults rapl_defaults_byt = {
|
||||
|
||||
@@ -70,6 +70,4 @@ void dtpm_unregister(struct dtpm *dtpm);
|
||||
|
||||
int dtpm_register(const char *name, struct dtpm *dtpm, struct dtpm *parent);
|
||||
|
||||
int dtpm_register_cpu(struct dtpm *parent);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -58,6 +58,12 @@ enum rapl_primitives {
|
||||
THROTTLED_TIME,
|
||||
PRIORITY_LEVEL,
|
||||
|
||||
PSYS_POWER_LIMIT1,
|
||||
PSYS_POWER_LIMIT2,
|
||||
PSYS_PL1_ENABLE,
|
||||
PSYS_PL2_ENABLE,
|
||||
PSYS_TIME_WINDOW1,
|
||||
PSYS_TIME_WINDOW2,
|
||||
/* below are not raw primitive data */
|
||||
AVERAGE_POWER,
|
||||
NR_RAPL_PRIMITIVES,
|
||||
|
||||
Reference in New Issue
Block a user