sdm845-common: lights: Remove LCD backlight handling

Since composer HAL is now able to handle display brightness,
this can be removed from the lights HAL.

Change-Id: Ic10cead638382d448a94205bcec3543177d387f6
This commit is contained in:
Bruno Martins 2020-12-27 19:48:05 +00:00
parent 11360d9805
commit f836f3e62e
2 changed files with 2 additions and 23 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 The LineageOS Project
* Copyright (C) 2018-2020 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -75,32 +75,12 @@ static uint32_t getBrightness(const LightState& state) {
return (77 * red + 150 * green + 29 * blue) >> 8;
}
static uint32_t rgbToBrightness(const LightState& state) {
uint32_t color = state.color & 0x00ffffff;
return ((77 * ((color >> 16) & 0xff))
+ (150 * ((color >> 8) & 0xff))
+ (29 * (color & 0xff))) >> 8;
}
Light::Light() {
mLights.emplace(Type::ATTENTION, std::bind(&Light::handleNotification, this, std::placeholders::_1, 0));
mLights.emplace(Type::BACKLIGHT, std::bind(&Light::handleBacklight, this, std::placeholders::_1));
mLights.emplace(Type::BATTERY, std::bind(&Light::handleBattery, this, std::placeholders::_1));
mLights.emplace(Type::NOTIFICATIONS, std::bind(&Light::handleNotification, this, std::placeholders::_1, 1));
}
void Light::handleBacklight(const LightState& state) {
int maxBrightness = get("/sys/class/backlight/panel0-backlight/max_brightness", -1);
if (maxBrightness < 0) {
maxBrightness = kDefaultMaxBrightness;
}
uint32_t sentBrightness = rgbToBrightness(state);
uint32_t brightness = sentBrightness * maxBrightness / kDefaultMaxBrightness;
LOG(DEBUG) << "Writing backlight brightness " << brightness
<< " (orig " << sentBrightness << ")";
set("/sys/class/backlight/panel0-backlight/brightness", brightness);
}
void Light::handleBattery(const LightState& state) {
uint32_t whiteBrightness = getBrightness(state);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2019 The LineageOS Project
* Copyright (C) 2018-2020 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -45,7 +45,6 @@ class Light : public ILight {
Return<void> getSupportedTypes(getSupportedTypes_cb _hidl_cb) override;
private:
void handleBacklight(const LightState& state);
void handleBattery(const LightState& state);
void handleNotification(const LightState& state, size_t index);