summaryrefslogtreecommitdiffstats
path: root/power
diff options
context:
space:
mode:
authorChristopher N. Hesse <raymanfx@gmail.com>2016-12-07 12:18:20 +0100
committerChristopher N. Hesse <raymanfx@gmail.com>2017-01-30 22:04:20 +0000
commit789472a258ae4e1f4ce97301546fb683905d5ee4 (patch)
treeeebd52e5347e33e8f854e9a161ecb7fbe2f52580 /power
parent0bb3363f4069f9a4b2f0f0cf7bc68d5cb256b05c (diff)
downloadandroid_hardware_samsung-789472a258ae4e1f4ce97301546fb683905d5ee4.tar.gz
android_hardware_samsung-789472a258ae4e1f4ce97301546fb683905d5ee4.tar.bz2
android_hardware_samsung-789472a258ae4e1f4ce97301546fb683905d5ee4.zip
power: Get panel backlight brightness from lights helper
Change-Id: I3f28fc4abac947cc4a30d95ba74f45bf24c12c20
Diffstat (limited to 'power')
-rw-r--r--power/Android.mk1
-rw-r--r--power/power.c27
2 files changed, 4 insertions, 24 deletions
diff --git a/power/Android.mk b/power/Android.mk
index 92ffe61..53f60b4 100644
--- a/power/Android.mk
+++ b/power/Android.mk
@@ -23,6 +23,7 @@ LOCAL_SRC_FILES := power.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_SHARED_LIBRARIES := liblog libcutils
+LOCAL_STATIC_LIBRARIES := liblights_helper
LOCAL_MODULE := power.$(TARGET_BOOTLOADER_BOARD_NAME)
LOCAL_MODULE_RELATIVE_PATH := hw
diff --git a/power/power.c b/power/power.c
index beb27da..6a24a8e 100644
--- a/power/power.c
+++ b/power/power.c
@@ -36,11 +36,10 @@
#include <hardware/hardware.h>
#include <hardware/power.h>
+#include <liblights/samsung_lights_helper.h>
#include "samsung_power.h"
-#define PANEL_BRIGHTNESS "/sys/class/backlight/panel/brightness"
-
struct samsung_power_module {
struct power_module base;
pthread_mutex_t lock;
@@ -118,27 +117,6 @@ static void sysfs_write(const char *path, char *s)
close(fd);
}
-static int read_panel_brightness() {
- int ret = 0;
- int read_status;
- // brightness can range from 0 to 255, so max. 3 chars + '\0'
- char panel_brightness[4];
- // for strtol
- char *dummy;
- const int base = 10;
-
- read_status = sysfs_read(PANEL_BRIGHTNESS, panel_brightness, sizeof(PANEL_BRIGHTNESS));
- if (read_status < 0) {
- ALOGE("%s: Failed to read panel brightness from %s!\n", __func__, PANEL_BRIGHTNESS);
- return -1;
- }
-
- ret = strtol(panel_brightness, &dummy, base);
- ALOGV("%s: Panel brightness is: %d", __func__, ret);
-
- return ret;
-}
-
/**********************************************************
*** POWER FUNCTIONS
**********************************************************/
@@ -360,9 +338,10 @@ static void samsung_power_set_interactive(struct power_module *module, int on)
ALOGV("power_set_interactive: %d\n", on);
+ // Get panel backlight brightness from lights HAL
// Do not disable any input devices if the screen is on but we are in a non-interactive state
if (!on) {
- if (read_panel_brightness() > 0) {
+ if (get_cur_panel_brightness() > 0) {
ALOGV("%s: Moving to non-interactive state, but screen is still on,"
" not disabling input devices\n", __func__);
goto out;