blob: d7862c778509071e5614d4b505ac0a46b39bfd9d [file] [log] [blame]
Rashed Abdel-Tawab00b21852017-11-03 12:44:16 -07001/*
2 * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 * * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above
10 * copyright notice, this list of conditions and the following
11 * disclaimer in the documentation and/or other materials provided
12 * with the distribution.
13 * * Neither the name of The Linux Foundation nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#ifndef __POWER_HELPER_H__
31#define __POWER_HELPER_H__
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#include "hardware/power.h"
38
39
40enum stats_type {
41 //WLAN Stats
42 WLAN_POWER_DEBUG_STATS = 0,
43 MAX_WLAN_STATS,
44};
45
46enum subsystem_type {
47 SUBSYSTEM_WLAN = 0,
48
49 //Don't add any lines after this line
50 SUBSYSTEM_COUNT
51};
52
53enum wlan_sleep_states {
54 WLAN_STATE_ACTIVE = 0,
55 WLAN_STATE_DEEP_SLEEP,
56
57 //Don't add any lines after this line
58 WLAN_STATES_COUNT
59};
60
61enum wlan_power_params {
62 CUMULATIVE_SLEEP_TIME_MS = 0,
63 CUMULATIVE_TOTAL_ON_TIME_MS,
64 DEEP_SLEEP_ENTER_COUNTER,
65 LAST_DEEP_SLEEP_ENTER_TSTAMP_MS,
66
67 //Don't add any lines after this line
68 WLAN_POWER_PARAMS_COUNT
69};
70
71
72#define MAX_RPM_PARAMS 2
73#define XO_VOTERS (MAX_PLATFORM_STATS - XO_VOTERS_START)
74#define VMIN_VOTERS 0
75
76struct stat_pair {
77 enum stats_type stat;
78 const char *label;
79 const char **parameters;
80 size_t num_parameters;
81};
82
83
84void power_init(void);
85void power_hint(power_hint_t hint, void *data);
86void power_set_interactive(int on);
87void set_feature(feature_t feature, int state);
88int extract_wlan_stats(uint64_t *list);
89
90
91#ifdef __cplusplus
92}
93#endif
94
95#endif //__POWER_HELPER_H__