changed cpu sleep sequence - add wake_lock/unlock
authorPark Yong Chul <yc1216.park@samsung.com>
Wed, 10 Apr 2013 05:08:04 +0000 (14:08 +0900)
committerPark Yong Chul <yc1216.park@samsung.com>
Wed, 10 Apr 2013 05:08:04 +0000 (14:08 +0900)
Change-Id: I647fee9e0e50e585be25588782a68a2c0fd0812b
Signed-off-by: Park Yong Chul <yc1216.park@samsung.com>
14 files changed:
CMakeLists.txt
config/common.cfg
include/chg_common.h
include/chg_env.h
include/chg_fb.h
include/chg_fbd.h
include/chg_power.h
packaging/charging-animation.spec
src/chg_env.c
src/chg_fb.c
src/chg_fbd.c
src/chg_main.c
src/chg_png.c
src/chg_power.c

index 73409eb..3ab7db1 100755 (executable)
@@ -52,6 +52,10 @@ IF("${ARCH}" STREQUAL "arm")
        MESSAGE("add -DTARGET")
 ENDIF("${ARCH}" STREQUAL "arm")
 
+ADD_DEFINITIONS("-DSYS_LOG_DEBUG")
+ADD_DEFINITIONS("-DINTERFACE_FB")
+ADD_DEFINITIONS("-DINTERFACE_DRM")
+ADD_DEFINITIONS("-DVENDOR=\"${VENDOR}\"")
 ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"")
 ADD_DEFINITIONS("-DPACKAGE_NAME=\"${PKGNAME}\"")
 ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
index ebda2ac..7b950f8 100755 (executable)
@@ -7,4 +7,7 @@ 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 a83fa70..ecbdc18 100755 (executable)
@@ -19,16 +19,20 @@ limitations under the License.
 
 #include <stdio.h>
 #include <errno.h>
-
-#define DEBUG_MSG      printf
-#if 0
+#ifdef SYS_LOG_DEBUG
+#include <syslog.h>
+#include <stdarg.h>
+#define DEBUG_MSG(format,args...) \
+do {\
+       syslog(LOG_DEBUG,""format"", ##args); \
+} while(0);
+#else
+//#define DEBUG_MSG    printf
 #define CHG_LOG_TAG "CHG_ANI"
 #include <dlog.h>
 #include <time.h>
 #include <sys/time.h>
 #include <libgen.h>
-#include <stdio.h>
-#include <errno.h>
 
 #define DEBUG_MSG(format,args...) \
 do {\
index 588e100..50bf6de 100755 (executable)
@@ -21,7 +21,8 @@ limitations under the License.
 #define ENV_MAX_LEN                    1024
 
 enum {
-       EN_ENV_BATT_CAP = 0,
+       EN_ENV_BATT_DUMMY = 0,
+       EN_ENV_BATT_CAP,
        EN_ENV_BATT_VOL_NOW,
        EN_ENV_BATT_CHG_NOW,
        EN_ENV_BATT_TEMP,
@@ -45,6 +46,9 @@ enum {
        EN_ENV_LCD_XRES,
        EN_ENV_LCD_YRES,
        EN_ENV_KEY_EVENT,
+       EN_ENV_NO_SLEEP,
+       EN_ENV_POWER_LOCK,
+       EN_ENV_POWER_UNLOCK,
        EN_ENV_MAX
 };
 
@@ -58,6 +62,10 @@ enum {
 #define CHG_ENV_BATT_HEALTH            "CHG_ENV_BATT_HEALTH"
 #define CHG_ENV_BATT_PRESENT           "CHG_ENV_BATT_PRESENT"
 #define CHG_ENV_POWER_STATE            "CHG_ENV_POWER_STATE"
+
+#define CHG_ENV_POWER_LOCK             "CHG_ENV_POWER_LOCK"
+#define CHG_ENV_POWER_UNLOCK           "CHG_ENV_POWER_UNLOCK"
+
 #define CHG_ENV_LCD_BRIGHT             "CHG_ENV_LCD_BRIGHT"
 #define CHG_ENV_LCD_BR_DIMM_VAL        "CHG_ENV_LCD_BR_DIMM_VAL"
 #define CHG_ENV_LCD_BR_NORM_VAL        "CHG_ENV_LCD_BR_NORM_VAL"
@@ -73,7 +81,7 @@ enum {
 #define CHG_ENV_LCD_XRES               "CHG_ENV_LCD_XRES"
 #define CHG_ENV_LCD_YRES               "CHG_ENV_LCD_YRES"
 #define CHG_ENV_KEY_EVENT              "CHG_ENV_KEY_EVENT"
-
+#define CHG_ENV_NO_SLEEP               "CHG_ENV_NO_SLEEP"
 
 extern char chg_env_str[EN_ENV_MAX][ENV_MAX_LEN];
 
index 492a1ce..227ea21 100755 (executable)
@@ -33,11 +33,10 @@ typedef struct _FbInfo {
        void* dev;
 } FbInfo;
 
-
 extern void set_chg_img_params(void);
 extern int fb_open(FbInfo *fbi);
 extern void fb_close(FbInfo *fbi);
-
+extern int fb_pan_display( FbInfo *fbi );
 extern void fb_clear_screen(FbInfo *fbi, unsigned int color);
 extern void fb_fill_rect(FbInfo *fbi, int x1, int y1, int x2, int y2,
                         unsigned int color);
index 1d4a3e2..87e106f 100755 (executable)
@@ -30,6 +30,6 @@ typedef struct _st_fbdi {
 
 extern int fbd_open(st_fbdi *fbdi);
 extern void fbd_close(st_fbdi *fbdi);
-
+extern int fbd_pan_display(st_fbdi *fbdi);
 
 #endif /* __CHG_FBD_H__ */
index 50985da..87cd270 100755 (executable)
@@ -33,7 +33,11 @@ enum {
        SYS_POWER_ON,
        SYS_POWER_OFF
 };
-
+enum {
+       SYS_POWER_UNKOWN,
+       SYS_POWER_LOCK,
+       SYS_POWER_UNLOCK
+};
 
 extern int lcd_bl_on(FbInfo *fbi);
 extern int lcd_bl_off(FbInfo *fbi);
@@ -43,6 +47,8 @@ extern int lcd_br_dimm(void);
 extern int lcd_br_state(void);
 extern int sys_power_wakeup(FbInfo *fbi);
 extern int sys_power_sleep(FbInfo *fbi);
+extern int sys_power_lock();
+extern int sys_power_unlock();
 extern int sys_power_state(void);
 extern void sys_power_reboot(void);
 extern void sys_power_off(void);
index 0db83ee..8a98844 100755 (executable)
@@ -1,8 +1,8 @@
 Name:       charging-animation
 Summary:    charging-animation
 ExclusiveArch:  %{arm}
-Version:    0.0.6
-Release:    1
+Version:    0.0.7
+Release:    0
 Group:      misc
 License:    Flora Software License
 Source0:    %{name}-%{version}.tar.gz
index 23c3b51..58c555e 100755 (executable)
@@ -57,6 +57,10 @@ void chg_env_str_load(void)
                chg_env_str[EN_ENV_BATT_PRESENT], ENV_MAX_LEN);
        get_env(CHG_ENV_POWER_STATE,
                chg_env_str[EN_ENV_POWER_STATE], ENV_MAX_LEN);
+       get_env(CHG_ENV_POWER_LOCK,
+               chg_env_str[EN_ENV_POWER_LOCK], ENV_MAX_LEN);
+       get_env(CHG_ENV_POWER_UNLOCK,
+               chg_env_str[EN_ENV_POWER_UNLOCK], ENV_MAX_LEN);
        get_env(CHG_ENV_LCD_BRIGHT,
                chg_env_str[EN_ENV_LCD_BRIGHT], ENV_MAX_LEN);
        get_env(CHG_ENV_LCD_BR_DIMM_VAL,
@@ -86,5 +90,7 @@ void chg_env_str_load(void)
                chg_env_str[EN_ENV_LCD_YRES], ENV_MAX_LEN);
        get_env(CHG_ENV_KEY_EVENT,
                chg_env_str[EN_ENV_KEY_EVENT], ENV_MAX_LEN);
+       get_env(CHG_ENV_NO_SLEEP,
+               chg_env_str[EN_ENV_NO_SLEEP], ENV_MAX_LEN);
 }
 
index a354bd6..9810c87 100755 (executable)
@@ -23,7 +23,7 @@ limitations under the License.
 #include "chg_png.h"
 #include "chg_env.h"
 #include "chg_battery.h"
-
+#include "chg_power.h"
 
 #define MAX_IMG_FILE_PATH      1024
 #define MAX_PROGRESS_CNT       5
@@ -231,20 +231,47 @@ void fb_close(FbInfo *fbi)
        }
 }
 
+/*------------------------------------------------------------------------------
+ fb_pan_display()- In case of Roy, the LCD Controller is turned OFF if it is not
+                  in use, hence we need to call PAN Display each time we have a
+                  new data in FB0 so that it can be pushed on the Display Panel
+------------------------------------------------------------------------------*/
+int fb_pan_display( FbInfo *fbi )
+{
+       int b_status = 0;
+       /* FB_IO_PAN_DISPLAY is used for pushing the data from FB0 i.e.
+          S/W Buffer to the H/W FIFO in the Display Panel
+       */
+       if (fbd_pan_display(&s_fbdi)) {
+               b_status = -1;
+       }
+       else {
+       }
+       return b_status;
+}
 
 /*-----------------------------------------------------------------------------
   fb_clear_screen()
  ----------------------------------------------------------------------------*/
 void fb_clear_screen(FbInfo *fbi, unsigned int color)
 {
-       unsigned int *fb_buf_cur;
+       unsigned int *fb_buf_cur = NULL;
        int loop_count = fbi->w * fbi->h;
 
-       if (fbi->current_fb_id == s_drmdi.fb_id[0])
-               fb_buf_cur = (unsigned int *)fbi->buf;
-       else
-               fb_buf_cur = (unsigned int *)fbi->buf2;
-
+#ifdef INTERFACE_DRM
+       if (fbi->type == FB_DEV_DRM) {
+               if (fbi->current_fb_id == s_drmdi.fb_id[0])
+                       fb_buf_cur = (unsigned int *)fbi->buf;
+               else
+                       fb_buf_cur = (unsigned int *)fbi->buf2;
+       }
+#endif
+#ifdef INTERFACE_FB
+/* temprary code now fb will be use double buffer */
+       if (fbi->type == FB_DEV_FB)
+               return ;
+//             fb_buf_cur = (unsigned int *)fbi->buf;
+#endif
        while (loop_count--)
                *(fb_buf_cur++) = color;
 }
@@ -255,7 +282,7 @@ void fb_clear_screen(FbInfo *fbi, unsigned int color)
 void fb_fill_rect(FbInfo *fbi, int x1, int y1, int x2, int y2,
                         unsigned int color)
 {
-       unsigned int *fb_buf_cur;
+       unsigned int *fb_buf_cur = NULL;
        unsigned int *fb_line_buf;
        int screen_width = fbi->w;
        int draw_width = x2 - x1 + 1;
@@ -263,10 +290,18 @@ void fb_fill_rect(FbInfo *fbi, int x1, int y1, int x2, int y2,
        int width_cnt;
        int height_cnt;
 
+#ifdef INTERFACE_DRM
+       if (fbi->type == FB_DEV_DRM) {
        if (fbi->current_fb_id == s_drmdi.fb_id[0])
                fb_buf_cur = (unsigned int *)fbi->buf;
        else
                fb_buf_cur = (unsigned int *)fbi->buf2;
+       }
+#endif
+#ifdef INTERFACE_DRM
+       if (fbi->type == FB_DEV_FB)
+               fb_buf_cur = (unsigned int *)fbi->buf;
+#endif
 
        fb_buf_cur += (x1 + y1 * screen_width);
        fb_line_buf = fb_buf_cur;
@@ -293,10 +328,14 @@ void fb_draw_img_normal_charging(FbInfo *fbi)
        static int batt_bar = 5;
        char chg_img_filename[MAX_IMG_FILE_PATH];
 
-       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];
+#ifdef INTERFACE_DRM
+       if (fbi->type == FB_DEV_DRM) {
+               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];
+       }
+#endif
 
        /* fill full screen with black color */
        fb_clear_screen(fbi, 0x00000000);
@@ -331,11 +370,26 @@ void fb_draw_img_normal_charging(FbInfo *fbi)
                progress_cnt = 0;
        }
 
-       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, fbi->current_fb_id,\
-               DRM_MODE_PAGE_FLIP_EVENT, NULL);
-       drmHandleEvent(s_drmdi.fd, &evctx);
+#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,\
+                       fbi->current_fb_id, DRM_MODE_PAGE_FLIP_EVENT, NULL);
+               drmHandleEvent(s_drmdi.fd, &evctx);
+       }
+#endif
 }
 
 /*-----------------------------------------------------------------------------
@@ -345,12 +399,14 @@ void fb_draw_img_full_charging(FbInfo *fbi)
 {
        char chg_img_filename[MAX_IMG_FILE_PATH];
 
-
-       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];
-
+#ifdef INTERFACE_DRM
+       if (fbi->type == FB_DEV_DRM) {
+               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];
+       }
+#endif
        /* fill full screen with black color */
        fb_clear_screen(fbi, 0x00000000);
 
@@ -365,12 +421,26 @@ void fb_draw_img_full_charging(FbInfo *fbi)
        draw_png_img_xy(fbi, s_normal_img_x, s_normal_img_y);
        release_png_res();
 
-       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, fbi->current_fb_id,\
-               DRM_MODE_PAGE_FLIP_EVENT, NULL);
-       drmHandleEvent(s_drmdi.fd, &evctx);
-
+#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,\
+                       fbi->current_fb_id, DRM_MODE_PAGE_FLIP_EVENT, NULL);
+               drmHandleEvent(s_drmdi.fd, &evctx);
+       }
+#endif
 }
 
 /*-----------------------------------------------------------------------------
@@ -380,11 +450,14 @@ void fb_draw_img_batt_err_plug(FbInfo *fbi)
 {
        char chg_img_filename[MAX_IMG_FILE_PATH];
 
-       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];
-
+#ifdef INTERFACE_DRM
+       if (fbi->type == FB_DEV_DRM) {
+               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];
+       }
+#endif
        /* fill full screen with black color */
        fb_clear_screen(fbi, 0x00000000);
 
@@ -399,11 +472,23 @@ void fb_draw_img_batt_err_plug(FbInfo *fbi)
        draw_png_img_xy(fbi, s_err_img_x, s_err_img_y);
        release_png_res();
 
-       DEBUG_MSG("[fb_draw_img_batt_err_plug]new_fb_id : %d\n",\
-               fbi->current_fb_id);
-       drmModePageFlip(s_drmdi.fd, s_drmdi.crtc->crtc_id, fbi->current_fb_id,\
-               DRM_MODE_PAGE_FLIP_EVENT, NULL);
-       drmHandleEvent(s_drmdi.fd, &evctx);
+#ifdef INTERFACE_DRM
+       if (fbi->type == FB_DEV_DRM) {
+       /*
+               if (sys_power_state() == SYS_POWER_OFF) {
+                       DEBUG_MSG("fb_draw_img_batt_err_plug - power off ..\n");
+                       return;
+               }
+               else
+                       DEBUG_MSG("no check..\n");*/
+
+               DEBUG_MSG("[fb_draw_img_batt_err_plug]new_fb_id : %d\n",\
+                       fbi->current_fb_id);
+               drmModePageFlip(s_drmdi.fd, s_drmdi.crtc->crtc_id,\
+                       fbi->current_fb_id, DRM_MODE_PAGE_FLIP_EVENT, NULL);
+               drmHandleEvent(s_drmdi.fd, &evctx);
+       }
+#endif
 }
 
 /*-----------------------------------------------------------------------------
@@ -413,11 +498,14 @@ void fb_draw_img_batt_err_temp(FbInfo *fbi)
 {
        char chg_img_filename[MAX_IMG_FILE_PATH];
 
-       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];
-
+#ifdef INTERFACE_DRM
+       if (fbi->type == FB_DEV_DRM) {
+               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];
+       }
+#endif
        /* fill full screen with black color */
        fb_clear_screen(fbi, 0x00000000);
 
@@ -440,12 +528,26 @@ void fb_draw_img_batt_err_temp(FbInfo *fbi)
        draw_png_img_xy(fbi, s_err_img_x, s_err_img_y);
        release_png_res();
 
-       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, fbi->current_fb_id,\
-               DRM_MODE_PAGE_FLIP_EVENT, NULL);
-       drmHandleEvent(s_drmdi.fd, &evctx);
-
+#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,\
+                       fbi->current_fb_id, DRM_MODE_PAGE_FLIP_EVENT, NULL);
+               drmHandleEvent(s_drmdi.fd, &evctx);
+       }
+#endif
 }
 
 /*-----------------------------------------------------------------------------
@@ -457,11 +559,14 @@ void fb_draw_img_batt_err_charging(FbInfo *fbi)
        static int batt_bar = 5;
        char chg_img_filename[MAX_IMG_FILE_PATH];
 
-       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];
-
+#ifdef INTERFACE_DRM
+       if (fbi->type == FB_DEV_DRM) {
+               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];
+       }
+#endif
        /* fill full screen with black color */
        fb_clear_screen(fbi, 0x00000000);
 
@@ -502,9 +607,24 @@ void fb_draw_img_batt_err_charging(FbInfo *fbi)
                progress_cnt = 0;
        }
 
-       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, fbi->current_fb_id,\
-               DRM_MODE_PAGE_FLIP_EVENT, NULL);
-       drmHandleEvent(s_drmdi.fd, &evctx);
+#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,\
+                       fbi->current_fb_id, DRM_MODE_PAGE_FLIP_EVENT, NULL);
+               drmHandleEvent(s_drmdi.fd, &evctx);
+       }
+#endif
 }
index c74ea1e..aebcff4 100755 (executable)
@@ -76,3 +76,20 @@ void fbd_close(st_fbdi *fbdi)
        close(fbdi->fb_fd);
 }
 
+/*------------------------------------------------------------------------------
+ fbd_pan_display()- In case of Roy, the LCD Controller is turned OFF if it is
+                   not in use, hence we need to call PAN Display each time we
+                   have a new data in FB0 so that it can be pushed on the
+                   Display Panel.
+ -----------------------------------------------------------------------------*/
+int fbd_pan_display(st_fbdi *fbdi)
+{
+       int b_status = 0;
+
+       if (ioctl(fbdi->fb_fd, FBIOPAN_DISPLAY, &fbdi->vi)) {
+               b_status = -1;
+       }
+       else {
+       }
+       return b_status;
+}
index c1da0a9..f56d71c 100755 (executable)
@@ -32,6 +32,7 @@ limitations under the License.
 #include "chg_power.h"
 #include "chg_battery.h"
 #include "chg_env.h"
+#include "chg_misc.h"
 
 #define KEY_VAL_PRESS          1
 #define KEY_VAL_RELEASE        0
@@ -112,6 +113,9 @@ int event_monitor_process(void *arg)
                if (sys_power_cnt >= LCD_OFF_COUNT
                    && sys_power_state()!= SYS_POWER_OFF) {
                        sys_power_sleep(&fbi);
+                       /* cpu sleep mode unlock */
+                       sys_power_unlock();
+
                }
 
                if (sys_power_cnt > 0xFFFE)
@@ -181,7 +185,7 @@ int charging_animation_process(void)
 {
        int charging_mode = 0;
        int batt_err_temp_cnt = 0;
-
+       int b_disp_status = 0;
        DEBUG_MSG("[main] charging_animation_process() started. \n");
 
        set_chg_img_params();
@@ -207,6 +211,7 @@ int charging_animation_process(void)
                        batt_err_temp_cnt++;
                        break;
                case BATT_STATE_DISCONNECT:     /* TA disconnected */
+                       sys_power_lock();
                        if (lcd_bl_state() == LCD_BL_OFF) {
                                lcd_bl_on(&fbi);
                                if (lcd_br_state() == LCD_BR_DIMM)
@@ -218,7 +223,14 @@ int charging_animation_process(void)
                        sys_power_off();
                        break;
                }
+
+#ifdef INTERFACE_FB
+               if (fbi.type == FB_DEV_FB)
+                       b_disp_status = fb_pan_display(&fbi);
+#endif
+               DEBUG_MSG("charging_animation_process() loop+...\n");
                sleep(1);
+               DEBUG_MSG("charging_animation_process() loop-...\n");
        }
 
        return 0;
@@ -248,7 +260,11 @@ int main(int argc, char *argv[])
        DEBUG_MSG("charging-animation main function called.");
 
        sys_power_wakeup(&fbi);
-       lcd_bl_on(&fbi);
+       /* cpu wake up sequnce start */
+       /* sys_power_lock(); --> mem > /sys/power/state */
+       system_cmd_nowait("echo mem > /sys/power/state");
+       /* cpu wake up sequnce end */
+
        lcd_br_normal();
 
        if (clone(event_monitor_process, (void *)(child_stack + 4095),
index 2189970..21c4836 100755 (executable)
@@ -121,11 +121,18 @@ void draw_png_img_xy(FbInfo *fbi, int x1, int y1)
        int bpp;
        int x, y;
 
-       if (fbi->current_fb_id == s_drmdi.fb_id[0])
+#ifdef INTERFACE_DRM
+       if (fbi->type == FB_DEV_DRM) {
+               if (fbi->current_fb_id == s_drmdi.fb_id[0])
+                       fb_buf_cur = (unsigned int *)fbi->buf;
+               else
+                       fb_buf_cur = (unsigned int *)fbi->buf2;
+       }
+#endif
+#ifdef INTERFACE_FB
+       if (fbi->type == FB_DEV_FB)
                fb_buf_cur = (unsigned int *)fbi->buf;
-       else
-               fb_buf_cur = (unsigned int *)fbi->buf2;
-
+#endif
        /* check out range */
        if ((x1 + png_img_width > fbi->w) ||
            (y1 + png_img_height > fbi->h)) {
index c802857..e37f57b 100755 (executable)
@@ -25,6 +25,7 @@ limitations under the License.
 static int s_lcd_bl_state = LCD_BL_ON;
 static int s_lcd_br_state = LCD_BR_NORMAL;
 static int s_sys_power_state = SYS_POWER_ON;
+static int s_sys_power_lock = SYS_POWER_UNKOWN;
 
 /*-----------------------------------------------------------------------------
   fb_lcd_bl_on()
@@ -172,8 +173,45 @@ int lcd_br_state(void)
 int sys_power_wakeup(FbInfo *fbi)
 {
        DEBUG_MSG("sys_power_wakeup() is called.\n");
-       lcd_bl_on(fbi);
+       sys_power_lock();
        s_sys_power_state = SYS_POWER_ON;
+       lcd_bl_on(fbi);
+
+       return 0;
+}
+
+/*-----------------------------------------------------------------------------
+  sys_power_lock()
+ ----------------------------------------------------------------------------*/
+int sys_power_lock()
+{
+       int ret = 0;
+
+       DEBUG_MSG("sys_power_lock() is called.\n");
+
+       ret = write_to_file((const char*)chg_env_str[EN_ENV_POWER_LOCK],
+                       "mainlock");
+       if (ret < 0)
+               return -1;
+       s_sys_power_lock = SYS_POWER_LOCK;
+       return 0;
+}
+
+ /*-----------------------------------------------------------------------------
+  sys_power_unlock()
+ ----------------------------------------------------------------------------*/
+int sys_power_unlock()
+{
+       int ret = 0;
+
+       DEBUG_MSG("sys_power_unlock() is called.\n");
+
+       ret = write_to_file((const char*)chg_env_str[EN_ENV_POWER_UNLOCK],
+                       "mainlock");
+
+       if (ret < 0)
+               return -1;
+       s_sys_power_lock = SYS_POWER_UNLOCK;
        return 0;
 }
 
@@ -182,10 +220,17 @@ int sys_power_wakeup(FbInfo *fbi)
  ----------------------------------------------------------------------------*/
 int sys_power_sleep(FbInfo *fbi)
 {
-       DEBUG_MSG("sys_power_sleep() is called.\n");
-       lcd_bl_off(fbi);
+       DEBUG_MSG("sys_power_sleep() is called.env :%s\n",
+               chg_env_str[EN_ENV_NO_SLEEP]);
+
        s_sys_power_state = SYS_POWER_OFF;
-//     system_cmd_nowait("echo mem > /sys/power/state");
+
+       lcd_bl_off(fbi);
+
+       if (0 == (strcmp(chg_env_str[EN_ENV_NO_SLEEP], "1"))) {
+               DEBUG_MSG("nosleep...\n");
+               return 0;
+       }
        return 0;
 }