From cddd7fe94782608252e78239f599b524533186dc Mon Sep 17 00:00:00 2001 From: "jy910.yun" Date: Wed, 17 Jul 2013 19:11:27 +0900 Subject: [PATCH] Move define of DISP_CMD to header file. The same thing is defined in several sources. And all shift bits're not changed, error occurs. Change-Id: I1b7b14de081bb800183f289ebc3700d138e9898a Signed-off-by: Krzysztof Sasiak --- src/display/display-dbus.c | 3 --- src/display/llinterface.c | 13 +++++-------- src/display/llinterface.h | 3 +++ src/display/lsensor.c | 5 +---- src/shared/display.c | 6 +----- 5 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/display/display-dbus.c b/src/display/display-dbus.c index bc7f493..c82525b 100644 --- a/src/display/display-dbus.c +++ b/src/display/display-dbus.c @@ -32,9 +32,6 @@ #include "core/common.h" #include "core/devices.h" -#define DISP_INDEX_BIT 16 -#define DISP_CMD(prop, index) (prop | (index << DISP_INDEX_BIT)) - static DBusMessage *e_dbus_start_cb(E_DBus_Object *obj, DBusMessage *msg) { display_device_ops.init(NULL); diff --git a/src/display/llinterface.c b/src/display/llinterface.c index a553006..fa3778c 100644 --- a/src/display/llinterface.c +++ b/src/display/llinterface.c @@ -34,9 +34,6 @@ #include "core.h" #include "device-node.h" -#define DISP_INDEX_BIT 4 -#define COMBINE_DISP_CMD(cmd, prop, index) (cmd = (prop | (index << DISP_INDEX_BIT))) - typedef struct _PMSys PMSys; struct _PMSys { int def_brt; @@ -63,9 +60,9 @@ static bool x_dpms_enable = false; static int _bl_onoff(PMSys *p, int on) { - int cmd = 0; + int cmd; - COMBINE_DISP_CMD(cmd, PROP_DISPLAY_ONOFF, DEFAULT_DISPLAY); + cmd = DISP_CMD(PROP_DISPLAY_ONOFF, DEFAULT_DISPLAY); return device_set_property(DEVICE_TYPE_DISPLAY, cmd, on); } @@ -75,7 +72,7 @@ static int _bl_brt(PMSys *p, int brightness) int ret; int prev; - COMBINE_DISP_CMD(cmd, PROP_DISPLAY_BRIGHTNESS, DEFAULT_DISPLAY); + cmd = DISP_CMD(PROP_DISPLAY_BRIGHTNESS, DEFAULT_DISPLAY); ret = device_get_property(DEVICE_TYPE_DISPLAY, cmd, &prev); /* Update new brightness to vconf */ @@ -101,9 +98,9 @@ static int _sys_get_lcd_power(PMSys *p) { int value = -1; int ret = -1; - int cmd = 0; + int cmd; - COMBINE_DISP_CMD(cmd, PROP_DISPLAY_ONOFF, DEFAULT_DISPLAY); + cmd = DISP_CMD(PROP_DISPLAY_ONOFF, DEFAULT_DISPLAY); ret = device_get_property(DEVICE_TYPE_DISPLAY, cmd, &value); if (ret < 0 || value < 0) diff --git a/src/display/llinterface.h b/src/display/llinterface.h index 3097641..c4e8b06 100644 --- a/src/display/llinterface.h +++ b/src/display/llinterface.h @@ -41,6 +41,9 @@ #define PM_LCD_RETRY_CNT 3 +#define DISP_INDEX_SHIFT 16 +#define DISP_CMD(prop, index) ((index << DISP_INDEX_SHIFT) | prop) + /* * Event type enumeration */ diff --git a/src/display/lsensor.c b/src/display/lsensor.c index 366068d..995a053 100644 --- a/src/display/lsensor.c +++ b/src/display/lsensor.c @@ -35,9 +35,6 @@ #define SAMPLING_INTERVAL 1 /* 1 sec */ #define MAX_FAULT 5 -#define DISP_INDEX_BIT 4 -#define COMBINE_DISP_CMD(cmd, prop, index) (cmd = (prop | (index << DISP_INDEX_BIT))) - static int (*prev_init_extention) (void *data); static int (*_default_action) (int); static Ecore_Timer *alc_timeout_id = 0; @@ -68,7 +65,7 @@ static bool alc_handler(void* data) int cmd; int ret; value = PM_MAX_BRIGHTNESS * (int)light_data.values[0] / 10; - COMBINE_DISP_CMD(cmd, PROP_DISPLAY_BRIGHTNESS, DEFAULT_DISPLAY); + cmd = DISP_CMD(PROP_DISPLAY_BRIGHTNESS, DEFAULT_DISPLAY); ret = device_get_property(DEVICE_TYPE_DISPLAY, cmd, &tmp_value); if (!ret && (tmp_value != value)) { backlight_ops.set_default_brt(value); diff --git a/src/shared/display.c b/src/shared/display.c index 872451c..11c72d7 100644 --- a/src/shared/display.c +++ b/src/shared/display.c @@ -192,13 +192,9 @@ API int display_release_brightness(void) } vconf_set_int(VCONFKEY_PM_CUSTOM_BRIGHTNESS_STATUS, VCONFKEY_PM_CUSTOM_BRIGHTNESS_OFF); - if (bat_state < VCONFKEY_SYSMAN_BAT_WARNING_LOW) { - _D("can not set brightness for low battery"); - return 0; - } // check dim state - if (bat_state == VCONFKEY_SYSMAN_BAT_WARNING_LOW && + if (bat_state <= VCONFKEY_SYSMAN_BAT_WARNING_LOW && charger_state == VCONFKEY_SYSMAN_CHARGER_DISCONNECTED && !brt_changed_state) { _D("batt warning low : brightness is not changed!"); device_set_property(DEVICE_TYPE_DISPLAY, PROP_DISPLAY_BRIGHTNESS, 0); -- 2.7.4