blob: 12b3440b3955f283c317f83b479eb703f982f1ce [file] [log] [blame]
Christopher N. Hessede5e3c62015-12-21 21:28:23 +01001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 * Copyright (C) 2014 The CyanogenMod Project
4 * Copyright (C) 2014-2015 Andreas Schneider <asn@cryptomilk.org>
Christopher N. Hessef05f9022017-01-16 22:49:06 +01005 * Copyright (C) 2014-2017 Christopher N. Hesse <raymanfx@gmail.com>
Christopher N. Hessede5e3c62015-12-21 21:28:23 +01006 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
Christopher N. Hesse3360b092016-07-11 15:48:35 +020020#include <ctype.h>
Christopher N. Hessede5e3c62015-12-21 21:28:23 +010021#include <dirent.h>
22#include <errno.h>
23#include <fcntl.h>
24#include <malloc.h>
25#include <stdbool.h>
Christopher N. Hessee1434192016-11-18 18:56:17 +010026#include <stdlib.h>
Christopher N. Hessede5e3c62015-12-21 21:28:23 +010027#include <string.h>
28#include <unistd.h>
29
30#include <sys/types.h>
31#include <sys/stat.h>
32
33#define LOG_TAG "SamsungPowerHAL"
34/* #define LOG_NDEBUG 0 */
35#include <utils/Log.h>
36
37#include <hardware/hardware.h>
38#include <hardware/power.h>
Christopher N. Hesse12263502016-12-07 12:18:20 +010039#include <liblights/samsung_lights_helper.h>
Christopher N. Hessede5e3c62015-12-21 21:28:23 +010040
Christopher N. Hesse4139d852016-12-07 12:21:44 +010041#include "samsung_power.h"
Christopher N. Hessede5e3c62015-12-21 21:28:23 +010042
Christopher N. Hessed9106e92017-03-04 01:05:14 +010043#define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0])
44
Christopher N. Hessede5e3c62015-12-21 21:28:23 +010045struct samsung_power_module {
46 struct power_module base;
47 pthread_mutex_t lock;
48 int boostpulse_fd;
Christopher N. Hessede5e3c62015-12-21 21:28:23 +010049 char cpu0_hispeed_freq[10];
50 char cpu0_max_freq[10];
51 char cpu4_hispeed_freq[10];
52 char cpu4_max_freq[10];
53 char* touchscreen_power_path;
54 char* touchkey_power_path;
Christopher N. Hessede5e3c62015-12-21 21:28:23 +010055};
56
Andreas Schneiderf15d7f42016-02-03 10:43:47 +010057enum power_profile_e {
58 PROFILE_POWER_SAVE = 0,
59 PROFILE_BALANCED,
Christopher N. Hesse58f2ca02017-01-17 00:01:15 +010060 PROFILE_HIGH_PERFORMANCE,
61 PROFILE_MAX
Andreas Schneiderf15d7f42016-02-03 10:43:47 +010062};
Christopher N. Hesseccd970d2017-01-25 22:41:05 +010063
Andreas Schneiderf15d7f42016-02-03 10:43:47 +010064static enum power_profile_e current_power_profile = PROFILE_BALANCED;
Christopher N. Hessede5e3c62015-12-21 21:28:23 +010065
66/**********************************************************
67 *** HELPER FUNCTIONS
68 **********************************************************/
69
70static int sysfs_read(char *path, char *s, int num_bytes)
71{
72 char errno_str[64];
73 int len;
74 int ret = 0;
75 int fd;
76
77 fd = open(path, O_RDONLY);
78 if (fd < 0) {
79 strerror_r(errno, errno_str, sizeof(errno_str));
Christopher N. Hesse354f7132017-03-04 01:06:22 +010080 ALOGE("Error opening %s: %s", path, errno_str);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +010081
82 return -1;
83 }
84
85 len = read(fd, s, num_bytes - 1);
86 if (len < 0) {
87 strerror_r(errno, errno_str, sizeof(errno_str));
Christopher N. Hesse354f7132017-03-04 01:06:22 +010088 ALOGE("Error reading from %s: %s", path, errno_str);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +010089
90 ret = -1;
91 } else {
92 s[len] = '\0';
93 }
94
95 close(fd);
96
97 return ret;
98}
99
100static void sysfs_write(const char *path, char *s)
101{
102 char errno_str[64];
103 int len;
104 int fd;
105
106 fd = open(path, O_WRONLY);
107 if (fd < 0) {
108 strerror_r(errno, errno_str, sizeof(errno_str));
Christopher N. Hesse354f7132017-03-04 01:06:22 +0100109 ALOGE("Error opening %s: %s", path, errno_str);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100110 return;
111 }
112
113 len = write(fd, s, strlen(s));
114 if (len < 0) {
115 strerror_r(errno, errno_str, sizeof(errno_str));
Christopher N. Hesse354f7132017-03-04 01:06:22 +0100116 ALOGE("Error writing to %s: %s", path, errno_str);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100117 }
118
119 close(fd);
120}
121
Christopher N. Hesse5fada9b2017-01-16 23:39:48 +0100122static void boost(int32_t duration_us)
123{
124 int fd;
125
126 if (duration_us <= 0)
127 return;
128
129 fd = open(BOOST_PATH, O_WRONLY);
130 if (fd < 0) {
Christopher N. Hesse354f7132017-03-04 01:06:22 +0100131 ALOGE("Error opening %s", BOOST_PATH);
Christopher N. Hesse5fada9b2017-01-16 23:39:48 +0100132 return;
133 }
134
135 write(fd, "1", 1);
136 usleep(duration_us);
137 write(fd, "0", 1);
138
139 close(fd);
140}
141
Christopher N. Hessef21fbdb2017-03-04 01:41:58 +0100142static void boostpulse_open(struct samsung_power_module *samsung_pwr)
143{
144 samsung_pwr->boostpulse_fd = open(BOOSTPULSE_PATH, O_WRONLY);
145 if (samsung_pwr->boostpulse_fd < 0) {
146 ALOGE("Error opening %s: %s\n", BOOSTPULSE_PATH, strerror(errno));
147 }
148}
149
150static void send_boostpulse(int boostpulse_fd)
151{
152 int len;
153
154 if (boostpulse_fd < 0) {
155 return;
156 }
157
158 len = write(boostpulse_fd, "1", 1);
159 if (len < 0) {
160 ALOGE("Error writing to %s: %s", BOOSTPULSE_PATH, strerror(errno));
161 }
162}
163
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100164/**********************************************************
165 *** POWER FUNCTIONS
166 **********************************************************/
167
Andreas Schneiderf15d7f42016-02-03 10:43:47 +0100168static void set_power_profile(struct samsung_power_module *samsung_pwr,
Christopher N. Hesse58f2ca02017-01-17 00:01:15 +0100169 int profile)
Andreas Schneiderf15d7f42016-02-03 10:43:47 +0100170{
171 int rc;
172 struct stat sb;
173
Christopher N. Hesse58f2ca02017-01-17 00:01:15 +0100174 if (profile < 0 || profile >= PROFILE_MAX) {
175 return;
176 }
177
Andreas Schneiderf15d7f42016-02-03 10:43:47 +0100178 if (current_power_profile == profile) {
179 return;
180 }
181
182 ALOGV("%s: profile=%d", __func__, profile);
183
184 switch (profile) {
185 case PROFILE_POWER_SAVE:
186 // Limit to hispeed freq
187 sysfs_write(CPU0_MAX_FREQ_PATH, samsung_pwr->cpu0_hispeed_freq);
188 rc = stat(CPU4_MAX_FREQ_PATH, &sb);
189 if (rc == 0) {
190 sysfs_write(CPU4_MAX_FREQ_PATH, samsung_pwr->cpu4_hispeed_freq);
191 }
Christopher N. Hessef05f9022017-01-16 22:49:06 +0100192 ALOGV("%s: set powersave mode", __func__);
Andreas Schneiderf15d7f42016-02-03 10:43:47 +0100193 break;
194 case PROFILE_BALANCED:
195 // Restore normal max freq
196 sysfs_write(CPU0_MAX_FREQ_PATH, samsung_pwr->cpu0_max_freq);
197 rc = stat(CPU4_MAX_FREQ_PATH, &sb);
198 if (rc == 0) {
199 sysfs_write(CPU4_MAX_FREQ_PATH, samsung_pwr->cpu4_max_freq);
200 }
Christopher N. Hessef05f9022017-01-16 22:49:06 +0100201 ALOGV("%s: set balanced mode", __func__);
Andreas Schneiderf15d7f42016-02-03 10:43:47 +0100202 break;
203 case PROFILE_HIGH_PERFORMANCE:
204 // Restore normal max freq
205 sysfs_write(CPU0_MAX_FREQ_PATH, samsung_pwr->cpu0_max_freq);
206 rc = stat(CPU4_MAX_FREQ_PATH, &sb);
207 if (rc == 0) {
208 sysfs_write(CPU4_MAX_FREQ_PATH, samsung_pwr->cpu4_max_freq);
209 }
Christopher N. Hessef05f9022017-01-16 22:49:06 +0100210 ALOGV("%s: set performance mode", __func__);
Andreas Schneiderf15d7f42016-02-03 10:43:47 +0100211 break;
212 }
213
214 current_power_profile = profile;
215}
216
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100217static void find_input_nodes(struct samsung_power_module *samsung_pwr, char *dir)
218{
219 const char filename[] = "name";
220 char errno_str[64];
221 struct dirent *de;
222 char file_content[20];
223 char *path = NULL;
224 char *node_path = NULL;
225 size_t pathsize;
226 size_t node_pathsize;
227 DIR *d;
228
229 d = opendir(dir);
230 if (d == NULL) {
231 return;
232 }
233
234 while ((de = readdir(d)) != NULL) {
235 if (strncmp(filename, de->d_name, sizeof(filename)) == 0) {
236 pathsize = strlen(dir) + strlen(de->d_name) + 2;
237 node_pathsize = strlen(dir) + strlen("enabled") + 2;
238
239 path = malloc(pathsize);
240 node_path = malloc(node_pathsize);
241 if (path == NULL || node_path == NULL) {
242 strerror_r(errno, errno_str, sizeof(errno_str));
Christopher N. Hesse354f7132017-03-04 01:06:22 +0100243 ALOGE("Out of memory: %s", errno_str);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100244 return;
245 }
246
247 snprintf(path, pathsize, "%s/%s", dir, filename);
248 sysfs_read(path, file_content, sizeof(file_content));
249
250 snprintf(node_path, node_pathsize, "%s/%s", dir, "enabled");
251
252 if (strncmp(file_content, "sec_touchkey", 12) == 0) {
Christopher N. Hesse354f7132017-03-04 01:06:22 +0100253 ALOGV("%s: found touchkey path: %s", __func__, node_path);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100254 samsung_pwr->touchkey_power_path = malloc(node_pathsize);
255 if (samsung_pwr->touchkey_power_path == NULL) {
256 strerror_r(errno, errno_str, sizeof(errno_str));
Christopher N. Hesse354f7132017-03-04 01:06:22 +0100257 ALOGE("Out of memory: %s", errno_str);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100258 return;
259 }
Christopher N. Hesse22da3132016-02-01 12:36:54 +0100260 snprintf(samsung_pwr->touchkey_power_path, node_pathsize,
261 "%s", node_path);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100262 }
263
264 if (strncmp(file_content, "sec_touchscreen", 15) == 0) {
Christopher N. Hesse354f7132017-03-04 01:06:22 +0100265 ALOGV("%s: found touchscreen path: %s", __func__, node_path);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100266 samsung_pwr->touchscreen_power_path = malloc(node_pathsize);
267 if (samsung_pwr->touchscreen_power_path == NULL) {
268 strerror_r(errno, errno_str, sizeof(errno_str));
Christopher N. Hesse354f7132017-03-04 01:06:22 +0100269 ALOGE("Out of memory: %s", errno_str);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100270 return;
271 }
Christopher N. Hesse22da3132016-02-01 12:36:54 +0100272 snprintf(samsung_pwr->touchscreen_power_path, node_pathsize,
273 "%s", node_path);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100274 }
275 }
276 }
277
278 if (path)
279 free(path);
280 if (node_path)
281 free(node_path);
282 closedir(d);
283}
284
285/**********************************************************
286 *** INIT FUNCTIONS
287 **********************************************************/
288
289static void init_cpufreqs(struct samsung_power_module *samsung_pwr)
290{
291 int rc;
292 struct stat sb;
293
294 sysfs_read(CPU0_HISPEED_FREQ_PATH, samsung_pwr->cpu0_hispeed_freq,
295 sizeof(samsung_pwr->cpu0_hispeed_freq));
296 sysfs_read(CPU0_MAX_FREQ_PATH, samsung_pwr->cpu0_max_freq,
297 sizeof(samsung_pwr->cpu0_max_freq));
Christopher N. Hesse354f7132017-03-04 01:06:22 +0100298 ALOGV("%s: CPU 0 hispeed freq: %s", __func__, samsung_pwr->cpu0_hispeed_freq);
299 ALOGV("%s: CPU 0 max freq: %s", __func__, samsung_pwr->cpu0_max_freq);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100300
301 rc = stat(CPU4_HISPEED_FREQ_PATH, &sb);
302 if (rc == 0) {
303 sysfs_read(CPU4_HISPEED_FREQ_PATH, samsung_pwr->cpu4_hispeed_freq,
304 sizeof(samsung_pwr->cpu4_hispeed_freq));
305 sysfs_read(CPU4_MAX_FREQ_PATH, samsung_pwr->cpu4_max_freq,
306 sizeof(samsung_pwr->cpu4_max_freq));
Christopher N. Hesse354f7132017-03-04 01:06:22 +0100307 ALOGV("%s: CPU 4 hispeed freq: %s", __func__, samsung_pwr->cpu4_hispeed_freq);
308 ALOGV("%s: CPU 4 max freq: %s", __func__, samsung_pwr->cpu4_max_freq);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100309 }
310}
311
312static void init_touch_input_power_path(struct samsung_power_module *samsung_pwr)
313{
314 char dir[1024];
315 char errno_str[64];
316 uint32_t i;
317
318 for (i = 0; i < 20; i++) {
319 snprintf(dir, sizeof(dir), "/sys/class/input/input%d", i);
320 find_input_nodes(samsung_pwr, dir);
321 }
322}
323
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100324static void samsung_power_init(struct power_module *module)
325{
326 struct samsung_power_module *samsung_pwr = (struct samsung_power_module *) module;
327
328 init_cpufreqs(samsung_pwr);
Christopher N. Hessed9106e92017-03-04 01:05:14 +0100329
330 boostpulse_open(samsung_pwr);
331
Christopher N. Hesse65c65bd2017-03-07 23:01:12 +0100332 samsung_pwr->touchscreen_power_path = NULL;
333 samsung_pwr->touchkey_power_path = NULL;
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100334 init_touch_input_power_path(samsung_pwr);
335}
336
Christopher N. Hessef6296722017-01-16 22:47:11 +0100337/**********************************************************
338 *** API FUNCTIONS
339 ***
340 *** Refer to power.h for documentation.
341 **********************************************************/
342
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100343static void samsung_power_set_interactive(struct power_module *module, int on)
344{
345 struct samsung_power_module *samsung_pwr = (struct samsung_power_module *) module;
346 struct stat sb;
Christopher N. Hessed9106e92017-03-04 01:05:14 +0100347 int panel_brightness;
348 char button_state[2];
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100349 int rc;
Christopher N. Hessed9106e92017-03-04 01:05:14 +0100350 static bool touchkeys_blocked = false;
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100351
Christopher N. Hesse354f7132017-03-04 01:06:22 +0100352 ALOGV("power_set_interactive: %d", on);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100353
Christopher N. Hessed9106e92017-03-04 01:05:14 +0100354 /*
355 * Do not disable any input devices if the screen is on but we are in a non-interactive
356 * state.
357 */
Christopher N. Hesse3360b092016-07-11 15:48:35 +0200358 if (!on) {
Christopher N. Hessed9106e92017-03-04 01:05:14 +0100359 panel_brightness = get_cur_panel_brightness();
360 if (panel_brightness < 0) {
361 ALOGE("%s: Failed to read panel brightness", __func__);
362 } else if (panel_brightness > 0) {
Christopher N. Hesse3360b092016-07-11 15:48:35 +0200363 ALOGV("%s: Moving to non-interactive state, but screen is still on,"
Christopher N. Hesse354f7132017-03-04 01:06:22 +0100364 " not disabling input devices", __func__);
Christopher N. Hesse3360b092016-07-11 15:48:35 +0200365 goto out;
366 }
367 }
368
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100369 sysfs_write(samsung_pwr->touchscreen_power_path, on ? "1" : "0");
370
Christopher N. Hessed9106e92017-03-04 01:05:14 +0100371 /* Bail out if the device does not have touchkeys */
372 if (samsung_pwr->touchkey_power_path == NULL) {
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100373 goto out;
374 }
375
376 if (!on) {
Christopher N. Hessed9106e92017-03-04 01:05:14 +0100377 rc = sysfs_read(samsung_pwr->touchkey_power_path, button_state, ARRAY_SIZE(button_state));
378 if (rc < 0) {
379 ALOGE("%s: Failed to read touchkey state", __func__);
380 goto out;
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100381 }
Christopher N. Hessed9106e92017-03-04 01:05:14 +0100382 /*
383 * If button_state is 0, the keys have been disabled by another component
384 * (for example cmhw), which means we don't want them to be enabled when resuming
385 * from suspend.
386 */
387 if (button_state[0] == '0') {
388 touchkeys_blocked = true;
389 } else {
390 touchkeys_blocked = false;
391 }
392 }
393
394 if (!touchkeys_blocked) {
395 sysfs_write(samsung_pwr->touchkey_power_path, on ? "1" : "0");
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100396 }
397
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100398out:
Christopher N. Hesse2879c692016-07-11 15:49:49 +0200399 sysfs_write(IO_IS_BUSY_PATH, on ? "1" : "0");
Christopher N. Hesse354f7132017-03-04 01:06:22 +0100400 ALOGV("power_set_interactive: %d done", on);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100401}
402
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100403static void samsung_power_hint(struct power_module *module,
404 power_hint_t hint,
405 void *data)
406{
407 struct samsung_power_module *samsung_pwr = (struct samsung_power_module *) module;
408 char errno_str[64];
409 int len;
410
411 switch (hint) {
412 case POWER_HINT_INTERACTION: {
Andreas Schneiderf15d7f42016-02-03 10:43:47 +0100413 if (current_power_profile == PROFILE_POWER_SAVE) {
414 return;
415 }
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100416
417 ALOGV("%s: POWER_HINT_INTERACTION", __func__);
Christopher N. Hessef21fbdb2017-03-04 01:41:58 +0100418 send_boostpulse(samsung_pwr->boostpulse_fd);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100419 break;
420 }
421 case POWER_HINT_VSYNC: {
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100422 ALOGV("%s: POWER_HINT_VSYNC", __func__);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100423 break;
424 }
Christopher N. Hesse5fada9b2017-01-16 23:39:48 +0100425#ifdef POWER_HINT_CPU_BOOST
426 case POWER_HINT_CPU_BOOST:
427 boost((*(int32_t *)data));
428 break;
429#endif
Andreas Schneiderf15d7f42016-02-03 10:43:47 +0100430 case POWER_HINT_SET_PROFILE: {
431 int profile = *((intptr_t *)data);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100432
Andreas Schneiderf15d7f42016-02-03 10:43:47 +0100433 ALOGV("%s: POWER_HINT_SET_PROFILE", __func__);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100434
Andreas Schneiderf15d7f42016-02-03 10:43:47 +0100435 set_power_profile(samsung_pwr, profile);
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100436 break;
437 }
438 default:
439 break;
440 }
441}
442
Andreas Schneiderf15d7f42016-02-03 10:43:47 +0100443static int samsung_get_feature(struct power_module *module __unused,
444 feature_t feature)
445{
446 if (feature == POWER_FEATURE_SUPPORTED_PROFILES) {
Christopher N. Hesse58f2ca02017-01-17 00:01:15 +0100447 return PROFILE_MAX;
Andreas Schneiderf15d7f42016-02-03 10:43:47 +0100448 }
449
450 return -1;
451}
452
Christopher N. Hesse1c474662016-11-18 18:59:06 +0100453static void samsung_set_feature(struct power_module *module, feature_t feature, int state __unused)
Christopher N. Hessee480d892016-06-22 23:04:39 +0200454{
455 struct samsung_power_module *samsung_pwr = (struct samsung_power_module *) module;
456
457 switch (feature) {
ishantvivek987dcca2016-11-21 06:05:47 +0000458#ifdef TARGET_TAP_TO_WAKE_NODE
Christopher N. Hessee480d892016-06-22 23:04:39 +0200459 case POWER_FEATURE_DOUBLE_TAP_TO_WAKE:
460 ALOGV("%s: %s double tap to wake", __func__, state ? "enabling" : "disabling");
ishantvivek987dcca2016-11-21 06:05:47 +0000461 sysfs_write(TARGET_TAP_TO_WAKE_NODE, state > 0 ? "1" : "0");
Christopher N. Hessee480d892016-06-22 23:04:39 +0200462 break;
463#endif
464 default:
465 break;
466 }
467}
468
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100469static struct hw_module_methods_t power_module_methods = {
470 .open = NULL,
471};
472
473struct samsung_power_module HAL_MODULE_INFO_SYM = {
474 .base = {
475 .common = {
476 .tag = HARDWARE_MODULE_TAG,
477 .module_api_version = POWER_MODULE_API_VERSION_0_2,
478 .hal_api_version = HARDWARE_HAL_API_VERSION,
479 .id = POWER_HARDWARE_MODULE_ID,
480 .name = "Samsung Power HAL",
Christopher N. Hesseaa75be42017-01-16 22:47:59 +0100481 .author = "The LineageOS Project",
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100482 .methods = &power_module_methods,
483 },
484
485 .init = samsung_power_init,
486 .setInteractive = samsung_power_set_interactive,
487 .powerHint = samsung_power_hint,
Christopher N. Hessee480d892016-06-22 23:04:39 +0200488 .getFeature = samsung_get_feature,
489 .setFeature = samsung_set_feature
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100490 },
491
492 .lock = PTHREAD_MUTEX_INITIALIZER,
493 .boostpulse_fd = -1,
Christopher N. Hessede5e3c62015-12-21 21:28:23 +0100494};