Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1736289 > unrolled thread
| Started by | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| First post | 2017-09-21 02:40 +0200 |
| Last post | 2017-09-26 04:40 +0200 |
| Articles | 7 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 0/8] PM / devfreq: Use OPP interface to handle the frequency Chanwoo Choi <cw00.choi@samsung.com> - 2017-09-21 02:40 +0200
[PATCH v2 1/8] PM / devfreq: Set min/max_freq when adding the devfreq device Chanwoo Choi <cw00.choi@samsung.com> - 2017-09-21 02:40 +0200
[PATCH v2 3/8] PM / devfreq: Show the available min/max frequency through sysfs node Chanwoo Choi <cw00.choi@samsung.com> - 2017-09-21 02:40 +0200
[PATCH v2 8/8] PM / devfreq: exynos-bus: Register cooling device Chanwoo Choi <cw00.choi@samsung.com> - 2017-09-21 02:40 +0200
Re: [PATCH v2 8/8] PM / devfreq: exynos-bus: Register cooling device Chanwoo Choi <cw00.choi@samsung.com> - 2017-09-21 07:00 +0200
[PATCH v2 6/8] PM / devfreq: Remove unneeded conditional statement Chanwoo Choi <cw00.choi@samsung.com> - 2017-09-21 02:40 +0200
[PATCH v2.1] PM / devfreq: exynos-bus: Register cooling device Chanwoo Choi <cw00.choi@samsung.com> - 2017-09-26 04:40 +0200
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2017-09-21 02:40 +0200 |
| Subject | [PATCH v2 0/8] PM / devfreq: Use OPP interface to handle the frequency |
| Message-ID | <urXH3-1Ui-3@gated-at.bofh.it> |
These patches makes the devfreq to use the OPP interface and clean-up codes.
- patch 1~5 are related to the OPP interfaces.
- patch 6 removes the unneeded code.
- patch 7 clean-up for the governor name.
- patch 8 registers the cooling device for exynos-bus.
[Detaild Descripion]
The commit a76caf55e5b3 ("thermal: Add devfreq cooling") provides
the devfreq cooling device by using the OPP interface such as
dev_pm_opp_disable() and dev_pm_opp_enable(). It means that
the OPP interface is able to change the available status of the frequency.
Firstly, the existing devfreq doesn't use the OPP interface when showing
the minimum and maximum frequency through the following sysfs nodes:
It shows the wrong frequency value because min_freq/max_freq don't
consider the frequency status by handling OPP interface
(opp_dev_pm_opp_{disable|add}()). So, these patches fix this issue.
- /sys/class/devfreq/devfreqX/min_freq
- /sys/class/devfreq/devfreqX/max_freq
Second, the 'available_frequencies' should show the all supported frequencis
even if the specific frequency is not available. It doesn't matter whether
frequneyc is available or not. Because the role of 'available_frequencies'
shows the all frequencies. Also, these patches fix this issue.
- /sys/class/devfreq/devfreqX/available_frequencies
Third, update_devfreq() get the available next frequency by using
the devfreq_recommended_opp() in order to consider the disabled OPP.
For example,
- devfreq's min_freq is 100Mhz and max_freq is 700Mhz.
- OPP disabled 500/600/700Mhz due to devfreq-cooling.c.
- simple_ondemand govenor decided the next target_freq (600Mhz)
|----------|-------------------------------------------------------------|
|Freq(MHz) |100 |200 |300 |400 |500 |600 |70 0 |
|Devfreq |min_freq| | | | | |max_freq|
|OPP avail |enabled |enabled|enabled|enabled |Disabled| Disabled|Disabled|
|Ondmenad | | | | | |next_freq| |
|------------------------------------------------------------------------|
In result,
- Before this patch, target_freq is 600Mhz
and TRANSITION_NOTIFIER sends the next_freq is 600Mhz to the notifiee.
- After this patch, target_freq is 400Mhz because 500/600 were disabled by OPP.
And TRANSITION_NOTIFIER sends the next_freq is 400Mhz to the notifiee.
Lastly,
- patch6/7 fix the minor issue and cleanup codes.
- patch8 register the cooling device. It depends on opp patch[1].
[1] https://patchwork.kernel.org/patch/9962387/
Changes from v1:
(https://lkml.org/lkml/2017/8/23/785)
- Show the available frequencies as an ascending order
- Change the author info from cwchoi00@gmail.com to cw00.choi@samsung.com
- Drop the patches related to opp_notifier
- Add new patch5/6/7/8
Chanwoo Choi (8):
PM / devfreq: Set min/max_freq when adding the devfreq device
Revert "PM / devfreq: Add show_one macro to delete the duplicate code"
PM / devfreq: Show the available min/max frequency through sysfs node
PM / devfreq: Show the all available frequencies
PM / devfreq: Get the available next frequency on update_devfreq()
PM / devfreq: Remove unneeded conditional statement
PM / devfreq: Define the constant governor name
PM / devfreq: exynos-bus: Register cooling device
drivers/devfreq/Kconfig | 1 +
drivers/devfreq/devfreq.c | 121 +++++++++++++++++++++++-------
drivers/devfreq/exynos-bus.c | 16 +++-
drivers/devfreq/governor_passive.c | 2 +-
drivers/devfreq/governor_performance.c | 2 +-
drivers/devfreq/governor_powersave.c | 2 +-
drivers/devfreq/governor_simpleondemand.c | 2 +-
drivers/devfreq/governor_userspace.c | 2 +-
drivers/devfreq/rk3399_dmc.c | 2 +-
include/linux/devfreq.h | 7 ++
10 files changed, 123 insertions(+), 34 deletions(-)
--
1.9.1
[toc] | [next] | [standalone]
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2017-09-21 02:40 +0200 |
| Subject | [PATCH v2 1/8] PM / devfreq: Set min/max_freq when adding the devfreq device |
| Message-ID | <urXH5-1Ui-41@gated-at.bofh.it> |
| In reply to | #1736289 |
Prior to that, the min/max_freq of the devfreq device are always zero
before the user changes the min/max_freq through sysfs entries.
It might make the confusion for the min/max_freq.
This patch initializes the available min/max_freq by using the OPP
during adding the devfreq device.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
drivers/devfreq/devfreq.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index a1c4ee818614..ae8717a6eee1 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -69,6 +69,34 @@ static struct devfreq *find_device_devfreq(struct device *dev)
return ERR_PTR(-ENODEV);
}
+static unsigned long find_available_min_freq(struct devfreq *devfreq)
+{
+ struct dev_pm_opp *opp;
+ unsigned long min_freq = 0;
+
+ opp = dev_pm_opp_find_freq_ceil(devfreq->dev.parent, &min_freq);
+ if (IS_ERR(opp))
+ min_freq = 0;
+ else
+ dev_pm_opp_put(opp);
+
+ return min_freq;
+}
+
+static unsigned long find_available_max_freq(struct devfreq *devfreq)
+{
+ struct dev_pm_opp *opp;
+ unsigned long max_freq = ULONG_MAX;
+
+ opp = dev_pm_opp_find_freq_floor(devfreq->dev.parent, &max_freq);
+ if (IS_ERR(opp))
+ max_freq = 0;
+ else
+ dev_pm_opp_put(opp);
+
+ return max_freq;
+}
+
/**
* devfreq_get_freq_level() - Lookup freq_table for the frequency
* @devfreq: the devfreq instance
@@ -559,6 +587,21 @@ struct devfreq *devfreq_add_device(struct device *dev,
mutex_lock(&devfreq->lock);
}
+ /* Set the scaling available min_freq and max_freq */
+ devfreq->min_freq = find_available_min_freq(devfreq);
+ if (!devfreq->min_freq) {
+ mutex_unlock(&devfreq->lock);
+ err = -EINVAL;
+ goto err_dev;
+ }
+
+ devfreq->max_freq = find_available_max_freq(devfreq);
+ if (!devfreq->max_freq) {
+ mutex_unlock(&devfreq->lock);
+ err = -EINVAL;
+ goto err_dev;
+ }
+
dev_set_name(&devfreq->dev, "devfreq%d",
atomic_inc_return(&devfreq_no));
err = device_register(&devfreq->dev);
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2017-09-21 02:40 +0200 |
| Subject | [PATCH v2 3/8] PM / devfreq: Show the available min/max frequency through sysfs node |
| Message-ID | <urXH5-1Ui-45@gated-at.bofh.it> |
| In reply to | #1736289 |
The existing {min|max}_freq sysfs nodes don't consider whether min/max_freq
are available or not. Those sysfs nodes show just the stored value
in the struct devfreq.
The devfreq uses the OPP interface and then dev_pm_opp_{disable|add}()
might change the state of the device's supported frequency. This patch
shows the available minimum and maximum frequency through sysfs node.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
drivers/devfreq/devfreq.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 2ce1fd0a1324..799a0cf75d39 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -1128,7 +1128,14 @@ static ssize_t min_freq_store(struct device *dev, struct device_attribute *attr,
static ssize_t min_freq_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
- return sprintf(buf, "%lu\n", to_devfreq(dev)->min_freq);
+ struct devfreq *df = to_devfreq(dev);
+ unsigned long min_freq = to_devfreq(dev)->min_freq;
+ unsigned long available_min_freq = find_available_min_freq(df);
+
+ if (available_min_freq != 0 && min_freq < available_min_freq)
+ min_freq = available_min_freq;
+
+ return sprintf(buf, "%lu\n", min_freq);
}
static ssize_t max_freq_store(struct device *dev, struct device_attribute *attr,
@@ -1162,7 +1169,14 @@ static ssize_t max_freq_store(struct device *dev, struct device_attribute *attr,
static ssize_t max_freq_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
- return sprintf(buf, "%lu\n", to_devfreq(dev)->max_freq);
+ struct devfreq *df = to_devfreq(dev);
+ unsigned long max_freq = to_devfreq(dev)->max_freq;
+ unsigned long available_max_freq = find_available_max_freq(df);
+
+ if (available_max_freq != 0 && max_freq > available_max_freq)
+ max_freq = available_max_freq;
+
+ return sprintf(buf, "%lu\n", max_freq);
}
static DEVICE_ATTR_RW(max_freq);
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2017-09-21 02:40 +0200 |
| Subject | [PATCH v2 8/8] PM / devfreq: exynos-bus: Register cooling device |
| Message-ID | <urXH5-1Ui-51@gated-at.bofh.it> |
| In reply to | #1736289 |
This patch registers the Exynos Bus-Frequency scaling device
as a cooling device of thermal management.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
drivers/devfreq/Kconfig | 1 +
drivers/devfreq/exynos-bus.c | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig
index 6a172d338f6d..eb8128e08b2c 100644
--- a/drivers/devfreq/Kconfig
+++ b/drivers/devfreq/Kconfig
@@ -81,6 +81,7 @@ config ARM_EXYNOS_BUS_DEVFREQ
select DEVFREQ_GOV_SIMPLE_ONDEMAND
select DEVFREQ_GOV_PASSIVE
select DEVFREQ_EVENT_EXYNOS_PPMU
+ select DEVFREQ_THERMAL
select PM_DEVFREQ_EVENT
select PM_OPP
help
diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
index c25658b26598..200ca0d11834 100644
--- a/drivers/devfreq/exynos-bus.c
+++ b/drivers/devfreq/exynos-bus.c
@@ -15,6 +15,7 @@
#include <linux/clk.h>
#include <linux/devfreq.h>
#include <linux/devfreq-event.h>
+#include <linux/devfreq_cooling.h>
#include <linux/device.h>
#include <linux/export.h>
#include <linux/module.h>
@@ -41,6 +42,8 @@ struct exynos_bus {
struct clk *clk;
unsigned int voltage_tolerance;
unsigned int ratio;
+
+ struct thermal_cooling_device *cdev;
};
/*
@@ -468,6 +471,14 @@ static int exynos_bus_probe(struct platform_device *pdev)
goto err;
}
+ /* Register devfreq cooling device */
+ bus->cdev = of_devfreq_cooling_register(np, bus->devfreq);
+ if (IS_ERR(bus->cdev) < 0) {
+ dev_err(dev, "failed to register cooling device\n");
+ ret = PTR_ERR(bus->cdev);
+ goto err;
+ }
+
goto out;
passive:
/* Initialize the struct profile and governor data for passive device */
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2017-09-21 07:00 +0200 |
| Subject | Re: [PATCH v2 8/8] PM / devfreq: exynos-bus: Register cooling device |
| Message-ID | <us1KF-4xO-3@gated-at.bofh.it> |
| In reply to | #1736295 |
Dear all,
Please ignore this patch. It has some problem.
I'll fix and resend this patch on v2.
Chanwoo Choi
Samsung Electronics
On 2017년 09월 21일 09:33, Chanwoo Choi wrote:
> This patch registers the Exynos Bus-Frequency scaling device
> as a cooling device of thermal management.
>
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <krzk@kernel.org>
> Cc: linux-samsung-soc@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> ---
> drivers/devfreq/Kconfig | 1 +
> drivers/devfreq/exynos-bus.c | 11 +++++++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig
> index 6a172d338f6d..eb8128e08b2c 100644
> --- a/drivers/devfreq/Kconfig
> +++ b/drivers/devfreq/Kconfig
> @@ -81,6 +81,7 @@ config ARM_EXYNOS_BUS_DEVFREQ
> select DEVFREQ_GOV_SIMPLE_ONDEMAND
> select DEVFREQ_GOV_PASSIVE
> select DEVFREQ_EVENT_EXYNOS_PPMU
> + select DEVFREQ_THERMAL
> select PM_DEVFREQ_EVENT
> select PM_OPP
> help
> diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
> index c25658b26598..200ca0d11834 100644
> --- a/drivers/devfreq/exynos-bus.c
> +++ b/drivers/devfreq/exynos-bus.c
> @@ -15,6 +15,7 @@
> #include <linux/clk.h>
> #include <linux/devfreq.h>
> #include <linux/devfreq-event.h>
> +#include <linux/devfreq_cooling.h>
> #include <linux/device.h>
> #include <linux/export.h>
> #include <linux/module.h>
> @@ -41,6 +42,8 @@ struct exynos_bus {
> struct clk *clk;
> unsigned int voltage_tolerance;
> unsigned int ratio;
> +
> + struct thermal_cooling_device *cdev;
> };
>
> /*
> @@ -468,6 +471,14 @@ static int exynos_bus_probe(struct platform_device *pdev)
> goto err;
> }
>
> + /* Register devfreq cooling device */
> + bus->cdev = of_devfreq_cooling_register(np, bus->devfreq);
> + if (IS_ERR(bus->cdev) < 0) {
> + dev_err(dev, "failed to register cooling device\n");
> + ret = PTR_ERR(bus->cdev);
> + goto err;
> + }
> +
> goto out;
> passive:
> /* Initialize the struct profile and governor data for passive device */
>
[toc] | [prev] | [next] | [standalone]
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2017-09-21 02:40 +0200 |
| Subject | [PATCH v2 6/8] PM / devfreq: Remove unneeded conditional statement |
| Message-ID | <urXH5-1Ui-55@gated-at.bofh.it> |
| In reply to | #1736289 |
The commit 0ec09ac2cebe9 ("PM / devfreq: Set the freq_table of devfreq
device") initializes the freq_table array of each devfreq device always.
In result, it is unneeded to check whether profile->freq_table is NULL
or not.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
drivers/devfreq/devfreq.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 3b9662ffe603..b28810cae7ee 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -315,10 +315,9 @@ int update_devfreq(struct devfreq *devfreq)
freqs.new = freq;
devfreq_notify_transition(devfreq, &freqs, DEVFREQ_POSTCHANGE);
- if (devfreq->profile->freq_table)
- if (devfreq_update_status(devfreq, freq))
- dev_err(&devfreq->dev,
- "Couldn't update frequency transition information.\n");
+ if (devfreq_update_status(devfreq, freq))
+ dev_err(&devfreq->dev,
+ "Couldn't update frequency transition information.\n");
devfreq->previous_freq = freq;
return err;
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2017-09-26 04:40 +0200 |
| Subject | [PATCH v2.1] PM / devfreq: exynos-bus: Register cooling device |
| Message-ID | <utNWW-6Tq-7@gated-at.bofh.it> |
| In reply to | #1736289 |
This patch registers the Exynos Bus-Frequency scaling device
as a cooling device of thermal management.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
drivers/devfreq/exynos-bus.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
index c25658b26598..fe9ef6a3238b 100644
--- a/drivers/devfreq/exynos-bus.c
+++ b/drivers/devfreq/exynos-bus.c
@@ -15,6 +15,7 @@
#include <linux/clk.h>
#include <linux/devfreq.h>
#include <linux/devfreq-event.h>
+#include <linux/devfreq_cooling.h>
#include <linux/device.h>
#include <linux/export.h>
#include <linux/module.h>
@@ -41,6 +42,8 @@ struct exynos_bus {
struct clk *clk;
unsigned int voltage_tolerance;
unsigned int ratio;
+
+ struct thermal_cooling_device *cdev;
};
/*
@@ -468,6 +471,13 @@ static int exynos_bus_probe(struct platform_device *pdev)
goto err;
}
+ /* Register devfreq cooling device */
+ bus->cdev = of_devfreq_cooling_register(np, bus->devfreq);
+ if (IS_ERR(bus->cdev)) {
+ dev_err(dev, "running exynos-bus without cooling device\n");
+ bus->cdev = NULL;
+ }
+
goto out;
passive:
/* Initialize the struct profile and governor data for passive device */
@@ -514,6 +524,15 @@ static int exynos_bus_probe(struct platform_device *pdev)
return ret;
}
+static int exynos_bus_remove(struct platform_device *pdev)
+{
+ struct exynos_bus *bus = platform_get_drvdata(pdev);
+
+ devfreq_cooling_unregister(bus->cdev);
+
+ return 0;
+}
+
#ifdef CONFIG_PM_SLEEP
static int exynos_bus_resume(struct device *dev)
{
@@ -556,6 +575,7 @@ static int exynos_bus_suspend(struct device *dev)
static struct platform_driver exynos_bus_platdrv = {
.probe = exynos_bus_probe,
+ .remove = exynos_bus_remove,
.driver = {
.name = "exynos-bus",
.pm = &exynos_bus_pm,
--
1.9.1
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web