diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-31 21:08:25 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-31 21:08:25 -0400 |
| commit | 4b24ff71108164e047cf2c95990b77651163e315 (patch) | |
| tree | 4b478906379adf22ff259fc1f2cce0da796df415 | |
| parent | bca1a5c0eabe0f17081760c61e8d08e73dd6b6a6 (diff) | |
| parent | 4b1bf5871f7d59de6484cc887e205d6d2f1e6fbd (diff) | |
Merge tag 'for-v3.6' of git://git.infradead.org/battery-2.6
Pull battery updates from Anton Vorontsov:
"The tag contains just a few battery-related changes for v3.6. It's is
all pretty straightforward, except one thing.
One of our patches added thermal support for power supply class, but
thermal/ subsystem changed under our feet. We (well, Stephen, that
is) caught the issue and it was decided[1] that I'd just delay the
battery pull request, and then will fix it up by merging upstream back
into battery tree at the specific commit.
That's not all though: another[2] small fixup for thermal subsystem
was needed to get rid of a warning in power supply subsystem (the
warning was not drivers/power's "fault", the thermal registration
function just needed a proper const annotation, which is also done by
a small commit on top of the merge.
So, to sum this up:
- The 'master' branch of the battery tree was in the -next tree for
weeks, was never rebased, altered etc. It should be all OK;
- Although, for-v3.6 tag contains the 'master' branch + merge + the
warning fix.
[1] http://lkml.org/lkml/2012/6/19/23
[2] http://lkml.org/lkml/2012/6/18/28"
* tag 'for-v3.6' of git://git.infradead.org/battery-2.6: (23 commits)
thermal: Constify 'type' argument for the registration routine
olpc-battery: update CHARGE_FULL_DESIGN property for BYD LiFe batteries
olpc-battery: Add VOLTAGE_MAX_DESIGN property
charger-manager: Fix build break related to EXTCON
lp8727_charger: Move header file into platform_data directory
power_supply: Add min/max alert properties for CAPACITY, TEMP, TEMP_AMBIENT
bq27x00_battery: Add support for BQ27425 chip
charger-manager: Set current limit of regulator for over current protection
charger-manager: Use EXTCON Subsystem to detect charger cables for charging
test_power: Add VOLTAGE_NOW and BATTERY_TEMP properties
test_power: Add support for USB AC source
gpio-charger: Use cansleep version of gpio_set_value
bq27x00_battery: Add support for power average and health properties
sbs-battery: Don't trigger false supply_changed event
twl4030_charger: Allow charger to control the regulator that feeds it
twl4030_charger: Add backup-battery charging
twl4030_charger: Fix some typos
max17042_battery: Support CHARGE_COUNTER power supply attribute
smb347-charger: Add constant charge and current properties
power_supply: Add constant charge_current and charge_voltage properties
...
23 files changed, 789 insertions, 57 deletions
diff --git a/Documentation/power/power_supply_class.txt b/Documentation/power/power_supply_class.txt index 211831d4095f..2f0ddc15b5ac 100644 --- a/Documentation/power/power_supply_class.txt +++ b/Documentation/power/power_supply_class.txt | |||
| @@ -112,14 +112,24 @@ CHARGE_COUNTER - the current charge counter (in µAh). This could easily | |||
| 112 | be negative; there is no empty or full value. It is only useful for | 112 | be negative; there is no empty or full value. It is only useful for |
| 113 | relative, time-based measurements. | 113 | relative, time-based measurements. |
| 114 | 114 | ||
| 115 | CONSTANT_CHARGE_CURRENT - constant charge current programmed by charger. | ||
| 116 | |||
| 117 | CONSTANT_CHARGE_VOLTAGE - constant charge voltage programmed by charger. | ||
| 118 | |||
| 115 | ENERGY_FULL, ENERGY_EMPTY - same as above but for energy. | 119 | ENERGY_FULL, ENERGY_EMPTY - same as above but for energy. |
| 116 | 120 | ||
| 117 | CAPACITY - capacity in percents. | 121 | CAPACITY - capacity in percents. |
| 122 | CAPACITY_ALERT_MIN - minimum capacity alert value in percents. | ||
| 123 | CAPACITY_ALERT_MAX - maximum capacity alert value in percents. | ||
| 118 | CAPACITY_LEVEL - capacity level. This corresponds to | 124 | CAPACITY_LEVEL - capacity level. This corresponds to |
| 119 | POWER_SUPPLY_CAPACITY_LEVEL_*. | 125 | POWER_SUPPLY_CAPACITY_LEVEL_*. |
| 120 | 126 | ||
| 121 | TEMP - temperature of the power supply. | 127 | TEMP - temperature of the power supply. |
| 128 | TEMP_ALERT_MIN - minimum battery temperature alert value in milli centigrade. | ||
| 129 | TEMP_ALERT_MAX - maximum battery temperature alert value in milli centigrade. | ||
| 122 | TEMP_AMBIENT - ambient temperature. | 130 | TEMP_AMBIENT - ambient temperature. |
| 131 | TEMP_AMBIENT_ALERT_MIN - minimum ambient temperature alert value in milli centigrade. | ||
| 132 | TEMP_AMBIENT_ALERT_MAX - maximum ambient temperature alert value in milli centigrade. | ||
| 123 | 133 | ||
| 124 | TIME_TO_EMPTY - seconds left for battery to be considered empty (i.e. | 134 | TIME_TO_EMPTY - seconds left for battery to be considered empty (i.e. |
| 125 | while battery powers a load) | 135 | while battery powers a load) |
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index b012efd29e01..1c32afed28aa 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c | |||
| @@ -717,8 +717,9 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base, | |||
| 717 | static struct regulator_consumer_supply usb1v8 = { | 717 | static struct regulator_consumer_supply usb1v8 = { |
| 718 | .supply = "usb1v8", | 718 | .supply = "usb1v8", |
| 719 | }; | 719 | }; |
| 720 | static struct regulator_consumer_supply usb3v1 = { | 720 | static struct regulator_consumer_supply usb3v1[] = { |
| 721 | .supply = "usb3v1", | 721 | { .supply = "usb3v1" }, |
| 722 | { .supply = "bci3v1" }, | ||
| 722 | }; | 723 | }; |
| 723 | 724 | ||
| 724 | /* First add the regulators so that they can be used by transceiver */ | 725 | /* First add the regulators so that they can be used by transceiver */ |
| @@ -746,7 +747,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base, | |||
| 746 | return PTR_ERR(child); | 747 | return PTR_ERR(child); |
| 747 | 748 | ||
| 748 | child = add_regulator_linked(TWL4030_REG_VUSB3V1, | 749 | child = add_regulator_linked(TWL4030_REG_VUSB3V1, |
| 749 | &usb_fixed, &usb3v1, 1, | 750 | &usb_fixed, usb3v1, 2, |
| 750 | features); | 751 | features); |
| 751 | if (IS_ERR(child)) | 752 | if (IS_ERR(child)) |
| 752 | return PTR_ERR(child); | 753 | return PTR_ERR(child); |
| @@ -767,7 +768,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base, | |||
| 767 | if (twl_has_regulator() && child) { | 768 | if (twl_has_regulator() && child) { |
| 768 | usb1v5.dev_name = dev_name(child); | 769 | usb1v5.dev_name = dev_name(child); |
| 769 | usb1v8.dev_name = dev_name(child); | 770 | usb1v8.dev_name = dev_name(child); |
| 770 | usb3v1.dev_name = dev_name(child); | 771 | usb3v1[0].dev_name = dev_name(child); |
| 771 | } | 772 | } |
| 772 | } | 773 | } |
| 773 | if (twl_has_usb() && pdata->usb && twl_class_is_6030()) { | 774 | if (twl_has_usb() && pdata->usb && twl_class_is_6030()) { |
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig index aa764ecc4e60..c1892f321c46 100644 --- a/drivers/power/Kconfig +++ b/drivers/power/Kconfig | |||
| @@ -268,6 +268,7 @@ config CHARGER_GPIO | |||
| 268 | config CHARGER_MANAGER | 268 | config CHARGER_MANAGER |
| 269 | bool "Battery charger manager for multiple chargers" | 269 | bool "Battery charger manager for multiple chargers" |
| 270 | depends on REGULATOR && RTC_CLASS | 270 | depends on REGULATOR && RTC_CLASS |
| 271 | select EXTCON | ||
| 271 | help | 272 | help |
| 272 | Say Y to enable charger-manager support, which allows multiple | 273 | Say Y to enable charger-manager support, which allows multiple |
| 273 | chargers attached to a battery and multiple batteries attached to a | 274 | chargers attached to a battery and multiple batteries attached to a |
diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c index f5d6d379f2fb..181ddece5181 100644 --- a/drivers/power/bq27x00_battery.c +++ b/drivers/power/bq27x00_battery.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | * Datasheets: | 22 | * Datasheets: |
| 23 | * http://focus.ti.com/docs/prod/folders/print/bq27000.html | 23 | * http://focus.ti.com/docs/prod/folders/print/bq27000.html |
| 24 | * http://focus.ti.com/docs/prod/folders/print/bq27500.html | 24 | * http://focus.ti.com/docs/prod/folders/print/bq27500.html |
| 25 | * http://www.ti.com/product/bq27425-g1 | ||
| 25 | */ | 26 | */ |
| 26 | 27 | ||
| 27 | #include <linux/module.h> | 28 | #include <linux/module.h> |
| @@ -51,6 +52,7 @@ | |||
| 51 | #define BQ27x00_REG_LMD 0x12 /* Last measured discharge */ | 52 | #define BQ27x00_REG_LMD 0x12 /* Last measured discharge */ |
| 52 | #define BQ27x00_REG_CYCT 0x2A /* Cycle count total */ | 53 | #define BQ27x00_REG_CYCT 0x2A /* Cycle count total */ |
| 53 | #define BQ27x00_REG_AE 0x22 /* Available energy */ | 54 | #define BQ27x00_REG_AE 0x22 /* Available energy */ |
| 55 | #define BQ27x00_POWER_AVG 0x24 | ||
| 54 | 56 | ||
| 55 | #define BQ27000_REG_RSOC 0x0B /* Relative State-of-Charge */ | 57 | #define BQ27000_REG_RSOC 0x0B /* Relative State-of-Charge */ |
| 56 | #define BQ27000_REG_ILMD 0x76 /* Initial last measured discharge */ | 58 | #define BQ27000_REG_ILMD 0x76 /* Initial last measured discharge */ |
| @@ -66,15 +68,21 @@ | |||
| 66 | #define BQ27500_FLAG_SOCF BIT(1) /* State-of-Charge threshold final */ | 68 | #define BQ27500_FLAG_SOCF BIT(1) /* State-of-Charge threshold final */ |
| 67 | #define BQ27500_FLAG_SOC1 BIT(2) /* State-of-Charge threshold 1 */ | 69 | #define BQ27500_FLAG_SOC1 BIT(2) /* State-of-Charge threshold 1 */ |
| 68 | #define BQ27500_FLAG_FC BIT(9) | 70 | #define BQ27500_FLAG_FC BIT(9) |
| 71 | #define BQ27500_FLAG_OTC BIT(15) | ||
| 72 | |||
| 73 | /* bq27425 register addresses are same as bq27x00 addresses minus 4 */ | ||
| 74 | #define BQ27425_REG_OFFSET 0x04 | ||
| 75 | #define BQ27425_REG_SOC 0x18 /* Register address plus offset */ | ||
| 69 | 76 | ||
| 70 | #define BQ27000_RS 20 /* Resistor sense */ | 77 | #define BQ27000_RS 20 /* Resistor sense */ |
| 78 | #define BQ27x00_POWER_CONSTANT (256 * 29200 / 1000) | ||
| 71 | 79 | ||
| 72 | struct bq27x00_device_info; | 80 | struct bq27x00_device_info; |
| 73 | struct bq27x00_access_methods { | 81 | struct bq27x00_access_methods { |
| 74 | int (*read)(struct bq27x00_device_info *di, u8 reg, bool single); | 82 | int (*read)(struct bq27x00_device_info *di, u8 reg, bool single); |
| 75 | }; | 83 | }; |
| 76 | 84 | ||
| 77 | enum bq27x00_chip { BQ27000, BQ27500 }; | 85 | enum bq27x00_chip { BQ27000, BQ27500, BQ27425}; |
| 78 | 86 | ||
| 79 | struct bq27x00_reg_cache { | 87 | struct bq27x00_reg_cache { |
| 80 | int temperature; | 88 | int temperature; |
| @@ -86,6 +94,8 @@ struct bq27x00_reg_cache { | |||
| 86 | int capacity; | 94 | int capacity; |
| 87 | int energy; | 95 | int energy; |
