Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pm+acpi-4.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management and ACPI updates from Rafael Wysocki:
"Included are: a somewhat late devfreq update which however is mostly
fixes and cleanups with one new thing only (the PPMUv2 support on
Exynos5433), an ACPI cpufreq driver fixup and two ACPI core cleanups
related to preprocessor directives.

Specifics:

- Fix a memory allocation size in the devfreq core (Xiaolong Ye).

- Fix a mistake in the exynos-ppmu DT binding (Javier Martinez
Canillas).

- Add support for PPMUv2 ((Platform Performance Monitoring Unit
version 2.0) on the Exynos5433 SoCs (Chanwoo Choi).

- Fix a type casting bug in the Exynos PPMU code (MyungJoo Ham).

- Assorted devfreq code cleanups and optimizations (Javi Merino,
MyungJoo Ham, Viresh Kumar).

- Fix up the ACPI cpufreq driver to use a more lightweight way to get
to its private data in the ->get() callback (Rafael J Wysocki).

- Fix a CONFIG_ prefix bug in one of the ACPI drivers and make the
ACPI subsystem use IS_ENABLED() instead of #ifdefs in function
bodies (Sudeep Holla)"

* tag 'pm+acpi-4.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
cpufreq: acpi-cpufreq: Use cpufreq_cpu_get_raw() in ->get()
ACPI: Eliminate CONFIG_.*{, _MODULE} #ifdef in favor of IS_ENABLED()
ACPI: int340x_thermal: add missing CONFIG_ prefix
PM / devfreq: Fix incorrect type issue.
PM / devfreq: tegra: Update governor to use devfreq_update_stats()
PM / devfreq: comments for get_dev_status usage updated
PM / devfreq: drop comment about thermal setting max_freq
PM / devfreq: cache the last call to get_dev_status()
PM / devfreq: Drop unlikely before IS_ERR(_OR_NULL)
PM / devfreq: exynos-ppmu: bit-wise operation bugfix.
PM / devfreq: exynos-ppmu: Update documentation to support PPMUv2
PM / devfreq: exynos-ppmu: Add the support of PPMUv2 for Exynos5433
PM / devfreq: event: Remove incorrect property in exynos-ppmu DT binding

+74 -47
+4 -8
drivers/acpi/bus.c
··· 315 315 316 316 capbuf[OSC_QUERY_DWORD] = OSC_QUERY_ENABLE; 317 317 capbuf[OSC_SUPPORT_DWORD] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */ 318 - #if defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) ||\ 319 - defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE) 320 - capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PAD_SUPPORT; 321 - #endif 322 - 323 - #if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) 324 - capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PPC_OST_SUPPORT; 325 - #endif 318 + if (IS_ENABLED(CONFIG_ACPI_PROCESSOR_AGGREGATOR)) 319 + capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PAD_SUPPORT; 320 + if (IS_ENABLED(CONFIG_ACPI_PROCESSOR)) 321 + capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PPC_OST_SUPPORT; 326 322 327 323 capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT; 328 324
+5 -6
drivers/acpi/int340x_thermal.c
··· 33 33 static int int340x_thermal_handler_attach(struct acpi_device *adev, 34 34 const struct acpi_device_id *id) 35 35 { 36 - #if defined(CONFIG_INT340X_THERMAL) || defined(CONFIG_INT340X_THERMAL_MODULE) 37 - acpi_create_platform_device(adev); 38 - #elif defined(INTEL_SOC_DTS_THERMAL) || defined(INTEL_SOC_DTS_THERMAL_MODULE) 39 - /* Intel SoC DTS thermal driver needs INT3401 to set IRQ descriptor */ 40 - if (id->driver_data == INT3401_DEVICE) 36 + if (IS_ENABLED(CONFIG_INT340X_THERMAL)) 41 37 acpi_create_platform_device(adev); 42 - #endif 38 + /* Intel SoC DTS thermal driver needs INT3401 to set IRQ descriptor */ 39 + else if (IS_ENABLED(CONFIG_INTEL_SOC_DTS_THERMAL) && 40 + id->driver_data == INT3401_DEVICE) 41 + acpi_create_platform_device(adev); 43 42 return 1; 44 43 } 45 44
+1 -2
drivers/cpufreq/acpi-cpufreq.c
··· 375 375 376 376 pr_debug("get_cur_freq_on_cpu (%d)\n", cpu); 377 377 378 - policy = cpufreq_cpu_get(cpu); 378 + policy = cpufreq_cpu_get_raw(cpu); 379 379 if (unlikely(!policy)) 380 380 return 0; 381 381 382 382 data = policy->driver_data; 383 - cpufreq_cpu_put(policy); 384 383 if (unlikely(!data || !data->freq_table)) 385 384 return 0; 386 385
+2 -2
drivers/cpufreq/cpufreq.c
··· 238 238 } 239 239 EXPORT_SYMBOL_GPL(cpufreq_generic_init); 240 240 241 - /* Only for cpufreq core internal use */ 242 - static struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu) 241 + struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu) 243 242 { 244 243 struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu); 245 244 246 245 return policy && cpumask_test_cpu(cpu, policy->cpus) ? policy : NULL; 247 246 } 247 + EXPORT_SYMBOL_GPL(cpufreq_cpu_get_raw); 248 248 249 249 unsigned int cpufreq_generic_get(unsigned int cpu) 250 250 {
+6 -6
drivers/devfreq/devfreq.c
··· 53 53 { 54 54 struct devfreq *tmp_devfreq; 55 55 56 - if (unlikely(IS_ERR_OR_NULL(dev))) { 56 + if (IS_ERR_OR_NULL(dev)) { 57 57 pr_err("DEVFREQ: %s: Invalid parameters\n", __func__); 58 58 return ERR_PTR(-EINVAL); 59 59 } ··· 133 133 { 134 134 struct devfreq_governor *tmp_governor; 135 135 136 - if (unlikely(IS_ERR_OR_NULL(name))) { 136 + if (IS_ERR_OR_NULL(name)) { 137 137 pr_err("DEVFREQ: %s: Invalid parameters\n", __func__); 138 138 return ERR_PTR(-EINVAL); 139 139 } ··· 177 177 return err; 178 178 179 179 /* 180 - * Adjust the freuqency with user freq and QoS. 180 + * Adjust the frequency with user freq and QoS. 181 181 * 182 - * List from the highest proiority 183 - * max_freq (probably called by thermal when it's too hot) 182 + * List from the highest priority 183 + * max_freq 184 184 * min_freq 185 185 */ 186 186 ··· 482 482 devfreq->profile->max_state * 483 483 devfreq->profile->max_state, 484 484 GFP_KERNEL); 485 - devfreq->time_in_state = devm_kzalloc(dev, sizeof(unsigned int) * 485 + devfreq->time_in_state = devm_kzalloc(dev, sizeof(unsigned long) * 486 486 devfreq->profile->max_state, 487 487 GFP_KERNEL); 488 488 devfreq->last_stat_updated = jiffies;
+2 -1
drivers/devfreq/event/exynos-ppmu.c
··· 319 319 case PPMU_PMNCNT3: 320 320 pmcnt_high = __raw_readl(info->ppmu.base + PPMU_V2_PMCNT3_HIGH); 321 321 pmcnt_low = __raw_readl(info->ppmu.base + PPMU_V2_PMCNT3_LOW); 322 - load_count = (u64)((pmcnt_high & 0xff) << 32) + (u64)pmcnt_low; 322 + load_count = ((u64)((pmcnt_high & 0xff)) << 32) 323 + + (u64)pmcnt_low; 323 324 break; 324 325 } 325 326 edata->load_count = load_count;
+18 -15
drivers/devfreq/governor_simpleondemand.c
··· 21 21 static int devfreq_simple_ondemand_func(struct devfreq *df, 22 22 unsigned long *freq) 23 23 { 24 - struct devfreq_dev_status stat; 25 - int err = df->profile->get_dev_status(df->dev.parent, &stat); 24 + int err; 25 + struct devfreq_dev_status *stat; 26 26 unsigned long long a, b; 27 27 unsigned int dfso_upthreshold = DFSO_UPTHRESHOLD; 28 28 unsigned int dfso_downdifferential = DFSO_DOWNDIFFERENCTIAL; 29 29 struct devfreq_simple_ondemand_data *data = df->data; 30 30 unsigned long max = (df->max_freq) ? df->max_freq : UINT_MAX; 31 31 32 + err = devfreq_update_stats(df); 32 33 if (err) 33 34 return err; 35 + 36 + stat = &df->last_status; 34 37 35 38 if (data) { 36 39 if (data->upthreshold) ··· 46 43 return -EINVAL; 47 44 48 45 /* Assume MAX if it is going to be divided by zero */ 49 - if (stat.total_time == 0) { 46 + if (stat->total_time == 0) { 50 47 *freq = max; 51 48 return 0; 52 49 } 53 50 54 51 /* Prevent overflow */ 55 - if (stat.busy_time >= (1 << 24) || stat.total_time >= (1 << 24)) { 56 - stat.busy_time >>= 7; 57 - stat.total_time >>= 7; 52 + if (stat->busy_time >= (1 << 24) || stat->total_time >= (1 << 24)) { 53 + stat->busy_time >>= 7; 54 + stat->total_time >>= 7; 58 55 } 59 56 60 57 /* Set MAX if it's busy enough */ 61 - if (stat.busy_time * 100 > 62 - stat.total_time * dfso_upthreshold) { 58 + if (stat->busy_time * 100 > 59 + stat->total_time * dfso_upthreshold) { 63 60 *freq = max; 64 61 return 0; 65 62 } 66 63 67 64 /* Set MAX if we do not know the initial frequency */ 68 - if (stat.current_frequency == 0) { 65 + if (stat->current_frequency == 0) { 69 66 *freq = max; 70 67 return 0; 71 68 } 72 69 73 70 /* Keep the current frequency */ 74 - if (stat.busy_time * 100 > 75 - stat.total_time * (dfso_upthreshold - dfso_downdifferential)) { 76 - *freq = stat.current_frequency; 71 + if (stat->busy_time * 100 > 72 + stat->total_time * (dfso_upthreshold - dfso_downdifferential)) { 73 + *freq = stat->current_frequency; 77 74 return 0; 78 75 } 79 76 80 77 /* Set the desired frequency based on the load */ 81 - a = stat.busy_time; 82 - a *= stat.current_frequency; 83 - b = div_u64(a, stat.total_time); 78 + a = stat->busy_time; 79 + a *= stat->current_frequency; 80 + b = div_u64(a, stat->total_time); 84 81 b *= 100; 85 82 b = div_u64(b, (dfso_upthreshold - dfso_downdifferential / 2)); 86 83 *freq = (unsigned long) b;
+5 -3
drivers/devfreq/tegra-devfreq.c
··· 541 541 static int tegra_governor_get_target(struct devfreq *devfreq, 542 542 unsigned long *freq) 543 543 { 544 - struct devfreq_dev_status stat; 544 + struct devfreq_dev_status *stat; 545 545 struct tegra_devfreq *tegra; 546 546 struct tegra_devfreq_device *dev; 547 547 unsigned long target_freq = 0; 548 548 unsigned int i; 549 549 int err; 550 550 551 - err = devfreq->profile->get_dev_status(devfreq->dev.parent, &stat); 551 + err = devfreq_update_stats(devfreq); 552 552 if (err) 553 553 return err; 554 554 555 - tegra = stat.private_data; 555 + stat = &devfreq->last_status; 556 + 557 + tegra = stat->private_data; 556 558 557 559 for (i = 0; i < ARRAY_SIZE(tegra->devices); i++) { 558 560 dev = &tegra->devices[i];
+2 -2
include/acpi/button.h
··· 3 3 4 4 #include <linux/notifier.h> 5 5 6 - #if defined(CONFIG_ACPI_BUTTON) || defined(CONFIG_ACPI_BUTTON_MODULE) 6 + #if IS_ENABLED(CONFIG_ACPI_BUTTON) 7 7 extern int acpi_lid_notifier_register(struct notifier_block *nb); 8 8 extern int acpi_lid_notifier_unregister(struct notifier_block *nb); 9 9 extern int acpi_lid_open(void); ··· 20 20 { 21 21 return 1; 22 22 } 23 - #endif /* defined(CONFIG_ACPI_BUTTON) || defined(CONFIG_ACPI_BUTTON_MODULE) */ 23 + #endif /* IS_ENABLED(CONFIG_ACPI_BUTTON) */ 24 24 25 25 #endif /* ACPI_BUTTON_H */
+1 -1
include/acpi/video.h
··· 24 24 acpi_backlight_native, 25 25 }; 26 26 27 - #if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE) 27 + #if IS_ENABLED(CONFIG_ACPI_VIDEO) 28 28 extern int acpi_video_register(void); 29 29 extern void acpi_video_unregister(void); 30 30 extern int acpi_video_get_edid(struct acpi_device *device, int type,
+5
include/linux/cpufreq.h
··· 127 127 #define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/ 128 128 129 129 #ifdef CONFIG_CPU_FREQ 130 + struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu); 130 131 struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu); 131 132 void cpufreq_cpu_put(struct cpufreq_policy *policy); 132 133 #else 134 + static inline struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu) 135 + { 136 + return NULL; 137 + } 133 138 static inline struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu) 134 139 { 135 140 return NULL;
+23 -1
include/linux/devfreq.h
··· 65 65 * The "flags" parameter's possible values are 66 66 * explained above with "DEVFREQ_FLAG_*" macros. 67 67 * @get_dev_status: The device should provide the current performance 68 - * status to devfreq, which is used by governors. 68 + * status to devfreq. Governors are recommended not to 69 + * use this directly. Instead, governors are recommended 70 + * to use devfreq_update_stats() along with 71 + * devfreq.last_status. 69 72 * @get_cur_freq: The device should provide the current frequency 70 73 * at which it is operating. 71 74 * @exit: An optional callback that is called when devfreq ··· 164 161 struct delayed_work work; 165 162 166 163 unsigned long previous_freq; 164 + struct devfreq_dev_status last_status; 167 165 168 166 void *data; /* private data for governors */ 169 167 ··· 207 203 struct devfreq *devfreq); 208 204 extern void devm_devfreq_unregister_opp_notifier(struct device *dev, 209 205 struct devfreq *devfreq); 206 + 207 + /** 208 + * devfreq_update_stats() - update the last_status pointer in struct devfreq 209 + * @df: the devfreq instance whose status needs updating 210 + * 211 + * Governors are recommended to use this function along with last_status, 212 + * which allows other entities to reuse the last_status without affecting 213 + * the values fetched later by governors. 214 + */ 215 + static inline int devfreq_update_stats(struct devfreq *df) 216 + { 217 + return df->profile->get_dev_status(df->dev.parent, &df->last_status); 218 + } 210 219 211 220 #if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND) 212 221 /** ··· 305 288 static inline void devm_devfreq_unregister_opp_notifier(struct device *dev, 306 289 struct devfreq *devfreq) 307 290 { 291 + } 292 + 293 + static inline int devfreq_update_stats(struct devfreq *df) 294 + { 295 + return -EINVAL; 308 296 } 309 297 #endif /* CONFIG_PM_DEVFREQ */ 310 298