mirror of
https://github.com/armbian/build.git
synced 2025-08-12 14:16:57 +02:00
* Recycling of megous v5.16.4 patches The patches were sorted as far as possible. Some patches are renamed according to their place of application. The length of the patch name has been changed to improve readability using the `git format-patch --filename-max-length=75` method. The folder containing the patches will have the name `patches.name` and the corresponding file `series.name` for the convenience of processing and moving them upstream. But the control file remains `series.conf`. Signed-off-by: The-going <48602507+The-going@users.noreply.github.com> * Add a series of armbian patches for 5.16 Signed-off-by: The-going <48602507+The-going@users.noreply.github.com> * Remove patches whose fixes are already in the kernel Signed-off-by: The-going <48602507+The-going@users.noreply.github.com>
72 lines
2.5 KiB
Diff
72 lines
2.5 KiB
Diff
From 0fe8b118cd5e40755f967cc64ca9ef2abeabfbbe Mon Sep 17 00:00:00 2001
|
|
From: Samuel Holland <samuel@sholland.org>
|
|
Date: Sat, 3 Apr 2021 17:07:13 -0500
|
|
Subject: [PATCH 227/446] PM / devfreq: Add a recommended frequency helper
|
|
|
|
This helper peforms the same function as devfreq_recommended_opp().
|
|
However, it works on devices without OPPs by iterating over freq_table.
|
|
Since freq_table is assumed to be sorted in ascending order, the
|
|
algorithm is relatively simple.
|
|
|
|
Devices with OPPs should continue using devfreq_recommended_opp(), as
|
|
that function respects disabled OPPs.
|
|
|
|
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
---
|
|
drivers/devfreq/devfreq.c | 25 +++++++++++++++++++++++++
|
|
include/linux/devfreq.h | 2 ++
|
|
2 files changed, 27 insertions(+)
|
|
|
|
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
|
|
index 003b4156c..2e2dee790 100644
|
|
--- a/drivers/devfreq/devfreq.c
|
|
+++ b/drivers/devfreq/devfreq.c
|
|
@@ -2010,6 +2010,31 @@ subsys_initcall(devfreq_init);
|
|
* OPP framework.
|
|
*/
|
|
|
|
+/**
|
|
+ * devfreq_recommended_freq() - Helper function to get the proper frequency from
|
|
+ * freq_table for the value given to target callback.
|
|
+ * @devfreq: The devfreq device.
|
|
+ * @freq: The frequency given to target function.
|
|
+ * @flags: Flags handed from devfreq framework.
|
|
+ */
|
|
+void devfreq_recommended_freq(struct devfreq *devfreq,
|
|
+ unsigned long *freq, u32 flags)
|
|
+{
|
|
+ const unsigned long *min = devfreq->profile->freq_table;
|
|
+ const unsigned long *max = min + devfreq->profile->max_state - 1;
|
|
+ const unsigned long *f;
|
|
+
|
|
+ if (flags & DEVFREQ_FLAG_LEAST_UPPER_BOUND) {
|
|
+ /* Find the first item lower than freq, or else min. */
|
|
+ for (f = max; f > min && *f > *freq; --f);
|
|
+ } else {
|
|
+ /* Find the first item higher than freq, or else max. */
|
|
+ for (f = min; f < max && *f < *freq; ++f);
|
|
+ }
|
|
+ *freq = *f;
|
|
+}
|
|
+EXPORT_SYMBOL(devfreq_recommended_freq);
|
|
+
|
|
/**
|
|
* devfreq_recommended_opp() - Helper function to get proper OPP for the
|
|
* freq value given to target callback.
|
|
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
|
|
index 142474b4a..4d324fea8 100644
|
|
--- a/include/linux/devfreq.h
|
|
+++ b/include/linux/devfreq.h
|
|
@@ -239,6 +239,8 @@ void devfreq_resume(void);
|
|
int update_devfreq(struct devfreq *devfreq);
|
|
|
|
/* Helper functions for devfreq user device driver with OPP. */
|
|
+void devfreq_recommended_freq(struct devfreq *devfreq,
|
|
+ unsigned long *freq, u32 flags);
|
|
struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
|
|
unsigned long *freq, u32 flags);
|
|
int devfreq_register_opp_notifier(struct device *dev,
|
|
--
|
|
2.31.1
|
|
|