davinci: lights: Adjust for davincis LEDs

Change-Id: If9e5afe292b023a8aa4d5ba509e206f9a4ff371f
This commit is contained in:
Arian 2020-05-08 14:59:57 +02:00
parent 3e94ffe9a3
commit 5af8701925
No known key found for this signature in database
GPG Key ID: 48029380598CE3B9
2 changed files with 13 additions and 13 deletions

View File

@ -22,11 +22,11 @@
#include <fstream>
#define LCD_LED "/sys/class/backlight/panel0-backlight/"
#define WHITE_LED "/sys/class/leds/white/"
#define PANEL_LED "/sys/class/backlight/panel0-backlight/"
#define NOTIFICATION_LED "/sys/class/leds/green/"
#define BREATH "breath"
#define BRIGHTNESS "brightness"
#define BREATH "breath"
#define BRIGHTNESS "brightness"
#define MAX_LED_BRIGHTNESS 255
#define MAX_LCD_BRIGHTNESS 4095
@ -83,24 +83,24 @@ static inline uint32_t getScaledBrightness(const LightState& state, uint32_t max
static void handleBacklight(const LightState& state) {
uint32_t brightness = getScaledBrightness(state, MAX_LCD_BRIGHTNESS);
set(LCD_LED BRIGHTNESS, brightness);
set(PANEL_LED BRIGHTNESS, brightness);
}
static void handleNotification(const LightState& state) {
uint32_t whiteBrightness = getScaledBrightness(state, MAX_LED_BRIGHTNESS);
uint32_t notificationBrightness = getScaledBrightness(state, MAX_LED_BRIGHTNESS);
/* Disable breathing or blinking */
set(WHITE_LED BREATH, 0);
set(NOTIFICATION_LED BREATH, 0);
switch (state.flashMode) {
case Flash::HARDWARE:
case Flash::TIMED:
/* Breathing */
set(WHITE_LED BREATH, 1);
set(NOTIFICATION_LED BREATH, 1);
break;
case Flash::NONE:
default:
set(WHITE_LED BRIGHTNESS, whiteBrightness);
set(NOTIFICATION_LED BRIGHTNESS, notificationBrightness);
}
}

View File

@ -1,13 +1,13 @@
on boot
chown system system /sys/class/backlight/panel0-backlight/brightness
chown system system /sys/class/backlight/panel0-backlight/max_brightness
chown system system /sys/class/leds/white/brightness
chown system system /sys/class/leds/white/breath
chown system system /sys/class/leds/green/brightness
chown system system /sys/class/leds/green/breath
chmod 0644 /sys/class/backlight/panel0-backlight/brightness
chmod 0644 /sys/class/backlight/panel0-backlight/max_brightness
chmod 0644 /sys/class/leds/white/brightness
chmod 0644 /sys/class/leds/white/breath
chmod 0644 /sys/class/leds/green/brightness
chmod 0644 /sys/class/leds/green/breath
service vendor.light-hal-2-0 /vendor/bin/hw/android.hardware.light@2.0-service.davinci
interface android.hardware.light@2.0::ILight default