* [PATCH v5 0/2] cpufreq: opp: Add device tree based lookup of boost mode frequency @ 2014-05-29 14:38 Thomas Abraham 2014-05-29 14:38 ` [PATCH v5 1/2] cpufreq / OPP: Allow boost frequency to be looked up from device tree Thomas Abraham 2014-05-29 14:38 ` [PATCH v5 2/2] Documentation: devicetree: Add boost-frequency binding to list boost mode frequency Thomas Abraham 0 siblings, 2 replies; 6+ messages in thread From: Thomas Abraham @ 2014-05-29 14:38 UTC (permalink / raw) To: linux-pm, devicetree, linux-arm-kernel Cc: rjw, linux-samsung-soc, kgene.kim, t.figa, l.majewski, viresh.kumar, thomas.ab Changes since v5: - Code improvements suggested by Viresh Kumar. Changes since v4: - Includes cleanup changes suggested by Viresh Kumar. Changes since v3: - Minor changes as suggested in the last version. Changes since v2: - Reworked based on the "PM / OPP: move cpufreq specific helpers out of OPP layer" patch series posted by Nishanth Menon <n...@ti.com>. Changes since v1: - Boost mode frequencies are specfied as a set of frequencies instead of specifying them as OPPs. Thanks to Nishanth, Lukasz and Rob for the feedback. Commit 6f19efc0 ("cpufreq: Add boost frequency support in core") adds support for CPU boost mode for CPUfreq drivers. To use the new boost mode, CPUfreq drivers have to specify the boost mode frequency and voltage within the CPUfreq driver, which is the case for Exynos4x12 CPUfreq driver. But for CPUfreq drivers which obtain the OPPs from cpus node, this patch series adds support to specify boost mode frequencies in the cpu device tree node. This requirement came up when Lukasz pointed out the regression caused by the Exynos CPUfreq driver consolidation patches. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v5 1/2] cpufreq / OPP: Allow boost frequency to be looked up from device tree 2014-05-29 14:38 [PATCH v5 0/2] cpufreq: opp: Add device tree based lookup of boost mode frequency Thomas Abraham @ 2014-05-29 14:38 ` Thomas Abraham 2014-05-29 20:51 ` Nishanth Menon 2014-05-30 7:31 ` Lukasz Majewski 2014-05-29 14:38 ` [PATCH v5 2/2] Documentation: devicetree: Add boost-frequency binding to list boost mode frequency Thomas Abraham 1 sibling, 2 replies; 6+ messages in thread From: Thomas Abraham @ 2014-05-29 14:38 UTC (permalink / raw) To: linux-pm, devicetree, linux-arm-kernel Cc: rjw, linux-samsung-soc, kgene.kim, t.figa, l.majewski, viresh.kumar, thomas.ab, Nishanth Menon From: Thomas Abraham <thomas.ab@samsung.com> Commit 6f19efc0 ("cpufreq: Add boost frequency support in core") adds support for CPU boost mode. This patch adds support for finding available boost frequencies from device tree and marking them as usable in boost mode. Cc: Nishanth Menon <nm@ti.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Thomas Abraham <thomas.ab@samsung.com> --- drivers/cpufreq/cpufreq_opp.c | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/cpufreq/cpufreq_opp.c b/drivers/cpufreq/cpufreq_opp.c index c0c6f4a..05fb115 100644 --- a/drivers/cpufreq/cpufreq_opp.c +++ b/drivers/cpufreq/cpufreq_opp.c @@ -19,6 +19,7 @@ #include <linux/pm_opp.h> #include <linux/rcupdate.h> #include <linux/slab.h> +#include <linux/of.h> /** * dev_pm_opp_init_cpufreq_table() - create a cpufreq table for a device @@ -51,6 +52,11 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev, struct cpufreq_frequency_table *freq_table = NULL; int i, max_opps, ret = 0; unsigned long rate; +#ifdef CONFIG_CPU_FREQ_BOOST_SW + struct cpufreq_frequency_table *ft; + int len, count; + u32 *boost_freqs = NULL; +#endif rcu_read_lock(); @@ -82,6 +88,45 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev, *table = &freq_table[0]; +#ifdef CONFIG_CPU_FREQ_BOOST_SW + if (!of_find_property(dev->of_node, "boost-frequencies", &len)) + goto out; + + if (!len || !IS_ALIGNED(len, sizeof(u32))) { + dev_err(dev, "%s: invalid boost frequency\n", __func__); + ret = -EINVAL; + goto out; + } + + boost_freqs = kmalloc(len, GFP_KERNEL); + if (!boost_freqs) { + dev_err(dev, "%s: no memory for boost freq table\n", __func__); + ret = -ENOMEM; + goto out; + } + + count = len / sizeof(u32); + of_property_read_u32_array(dev->of_node, "boost-frequencies", + boost_freqs, count); + + for (i = 0; i < count; i++) { + cpufreq_for_each_valid_entry(ft, *table) { + if (boost_freqs[i] == ft->frequency) { + ft->flags |= CPUFREQ_BOOST_FREQ; + pr_debug("%s: marked %d as boost frequency\n", + __func__, boost_freqs[i]); + break; + } + } + + if (ft->frequency == CPUFREQ_TABLE_END) + dev_err(dev, "%s: invalid boost frequency %d\n", + __func__, boost_freqs[i]); + } + + kfree(boost_freqs); +#endif + out: rcu_read_unlock(); if (ret) -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v5 1/2] cpufreq / OPP: Allow boost frequency to be looked up from device tree 2014-05-29 14:38 ` [PATCH v5 1/2] cpufreq / OPP: Allow boost frequency to be looked up from device tree Thomas Abraham @ 2014-05-29 20:51 ` Nishanth Menon 2014-05-30 7:31 ` Lukasz Majewski 1 sibling, 0 replies; 6+ messages in thread From: Nishanth Menon @ 2014-05-29 20:51 UTC (permalink / raw) To: Thomas Abraham, linux-pm, devicetree, linux-arm-kernel Cc: rjw, linux-samsung-soc, kgene.kim, t.figa, l.majewski, viresh.kumar On 05/29/2014 09:38 AM, Thomas Abraham wrote: > From: Thomas Abraham <thomas.ab@samsung.com> > > Commit 6f19efc0 ("cpufreq: Add boost frequency support in core") adds > support for CPU boost mode. This patch adds support for finding available > boost frequencies from device tree and marking them as usable in boost mode. > > Cc: Nishanth Menon <nm@ti.com> > Cc: Lukasz Majewski <l.majewski@samsung.com> > Signed-off-by: Thomas Abraham <thomas.ab@samsung.com> > --- > drivers/cpufreq/cpufreq_opp.c | 45 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 45 insertions(+) > > diff --git a/drivers/cpufreq/cpufreq_opp.c b/drivers/cpufreq/cpufreq_opp.c > index c0c6f4a..05fb115 100644 > --- a/drivers/cpufreq/cpufreq_opp.c > +++ b/drivers/cpufreq/cpufreq_opp.c > @@ -19,6 +19,7 @@ > #include <linux/pm_opp.h> > #include <linux/rcupdate.h> > #include <linux/slab.h> > +#include <linux/of.h> > > /** > * dev_pm_opp_init_cpufreq_table() - create a cpufreq table for a device > @@ -51,6 +52,11 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev, > struct cpufreq_frequency_table *freq_table = NULL; > int i, max_opps, ret = 0; > unsigned long rate; > +#ifdef CONFIG_CPU_FREQ_BOOST_SW > + struct cpufreq_frequency_table *ft; > + int len, count; > + u32 *boost_freqs = NULL; > +#endif > > rcu_read_lock(); > > @@ -82,6 +88,45 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev, > > *table = &freq_table[0]; > > +#ifdef CONFIG_CPU_FREQ_BOOST_SW > + if (!of_find_property(dev->of_node, "boost-frequencies", &len)) > + goto out; > + > + if (!len || !IS_ALIGNED(len, sizeof(u32))) { > + dev_err(dev, "%s: invalid boost frequency\n", __func__); > + ret = -EINVAL; > + goto out; > + } > + > + boost_freqs = kmalloc(len, GFP_KERNEL); > + if (!boost_freqs) { > + dev_err(dev, "%s: no memory for boost freq table\n", __func__); > + ret = -ENOMEM; > + goto out; > + } > + > + count = len / sizeof(u32); > + of_property_read_u32_array(dev->of_node, "boost-frequencies", > + boost_freqs, count); > + > + for (i = 0; i < count; i++) { > + cpufreq_for_each_valid_entry(ft, *table) { > + if (boost_freqs[i] == ft->frequency) { > + ft->flags |= CPUFREQ_BOOST_FREQ; > + pr_debug("%s: marked %d as boost frequency\n", > + __func__, boost_freqs[i]); > + break; > + } > + } > + > + if (ft->frequency == CPUFREQ_TABLE_END) > + dev_err(dev, "%s: invalid boost frequency %d\n", > + __func__, boost_freqs[i]); > + } > + > + kfree(boost_freqs); > +#endif > + > out: > rcu_read_unlock(); > if (ret) > I suggest the following checkpatch --strict warnings should be fixed. @@ -0,0 +1,10 @@ +CHECK: Alignment should match open parenthesis +#65: FILE: drivers/cpufreq/cpufreq_opp.c:110: ++ of_property_read_u32_array(dev->of_node, "boost-frequencies", ++ boost_freqs, count); +CHECK: Alignment should match open parenthesis +#72: FILE: drivers/cpufreq/cpufreq_opp.c:117: ++ pr_debug("%s: marked %d as boost frequency\n", ++ __func__, boost_freqs[i]); +If any of these errors are false positives, please report +them to the maintainer, see CHECKPATCH in MAINTAINERS. Otherwise, For the entire series: Acked-by: Nishanth Menon <nm@ti.com> -- Regards, Nishanth Menon ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v5 1/2] cpufreq / OPP: Allow boost frequency to be looked up from device tree 2014-05-29 14:38 ` [PATCH v5 1/2] cpufreq / OPP: Allow boost frequency to be looked up from device tree Thomas Abraham 2014-05-29 20:51 ` Nishanth Menon @ 2014-05-30 7:31 ` Lukasz Majewski 1 sibling, 0 replies; 6+ messages in thread From: Lukasz Majewski @ 2014-05-30 7:31 UTC (permalink / raw) To: Thomas Abraham Cc: linux-pm, devicetree, linux-arm-kernel, Nishanth Menon, kgene.kim, viresh.kumar, t.figa, rjw, linux-samsung-soc Hi Thomas, > From: Thomas Abraham <thomas.ab@samsung.com> > > Commit 6f19efc0 ("cpufreq: Add boost frequency support in core") adds > support for CPU boost mode. This patch adds support for finding > available boost frequencies from device tree and marking them as > usable in boost mode. > > Cc: Nishanth Menon <nm@ti.com> > Cc: Lukasz Majewski <l.majewski@samsung.com> > Signed-off-by: Thomas Abraham <thomas.ab@samsung.com> > --- > drivers/cpufreq/cpufreq_opp.c | 45 > +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 > insertions(+) > > diff --git a/drivers/cpufreq/cpufreq_opp.c > b/drivers/cpufreq/cpufreq_opp.c index c0c6f4a..05fb115 100644 > --- a/drivers/cpufreq/cpufreq_opp.c > +++ b/drivers/cpufreq/cpufreq_opp.c > @@ -19,6 +19,7 @@ > #include <linux/pm_opp.h> > #include <linux/rcupdate.h> > #include <linux/slab.h> > +#include <linux/of.h> > > /** > * dev_pm_opp_init_cpufreq_table() - create a cpufreq table for a > device @@ -51,6 +52,11 @@ int dev_pm_opp_init_cpufreq_table(struct > device *dev, struct cpufreq_frequency_table *freq_table = NULL; > int i, max_opps, ret = 0; > unsigned long rate; > +#ifdef CONFIG_CPU_FREQ_BOOST_SW > + struct cpufreq_frequency_table *ft; > + int len, count; > + u32 *boost_freqs = NULL; > +#endif > > rcu_read_lock(); > > @@ -82,6 +88,45 @@ int dev_pm_opp_init_cpufreq_table(struct device > *dev, > *table = &freq_table[0]; > > +#ifdef CONFIG_CPU_FREQ_BOOST_SW > + if (!of_find_property(dev->of_node, "boost-frequencies", > &len)) > + goto out; > + > + if (!len || !IS_ALIGNED(len, sizeof(u32))) { > + dev_err(dev, "%s: invalid boost frequency\n", > __func__); > + ret = -EINVAL; > + goto out; > + } > + > + boost_freqs = kmalloc(len, GFP_KERNEL); > + if (!boost_freqs) { > + dev_err(dev, "%s: no memory for boost freq table\n", > __func__); > + ret = -ENOMEM; > + goto out; > + } > + > + count = len / sizeof(u32); > + of_property_read_u32_array(dev->of_node, "boost-frequencies", > + boost_freqs, count); > + > + for (i = 0; i < count; i++) { > + cpufreq_for_each_valid_entry(ft, *table) { > + if (boost_freqs[i] == ft->frequency) { > + ft->flags |= CPUFREQ_BOOST_FREQ; > + pr_debug("%s: marked %d as boost > frequency\n", > + __func__, boost_freqs[i]); > + break; > + } > + } > + > + if (ft->frequency == CPUFREQ_TABLE_END) > + dev_err(dev, "%s: invalid boost frequency > %d\n", > + __func__, boost_freqs[i]); > + } > + > + kfree(boost_freqs); > +#endif > + > out: > rcu_read_unlock(); > if (ret) Acked-by: Lukasz Majewski <l.majewski@samsung.com> Thomas, thanks for this patch. -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v5 2/2] Documentation: devicetree: Add boost-frequency binding to list boost mode frequency 2014-05-29 14:38 [PATCH v5 0/2] cpufreq: opp: Add device tree based lookup of boost mode frequency Thomas Abraham 2014-05-29 14:38 ` [PATCH v5 1/2] cpufreq / OPP: Allow boost frequency to be looked up from device tree Thomas Abraham @ 2014-05-29 14:38 ` Thomas Abraham 2014-05-30 7:31 ` Lukasz Majewski 1 sibling, 1 reply; 6+ messages in thread From: Thomas Abraham @ 2014-05-29 14:38 UTC (permalink / raw) To: linux-pm, devicetree, linux-arm-kernel Cc: rjw, linux-samsung-soc, kgene.kim, t.figa, l.majewski, viresh.kumar, thomas.ab, Nishanth Menon, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala From: Thomas Abraham <thomas.ab@samsung.com> Add a new optional boost-frequency binding for specifying the frequencies usable in boost mode. Cc: Nishanth Menon <nm@ti.com> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Rob Herring <robh+dt@kernel.org> Cc: Pawel Moll <pawel.moll@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Ian Campbell <ijc+devicetree@hellion.org.uk> Cc: Kumar Gala <galak@codeaurora.org> Signed-off-by: Thomas Abraham <thomas.ab@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> --- .../devicetree/bindings/cpufreq/cpufreq-boost.txt | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Documentation/devicetree/bindings/cpufreq/cpufreq-boost.txt diff --git a/Documentation/devicetree/bindings/cpufreq/cpufreq-boost.txt b/Documentation/devicetree/bindings/cpufreq/cpufreq-boost.txt new file mode 100644 index 0000000..63ed0fc --- /dev/null +++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-boost.txt @@ -0,0 +1,38 @@ +* Device tree binding for CPU boost frequency (aka over-clocking) + +Certain CPU's can be operated in optional 'boost' mode (or sometimes referred as +overclocking) in which the CPU can operate at frequencies which are not +specified by the manufacturer as CPU's operating frequency. + +Optional Properties: +- boost-frequencies: list of frequencies in KHz to be used only in boost mode. + This list should be a subset of frequencies listed in "operating-points" + property. Refer to Documentation/devicetree/bindings/power/opp.txt for + details about "operating-points" property. + +Example: + + cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0>; + + operating-points = < + 1500000 1350000 + 1400000 1287500 + 1300000 1250000 + 1200000 1187500 + 1100000 1137500 + 1000000 1087500 + >; + boost-frequencies = <1500000 1400000>; + }; + cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <1>; + }; + }; -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v5 2/2] Documentation: devicetree: Add boost-frequency binding to list boost mode frequency 2014-05-29 14:38 ` [PATCH v5 2/2] Documentation: devicetree: Add boost-frequency binding to list boost mode frequency Thomas Abraham @ 2014-05-30 7:31 ` Lukasz Majewski 0 siblings, 0 replies; 6+ messages in thread From: Lukasz Majewski @ 2014-05-30 7:31 UTC (permalink / raw) To: Thomas Abraham Cc: linux-pm, devicetree, linux-arm-kernel, Nishanth Menon, Mark Rutland, kgene.kim, Pawel Moll, Ian Campbell, viresh.kumar, t.figa, rjw, Rob Herring, linux-samsung-soc, Kumar Gala Hi Thomas, > From: Thomas Abraham <thomas.ab@samsung.com> > > Add a new optional boost-frequency binding for specifying the > frequencies usable in boost mode. > > Cc: Nishanth Menon <nm@ti.com> > Cc: Lukasz Majewski <l.majewski@samsung.com> > Cc: Rob Herring <robh+dt@kernel.org> > Cc: Pawel Moll <pawel.moll@arm.com> > Cc: Mark Rutland <mark.rutland@arm.com> > Cc: Ian Campbell <ijc+devicetree@hellion.org.uk> > Cc: Kumar Gala <galak@codeaurora.org> > Signed-off-by: Thomas Abraham <thomas.ab@samsung.com> > Acked-by: Viresh Kumar <viresh.kumar@linaro.org> > --- > .../devicetree/bindings/cpufreq/cpufreq-boost.txt | 38 > ++++++++++++++++++++ 1 file changed, 38 insertions(+) > create mode 100644 > Documentation/devicetree/bindings/cpufreq/cpufreq-boost.txt > > diff --git > a/Documentation/devicetree/bindings/cpufreq/cpufreq-boost.txt > b/Documentation/devicetree/bindings/cpufreq/cpufreq-boost.txt new > file mode 100644 index 0000000..63ed0fc --- /dev/null > +++ b/Documentation/devicetree/bindings/cpufreq/cpufreq-boost.txt > @@ -0,0 +1,38 @@ > +* Device tree binding for CPU boost frequency (aka over-clocking) > + > +Certain CPU's can be operated in optional 'boost' mode (or sometimes > referred as +overclocking) in which the CPU can operate at > frequencies which are not +specified by the manufacturer as CPU's > operating frequency. + > +Optional Properties: > +- boost-frequencies: list of frequencies in KHz to be used only in > boost mode. > + This list should be a subset of frequencies listed in > "operating-points" > + property. Refer to Documentation/devicetree/bindings/power/opp.txt > for > + details about "operating-points" property. > + > +Example: > + > + cpus { > + #address-cells = <1>; > + #size-cells = <0>; > + cpu@0 { > + device_type = "cpu"; > + compatible = "arm,cortex-a9"; > + reg = <0>; > + > + operating-points = < > + 1500000 1350000 > + 1400000 1287500 > + 1300000 1250000 > + 1200000 1187500 > + 1100000 1137500 > + 1000000 1087500 > + >; > + boost-frequencies = <1500000 1400000>; > + }; > + cpu@1 { > + device_type = "cpu"; > + compatible = "arm,cortex-a9"; > + reg = <1>; > + }; > + }; Acked-by: Lukasz Majewski <l.majewski@samsung.com> -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-05-30 7:31 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-05-29 14:38 [PATCH v5 0/2] cpufreq: opp: Add device tree based lookup of boost mode frequency Thomas Abraham 2014-05-29 14:38 ` [PATCH v5 1/2] cpufreq / OPP: Allow boost frequency to be looked up from device tree Thomas Abraham 2014-05-29 20:51 ` Nishanth Menon 2014-05-30 7:31 ` Lukasz Majewski 2014-05-29 14:38 ` [PATCH v5 2/2] Documentation: devicetree: Add boost-frequency binding to list boost mode frequency Thomas Abraham 2014-05-30 7:31 ` Lukasz Majewski
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).