All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] input: CPU frequency booster
@ 2012-01-19 12:53 Antti P Miettinen
  2012-01-19 17:44 ` Pavel Machek
  2012-01-19 22:52 ` Thomas Renninger
  0 siblings, 2 replies; 8+ messages in thread
From: Antti P Miettinen @ 2012-01-19 12:53 UTC (permalink / raw)
  To: davej, pavel, rjw, len.brown, khilman, j-pihet, markgross,
	cpufreq, linux-pm

Inspired by cpufreq ondemand governor changes at
git://codeaurora.org/kernel/msm.git tree in commits:

    2a6181bc76c6ce46ca0fa8e547be42acd534cf0e
    1cca8861d8fda4e05f6b0c59c60003345c15454d
    96a9aeb02bf5b3fbbef47e44460750eb275e9f1b
    b600449501cf15928440f87eff86b1f32d14214e
    88a65c7ae04632ffee11f9fc628d7ab017c06b83

Signed-off-by: Antti P Miettinen <amiettinen@nvidia.com>
---
Depends on "RFC: CPU frequency min as PM QoS param" patchset.
An example - the input filtering needs some thinking.

 drivers/input/Kconfig         |    9 ++
 drivers/input/Makefile        |    1 +
 drivers/input/input-cfboost.c |  174 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 184 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/input-cfboost.c

diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig
index 001b147..3859f78 100644
--- a/drivers/input/Kconfig
+++ b/drivers/input/Kconfig
@@ -161,6 +161,15 @@ config INPUT_APMPOWER
 	  To compile this driver as a module, choose M here: the
 	  module will be called apm-power.
 
+config INPUT_CFBOOST
+	tristate "CPU frequency booster"
+	depends on INPUT && CPU_FREQ
+	help
+	  Say Y here if you want to boost frequency upon input events;
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called input-cfboost.
+
 comment "Input Device Drivers"
 
 source "drivers/input/keyboard/Kconfig"
diff --git a/drivers/input/Makefile b/drivers/input/Makefile
index 0c78949..6cad177 100644
--- a/drivers/input/Makefile
+++ b/drivers/input/Makefile
@@ -24,3 +24,4 @@ obj-$(CONFIG_INPUT_TOUCHSCREEN)	+= touchscreen/
 obj-$(CONFIG_INPUT_MISC)	+= misc/
 
 obj-$(CONFIG_INPUT_APMPOWER)	+= apm-power.o
+obj-$(CONFIG_INPUT_CFBOOST)	+= input-cfboost.o
diff --git a/drivers/input/input-cfboost.c b/drivers/input/input-cfboost.c
new file mode 100644
index 0000000..bef3ec5
--- /dev/null
+++ b/drivers/input/input-cfboost.c
@@ -0,0 +1,174 @@
+/*
+ * drivers/input/input-cfboost.c
+ *
+ * Copyright (C) 2012 NVIDIA Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+#include <linux/slab.h>
+#include <linux/jiffies.h>
+#include <linux/printk.h>
+#include <linux/workqueue.h>
+#include <linux/input.h>
+#include <linux/module.h>
+#include <linux/pm_qos.h>
+
+/* This module listens to input events and sets a temporary frequency
+ * floor upon input event detection. This is based on changes to
+ * cpufreq ondemand governor by:
+ *
+ * Tero Kristo <tero.kristo@nokia.com>
+ * Brian Steuer <bsteuer@codeaurora.org>
+ * David Ng <dave@codeaurora.org>
+ *
+ * at git://codeaurora.org/kernel/msm.git tree, commits:
+ *
+ * 2a6181bc76c6ce46ca0fa8e547be42acd534cf0e
+ * 1cca8861d8fda4e05f6b0c59c60003345c15454d
+ * 96a9aeb02bf5b3fbbef47e44460750eb275e9f1b
+ * b600449501cf15928440f87eff86b1f32d14214e
+ * 88a65c7ae04632ffee11f9fc628d7ab017c06b83
+ */
+
+MODULE_AUTHOR("Antti P Miettinen <amiettinen@nvidia.com>");
+MODULE_DESCRIPTION("Input event CPU frequency booster");
+MODULE_LICENSE("GPL v2");
+
+
+static struct pm_qos_request qos_req;
+static struct work_struct boost;
+static struct delayed_work unboost;
+static unsigned int boost_freq; /* kHz */
+module_param(boost_freq, uint, 0644);
+static unsigned long boost_time = 500; /* ms */
+module_param(boost_time, ulong, 0644);
+static struct workqueue_struct *cfb_wq;
+
+static void cfb_boost(struct work_struct *w)
+{
+	cancel_delayed_work_sync(&unboost);
+	pm_qos_update_request(&qos_req, boost_freq);
+	queue_delayed_work(cfb_wq, &unboost, msecs_to_jiffies(boost_time));
+}
+
+static void cfb_unboost(struct work_struct *w)
+{
+	pm_qos_update_request(&qos_req, PM_QOS_DEFAULT_VALUE);
+}
+
+static void cfb_input_event(struct input_handle *handle, unsigned int type,
+			    unsigned int code, int value)
+{
+	if (!work_pending(&boost))
+		queue_work(cfb_wq, &boost);
+}
+
+static int cfb_input_connect(struct input_handler *handler,
+			     struct input_dev *dev,
+			     const struct input_device_id *id)
+{
+	struct input_handle *handle;
+	int error;
+
+	handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
+	if (!handle)
+		return -ENOMEM;
+
+	handle->dev = dev;
+	handle->handler = handler;
+	handle->name = "icfboost";
+
+	error = input_register_handle(handle);
+	if (error)
+		goto err2;
+
+	error = input_open_device(handle);
+	if (error)
+		goto err1;
+
+	return 0;
+err1:
+	input_unregister_handle(handle);
+err2:
+	kfree(handle);
+	return error;
+}
+
+static void cfb_input_disconnect(struct input_handle *handle)
+{
+	input_close_device(handle);
+	input_unregister_handle(handle);
+	kfree(handle);
+}
+
+/* XXX make configurable */
+static const struct input_device_id cfb_ids[] = {
+	{ /* touch screen */
+		.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
+				INPUT_DEVICE_ID_MATCH_KEYBIT,
+		.evbit = { BIT_MASK(EV_ABS) },
+		.keybit = {[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH) },
+	},
+	{ /* mouse */
+		.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
+				INPUT_DEVICE_ID_MATCH_KEYBIT,
+		.evbit = { BIT_MASK(EV_REL) },
+		.keybit = {[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MOUSE) },
+	},
+	{ },
+};
+
+static struct input_handler cfb_input_handler = {
+	.event		= cfb_input_event,
+	.connect	= cfb_input_connect,
+	.disconnect	= cfb_input_disconnect,
+	.name		= "icfboost",
+	.id_table	= cfb_ids,
+};
+
+static int __init cfboost_init(void)
+{
+	int ret;
+
+	cfb_wq = create_workqueue("icfb-wq");
+	if (!cfb_wq)
+		return -ENOMEM;
+	INIT_WORK(&boost, cfb_boost);
+	INIT_DELAYED_WORK(&unboost, cfb_unboost);
+	ret = input_register_handler(&cfb_input_handler);
+	if (ret) {
+		destroy_workqueue(cfb_wq);
+		return ret;
+	}
+	pm_qos_add_request(&qos_req, PM_QOS_CPU_FREQ_MIN,
+			   PM_QOS_DEFAULT_VALUE);
+	return 0;
+}
+
+static void __exit cfboost_exit(void)
+{
+	/* stop input events */
+	input_unregister_handler(&cfb_input_handler);
+	/* cancel pending work requests */
+	cancel_work_sync(&boost);
+	cancel_delayed_work_sync(&unboost);
+	/* clean up */
+	destroy_workqueue(cfb_wq);
+	pm_qos_remove_request(&qos_req);
+}
+
+module_init(cfboost_init);
+module_exit(cfboost_exit);
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] input: CPU frequency booster
  2012-01-19 12:53 [PATCH] input: CPU frequency booster Antti P Miettinen
@ 2012-01-19 17:44 ` Pavel Machek
  2012-01-22 10:55   ` Antti P Miettinen
  2012-01-19 22:52 ` Thomas Renninger
  1 sibling, 1 reply; 8+ messages in thread
From: Pavel Machek @ 2012-01-19 17:44 UTC (permalink / raw)
  To: Antti P Miettinen
  Cc: khilman, len.brown, markgross, cpufreq, linux-pm, j-pihet

Hi!

> +/* XXX make configurable */

Remove XXX?


> +static const struct input_device_id cfb_ids[] = {
> +	{ /* touch screen */
> +		.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
> +				INPUT_DEVICE_ID_MATCH_KEYBIT,
> +		.evbit = { BIT_MASK(EV_ABS) },
> +		.keybit = {[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH) },
> +	},
> +	{ /* mouse */
> +		.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
> +				INPUT_DEVICE_ID_MATCH_KEYBIT,
> +		.evbit = { BIT_MASK(EV_REL) },
> +		.keybit = {[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MOUSE) },
> +	},
> +	{ },
> +};

Does it need to be configurable? Going to max frequency for user
interaction sounds like good idea... Probably should include keyboard,
too.

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] input: CPU frequency booster
  2012-01-19 12:53 [PATCH] input: CPU frequency booster Antti P Miettinen
  2012-01-19 17:44 ` Pavel Machek
@ 2012-01-19 22:52 ` Thomas Renninger
  2012-01-19 23:10   ` Thomas Renninger
                     ` (3 more replies)
  1 sibling, 4 replies; 8+ messages in thread
From: Thomas Renninger @ 2012-01-19 22:52 UTC (permalink / raw)
  To: Antti P Miettinen
  Cc: davej, pavel, rjw, len.brown, khilman, j-pihet, markgross,
	cpufreq, linux-pm

Hi,

Not sure which email I should take to answer...

I can't see why pm_qos is needed at all, better use cpufreq
providing interface.
PPC (BIOS request to cut max_frequency) in
drivers/acpi/processor_perflib.c is a nice example

I'd also put this into drivers/cpufreq/cpufreq_input_boost.c.

Find below a re-written version of the booster.
Instead of pm_qos, it simply uses cpufreq interface:
/sys/devices/system/cpu/cpufreq/input_boost_freq
/sys/devices/system/cpu/cpufreq/input_boost_time

I started with global cpufreq variables, they could also
be declared per cpu like scaling_min_freq or others
(at least input_boost_freq, input_boost_time should probably
stay global). That would be:
/sys/devices/system/cpu/cpuX/cpufreq/input_boost_freq

A mechanism to set the right variables on the right HW
so that no userspace interaction is needed by default would be great.
Is there a PCI id, CPU family/model that could get checked
in the init func and automatically set the right values?

Now that this is part of cpufreq core, one could use these:
/* the following 3 funtions are for cpufreq core use only */                                                                                                          
struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);                                                                                        
struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);                                                                                                             
void   cpufreq_cpu_put(struct cpufreq_policy *data);                                                                                                                  

to find the 2nd lowest P-state or similar as default boost freq

A comment on which platforms this makes sense at all would be great.
Does any X86 machine need this?
Which ARM platforms you'd recommend to enable this in .config?

Could you give below a test, please.
Compile tested only.
Based on latest Linus git tree.
What do you think about it?

    Thomas

---
 drivers/cpufreq/Kconfig               |    9 ++
 drivers/cpufreq/Makefile              |    3 +
 drivers/cpufreq/cpufreq_input_boost.c |  238 +++++++++++++++++++++++++++++++++
 3 files changed, 250 insertions(+), 0 deletions(-)

diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index e24a2a1..3f584d6 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -179,6 +179,15 @@ config CPU_FREQ_GOV_CONSERVATIVE
 
 	  If in doubt, say N.
 
+config INPUT_CFBOOST
+       boolean "CPU frequency booster"
+       depends on INPUT
+       help
+         Say Y here if you want to boost frequency upon input events;
+
+         To compile this driver as a module, choose M here: the
+         module will be called input-cfboost.
+
 menu "x86 CPU frequency scaling drivers"
 depends on X86
 source "drivers/cpufreq/Kconfig.x86"
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index ac000fa..d083b9f 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -10,6 +10,9 @@ obj-$(CONFIG_CPU_FREQ_GOV_USERSPACE)	+= cpufreq_userspace.o
 obj-$(CONFIG_CPU_FREQ_GOV_ONDEMAND)	+= cpufreq_ondemand.o
 obj-$(CONFIG_CPU_FREQ_GOV_CONSERVATIVE)	+= cpufreq_conservative.o
 
+# CPUfreq misc
+obj-$(CONFIG_INPUT_CFBOOST)		+= cpufreq_input_boost.o
+
 # CPUfreq cross-arch helpers
 obj-$(CONFIG_CPU_FREQ_TABLE)		+= freq_table.o
 
diff --git a/drivers/cpufreq/cpufreq_input_boost.c b/drivers/cpufreq/cpufreq_input_boost.c
new file mode 100644
index 0000000..3ef8bca
--- /dev/null
+++ b/drivers/cpufreq/cpufreq_input_boost.c
@@ -0,0 +1,238 @@
+/*
+ * drivers/input/input-cfboost.c
+ *
+ * Copyright (C) 2012 NVIDIA Corporation
+ * Copyright (C) 2012 Thomas Renninger <trenn@suse.de>
+ *     Better integration into cpufreq subsystem
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+#include <linux/slab.h>
+#include <linux/jiffies.h>
+#include <linux/printk.h>
+#include <linux/workqueue.h>
+#include <linux/input.h>
+#include <linux/module.h>
+#include <linux/cpufreq.h>
+
+/* This module listens to input events and sets a temporary frequency
+ * floor upon input event detection. This is based on changes to
+ * cpufreq ondemand governor by:
+ *
+ * Tero Kristo <tero.kristo@nokia.com>
+ * Brian Steuer <bsteuer@codeaurora.org>
+ * David Ng <dave@codeaurora.org>
+ *
+ * at git://codeaurora.org/kernel/msm.git tree, commits:
+ *
+ * 2a6181bc76c6ce46ca0fa8e547be42acd534cf0e
+ * 1cca8861d8fda4e05f6b0c59c60003345c15454d
+ * 96a9aeb02bf5b3fbbef47e44460750eb275e9f1b
+ * b600449501cf15928440f87eff86b1f32d14214e
+ * 88a65c7ae04632ffee11f9fc628d7ab017c06b83
+ */
+
+MODULE_AUTHOR("Antti P Miettinen <amiettinen@nvidia.com>");
+MODULE_DESCRIPTION("Input event CPU frequency booster");
+MODULE_LICENSE("GPL v2");
+
+
+static struct work_struct boost;
+static struct delayed_work unboost;
+static struct workqueue_struct *cfb_wq;
+
+/* sysfs stuff **************************/
+static unsigned long boost_time;
+static unsigned int boost_freq = 500;
+
+static ssize_t show_input_boost_time (struct kobject *kobj,
+				      struct attribute *attr, char *buf)
+{
+	return sprintf(buf, "%lu\n", boost_time);
+}
+static ssize_t show_input_boost_freq (struct kobject *kobj,
+				      struct attribute *attr, char *buf)
+{
+	return sprintf(buf, "%u\n", boost_freq);
+}
+
+static ssize_t store_input_boost_time(struct kobject *a, struct attribute *b,
+				const char *buf, size_t count)
+{
+	/* TBD: Check input! */
+	int ret;
+	ret = sscanf(buf, "%lu", &boost_time);
+	if (ret != 1)
+		return -EINVAL;
+	return count;
+}
+
+static ssize_t store_input_boost_freq(struct kobject *a, struct attribute *b,
+				const char *buf, size_t count)
+{
+	/* TBD: Check input! */
+	int ret;
+	ret = sscanf(buf, "%u", &boost_freq);
+	if (ret != 1)
+		return -EINVAL;
+	return count;
+}
+define_one_global_rw(input_boost_freq);
+define_one_global_rw(input_boost_time);
+
+static const struct attribute *input_boost_attr[] = {
+	&input_boost_freq.attr,
+	&input_boost_time.attr,
+};
+
+/* sysfs stuff **************************/
+
+
+static void cfb_boost(struct work_struct *w)
+{
+	struct cpufreq_policy policy;
+	int ret;
+
+	cancel_delayed_work_sync(&unboost);
+	ret = cpufreq_get_policy(&policy, 0);
+	if (ret)
+		return;
+	cpufreq_verify_within_limits(&policy, boost_freq,
+				     policy.cpuinfo.max_freq);
+	queue_delayed_work(cfb_wq, &unboost,
+			   msecs_to_jiffies(boost_time));
+}
+
+static void cfb_unboost(struct work_struct *w)
+{
+	struct cpufreq_policy policy;
+	int ret;
+	
+	ret = cpufreq_get_policy(&policy, 0);
+	if (ret)
+		return;
+
+	cpufreq_verify_within_limits(&policy, policy.cpuinfo.min_freq,
+				     policy.cpuinfo.max_freq);
+}
+
+static void cfb_input_event(struct input_handle *handle, unsigned int type,
+			    unsigned int code, int value)
+{
+	if (!work_pending(&boost))
+		queue_work(cfb_wq, &boost);
+}
+
+static int cfb_input_connect(struct input_handler *handler,
+			     struct input_dev *dev,
+			     const struct input_device_id *id)
+{
+	struct input_handle *handle;
+	int error;
+
+	handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
+	if (!handle)
+		return -ENOMEM;
+
+	handle->dev = dev;
+	handle->handler = handler;
+	handle->name = "icfboost";
+
+	error = input_register_handle(handle);
+	if (error)
+		goto err2;
+
+	error = input_open_device(handle);
+	if (error)
+		goto err1;
+
+	return 0;
+err1:
+	input_unregister_handle(handle);
+err2:
+	kfree(handle);
+	return error;
+}
+
+static void cfb_input_disconnect(struct input_handle *handle)
+{
+	input_close_device(handle);
+	input_unregister_handle(handle);
+	kfree(handle);
+}
+
+static const struct input_device_id cfb_ids[] = {
+	{ /* touch screen */
+		.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
+		INPUT_DEVICE_ID_MATCH_KEYBIT,
+		.evbit = { BIT_MASK(EV_ABS) },
+		.keybit = {[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH) },
+	},
+	{ /* mouse */
+		.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
+		INPUT_DEVICE_ID_MATCH_KEYBIT,
+		.evbit = { BIT_MASK(EV_REL) },
+		.keybit = {[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MOUSE) },
+	},
+	{ },
+};
+
+static struct input_handler cfb_input_handler = {
+	.event          = cfb_input_event,
+	.connect        = cfb_input_connect,
+	.disconnect     = cfb_input_disconnect,
+	.name           = "icfboost",
+	.id_table       = cfb_ids,
+};
+
+static int __init cfboost_init(void)
+{
+	/* TBD: Properly clean up in all cases */
+	int ret;
+
+	ret = sysfs_create_files(cpufreq_global_kobject,
+				 input_boost_attr);
+
+	cfb_wq = create_workqueue("icfb-wq");
+	if (!cfb_wq)
+		return -ENOMEM;
+	INIT_WORK(&boost, cfb_boost);
+	INIT_DELAYED_WORK(&unboost, cfb_unboost);
+	ret = input_register_handler(&cfb_input_handler);
+	if (ret) {
+		destroy_workqueue(cfb_wq);
+		return ret;
+	}
+	return 0;
+}
+
+static void __exit cfboost_exit(void)
+{
+	sysfs_remove_files(cpufreq_global_kobject,
+			   input_boost_attr);
+
+	/* stop input events */
+	input_unregister_handler(&cfb_input_handler);
+	/* cancel pending work requests */
+	cancel_work_sync(&boost);
+	cancel_delayed_work_sync(&unboost);
+	/* clean up */
+	destroy_workqueue(cfb_wq);
+}
+
+module_init(cfboost_init);
+module_exit(cfboost_exit);

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] input: CPU frequency booster
  2012-01-19 22:52 ` Thomas Renninger
@ 2012-01-19 23:10   ` Thomas Renninger
  2012-01-20  8:36   ` Antti P Miettinen
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Thomas Renninger @ 2012-01-19 23:10 UTC (permalink / raw)
  To: Antti P Miettinen
  Cc: davej, pavel, rjw, len.brown, khilman, j-pihet, markgross,
	cpufreq, linux-pm

On Thursday 19 January 2012 23:52:59 Thomas Renninger wrote:
> Hi,
...
> I'd also put this into drivers/cpufreq/cpufreq_input_boost.c.
> 
> Find below a re-written version of the booster.
> Instead of pm_qos, it simply uses cpufreq interface:
> /sys/devices/system/cpu/cpufreq/input_boost_freq
> /sys/devices/system/cpu/cpufreq/input_boost_time

There was the same problem that scaling_max_freq showed a limit,
but one did not know whether it comes from:
  - thermal
  - PPC/BIOS
restrictions.

This got solved by introducing:
/sys/.../cpuX/cpufreq/bios_limit
which shows the PPC limitation

A file:
/sys/.../cpuX/cpufreq/input_boost_limit
could show the currently raised min_freq, caused by
the input booster.

    Thomas

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] input: CPU frequency booster
  2012-01-19 22:52 ` Thomas Renninger
  2012-01-19 23:10   ` Thomas Renninger
@ 2012-01-20  8:36   ` Antti P Miettinen
  2012-01-20 10:50   ` Thomas Renninger
  2015-01-12 13:32   ` Pavel Machek
  3 siblings, 0 replies; 8+ messages in thread
From: Antti P Miettinen @ 2012-01-20  8:36 UTC (permalink / raw)
  To: linux-pm; +Cc: cpufreq

Thomas Renninger <trenn@suse.de> writes:
> I can't see why pm_qos is needed at all, better use cpufreq
> providing interface.

One reason for using PM QoS is that it provides an interface for user
space. We want to be able to control frequency also from user space.

	--Antti

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] input: CPU frequency booster
  2012-01-19 22:52 ` Thomas Renninger
  2012-01-19 23:10   ` Thomas Renninger
  2012-01-20  8:36   ` Antti P Miettinen
@ 2012-01-20 10:50   ` Thomas Renninger
  2015-01-12 13:32   ` Pavel Machek
  3 siblings, 0 replies; 8+ messages in thread
From: Thomas Renninger @ 2012-01-20 10:50 UTC (permalink / raw)
  To: Antti P Miettinen
  Cc: khilman, len.brown, markgross, cpufreq, linux-pm, j-pihet


[-- Attachment #1.1: Type: text/plain, Size: 938 bytes --]

On Thursday, January 19, 2012 11:52:59 PM Thomas Renninger wrote:
> Hi,
> 
...
I forgot to activate the newly set limits:

> +/* sysfs stuff **************************/
> +
> +
> +static void cfb_boost(struct work_struct *w)
> +{
> +	struct cpufreq_policy policy;
> +	int ret;
> +
> +	cancel_delayed_work_sync(&unboost);
> +	ret = cpufreq_get_policy(&policy, 0);
> +	if (ret)
> +		return;
> +	cpufreq_verify_within_limits(&policy, boost_freq,
> +				     policy.cpuinfo.max_freq);
cpufreq_update_policy(0);
> +	queue_delayed_work(cfb_wq, &unboost,
> +			   msecs_to_jiffies(boost_time));
> +}
> +
> +static void cfb_unboost(struct work_struct *w)
> +{
> +	struct cpufreq_policy policy;
> +	int ret;
> +	
> +	ret = cpufreq_get_policy(&policy, 0);
> +	if (ret)
> +		return;
> +
> +	cpufreq_verify_within_limits(&policy, policy.cpuinfo.min_freq,
> +				     policy.cpuinfo.max_freq);
cpufreq_update_policy(0);

Hope it works now?

   Thomas

[-- Attachment #1.2: Type: text/html, Size: 7251 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] input: CPU frequency booster
  2012-01-19 17:44 ` Pavel Machek
@ 2012-01-22 10:55   ` Antti P Miettinen
  0 siblings, 0 replies; 8+ messages in thread
From: Antti P Miettinen @ 2012-01-22 10:55 UTC (permalink / raw)
  To: linux-pm; +Cc: cpufreq

Pavel Machek <pavel@ucw.cz> writes:
> Does it need to be configurable? Going to max frequency for user
> interaction sounds like good idea... Probably should include keyboard,
> too.

Boosting upon all input events might be wasteful. Configurability would
allow tuning based on platform characteristics.

	--Antti

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] input: CPU frequency booster
  2012-01-19 22:52 ` Thomas Renninger
                     ` (2 preceding siblings ...)
  2012-01-20 10:50   ` Thomas Renninger
@ 2015-01-12 13:32   ` Pavel Machek
  3 siblings, 0 replies; 8+ messages in thread
From: Pavel Machek @ 2015-01-12 13:32 UTC (permalink / raw)
  To: Thomas Renninger
  Cc: Antti P Miettinen, davej, rjw, len.brown, khilman, j-pihet,
	markgross, cpufreq, linux-pm

Hi!

> I can't see why pm_qos is needed at all, better use cpufreq
> providing interface.
> PPC (BIOS request to cut max_frequency) in
> drivers/acpi/processor_perflib.c is a nice example
> 
> I'd also put this into drivers/cpufreq/cpufreq_input_boost.c.
> 
> Find below a re-written version of the booster.
> Instead of pm_qos, it simply uses cpufreq interface:
> /sys/devices/system/cpu/cpufreq/input_boost_freq
> /sys/devices/system/cpu/cpufreq/input_boost_time
> 
> I started with global cpufreq variables, they could also
> be declared per cpu like scaling_min_freq or others
> (at least input_boost_freq, input_boost_time should probably
> stay global). That would be:
> /sys/devices/system/cpu/cpuX/cpufreq/input_boost_freq

Going through old mails. This did not seem to go anywhere? Is it still
required? I don't see it in kernel. For some reason, it looks like it
has potential to help Nokia N900 a lot...
								Pavel
								
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-01-12 13:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-19 12:53 [PATCH] input: CPU frequency booster Antti P Miettinen
2012-01-19 17:44 ` Pavel Machek
2012-01-22 10:55   ` Antti P Miettinen
2012-01-19 22:52 ` Thomas Renninger
2012-01-19 23:10   ` Thomas Renninger
2012-01-20  8:36   ` Antti P Miettinen
2012-01-20 10:50   ` Thomas Renninger
2015-01-12 13:32   ` Pavel Machek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.