Skip to content

Commit

Permalink
Merge tag 'opp-updates-6.9' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/vireshk/pm into pm

Merge OPP (operating performance points) updates for 6.9 from Viresh
Kumar:

"- Fix couple of warnings related to W=1 builds. (Viresh Kumar).
 - Move Move dev_pm_opp_{init|free}_cpufreq_table() to pm_opp.h (Viresh Kumar).
 - Extend dev_pm_opp_data with turbo support (Sibi Sankar).
 - dt-bindings: drop maxItems from inner items (David Heidelberg)."

* tag 'opp-updates-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm:
  dt-bindings: opp: drop maxItems from inner items
  OPP: debugfs: Fix warning around icc_get_name()
  OPP: debugfs: Fix warning with W=1 builds
  cpufreq: Move dev_pm_opp_{init|free}_cpufreq_table() to pm_opp.h
  OPP: Extend dev_pm_opp_data with turbo support
  • Loading branch information
Rafael J. Wysocki committed Mar 11, 2024
2 parents 3bd8346 + 13c8cf3 commit 866b554
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 28 deletions.
2 changes: 0 additions & 2 deletions Documentation/devicetree/bindings/opp/opp-v2-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ patternProperties:
specific binding.
minItems: 1
maxItems: 32
items:
maxItems: 1

opp-microvolt:
description: |
Expand Down
1 change: 1 addition & 0 deletions drivers/opp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2065,6 +2065,7 @@ int _opp_add_v1(struct opp_table *opp_table, struct device *dev,
/* populate the opp table */
new_opp->rates[0] = data->freq;
new_opp->level = data->level;
new_opp->turbo = data->turbo;
tol = u_volt * opp_table->voltage_tolerance_v1 / 100;
new_opp->supplies[0].u_volt = u_volt;
new_opp->supplies[0].u_volt_min = u_volt - tol;
Expand Down
14 changes: 8 additions & 6 deletions drivers/opp/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ static ssize_t bw_name_read(struct file *fp, char __user *userbuf,
size_t count, loff_t *ppos)
{
struct icc_path *path = fp->private_data;
const char *name = icc_get_name(path);
char buf[64];
int i;
int i = 0;

i = scnprintf(buf, sizeof(buf), "%.62s\n", icc_get_name(path));
if (name)
i = scnprintf(buf, sizeof(buf), "%.62s\n", name);

return simple_read_from_buffer(userbuf, count, ppos, buf, i);
}
Expand All @@ -56,11 +58,11 @@ static void opp_debug_create_bw(struct dev_pm_opp *opp,
struct dentry *pdentry)
{
struct dentry *d;
char name[20];
char name[] = "icc-path-XXXXXXXXXXX"; /* Integers can take 11 chars max */
int i;

for (i = 0; i < opp_table->path_count; i++) {
snprintf(name, sizeof(name), "icc-path-%.1d", i);
snprintf(name, sizeof(name), "icc-path-%d", i);

/* Create per-path directory */
d = debugfs_create_dir(name, pdentry);
Expand All @@ -78,7 +80,7 @@ static void opp_debug_create_clks(struct dev_pm_opp *opp,
struct opp_table *opp_table,
struct dentry *pdentry)
{
char name[12];
char name[] = "rate_hz_XXXXXXXXXXX"; /* Integers can take 11 chars max */
int i;

if (opp_table->clk_count == 1) {
Expand All @@ -100,7 +102,7 @@ static void opp_debug_create_supplies(struct dev_pm_opp *opp,
int i;

for (i = 0; i < opp_table->regulator_count; i++) {
char name[15];
char name[] = "supply-XXXXXXXXXXX"; /* Integers can take 11 chars max */

snprintf(name, sizeof(name), "supply-%d", i);

Expand Down
20 changes: 0 additions & 20 deletions include/linux/cpufreq.h
Original file line number Diff line number Diff line change
Expand Up @@ -693,26 +693,6 @@ struct cpufreq_frequency_table {
* order */
};

#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
int dev_pm_opp_init_cpufreq_table(struct device *dev,
struct cpufreq_frequency_table **table);
void dev_pm_opp_free_cpufreq_table(struct device *dev,
struct cpufreq_frequency_table **table);
#else
static inline int dev_pm_opp_init_cpufreq_table(struct device *dev,
struct cpufreq_frequency_table
**table)
{
return -EINVAL;
}

static inline void dev_pm_opp_free_cpufreq_table(struct device *dev,
struct cpufreq_frequency_table
**table)
{
}
#endif

/*
* cpufreq_for_each_entry - iterate over a cpufreq_frequency_table
* @pos: the cpufreq_frequency_table * to use as a loop cursor.
Expand Down
18 changes: 18 additions & 0 deletions include/linux/pm_opp.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/notifier.h>

struct clk;
struct cpufreq_frequency_table;
struct regulator;
struct dev_pm_opp;
struct device;
Expand Down Expand Up @@ -87,12 +88,14 @@ struct dev_pm_opp_config {

/**
* struct dev_pm_opp_data - The data to use to initialize an OPP.
* @turbo: Flag to indicate whether the OPP is to be marked turbo or not.
* @level: The performance level for the OPP. Set level to OPP_LEVEL_UNSET if
* level field isn't used.
* @freq: The clock rate in Hz for the OPP.
* @u_volt: The voltage in uV for the OPP.
*/
struct dev_pm_opp_data {
bool turbo;
unsigned int level;
unsigned long freq;
unsigned long u_volt;
Expand Down Expand Up @@ -444,6 +447,21 @@ static inline int dev_pm_opp_sync_regulators(struct device *dev)

#endif /* CONFIG_PM_OPP */

#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
int dev_pm_opp_init_cpufreq_table(struct device *dev, struct cpufreq_frequency_table **table);
void dev_pm_opp_free_cpufreq_table(struct device *dev, struct cpufreq_frequency_table **table);
#else
static inline int dev_pm_opp_init_cpufreq_table(struct device *dev, struct cpufreq_frequency_table **table)
{
return -EINVAL;
}

static inline void dev_pm_opp_free_cpufreq_table(struct device *dev, struct cpufreq_frequency_table **table)
{
}
#endif


#if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
int dev_pm_opp_of_add_table(struct device *dev);
int dev_pm_opp_of_add_table_indexed(struct device *dev, int index);
Expand Down

0 comments on commit 866b554

Please sign in to comment.