Skip to content

Commit

Permalink
U8500:Lights make BLN Optional
Browse files Browse the repository at this point in the history
Change-Id: I5ac69542a8fbfc8919f9051a3d360fc9d91037a4
  • Loading branch information
C457 committed May 7, 2014
1 parent 796ee4b commit 76fb916
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
7 changes: 6 additions & 1 deletion u8500/ux500/lights/Android.mk
Expand Up @@ -19,11 +19,16 @@ LOCAL_PATH:= $(call my-dir)
# hw/<POWERS_HARDWARE_MODULE_ID>.<ro.hardware>.so
include $(CLEAR_VARS)

# Make backlight notification optional
ifeq ($(BOARD_USE_BLN),true)
LOCAL_CFLAGS += -DUSE_BLN
endif

LOCAL_SRC_FILES := lights.c
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_MODULE := lights.montblanc

include $(BUILD_SHARED_LIBRARY)
include $(BUILD_SHARED_LIBRARY)
13 changes: 10 additions & 3 deletions u8500/ux500/lights/lights.c
Expand Up @@ -36,7 +36,10 @@ static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
/** Paths to light files **/
char const *const BACKLIGHT_FILE = "/sys/class/backlight/panel/brightness";
char const *const BUTTON_FILE = "/sys/class/leds/button-backlight/brightness";
char const *const NOTIFICATION_FILE = "/sys/class/misc/backlightnotification/notification_led";

#ifdef USE_BLN
char const*const NOTIFICATION_FILE = "/sys/class/misc/backlightnotification/notification_led";
#endif

/** Write integer to file **/
static int write_int(char const *path, int value)
Expand Down Expand Up @@ -96,6 +99,7 @@ static int set_light_buttons(struct light_device_t* dev, struct light_state_t co
return err;
}

#ifdef USE_BLN
/** Set buttons backlight as BLN **/
static int set_light_notifications(struct light_device_t* dev, struct light_state_t const* state)
{
Expand All @@ -108,6 +112,7 @@ static int set_light_notifications(struct light_device_t* dev, struct light_stat
pthread_mutex_unlock (&g_lock);
return err;
}
#endif

/** Close the lights device */
static int close_lights(struct light_device_t *dev)
Expand All @@ -129,8 +134,10 @@ static int open_lights(const struct hw_module_t *module, char const *name, struc
set_light = set_light_backlight;
else if (0 == strcmp(LIGHT_ID_BUTTONS, name))
set_light = set_light_buttons;
#ifdef USE_BLN
else if (0 == strcmp(LIGHT_ID_NOTIFICATIONS, name))
set_light = set_light_notifications;
#endif
else
return -EINVAL;

Expand Down Expand Up @@ -163,7 +170,7 @@ struct hw_module_t HAL_MODULE_INFO_SYM =
.version_major = 1,
.version_minor = 0,
.id = LIGHTS_HARDWARE_MODULE_ID,
.name = "Montblanc lights module",
.author = "Marcin Chojnacki",
.name = "U8500 Lights Module",
.author = "VanirAOSP",
.methods = &lights_methods,
};

0 comments on commit 76fb916

Please sign in to comment.