input: cfboost: Add module parameter callback
Antti P Miettinen [Tue, 1 Oct 2013 13:37:57 +0000 (16:37 +0300)]
Cancel PM QoS request upon frequency changing to zero.

Change-Id: Ie6bba1eb3f3177751449d53d9237e021140edf82
Signed-off-by: Antti P Miettinen <amiettinen@nvidia.com>
Reviewed-on: http://git-master/r/280744
(cherry picked from commit 8623a52d17f0e0788d393fbc4e8a9b2987ae492d)
Reviewed-on: http://git-master/r/298656
(cherry picked from commit ad5110686a0596cf8a1b1373b14d37e8b83284b9)
Reviewed-on: http://git-master/r/353767
GVS: Gerrit_Virtual_Submit
Reviewed-by: Gabby Lee <galee@nvidia.com>
Tested-by: Gabby Lee <galee@nvidia.com>

drivers/input/input-cfboost.c

index 157a141..923dd69 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * drivers/input/input-cfboost.c
  *
- * Copyright (c) 2012-2013, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2012-2013 NVIDIA CORPORATION.  All rights reserved.
  *
  * 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
@@ -55,7 +55,24 @@ static struct pm_qos_request freq_req, core_req;
 static struct work_struct boost;
 static struct delayed_work unboost;
 static unsigned int boost_freq; /* kHz */
-module_param(boost_freq, uint, 0644);
+static int boost_freq_set(const char *arg, const struct kernel_param *kp)
+{
+       unsigned int old_boost = boost_freq;
+       int ret = param_set_uint(arg, kp);
+       if (ret == 0 && old_boost && !boost_freq)
+               pm_qos_update_request(&freq_req,
+                                     PM_QOS_DEFAULT_VALUE);
+       return ret;
+}
+static int boost_freq_get(char *buffer, const struct kernel_param *kp)
+{
+       return param_get_uint(buffer, kp);
+}
+static struct kernel_param_ops boost_freq_ops = {
+       .set = boost_freq_set,
+       .get = boost_freq_get,
+};
+module_param_cb(boost_freq, &boost_freq_ops, &boost_freq, 0644);
 static unsigned long boost_time = 500; /* ms */
 module_param(boost_time, ulong, 0644);
 static struct workqueue_struct *cfb_wq;