Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

docs: power: clean up power_supply_class.rst

Clean up grammar, punctuation, etc., in the power supply class
documentation.

Add article adjectives where needed.
Hyphenate some adjectives.
Fix punctuation.
Fix some verb usage (singular/plural).
Fix run-on sentences.
Add "is" in a few places.
Change "QA" to "Q&A".

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Link: https://patch.msgid.link/20251014182008.823980-1-rdunlap@infradead.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

authored by

Randy Dunlap and committed by
Sebastian Reichel
06b54f2d 446fcf49

+42 -42
+42 -42
Documentation/power/power_supply_class.rst
··· 7 7 Power supply class used to represent battery, UPS, AC or DC power supply 8 8 properties to user-space. 9 9 10 - It defines core set of attributes, which should be applicable to (almost) 10 + It defines a core set of attributes which should be applicable to (almost) 11 11 every power supply out there. Attributes are available via sysfs and uevent 12 12 interfaces. 13 13 14 - Each attribute has well defined meaning, up to unit of measure used. While 14 + Each attribute has a well-defined meaning, up to the unit of measure used. While 15 15 the attributes provided are believed to be universally applicable to any 16 16 power supply, specific monitoring hardware may not be able to provide them 17 17 all, so any of them may be skipped. 18 18 19 - Power supply class is extensible, and allows to define drivers own attributes. 20 - The core attribute set is subject to the standard Linux evolution (i.e. 21 - if it will be found that some attribute is applicable to many power supply 22 - types or their drivers, it can be added to the core set). 19 + The power supply class is extensible and allows drivers to define their own 20 + attributes. The core attribute set is subject to the standard Linux evolution 21 + (i.e., if some attribute is found to be applicable to many power 22 + supply types or their drivers, it can be added to the core set). 23 23 24 - It also integrates with LED framework, for the purpose of providing 24 + It also integrates with the LED framework, for the purpose of providing 25 25 typically expected feedback of battery charging/fully charged status and 26 26 AC/USB power supply online status. (Note that specific details of the 27 27 indication (including whether to use it at all) are fully controllable by 28 - user and/or specific machine defaults, per design principles of LED 29 - framework). 28 + user and/or specific machine defaults, per design principles of the LED 29 + framework.) 30 30 31 31 32 32 Attributes/properties 33 33 ~~~~~~~~~~~~~~~~~~~~~ 34 - Power supply class has predefined set of attributes, this eliminates code 35 - duplication across drivers. Power supply class insist on reusing its 34 + The power supply class has a predefined set of attributes. This eliminates code 35 + duplication across drivers. The power supply class insists on reusing its 36 36 predefined attributes *and* their units. 37 37 38 - So, userspace gets predictable set of attributes and their units for any 38 + So, userspace gets a predictable set of attributes and their units for any 39 39 kind of power supply, and can process/present them to a user in consistent 40 40 manner. Results for different power supplies and machines are also directly 41 41 comparable. ··· 61 61 | **Charge/Energy/Capacity - how to not confuse** | 62 62 +--------------------------------------------------------------------------+ 63 63 | **Because both "charge" (µAh) and "energy" (µWh) represents "capacity" | 64 - | of battery, this class distinguish these terms. Don't mix them!** | 64 + | of battery, this class distinguishes these terms. Don't mix them!** | 65 65 | | 66 66 | - `CHARGE_*` | 67 67 | attributes represents capacity in µAh only. | ··· 81 81 82 82 STATUS 83 83 this attribute represents operating status (charging, full, 84 - discharging (i.e. powering a load), etc.). This corresponds to 84 + discharging (i.e., powering a load), etc.). This corresponds to 85 85 `BATTERY_STATUS_*` values, as defined in battery.h. 86 86 87 87 CHARGE_TYPE ··· 92 92 93 93 AUTHENTIC 94 94 indicates the power supply (battery or charger) connected 95 - to the platform is authentic(1) or non authentic(0). 95 + to the platform is authentic(1) or non-authentic(0). 96 96 97 97 HEALTH 98 - represents health of the battery, values corresponds to 98 + represents health of the battery. Values corresponds to 99 99 POWER_SUPPLY_HEALTH_*, defined in battery.h. 100 100 101 101 VOLTAGE_OCV ··· 103 103 104 104 VOLTAGE_MAX_DESIGN, VOLTAGE_MIN_DESIGN 105 105 design values for maximal and minimal power supply voltages. 106 - Maximal/minimal means values of voltages when battery considered 106 + Maximal/minimal means values of voltages when battery is considered 107 107 "full"/"empty" at normal conditions. Yes, there is no direct relation 108 108 between voltage and battery capacity, but some dumb 109 109 batteries use voltage for very approximated calculation of capacity. 110 - Battery driver also can use this attribute just to inform userspace 110 + A battery driver also can use this attribute just to inform userspace 111 111 about maximal and minimal voltage thresholds of a given battery. 112 112 113 113 VOLTAGE_MAX, VOLTAGE_MIN ··· 122 122 Reports the current measured during boot 123 123 124 124 CHARGE_FULL_DESIGN, CHARGE_EMPTY_DESIGN 125 - design charge values, when battery considered full/empty. 125 + design charge values, when battery is considered full/empty. 126 126 127 127 ENERGY_FULL_DESIGN, ENERGY_EMPTY_DESIGN 128 128 same as above but for energy. 129 129 130 130 CHARGE_FULL, CHARGE_EMPTY 131 - These attributes means "last remembered value of charge when battery 132 - became full/empty". It also could mean "value of charge when battery 131 + These attributes mean "last remembered value of charge when battery 132 + became full/empty". They also could mean "value of charge when battery is 133 133 considered full/empty at given conditions (temperature, age)". 134 - I.e. these attributes represents real thresholds, not design values. 134 + I.e., these attributes represents real thresholds, not design values. 135 135 136 136 ENERGY_FULL, ENERGY_EMPTY 137 137 same as above but for energy. ··· 153 153 CONSTANT_CHARGE_CURRENT 154 154 constant charge current programmed by charger. 155 155 156 - 157 156 CONSTANT_CHARGE_CURRENT_MAX 158 157 maximum charge current supported by the power supply object. 159 158 160 159 CONSTANT_CHARGE_VOLTAGE 161 160 constant charge voltage programmed by charger. 161 + 162 162 CONSTANT_CHARGE_VOLTAGE_MAX 163 163 maximum charge voltage supported by the power supply object. 164 164 ··· 208 208 209 209 TIME_TO_EMPTY 210 210 seconds left for battery to be considered empty 211 - (i.e. while battery powers a load) 211 + (i.e., while battery powers a load) 212 212 TIME_TO_FULL 213 213 seconds left for battery to be considered full 214 - (i.e. while battery is charging) 214 + (i.e., while battery is charging) 215 215 216 216 217 217 Battery <-> external power supply interaction ··· 220 220 time. Batteries are good example. So, batteries usually care if they're 221 221 externally powered or not. 222 222 223 - For that case, power supply class implements notification mechanism for 223 + For that case, the power supply class implements a notification mechanism for 224 224 batteries. 225 225 226 - External power supply (AC) lists supplicants (batteries) names in 226 + An external power supply (AC) lists supplicants (batteries) names in 227 227 "supplied_to" struct member, and each power_supply_changed() call 228 - issued by external power supply will notify supplicants via 229 - external_power_changed callback. 228 + issued by an external power supply will notify supplicants via 229 + the external_power_changed callback. 230 230 231 231 232 232 Devicetree battery characteristics ··· 241 241 for naming consistency between sysfs attributes and battery node properties. 242 242 243 243 244 - QA 245 - ~~ 244 + Q&A 245 + ~~~ 246 246 247 247 Q: 248 248 Where is POWER_SUPPLY_PROP_XYZ attribute? 249 249 A: 250 - If you cannot find attribute suitable for your driver needs, feel free 251 - to add it and send patch along with your driver. 250 + If you cannot find an attribute suitable for your driver needs, feel free 251 + to add it and send a patch along with your driver. 252 252 253 253 The attributes available currently are the ones currently provided by the 254 254 drivers written. ··· 258 258 259 259 260 260 Q: 261 - I have some very specific attribute (e.g. battery color), should I add 261 + I have some very specific attribute (e.g., battery color). Should I add 262 262 this attribute to standard ones? 263 263 A: 264 264 Most likely, no. Such attribute can be placed in the driver itself, if 265 - it is useful. Of course, if the attribute in question applicable to 266 - large set of batteries, provided by many drivers, and/or comes from 265 + it is useful. Of course, if the attribute in question is applicable to 266 + a large set of batteries, provided by many drivers, and/or comes from 267 267 some general battery specification/standard, it may be a candidate to 268 268 be added to the core attribute set. 269 269 270 270 271 271 Q: 272 - Suppose, my battery monitoring chip/firmware does not provides capacity 272 + Suppose my battery monitoring chip/firmware does not provide capacity 273 273 in percents, but provides charge_{now,full,empty}. Should I calculate 274 274 percentage capacity manually, inside the driver, and register CAPACITY 275 275 attribute? The same question about time_to_empty/time_to_full. ··· 278 278 directly measurable by the specific hardware available. 279 279 280 280 Inferring not available properties using some heuristics or mathematical 281 - model is not subject of work for a battery driver. Such functionality 281 + model is not a subject of work for a battery driver. Such functionality 282 282 should be factored out, and in fact, apm_power, the driver to serve 283 - legacy APM API on top of power supply class, uses a simple heuristic of 283 + legacy APM API on top of the power supply class, uses a simple heuristic of 284 284 approximating remaining battery capacity based on its charge, current, 285 - voltage and so on. But full-fledged battery model is likely not subject 286 - for kernel at all, as it would require floating point calculation to deal 287 - with things like differential equations and Kalman filters. This is 285 + voltage and so on. But a full-fledged battery model is likely not a subject 286 + for the kernel at all, as it would require floating point calculations to 287 + deal with things like differential equations and Kalman filters. This is 288 288 better be handled by batteryd/libbattery, yet to be written.