xref: /aosp_15_r20/external/crosvm/power_monitor/power_supply_properties.proto (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1// Copyright (c) 2013 The ChromiumOS Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// WARNING: DO NOT MODIFY
6//
7// This files is a copy of the same file in the ChromeOS codebase at
8// platform2/system_api/dbus/power_manager/power_supply_properties.proto
9// and is only used for upstream builds.
10//
11// If you need to make changes, make the changes on the ChromeOS-side first,
12// then copy to this file.
13
14syntax = "proto2";
15option optimize_for = LITE_RUNTIME;
16package power_manager;
17option go_package = "chromiumos/system_api/power_manager_proto";
18// Power supply status sent from powerd to Chrome.
19message PowerSupplyProperties {
20  // For any of these power sources, the system may be consuming power at a high
21  // enough rate that the battery is discharging rather than charging; see
22  // BatteryState. See the PowerSource submessage's |type| field for more
23  // details about the active power source.
24  enum ExternalPower {
25    // AC/line/mains or USB PD power is connected. This is typically the
26    // highest-power source that can be attached to the system.
27    AC = 0;
28    // A low-power USB source (SDP, DCP, CDP, or ACA) is connected.
29    USB = 1;
30    // No external power source is connected.
31    DISCONNECTED = 2;
32    // Next value to use: 4
33  }
34  enum BatteryState {
35    // The battery is full or close to full.
36    FULL = 0;
37    // The battery is being charged but is not yet full.
38    CHARGING = 1;
39    // The battery is discharging. Note that an external power source may be
40    // connected but not supplying enough power to offset the system's
41    // instantaneous power consumption. This state is also used if the battery
42    // is neither charging nor discharging (i.e. current is zero) in a non-full
43    // state, which may indicate a battery defect.
44    DISCHARGING = 2;
45    // The system doesn't have a battery.
46    NOT_PRESENT = 3;
47    // Next value to use: 4
48  }
49  // Details about a potential source of power to the system.
50  message PowerSource {
51    enum Port {
52      // The location of the port is unknown, or there's only one port.
53      UNKNOWN = 0;
54      // Various positions on the device. The first word describes the side of
55      // the device where the port is located while the second clarifies the
56      // position. For example, LEFT_BACK means the farthest-back port on the
57      // left side, while BACK_LEFT means the leftmost port on the back of the
58      // device.
59      LEFT = 1;
60      RIGHT = 2;
61      BACK = 3;
62      FRONT = 4;
63      LEFT_FRONT = 5;
64      LEFT_BACK = 6;
65      RIGHT_FRONT = 7;
66      RIGHT_BACK = 8;
67      BACK_LEFT = 9;
68      BACK_RIGHT = 10;
69      // Next value to use: 11
70    }
71    enum Type {
72      // Unspecified type.
73      OTHER = 0;
74      // Dedicated charger. Typically single-purpose and non-USB (e.g. barrel
75      // jack plugs). Corresponds to kernel-reported type "Mains". This source
76      // is reported by the ACPI driver and may also appear (along with a USB_PD
77      // source) on Type-C-only systems if the ACPI driver is present.
78      MAINS = 1;
79      // USB Type-C, including dedicated Type-C chargers. Typically >= 7.5W.
80      // Corresponds to kernel-reported types "USB_C", "USB_PD", "USB_PD_DRP",
81      // and "BrickID".
82      USB_C = 2;
83      // USB Battery Charging r1.2. Typically <= 7.5W. Corresponds to
84      // kernel-reported types "USB", "USB_ACA", "USB_CDP", and "USB_DCP".
85      USB_BC_1_2 = 3;
86      // Next value to use: 4
87    }
88    // Opaque ID corresponding to the device. Do not use this for any purpose
89    // beyond comparisons with |external_power_source_id| or as an argument to
90    // powerd's SetPowerSource D-Bus method.
91    optional string id = 1;
92    // The charging port to which this power source is connected.
93    optional Port port = 7;
94    // Power source type.
95    optional Type type = 8;
96    // Raw strings read from |manufacturer| and |model_name| files in sysfs.
97    optional string manufacturer_id = 4;
98    optional string model_id = 5;
99    // Maximum power this source is capable of delivering, in watts.
100    optional double max_power = 6;
101    // True if the power source will automatically deliver charge to the system
102    // when connected (assuming there isn't another |active_by_default| source
103    // doing so). If false, the source will not deliver charge unless requested
104    // to do so by the user.
105    optional bool active_by_default = 3;
106    // Next ID to use: 9
107  }
108  // Current state of the external power source.
109  optional ExternalPower external_power = 14;
110  // ID of the PowerSource that is currently providing power to the system.
111  optional string external_power_source_id = 17;
112  // Currently-connected external power sources.
113  repeated PowerSource available_external_power_source = 18;
114  // Current state of the battery.
115  optional BatteryState battery_state = 15;
116  // Estimated battery charge as a percent of its total capacity, in the
117  // range [0.0, 100.0]. Unset if a battery isn't present.
118  optional double battery_percent = 7 [default = -1.0];
119  // Estimated time until the battery is empty, in seconds, or zero if the
120  // battery isn't discharging. -1 if the estimated time would be huge
121  // (e.g. because the current is zero or close to zero). Unset if a battery
122  // isn't present.
123  optional int64 battery_time_to_empty_sec = 5;
124  // Estimated time until the battery is full, in seconds, or zero if the
125  // battery isn't charging. -1 if the estimated time would be huge (e.g.
126  // because the current is zero or close to zero). Contains the best estimate
127  // for when the battery will be full when Adaptive Charging is delaying
128  // charge. If there is no current estimate for when Adaptive Charging will
129  // finish, the value is zero. Unset if a battery isn't present.
130  optional int64 battery_time_to_full_sec = 6;
131  // True when |battery_time_to_*| can't be trusted, e.g. because the power
132  // source just changed. Unset if a battery isn't present.
133  optional bool is_calculating_battery_time = 12 [default = false];
134  // The battery discharge rate measured in W. Positive if the battery is being
135  // discharged, negative if it's being charged, or unset if a battery isn't
136  // present.
137  optional double battery_discharge_rate = 16;
138  // True if it is possible for some connected devices to function as either
139  // sources or sinks (i.e. to either deliver or receive charge).
140  optional bool supports_dual_role_devices = 19;
141  // Current battery voltage level.
142  optional double battery_voltage = 20;
143  // Battery manufacturer reported in sysfs as either "manufacturer" or
144  // "vendor". Ex.: "SIMPLO"
145  optional string battery_vendor = 21;
146  // Battery cycle count representing the total number of times all the
147  // battery's power has been used.
148  optional int64 battery_cycle_count = 22;
149  // Battery serial number reported in sysfs.
150  optional string battery_serial_number = 23;
151  // Battery design capacity measured in ampere-hours (Ah).
152  optional double battery_charge_full_design = 24;
153  // Battery full capacity measured in ampere-hours (Ah).
154  optional double battery_charge_full = 25;
155  // Battery voltage min design measured in V.
156  optional double battery_voltage_min_design = 26;
157  // Current battery charge right now, measured in ampere-hours (Ah).
158  optional double battery_charge = 27;
159  // Battery model name reported by |model_name|.
160  optional string battery_model_name = 28;
161  // Battery current as of now, measured in amperes (A).
162  optional double battery_current = 29;
163  // Battery technology read from sysfs.
164  optional string battery_technology = 30;
165  // Battery status read from sysfs.
166  optional string battery_status = 31;
167  // The device's preferred minimum external power input in watts (W). When
168  // requesting the user use a higher-power external power source, this value
169  // can be displayed.
170  optional double preferred_minimum_external_power = 32;
171  // Indicates if the system supports Adaptive Charging required functionality.
172  optional bool adaptive_charging_supported = 33 [default = false];
173  // Indicates whether charging to full is delayed by adaptive charging. If so,
174  // |battery_time_to_full_sec| indicates the time until the battery is planned
175  // to be fully charged. The planned time to fully charge the battery may
176  // change over time based on predictions from adaptive battery.
177  optional bool adaptive_delaying_charge = 34 [default = false];
178  // Indicates if Adaptive Charging is currently allowed by its heuristic, which
179  // disables Adaptive Charging if the charging behavior of the user won't
180  // benefit from the feature.
181  // Unused unless Adaptive Charging is supported on the system.
182  optional bool adaptive_charging_heuristic_enabled = 35;
183  // Next ID to use: 36
184}
185