summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcodeworkx <daniel.hillenbrand@codeworkx.de>2012-06-21 05:40:51 +0200
committercodeworkx <daniel.hillenbrand@codeworkx.de>2012-06-21 05:47:12 +0200
commit61bb8c4defa2cf570796d2840fca8ffcd573202d (patch)
tree0046e66658b11e448b536e562820038d4c098467
parent15b850d507ab3aa1fe284a97a700ac4640a4fdc0 (diff)
downloadhardware_samsung-61bb8c4defa2cf570796d2840fca8ffcd573202d.zip
hardware_samsung-61bb8c4defa2cf570796d2840fca8ffcd573202d.tar.gz
hardware_samsung-61bb8c4defa2cf570796d2840fca8ffcd573202d.tar.bz2
smdk4x12: lights: battery led support
Change-Id: Ida4e7bd998251ec07a9874f695d1fef9f97a1b0c
-rw-r--r--exynos4/exynos4x12/liblights/lights.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/exynos4/exynos4x12/liblights/lights.c b/exynos4/exynos4x12/liblights/lights.c
index ba0f0fc..8b5288f 100644
--- a/exynos4/exynos4x12/liblights/lights.c
+++ b/exynos4/exynos4x12/liblights/lights.c
@@ -191,6 +191,30 @@ static int set_light_leds_notifications(struct light_device_t *dev,
return set_light_leds(state, 0);
}
+static int set_light_battery(struct light_device_t *dev,
+ struct light_state_t const *state)
+{
+ struct led_config led;
+ int brightness = rgb_to_brightness(state);
+ unsigned int colorRGB;
+
+ colorRGB = state->color;
+
+ if (brightness == 0) {
+ led.red = 0;
+ led.green = 0;
+ led.blue = 0;
+ snprintf(led.blink, MAX_WRITE_CMD, "0x000000 0 0");
+ } else {
+ led.red = (colorRGB >> 16) & 0xFF;
+ led.green = (colorRGB >> 8) & 0xFF;
+ led.blue = colorRGB & 0xFF;
+ snprintf(led.blink, MAX_WRITE_CMD, "0x%x %d %d", colorRGB, state->flashOnMS, state->flashOffMS);
+ }
+
+ return write_leds(led);
+}
+
static int set_light_leds_attention(struct light_device_t *dev,
struct light_state_t const *state)
{
@@ -209,6 +233,8 @@ static int open_lights(const struct hw_module_t *module, char const *name,
set_light = set_light_leds_notifications;
else if (0 == strcmp(LIGHT_ID_ATTENTION, name))
set_light = set_light_leds_attention;
+ else if (0 == strcmp(LIGHT_ID_BATTERY, name))
+ set_light = set_light_battery;
else
return -EINVAL;