Skip to content

Commit

Permalink
cpu-boost: add a function to boost the cpu to max freq
Browse files Browse the repository at this point in the history
Signed-off-by: Francisco Franco <[email protected]>
  • Loading branch information
franciscofranco committed Nov 2, 2018
1 parent 230819b commit 76b60e2
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
23 changes: 23 additions & 0 deletions drivers/cpufreq/cpu-boost.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/input.h>
#include <linux/time.h>
#include <linux/fsync.h>
#include <linux/cpu_boost.h>

struct cpu_sync {
struct task_struct *thread;
Expand Down Expand Up @@ -155,6 +156,9 @@ static int boost_adjust_notify(struct notifier_block *nb, unsigned long val,
if (!b_min && !ib_min)
break;

ib_min = min((s->input_boost_min == UINT_MAX ?
policy->max : s->input_boost_min), policy->max);

min = max(b_min, ib_min);
min = min(min, policy->max);

Expand Down Expand Up @@ -204,6 +208,25 @@ static void update_policy_online(void)
put_online_cpus();
}

void do_input_boost_max()
{
unsigned int i;
struct cpu_sync *i_sync_info;

cancel_delayed_work_sync(&input_boost_rem);

for_each_possible_cpu(i) {
i_sync_info = &per_cpu(sync_info, i);
i_sync_info->input_boost_min = UINT_MAX;
}

update_policy_online();

queue_delayed_work(system_power_efficient_wq,
&input_boost_rem, msecs_to_jiffies(
!input_boost_ms ? 1500 : input_boost_ms));
}

static void do_input_boost_rem(struct work_struct *work)
{
unsigned int i;
Expand Down
24 changes: 24 additions & 0 deletions include/linux/cpu_boost.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (C) 2018, Francisco Franco <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* 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.
*/
#ifndef _CPU_BOOST_H_
#define _CPU_BOOST_H_

#ifdef CONFIG_CPU_BOOST
void do_input_boost_max(void);
#else
static inline void do_input_boost_max(void)
{
}
#endif

#endif /* _CPUBOOST_H_ */

0 comments on commit 76b60e2

Please sign in to comment.