-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drivers/misc: Introduce kernelspace battery saver mode
Change-Id: I4ed95be27f8059804ad6a90dc928f30ce84c679f Signed-off-by: K A R T H I K <[email protected]>
- Loading branch information
1 parent
628f0a7
commit a8ffaa0
Showing
4 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* | ||
* Copyright (C) 2020 Adithya R <[email protected]>. | ||
*/ | ||
|
||
#include <linux/module.h> | ||
#include <linux/moduleparam.h> | ||
#include <linux/battery_saver.h> | ||
|
||
static bool enabled = false; | ||
module_param(enabled, bool, 0644); | ||
|
||
// returns whether battery saver is enabled or disabled | ||
bool is_battery_saver_on(void) | ||
{ | ||
return enabled; | ||
} | ||
|
||
// enable or disable battery saver mode | ||
void update_battery_saver(bool status) | ||
{ | ||
enabled = status; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* | ||
* Copyright (C) 2020 Adithya R <[email protected]>. | ||
*/ | ||
|
||
#ifndef _BATTERY_SAVER_H_ | ||
#define _BATTERY_SAVER_H_ | ||
|
||
#include <linux/types.h> | ||
|
||
#ifdef CONFIG_BATTERY_SAVER | ||
bool is_battery_saver_on(void); | ||
void enable_battery_saver(bool status); | ||
#else | ||
static inline bool is_battery_saver_on() | ||
{ | ||
return false; | ||
} | ||
static inline void update_battery_saver(bool status) | ||
{ | ||
} | ||
#endif | ||
|
||
#endif /* _BATTERY_SAVER_H_ */ |