Re: [PATCH 3/8] Universal power supply class (was: battery class)

From: Shem Multinymous
Date: Fri May 04 2007 - 00:55:38 EST


On 5/3/07, Anton Vorontsov <cbou@xxxxxxx> wrote:
This class is result of "external power" and "battery" classes merge,
as suggested by David Woodhouse. He also implemented uevent support.

Looks great. In particular, the policies you've chosen for the
attributes and units are very reasonable.

I'll gladly accept patches moving tp_smapi to this interface (or
eventually do it myself when I have time).


A few minor points:

+#define POWER_SUPPLY_TECHNOLOGY_UNKNOWN 0
+#define POWER_SUPPLY_TECHNOLOGY_NIMH 1
+#define POWER_SUPPLY_TECHNOLOGY_LION 2
+#define POWER_SUPPLY_TECHNOLOGY_LIPO 3

Might as well add NiCd (common in UPS).


+#define POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN 0
+#define POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL 1
+#define POWER_SUPPLY_CAPACITY_LEVEL_LOW 2
+#define POWER_SUPPLY_CAPACITY_LEVEL_NORMAL 3
+#define POWER_SUPPLY_CAPACITY_LEVEL_HIGH 4
+#define POWER_SUPPLY_CAPACITY_LEVEL_FULL 5

Should this be synthesized by the driver if the hardware gives only
quantitative values? If so, maybe provide some guidelines.


+enum power_supply_type {
+ POWER_SUPPLY_TYPE_BATTERY = 0,
+ POWER_SUPPLY_TYPE_UPS,
+ POWER_SUPPLY_TYPE_AC,
+ POWER_SUPPLY_TYPE_USB,
+};

How about dumb (non-USB) DC power? Any reason to distinguish it from AC?

Shem
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/