Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 76f901eb authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'for-v3.5' of git://git.infradead.org/battery-2.6

Pull battery updates from Anton Vorontsov:
 "A bunch of fixes for v3.5, nothing extraordinary."

* tag 'for-v3.5' of git://git.infradead.org/battery-2.6: (27 commits)
  smb347-charger: Include missing <linux/err.h>
  smb347-charger: Clean up battery attributes
  max17042_battery: Add support for max17047/50 chip
  sbs-battery.c: Capacity attr = remaining relative capacity
  isp1704_charger: Use after free on probe error
  ds2781_battery: Use DS2781_PARAM_EEPROM_SIZE and DS2781_USER_EEPROM_SIZE
  power_supply: Fix a typo in BATTERY_DS2781 Kconfig entry
  charger-manager: Provide cm_notify_event function for in-kernel use
  charger-manager: Poll battery health in normal state
  smb347-charger: Convert to regmap API
  smb347-charger: Move IRQ enabling to the end of probe
  smb347-charger: Rename few functions to match better what they are doing
  smb347-charger: Convert to use module_i2c_driver()
  smb347_charger: Cleanup power supply registration code in probe
  ab8500: Clean up probe routines
  ab8500_fg: Harden platform data check
  ab8500_btemp: Harden platform data check
  ab8500_charger: Harden platform data check
  MAINTAINERS: Fix 'F' entry for the power supply class
  max17042_battery: Handle irq request failure case
  ...
parents bd0e162d 96facd23
Loading
Loading
Loading
Loading
+39 −2
Original line number Diff line number Diff line
@@ -44,6 +44,16 @@ Charger Manager supports the following:
	Normally, the platform will need to resume and suspend some devices
	that are used by Charger Manager.

* Support for premature full-battery event handling
	If the battery voltage drops by "fullbatt_vchkdrop_uV" after
	"fullbatt_vchkdrop_ms" from the full-battery event, the framework
	restarts charging. This check is also performed while suspended by
	setting wakeup time accordingly and using suspend_again.

* Support for uevent-notify
	With the charger-related events, the device sends
	notification to users with UEVENT.

2. Global Charger-Manager Data related with suspend_again
========================================================
In order to setup Charger Manager with suspend-again feature
@@ -55,7 +65,7 @@ if there are multiple batteries. If there are multiple batteries, the
multiple instances of Charger Manager share the same charger_global_desc
and it will manage in-suspend monitoring for all instances of Charger Manager.

The user needs to provide all the two entries properly in order to activate
The user needs to provide all the three entries properly in order to activate
in-suspend monitoring:

struct charger_global_desc {
@@ -74,6 +84,11 @@ bool (*rtc_only_wakeup)(void);
	same struct. If there is any other wakeup source triggered the
	wakeup, it should return false. If the "rtc" is the only wakeup
	reason, it should return true.

bool assume_timer_stops_in_suspend;
	: if true, Charger Manager assumes that
	the timer (CM uses jiffies as timer) stops during suspend. Then, CM
	assumes that the suspend-duration is same as the alarm length.
};

3. How to setup suspend_again
@@ -111,6 +126,16 @@ enum polling_modes polling_mode;
	  CM_POLL_CHARGING_ONLY: poll this battery if and only if the
				 battery is being charged.

unsigned int fullbatt_vchkdrop_ms;
unsigned int fullbatt_vchkdrop_uV;
	: If both have non-zero values, Charger Manager will check the
	battery voltage drop fullbatt_vchkdrop_ms after the battery is fully
	charged. If the voltage drop is over fullbatt_vchkdrop_uV, Charger
	Manager will try to recharge the battery by disabling and enabling
	chargers. Recharge with voltage drop condition only (without delay
	condition) is needed to be implemented with hardware interrupts from
	fuel gauges or charger devices/chips.

unsigned int fullbatt_uV;
	: If specified with a non-zero value, Charger Manager assumes
	that the battery is full (capacity = 100) if the battery is not being
@@ -122,6 +147,8 @@ unsigned int polling_interval_ms;
	this battery every polling_interval_ms or more frequently.

enum data_source battery_present;
	: CM_BATTERY_PRESENT: assume that the battery exists.
	CM_NO_BATTERY: assume that the battery does not exists.
	CM_FUEL_GAUGE: get battery presence information from fuel gauge.
	CM_CHARGER_STAT: get battery presence from chargers.

@@ -151,7 +178,17 @@ bool measure_battery_temp;
	the value of measure_battery_temp.
};

5. Other Considerations
5. Notify Charger-Manager of charger events: cm_notify_event()
=========================================================
If there is an charger event is required to notify
Charger Manager, a charger device driver that triggers the event can call
cm_notify_event(psy, type, msg) to notify the corresponding Charger Manager.
In the function, psy is the charger driver's power_supply pointer, which is
associated with Charger-Manager. The parameter "type"
is the same as irq's type (enum cm_event_types). The event message "msg" is
optional and is effective only if the event type is "UNDESCRIBED" or "OTHERS".

6. Other Considerations
=======================

At the charger/battery-related events such as battery-pulled-out,
+2 −0
Original line number Diff line number Diff line
@@ -84,6 +84,8 @@ are already charged or discharging, 'n/a' can be displayed (or
HEALTH - represents health of the battery, values corresponds to
POWER_SUPPLY_HEALTH_*, defined in battery.h.

VOLTAGE_OCV - open circuit voltage of the battery.

VOLTAGE_MAX_DESIGN, VOLTAGE_MIN_DESIGN - design values for maximal and
minimal power supply voltages. Maximal/minimal means values of voltages
when battery considered "full"/"empty" at normal conditions. Yes, there is
+1 −1
Original line number Diff line number Diff line
@@ -5337,7 +5337,7 @@ M: David Woodhouse <dwmw2@infradead.org>
T:	git git://git.infradead.org/battery-2.6.git
S:	Maintained
F:	include/linux/power_supply.h
F:	drivers/power/power_supply*
F:	drivers/power/

PNP SUPPORT
M:	Adam Belay <abelay@mit.edu>
+6 −4
Original line number Diff line number Diff line
menuconfig POWER_SUPPLY
	tristate "Power supply class support"
	bool "Power supply class support"
	help
	  Say Y here to enable power supply class support. This allows
	  power supply (batteries, AC, USB) monitoring by userspace
@@ -77,7 +77,7 @@ config BATTERY_DS2780
	  Say Y here to enable support for batteries with ds2780 chip.

config BATTERY_DS2781
	tristate "2781 battery driver"
	tristate "DS2781 battery driver"
	depends on HAS_IOMEM
	select W1
	select W1_SLAVE_DS2781
@@ -181,14 +181,15 @@ config BATTERY_MAX17040
	  to operate with a single lithium cell

config BATTERY_MAX17042
	tristate "Maxim MAX17042/8997/8966 Fuel Gauge"
	tristate "Maxim MAX17042/17047/17050/8997/8966 Fuel Gauge"
	depends on I2C
	help
	  MAX17042 is fuel-gauge systems for lithium-ion (Li+) batteries
	  in handheld and portable equipment. The MAX17042 is configured
	  to operate with a single lithium cell. MAX8997 and MAX8966 are
	  multi-function devices that include fuel gauages that are compatible
	  with MAX17042.
	  with MAX17042. This driver also supports max17047/50 chips which are
	  improved version of max17042.

config BATTERY_Z2
	tristate "Z2 battery driver"
@@ -291,6 +292,7 @@ config CHARGER_MAX8998
config CHARGER_SMB347
	tristate "Summit Microelectronics SMB347 Battery Charger"
	depends on I2C
	select REGMAP_I2C
	help
	  Say Y to include support for Summit Microelectronics SMB347
	  Battery Charger.
+8 −4
Original line number Diff line number Diff line
@@ -964,10 +964,15 @@ static int __devinit ab8500_btemp_probe(struct platform_device *pdev)
{
	int irq, i, ret = 0;
	u8 val;
	struct abx500_bm_plat_data *plat_data;
	struct abx500_bm_plat_data *plat_data = pdev->dev.platform_data;
	struct ab8500_btemp *di;

	if (!plat_data) {
		dev_err(&pdev->dev, "No platform data\n");
		return -EINVAL;
	}

	struct ab8500_btemp *di =
		kzalloc(sizeof(struct ab8500_btemp), GFP_KERNEL);
	di = kzalloc(sizeof(*di), GFP_KERNEL);
	if (!di)
		return -ENOMEM;

@@ -977,7 +982,6 @@ static int __devinit ab8500_btemp_probe(struct platform_device *pdev)
	di->gpadc = ab8500_gpadc_get("ab8500-gpadc.0");

	/* get btemp specific platform data */
	plat_data = pdev->dev.platform_data;
	di->pdata = plat_data->btemp;
	if (!di->pdata) {
		dev_err(di->dev, "no btemp platform data supplied\n");
Loading