]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
power_supply: Add new power supply properties CHARGE_CURRENT/VOLTAGE_MAX
authorRamakrishna Pallala <ramakrishna.pallala@intel.com>
Mon, 30 Jul 2012 07:19:21 +0000 (12:49 +0530)
committerAnton Vorontsov <anton.vorontsov@linaro.org>
Thu, 23 Aug 2012 04:59:15 +0000 (21:59 -0700)
There are different types of chargers avalibale like AC, Solar, USB,
etc..  Even in USB we have different types SDP/DCP/CDP/ACA and all these
chargers have different o/p ratings. For example SDP supports only 500mA
of charge current whereas AC charger can support upto 8A or more.

Similarly batteries also come with charge current and voltage ratings
and these ratings vary depending on its capacity and the technology
used.

This patch adds two new power supply properties
CONSTANT_CHARGE_CURRENT_MAX and CONSTANT_CHARGE_CURRENT_MAX.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Documentation/power/power_supply_class.txt
drivers/power/power_supply_sysfs.c
include/linux/power_supply.h

index 48badec1cec34a7437abf7ac6b1315799cca805d..9c647bd7c5a9cf108746647b8f97ec4b70afe1ab 100644 (file)
@@ -116,8 +116,12 @@ be negative; there is no empty or full value.  It is only useful for
 relative, time-based measurements.
 
 CONSTANT_CHARGE_CURRENT - constant charge current programmed by charger.
+CONSTANT_CHARGE_CURRENT_MAX - maximum charge current supported by the
+power supply object.
 
 CONSTANT_CHARGE_VOLTAGE - constant charge voltage programmed by charger.
+CONSTANT_CHARGE_VOLTAGE_MAX - maximum charge voltage supported by the
+power supply object.
 
 ENERGY_FULL, ENERGY_EMPTY - same as above but for energy.
 
index be34a6d4664d27d98b10980096cb49af89901497..395c2cfa16c0bbd3bb200b31f5d2de343e2cd7e3 100644 (file)
@@ -161,7 +161,9 @@ static struct device_attribute power_supply_attrs[] = {
        POWER_SUPPLY_ATTR(charge_avg),
        POWER_SUPPLY_ATTR(charge_counter),
        POWER_SUPPLY_ATTR(constant_charge_current),
+       POWER_SUPPLY_ATTR(constant_charge_current_max),
        POWER_SUPPLY_ATTR(constant_charge_voltage),
+       POWER_SUPPLY_ATTR(constant_charge_voltage_max),
        POWER_SUPPLY_ATTR(energy_full_design),
        POWER_SUPPLY_ATTR(energy_empty_design),
        POWER_SUPPLY_ATTR(energy_full),
index 204d43dc6ddc48646bd77583effd58497119c0f9..e5ef45834c3c415e05af46d66b0d38599c12ec85 100644 (file)
@@ -111,7 +111,9 @@ enum power_supply_property {
        POWER_SUPPLY_PROP_CHARGE_AVG,
        POWER_SUPPLY_PROP_CHARGE_COUNTER,
        POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT,
+       POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
        POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
+       POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
        POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
        POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN,
        POWER_SUPPLY_PROP_ENERGY_FULL,
@@ -249,6 +251,7 @@ static inline bool power_supply_is_amp_property(enum power_supply_property psp)
        case POWER_SUPPLY_PROP_CHARGE_AVG:
        case POWER_SUPPLY_PROP_CHARGE_COUNTER:
        case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
+       case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
        case POWER_SUPPLY_PROP_CURRENT_MAX:
        case POWER_SUPPLY_PROP_CURRENT_NOW:
        case POWER_SUPPLY_PROP_CURRENT_AVG:
@@ -277,6 +280,7 @@ static inline bool power_supply_is_watt_property(enum power_supply_property psp)
        case POWER_SUPPLY_PROP_VOLTAGE_AVG:
        case POWER_SUPPLY_PROP_VOLTAGE_OCV:
        case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
+       case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
        case POWER_SUPPLY_PROP_POWER_NOW:
                return 1;
        default: