aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mfd
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2008-11-16 14:16:47 -0500
committerSamuel Ortiz <samuel@sortiz.org>2009-01-04 06:17:38 -0500
commit14431aa0c5a443d13d24e6f865a8838f97dab973 (patch)
treeb0494cf2787cf039f7541439ef9b1f6ee5c3b294 /include/linux/mfd
parent3fba19ec1ae5b460c73a7f32efed8d3b3300b246 (diff)
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: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
Diffstat (limited to 'include/linux/mfd')
-rw-r--r--include/linux/mfd/wm8350/core.h26
-rw-r--r--include/linux/mfd/wm8350/supply.h23
2 files changed, 48 insertions, 1 deletions
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index cc190055b9c4..d2614dfc9397 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -57,6 +57,9 @@
57#define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25 57#define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25
58#define WM8350_GPIO_INT_STATUS_MASK 0x26 58#define WM8350_GPIO_INT_STATUS_MASK 0x26
59#define WM8350_COMPARATOR_INT_STATUS_MASK 0x27 59#define WM8350_COMPARATOR_INT_STATUS_MASK 0x27
60#define WM8350_MISC_OVERRIDES 0xE3
61#define WM8350_COMPARATOR_OVERRIDES 0xE7
62#define WM8350_STATE_MACHINE_STATUS 0xE9
60 63
61#define WM8350_MAX_REGISTER 0xFF 64#define WM8350_MAX_REGISTER 0xFF
62 65
@@ -523,6 +526,29 @@
523#define WM8350_DC2_STS 0x0002 526#define WM8350_DC2_STS 0x0002
524#define WM8350_DC1_STS 0x0001 527#define WM8350_DC1_STS 0x0001
525 528
529/*
530 * R227 (0xE3) - Misc Overrides
531 */
532#define WM8350_USB_LIMIT_OVRDE 0x0400
533
534/*
535 * R227 (0xE7) - Comparator Overrides
536 */
537#define WM8350_USB_FB_OVRDE 0x8000
538#define WM8350_WALL_FB_OVRDE 0x4000
539#define WM8350_BATT_FB_OVRDE 0x2000
540
541
542/*
543 * R233 (0xE9) - State Machinine Status
544 */
545#define WM8350_USB_SM_MASK 0x0700
546#define WM8350_USB_SM_SHIFT 8
547
548#define WM8350_USB_SM_100_SLV 1
549#define WM8350_USB_SM_500_SLV 5
550#define WM8350_USB_SM_STDBY_SLV 7
551
526/* WM8350 wake up conditions */ 552/* WM8350 wake up conditions */
527#define WM8350_IRQ_WKUP_OFF_STATE 43 553#define WM8350_IRQ_WKUP_OFF_STATE 43
528#define WM8350_IRQ_WKUP_HIB_STATE 44 554#define WM8350_IRQ_WKUP_HIB_STATE 44
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h
index 1c8f3cde79b0..79721513fa9f 100644
--- a/include/linux/mfd/wm8350/supply.h
+++ b/include/linux/mfd/wm8350/supply.h
@@ -13,7 +13,8 @@
13#ifndef __LINUX_MFD_WM8350_SUPPLY_H_ 13#ifndef __LINUX_MFD_WM8350_SUPPLY_H_
14#define __LINUX_MFD_WM8350_SUPPLY_H_ 14#define __LINUX_MFD_WM8350_SUPPLY_H_
15 15
16#include <linux/platform_device.h> 16#include <linux/mutex.h>
17#include <linux/power_supply.h>
17 18
18/* 19/*
19 * Charger registers 20 * Charger registers
@@ -104,8 +105,28 @@
104#define WM8350_IRQ_EXT_WALL_FB 37 105#define WM8350_IRQ_EXT_WALL_FB 37
105#define WM8350_IRQ_EXT_BAT_FB 38 106#define WM8350_IRQ_EXT_BAT_FB 38
106 107
108/*
109 * Policy to control charger state machine.
110 */
111struct wm8350_charger_policy {
112
113 /* charger state machine policy - set in machine driver */
114 int eoc_mA; /* end of charge current (mA) */
115 int charge_mV; /* charge voltage */
116 int fast_limit_mA; /* fast charge current limit */
117 int fast_limit_USB_mA; /* USB fast charge current limit */
118 int charge_timeout; /* charge timeout (mins) */
119 int trickle_start_mV; /* trickle charge starts at mV */
120 int trickle_charge_mA; /* trickle charge current */
121 int trickle_charge_USB_mA; /* USB trickle charge current */
122};
123
107struct wm8350_power { 124struct wm8350_power {
108 struct platform_device *pdev; 125 struct platform_device *pdev;
126 struct power_supply battery;
127 struct power_supply usb;
128 struct power_supply ac;
129 struct wm8350_charger_policy *policy;
109}; 130};
110 131
111#endif 132#endif