display: Add SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY plugin-backend 94/312894/1
authorYunhee Seo <yuni.seo@samsung.com>
Wed, 5 Jun 2024 05:05:53 +0000 (14:05 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Mon, 17 Jun 2024 04:39:12 +0000 (13:39 +0900)
Add SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY plugin-backend skeleton code
for mobile profile.
To support syscommon_plugin_deviced_display_get_backend(), initialization code is added.
Also, mobile specific display config is set.

Change-Id: I246f4678e05d1056fea8f79351505a32d5dc9db0
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
CMakeLists.txt
packaging/system-plugin-backend-deviced-mobile.spec
src/display/CMakeLists.txt [new file with mode: 0644]
src/display/display.c [new file with mode: 0644]

index 7771931a0d2af470eb3ee6fd8e6151863d8097b8..6137912f0f436b57c9ab941d19b2586d860e4b93 100644 (file)
@@ -6,3 +6,4 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
 
 ADD_SUBDIRECTORY(src/battery)
+ADD_SUBDIRECTORY(src/display)
index ef908402b4dc693291a7582a9f3a6927ab61ce90..f83c300cf63dabc26bb50bcd40886de22d2cf520 100644 (file)
@@ -45,3 +45,4 @@ make %{?jobs:-j%jobs}
 %manifest %{name}.manifest
 %license LICENSE.Apache-2.0
 %{SYSTEM_PLUGIN_LIBDIR}/libplugin-backend-deviced-battery.so
+%{SYSTEM_PLUGIN_LIBDIR}/libplugin-backend-deviced-display.so
diff --git a/src/display/CMakeLists.txt b/src/display/CMakeLists.txt
new file mode 100644 (file)
index 0000000..5c46a85
--- /dev/null
@@ -0,0 +1,32 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(plugin-backend-deviced-display C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+FILE(GLOB ALL_SRCS "*.c")
+SET(SRCS ${ALL_SRCS})
+
+if (${PLUGIN_DEVICED_ENABLE_DLOG})
+       SET(PKG_MODULES
+               libsyscommon
+               libsyscommon-plugin-api-deviced)
+       ADD_DEFINITIONS("-DENABLE_DLOG")
+       ADD_DEFINITIONS("-DLOG_TAG=\"SYSTEM_PLUGIN_DEVICED_BATTERY\"")
+else()
+       SET(PKG_MODULES
+               libsyscommon
+               libsyscommon-plugin-api-deviced)
+endif()
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(PKGS REQUIRED ${PKG_MODULES})
+FOREACH(flag ${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} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS})
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${PLUGIN_LIB_DIR} COMPONENT RuntimeLibraries)
\ No newline at end of file
diff --git a/src/display/display.c b/src/display/display.c
new file mode 100644 (file)
index 0000000..9fbc6ea
--- /dev/null
@@ -0,0 +1,93 @@
+/**
+ * system-plugin-deviced-mobile
+ *
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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 <system/syscommon-plugin-common-interface.h>
+#include <system/syscommon-plugin-deviced-common-interface.h>
+#include <system/syscommon-plugin-deviced-display.h>
+#include <system/syscommon-plugin-deviced-display-interface.h>
+
+#define EXPORT __attribute__ ((visibility("default")))
+
+#define LOCK_SCREEN_WATING_TIME                300     /* 0.3 second */
+#define LONG_PRESS_INTERVAL            400     /* 0.4 seconds */
+#define SAMPLING_INTERVAL              1       /* 1 sec */
+#define BRIGHTNESS_CHANGE_STEP         10
+#define LCD_ALWAYS_ON                  0
+#define ACCEL_SENSOR_ON                        1
+#define CONTINUOUS_SAMPLING            1
+#define LCDOFF_TIMEOUT                 300     /* milli second */
+
+static struct syscommon_deviced_display_config display_conf = {
+       .lock_wait_time         = LOCK_SCREEN_WATING_TIME,
+       .longpress_interval     = LONG_PRESS_INTERVAL,
+       .lightsensor_interval   = SAMPLING_INTERVAL,
+       .lcdoff_timeout         = LCDOFF_TIMEOUT,
+       .pm_default_brightness = 80,
+       .brightness_change_step = BRIGHTNESS_CHANGE_STEP,
+       .lcd_always_on          = LCD_ALWAYS_ON,
+       .dimming                = 1,
+       .framerate_app          = {0, 0, 0, 0},
+       .control_display        = 0,
+       .powerkey_doublepress   = 0,
+       .accel_sensor_on        = ACCEL_SENSOR_ON,
+       .continuous_sampling    = CONTINUOUS_SAMPLING,
+       .timeout_enable         = true,
+       .input_support          = true,
+       .display_init_direction = SYSCOMMON_DEVICED_DISPLAY_ORIENTATION_HORIZONTAL,
+       .aod_enter_level        = 40,
+       .aod_tsp                = true,
+       .touch_wakeup           = false,
+       .display_on_usb_conn_changed = true,
+       .display_dpms_type      = SYSCOMMON_DEVICED_DPMS_TYPE_WINDOW_MANAGER,
+};
+
+static int load_display_config(struct syscommon_deviced_display_config **data)
+{
+       if (!data)
+               return -EINVAL;
+
+       *data = &display_conf;
+
+       return 0;
+}
+
+static syscommon_plugin_backend_deviced_display_funcs g_display_funcs = {
+       .load_display_config = load_display_config,
+};
+
+static int deviced_display_init(void **data)
+{
+       if (!data)
+               return -EINVAL;
+
+       *data = (void *)&g_display_funcs;
+
+       return 0;
+}
+
+static int deviced_display_exit(void *data)
+{
+       return 0;
+}
+
+syscommon_plugin_backend EXPORT system_plugin_backend_deviced_display_data = {
+       .name = "deviced-display",
+       .vendor = "Samsung",
+       .init = deviced_display_init,
+       .exit = deviced_display_exit,
+};