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    STORAGE_UFS_HEALTH = 105003;
41    F2FS_STATS = 105004;
42    ZRAM_MM_STAT = 105005;
43    ZRAM_BD_STAT = 105006;
44    BOOT_STATS = 105007;
45    WIRELESS_CHARGING_STATS = 105008;
46    DEVICE_ORIENTATION = 105009;
47    FG_CAPACITY = 105010;
48    // AOSP atom ID range ends at 109999
49}
50
51/* Westworld-supported reverse domain names. */
52message ReverseDomainNames {
53    optional string pixel = 1 [default = "com.google.pixel"];
54}
55
56/* A message containing detailed statistics and debug information about a charge session. */
57message ChargeStats {
58    /* Charge Adapter stats. */
59    enum AdapterType {
60        ADAPTER_TYPE_UNKNOWN = 0;
61        ADAPTER_TYPE_USB = 1;
62        ADAPTER_TYPE_USB_SDP = 2;
63        ADAPTER_TYPE_USB_DCP = 3;
64        ADAPTER_TYPE_USB_CDP = 4;
65        ADAPTER_TYPE_USB_ACA = 5;
66        ADAPTER_TYPE_USB_C = 6;
67        ADAPTER_TYPE_USB_PD = 7;
68        ADAPTER_TYPE_USB_PD_DRP = 8;
69        ADAPTER_TYPE_USB_PD_PPS = 9;
70        ADAPTER_TYPE_USB_PD_BRICKID = 10;
71        ADAPTER_TYPE_HVDCP = 11;
72        ADAPTER_TYPE_HVDCP3 = 12;
73        ADAPTER_TYPE_FLOAT = 13;
74        ADAPTER_TYPE_WLC  = 14;
75        ADAPTER_TYPE_WLC_EPP = 15;
76        ADAPTER_TYPE_WLC_SPP = 16;
77    }
78    /* Type of charge adapter, enumerated above. */
79    optional AdapterType adapter_type = 2;
80    /* Max negotiated voltage by charge adapter, in mV. */
81    optional int32 adapter_voltage = 3;
82    /* Max negotiated current by charge adapter current, in mA. */
83    optional int32 adapter_amperage = 4;
84
85    /* Stats at beginning of charge session. */
86    /* System State of Charge, in percent. */
87    optional int32 ssoc_in = 5;
88    /* Voltage in mV. */
89    optional int32 voltage_in = 6;
90
91    /* Stats at end of charge session. */
92    /* System State of Charge, in percent. */
93    optional int32 ssoc_out = 7;
94    /* Voltage in mV. */
95    optional int32 voltage_out = 8;
96}
97
98/* A message containing stats from each charge voltage tier. */
99message VoltageTierStats {
100    /* Voltage tier number, custom to implementation, should be <= 3. */
101    optional int32 voltage_tier = 2;
102
103    /* Stats when entering voltage tier. */
104    /* State of charge, in percent. */
105    optional float soc_in = 3;
106    /* Coulomb count, in mAh. */
107    optional int32 cc_in = 4;
108    /* Battery temperature, in deciC. */
109    optional int32 temp_in = 5;
110
111    /* Time spent at various charge speeds, in seconds. */
112    optional int32 time_fast_secs = 6;
113    optional int32 time_taper_secs = 7;
114    optional int32 time_other_secs = 8;
115
116    /* Battery temperature stats, in deciC. */
117    optional int32 temp_min = 9;
118    optional int32 temp_avg = 10;
119    optional int32 temp_max = 11;
120
121    /* Battery current stats, in mA. */
122    optional int32 ibatt_min = 12;
123    optional int32 ibatt_avg = 13;
124    optional int32 ibatt_max = 14;
125
126    /* Input current limit stats, in mA. */
127    optional int32 icl_min = 15;
128    optional int32 icl_avg = 16;
129    optional int32 icl_max = 17;
130}
131
132/* A message containing an alternate proprietary full battery capacity estimate. */
133message BatteryCapacity {
134    /* Sum of the change in coulomb count. */
135    optional int32 delta_cc_sum = 2;
136    /* Sum of the change in state of charge (battery level). */
137    optional int32 delta_vfsoc_sum = 3;
138}
139
140/* A message containing health values of UFS */
141message StorageUfsHealth {
142    /* The value of lifetimeA for UFS health */
143    optional int32 lifetime_a = 2;
144    /* The value of lifetimeB for UFS health */
145    optional int32 lifetime_b = 3;
146    /* The value of lifetimeC for UFS health */
147    optional int32 lifetime_c = 4;
148}
149
150/* A message containing filesystem stats of F2FS */
151message F2fsStatsInfo {
152    /* The value of dirty segments of f2fs */
153    optional int32 dirty_segments = 2;
154    /* The value of free segments of f2fs */
155    optional int32 free_segments = 3;
156    /* The times of checkpoint function called in foreground*/
157    optional int32 cp_calls_fg = 4;
158    /* The times of checkpoint function called in background */
159    optional int32 cp_calls_bg = 5;
160    /* The times of garbage collection function called in foreground */
161    optional int32 gc_calls_fg = 6;
162    /* The times of garbage collection function called in background */
163    optional int32 gc_calls_bg = 7;
164    /* The amount of blocks been moved by garbage collection in foreground */
165    optional int32 moved_blocks_fg = 8;
166    /* The amount of blocks been moved by garbage collection in background */
167    optional int32 moved_blocks_bg = 9;
168    /* The average of how many valid blocks is in a segment */
169    optional int32 valid_blocks = 10;
170}
171
172message ZramMmStat {
173    /* The value of original memory size */
174    optional int64 orig_data_size = 2;
175    /* The value of compressed memory size */
176    optional int64 compr_data_size = 3;
177    /* The value of consumed memory size to store compressed memory */
178    optional int64 mem_used_total = 4;
179    /* The value of number of page filled with same elements data */
180    optional int64 same_pages = 5;
181    /* The value of number of incompressible page */
182    optional int64 huge_pages = 6;
183}
184
185message ZramBdStat {
186    /* the number of pages in backing device */
187    optional int64 bd_count = 2;
188    /* The number of pages readed from backing device */
189    optional int64 bd_reads = 3;
190    /* The number of pages written to backing device */
191    optional int64 bd_writes = 4;
192}
193
194/* A message containing boot times */
195message BootStatsInfo {
196    /* The F2FS fsck time in secs */
197    optional int32 fsck_time_sec = 2;
198    /* The F2FS mounted time in secs */
199    optional int32 mounted_time_sec = 3;
200    /* The F2FS checkpoint=disable time in secs */
201    optional int32 checkpoint_time_sec = 4;
202}
203
204/* A message containing wireless charging health info. */
205message WirelessChargingStats {
206    /* Captures if a google charger used when start wireless charging */
207    enum ChargerVendor {
208        VENDOR_UNKNOWN = 0;
209        VENDOR_GOOGLE = 1;
210    }
211
212    optional ChargerVendor charger_vendor = 2;
213}
214
215/* Current device Orientation */
216message DeviceOrientation {
217    enum Orientation {
218        ORIENTATION_UNKNOWN = 0;
219        ORIENTATION_0 = 1;
220        ORIENTATION_90 = 2;
221        ORIENTATION_180 = 3;
222        ORIENTATION_270 = 4;
223    }
224
225    /* Device orientation. */
226    optional Orientation orientation = 2;
227}
228
229/* Raw battery capacity stats */
230message BatteryCapacityFG {
231    enum LogReason {
232        LOG_REASON_UNKNOWN = 0;
233        LOG_REASON_CONNECTED = 1;
234        LOG_REASON_DISCONNECTED = 2;
235        LOG_REASON_FULL_CHARGE = 3;
236        LOG_REASON_PERCENT_SKIP = 4;
237        LOG_REASON_DIVERGING_FG = 5;
238    }
239
240    /* Uevent logging reason, enumerated above. */
241    optional LogReason capacity_log_reason = 2;
242
243    /* The battery capacity reported from the FG (fuel gauge) hardware  */
244    optional float capacity_gdf = 3;
245    /* The filtered system battery capacity reported to the UI */
246    optional float capacity_ssoc = 4;
247    /* The fuel gauge capacity curve midpoint FG (fuel gauge) value */
248    optional float capacity_gdf_curve = 5;
249    /* The fuel gauge capacity curve midpoint UI value */
250    optional float capacity_ssoc_curve = 6;
251}
252
253