Skip to content

Commit

Permalink
Merge tag 'for-v3.17' of git://git.infradead.org/battery-2.6
Browse files Browse the repository at this point in the history
Pull power supply changes from Sebastian Reichel:
 - Added iPaq h3xxx battery driver
 - Added Broadcom STB reset driver
 - DT support for rx51-battery
 - misc. fixes

* tag 'for-v3.17' of git://git.infradead.org/battery-2.6:
  ipaq_micro_battery: fix sparse non static symbol warning
  power: add driver for battery reading on iPaq h3xxx
  power: twl4030_charger: detect battery presence prior to enabling charger
  power: reset: Add reboot driver for brcmstb
  power_supply: Fix sparse non static symbol warning
  power_supply: Add inlmt,iterm, min/max temp props
  charger: tps65090: Allow charger module to be used when no irq
  power/reset: Fix GPL v2 license string typo
  power: poweroff: gpio: convert to use descriptors
  bq27000: report missing device better.
  bq27x00_battery: Introduce the use of the managed version of kzalloc
  Documentation: DT: Document rx51-battery binding
  rx51_battery: convert to iio consumer
  bq2415x_charger: Fix Atomic Sleep Bug
  • Loading branch information
Linus Torvalds committed Aug 7, 2014
2 parents 85417ae + 5e37195 commit 0498cf8
Show file tree
Hide file tree
Showing 18 changed files with 673 additions and 99 deletions.
25 changes: 25 additions & 0 deletions Documentation/devicetree/bindings/power/rx51-battery.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Binding for Nokia N900 battery

The Nokia N900 battery status can be read via the TWL4030's A/D converter.

Required properties:
- compatible: Should contain one of the following:
* "nokia,n900-battery"
- io-channels: Should contain IIO channel specifiers
for each element in io-channel-names.
- io-channel-names: Should contain the following values:
* "temp" - The ADC channel for temperature reading
* "bsi" - The ADC channel for battery size identification
* "vbat" - The ADC channel to measure the battery voltage

Example from Nokia N900:

battery: n900-battery {
compatible = "nokia,n900-battery";
io-channels = <&twl4030_madc 0>,
<&twl4030_madc 4>,
<&twl4030_madc 12>;
io-channel-names = "temp",
"bsi",
"vbat";
};
6 changes: 6 additions & 0 deletions Documentation/power/power_supply_class.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ 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.
INPUT_CURRENT_LIMIT - input current limit programmed by charger. Indicates
the current drawn from a charging source.
CHARGE_TERM_CURRENT - Charge termination current used to detect the end of charge
condition.

CONSTANT_CHARGE_VOLTAGE - constant charge voltage programmed by charger.
CONSTANT_CHARGE_VOLTAGE_MAX - maximum charge voltage supported by the
Expand All @@ -140,6 +144,8 @@ TEMP_ALERT_MAX - maximum battery temperature alert.
TEMP_AMBIENT - ambient temperature.
TEMP_AMBIENT_ALERT_MIN - minimum ambient temperature alert.
TEMP_AMBIENT_ALERT_MAX - maximum ambient temperature alert.
TEMP_MIN - minimum operatable temperature
TEMP_MAX - maximum operatable temperature

TIME_TO_EMPTY - seconds left for battery to be considered empty (i.e.
while battery powers a load)
Expand Down
7 changes: 7 additions & 0 deletions drivers/power/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ config BATTERY_COLLIE
Say Y to enable support for the battery on the Sharp Zaurus
SL-5500 (collie) models.

config BATTERY_IPAQ_MICRO
tristate "iPAQ Atmel Micro ASIC battery driver"
depends on MFD_IPAQ_MICRO
help
Choose this option if you want to monitor battery status on
Compaq/HP iPAQ h3100 and h3600.

config BATTERY_WM97XX
bool "WM97xx generic battery driver"
depends on TOUCHSCREEN_WM97XX=y
Expand Down
1 change: 1 addition & 0 deletions drivers/power/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o
obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o
obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o
obj-$(CONFIG_BATTERY_COLLIE) += collie_battery.o
obj-$(CONFIG_BATTERY_IPAQ_MICRO) += ipaq_micro_battery.o
obj-$(CONFIG_BATTERY_WM97XX) += wm97xx_battery.o
obj-$(CONFIG_BATTERY_SBS) += sbs-battery.o
obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o
Expand Down
8 changes: 6 additions & 2 deletions drivers/power/bq2415x_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,8 +840,7 @@ static int bq2415x_notifier_call(struct notifier_block *nb,
if (bq->automode < 1)
return NOTIFY_OK;

sysfs_notify(&bq->charger.dev->kobj, NULL, "reported_mode");
bq2415x_set_mode(bq, bq->reported_mode);
schedule_delayed_work(&bq->work, 0);

return NOTIFY_OK;
}
Expand Down Expand Up @@ -892,6 +891,11 @@ static void bq2415x_timer_work(struct work_struct *work)
int error;
int boost;

if (bq->automode > 0 && (bq->reported_mode != bq->mode)) {
sysfs_notify(&bq->charger.dev->kobj, NULL, "reported_mode");
bq2415x_set_mode(bq, bq->reported_mode);
}

if (!bq->autotimer)
return;

Expand Down
28 changes: 8 additions & 20 deletions drivers/power/bq27x00_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* http://www.ti.com/product/bq27425-g1
*/

#include <linux/device.h>
#include <linux/module.h>
#include <linux/param.h>
#include <linux/jiffies.h>
Expand Down Expand Up @@ -415,6 +416,9 @@ static void bq27x00_update(struct bq27x00_device_info *di)
bool is_bq27425 = di->chip == BQ27425;

cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, !is_bq27500);
if ((cache.flags & 0xff) == 0xff)
/* read error */
cache.flags = -1;
if (cache.flags >= 0) {
if (!is_bq27500 && !is_bq27425
&& (cache.flags & BQ27000_FLAG_CI)) {
Expand Down Expand Up @@ -804,7 +808,7 @@ static int bq27x00_battery_probe(struct i2c_client *client,
goto batt_failed_1;
}

di = kzalloc(sizeof(*di), GFP_KERNEL);
di = devm_kzalloc(&client->dev, sizeof(*di), GFP_KERNEL);
if (!di) {
dev_err(&client->dev, "failed to allocate device info data\n");
retval = -ENOMEM;
Expand All @@ -819,14 +823,12 @@ static int bq27x00_battery_probe(struct i2c_client *client,

retval = bq27x00_powersupply_init(di);
if (retval)
goto batt_failed_3;
goto batt_failed_2;

i2c_set_clientdata(client, di);

return 0;

batt_failed_3:
kfree(di);
batt_failed_2:
kfree(name);
batt_failed_1:
Expand All @@ -849,8 +851,6 @@ static int bq27x00_battery_remove(struct i2c_client *client)
idr_remove(&battery_id, di->id);
mutex_unlock(&battery_mutex);

kfree(di);

return 0;
}

Expand Down Expand Up @@ -933,7 +933,6 @@ static int bq27000_battery_probe(struct platform_device *pdev)
{
struct bq27x00_device_info *di;
struct bq27000_platform_data *pdata = pdev->dev.platform_data;
int ret;

if (!pdata) {
dev_err(&pdev->dev, "no platform_data supplied\n");
Expand All @@ -945,7 +944,7 @@ static int bq27000_battery_probe(struct platform_device *pdev)
return -EINVAL;
}

di = kzalloc(sizeof(*di), GFP_KERNEL);
di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL);
if (!di) {
dev_err(&pdev->dev, "failed to allocate device info data\n");
return -ENOMEM;
Expand All @@ -959,16 +958,7 @@ static int bq27000_battery_probe(struct platform_device *pdev)
di->bat.name = pdata->name ?: dev_name(&pdev->dev);
di->bus.read = &bq27000_read_platform;

ret = bq27x00_powersupply_init(di);
if (ret)
goto err_free;

return 0;

err_free:
kfree(di);

return ret;
return bq27x00_powersupply_init(di);
}

static int bq27000_battery_remove(struct platform_device *pdev)
Expand All @@ -977,8 +967,6 @@ static int bq27000_battery_remove(struct platform_device *pdev)

bq27x00_powersupply_unregister(di);

kfree(di);

return 0;
}

Expand Down
Loading

0 comments on commit 0498cf8

Please sign in to comment.