Home | History | Annotate | Download | only in power
      1 /*
      2  * Copyright (c) 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 #ifndef __POWER_HELPER_H__
     30 #define __POWER_HELPER_H__
     31 
     32 #ifdef __cplusplus
     33 extern "C" {
     34 #endif
     35 
     36 #include <hardware/power.h>
     37 
     38 enum platform_param_id {
     39     VLOW_COUNT = 0,
     40     ACCUMULATED_VLOW_TIME,
     41     VMIN_COUNT,
     42     ACCUMULATED_VMIN_TIME,
     43     RPM_PARAM_COUNT,
     44 
     45     XO_ACCUMULATED_DURATION_APSS = RPM_PARAM_COUNT,
     46     XO_COUNT_APSS,
     47     XO_ACCUMULATED_DURATION_MPSS,
     48     XO_COUNT_MPSS,
     49     XO_ACCUMULATED_DURATION_ADSP,
     50     XO_COUNT_ADSP,
     51     XO_ACCUMULATED_DURATION_SLPI,
     52     XO_COUNT_SLPI,
     53 
     54     //Don't add any lines after that line
     55     PLATFORM_PARAM_COUNT
     56 };
     57 
     58 enum platform_mode_id {
     59     RPM_MODE_XO = 0,
     60     RPM_MODE_VMIN,
     61 
     62     //Don't add any lines after that line
     63     RPM_MODE_COUNT
     64 };
     65 
     66 #define XO_VOTERS 4
     67 #define VMIN_VOTERS 0
     68 
     69 enum voter_id {
     70     APSS,
     71     MPSS,
     72     ADSP,
     73     SLPI,
     74 
     75     //Don't add any lines after that line
     76     VOTER_COUNT
     77 };
     78 
     79 enum subsystem_type {
     80     SUBSYSTEM_WLAN,
     81 
     82     //Don't add any lines after that line
     83     SUBSYSTEM_COUNT
     84 };
     85 
     86 enum wlan_param_id {
     87     CUMULATIVE_SLEEP_TIME_MS,
     88     CUMULATIVE_TOTAL_ON_TIME_MS,
     89     DEEP_SLEEP_ENTER_COUNTER,
     90     LAST_DEEP_SLEEP_ENTER_TSTAMP_MS,
     91 
     92     //Don't add any lines after that line
     93     WLAN_PARAM_COUNT
     94 };
     95 
     96 enum wlan_state_id {
     97     WLAN_STATE_ACTIVE = 0,
     98     WLAN_STATE_DEEP_SLEEP,
     99 
    100     //Don't add any lines after that line
    101     WLAN_STATE_COUNT
    102 };
    103 
    104 
    105 void power_init(void);
    106 void power_hint(power_hint_t hint, void *data);
    107 void power_set_interactive(int on);
    108 int extract_platform_stats(uint64_t *list);
    109 int extract_wlan_stats(uint64_t *list);
    110 
    111 #ifdef __cplusplus
    112 }
    113 #endif
    114 
    115 #endif //__POWER_HELPER_H__
    116