Commit 14431aa0 authored by Mark Brown's avatar Mark Brown Committed by Samuel Ortiz

power_supply: Add support for WM8350 PMU

This patch adds support for the PMU provided by the WM8350 which
implements battery, line and USB supplies including a battery charger.
The hardware functions largely autonomously, with minimal software
control required to initiate fast charging.

Support for configuration of the USB supply is not yet implemented.
This means that the hardware will remain in the mode configured at
startup, by default limiting the current drawn from USB to 100mA.

This driver was originally written by Liam Girdwood with subsequent
updates for submission by Mark Brown.
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: default avatarAnton Vorontsov <cbouatmailru@gmail.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@openedhand.com>
parent 3fba19ec
......@@ -29,6 +29,13 @@ config APM_POWER
Say Y here to enable support APM status emulation using
battery class devices.
config WM8350_POWER
tristate "WM8350 PMU support"
depends on MFD_WM8350
help
Say Y here to enable support for the power management unit
provided by the Wolfson Microelectronics WM8350 PMIC.
config BATTERY_DS2760
tristate "DS2760 battery driver (HP iPAQ & others)"
select W1
......
......@@ -16,6 +16,7 @@ obj-$(CONFIG_POWER_SUPPLY) += power_supply.o
obj-$(CONFIG_PDA_POWER) += pda_power.o
obj-$(CONFIG_APM_POWER) += apm_power.o
obj-$(CONFIG_WM8350_POWER) += wm8350_power.o
obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o
obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o
......
This diff is collapsed.
......@@ -57,6 +57,9 @@
#define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25
#define WM8350_GPIO_INT_STATUS_MASK 0x26
#define WM8350_COMPARATOR_INT_STATUS_MASK 0x27
#define WM8350_MISC_OVERRIDES 0xE3
#define WM8350_COMPARATOR_OVERRIDES 0xE7
#define WM8350_STATE_MACHINE_STATUS 0xE9
#define WM8350_MAX_REGISTER 0xFF
......@@ -523,6 +526,29 @@
#define WM8350_DC2_STS 0x0002
#define WM8350_DC1_STS 0x0001
/*
* R227 (0xE3) - Misc Overrides
*/
#define WM8350_USB_LIMIT_OVRDE 0x0400
/*
* R227 (0xE7) - Comparator Overrides
*/
#define WM8350_USB_FB_OVRDE 0x8000
#define WM8350_WALL_FB_OVRDE 0x4000
#define WM8350_BATT_FB_OVRDE 0x2000
/*
* R233 (0xE9) - State Machinine Status
*/
#define WM8350_USB_SM_MASK 0x0700
#define WM8350_USB_SM_SHIFT 8
#define WM8350_USB_SM_100_SLV 1
#define WM8350_USB_SM_500_SLV 5
#define WM8350_USB_SM_STDBY_SLV 7
/* WM8350 wake up conditions */
#define WM8350_IRQ_WKUP_OFF_STATE 43
#define WM8350_IRQ_WKUP_HIB_STATE 44
......
......@@ -13,7 +13,8 @@
#ifndef __LINUX_MFD_WM8350_SUPPLY_H_
#define __LINUX_MFD_WM8350_SUPPLY_H_
#include <linux/platform_device.h>
#include <linux/mutex.h>
#include <linux/power_supply.h>
/*
* Charger registers
......@@ -104,8 +105,28 @@
#define WM8350_IRQ_EXT_WALL_FB 37
#define WM8350_IRQ_EXT_BAT_FB 38
/*
* Policy to control charger state machine.
*/
struct wm8350_charger_policy {
/* charger state machine policy - set in machine driver */
int eoc_mA; /* end of charge current (mA) */
int charge_mV; /* charge voltage */
int fast_limit_mA; /* fast charge current limit */
int fast_limit_USB_mA; /* USB fast charge current limit */
int charge_timeout; /* charge timeout (mins) */
int trickle_start_mV; /* trickle charge starts at mV */
int trickle_charge_mA; /* trickle charge current */
int trickle_charge_USB_mA; /* USB trickle charge current */
};
struct wm8350_power {
struct platform_device *pdev;
struct power_supply battery;
struct power_supply usb;
struct power_supply ac;
struct wm8350_charger_policy *policy;
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment