* [PATCH v3 0/3] cpufreq: cpufreq-dt: platform_data based proposal
@ 2014-10-19 9:30 Thomas Petazzoni
2014-10-19 9:30 ` [PATCH v3 1/3] cpufreq: allow driver-specific data Thomas Petazzoni
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2014-10-19 9:30 UTC (permalink / raw)
To: Rafael Wysocki
Cc: Viresh Kumar, Lists linaro-kernel, linux-pm@vger.kernel.org,
Shawn Guo, Stephen Boyd, linux-arm-msm@vger.kernel.org,
Sachin Kamat, Thomas Abraham, Santosh Shilimkar,
pramod.gurav@smartplayin.com, Rob Herring, Mike Turquette,
Gregory Clement, Ezequiel Garcia, Tawfik Bayouk, Nadav Haklai,
Lior Amsalem, Thomas Petazzoni
Hello Rafael,
As you requested, here is a new version of the cpufreq-dt patches,
rebased on top of the latest Linus tree
(52d589a01d4545ce1dc5c3892bb8c7b55edfe714 as I write this).
Compared to version 2:
- Rebased on top of latest Linus tree.
- Removed PATCH 3/4, which is meant to go through the mvebu
maintainer tree. I'll push it post-rc1.
- Added Acked-by tags from Viresh, since he ACKed all the patches.
Could you take those patches and push them to 3.18 ?
Thanks a lot,
Thomas
Thomas Petazzoni (3):
cpufreq: allow driver-specific data
cpufreq: cpufreq-dt: extend with platform_data
cpufreq: cpufreq-dt: adjust message related to regulators
drivers/cpufreq/cpufreq-dt.c | 21 +++++++++++++++++----
drivers/cpufreq/cpufreq.c | 15 +++++++++++++++
include/linux/cpufreq-dt.h | 22 ++++++++++++++++++++++
include/linux/cpufreq.h | 2 ++
4 files changed, 56 insertions(+), 4 deletions(-)
create mode 100644 include/linux/cpufreq-dt.h
--
2.0.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 1/3] cpufreq: allow driver-specific data
2014-10-19 9:30 [PATCH v3 0/3] cpufreq: cpufreq-dt: platform_data based proposal Thomas Petazzoni
@ 2014-10-19 9:30 ` Thomas Petazzoni
2014-10-19 9:30 ` [PATCH v3 2/3] cpufreq: cpufreq-dt: extend with platform_data Thomas Petazzoni
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2014-10-19 9:30 UTC (permalink / raw)
To: Rafael Wysocki
Cc: Viresh Kumar, Lists linaro-kernel, linux-pm@vger.kernel.org,
Shawn Guo, Stephen Boyd, linux-arm-msm@vger.kernel.org,
Sachin Kamat, Thomas Abraham, Santosh Shilimkar,
pramod.gurav@smartplayin.com, Rob Herring, Mike Turquette,
Gregory Clement, Ezequiel Garcia, Tawfik Bayouk, Nadav Haklai,
Lior Amsalem, Thomas Petazzoni
This commit extends the cpufreq_driver structure with an additional
'void *driver_data' field that can be filled by the ->probe() function
of a cpufreq driver to pass additional custom information to the
driver itself.
A new function called cpufreq_get_driver_data() is added to allow a
cpufreq driver to retrieve those driver data, since they are typically
needed from a cpufreq_policy->init() callback, which does not have
access to the cpufreq_driver structure. This function call is similar
to the existing cpufreq_get_current_driver() function call.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/cpufreq.c | 15 +++++++++++++++
include/linux/cpufreq.h | 2 ++
2 files changed, 17 insertions(+)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 24bf76f..058d6e0 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1731,6 +1731,21 @@ const char *cpufreq_get_current_driver(void)
}
EXPORT_SYMBOL_GPL(cpufreq_get_current_driver);
+/**
+ * cpufreq_get_driver_data - return current driver data
+ *
+ * Return the private data of the currently loaded cpufreq
+ * driver, or NULL if no cpufreq driver is loaded.
+ */
+void *cpufreq_get_driver_data(void)
+{
+ if (cpufreq_driver)
+ return cpufreq_driver->driver_data;
+
+ return NULL;
+}
+EXPORT_SYMBOL_GPL(cpufreq_get_driver_data);
+
/*********************************************************************
* NOTIFIER LISTS INTERFACE *
*********************************************************************/
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 138336b..503b085 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -219,6 +219,7 @@ __ATTR(_name, 0644, show_##_name, store_##_name)
struct cpufreq_driver {
char name[CPUFREQ_NAME_LEN];
u8 flags;
+ void *driver_data;
/* needed by all drivers */
int (*init) (struct cpufreq_policy *policy);
@@ -312,6 +313,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data);
int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
const char *cpufreq_get_current_driver(void);
+void *cpufreq_get_driver_data(void);
static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
unsigned int min, unsigned int max)
--
2.0.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 2/3] cpufreq: cpufreq-dt: extend with platform_data
2014-10-19 9:30 [PATCH v3 0/3] cpufreq: cpufreq-dt: platform_data based proposal Thomas Petazzoni
2014-10-19 9:30 ` [PATCH v3 1/3] cpufreq: allow driver-specific data Thomas Petazzoni
@ 2014-10-19 9:30 ` Thomas Petazzoni
2014-10-19 9:30 ` [PATCH v3 3/3] cpufreq: cpufreq-dt: adjust message related to regulators Thomas Petazzoni
2014-10-21 13:33 ` [PATCH v3 0/3] cpufreq: cpufreq-dt: platform_data based proposal Rafael J. Wysocki
3 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2014-10-19 9:30 UTC (permalink / raw)
To: Rafael Wysocki
Cc: Viresh Kumar, Lists linaro-kernel, linux-pm@vger.kernel.org,
Shawn Guo, Stephen Boyd, linux-arm-msm@vger.kernel.org,
Sachin Kamat, Thomas Abraham, Santosh Shilimkar,
pramod.gurav@smartplayin.com, Rob Herring, Mike Turquette,
Gregory Clement, Ezequiel Garcia, Tawfik Bayouk, Nadav Haklai,
Lior Amsalem, Thomas Petazzoni
This commit extends the cpufreq-dt driver to take a platform_data
structure. This structure is for now used to tell the cpufreq-dt
driver the layout of the clocks on the platform, i.e whether all CPUs
share the same clock or whether each CPU has a separate clock.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/cpufreq-dt.c | 17 +++++++++++++++--
include/linux/cpufreq-dt.h | 22 ++++++++++++++++++++++
2 files changed, 37 insertions(+), 2 deletions(-)
create mode 100644 include/linux/cpufreq-dt.h
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index 6bbb8b9..52facda 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -18,6 +18,7 @@
#include <linux/cpu.h>
#include <linux/cpu_cooling.h>
#include <linux/cpufreq.h>
+#include <linux/cpufreq-dt.h>
#include <linux/cpumask.h>
#include <linux/err.h>
#include <linux/module.h>
@@ -178,6 +179,7 @@ try_again:
static int cpufreq_init(struct cpufreq_policy *policy)
{
+ struct cpufreq_dt_platform_data *pd;
struct cpufreq_frequency_table *freq_table;
struct thermal_cooling_device *cdev;
struct device_node *np;
@@ -265,9 +267,18 @@ static int cpufreq_init(struct cpufreq_policy *policy)
policy->driver_data = priv;
policy->clk = cpu_clk;
- ret = cpufreq_generic_init(policy, freq_table, transition_latency);
- if (ret)
+ ret = cpufreq_table_validate_and_show(policy, freq_table);
+ if (ret) {
+ dev_err(cpu_dev, "%s: invalid frequency table: %d\n", __func__,
+ ret);
goto out_cooling_unregister;
+ }
+
+ policy->cpuinfo.transition_latency = transition_latency;
+
+ pd = cpufreq_get_driver_data();
+ if (pd && !pd->independent_clocks)
+ cpumask_setall(policy->cpus);
of_node_put(np);
@@ -335,6 +346,8 @@ static int dt_cpufreq_probe(struct platform_device *pdev)
if (!IS_ERR(cpu_reg))
regulator_put(cpu_reg);
+ dt_cpufreq_driver.driver_data = dev_get_platdata(&pdev->dev);
+
ret = cpufreq_register_driver(&dt_cpufreq_driver);
if (ret)
dev_err(cpu_dev, "failed register driver: %d\n", ret);
diff --git a/include/linux/cpufreq-dt.h b/include/linux/cpufreq-dt.h
new file mode 100644
index 0000000..0414009
--- /dev/null
+++ b/include/linux/cpufreq-dt.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2014 Marvell
+ * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __CPUFREQ_DT_H__
+#define __CPUFREQ_DT_H__
+
+struct cpufreq_dt_platform_data {
+ /*
+ * True when each CPU has its own clock to control its
+ * frequency, false when all CPUs are controlled by a single
+ * clock.
+ */
+ bool independent_clocks;
+};
+
+#endif /* __CPUFREQ_DT_H__ */
--
2.0.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 3/3] cpufreq: cpufreq-dt: adjust message related to regulators
2014-10-19 9:30 [PATCH v3 0/3] cpufreq: cpufreq-dt: platform_data based proposal Thomas Petazzoni
2014-10-19 9:30 ` [PATCH v3 1/3] cpufreq: allow driver-specific data Thomas Petazzoni
2014-10-19 9:30 ` [PATCH v3 2/3] cpufreq: cpufreq-dt: extend with platform_data Thomas Petazzoni
@ 2014-10-19 9:30 ` Thomas Petazzoni
2014-10-21 13:33 ` [PATCH v3 0/3] cpufreq: cpufreq-dt: platform_data based proposal Rafael J. Wysocki
3 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2014-10-19 9:30 UTC (permalink / raw)
To: Rafael Wysocki
Cc: Viresh Kumar, Lists linaro-kernel, linux-pm@vger.kernel.org,
Shawn Guo, Stephen Boyd, linux-arm-msm@vger.kernel.org,
Sachin Kamat, Thomas Abraham, Santosh Shilimkar,
pramod.gurav@smartplayin.com, Rob Herring, Mike Turquette,
Gregory Clement, Ezequiel Garcia, Tawfik Bayouk, Nadav Haklai,
Lior Amsalem, Thomas Petazzoni
The cpufreq-dt driver tries to get a regulator for each CPU. This
regulator is optional, but when not present, a scary message "failed
to get cpuX regulator" is displayed. To solve this, we reduce the
severity of the message from dev_warn() to dev_dbg() and we reword the
message to not be as scary.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/cpufreq-dt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index 52facda..92c162a 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -147,8 +147,8 @@ try_again:
goto try_again;
}
- dev_warn(cpu_dev, "failed to get cpu%d regulator: %ld\n",
- cpu, PTR_ERR(cpu_reg));
+ dev_dbg(cpu_dev, "no regulator for cpu%d: %ld\n",
+ cpu, PTR_ERR(cpu_reg));
}
cpu_clk = clk_get(cpu_dev, NULL);
--
2.0.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3 0/3] cpufreq: cpufreq-dt: platform_data based proposal
2014-10-21 13:33 ` [PATCH v3 0/3] cpufreq: cpufreq-dt: platform_data based proposal Rafael J. Wysocki
@ 2014-10-21 13:13 ` Thomas Petazzoni
2014-10-27 13:54 ` Geert Uytterhoeven
1 sibling, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2014-10-21 13:13 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Viresh Kumar, Lists linaro-kernel, linux-pm@vger.kernel.org,
Shawn Guo, Stephen Boyd, linux-arm-msm@vger.kernel.org,
Sachin Kamat, Thomas Abraham, Santosh Shilimkar,
pramod.gurav@smartplayin.com, Rob Herring, Mike Turquette,
Gregory Clement, Ezequiel Garcia, Tawfik Bayouk, Nadav Haklai,
Lior Amsalem
Dear Rafael J. Wysocki,
On Tue, 21 Oct 2014 15:33:09 +0200, Rafael J. Wysocki wrote:
> On Sunday, October 19, 2014 11:30:26 AM Thomas Petazzoni wrote:
> > Hello Rafael,
> >
> > As you requested, here is a new version of the cpufreq-dt patches,
> > rebased on top of the latest Linus tree
> > (52d589a01d4545ce1dc5c3892bb8c7b55edfe714 as I write this).
> >
> > Compared to version 2:
> >
> > - Rebased on top of latest Linus tree.
> >
> > - Removed PATCH 3/4, which is meant to go through the mvebu
> > maintainer tree. I'll push it post-rc1.
> >
> > - Added Acked-by tags from Viresh, since he ACKed all the patches.
> >
> > Could you take those patches and push them to 3.18 ?
>
> I've applied the series and it is in my linux-next branch now (which means that
> it should appear in linux-next proper tomorrow).
>
> I'm going to push it for 3.18-rc2.
Thanks a lot! I'll push the mvebu part of the series separately through
the mvebu maintainers.
Best regards,
Thomas Petazzoni
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 0/3] cpufreq: cpufreq-dt: platform_data based proposal
2014-10-19 9:30 [PATCH v3 0/3] cpufreq: cpufreq-dt: platform_data based proposal Thomas Petazzoni
` (2 preceding siblings ...)
2014-10-19 9:30 ` [PATCH v3 3/3] cpufreq: cpufreq-dt: adjust message related to regulators Thomas Petazzoni
@ 2014-10-21 13:33 ` Rafael J. Wysocki
2014-10-21 13:13 ` Thomas Petazzoni
2014-10-27 13:54 ` Geert Uytterhoeven
3 siblings, 2 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2014-10-21 13:33 UTC (permalink / raw)
To: Thomas Petazzoni
Cc: Viresh Kumar, Lists linaro-kernel, linux-pm@vger.kernel.org,
Shawn Guo, Stephen Boyd, linux-arm-msm@vger.kernel.org,
Sachin Kamat, Thomas Abraham, Santosh Shilimkar,
pramod.gurav@smartplayin.com, Rob Herring, Mike Turquette,
Gregory Clement, Ezequiel Garcia, Tawfik Bayouk, Nadav Haklai,
Lior Amsalem
On Sunday, October 19, 2014 11:30:26 AM Thomas Petazzoni wrote:
> Hello Rafael,
>
> As you requested, here is a new version of the cpufreq-dt patches,
> rebased on top of the latest Linus tree
> (52d589a01d4545ce1dc5c3892bb8c7b55edfe714 as I write this).
>
> Compared to version 2:
>
> - Rebased on top of latest Linus tree.
>
> - Removed PATCH 3/4, which is meant to go through the mvebu
> maintainer tree. I'll push it post-rc1.
>
> - Added Acked-by tags from Viresh, since he ACKed all the patches.
>
> Could you take those patches and push them to 3.18 ?
I've applied the series and it is in my linux-next branch now (which means that
it should appear in linux-next proper tomorrow).
I'm going to push it for 3.18-rc2.
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 0/3] cpufreq: cpufreq-dt: platform_data based proposal
2014-10-21 13:33 ` [PATCH v3 0/3] cpufreq: cpufreq-dt: platform_data based proposal Rafael J. Wysocki
2014-10-21 13:13 ` Thomas Petazzoni
@ 2014-10-27 13:54 ` Geert Uytterhoeven
1 sibling, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2014-10-27 13:54 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Thomas Petazzoni, Viresh Kumar, Lists linaro-kernel,
linux-pm@vger.kernel.org, Shawn Guo, Stephen Boyd,
linux-arm-msm@vger.kernel.org, Sachin Kamat, Thomas Abraham,
Santosh Shilimkar, pramod.gurav@smartplayin.com, Rob Herring,
Mike Turquette, Gregory Clement, Ezequiel Garcia, Tawfik Bayouk,
Nadav Haklai, Lior Amsalem
On Tue, Oct 21, 2014 at 3:33 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Sunday, October 19, 2014 11:30:26 AM Thomas Petazzoni wrote:
>> Hello Rafael,
>>
>> As you requested, here is a new version of the cpufreq-dt patches,
>> rebased on top of the latest Linus tree
>> (52d589a01d4545ce1dc5c3892bb8c7b55edfe714 as I write this).
>>
>> Compared to version 2:
>>
>> - Rebased on top of latest Linus tree.
>>
>> - Removed PATCH 3/4, which is meant to go through the mvebu
>> maintainer tree. I'll push it post-rc1.
>>
>> - Added Acked-by tags from Viresh, since he ACKed all the patches.
>>
>> Could you take those patches and push them to 3.18 ?
>
> I've applied the series and it is in my linux-next branch now (which means that
> it should appear in linux-next proper tomorrow).
>
> I'm going to push it for 3.18-rc2.
Unfortunately this caused a regression (crash). Fix available in
https://lkml.org/lkml/2014/10/27/361
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-10-27 13:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-19 9:30 [PATCH v3 0/3] cpufreq: cpufreq-dt: platform_data based proposal Thomas Petazzoni
2014-10-19 9:30 ` [PATCH v3 1/3] cpufreq: allow driver-specific data Thomas Petazzoni
2014-10-19 9:30 ` [PATCH v3 2/3] cpufreq: cpufreq-dt: extend with platform_data Thomas Petazzoni
2014-10-19 9:30 ` [PATCH v3 3/3] cpufreq: cpufreq-dt: adjust message related to regulators Thomas Petazzoni
2014-10-21 13:33 ` [PATCH v3 0/3] cpufreq: cpufreq-dt: platform_data based proposal Rafael J. Wysocki
2014-10-21 13:13 ` Thomas Petazzoni
2014-10-27 13:54 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).