Home | History | Annotate | Download | only in hw
      1 /*
      2  *  Universal power supply monitor class
      3  *
      4  *  Copyright  2007  Anton Vorontsov <cbou (at) mail.ru>
      5  *  Copyright  2004  Szabolcs Gyurko
      6  *  Copyright  2003  Ian Molton <spyro (at) f2s.com>
      7  *
      8  *  Modified: 2004, Oct     Szabolcs Gyurko
      9  *
     10  *  You may use this code as per GPL version 2
     11  */
     12 
     13 #ifndef __LINUX_POWER_SUPPLY_H__
     14 #define __LINUX_POWER_SUPPLY_H__
     15 
     16 /*
     17  * All voltages, currents, charges, energies, time and temperatures in uV,
     18  * A, Ah, Wh, seconds and tenths of degree Celsius unless otherwise
     19  * stated. It's driver's job to convert its raw values to units in which
     20  * this class operates.
     21  */
     22 
     23 /*
     24  * For systems where the charger determines the maximum battery capacity
     25  * the min and max fields should be used to present these values to user
     26  * space. Unused/unknown fields will not appear in sysfs.
     27  */
     28 
     29 enum {
     30 	POWER_SUPPLY_STATUS_UNKNOWN = 0,
     31 	POWER_SUPPLY_STATUS_CHARGING,
     32 	POWER_SUPPLY_STATUS_DISCHARGING,
     33 	POWER_SUPPLY_STATUS_NOT_CHARGING,
     34 	POWER_SUPPLY_STATUS_FULL,
     35 };
     36 
     37 enum {
     38 	POWER_SUPPLY_HEALTH_UNKNOWN = 0,
     39 	POWER_SUPPLY_HEALTH_GOOD,
     40 	POWER_SUPPLY_HEALTH_OVERHEAT,
     41 	POWER_SUPPLY_HEALTH_DEAD,
     42 	POWER_SUPPLY_HEALTH_OVERVOLTAGE,
     43 	POWER_SUPPLY_HEALTH_UNSPEC_FAILURE,
     44 };
     45 
     46 enum {
     47 	POWER_SUPPLY_TECHNOLOGY_UNKNOWN = 0,
     48 	POWER_SUPPLY_TECHNOLOGY_NiMH,
     49 	POWER_SUPPLY_TECHNOLOGY_LION,
     50 	POWER_SUPPLY_TECHNOLOGY_LIPO,
     51 	POWER_SUPPLY_TECHNOLOGY_LiFe,
     52 	POWER_SUPPLY_TECHNOLOGY_NiCd,
     53 };
     54 
     55 enum {
     56 	POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN = 0,
     57 	POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL,
     58 	POWER_SUPPLY_CAPACITY_LEVEL_LOW,
     59 	POWER_SUPPLY_CAPACITY_LEVEL_NORMAL,
     60 	POWER_SUPPLY_CAPACITY_LEVEL_HIGH,
     61 	POWER_SUPPLY_CAPACITY_LEVEL_FULL,
     62 };
     63 
     64 enum power_supply_property {
     65 	/* Properties of type `int' */
     66 	POWER_SUPPLY_PROP_STATUS = 0,
     67 	POWER_SUPPLY_PROP_HEALTH,
     68 	POWER_SUPPLY_PROP_PRESENT,
     69 	POWER_SUPPLY_PROP_ONLINE,
     70 	POWER_SUPPLY_PROP_TECHNOLOGY,
     71 	POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
     72 	POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
     73 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
     74 	POWER_SUPPLY_PROP_VOLTAGE_AVG,
     75 	POWER_SUPPLY_PROP_CURRENT_NOW,
     76 	POWER_SUPPLY_PROP_CURRENT_AVG,
     77 	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
     78 	POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN,
     79 	POWER_SUPPLY_PROP_CHARGE_FULL,
     80 	POWER_SUPPLY_PROP_CHARGE_EMPTY,
     81 	POWER_SUPPLY_PROP_CHARGE_NOW,
     82 	POWER_SUPPLY_PROP_CHARGE_AVG,
     83 	POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
     84 	POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN,
     85 	POWER_SUPPLY_PROP_ENERGY_FULL,
     86 	POWER_SUPPLY_PROP_ENERGY_EMPTY,
     87 	POWER_SUPPLY_PROP_ENERGY_NOW,
     88 	POWER_SUPPLY_PROP_ENERGY_AVG,
     89 	POWER_SUPPLY_PROP_CAPACITY, /* in percents! */
     90 	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
     91 	POWER_SUPPLY_PROP_TEMP,
     92 	POWER_SUPPLY_PROP_TEMP_AMBIENT,
     93 	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
     94 	POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG,
     95 	POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
     96 	POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
     97 	/* Properties of type `const char *' */
     98 	POWER_SUPPLY_PROP_MODEL_NAME,
     99 	POWER_SUPPLY_PROP_MANUFACTURER,
    100 };
    101 
    102 enum power_supply_type {
    103 	POWER_SUPPLY_TYPE_BATTERY = 0,
    104 	POWER_SUPPLY_TYPE_UPS,
    105 	POWER_SUPPLY_TYPE_MAINS,
    106 	POWER_SUPPLY_TYPE_USB,
    107 };
    108 
    109 #endif /* __LINUX_POWER_SUPPLY_H__ */
    110