PM / OPP: rename to dev_pm_opp * equivalents
Subsystems (13)
Nishanth Menon
maintainercover PM / OPP: rename to dev_pm_opp * equivalents
Hi,
Based on [1], Randy rightly pointed out that OPP functions and data structures could be a bit specific to Power management.
So, the following series is based on v3.12-rc1 tag.
If folks like it broken in a different way, I am open to suggestions.
Nishanth Menon (3):
PM / OPP: rename functions to dev_pm_opp*
PM / OPP: rename data structures to dev_pm equivalents PM / OPP: rename header to linux/pm_opp.h
Documentation/power/opp.txt | 108 ++++++++++++------------ arch/arm/mach-imx/mach-imx6q.c | 4 +- arch/arm/mach-omap2/board-omap3beagle.c | 10 +-- arch/arm/mach-omap2/omap-pm.h | 2 +- arch/arm/mach-omap2/opp.c | 6 +- arch/arm/mach-omap2/pm.c | 8 +- drivers/base/power/opp.c | 115 ++++++++++++------------- drivers/cpufreq/arm_big_little.c | 8 +- drivers/cpufreq/arm_big_little_dt.c | 2 +- drivers/cpufreq/cpufreq-cpu0.c | 24 +++--- drivers/cpufreq/exynos5440-cpufreq.c | 17 ++-- drivers/cpufreq/imx6q-cpufreq.c | 26 +++--- drivers/cpufreq/omap-cpufreq.c | 12 +-- drivers/devfreq/devfreq.c | 25 +++--- drivers/devfreq/exynos/exynos4_bus.c | 29 +++---- drivers/devfreq/exynos/exynos5_bus.c | 28 +++---- include/linux/devfreq.h | 6 +- include/linux/opp.h | 134 ----------------------------- include/linux/pm_opp.h | 139 +++++++++++++++++++++++++++++++ 19 files changed, 357 insertions(+), 346 deletions(-) delete mode 100644 include/linux/opp.h create mode 100644 include/linux/pm_opp.h
Signature · 1 line
1.7.9.5
Nishanth Menon
maintainerPATCH 1/3 PM / OPP: rename functions to dev_pm_opp*
Since Operating Performance Points(OPP) functions are specific to device specific power management, be specific and rename opp_* accessors in OPP library with dev_pm_opp_* equivalent.
Impacted functions are:opp_get_voltageopp_get_freqopp_get_opp_countopp_find_freq_exactopp_find_freq_flooropp_find_freq_ceilopp_addopp_enableopp_disableopp_get_notifieropp_init_cpufreq_tableopp_free_cpufreq_table
--- Documentation/power/opp.txt | 102 +++++++++++++++---------------- arch/arm/mach-imx/mach-imx6q.c | 2 +- arch/arm/mach-omap2/board-omap3beagle.c | 8 +-- arch/arm/mach-omap2/opp.c | 4 +- arch/arm/mach-omap2/pm.c | 4 +- drivers/base/power/opp.c | 82 ++++++++++++------------- drivers/cpufreq/arm_big_little.c | 6 +- drivers/cpufreq/cpufreq-cpu0.c | 18 +++--- drivers/cpufreq/exynos5440-cpufreq.c | 13 ++-- drivers/cpufreq/imx6q-cpufreq.c | 20 +++--- drivers/cpufreq/omap-cpufreq.c | 8 +-- drivers/devfreq/devfreq.c | 14 ++--- drivers/devfreq/exynos/exynos4_bus.c | 21 ++++--- drivers/devfreq/exynos/exynos5_bus.c | 18 +++--- include/linux/opp.h | 50 +++++++-------- 15 files changed, 187 insertions(+), 183 deletions(-)
Documentation/power/opp.txt +51 -51
@@ -71,14 +71,14 @@ operations until that OPP could be re-enabled if possible. OPP library facilitates this concept in it's implementation. The following operational functions operate only on available opps: -opp_find_freq_{ceil, floor}, opp_get_voltage, opp_get_freq, opp_get_opp_count -and opp_init_cpufreq_table +opp_find_freq_{ceil, floor}, dev_pm_opp_get_voltage, dev_pm_opp_get_freq, dev_pm_opp_get_opp_count +and dev_pm_opp_init_cpufreq_table -opp_find_freq_exact is meant to be used to find the opp pointer which can then -be used for opp_enable/disable functions to make an opp available as required. +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 opp available as required. WARNING: Users of OPP library should refresh their availability count using -get_opp_count if opp_enable/disable functions are invoked for a device, the +get_opp_count if dev_pm_opp_enable/disable functions are invoked for a device, the exact mechanism to trigger these or the notification mechanism to other dependent subsystems such as cpufreq are left to the discretion of the SoC specific framework which uses the OPP library. Similar care needs to be taken
@@ -96,24 +96,24 @@ using RCU read locks. The opp_find_freq_{exact,ceil,floor}, opp_get_{voltage, freq, opp_count} fall into this category. opp_{add,enable,disable} are updaters which use mutex and implement it's own -RCU locking mechanisms. opp_init_cpufreq_table acts as an updater and uses +RCU locking mechanisms. dev_pm_opp_init_cpufreq_table acts as an updater and uses mutex to implment RCU updater strategy. These functions should *NOT* be called under RCU locks and other contexts that prevent blocking functions in RCU or mutex operations from working. 2. Initial OPP List Registration ================================ -The SoC implementation calls opp_add function iteratively to add OPPs per +The SoC implementation calls dev_pm_opp_add function iteratively to add OPPs per device. It is expected that the SoC framework will register the OPP entries optimally- typical numbers range to be less than 5. The list generated by registering the OPPs is maintained by OPP library throughout the device operation. The SoC framework can subsequently control the availability of the -OPPs dynamically using the opp_enable / disable functions. +OPPs dynamically using the dev_pm_opp_enable / disable functions. -opp_add - Add a new OPP for a specific domain represented by the device pointer. +dev_pm_opp_add - Add a new OPP for a specific domain represented by the device pointer. The OPP is defined using the frequency and voltage. Once added, the OPP is assumed to be available and control of it's availability can be done - with the opp_enable/disable functions. OPP library internally stores + with the dev_pm_opp_enable/disable functions. OPP library internally stores and manages this information in the opp struct. This function may be used by SoC framework to define a optimal list as per the demands of SoC usage environment.
@@ -124,7 +124,7 @@ opp_add - Add a new OPP for a specific domain represented by the device pointer. soc_pm_init() { /* Do things */ - r = opp_add(mpu_dev, 1000000, 900000); + r = dev_pm_opp_add(mpu_dev, 1000000, 900000); if (!r) { pr_err("%s: unable to register mpu opp(%d)\n", r); goto no_cpufreq;
@@ -143,44 +143,44 @@ functions return the matching pointer representing the opp if a match is found, else returns error. These errors are expected to be handled by standard error checks such as IS_ERR() and appropriate actions taken by the caller. -opp_find_freq_exact - Search for an OPP based on an *exact* frequency and +dev_pm_opp_find_freq_exact - Search for an OPP based on an *exact* frequency and availability. This function is especially useful to enable an OPP which is not available by default. Example: In a case when SoC framework detects a situation where a higher frequency could be made available, it can use this function to - find the OPP prior to call the opp_enable to actually make it available. + find the OPP prior to call the dev_pm_opp_enable to actually make it available. rcu_read_lock(); - opp = opp_find_freq_exact(dev, 1000000000, false); + opp = dev_pm_opp_find_freq_exact(dev, 1000000000, false); rcu_read_unlock(); /* dont operate on the pointer.. just do a sanity check.. */ if (IS_ERR(opp)) { pr_err("frequency not disabled!\n"); /* trigger appropriate actions.. */ } else { - opp_enable(dev,1000000000); + dev_pm_opp_enable(dev,1000000000); } NOTE: This is the only search function that operates on OPPs which are not available. -opp_find_freq_floor - Search for an available OPP which is *at most* the +dev_pm_opp_find_freq_floor - Search for an available OPP which is *at most* the provided frequency. This function is useful while searching for a lesser match OR operating on OPP information in the order of decreasing frequency. Example: To find the highest opp for a device: freq = ULONG_MAX; rcu_read_lock(); - opp_find_freq_floor(dev, &freq); + dev_pm_opp_find_freq_floor(dev, &freq); rcu_read_unlock(); -opp_find_freq_ceil - Search for an available OPP which is *at least* the +dev_pm_opp_find_freq_ceil - Search for an available OPP which is *at least* the provided frequency. This function is useful while searching for a higher match OR operating on OPP information in the order of increasing frequency. Example 1: To find the lowest opp for a device: freq = 0; rcu_read_lock(); - opp_find_freq_ceil(dev, &freq); + dev_pm_opp_find_freq_ceil(dev, &freq); rcu_read_unlock(); Example 2: A simplified implementation of a SoC cpufreq_driver->target: soc_cpufreq_target(..)
@@ -188,7 +188,7 @@ opp_find_freq_ceil - Search for an available OPP which is *at least* the /* Do stuff like policy checks etc. */ /* Find the best frequency match for the req */ rcu_read_lock(); - opp = opp_find_freq_ceil(dev, &freq); + opp = dev_pm_opp_find_freq_ceil(dev, &freq); rcu_read_unlock(); if (!IS_ERR(opp)) soc_switch_to_freq_voltage(freq);
@@ -208,34 +208,34 @@ as thermal considerations (e.g. don't use OPPx until the temperature drops). WARNING: Do not use these functions in interrupt context. -opp_enable - Make a OPP available for operation. +dev_pm_opp_enable - Make a OPP available for operation. Example: Lets say that 1GHz OPP is to be made available only if the SoC temperature is lower than a certain threshold. The SoC framework implementation might choose to do something as follows: if (cur_temp < temp_low_thresh) { /* Enable 1GHz if it was disabled */ rcu_read_lock(); - opp = opp_find_freq_exact(dev, 1000000000, false); + opp = dev_pm_opp_find_freq_exact(dev, 1000000000, false); rcu_read_unlock(); /* just error check */ if (!IS_ERR(opp)) - ret = opp_enable(dev, 1000000000); + ret = dev_pm_opp_enable(dev, 1000000000); else goto try_something_else; } -opp_disable - Make an OPP to be not available for operation +dev_pm_opp_disable - Make an OPP to be not available for operation Example: Lets say that 1GHz OPP is to be disabled if the temperature exceeds a threshold value. The SoC framework implementation might choose to do something as follows: if (cur_temp > temp_high_thresh) { /* Disable 1GHz if it was enabled */ rcu_read_lock(); - opp = opp_find_freq_exact(dev, 1000000000, true); + opp = dev_pm_opp_find_freq_exact(dev, 1000000000, true); rcu_read_unlock(); /* just error check */ if (!IS_ERR(opp)) - ret = opp_disable(dev, 1000000000); + ret = dev_pm_opp_disable(dev, 1000000000); else goto try_something_else; }
@@ -247,7 +247,7 @@ information from the 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. -opp_get_voltage - Retrieve the voltage represented by the opp pointer. +dev_pm_opp_get_voltage - Retrieve the voltage represented by the opp pointer. Example: At a cpufreq transition to a different frequency, SoC framework requires to set the voltage represented by the OPP using the regulator framework to the Power Management chip providing the
@@ -256,15 +256,15 @@ opp_get_voltage - Retrieve the voltage represented by the opp pointer. { /* do things */ rcu_read_lock(); - opp = opp_find_freq_ceil(dev, &freq); - v = opp_get_voltage(opp); + opp = dev_pm_opp_find_freq_ceil(dev, &freq); + v = dev_pm_opp_get_voltage(opp); rcu_read_unlock(); if (v) regulator_set_voltage(.., v); /* do other things */ } -opp_get_freq - Retrieve the freq represented by the opp pointer. +dev_pm_opp_get_freq - Retrieve the freq represented by the opp pointer. Example: Lets say the SoC framework uses a couple of helper functions we could pass opp pointers instead of doing additional parameters to handle quiet a bit of data parameters.
@@ -273,8 +273,8 @@ opp_get_freq - Retrieve the freq represented by the opp pointer. /* do things.. */ max_freq = ULONG_MAX; rcu_read_lock(); - max_opp = opp_find_freq_floor(dev,&max_freq); - requested_opp = opp_find_freq_ceil(dev,&freq); + max_opp = dev_pm_opp_find_freq_floor(dev,&max_freq); + requested_opp = dev_pm_opp_find_freq_ceil(dev,&freq); if (!IS_ERR(max_opp) && !IS_ERR(requested_opp)) r = soc_test_validity(max_opp, requested_opp); rcu_read_unlock();
@@ -282,25 +282,25 @@ opp_get_freq - Retrieve the freq represented by the opp pointer. } soc_test_validity(..) { - if(opp_get_voltage(max_opp) < opp_get_voltage(requested_opp)) + if(dev_pm_opp_get_voltage(max_opp) < dev_pm_opp_get_voltage(requested_opp)) return -EINVAL; - if(opp_get_freq(max_opp) < opp_get_freq(requested_opp)) + if(dev_pm_opp_get_freq(max_opp) < dev_pm_opp_get_freq(requested_opp)) return -EINVAL; /* do things.. */ } -opp_get_opp_count - Retrieve the number of available opps for a device +dev_pm_opp_get_opp_count - Retrieve the number of available opps for a device Example: Lets say a co-processor in the SoC needs to know the available frequencies in a table, the main processor can notify as following: soc_notify_coproc_available_frequencies() { /* Do things */ rcu_read_lock(); - num_available = opp_get_opp_count(dev); + num_available = dev_pm_opp_get_opp_count(dev); speeds = kzalloc(sizeof(u32) * num_available, GFP_KERNEL); /* populate the table in increasing order */ freq = 0; - while (!IS_ERR(opp = opp_find_freq_ceil(dev, &freq))) { + while (!IS_ERR(opp = dev_pm_opp_find_freq_ceil(dev, &freq))) { speeds[i] = freq; freq++; i++;
@@ -313,7 +313,7 @@ opp_get_opp_count - Retrieve the number of available opps for a device 6. Cpufreq Table Generation =========================== -opp_init_cpufreq_table - cpufreq framework typically is initialized with +dev_pm_opp_init_cpufreq_table - cpufreq framework typically is initialized with cpufreq_frequency_table_cpuinfo which is provided with the list of frequencies that are available for operation. This function provides a ready to use conversion routine to translate the OPP layer's internal
@@ -326,7 +326,7 @@ opp_init_cpufreq_table - cpufreq framework typically is initialized with soc_pm_init() { /* Do things */ - r = opp_init_cpufreq_table(dev, &freq_table); + r = dev_pm_opp_init_cpufreq_table(dev, &freq_table); if (!r) cpufreq_frequency_table_cpuinfo(policy, freq_table); /* Do other things */
@@ -336,7 +336,7 @@ opp_init_cpufreq_table - cpufreq framework typically is initialized with addition to CONFIG_PM as power management feature is required to dynamically scale voltage and frequency in a system. -opp_free_cpufreq_table - Free up the table allocated by opp_init_cpufreq_table +dev_pm_opp_free_cpufreq_table - Free up the table allocated by dev_pm_opp_init_cpufreq_table 7. Data Structures ==================
@@ -366,8 +366,8 @@ struct opp - The internal data structure of OPP library which is used to identifier for OPP in the interactions with OPP layer. WARNING: The struct opp pointer should not be parsed or modified by the - users. The defaults of for an instance is populated by opp_add, but the - availability of the OPP can be modified by opp_enable/disable functions. + users. The defaults of for an instance is populated by dev_pm_opp_add, but the + availability of the OPP can be modified by dev_pm_opp_enable/disable functions. struct device - This is used to identify a domain to the OPP layer. The nature of the device and it's implementation is left to the user of
@@ -377,19 +377,19 @@ Overall, in a simplistic view, the data structure operations is represented as following: Initialization / modification: - +-----+ /- opp_enable -opp_add --> | opp | <------- - | +-----+ \- opp_disable + +-----+ /- dev_pm_opp_enable +dev_pm_opp_add --> | opp | <------- + | +-----+ \- dev_pm_opp_disable \-------> domain_info(device) Search functions: - /-- opp_find_freq_ceil ---\ +-----+ -domain_info<---- opp_find_freq_exact -----> | opp | - \-- opp_find_freq_floor ---/ +-----+ + /-- dev_pm_opp_find_freq_ceil ---\ +-----+ +domain_info<---- dev_pm_opp_find_freq_exact -----> | opp | + \-- dev_pm_opp_find_freq_floor ---/ +-----+ Retrieval functions: -+-----+ /- opp_get_voltage ++-----+ /- dev_pm_opp_get_voltage | opp | <--- -+-----+ \- opp_get_freq ++-----+ \- dev_pm_opp_get_freq -domain_info <- opp_get_opp_count +domain_info <- dev_pm_opp_get_opp_count
arch/arm/mach-imx/mach-imx6q.c +1 -1
@@ -226,7 +226,7 @@ static void __init imx6q_opp_check_1p2ghz(struct device *cpu_dev) val =readl_relaxed (base +OCOTP_CFG3 ); val >>=OCOTP_CFG3_SPEED_SHIFT ;if ((val &0x3 ) !=OCOTP_CFG3_SPEED_1P2GHZ ) -if (opp_disable (cpu_dev,1200000000 )) +if (dev_pm_opp_disable (cpu_dev,1200000000 ))pr_warn ("failed to disable 1.2 GHz OPP\n" ); put_node:
arch/arm/mach-omap2/board-omap3beagle.c +4 -4
@@ -522,11 +522,11 @@ static int __init beagle_opp_init(void)return -ENODEV ; }/* Enable MPU 1GHz and lower opps */ - r =opp_enable (mpu_dev,800000000 ); + r =dev_pm_opp_enable (mpu_dev,800000000 );/* TODO: MPU 1GHz needs SR and ABB */ /* Enable IVA 800MHz and lower opps */ - r |=opp_enable (iva_dev,660000000 ); + r |=dev_pm_opp_enable (iva_dev,660000000 );/* TODO: DSP 800MHz needs SR and ABB */ if (r) { pr_err("%s: failed to enable higher opp %d\n",
@@ -535,8 +535,8 @@ static int __init beagle_opp_init(void)* Cleanup - disable the higher freqs - we dont care * about the results */ -opp_disable (mpu_dev,800000000 ); -opp_disable (iva_dev,660000000 ); +dev_pm_opp_disable (mpu_dev,800000000 ); +dev_pm_opp_disable (iva_dev,660000000 ); } }return 0 ;
arch/arm/mach-omap2/opp.c +2 -2
@@ -81,14 +81,14 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def, dev = &oh->od->pdev->dev; } - r =opp_add (dev, opp_def->freq, opp_def->u_volt); + r =dev_pm_opp_add (dev, opp_def->freq, opp_def->u_volt);if (r) {dev_err (dev,"%s: add OPP %ld failed for %s [%d] result=%d\n" , __func__, opp_def->freq, opp_def->hwmod_name, i, r); }else {if (!opp_def->default_available) - r =opp_disable (dev, opp_def->freq); + r =dev_pm_opp_disable (dev, opp_def->freq);if (r) dev_err(dev, "%s: disable %ld failed for %s [%d] result=%d\n", __func__, opp_def->freq,
arch/arm/mach-omap2/pm.c +2 -2
@@ -172,7 +172,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,clk_put (clk);rcu_read_lock (); - opp =opp_find_freq_ceil (dev, &freq); + opp =dev_pm_opp_find_freq_ceil (dev, &freq);if (IS_ERR (opp)) {rcu_read_unlock (); pr_err("%s: unable to find boot up OPP for vdd_%s\n",
@@ -180,7 +180,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, goto exit; } - bootup_volt =opp_get_voltage (opp); + bootup_volt =dev_pm_opp_get_voltage (opp);rcu_read_unlock ();if (!bootup_volt) { pr_err("%s: unable to find voltage corresponding to the bootup OPP for vdd_%s\n",
drivers/base/power/opp.c +41 -41
271 lines not on this page · raw message
drivers/cpufreq/arm_big_little.c +3 -3
@@ -98,7 +98,7 @@ static void put_cluster_clk_and_freq_table(struct device *cpu_dev)if (!atomic_dec_return (&cluster_usage[cluster])) {clk_put (clk[cluster]); -opp_free_cpufreq_table (cpu_dev, &freq_table[cluster]); +dev_pm_opp_free_cpufreq_table (cpu_dev, &freq_table[cluster]);dev_dbg (cpu_dev,"%s: cluster: %d\n" , __func__, cluster); } }
@@ -119,7 +119,7 @@ static int get_cluster_clk_and_freq_table(struct device *cpu_dev) goto atomic_dec; } - ret =opp_init_cpufreq_table (cpu_dev, &freq_table[cluster]); + ret =dev_pm_opp_init_cpufreq_table (cpu_dev, &freq_table[cluster]);if (ret) {dev_err (cpu_dev,"%s: failed to init cpufreq table, cpu: %d, err: %d\n" , __func__, cpu_dev->id, ret);
@@ -138,7 +138,7 @@ static int get_cluster_clk_and_freq_table(struct device *cpu_dev)dev_err (cpu_dev,"%s: Failed to get clk for cpu: %d, cluster: %d\n" , __func__, cpu_dev->id, cluster); ret =PTR_ERR (clk[cluster]); -opp_free_cpufreq_table (cpu_dev, &freq_table[cluster]); +dev_pm_opp_free_cpufreq_table (cpu_dev, &freq_table[cluster]); atomic_dec:atomic_dec (&cluster_usage[cluster]);
drivers/cpufreq/cpufreq-cpu0.c +9 -9
@@ -71,7 +71,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,if (!IS_ERR (cpu_reg)) {rcu_read_lock (); - opp =opp_find_freq_ceil (cpu_dev, &freq_Hz); + opp =dev_pm_opp_find_freq_ceil (cpu_dev, &freq_Hz);if (IS_ERR (opp)) {rcu_read_unlock ();pr_err ("failed to find OPP for %ld\n" , freq_Hz);
@@ -79,7 +79,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, ret =PTR_ERR (opp); goto post_notify; } - volt =opp_get_voltage (opp); + volt =dev_pm_opp_get_voltage (opp);rcu_read_unlock (); tol = volt * voltage_tolerance /100 ; volt_old =regulator_get_voltage (cpu_reg);
@@ -213,7 +213,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) goto out_put_node; } - ret =opp_init_cpufreq_table (cpu_dev, &freq_table); + ret =dev_pm_opp_init_cpufreq_table (cpu_dev, &freq_table);if (ret) {pr_err ("failed to init cpufreq table: %d\n" , ret); goto out_put_node;
@@ -237,12 +237,12 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)for (i =0 ; freq_table[i].frequency !=CPUFREQ_TABLE_END ; i++) ;rcu_read_lock (); - opp =opp_find_freq_exact (cpu_dev, + opp =dev_pm_opp_find_freq_exact (cpu_dev, freq_table[0 ].frequency *1000 , true); - min_uV =opp_get_voltage (opp); - opp =opp_find_freq_exact (cpu_dev, + min_uV =dev_pm_opp_get_voltage (opp); + opp =dev_pm_opp_find_freq_exact (cpu_dev, freq_table[i-1 ].frequency *1000 , true); - max_uV =opp_get_voltage (opp); + max_uV =dev_pm_opp_get_voltage (opp);rcu_read_unlock (); ret =regulator_set_voltage_time (cpu_reg, min_uV, max_uV);if (ret >0 )
@@ -259,7 +259,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)return 0 ; out_free_table: -opp_free_cpufreq_table (cpu_dev, &freq_table); +dev_pm_opp_free_cpufreq_table (cpu_dev, &freq_table); out_put_node:of_node_put (np);return ret;
@@ -268,7 +268,7 @@ out_put_node:static int cpu0_cpufreq_remove (struct platform_device *pdev) {cpufreq_unregister_driver (&cpu0_cpufreq_driver); -opp_free_cpufreq_table (cpu_dev, &freq_table); +dev_pm_opp_free_cpufreq_table (cpu_dev, &freq_table);return 0 ; }
drivers/cpufreq/exynos5440-cpufreq.c +7 -6
@@ -123,7 +123,7 @@ static int init_div_table(void)rcu_read_lock ();for (i =0 ; freq_tbl[i].frequency !=CPUFREQ_TABLE_END ; i++) { - opp =opp_find_freq_exact (dvfs_info->dev, + opp =dev_pm_opp_find_freq_exact (dvfs_info->dev, freq_tbl[i].frequency *1000 , true);if (IS_ERR (opp)) {rcu_read_unlock ();
@@ -142,7 +142,7 @@ static int init_div_table(void) << P0_7_CSCLKDEV_SHIFT;/* Calculate EMA */ - volt_id =opp_get_voltage (opp); + volt_id =dev_pm_opp_get_voltage (opp); volt_id = (MAX_VOLTAGE - volt_id) /VOLTAGE_STEP ;if (volt_id <PMIC_HIGH_VOLT ) { ema_div = (CPUEMA_HIGH << P0_7_CPUEMA_SHIFT) |
@@ -399,13 +399,14 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) goto err_put_node; } - ret =opp_init_cpufreq_table (dvfs_info->dev, &dvfs_info->freq_table); + ret =dev_pm_opp_init_cpufreq_table (dvfs_info->dev, + &dvfs_info->freq_table);if (ret) {dev_err (dvfs_info->dev,"failed to init cpufreq table: %d\n" , ret); goto err_put_node; } - dvfs_info->freq_count =opp_get_opp_count (dvfs_info->dev); + dvfs_info->freq_count =dev_pm_opp_get_opp_count (dvfs_info->dev);exynos_sort_descend_freq_table ();if (of_property_read_u32 (np,"clock-latency" , &dvfs_info->latency))
@@ -454,7 +455,7 @@ static int exynos_cpufreq_probe(struct platform_device *pdev)return 0 ; err_free_table: -opp_free_cpufreq_table (dvfs_info->dev, &dvfs_info->freq_table); +dev_pm_opp_free_cpufreq_table (dvfs_info->dev, &dvfs_info->freq_table); err_put_node:of_node_put (np);dev_err (dvfs_info->dev,"%s: failed initialization\n" , __func__);
@@ -464,7 +465,7 @@ err_put_node:static int exynos_cpufreq_remove (struct platform_device *pdev) {cpufreq_unregister_driver (&exynos_driver); -opp_free_cpufreq_table (dvfs_info->dev, &dvfs_info->freq_table); +dev_pm_opp_free_cpufreq_table (dvfs_info->dev, &dvfs_info->freq_table);return 0 ; }
drivers/cpufreq/imx6q-cpufreq.c +10 -10
@@ -69,14 +69,14 @@ static int imx6q_set_target(struct cpufreq_policy *policy,return 0 ;rcu_read_lock (); - opp =opp_find_freq_ceil (cpu_dev, &freq_hz); + opp =dev_pm_opp_find_freq_ceil (cpu_dev, &freq_hz);if (IS_ERR (opp)) {rcu_read_unlock ();dev_err (cpu_dev,"failed to find OPP for %ld\n" , freq_hz);return PTR_ERR (opp); } - volt =opp_get_voltage (opp); + volt =dev_pm_opp_get_voltage (opp);rcu_read_unlock (); volt_old =regulator_get_voltage (arm_reg);
@@ -232,14 +232,14 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) }/* We expect an OPP table supplied by platform */ - num =opp_get_opp_count (cpu_dev); + num =dev_pm_opp_get_opp_count (cpu_dev);if (num <0 ) { ret = num;dev_err (cpu_dev,"no OPP table is found: %d\n" , ret); goto put_node; } - ret =opp_init_cpufreq_table (cpu_dev, &freq_table); + ret =dev_pm_opp_init_cpufreq_table (cpu_dev, &freq_table);if (ret) {dev_err (cpu_dev,"failed to init cpufreq table: %d\n" , ret); goto put_node;
@@ -254,12 +254,12 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)* same order. */ rcu_read_lock (); - opp =opp_find_freq_exact (cpu_dev, + opp =dev_pm_opp_find_freq_exact (cpu_dev, freq_table[0 ].frequency *1000 , true); - min_volt =opp_get_voltage (opp); - opp =opp_find_freq_exact (cpu_dev, + min_volt =dev_pm_opp_get_voltage (opp); + opp =dev_pm_opp_find_freq_exact (cpu_dev, freq_table[--num].frequency *1000 , true); - max_volt =opp_get_voltage (opp); + max_volt =dev_pm_opp_get_voltage (opp);rcu_read_unlock (); ret =regulator_set_voltage_time (arm_reg, min_volt, max_volt);if (ret >0 )
@@ -287,7 +287,7 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)return 0 ; free_freq_table: -opp_free_cpufreq_table (cpu_dev, &freq_table); +dev_pm_opp_free_cpufreq_table (cpu_dev, &freq_table); put_node:of_node_put (np);return ret;
@@ -296,7 +296,7 @@ put_node:static int imx6q_cpufreq_remove (struct platform_device *pdev) {cpufreq_unregister_driver (&imx6q_cpufreq_driver); -opp_free_cpufreq_table (cpu_dev, &freq_table); +dev_pm_opp_free_cpufreq_table (cpu_dev, &freq_table);return 0 ; }
drivers/cpufreq/omap-cpufreq.c +4 -4
@@ -105,14 +105,14 @@ static int omap_target(struct cpufreq_policy *policy,if (mpu_reg) {rcu_read_lock (); - opp =opp_find_freq_ceil (mpu_dev, &freq); + opp =dev_pm_opp_find_freq_ceil (mpu_dev, &freq);if (IS_ERR (opp)) {rcu_read_unlock ();dev_err (mpu_dev,"%s: unable to find MPU OPP for %d\n" , __func__, freqs.new);return -EINVAL ; } - volt =opp_get_voltage (opp); + volt =dev_pm_opp_get_voltage (opp);rcu_read_unlock (); tol = volt *OPP_TOLERANCE /100 ; volt_old =regulator_get_voltage (mpu_reg);
@@ -162,7 +162,7 @@ done:static inline void freq_table_free (void ) {if (atomic_dec_and_test (&freq_table_users)) -opp_free_cpufreq_table (mpu_dev, &freq_table); +dev_pm_opp_free_cpufreq_table (mpu_dev, &freq_table); }static int omap_cpu_init (struct cpufreq_policy *policy)
@@ -181,7 +181,7 @@ static int omap_cpu_init(struct cpufreq_policy *policy) policy->cur =omap_getspeed (policy->cpu);if (!freq_table) - result =opp_init_cpufreq_table (mpu_dev, &freq_table); + result =dev_pm_opp_init_cpufreq_table (mpu_dev, &freq_table);if (result) { dev_err(mpu_dev, "%s: cpu%d: failed creating freq table[%d]\n",
drivers/devfreq/devfreq.c +7 -7
@@ -908,7 +908,7 @@ static ssize_t available_frequencies_show(struct device *d,rcu_read_lock (); do { - opp = opp_find_freq_ceil(dev, &freq); + opp = dev_pm_opp_find_freq_ceil(dev, &freq); if (IS_ERR(opp)) break;
@@ -1036,18 +1036,18 @@ struct opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq,if (flags &DEVFREQ_FLAG_LEAST_UPPER_BOUND ) {/* The freq is an upper bound. opp should be lower */ - opp =opp_find_freq_floor (dev, freq); + opp =dev_pm_opp_find_freq_floor (dev, freq);/* If not available, use the closest opp */ if (opp ==ERR_PTR (-ERANGE )) - opp =opp_find_freq_ceil (dev, freq); + opp =dev_pm_opp_find_freq_ceil (dev, freq); }else {/* The freq is an lower bound. opp should be higher */ - opp =opp_find_freq_ceil (dev, freq); + opp =dev_pm_opp_find_freq_ceil (dev, freq);/* If not available, use the closest opp */ if (opp ==ERR_PTR (-ERANGE )) - opp =opp_find_freq_floor (dev, freq); + opp =dev_pm_opp_find_freq_floor (dev, freq); }return opp;
@@ -1066,7 +1066,7 @@ int devfreq_register_opp_notifier(struct device *dev, struct devfreq *devfreq)int ret =0 ;rcu_read_lock (); - nh =opp_get_notifier (dev); + nh =dev_pm_opp_get_notifier (dev);if (IS_ERR (nh)) ret =PTR_ERR (nh);rcu_read_unlock ();
@@ -1092,7 +1092,7 @@ int devfreq_unregister_opp_notifier(struct device *dev, struct devfreq *devfreq)int ret =0 ;rcu_read_lock (); - nh =opp_get_notifier (dev); + nh =dev_pm_opp_get_notifier (dev);if (IS_ERR (nh)) ret =PTR_ERR (nh);rcu_read_unlock ();
drivers/devfreq/exynos/exynos4_bus.c +11 -10
@@ -650,8 +650,8 @@ static int exynos4_bus_target(struct device *dev, unsigned long *_freq,rcu_read_unlock ();return PTR_ERR (opp); } - new_oppinfo.rate =opp_get_freq (opp); - new_oppinfo.volt =opp_get_voltage (opp); + new_oppinfo.rate =dev_pm_opp_get_freq (opp); + new_oppinfo.volt =dev_pm_opp_get_voltage (opp);rcu_read_unlock (); freq = new_oppinfo.rate;
@@ -873,7 +873,7 @@ static int exynos4210_init_tables(struct busfreq_data *data) exynos4210_busclk_table[i].volt = exynos4210_asv_volt[mgrp][i];for (i =LV_0 ; i <EX4210_LV_NUM ; i++) { - err =opp_add (data->dev, exynos4210_busclk_table[i].clk, + err =dev_pm_opp_add (data->dev, exynos4210_busclk_table[i].clk, exynos4210_busclk_table[i].volt);if (err) {dev_err (data->dev,"Cannot add opp entries.\n" );
@@ -940,7 +940,7 @@ static int exynos4x12_init_tables(struct busfreq_data *data) }for (i =0 ; i < EX4x12_LV_NUM; i++) { - ret =opp_add (data->dev, exynos4x12_mifclk_table[i].clk, + ret =dev_pm_opp_add (data->dev, exynos4x12_mifclk_table[i].clk, exynos4x12_mifclk_table[i].volt);if (ret) {dev_err (data->dev,"Fail to add opp entries.\n" );
@@ -969,7 +969,7 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this, data->disabled = true;rcu_read_lock (); - opp =opp_find_freq_floor (data->dev, &maxfreq); + opp =dev_pm_opp_find_freq_floor (data->dev, &maxfreq);if (IS_ERR (opp)) {rcu_read_unlock (); dev_err(data->dev, "%s: unable to find a min freq\n",
@@ -977,8 +977,8 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this,mutex_unlock (&data->lock);return PTR_ERR (opp); } - new_oppinfo.rate =opp_get_freq (opp); - new_oppinfo.volt =opp_get_voltage (opp); + new_oppinfo.rate =dev_pm_opp_get_freq (opp); + new_oppinfo.volt =dev_pm_opp_get_voltage (opp);rcu_read_unlock (); err = exynos4_bus_setvolt(data, &new_oppinfo,
@@ -1065,15 +1065,16 @@ static int exynos4_busfreq_probe(struct platform_device *pdev) }rcu_read_lock (); - opp =opp_find_freq_floor (dev, &exynos4_devfreq_profile.initial_freq); + opp =dev_pm_opp_find_freq_floor (dev, + &exynos4_devfreq_profile.initial_freq);if (IS_ERR (opp)) {rcu_read_unlock ();dev_err (dev,"Invalid initial frequency %lu kHz.\n" , exynos4_devfreq_profile.initial_freq);return PTR_ERR (opp); } - data->curr_oppinfo.rate =opp_get_freq (opp); - data->curr_oppinfo.volt =opp_get_voltage (opp); + data->curr_oppinfo.rate =dev_pm_opp_get_freq (opp); + data->curr_oppinfo.volt =dev_pm_opp_get_voltage (opp);rcu_read_unlock ();platform_set_drvdata (pdev, data);
drivers/devfreq/exynos/exynos5_bus.c +9 -9
@@ -144,8 +144,8 @@ static int exynos5_busfreq_int_target(struct device *dev, unsigned long *_freq,return PTR_ERR (opp); } - freq =opp_get_freq (opp); - volt =opp_get_voltage (opp); + freq =dev_pm_opp_get_freq (opp); + volt =dev_pm_opp_get_voltage (opp);rcu_read_unlock (); old_freq = data->curr_freq;
@@ -246,7 +246,7 @@ static int exynos5250_init_int_tables(struct busfreq_data_int *data)int i, err =0 ;for (i =LV_0 ; i < _LV_END; i++) { - err =opp_add (data->dev, exynos5_int_opp_table[i].clk, + err =dev_pm_opp_add (data->dev, exynos5_int_opp_table[i].clk, exynos5_int_opp_table[i].volt);if (err) {dev_err (data->dev,"Cannot add opp entries.\n" );
@@ -276,14 +276,14 @@ static int exynos5_busfreq_int_pm_notifier_event(struct notifier_block *this, data->disabled = true;rcu_read_lock (); - opp =opp_find_freq_floor (data->dev, &maxfreq); + opp =dev_pm_opp_find_freq_floor (data->dev, &maxfreq);if (IS_ERR (opp)) {rcu_read_unlock (); err =PTR_ERR (opp); goto unlock; } - freq =opp_get_freq (opp); - volt =opp_get_voltage (opp); + freq =dev_pm_opp_get_freq (opp); + volt =dev_pm_opp_get_voltage (opp);rcu_read_unlock (); err =exynos5_int_setvolt (data, volt);
@@ -368,7 +368,7 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev) }rcu_read_lock (); - opp =opp_find_freq_floor (dev, + opp =dev_pm_opp_find_freq_floor (dev, &exynos5_devfreq_int_profile.initial_freq);if (IS_ERR (opp)) {rcu_read_unlock ();
@@ -377,8 +377,8 @@ static int exynos5_busfreq_int_probe(struct platform_device *pdev) err =PTR_ERR (opp); goto err_opp_add; } - initial_freq =opp_get_freq (opp); - initial_volt =opp_get_voltage (opp); + initial_freq =dev_pm_opp_get_freq (opp); + initial_volt =dev_pm_opp_get_voltage (opp);rcu_read_unlock (); data->curr_freq = initial_freq;
include/linux/opp.h +26 -24
122 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH 1/3] PM / OPP: rename functions to dev_pm_opp*
Quoted 4 lines · Nishanth Menon
opp_get_opp_countopp_find_freq_exactopp_init_cpufreq_tableopp_free_cpufreq_table
The only problem I see is that routines names for few of them are getting really long now.. Otherwise not much I could find...
Though you had following changes, which you could have avoided in this hard to review patchset:
drivers/base/power/opp.c +0 -0
new_opp = [-kzalloc(sizeof(struct
opp),-]{+kzalloc(sizeof(*new_opp),+} GFP_KERNEL);
new_opp = [-kmalloc(sizeof(struct
opp),-]{+kmalloc(sizeof(*new_opp),+} GFP_KERNEL);
It is almost impossible to catch these with naked eyes for such long patches.. I took help of --word-diff though :)
If no one else sees these as problems then feel free to add my:
Nishanth Menon
maintainerRe: [PATCH 1/3] PM / OPP: rename functions to dev_pm_opp*
Quoted 8 lines · Viresh Kumar
Quoted 4 lines · Nishanth Menon
opp_get_opp_countopp_find_freq_exactopp_init_cpufreq_tableopp_free_cpufreq_tableThe only problem I see is that routines names for few of them are getting really long now.. Otherwise not much I could find...
I am open to suggestions if any one feels we can improve this better.
Quoted 10 lines
Though you had following changes, which you could have avoided in this hard to review patchset:
drivers/base/power/opp.c +0
-0new_opp = [-kzalloc(sizeof(structopp),-]{+kzalloc(sizeof(*new_opp),+}
GFP_KERNEL);
new_opp= [-kmalloc(sizeof(struct
opp),-]{+kmalloc(sizeof(*new_opp),+}GFP_KERNEL);
Quoted 2 lines
It is almost impossible to catch these with naked eyes for such long patches.. I took help of --word-diff though :)
I believe that change was from Patch #2[1]
yes, you are right, I had squashed this patch in to squelch checkpatch warnings:
CHECK: Prefer kzalloc(sizeof(*new_opp)...) over kzalloc(sizeof(struct
dev_pm_opp)...)
#177: FILE: drivers/base/power/opp.c:406:
+ new_opp = kzalloc(sizeof(struct dev_pm_opp), GFP_KERNEL);
CHECK: Prefer kmalloc(sizeof(*new_opp)...) over kmalloc(sizeof(struct
dev_pm_opp)...)
#191: FILE: drivers/base/power/opp.c:495:
+ new_opp = kmalloc(sizeof(struct dev_pm_opp), GFP_KERNEL);
I had added a comment:
" Minor checkpatch warning fixes as a result of this change was fixed as well."
Would you suggest I split the change off to a separate patch or improve
the comment a little more?
Quoted 3 lines
If no one else sees these as problems then feel free to add my:
Acked-by Viresh Kumar <[email protected]>
[1] https://patchwork.kernel.org/patch/2913551/
Signature · 2 lines
Regards, Nishanth Menon
Viresh Kumar
maintainerRe: [PATCH 1/3] PM / OPP: rename functions to dev_pm_opp*
Quoted 1 line · Nishanth Menon
I am open to suggestions if any one feels we can improve this better.
I didn't really had one.. I thought of pm_opp** instead of dev_pm_opp** though..
Quoted 1 line
I believe that change was from Patch #2[1]
Yeah.. I just replied on a single patch :)
Quoted 2 lines
yes, you are right, I had squashed this patch in to squelch checkpatch warnings:
I see..
Quoted 3 lines
I had added a comment:
" Minor checkpatch warning fixes as a result of this change was fixed as well."
I really missed that..
Quoted 2 lines
Would you suggest I split the change off to a separate patch or improve
the comment a little more?
don't really know, maybe leave those as is and let checkpatch warn you..
Nishanth Menon
maintainerRe: [PATCH 1/3] PM / OPP: rename functions to dev_pm_opp*
Quoted 6 lines · Viresh Kumar
Quoted 1 line · Nishanth Menon
I am open to suggestions if any one feels we can improve this better.
I didn't really had one.. I thought of pm_opp** instead of dev_pm_opp** though..
I had proposed this earlier, however, had gone with Rafael's suggestion [1] to have the right context to the usage.
Quoted 8 lines
Quoted 2 lines
I believe that change was from Patch #2[1]
Yeah.. I just replied on a single patch :)
Quoted 2 lines
yes, you are right, I had squashed this patch in to squelch checkpatch warnings:
Quoted 7 lines
I see..
Quoted 3 lines
I had added a comment:
" Minor checkpatch warning fixes as a result of this change was fixed as well."I really missed that..
no problems..
Quoted 6 lines
Quoted 3 lines
Would you suggest I split the change off to a separate patch or improve
the comment a little more?don't really know, maybe leave those as is and let checkpatch warn you..
that is fair as well. i can split it off seperately in the next respin.
[1] http://marc.info/?l=linaro-kernel&m=137645747511725&w=2
Signature · 2 lines
Regards, Nishanth Menon
Nishanth Menon
maintainerPATCH 2/3 PM / OPP: rename data structures to dev_pm equivalents
In reply to Nishanth MenonSince Operating Performance Points(OPP) data structures are specific to device specific power management, be specific and rename opp_* data structures in OPP library with dev_pm_opp_* equivalent.
Impacted structures are:
struct opp
enum opp_event
Minor checkpatch warning fixes as a result of this change was fixed as well.
--- Documentation/power/opp.txt | 4 ++-- arch/arm/mach-omap2/pm.c | 2 +- drivers/base/power/opp.c | 41 ++++++++++++++++++---------------- drivers/cpufreq/cpufreq-cpu0.c | 4 ++-- drivers/cpufreq/exynos5440-cpufreq.c | 2 +- drivers/cpufreq/imx6q-cpufreq.c | 4 ++-- drivers/cpufreq/omap-cpufreq.c | 2 +- drivers/devfreq/devfreq.c | 9 ++++---- drivers/devfreq/exynos/exynos4_bus.c | 6 ++--- drivers/devfreq/exynos/exynos5_bus.c | 6 ++--- include/linux/devfreq.h | 4 ++-- include/linux/opp.h | 29 +++++++++++++----------- 12 files changed, 60 insertions(+), 53 deletions(-)
Documentation/power/opp.txt +2 -2
@@ -358,14 +358,14 @@ accessed by various functions as described above. However, the structures representing the actual OPPs and domains are internal to the OPP library itself to allow for suitable abstraction reusable across systems. -struct opp - The internal data structure of OPP library which is used to +struct dev_pm_opp - The internal data structure of OPP library which is used to represent an OPP. In addition to the freq, voltage, availability information, it also contains internal book keeping information required for the OPP library to operate on. Pointer to this structure is provided back to the users such as SoC framework to be used as a identifier for OPP in the interactions with OPP layer. - WARNING: The struct opp pointer should not be parsed or modified by the + WARNING: The struct dev_pm_opp pointer should not be parsed or modified by the users. The defaults of for an instance is populated by dev_pm_opp_add, but the availability of the OPP can be modified by dev_pm_opp_enable/disable functions.
arch/arm/mach-omap2/pm.c +1 -1
@@ -131,7 +131,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name, {struct voltagedomain *voltdm;struct clk *clk; -struct opp *opp; +struct dev_pm_opp *opp;unsigned long freq, bootup_volt;struct device *dev;
drivers/base/power/opp.c +22 -19
121 lines not on this page · raw message
drivers/cpufreq/cpufreq-cpu0.c +2 -2
@@ -43,7 +43,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, unsigned int target_freq, unsigned int relation) {struct cpufreq_freqs freqs; -struct opp *opp; +struct dev_pm_opp *opp;unsigned long volt =0 , volt_old =0 , tol =0 ;long freq_Hz, freq_exact;unsigned int index;
@@ -225,7 +225,7 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) transition_latency =CPUFREQ_ETERNAL ;if (cpu_reg) { -struct opp *opp; +struct dev_pm_opp *opp;unsigned long min_uV, max_uV;int i;
drivers/cpufreq/exynos5440-cpufreq.c +1 -1
@@ -118,7 +118,7 @@ static int init_div_table(void)struct cpufreq_frequency_table *freq_tbl = dvfs_info->freq_table;unsigned int tmp, clk_div, ema_div, freq, volt_id;int i =0 ; -struct opp *opp; +struct dev_pm_opp *opp;rcu_read_lock ();for (i =0 ; freq_tbl[i].frequency !=CPUFREQ_TABLE_END ; i++) {
drivers/cpufreq/imx6q-cpufreq.c +2 -2
@@ -48,7 +48,7 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int target_freq, unsigned int relation) {struct cpufreq_freqs freqs; -struct opp *opp; +struct dev_pm_opp *opp;unsigned long freq_hz, volt, volt_old;unsigned int index;int ret;
@@ -198,7 +198,7 @@ static struct cpufreq_driver imx6q_cpufreq_driver = {static int imx6q_cpufreq_probe (struct platform_device *pdev) {struct device_node *np; -struct opp *opp; +struct dev_pm_opp *opp;unsigned long min_volt, max_volt;int num, ret;
drivers/cpufreq/omap-cpufreq.c +1 -1
@@ -65,7 +65,7 @@ static int omap_target(struct cpufreq_policy *policy,unsigned int i;int r, ret =0 ;struct cpufreq_freqs freqs; -struct opp *opp; +struct dev_pm_opp *opp;unsigned long freq, volt =0 , volt_old =0 , tol =0 ;if (!freq_table) {
drivers/devfreq/devfreq.c +5 -4
@@ -902,7 +902,7 @@ static ssize_t available_frequencies_show(struct device *d, {struct devfreq *df =to_devfreq (d);struct device *dev = df->dev.parent; -struct opp *opp; +struct dev_pm_opp *opp;ssize_t count =0 ;unsigned long freq =0 ;
@@ -1029,10 +1029,11 @@ module_exit(devfreq_exit);* under the locked area. The pointer returned must be used prior to unlocking * with rcu_read_unlock() to maintain the integrity of the pointer. */ -struct opp *devfreq_recommended_opp (struct device *dev,unsigned long *freq, -u32 flags) +struct dev_pm_opp *devfreq_recommended_opp (struct device *dev, +unsigned long *freq, +u32 flags) { -struct opp *opp; +struct dev_pm_opp *opp;if (flags &DEVFREQ_FLAG_LEAST_UPPER_BOUND ) {/* The freq is an upper bound. opp should be lower */
drivers/devfreq/exynos/exynos4_bus.c +3 -3
@@ -639,7 +639,7 @@ static int exynos4_bus_target(struct device *dev, unsigned long *_freq, struct platform_device *pdev = container_of(dev, struct platform_device, dev);struct busfreq_data *data =platform_get_drvdata (pdev); -struct opp *opp; +struct dev_pm_opp *opp;unsigned long freq;unsigned long old_freq = data->curr_oppinfo.rate;struct busfreq_opp_info new_oppinfo;
@@ -956,7 +956,7 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this, { struct busfreq_data *data = container_of(this, struct busfreq_data, pm_notifier); -struct opp *opp; +struct dev_pm_opp *opp;struct busfreq_opp_info new_oppinfo;unsigned long maxfreq =ULONG_MAX ;int err =0 ;
@@ -1020,7 +1020,7 @@ unlock:static int exynos4_busfreq_probe (struct platform_device *pdev) {struct busfreq_data *data; -struct opp *opp; +struct dev_pm_opp *opp;struct device *dev = &pdev->dev;int err =0 ;
drivers/devfreq/exynos/exynos5_bus.c +3 -3
@@ -132,7 +132,7 @@ static int exynos5_busfreq_int_target(struct device *dev, unsigned long *_freq, struct platform_device *pdev = container_of(dev, struct platform_device, dev);struct busfreq_data_int *data =platform_get_drvdata (pdev); -struct opp *opp; +struct dev_pm_opp *opp;unsigned long old_freq, freq;unsigned long volt;
@@ -262,7 +262,7 @@ static int exynos5_busfreq_int_pm_notifier_event(struct notifier_block *this, {struct busfreq_data_int *data =container_of (this, struct busfreq_data_int, pm_notifier); -struct opp *opp; +struct dev_pm_opp *opp;unsigned long maxfreq =ULONG_MAX ;unsigned long freq;unsigned long volt;
@@ -316,7 +316,7 @@ unlock:static int exynos5_busfreq_int_probe (struct platform_device *pdev) {struct busfreq_data_int *data; -struct opp *opp; +struct dev_pm_opp *opp;struct device *dev = &pdev->dev;struct device_node *np;unsigned long initial_freq;
include/linux/devfreq.h +2 -2
@@ -187,7 +187,7 @@ extern int devfreq_suspend_device(struct devfreq *devfreq);extern int devfreq_resume_device (struct devfreq *devfreq);/* Helper functions for devfreq user device driver with OPP. */ -extern struct opp *devfreq_recommended_opp (struct device *dev, +extern struct dev_pm_opp *devfreq_recommended_opp (struct device *dev,unsigned long *freq,u32 flags);extern int devfreq_register_opp_notifier (struct device *dev,struct devfreq *devfreq);
@@ -238,7 +238,7 @@ static inline int devfreq_resume_device(struct devfreq *devfreq)return 0 ; } -static inline struct opp *devfreq_recommended_opp (struct device *dev, +static inline struct dev_pm_opp *devfreq_recommended_opp (struct device *dev,unsigned long *freq,u32 flags) {return ERR_PTR (-EINVAL );
include/linux/opp.h +16 -13
@@ -18,27 +18,30 @@#include <linux/cpufreq.h> #include <linux/notifier.h> -struct opp ; +struct dev_pm_opp ;struct device ; -enum opp_event { +enum dev_pm_opp_event {OPP_EVENT_ADD ,OPP_EVENT_ENABLE ,OPP_EVENT_DISABLE , };#if defined(CONFIG_PM_OPP ) -unsigned long dev_pm_opp_get_voltage (struct opp *opp); +unsigned long dev_pm_opp_get_voltage (struct dev_pm_opp *opp); -unsigned long dev_pm_opp_get_freq (struct opp *opp); +unsigned long dev_pm_opp_get_freq (struct dev_pm_opp *opp);int dev_pm_opp_get_opp_count (struct device *dev); -struct opp *dev_pm_opp_find_freq_exact (struct device *dev,unsigned long freq, -bool available); +struct dev_pm_opp *dev_pm_opp_find_freq_exact (struct device *dev, +unsigned long freq, +bool available); -struct opp *dev_pm_opp_find_freq_floor (struct device *dev,unsigned long *freq); +struct dev_pm_opp *dev_pm_opp_find_freq_floor (struct device *dev, +unsigned long *freq); -struct opp *dev_pm_opp_find_freq_ceil (struct device *dev,unsigned long *freq); +struct dev_pm_opp *dev_pm_opp_find_freq_ceil (struct device *dev, +unsigned long *freq);int dev_pm_opp_add (struct device *dev,unsigned long freq,unsigned long u_volt);
@@ -49,12 +52,12 @@ int dev_pm_opp_disable(struct device *dev, unsigned long freq);struct srcu_notifier_head *dev_pm_opp_get_notifier (struct device *dev);#else -static inline unsigned long dev_pm_opp_get_voltage (struct opp *opp) +static inline unsigned long dev_pm_opp_get_voltage (struct dev_pm_opp *opp) {return 0 ; } -static inline unsigned long dev_pm_opp_get_freq (struct opp *opp) +static inline unsigned long dev_pm_opp_get_freq (struct dev_pm_opp *opp) {return 0 ; }
@@ -64,19 +67,19 @@ static inline int dev_pm_opp_get_opp_count(struct device *dev)return 0 ; } -static inline struct opp *dev_pm_opp_find_freq_exact (struct device *dev, +static inline struct dev_pm_opp *dev_pm_opp_find_freq_exact (struct device *dev,unsigned long freq,bool available) {return ERR_PTR (-EINVAL ); } -static inline struct opp *dev_pm_opp_find_freq_floor (struct device *dev, +static inline struct dev_pm_opp *dev_pm_opp_find_freq_floor (struct device *dev,unsigned long *freq) {return ERR_PTR (-EINVAL ); } -static inline struct opp *dev_pm_opp_find_freq_ceil (struct device *dev, +static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil (struct device *dev,unsigned long *freq) {return ERR_PTR (-EINVAL );
Signature · 1 line
1.7.9.5
Nishanth Menon
maintainerPATCH 3/3 PM / OPP: rename header to linux/pm_opp.h
In reply to Nishanth MenonSince Operating Performance Points(OPP) functions are specific to device specific power management, be specific and rename opp.h to pm_opp.h
---
Documentation/power/opp.txt | 2 +-
arch/arm/mach-imx/mach-imx6q.c | 2 +-
arch/arm/mach-omap2/board-omap3beagle.c | 2 +-
arch/arm/mach-omap2/omap-pm.h | 2 +-
arch/arm/mach-omap2/opp.c | 2 +-
arch/arm/mach-omap2/pm.c | 2 +-
drivers/base/power/opp.c | 2 +-
drivers/cpufreq/arm_big_little.c | 2 +-
drivers/cpufreq/arm_big_little_dt.c | 2 +-
drivers/cpufreq/cpufreq-cpu0.c | 2 +-
drivers/cpufreq/exynos5440-cpufreq.c | 2 +-
drivers/cpufreq/imx6q-cpufreq.c | 2 +-
drivers/cpufreq/omap-cpufreq.c | 2 +-
drivers/devfreq/devfreq.c | 2 +-
drivers/devfreq/exynos/exynos4_bus.c | 2 +-
drivers/devfreq/exynos/exynos5_bus.c | 4 ++--
include/linux/devfreq.h | 2 +-
include/linux/{opp.h => pm_opp.h} | 0
18 files changed, 18 insertions(+), 18 deletions(-)
rename include/linux/{opp.h => pm_opp.h} (100%)Documentation/power/opp.txt +1 -1
@@ -42,7 +42,7 @@ 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/base/power/opp.c and the header -is located in include/linux/opp.h. OPP library can be enabled by enabling +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.
arch/arm/mach-imx/mach-imx6q.c +1 -1
@@ -25,7 +25,7 @@#include <linux/of_address.h> #include <linux/of_irq.h> #include <linux/of_platform.h> -#include <linux/opp.h> +#include <linux/pm_opp.h> #include <linux/phy.h> #include <linux/reboot.h> #include <linux/regmap.h>
arch/arm/mach-omap2/board-omap3beagle.c +1 -1
@@ -25,7 +25,7 @@#include <linux/gpio.h> #include <linux/input.h> #include <linux/gpio_keys.h> -#include <linux/opp.h> +#include <linux/pm_opp.h> #include <linux/cpu.h> #include <linux/mtd/mtd.h>
arch/arm/mach-omap2/omap-pm.h +1 -1
@@ -17,7 +17,7 @@#include <linux/device.h> #include <linux/cpufreq.h> #include <linux/clk.h> -#include <linux/opp.h> +#include <linux/pm_opp.h> /* * agent_id values for use with omap_pm_set_min_bus_tput():
arch/arm/mach-omap2/opp.c +1 -1
@@ -17,7 +17,7 @@* GNU General Public License for more details. */ #include <linux/module.h> -#include <linux/opp.h> +#include <linux/pm_opp.h> #include <linux/cpu.h> #include "omap_device.h"
arch/arm/mach-omap2/pm.c +1 -1
@@ -13,7 +13,7 @@#include <linux/init.h> #include <linux/io.h> #include <linux/err.h> -#include <linux/opp.h> +#include <linux/pm_opp.h> #include <linux/export.h> #include <linux/suspend.h> #include <linux/cpu.h>
drivers/base/power/opp.c +1 -1
@@ -21,7 +21,7 @@#include <linux/list.h> #include <linux/rculist.h> #include <linux/rcupdate.h> -#include <linux/opp.h> +#include <linux/pm_opp.h> #include <linux/of.h> #include <linux/export.h>
drivers/cpufreq/arm_big_little.c +1 -1
@@ -25,7 +25,7 @@#include <linux/cpumask.h> #include <linux/export.h> #include <linux/of_platform.h> -#include <linux/opp.h> +#include <linux/pm_opp.h> #include <linux/slab.h> #include <linux/topology.h> #include <linux/types.h>
drivers/cpufreq/arm_big_little_dt.c +1 -1
@@ -24,7 +24,7 @@#include <linux/export.h> #include <linux/module.h> #include <linux/of_device.h> -#include <linux/opp.h> +#include <linux/pm_opp.h> #include <linux/platform_device.h> #include <linux/slab.h> #include <linux/types.h>
drivers/cpufreq/cpufreq-cpu0.c +1 -1
@@ -16,7 +16,7 @@#include <linux/err.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/opp.h> +#include <linux/pm_opp.h> #include <linux/platform_device.h> #include <linux/regulator/consumer.h> #include <linux/slab.h>
drivers/cpufreq/exynos5440-cpufreq.c +1 -1
@@ -20,7 +20,7 @@#include <linux/module.h> #include <linux/of_address.h> #include <linux/of_irq.h> -#include <linux/opp.h> +#include <linux/pm_opp.h> #include <linux/platform_device.h> #include <linux/slab.h>
drivers/cpufreq/imx6q-cpufreq.c +1 -1
@@ -12,7 +12,7 @@#include <linux/err.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/opp.h> +#include <linux/pm_opp.h> #include <linux/platform_device.h> #include <linux/regulator/consumer.h>
drivers/cpufreq/omap-cpufreq.c +1 -1
@@ -22,7 +22,7 @@#include <linux/err.h> #include <linux/clk.h> #include <linux/io.h> -#include <linux/opp.h> +#include <linux/pm_opp.h> #include <linux/cpu.h> #include <linux/module.h> #include <linux/platform_device.h>
drivers/devfreq/devfreq.c +1 -1
@@ -18,7 +18,7 @@#include <linux/module.h> #include <linux/slab.h> #include <linux/stat.h> -#include <linux/opp.h> +#include <linux/pm_opp.h> #include <linux/devfreq.h> #include <linux/workqueue.h> #include <linux/platform_device.h>
drivers/devfreq/exynos/exynos4_bus.c +1 -1
@@ -19,7 +19,7 @@#include <linux/slab.h> #include <linux/mutex.h> #include <linux/suspend.h> -#include <linux/opp.h> +#include <linux/pm_opp.h> #include <linux/devfreq.h> #include <linux/platform_device.h> #include <linux/regulator/consumer.h>
drivers/devfreq/exynos/exynos5_bus.c +2 -2
@@ -15,10 +15,10 @@#include <linux/module.h> #include <linux/devfreq.h> #include <linux/io.h> -#include <linux/opp.h> +#include <linux/pm_opp.h> #include <linux/slab.h> #include <linux/suspend.h> -#include <linux/opp.h> +#include <linux/pm_opp.h> #include <linux/clk.h> #include <linux/delay.h> #include <linux/platform_device.h>
include/linux/devfreq.h +1 -1
@@ -15,7 +15,7 @@#include <linux/device.h> #include <linux/notifier.h> -#include <linux/opp.h> +#include <linux/pm_opp.h> #define DEVFREQ_NAME_LEN 16
include/linux/pm_opp.h renamed from include/linux/opp.h +0 -0
Signature · 1 line
1.7.9.5
Nishanth Menon
maintainerQuoted 28 lines · Nishanth Menon
Hi,
Based on [1], Randy rightly pointed out that OPP functions and data structures could be a bit specific to Power management.
So, the following series is based on v3.12-rc1 tag.
If folks like it broken in a different way, I am open to suggestions.
Nishanth Menon (3):
PM / OPP: rename functions to dev_pm_opp*
PM / OPP: rename data structures todev_pmequivalents PM / OPP: rename header tolinux/pm_opp.hDocumentation/power/opp.txt | 108 ++++++++++++------------ arch/arm/mach-imx/mach-imx6q.c | 4 +- arch/arm/mach-omap2/board-omap3beagle.c | 10 +-- arch/arm/mach-omap2/omap-pm.h | 2 +- arch/arm/mach-omap2/opp.c | 6 +- arch/arm/mach-omap2/pm.c | 8 +- drivers/base/power/opp.c | 115 ++++++++++++------------- drivers/cpufreq/arm_big_little.c | 8 +- drivers/cpufreq/arm_big_little_dt.c | 2 +- drivers/cpufreq/cpufreq-cpu0.c | 24 +++--- drivers/cpufreq/exynos5440-cpufreq.c | 17 ++-- drivers/cpufreq/imx6q-cpufreq.c | 26 +++--- drivers/cpufreq/omap-cpufreq.c | 12 +-- drivers/devfreq/devfreq.c | 25 +++---
Quoted 12 lines
drivers/devfreq/exynos/exynos4_bus.c | 29 +++---- drivers/devfreq/exynos/exynos5_bus.c | 28 +++---- include/linux/devfreq.h | 6 +- include/linux/opp.h | 134 ----------------------------- include/linux/pm_opp.h | 139 +++++++++++++++++++++++++++++++ 19 files changed, 357 insertions(+), 346 deletions(-) delete mode 100644 include/linux/opp.h create mode 100644 include/linux/pm_opp.hSignature · 1 line
1.7.9.5
Oops.. seems I deleted the link of the discussion - my bad...
[1] http://marc.info/?t=137579467400007&r=1&w=2
Signature · 2 lines
Regards, Nishanth Menon