1/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18
19// C++ namespace: android::hardware::google::pixel::PixelAtoms
20package android.hardware.google.pixel.PixelAtoms;
21
22option java_package = "android.hardware.google.pixel";
23option java_outer_classname = "PixelAtoms";
24
25/*
26 * Please note that the following features are not currently supported by
27 * the IStats->reportVendorAtom implementation:
28 *   - types outside of int, long, float, and string (ex. uint)
29 *   - submessages within an atom
30 *   - repeated fields - arrays must be unrolled
31 *   - field # 1 - this will be occupied by the vendor namespace
32 */
33
34/* Allocated Westworld atom IDs. */
35enum Ids {
36    // AOSP atom ID range starts at 105000
37    CHARGE_STATS = 105000;
38    VOLTAGE_TIER_STATS = 105001;
39    BATTERY_CAPACITY = 105002;
40    // AOSP atom ID range ends at 109999
41}
42
43/* Westworld-supported reverse domain names. */
44message ReverseDomainNames {
45    optional string pixel = 1 [default = "com.google.pixel"];
46}
47
48/* A message containing detailed statistics and debug information about a charge session. */
49message ChargeStats {
50    /* Charge Adapter stats. */
51    enum AdapterType {
52        ADAPTER_TYPE_UNKNOWN = 0;
53        ADAPTER_TYPE_USB = 1;
54        ADAPTER_TYPE_USB_SDP = 2;
55        ADAPTER_TYPE_USB_DCP = 3;
56        ADAPTER_TYPE_USB_CDP = 4;
57        ADAPTER_TYPE_USB_ACA = 5;
58        ADAPTER_TYPE_USB_C = 6;
59        ADAPTER_TYPE_USB_PD = 7;
60        ADAPTER_TYPE_USB_PD_DRP = 8;
61        ADAPTER_TYPE_USB_PD_PPS = 9;
62        ADAPTER_TYPE_USB_PD_BRICKID = 10;
63        ADAPTER_TYPE_HVDCP = 11;
64        ADAPTER_TYPE_HVDCP3 = 12;
65        ADAPTER_TYPE_FLOAT = 13;
66        ADAPTER_TYPE_WLC  = 14;
67        ADAPTER_TYPE_WLC_EPP = 15;
68        ADAPTER_TYPE_WLC_SPP = 16;
69    }
70    /* Type of charge adapter, enumerated above. */
71    optional AdapterType adapter_type = 2;
72    /* Max negotiated voltage by charge adapter, in mV. */
73    optional int32 adapter_voltage = 3;
74    /* Max negotiated current by charge adapter current, in mA. */
75    optional int32 adapter_amperage = 4;
76
77    /* Stats at beginning of charge session. */
78    /* System State of Charge, in percent. */
79    optional int32 ssoc_in = 5;
80    /* Voltage in mV. */
81    optional int32 voltage_in = 6;
82
83    /* Stats at end of charge session. */
84    /* System State of Charge, in percent. */
85    optional int32 ssoc_out = 7;
86    /* Voltage in mV. */
87    optional int32 voltage_out = 8;
88}
89
90/* A message containing stats from each charge voltage tier. */
91message VoltageTierStats {
92    /* Voltage tier number, custom to implementation, should be <= 3. */
93    optional int32 voltage_tier = 2;
94
95    /* Stats when entering voltage tier. */
96    /* State of charge, in percent. */
97    optional float soc_in = 3;
98    /* Coulomb count, in mAh. */
99    optional int32 cc_in = 4;
100    /* Battery temperature, in deciC. */
101    optional int32 temp_in = 5;
102
103    /* Time spent at various charge speeds, in seconds. */
104    optional int32 time_fast_secs = 6;
105    optional int32 time_taper_secs = 7;
106    optional int32 time_other_secs = 8;
107
108    /* Battery temperature stats, in deciC. */
109    optional int32 temp_min = 9;
110    optional int32 temp_avg = 10;
111    optional int32 temp_max = 11;
112
113    /* Battery current stats, in mA. */
114    optional int32 ibatt_min = 12;
115    optional int32 ibatt_avg = 13;
116    optional int32 ibatt_max = 14;
117
118    /* Input current limit stats, in mA. */
119    optional int32 icl_min = 15;
120    optional int32 icl_avg = 16;
121    optional int32 icl_max = 17;
122}
123
124/* A message containing an alternate proprietary full battery capacity estimate. */
125message BatteryCapacity {
126    /* Sum of the change in coulomb count. */
127    optional int32 delta_cc_sum = 2;
128    /* Sum of the change in state of charge (battery level). */
129    optional int32 delta_vfsoc_sum = 3;
130}
131