revert lcd state control part
authorPark Yong Chul <yc1216.park@samsung.com>
Wed, 10 Apr 2013 07:28:40 +0000 (16:28 +0900)
committerPark Yong Chul <yc1216.park@samsung.com>
Wed, 10 Apr 2013 07:29:09 +0000 (16:29 +0900)
[Problem] lcd control have to control by drm and fb ioctl
[Cause] lcd controller didn't sleep
[Solution] revert lcd on/off part

Change-Id: Id963ba1243b472a6e2f7a49964a08e1f10aa2690
Signed-off-by: Park Yong Chul <yc1216.park@samsung.com>
CMakeLists.txt
config/common.cfg [deleted file]
config/tizen.cfg
include/chg_env.h
include/chg_power.h
packaging/charging-animation.conf [deleted file]
packaging/charging-animation.spec
src/chg_drmd.c
src/chg_env.c
src/chg_fb.c
src/chg_power.c

index 55f7e87..1bf7b96 100755 (executable)
@@ -38,7 +38,6 @@ pkg_check_modules(pkgs REQUIRED
        device-node
        devman
        dlog
-       deviced
 )
 
 FOREACH(flag ${pkgs_CFLAGS})
diff --git a/config/common.cfg b/config/common.cfg
deleted file mode 100755 (executable)
index 7b950f8..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-CHG_ENV_BATT_CAP=/sys/class/power_supply/battery/capacity
-CHG_ENV_BATT_VOL_NOW=/sys/class/power_supply/battery/voltage_now
-CHG_ENV_BATT_CHG_NOW=/sys/class/power_supply/battery/charge_now
-CHG_ENV_BATT_TEMP=/sys/class/power_supply/battery/temp
-CHG_ENV_BATT_CHG_FULL=/sys/class/power_supply/battery/charge_full
-CHG_ENV_BATT_ONLINE=/sys/class/power_supply/battery/online
-CHG_ENV_BATT_HEALTH=/sys/class/power_supply/battery/health
-CHG_ENV_BATT_PRESENT=/sys/class/power_supply/battery/present
-
-
-CHG_ENV_POWER_STATE=/sys/power/state
-CHG_ENV_POWER_LOCK=/sys/power/wake_lock
-CHG_ENV_POWER_UNLOCK=/sys/power/wake_unlock
\ No newline at end of file
index 2eba8e8..d8028b9 100755 (executable)
@@ -1,5 +1,3 @@
 export CHG_ENV_DEV_FB=
 export CHG_ENV_DEV_DRM_NAME=exynos
-export CHG_ENV_LCD_BL_ON_VAL=0
-export CHG_ENV_LCD_BL_OFF_VAL=4
 export CHG_ENV_NO_SLEEP=0
\ No newline at end of file
index e5b7aa5..8bb82a7 100755 (executable)
@@ -24,16 +24,12 @@ enum {
        EN_ENV_BATT_DUMMY = 0,
        EN_ENV_DEV_FB,
        EN_ENV_DEV_DRM_NAME,
-       EN_ENV_LCD_BL_ON_VAL,
-       EN_ENV_LCD_BL_OFF_VAL,
        EN_ENV_NO_SLEEP,
        EN_ENV_MAX
 };
 
 #define CHG_ENV_DEV_FB                         "CHG_ENV_DEV_FB"
-#define CHG_ENV_DEV_DRM_NAME           "CHG_ENV_DEV_DRM_NAME"
-#define CHG_ENV_LCD_BL_ON_VAL          "CHG_ENV_LCD_BL_ON_VAL"
-#define CHG_ENV_LCD_BL_OFF_VAL                 "CHG_ENV_LCD_BL_OFF_VAL"
+#define CHG_ENV_DEV_DRM_NAME   "CHG_ENV_DEV_DRM_NAME"
 #define CHG_ENV_NO_SLEEP               "CHG_ENV_NO_SLEEP"
 
 extern char chg_env_str[EN_ENV_MAX][ENV_MAX_LEN];
index c84cd20..25e9a08 100755 (executable)
@@ -18,6 +18,7 @@ limitations under the License.
 #define __CHG_POWER_H__
 
 #include "chg_fb.h"
+#include "chg_fbd.h"
 
 enum {
        LCD_BL_ON,
diff --git a/packaging/charging-animation.conf b/packaging/charging-animation.conf
deleted file mode 100644 (file)
index b89f00d..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-CHG_ENV_SUPPORT_FB=0
-CHG_ENV_SUPPORT_DRM=1
-
-CHG_ENV_DEV_FB=
-CHG_ENV_DEV_DRM_NAME=exynos
-
-CHG_ENV_LCD_BRIGHT=/sys/class/backlight/s6e8aa0-bl/brightness
-CHG_ENV_LCD_BR_DIMM_VAL=0
-CHG_ENV_LCD_BR_NORM_VAL=10
-
-CHG_ENV_LCD_BL_ONOFF=/sys/class/graphics/fb3/blank
-CHG_ENV_LCD_BL_ON_VAL=0
-CHG_ENV_LCD_BL_OFF_VAL=4
-CHG_ENV_LCD_BL_NORM_VAL=
-
-CHG_ENV_LCD_XRES=720
-CHG_ENV_LCD_YRES=1280
-
-CHG_ENV_KEY_EVENT=/dev/event1
index cd5a8c6..68b02fe 100755 (executable)
@@ -1,7 +1,7 @@
 Name:       charging-animation
 Summary:    charging-animation
 ExclusiveArch:  %{arm}
-Version:    0.0.8
+Version:    0.0.9
 Release:    0
 Group:      misc
 License:    Flora Software License
@@ -16,7 +16,6 @@ BuildRequires: pkgconfig(libkms)
 BuildRequires: pkgconfig(device-node)
 BuildRequires: pkgconfig(devman)
 BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(deviced)
 
 %description
 charging-animation
index ab1a6ee..cf6f0fd 100755 (executable)
@@ -179,6 +179,11 @@ void page_flip_handler(int fd, unsigned int frame,
        return;
 }
 
+char *drivers[] = {
+       "exynos",
+       NULL
+};
+
 /*-----------------------------------------------------------------------------
   drmd_open()
  ----------------------------------------------------------------------------*/
@@ -186,7 +191,7 @@ int drmd_open(st_drmdi *drmdi)
 {
        drm_magic_t magic;
        void *ptr, *ptr2;
-       int ret;
+       int ret, i;
 
        if (drmdi == NULL) {
                DEBUG_MSG("[drmd_open] drmdi is NULL\n");
@@ -195,7 +200,10 @@ int drmd_open(st_drmdi *drmdi)
 
        memset(drmdi, 0x00, sizeof(st_drmdi));
 
-       drmdi->fd = drmOpen(chg_env_str[EN_ENV_DEV_DRM_NAME], NULL);
+       for (i = 0, drmdi->fd = -1; drmdi->fd < 0 && drivers[i]; i++) {
+               drmdi->fd = drmOpen(drivers[i], NULL);
+               DEBUG_MSG("[drmd_open] driver : %s ",drivers[i]);
+       }
        if(drmdi->fd<0) {
                DEBUG_MSG("[drmd_open] Cannot open drm:%s\n",
                        chg_env_str[EN_ENV_DEV_DRM_NAME]);
index c19e85b..c018c2b 100755 (executable)
@@ -43,10 +43,6 @@ void chg_env_str_load(void)
                chg_env_str[EN_ENV_DEV_FB], ENV_MAX_LEN);
        get_env(CHG_ENV_DEV_DRM_NAME,
                chg_env_str[EN_ENV_DEV_DRM_NAME], ENV_MAX_LEN);
-       get_env(CHG_ENV_LCD_BL_ON_VAL,
-               chg_env_str[EN_ENV_LCD_BL_ON_VAL], ENV_MAX_LEN);
-       get_env(CHG_ENV_LCD_BL_OFF_VAL,
-               chg_env_str[EN_ENV_LCD_BL_OFF_VAL], ENV_MAX_LEN);
        get_env(CHG_ENV_NO_SLEEP,
                chg_env_str[EN_ENV_NO_SLEEP], ENV_MAX_LEN);
 }
index 2f5f839..e3e90d2 100755 (executable)
@@ -64,7 +64,6 @@ static int s_err_img_x;
 static int s_err_img_y;
 
 
-
 st_fbdi s_fbdi;
 st_drmdi s_drmdi;
 
@@ -328,6 +327,17 @@ void fb_draw_img_normal_charging(FbInfo *fbi)
 
 #ifdef INTERFACE_DRM
        if (fbi->type == FB_DEV_DRM) {
+               if (sys_power_state() == SYS_POWER_OFF) {
+                       DEBUG_MSG("fb_draw_img_normal_charging - power off ..\n");
+                       if (fbi->current_fb_id == s_drmdi.fb_id[0])
+                               fbi->current_fb_id = s_drmdi.fb_id[1];
+                       else
+                               fbi->current_fb_id = s_drmdi.fb_id[0];
+                       return;
+               }
+               else
+                       DEBUG_MSG("no check..\n");
+
                DEBUG_MSG("[fb_draw_img_normal_charging] current_fb_id :%d\n",\
                        fbi->current_fb_id);
                drmModePageFlip(s_drmdi.fd, s_drmdi.crtc->crtc_id,\
@@ -368,6 +378,17 @@ void fb_draw_img_full_charging(FbInfo *fbi)
 
 #ifdef INTERFACE_DRM
        if (fbi->type == FB_DEV_DRM) {
+               if (sys_power_state() == SYS_POWER_OFF) {
+                       DEBUG_MSG("fb_draw_img_full_charging - power off ..\n");
+                       if (fbi->current_fb_id == s_drmdi.fb_id[0])
+                               fbi->current_fb_id = s_drmdi.fb_id[1];
+                       else
+                               fbi->current_fb_id = s_drmdi.fb_id[0];
+                       return;
+               }
+               else
+                       DEBUG_MSG("no check..\n");
+
                DEBUG_MSG("[fb_draw_img_full_charging] current_fb_id :%d\n",\
                        fbi->current_fb_id);
                drmModePageFlip(s_drmdi.fd, s_drmdi.crtc->crtc_id,\
@@ -464,6 +485,17 @@ void fb_draw_img_batt_err_temp(FbInfo *fbi)
 
 #ifdef INTERFACE_DRM
        if (fbi->type == FB_DEV_DRM) {
+               if (sys_power_state() == SYS_POWER_OFF) {
+                       DEBUG_MSG("fb_draw_img_batt_err_temp - power off ..\n");
+                       if (fbi->current_fb_id == s_drmdi.fb_id[0])
+                               fbi->current_fb_id = s_drmdi.fb_id[1];
+                       else
+                               fbi->current_fb_id = s_drmdi.fb_id[0];
+                       return;
+               }
+               else
+                       DEBUG_MSG("no check..\n");
+
                DEBUG_MSG("[fb_draw_img_batt_err_temp]new_fb_id : %d\n",\
                        fbi->current_fb_id);
                drmModePageFlip(s_drmdi.fd, s_drmdi.crtc->crtc_id,\
@@ -532,6 +564,17 @@ void fb_draw_img_batt_err_charging(FbInfo *fbi)
 
 #ifdef INTERFACE_DRM
        if (fbi->type == FB_DEV_DRM) {
+               if (sys_power_state() == SYS_POWER_OFF) {
+                       DEBUG_MSG("fb_draw_img_batt_err_charging - power off ..\n");
+                       if (fbi->current_fb_id == s_drmdi.fb_id[0])
+                               fbi->current_fb_id = s_drmdi.fb_id[1];
+                       else
+                               fbi->current_fb_id = s_drmdi.fb_id[0];
+                       return;
+               }
+               else
+                       DEBUG_MSG("no check..\n");
+
                DEBUG_MSG("[fb_draw_img_batt_err_charging]new_fb_id : %d\n",\
                        fbi->current_fb_id);
                drmModePageFlip(s_drmdi.fd, s_drmdi.crtc->crtc_id,\
index 199e56a..34f91c0 100755 (executable)
@@ -17,6 +17,7 @@ limitations under the License.
 #include <string.h>
 #include <sys/reboot.h>
 #include <stdlib.h>
+#include <sys/ioctl.h>
 #include <device-node.h>
 #include <devman.h>
 
@@ -31,18 +32,41 @@ static int s_lcd_br_state = LCD_BR_NORMAL;
 static int s_sys_power_state = SYS_POWER_ON;
 
 /*-----------------------------------------------------------------------------
+  fb_lcd_bl_on()
+ ----------------------------------------------------------------------------*/
+static int fb_lcd_bl_on(st_fbdi *s_fbdi)
+{
+       DEBUG_MSG("fb_lcd_bl_on() is called.\n");
+       ioctl(s_fbdi->fb_fd, FBIOBLANK, FB_BLANK_UNBLANK);
+       return 0;
+}
+
+/*-----------------------------------------------------------------------------
+  fb_lcd_bl_off()
+ ----------------------------------------------------------------------------*/
+static int fb_lcd_bl_off(st_fbdi *s_fbdi)
+{
+       DEBUG_MSG("fb_lcd_bl_off() is called.\n");
+       ioctl(s_fbdi->fb_fd, FBIOBLANK, FB_BLANK_POWERDOWN);
+       return 0;
+}
+/*-----------------------------------------------------------------------------
   lcd_bl_on()
  ----------------------------------------------------------------------------*/
 int lcd_bl_on(FbInfo *fbi)
 {
-       int ret = 0;
-
+       DEBUG_MSG("lcd_bl_on() is called.\n");
        if (s_lcd_bl_state == LCD_BL_ON)
                return 0;
 
-       ret = device_set_property(DEVICE_TYPE_DISPLAY,PROP_DISPLAY_ONOFF, atoi(chg_env_str[EN_ENV_LCD_BL_ON_VAL]));
-
-       DEBUG_MSG("lcd_bl_on() is called. ret : %d \n",ret);
+       if (fbi->type == FB_DEV_FB) {
+               if (fb_lcd_bl_on((st_fbdi*)fbi->dev) < 0)
+                       return -1;
+       } else if (fbi->type == FB_DEV_DRM) {
+               if (drmd_lcd_on((st_drmdi*)fbi->dev) < 0)
+                       return -1;
+       } else
+               return -1;
 
        s_lcd_bl_state = LCD_BL_ON;
        return 0;
@@ -53,14 +77,18 @@ int lcd_bl_on(FbInfo *fbi)
  ----------------------------------------------------------------------------*/
 int lcd_bl_off(FbInfo *fbi)
 {
-       int ret = 0;
-
+       DEBUG_MSG("lcd_bl_off() is called.\n");
        if (s_lcd_bl_state == LCD_BL_OFF)
                return 0;
 
-       ret = device_set_property(DEVICE_TYPE_DISPLAY,PROP_DISPLAY_ONOFF, atoi(chg_env_str[EN_ENV_LCD_BL_OFF_VAL]));
-
-       DEBUG_MSG("lcd_bl_off() is called. ret : %d \n",ret);
+       if (fbi->type == FB_DEV_FB) {
+               if (fb_lcd_bl_off((st_fbdi*)fbi->dev) < 0)
+                       return -1;
+       } else if (fbi->type == FB_DEV_DRM) {
+               if (drmd_lcd_off((st_drmdi*)fbi->dev) < 0)
+                       return -1;
+       } else
+               return -1;
 
        s_lcd_bl_state = LCD_BL_OFF;
        return 0;
@@ -99,7 +127,7 @@ int lcd_br_dimm(void)
 {
        int ret = 0;
 
-       ret = device_set_property(DEVICE_TYPE_DISPLAY,PROP_DISPLAY_BRIGHTNESS,1);
+       ret = device_set_property(DEVICE_TYPE_DISPLAY,PROP_DISPLAY_BRIGHTNESS, 0);
 
        DEBUG_MSG("lcd_br_dimm() is called. ret : %d \n",ret);
 
@@ -144,6 +172,9 @@ int sys_power_sleep(FbInfo *fbi)
                DEBUG_MSG("nosleep...\n");
                return 0;
        }
+
+       system_cmd_nowait("echo mem > /sys/power/state");
+
        return 0;
 }