Skip to content

Commit

Permalink
Merge tag 'for-v3.20' of git://git.infradead.org/battery-2.6
Browse files Browse the repository at this point in the history
Pull power supply and reset changes from Sebastian Reichel:
 "New drivers:
   - charger driver for Maxim 77693
   - battery gauge driver for LTC 2941/2943
   - battery gauge driver for RT5033
   - reset driver for R-Mobile platforms

  Convert drivers to restart handler framework:
   - arm-versatile
   - at91
   - st-poweroff

  Misc:
   - remove deprecated sun6i reboot driver
   - use alarmtimer instead of rtc in charger-manager
   - misc fixes"

* tag 'for-v3.20' of git://git.infradead.org/battery-2.6: (48 commits)
  power_supply: 88pm860x: Fix leaked power supply on probe fail
  power/reset: restart-poweroff: Remove arm dependencies
  power/reset: st-poweroff: Fix misleading Kconfig description
  power/reset: st-poweroff: Register with kernel restart handler
  power/reset: Remove sun6i reboot driver
  power/reset: at91: Register with kernel restart handler
  power/reset: arm-versatile: Register with kernel restart handler
  power: test_power: Use enum as index for array of supplies
  Add devicetree binding documentation for the LTC2941/LTC2943 driver
  Add LTC2941/LTC2943 Battery Gauge Driver
  power/reset: brcmstb: Add support for old 65nm chips
  power/reset: brcmstb: Use the DT "compatible" string to indicate bit positions
  power/reset: brcmstb: Make the driver buildable on MIPS
  power: charger-manager: Use alarmtimer for battery monitoring in suspend.
  power/reset: at91-poweroff: Fix error handling and other compiler warnings
  bq27x00_battery: Call power_supply_changed only when capacity changed
  bq27x00_battery: fix register offset for bq27425
  power: max14577: Remove SYSFS dependency from Kconfig
  power: bq24190_charger: suppress build warning
  power: reset: Add reset driver for R-Mobile platforms
  ...
  • Loading branch information
torvalds committed Feb 11, 2015
2 parents c5ce28d + 24727b4 commit 13c0719
Show file tree
Hide file tree
Showing 35 changed files with 2,224 additions and 604 deletions.
42 changes: 42 additions & 0 deletions Documentation/ABI/testing/sysfs-class-power
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,45 @@ Description:
Valid values:
- 5, 6 or 7 (hours),
- 0: disabled.

What: /sys/class/power_supply/max77693-charger/device/fast_charge_timer
Date: January 2015
KernelVersion: 3.19.0
Contact: Krzysztof Kozlowski <[email protected]>
Description:
This entry shows and sets the maximum time the max77693
charger operates in fast-charge mode. When the timer expires
the device will terminate fast-charge mode (charging current
will drop to 0 A) and will trigger interrupt.

Valid values:
- 4 - 16 (hours), step by 2 (rounded down)
- 0: disabled.

What: /sys/class/power_supply/max77693-charger/device/top_off_threshold_current
Date: January 2015
KernelVersion: 3.19.0
Contact: Krzysztof Kozlowski <[email protected]>
Description:
This entry shows and sets the charging current threshold for
entering top-off charging mode. When charging current in fast
charge mode drops below this value, the charger will trigger
interrupt and start top-off charging mode.

Valid values:
- 100000 - 200000 (microamps), step by 25000 (rounded down)
- 200000 - 350000 (microamps), step by 50000 (rounded down)
- 0: disabled.

What: /sys/class/power_supply/max77693-charger/device/top_off_timer
Date: January 2015
KernelVersion: 3.19.0
Contact: Krzysztof Kozlowski <[email protected]>
Description:
This entry shows and sets the maximum time the max77693
charger operates in top-off charge mode. When the timer expires
the device will terminate top-off charge mode (charging current
will drop to 0 A) and will trigger interrupt.

Valid values:
- 0 - 70 (minutes), step by 10 (rounded down)
4 changes: 3 additions & 1 deletion Documentation/devicetree/bindings/arm/brcm-brcmstb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ reboot
Required properties

- compatible
The string property "brcm,brcmstb-reboot".
The string property "brcm,brcmstb-reboot" for 40nm/28nm chips with
the new SYS_CTRL interface, or "brcm,bcm7038-reboot" for 65nm
chips with the old SUN_TOP_CTRL interface.

- syscon
A phandle / integer array that points to the syscon node which describes
Expand Down
45 changes: 45 additions & 0 deletions Documentation/devicetree/bindings/mfd/max77693.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,41 @@ Optional properties:
To get more informations, please refer to documentaion.
[*] refer Documentation/devicetree/bindings/pwm/pwm.txt

- charger : Node configuring the charger driver.
If present, required properties:
- compatible : Must be "maxim,max77693-charger".

Optional properties (if not set, defaults will be used):
- maxim,constant-microvolt : Battery constant voltage in uV. The charger
will operate in fast charge constant current mode till battery voltage
reaches this level. Then the charger will switch to fast charge constant
voltage mode. Also vsys (system voltage) will be set to this value when
DC power is supplied but charger is not enabled.
Valid values: 3650000 - 4400000, step by 25000 (rounded down)
Default: 4200000

- maxim,min-system-microvolt : Minimal system voltage in uV.
Valid values: 3000000 - 3700000, step by 100000 (rounded down)
Default: 3600000

- maxim,thermal-regulation-celsius : Temperature in Celsius for entering
high temperature charging mode. If die temperature exceeds this value
the charging current will be reduced by 105 mA/Celsius.
Valid values: 70, 85, 100, 115
Default: 100

- maxim,battery-overcurrent-microamp : Overcurrent protection threshold
in uA (current from battery to system).
Valid values: 2000000 - 3500000, step by 250000 (rounded down)
Default: 3500000

- maxim,charge-input-threshold-microvolt : Threshold voltage in uV for
triggering input voltage regulation loop. If input voltage decreases
below this value, the input current will be reduced to reach the
threshold voltage.
Valid values: 4300000, 4700000, 4800000, 4900000
Default: 4300000

Example:
max77693@66 {
compatible = "maxim,max77693";
Expand Down Expand Up @@ -73,4 +108,14 @@ Example:
pwms = <&pwm 0 40000 0>;
pwm-names = "haptic";
};

charger {
compatible = "maxim,max77693-charger";

maxim,constant-microvolt = <4200000>;
maxim,min-system-microvolt = <3600000>;
maxim,thermal-regulation-celsius = <75>;
maxim,battery-overcurrent-microamp = <3000000>;
maxim,charge-input-threshold-microvolt = <4300000>;
};
};
27 changes: 27 additions & 0 deletions Documentation/devicetree/bindings/power/ltc2941.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
binding for LTC2941 and LTC2943 battery gauges

Both the LTC2941 and LTC2943 measure battery capacity.
The LTC2943 is compatible with the LTC2941, it adds voltage and
temperature monitoring, and uses a slightly different conversion
formula for the charge counter.

Required properties:
- compatible: Should contain "ltc2941" or "ltc2943" which also indicates the
type of I2C chip attached.
- reg: The 7-bit I2C address.
- lltc,resistor-sense: The sense resistor value in milli-ohms. Can be a 32-bit
negative value when the battery has been connected to the wrong end of the
resistor.
- lltc,prescaler-exponent: The prescaler exponent as explained in the datasheet.
This determines the range and accuracy of the gauge. The value is programmed
into the chip only if it differs from the current setting. The setting is
lost when the battery is disconnected.

Example from the Topic Miami Florida board:

fuelgauge: ltc2943@64 {
compatible = "ltc2943";
reg = <0x64>;
lltc,resistor-sense = <15>;
lltc,prescaler-exponent = <5>; /* 2^(2*5) = 1024 */
};
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
Binding for the LTC2952 PowerPath controller

This chip is used to externally trigger a system shut down. Once the trigger has
been sent, the chips' watchdog has to be reset to gracefully shut down.
If the Linux systems decides to shut down it powers off the platform via the
kill signal.
been sent, the chip's watchdog has to be reset to gracefully shut down.
A full powerdown can be triggered via the kill signal.

Required properties:

- compatible: Must contain: "lltc,ltc2952"
- trigger-gpios: phandle + gpio-specifier for the GPIO connected to the
chip's trigger line
- watchdog-gpios: phandle + gpio-specifier for the GPIO connected to the
chip's watchdog line
- kill-gpios: phandle + gpio-specifier for the GPIO connected to the
chip's kill line

Optional properties:
- trigger-gpios: phandle + gpio-specifier for the GPIO connected to the
chip's trigger line. If this property is not set, the
trigger function is ignored and the chip is kept alive
until an explicit kill signal is received

Example:

ltc2952 {
Expand Down
7 changes: 7 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -6165,6 +6165,13 @@ F: Documentation/devicetree/bindings/i2c/max6697.txt
F: drivers/hwmon/max6697.c
F: include/linux/platform_data/max6697.h

MAXIM MUIC CHARGER DRIVERS FOR EXYNOS BASED BOARDS
M: Krzysztof Kozlowski <[email protected]>
L: [email protected]
S: Supported
F: drivers/power/max14577_charger.c
F: drivers/power/max77693_charger.c

MAXIRADIO FM RADIO RECEIVER DRIVER
M: Hans Verkuil <[email protected]>
L: [email protected]
Expand Down
1 change: 1 addition & 0 deletions drivers/power/88pm860x_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ static int pm860x_charger_probe(struct platform_device *pdev)
return 0;

out_irq:
power_supply_unregister(&info->usb);
while (--i >= 0)
free_irq(info->irq[i], info);
out:
Expand Down
25 changes: 23 additions & 2 deletions drivers/power/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ config CHARGER_GPIO

config CHARGER_MANAGER
bool "Battery charger manager for multiple chargers"
depends on REGULATOR && RTC_CLASS
depends on REGULATOR
select EXTCON
help
Say Y to enable charger-manager support, which allows multiple
Expand All @@ -327,11 +327,16 @@ config CHARGER_MANAGER
config CHARGER_MAX14577
tristate "Maxim MAX14577/77836 battery charger driver"
depends on MFD_MAX14577
depends on SYSFS
help
Say Y to enable support for the battery charger control sysfs and
platform data of MAX14577/77836 MUICs.

config CHARGER_MAX77693
tristate "Maxim MAX77693 battery charger driver"
depends on MFD_MAX77693
help
Say Y to enable support for the Maxim MAX77693 battery charger.

config CHARGER_MAX8997
tristate "Maxim MAX8997/MAX8966 PMIC battery charger driver"
depends on MFD_MAX8997 && REGULATOR_MAX8997
Expand Down Expand Up @@ -383,6 +388,14 @@ config CHARGER_TPS65090
Say Y here to enable support for battery charging with TPS65090
PMIC chips.

config BATTERY_GAUGE_LTC2941
tristate "LTC2941/LTC2943 Battery Gauge Driver"
depends on I2C
help
Say Y here to include support for LTC2941 and LTC2943 Battery
Gauge IC. The driver reports the charge count continuously, and
measures the voltage and temperature every 10 seconds.

config AB8500_BM
bool "AB8500 Battery Management Driver"
depends on AB8500_CORE && AB8500_GPADC
Expand All @@ -397,6 +410,14 @@ config BATTERY_GOLDFISH
Say Y to enable support for the battery and AC power in the
Goldfish emulator.

config BATTERY_RT5033
tristate "RT5033 fuel gauge support"
depends on MFD_RT5033
help
This adds support for battery fuel gauge in Richtek RT5033 PMIC.
The fuelgauge calculates and determines the battery state of charge
according to battery open circuit voltage.

source "drivers/power/reset/Kconfig"

endif # POWER_SUPPLY
Expand Down
3 changes: 3 additions & 0 deletions drivers/power/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o
obj-$(CONFIG_BATTERY_DS2780) += ds2780_battery.o
obj-$(CONFIG_BATTERY_DS2781) += ds2781_battery.o
obj-$(CONFIG_BATTERY_DS2782) += ds2782_battery.o
obj-$(CONFIG_BATTERY_GAUGE_LTC2941) += ltc2941-battery-gauge.o
obj-$(CONFIG_BATTERY_GOLDFISH) += goldfish_battery.o
obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o
obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o
Expand All @@ -34,6 +35,7 @@ obj-$(CONFIG_BATTERY_DA9052) += da9052-battery.o
obj-$(CONFIG_BATTERY_MAX17040) += max17040_battery.o
obj-$(CONFIG_BATTERY_MAX17042) += max17042_battery.o
obj-$(CONFIG_BATTERY_Z2) += z2_battery.o
obj-$(CONFIG_BATTERY_RT5033) += rt5033_battery.o
obj-$(CONFIG_BATTERY_S3C_ADC) += s3c_adc_battery.o
obj-$(CONFIG_BATTERY_TWL4030_MADC) += twl4030_madc_battery.o
obj-$(CONFIG_CHARGER_88PM860X) += 88pm860x_charger.o
Expand All @@ -50,6 +52,7 @@ obj-$(CONFIG_CHARGER_LP8788) += lp8788-charger.o
obj-$(CONFIG_CHARGER_GPIO) += gpio-charger.o
obj-$(CONFIG_CHARGER_MANAGER) += charger-manager.o
obj-$(CONFIG_CHARGER_MAX14577) += max14577_charger.o
obj-$(CONFIG_CHARGER_MAX77693) += max77693_charger.o
obj-$(CONFIG_CHARGER_MAX8997) += max8997_charger.o
obj-$(CONFIG_CHARGER_MAX8998) += max8998_charger.o
obj-$(CONFIG_CHARGER_BQ2415X) += bq2415x_charger.o
Expand Down
14 changes: 0 additions & 14 deletions drivers/power/ab8500_fg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2435,20 +2435,6 @@ static void ab8500_fg_reinit_work(struct work_struct *work)
}
}

/**
* ab8500_fg_reinit() - forces FG algorithm to reinitialize with current values
*
* This function can be used to force the FG algorithm to recalculate a new
* voltage based battery capacity.
*/
void ab8500_fg_reinit(void)
{
struct ab8500_fg *di = ab8500_fg_get();
/* User won't be notified if a null pointer returned. */
if (di != NULL)
queue_delayed_work(di->fg_wq, &di->fg_reinit_work, 0);
}

/* Exposure to the sysfs interface */

struct ab8500_fg_sysfs_entry {
Expand Down
4 changes: 2 additions & 2 deletions drivers/power/bq24190_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ static void bq24190_charger_init(struct power_supply *charger)
charger->properties = bq24190_charger_properties;
charger->num_properties = ARRAY_SIZE(bq24190_charger_properties);
charger->supplied_to = bq24190_charger_supplied_to;
charger->num_supplies = ARRAY_SIZE(bq24190_charger_supplied_to);
charger->num_supplicants = ARRAY_SIZE(bq24190_charger_supplied_to);
charger->get_property = bq24190_charger_get_property;
charger->set_property = bq24190_charger_set_property;
charger->property_is_writeable = bq24190_charger_property_is_writeable;
Expand Down Expand Up @@ -1208,7 +1208,7 @@ static irqreturn_t bq24190_irq_handler_thread(int irq, void *data)
{
struct bq24190_dev_info *bdi = data;
bool alert_userspace = false;
u8 ss_reg, f_reg;
u8 ss_reg = 0, f_reg = 0;
int ret;

pm_runtime_get_sync(bdi->dev);
Expand Down
19 changes: 12 additions & 7 deletions drivers/power/bq27x00_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@

/* bq27425 register addresses are same as bq27x00 addresses minus 4 */
#define BQ27425_REG_OFFSET 0x04
#define BQ27425_REG_SOC 0x18 /* Register address plus offset */
#define BQ27425_REG_SOC (0x1C + BQ27425_REG_OFFSET)
#define BQ27425_REG_DCAP (0x3C + BQ27425_REG_OFFSET)

#define BQ27000_RS 20 /* Resistor sense */
#define BQ27x00_POWER_CONSTANT (256 * 29200 / 1000)
Expand Down Expand Up @@ -282,9 +283,12 @@ static int bq27x00_battery_read_ilmd(struct bq27x00_device_info *di)
{
int ilmd;

if (bq27xxx_is_chip_version_higher(di))
ilmd = bq27x00_read(di, BQ27500_REG_DCAP, false);
else
if (bq27xxx_is_chip_version_higher(di)) {
if (di->chip == BQ27425)
ilmd = bq27x00_read(di, BQ27425_REG_DCAP, false);
else
ilmd = bq27x00_read(di, BQ27500_REG_DCAP, false);
} else
ilmd = bq27x00_read(di, BQ27000_REG_ILMD, true);

if (ilmd < 0) {
Expand Down Expand Up @@ -493,10 +497,11 @@ static void bq27x00_update(struct bq27x00_device_info *di)
di->charge_design_full = bq27x00_battery_read_ilmd(di);
}

if (memcmp(&di->cache, &cache, sizeof(cache)) != 0) {
di->cache = cache;
if (di->cache.capacity != cache.capacity)
power_supply_changed(&di->bat);
}

if (memcmp(&di->cache, &cache, sizeof(cache)) != 0)
di->cache = cache;

di->last_update = jiffies;
}
Expand Down
Loading

0 comments on commit 13c0719

Please sign in to comment.