display: Do not control dpms in HAL 02/39002/1 accepted/tizen/common/20150507.110630 accepted/tizen/mobile/20150507.143531 accepted/tizen/tv/20150507.140652 accepted/tizen/wearable/20150507.141947 submit/tizen/20150507.094206
authorJiyoung Yun <jy910.yun@samsung.com>
Wed, 6 May 2015 12:36:49 +0000 (21:36 +0900)
committerJiyoung Yun <jy910.yun@samsung.com>
Wed, 6 May 2015 12:36:49 +0000 (21:36 +0900)
It will control by deviced.
Because it depends on display solution, not hardware.

Change-Id: I3041a0af3c1a8336b1c1d35b79367f8d16487dce
Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
CMakeLists.txt
hw/display-x/CMakeLists.txt [deleted file]
hw/display-x/display.c [deleted file]
hw/display/CMakeLists.txt [new file with mode: 0644]
hw/display/display.c [new file with mode: 0644]
packaging/device-manager-plugin-exynos5433.spec

index b19441c476bce415cecc9303811ae3884aa800d1..9175ff102df28bb14193ff5f11b831542cd148fc 100644 (file)
@@ -3,7 +3,5 @@ PROJECT(device-manager-exynos5433 C)
 
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 
-IF(X11_SUPPORT)
-ADD_SUBDIRECTORY(hw/display-x)
-ENDIF(X11_SUPPORT)
+ADD_SUBDIRECTORY(hw/display)
 ADD_SUBDIRECTORY(hw/led)
diff --git a/hw/display-x/CMakeLists.txt b/hw/display-x/CMakeLists.txt
deleted file mode 100644 (file)
index f1193e8..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(display C)
-
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(display_pkgs REQUIRED hwcommon dlog x11 xext)
-
-FOREACH(flag ${display_pkgs_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-
-ADD_LIBRARY(${PROJECT_NAME} MODULE display.c ../shared.c)
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${display_pkgs_LDFLAGS})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "")
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR}/hw COMPONENT RuntimeLibraries)
diff --git a/hw/display-x/display.c b/hw/display-x/display.c
deleted file mode 100644 (file)
index f956d51..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * device-node
- *
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <linux/limits.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/dpms.h>
-
-#include <hw/display.h>
-#include "../shared.h"
-
-#ifndef BACKLIGHT_PATH
-#define BACKLIGHT_PATH  "/sys/class/backlight/s6e3ha2"
-#endif
-
-static int get_max_brightness(int *val)
-{
-       static int max = -1;
-       int r;
-
-       if (!val)
-               return -EINVAL;
-
-       if (max < 0) {
-               r = sys_get_int(BACKLIGHT_PATH"/max_brightness", &max);
-               if (r < 0)
-                       return r;
-       }
-
-       *val = max;
-       return 0;
-}
-
-static int display_get_brightness(int *brightness)
-{
-       int r, v;
-
-       if (!brightness) {
-               _E("wrong parameter");
-               return -EINVAL;
-       }
-
-       r = sys_get_int(BACKLIGHT_PATH"/brightness", &v);
-       if (r < 0) {
-               _E("fail to get brightness : %s", strerror(r));
-               return r;
-       }
-
-       *brightness = v;
-       return 0;
-}
-
-static int display_set_brightness(int brightness)
-{
-       int r, v, max;
-
-       if (brightness < 0 || brightness > 100) {
-               _E("wrong parameter");
-               return -EINVAL;
-       }
-
-       r = get_max_brightness(&max);
-       if (r < 0) {
-               _E("fail to get max brightness : %s", strerror(r));
-               return r;
-       }
-
-       v = brightness/100.f*max;
-       r = sys_set_int(BACKLIGHT_PATH"/brightness", v);
-       if (r < 0) {
-               _E("fail to set brightness : %s", strerror(r));
-               return r;
-       }
-
-       return 0;
-}
-
-static int display_get_power_state(enum display_state *state)
-{
-       Display *dpy;
-       int dummy;
-       CARD16 dpms_state = DPMSModeOff;
-       BOOL onoff;
-
-       dpy = XOpenDisplay(NULL);
-       if (dpy == NULL) {
-               _E("fail to open display");
-               return -EPERM;
-       }
-
-       if (DPMSQueryExtension(dpy, &dummy, &dummy)) {
-               if (DPMSCapable(dpy)) {
-                       DPMSInfo(dpy, &dpms_state, &onoff);
-               }
-       }
-
-       XCloseDisplay(dpy);
-
-       if (state)
-               *state = dpms_state;
-
-       return 0;
-}
-
-static int display_set_power_state(enum display_state state)
-{
-       int type;
-       Display *dpy;
-
-       if (state == DISPLAY_ON)
-               type = DPMSModeOn;
-       else if (state == DISPLAY_STANDBY)
-               type = DPMSModeStandby;
-       else if (state == DISPLAY_SUSPEND)
-               type = DPMSModeSuspend;
-       else if (state == DISPLAY_OFF)
-               type = DPMSModeOff;
-       else
-               return -EINVAL;
-
-       dpy = XOpenDisplay(NULL);
-       if (dpy == NULL) {
-               _E("fail to open display");
-               return -EPERM;
-       }
-
-       DPMSEnable(dpy);
-       DPMSForceLevel(dpy, type);
-
-       XCloseDisplay(dpy);
-
-       return 0;
-}
-
-static int display_open(struct hw_info *info,
-               const char *id, struct hw_common **common)
-{
-       struct display_device *display_dev;
-
-       if (!info || !common)
-               return -EINVAL;
-
-       display_dev = calloc(1, sizeof(struct display_device));
-       if (!display_dev)
-               return -ENOMEM;
-
-       display_dev->common.info = info;
-       display_dev->get_brightness = display_get_brightness;
-       display_dev->set_brightness = display_set_brightness;
-       display_dev->get_state = display_get_power_state;
-       display_dev->set_state = display_set_power_state;
-
-       *common = (struct hw_common *)display_dev;
-       return 0;
-}
-
-static int display_close(struct hw_common *common)
-{
-       if (!common)
-               return -EINVAL;
-
-       free(common);
-       return 0;
-}
-
-HARDWARE_MODULE_STRUCTURE = {
-       .magic = HARDWARE_INFO_TAG,
-       .hal_version = HARDWARE_INFO_VERSION,
-       .device_version = DISPLAY_HARDWARE_DEVICE_VERSION,
-       .id = DISPLAY_HARDWARE_DEVICE_ID,
-       .name = "Display",
-       .open = display_open,
-       .close = display_close,
-};
diff --git a/hw/display/CMakeLists.txt b/hw/display/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ebccfbe
--- /dev/null
@@ -0,0 +1,19 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(display C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(display_pkgs REQUIRED hwcommon dlog)
+
+FOREACH(flag ${display_pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_LIBRARY(${PROJECT_NAME} MODULE display.c ../shared.c)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${display_pkgs_LDFLAGS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "")
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR}/hw COMPONENT RuntimeLibraries)
diff --git a/hw/display/display.c b/hw/display/display.c
new file mode 100644 (file)
index 0000000..d5d0b84
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * device-node
+ *
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <linux/limits.h>
+
+#include <hw/display.h>
+#include "../shared.h"
+
+#ifndef BACKLIGHT_PATH
+#define BACKLIGHT_PATH  "/sys/class/backlight/s6e3ha2"
+#endif
+
+static int get_max_brightness(int *val)
+{
+       static int max = -1;
+       int r;
+
+       if (!val)
+               return -EINVAL;
+
+       if (max < 0) {
+               r = sys_get_int(BACKLIGHT_PATH"/max_brightness", &max);
+               if (r < 0)
+                       return r;
+       }
+
+       *val = max;
+       return 0;
+}
+
+static int display_get_brightness(int *brightness)
+{
+       int r, v;
+
+       if (!brightness) {
+               _E("wrong parameter");
+               return -EINVAL;
+       }
+
+       r = sys_get_int(BACKLIGHT_PATH"/brightness", &v);
+       if (r < 0) {
+               _E("fail to get brightness : %s", strerror(r));
+               return r;
+       }
+
+       *brightness = v;
+       return 0;
+}
+
+static int display_set_brightness(int brightness)
+{
+       int r, v, max;
+
+       if (brightness < 0 || brightness > 100) {
+               _E("wrong parameter");
+               return -EINVAL;
+       }
+
+       r = get_max_brightness(&max);
+       if (r < 0) {
+               _E("fail to get max brightness : %s", strerror(r));
+               return r;
+       }
+
+       v = brightness/100.f*max;
+       r = sys_set_int(BACKLIGHT_PATH"/brightness", v);
+       if (r < 0) {
+               _E("fail to set brightness : %s", strerror(r));
+               return r;
+       }
+
+       return 0;
+}
+
+static int display_open(struct hw_info *info,
+               const char *id, struct hw_common **common)
+{
+       struct display_device *display_dev;
+
+       if (!info || !common)
+               return -EINVAL;
+
+       display_dev = calloc(1, sizeof(struct display_device));
+       if (!display_dev)
+               return -ENOMEM;
+
+       display_dev->common.info = info;
+       display_dev->get_brightness = display_get_brightness;
+       display_dev->set_brightness = display_set_brightness;
+
+       *common = (struct hw_common *)display_dev;
+       return 0;
+}
+
+static int display_close(struct hw_common *common)
+{
+       if (!common)
+               return -EINVAL;
+
+       free(common);
+       return 0;
+}
+
+HARDWARE_MODULE_STRUCTURE = {
+       .magic = HARDWARE_INFO_TAG,
+       .hal_version = HARDWARE_INFO_VERSION,
+       .device_version = DISPLAY_HARDWARE_DEVICE_VERSION,
+       .id = DISPLAY_HARDWARE_DEVICE_ID,
+       .name = "Display",
+       .open = display_open,
+       .close = display_close,
+};
index fa6939f140d2fb58caf3c5fb4bf860f0bfecd494..97ff9b0be048b63e7526b6201c9460d76a588561 100644 (file)
@@ -1,5 +1,3 @@
-%bcond_with x
-
 Name:       device-manager-plugin-exynos5433
 Summary:    Device manager plugin exynos5433
 Version:    0.0.1
@@ -13,10 +11,6 @@ Requires(postun): /sbin/ldconfig
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(hwcommon)
-%if %{with x}
-BuildRequires:  pkgconfig(x11)
-BuildRequires:  pkgconfig(xext)
-%endif
 
 %description
 Device manager plugin exynos 5433
@@ -27,13 +21,7 @@ Device manager plugin exynos 5433
 cp %{SOURCE1} .
 
 %build
-%if %{with x}
-%define X11_SUPPORT ON
-%else
-%define X11_SUPPORT OFF
-%endif
-
-%cmake . -DX11_SUPPORT:BOOL=%{X11_SUPPORT}
+%cmake .
 
 make %{?jobs:-j%jobs}