device-node
devman
dlog
- deviced
)
FOREACH(flag ${pkgs_CFLAGS})
+++ /dev/null
-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
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
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];
#define __CHG_POWER_H__
#include "chg_fb.h"
+#include "chg_fbd.h"
enum {
LCD_BL_ON,
+++ /dev/null
-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
Name: charging-animation
Summary: charging-animation
ExclusiveArch: %{arm}
-Version: 0.0.8
+Version: 0.0.9
Release: 0
Group: misc
License: Flora Software License
BuildRequires: pkgconfig(device-node)
BuildRequires: pkgconfig(devman)
BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(deviced)
%description
charging-animation
return;
}
+char *drivers[] = {
+ "exynos",
+ NULL
+};
+
/*-----------------------------------------------------------------------------
drmd_open()
----------------------------------------------------------------------------*/
{
drm_magic_t magic;
void *ptr, *ptr2;
- int ret;
+ int ret, i;
if (drmdi == NULL) {
DEBUG_MSG("[drmd_open] drmdi is NULL\n");
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]);
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);
}
static int s_err_img_y;
-
st_fbdi s_fbdi;
st_drmdi s_drmdi;
#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,\
#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,\
#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,\
#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,\
#include <string.h>
#include <sys/reboot.h>
#include <stdlib.h>
+#include <sys/ioctl.h>
#include <device-node.h>
#include <devman.h>
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;
----------------------------------------------------------------------------*/
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;
{
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);
DEBUG_MSG("nosleep...\n");
return 0;
}
+
+ system_cmd_nowait("echo mem > /sys/power/state");
+
return 0;
}