usb: gadget: tegra: Add callback to boost_enable
Antti P Miettinen [Mon, 30 Sep 2013 10:14:58 +0000 (13:14 +0300)]
Cancel PM QoS request upon enabled to disabled
transition.

Change-Id: Iaf28d2d0daca312996e2cb1a1280769d814fd066
Signed-off-by: Antti P Miettinen <amiettinen@nvidia.com>
Reviewed-on: http://git-master/r/280232
(cherry picked from commit 9a25a04c42ed0feeb1aff1dcf696b54e122a8c65)
Reviewed-on: http://git-master/r/353766
GVS: Gerrit_Virtual_Submit
Reviewed-by: Gabby Lee <galee@nvidia.com>
Tested-by: Gabby Lee <galee@nvidia.com>

drivers/usb/gadget/tegra_udc.c

index c9799fd..7050da1 100644 (file)
@@ -107,7 +107,24 @@ static u32 ep_queue_request_count;
 static u8 boost_cpufreq_work_flag, set_cpufreq_normal_flag;
 static struct timer_list boost_timer;
 static bool boost_enable = true;
-module_param(boost_enable, bool, 0644);
+static int boost_enable_set(const char *arg, const struct kernel_param *kp)
+{
+       bool old_boost = boost_enable;
+       int ret = param_set_bool(arg, kp);
+       if (ret == 0 && old_boost && !boost_enable)
+               pm_qos_update_request(&boost_cpu_freq_req,
+                                     PM_QOS_DEFAULT_VALUE);
+       return ret;
+}
+static int boost_enable_get(char *buffer, const struct kernel_param *kp)
+{
+       return param_get_bool(buffer, kp);
+}
+static struct kernel_param_ops boost_enable_ops = {
+       .set = boost_enable_set,
+       .get = boost_enable_get,
+};
+module_param_cb(boost_enable, &boost_enable_ops, &boost_enable, 0644);
 #endif
 
 static char *const tegra_udc_extcon_cable[] = {