Adding CPU power lock/release 16/244216/8 accepted/tizen/unified/20200917.141751 submit/tizen/20200917.055747
authorManish Toshan Rathod/Tizen Platform /SRI-Bangalore/Staff Engineer/Samsung Electronics <manish.r@samsung.com>
Wed, 16 Sep 2020 09:08:04 +0000 (14:38 +0530)
committerManish Toshan Rathod/Tizen Platform /SRI-Bangalore/Staff Engineer/Samsung Electronics <manish.r@samsung.com>
Thu, 17 Sep 2020 04:59:06 +0000 (10:29 +0530)
Change-Id: If860a5b8298309af75b7fabd83cfed0fc8597f17
Signed-off-by: Manish Toshan Rathod/Tizen Platform /SRI-Bangalore/Staff Engineer/Samsung Electronics <manish.r@samsung.com>
CMakeLists.txt
packaging/sdbd.spec
src/transport.c

index bac4df9a5536643d980342373a370eeeca1bbc5d..915d312340db9c58a8f9ad485a5371bd53c21a05 100755 (executable)
@@ -105,6 +105,7 @@ include(FindPkgConfig)
 pkg_check_modules(pkgs REQUIRED
         libtzplatform-config
         capi-system-info
+        capi-system-device
         vconf
         glib-2.0
         gio-2.0
index a9ad6522ab9e3240840f21930b1ab9cf1b8008b4..953e052501f9eb330f64cef446aa0ce48ddca08e 100644 (file)
@@ -31,6 +31,8 @@ BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(gio-2.0)
 BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(libsystemd)
+BuildRequires: pkgconfig(capi-system-device)
+
 Requires: dbus
 Provides:      %{name}-profile_common = %{version}-%{release}
 Provides:      %{name}-profile_mobile = %{version}-%{release}
index 078df70fb1b21484bba12570f2895bca0f60cdeb..dce1888013f9901516d3c5ba35240d51ecce1281 100644 (file)
 #include "plugin_encrypt.h"
 #endif
 
+#include <device/power.h>
+#define CPU_LOCK_STATE_LOCKED 0
+#define CPU_LOCK_STATE_UNLOCKED 1
+int can_lock_once=CPU_LOCK_STATE_UNLOCKED;
+
 static void transport_unref(atransport *t);
 
 static atransport transport_list = {
@@ -594,6 +599,17 @@ static void register_transport(atransport *transport)
     m.transport = transport;
     m.action = 1;
     D("transport: %s registered\n", transport->serial);
+    if(can_lock_once==CPU_LOCK_STATE_UNLOCKED)
+    {
+        D("transport: doing CPU Power Lock\n");
+        device_power_request_lock (POWER_LOCK_CPU, 0);
+        can_lock_once=CPU_LOCK_STATE_LOCKED;
+    }
+    else
+    {
+        D("transport: Cannot do CPU Power Lock as lock already in place\n");
+    }
+
     if(transport_write_action(transport_registration_send, &m)) {
         fatal_errno("cannot write transport registration socket\n");
     }
@@ -605,6 +621,17 @@ static void remove_transport(atransport *transport)
     m.transport = transport;
     m.action = 0;
     D("transport: %s removed\n", transport->serial);
+    if(can_lock_once==CPU_LOCK_STATE_LOCKED)
+    {
+        D("transport: doing CPU Power UnLock\n");
+        device_power_release_lock (POWER_LOCK_CPU);
+        can_lock_once=CPU_LOCK_STATE_UNLOCKED;
+    }
+    else
+    {
+        D("transport: Cannot do CPU Power UnLock as lock is not in place\n");
+    }
+
     if(transport_write_action(transport_registration_send, &m)) {
         fatal_errno("cannot write transport registration socket\n");
     }