Home | History | Annotate | Download | only in power-libperfmgr
      1 /*
      2  * Copyright (c) 2018, 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
     34 extern "C" {
     35 #endif
     36 
     37 enum stats_type {
     38     //Platform Stats
     39     RPM_MODE_XO = 0,
     40     RPM_MODE_VMIN,
     41     RPM_MODE_MAX,
     42     XO_VOTERS_START = RPM_MODE_MAX,
     43     VOTER_APSS = XO_VOTERS_START,
     44     VOTER_MPSS,
     45     VOTER_ADSP,
     46     VOTER_SLPI,
     47     MAX_PLATFORM_STATS,
     48 
     49     //WLAN Stats
     50     WLAN_POWER_DEBUG_STATS = 0,
     51     MAX_WLAN_STATS,
     52 };
     53 
     54 enum subsystem_type {
     55     SUBSYSTEM_WLAN = 0,
     56     SUBSYSTEM_EASEL,
     57 
     58     //Don't add any lines after this line
     59     SUBSYSTEM_COUNT
     60 };
     61 
     62 enum wlan_sleep_states {
     63     WLAN_STATE_ACTIVE = 0,
     64     WLAN_STATE_DEEP_SLEEP,
     65 
     66     //Don't add any lines after this line
     67     WLAN_STATES_COUNT
     68 };
     69 
     70 enum wlan_power_params {
     71     CUMULATIVE_SLEEP_TIME_MS = 0,
     72     CUMULATIVE_TOTAL_ON_TIME_MS,
     73     DEEP_SLEEP_ENTER_COUNTER,
     74     LAST_DEEP_SLEEP_ENTER_TSTAMP_MS,
     75 
     76     //Don't add any lines after this line
     77     WLAN_POWER_PARAMS_COUNT
     78 };
     79 
     80 
     81 #define PLATFORM_SLEEP_MODES_COUNT RPM_MODE_MAX
     82 
     83 #define MAX_RPM_PARAMS 2
     84 #define XO_VOTERS (MAX_PLATFORM_STATS - XO_VOTERS_START)
     85 #define VMIN_VOTERS 0
     86 
     87 struct stat_pair {
     88     enum stats_type stat;
     89     const char *label;
     90     const char **parameters;
     91     size_t num_parameters;
     92 };
     93 
     94 int extract_platform_stats(uint64_t *list);
     95 int extract_wlan_stats(uint64_t *list);
     96 int get_easel_state(unsigned long *current_state);
     97 
     98 #ifdef __cplusplus
     99 }
    100 #endif
    101 
    102 #endif //__POWER_HELPER_H__
    103