1d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
28c0984e5SSebastian Reichel /*
38c0984e5SSebastian Reichel  * Battery driver for wm8350 PMIC
48c0984e5SSebastian Reichel  *
58c0984e5SSebastian Reichel  * Copyright 2007, 2008 Wolfson Microelectronics PLC.
68c0984e5SSebastian Reichel  *
78c0984e5SSebastian Reichel  * Based on OLPC Battery Driver
88c0984e5SSebastian Reichel  *
98c0984e5SSebastian Reichel  * Copyright 2006  David Woodhouse <dwmw2@infradead.org>
108c0984e5SSebastian Reichel  */
118c0984e5SSebastian Reichel 
128c0984e5SSebastian Reichel #include <linux/module.h>
138c0984e5SSebastian Reichel #include <linux/err.h>
148c0984e5SSebastian Reichel #include <linux/platform_device.h>
158c0984e5SSebastian Reichel #include <linux/power_supply.h>
168c0984e5SSebastian Reichel #include <linux/mfd/wm8350/supply.h>
178c0984e5SSebastian Reichel #include <linux/mfd/wm8350/core.h>
188c0984e5SSebastian Reichel #include <linux/mfd/wm8350/comparator.h>
198c0984e5SSebastian Reichel 
wm8350_read_battery_uvolts(struct wm8350 * wm8350)208c0984e5SSebastian Reichel static int wm8350_read_battery_uvolts(struct wm8350 *wm8350)
218c0984e5SSebastian Reichel {
228c0984e5SSebastian Reichel 	return wm8350_read_auxadc(wm8350, WM8350_AUXADC_BATT, 0, 0)
238c0984e5SSebastian Reichel 		* WM8350_AUX_COEFF;
248c0984e5SSebastian Reichel }
258c0984e5SSebastian Reichel 
wm8350_read_line_uvolts(struct wm8350 * wm8350)268c0984e5SSebastian Reichel static int wm8350_read_line_uvolts(struct wm8350 *wm8350)
278c0984e5SSebastian Reichel {
288c0984e5SSebastian Reichel 	return wm8350_read_auxadc(wm8350, WM8350_AUXADC_LINE, 0, 0)
298c0984e5SSebastian Reichel 		* WM8350_AUX_COEFF;
308c0984e5SSebastian Reichel }
318c0984e5SSebastian Reichel 
wm8350_read_usb_uvolts(struct wm8350 * wm8350)328c0984e5SSebastian Reichel static int wm8350_read_usb_uvolts(struct wm8350 *wm8350)
338c0984e5SSebastian Reichel {
348c0984e5SSebastian Reichel 	return wm8350_read_auxadc(wm8350, WM8350_AUXADC_USB, 0, 0)
358c0984e5SSebastian Reichel 		* WM8350_AUX_COEFF;
368c0984e5SSebastian Reichel }
378c0984e5SSebastian Reichel 
388c0984e5SSebastian Reichel #define WM8350_BATT_SUPPLY	1
398c0984e5SSebastian Reichel #define WM8350_USB_SUPPLY	2
408c0984e5SSebastian Reichel #define WM8350_LINE_SUPPLY	4
418c0984e5SSebastian Reichel 
wm8350_charge_time_min(struct wm8350 * wm8350,int min)428c0984e5SSebastian Reichel static inline int wm8350_charge_time_min(struct wm8350 *wm8350, int min)
438c0984e5SSebastian Reichel {
448c0984e5SSebastian Reichel 	if (!wm8350->power.rev_g_coeff)
458c0984e5SSebastian Reichel 		return (((min - 30) / 15) & 0xf) << 8;
468c0984e5SSebastian Reichel 	else
478c0984e5SSebastian Reichel 		return (((min - 30) / 30) & 0xf) << 8;
488c0984e5SSebastian Reichel }
498c0984e5SSebastian Reichel 
wm8350_get_supplies(struct wm8350 * wm8350)508c0984e5SSebastian Reichel static int wm8350_get_supplies(struct wm8350 *wm8350)
518c0984e5SSebastian Reichel {
528c0984e5SSebastian Reichel 	u16 sm, ov, co, chrg;
538c0984e5SSebastian Reichel 	int supplies = 0;
548c0984e5SSebastian Reichel 
558c0984e5SSebastian Reichel 	sm = wm8350_reg_read(wm8350, WM8350_STATE_MACHINE_STATUS);
568c0984e5SSebastian Reichel 	ov = wm8350_reg_read(wm8350, WM8350_MISC_OVERRIDES);
578c0984e5SSebastian Reichel 	co = wm8350_reg_read(wm8350, WM8350_COMPARATOR_OVERRIDES);
588c0984e5SSebastian Reichel 	chrg = wm8350_reg_read(wm8350, WM8350_BATTERY_CHARGER_CONTROL_2);
598c0984e5SSebastian Reichel 
608c0984e5SSebastian Reichel 	/* USB_SM */
618c0984e5SSebastian Reichel 	sm = (sm & WM8350_USB_SM_MASK) >> WM8350_USB_SM_SHIFT;
628c0984e5SSebastian Reichel 
638c0984e5SSebastian Reichel 	/* CHG_ISEL */
648c0984e5SSebastian Reichel 	chrg &= WM8350_CHG_ISEL_MASK;
658c0984e5SSebastian Reichel 
668c0984e5SSebastian Reichel 	/* If the USB state machine is active then we're using that with or
678c0984e5SSebastian Reichel 	 * without battery, otherwise check for wall supply */
688c0984e5SSebastian Reichel 	if (((sm == WM8350_USB_SM_100_SLV) ||
698c0984e5SSebastian Reichel 	     (sm == WM8350_USB_SM_500_SLV) ||
708c0984e5SSebastian Reichel 	     (sm == WM8350_USB_SM_STDBY_SLV))
718c0984e5SSebastian Reichel 	    && !(ov & WM8350_USB_LIMIT_OVRDE))
728c0984e5SSebastian Reichel 		supplies = WM8350_USB_SUPPLY;
738c0984e5SSebastian Reichel 	else if (((sm == WM8350_USB_SM_100_SLV) ||
748c0984e5SSebastian Reichel 		  (sm == WM8350_USB_SM_500_SLV) ||
758c0984e5SSebastian Reichel 		  (sm == WM8350_USB_SM_STDBY_SLV))
768c0984e5SSebastian Reichel 		 && (ov & WM8350_USB_LIMIT_OVRDE) && (chrg == 0))
778c0984e5SSebastian Reichel 		supplies = WM8350_USB_SUPPLY | WM8350_BATT_SUPPLY;
788c0984e5SSebastian Reichel 	else if (co & WM8350_WALL_FB_OVRDE)
798c0984e5SSebastian Reichel 		supplies = WM8350_LINE_SUPPLY;
808c0984e5SSebastian Reichel 	else
818c0984e5SSebastian Reichel 		supplies = WM8350_BATT_SUPPLY;
828c0984e5SSebastian Reichel 
838c0984e5SSebastian Reichel 	return supplies;
848c0984e5SSebastian Reichel }
858c0984e5SSebastian Reichel 
wm8350_charger_config(struct wm8350 * wm8350,struct wm8350_charger_policy * policy)868c0984e5SSebastian Reichel static int wm8350_charger_config(struct wm8350 *wm8350,
878c0984e5SSebastian Reichel 				 struct wm8350_charger_policy *policy)
888c0984e5SSebastian Reichel {
898c0984e5SSebastian Reichel 	u16 reg, eoc_mA, fast_limit_mA;
908c0984e5SSebastian Reichel 
918c0984e5SSebastian Reichel 	if (!policy) {
928c0984e5SSebastian Reichel 		dev_warn(wm8350->dev,
938c0984e5SSebastian Reichel 			 "No charger policy, charger not configured.\n");
948c0984e5SSebastian Reichel 		return -EINVAL;
958c0984e5SSebastian Reichel 	}
968c0984e5SSebastian Reichel 
978c0984e5SSebastian Reichel 	/* make sure USB fast charge current is not > 500mA */
988c0984e5SSebastian Reichel 	if (policy->fast_limit_USB_mA > 500) {
998c0984e5SSebastian Reichel 		dev_err(wm8350->dev, "USB fast charge > 500mA\n");
1008c0984e5SSebastian Reichel 		return -EINVAL;
1018c0984e5SSebastian Reichel 	}
1028c0984e5SSebastian Reichel 
1038c0984e5SSebastian Reichel 	eoc_mA = WM8350_CHG_EOC_mA(policy->eoc_mA);
1048c0984e5SSebastian Reichel 
1058c0984e5SSebastian Reichel 	wm8350_reg_unlock(wm8350);
1068c0984e5SSebastian Reichel 
1078c0984e5SSebastian Reichel 	reg = wm8350_reg_read(wm8350, WM8350_BATTERY_CHARGER_CONTROL_1)
1088c0984e5SSebastian Reichel 		& WM8350_CHG_ENA_R168;
1098c0984e5SSebastian Reichel 	wm8350_reg_write(wm8350, WM8350_BATTERY_CHARGER_CONTROL_1,
1108c0984e5SSebastian Reichel 			 reg | eoc_mA | policy->trickle_start_mV |
1118c0984e5SSebastian Reichel 			 WM8350_CHG_TRICKLE_TEMP_CHOKE |
1128c0984e5SSebastian Reichel 			 WM8350_CHG_TRICKLE_USB_CHOKE |
1138c0984e5SSebastian Reichel 			 WM8350_CHG_FAST_USB_THROTTLE);
1148c0984e5SSebastian Reichel 
1158c0984e5SSebastian Reichel 	if (wm8350_get_supplies(wm8350) & WM8350_USB_SUPPLY) {
1168c0984e5SSebastian Reichel 		fast_limit_mA =
1178c0984e5SSebastian Reichel 			WM8350_CHG_FAST_LIMIT_mA(policy->fast_limit_USB_mA);
1188c0984e5SSebastian Reichel 		wm8350_reg_write(wm8350, WM8350_BATTERY_CHARGER_CONTROL_2,
1198c0984e5SSebastian Reichel 			    policy->charge_mV | policy->trickle_charge_USB_mA |
1208c0984e5SSebastian Reichel 			    fast_limit_mA | wm8350_charge_time_min(wm8350,
1218c0984e5SSebastian Reichel 						policy->charge_timeout));
1228c0984e5SSebastian Reichel 
1238c0984e5SSebastian Reichel 	} else {
1248c0984e5SSebastian Reichel 		fast_limit_mA =
1258c0984e5SSebastian Reichel 			WM8350_CHG_FAST_LIMIT_mA(policy->fast_limit_mA);
1268c0984e5SSebastian Reichel 		wm8350_reg_write(wm8350, WM8350_BATTERY_CHARGER_CONTROL_2,
1278c0984e5SSebastian Reichel 			    policy->charge_mV | policy->trickle_charge_mA |
1288c0984e5SSebastian Reichel 			    fast_limit_mA | wm8350_charge_time_min(wm8350,
1298c0984e5SSebastian Reichel 						policy->charge_timeout));
1308c0984e5SSebastian Reichel 	}
1318c0984e5SSebastian Reichel 
1328c0984e5SSebastian Reichel 	wm8350_reg_lock(wm8350);
1338c0984e5SSebastian Reichel 	return 0;
1348c0984e5SSebastian Reichel }
1358c0984e5SSebastian Reichel 
wm8350_batt_status(struct wm8350 * wm8350)1368c0984e5SSebastian Reichel static int wm8350_batt_status(struct wm8350 *wm8350)
1378c0984e5SSebastian Reichel {
1388c0984e5SSebastian Reichel 	u16 state;
1398c0984e5SSebastian Reichel 
1408c0984e5SSebastian Reichel 	state = wm8350_reg_read(wm8350, WM8350_BATTERY_CHARGER_CONTROL_2);
1418c0984e5SSebastian Reichel 	state &= WM8350_CHG_STS_MASK;
1428c0984e5SSebastian Reichel 
1438c0984e5SSebastian Reichel 	switch (state) {
1448c0984e5SSebastian Reichel 	case WM8350_CHG_STS_OFF:
1458c0984e5SSebastian Reichel 		return POWER_SUPPLY_STATUS_DISCHARGING;
1468c0984e5SSebastian Reichel 
1478c0984e5SSebastian Reichel 	case WM8350_CHG_STS_TRICKLE:
1488c0984e5SSebastian Reichel 	case WM8350_CHG_STS_FAST:
1498c0984e5SSebastian Reichel 		return POWER_SUPPLY_STATUS_CHARGING;
1508c0984e5SSebastian Reichel 
1518c0984e5SSebastian Reichel 	default:
1528c0984e5SSebastian Reichel 		return POWER_SUPPLY_STATUS_UNKNOWN;
1538c0984e5SSebastian Reichel 	}
1548c0984e5SSebastian Reichel }
1558c0984e5SSebastian Reichel 
charger_state_show(struct device * dev,struct device_attribute * attr,char * buf)1568c0984e5SSebastian Reichel static ssize_t charger_state_show(struct device *dev,
1578c0984e5SSebastian Reichel 				 struct device_attribute *attr, char *buf)
1588c0984e5SSebastian Reichel {
1598c0984e5SSebastian Reichel 	struct wm8350 *wm8350 = dev_get_drvdata(dev);
1608c0984e5SSebastian Reichel 	char *charge;
1618c0984e5SSebastian Reichel 	int state;
1628c0984e5SSebastian Reichel 
1638c0984e5SSebastian Reichel 	state = wm8350_reg_read(wm8350, WM8350_BATTERY_CHARGER_CONTROL_2) &
1648c0984e5SSebastian Reichel 	    WM8350_CHG_STS_MASK;
1658c0984e5SSebastian Reichel 	switch (state) {
1668c0984e5SSebastian Reichel 	case WM8350_CHG_STS_OFF:
1678c0984e5SSebastian Reichel 		charge = "Charger Off";
1688c0984e5SSebastian Reichel 		break;
1698c0984e5SSebastian Reichel 	case WM8350_CHG_STS_TRICKLE:
1708c0984e5SSebastian Reichel 		charge = "Trickle Charging";
1718c0984e5SSebastian Reichel 		break;
1728c0984e5SSebastian Reichel 	case WM8350_CHG_STS_FAST:
1738c0984e5SSebastian Reichel 		charge = "Fast Charging";
1748c0984e5SSebastian Reichel 		break;
1758c0984e5SSebastian Reichel 	default:
1768c0984e5SSebastian Reichel 		return 0;
1778c0984e5SSebastian Reichel 	}
1788c0984e5SSebastian Reichel 
179*a441f3b9Sye xingchen 	return sysfs_emit(buf, "%s\n", charge);
1808c0984e5SSebastian Reichel }
1818c0984e5SSebastian Reichel 
1828d4124cbSJulia Lawall static DEVICE_ATTR_RO(charger_state);
1838c0984e5SSebastian Reichel 
wm8350_charger_handler(int irq,void * data)1848c0984e5SSebastian Reichel static irqreturn_t wm8350_charger_handler(int irq, void *data)
1858c0984e5SSebastian Reichel {
1868c0984e5SSebastian Reichel 	struct wm8350 *wm8350 = data;
1878c0984e5SSebastian Reichel 	struct wm8350_power *power = &wm8350->power;
1888c0984e5SSebastian Reichel 	struct wm8350_charger_policy *policy = power->policy;
1898c0984e5SSebastian Reichel 
1908c0984e5SSebastian Reichel 	switch (irq - wm8350->irq_base) {
1918c0984e5SSebastian Reichel 	case WM8350_IRQ_CHG_BAT_FAIL:
1928c0984e5SSebastian Reichel 		dev_err(wm8350->dev, "battery failed\n");
1938c0984e5SSebastian Reichel 		break;
1948c0984e5SSebastian Reichel 	case WM8350_IRQ_CHG_TO:
1958c0984e5SSebastian Reichel 		dev_err(wm8350->dev, "charger timeout\n");
1968c0984e5SSebastian Reichel 		power_supply_changed(power->battery);
1978c0984e5SSebastian Reichel 		break;
1988c0984e5SSebastian Reichel 
1998c0984e5SSebastian Reichel 	case WM8350_IRQ_CHG_BAT_HOT:
2008c0984e5SSebastian Reichel 	case WM8350_IRQ_CHG_BAT_COLD:
2018c0984e5SSebastian Reichel 	case WM8350_IRQ_CHG_START:
2028c0984e5SSebastian Reichel 	case WM8350_IRQ_CHG_END:
2038c0984e5SSebastian Reichel 		power_supply_changed(power->battery);
2048c0984e5SSebastian Reichel 		break;
2058c0984e5SSebastian Reichel 
2068c0984e5SSebastian Reichel 	case WM8350_IRQ_CHG_FAST_RDY:
2078c0984e5SSebastian Reichel 		dev_dbg(wm8350->dev, "fast charger ready\n");
2088c0984e5SSebastian Reichel 		wm8350_charger_config(wm8350, policy);
2098c0984e5SSebastian Reichel 		wm8350_reg_unlock(wm8350);
2108c0984e5SSebastian Reichel 		wm8350_set_bits(wm8350, WM8350_BATTERY_CHARGER_CONTROL_1,
2118c0984e5SSebastian Reichel 				WM8350_CHG_FAST);
2128c0984e5SSebastian Reichel 		wm8350_reg_lock(wm8350);
2138c0984e5SSebastian Reichel 		break;
2148c0984e5SSebastian Reichel 
2158c0984e5SSebastian Reichel 	case WM8350_IRQ_CHG_VBATT_LT_3P9:
2168c0984e5SSebastian Reichel 		dev_warn(wm8350->dev, "battery < 3.9V\n");
2178c0984e5SSebastian Reichel 		break;
2188c0984e5SSebastian Reichel 	case WM8350_IRQ_CHG_VBATT_LT_3P1:
2198c0984e5SSebastian Reichel 		dev_warn(wm8350->dev, "battery < 3.1V\n");
2208c0984e5SSebastian Reichel 		break;
2218c0984e5SSebastian Reichel 	case WM8350_IRQ_CHG_VBATT_LT_2P85:
2228c0984e5SSebastian Reichel 		dev_warn(wm8350->dev, "battery < 2.85V\n");
2238c0984e5SSebastian Reichel 		break;
2248c0984e5SSebastian Reichel 
2258c0984e5SSebastian Reichel 		/* Supply change.  We will overnotify but it should do
2268c0984e5SSebastian Reichel 		 * no harm. */
2278c0984e5SSebastian Reichel 	case WM8350_IRQ_EXT_USB_FB:
2288c0984e5SSebastian Reichel 	case WM8350_IRQ_EXT_WALL_FB:
2298c0984e5SSebastian Reichel 		wm8350_charger_config(wm8350, policy);
230df561f66SGustavo A. R. Silva 		fallthrough;
23137bab356SGustavo A. R. Silva 	case WM8350_IRQ_EXT_BAT_FB:
2328c0984e5SSebastian Reichel 		power_supply_changed(power->battery);
2338c0984e5SSebastian Reichel 		power_supply_changed(power->usb);
2348c0984e5SSebastian Reichel 		power_supply_changed(power->ac);
2358c0984e5SSebastian Reichel 		break;
2368c0984e5SSebastian Reichel 
2378c0984e5SSebastian Reichel 	default:
2388c0984e5SSebastian Reichel 		dev_err(wm8350->dev, "Unknown interrupt %d\n", irq);
2398c0984e5SSebastian Reichel 	}
2408c0984e5SSebastian Reichel 
2418c0984e5SSebastian Reichel 	return IRQ_HANDLED;
2428c0984e5SSebastian Reichel }
2438c0984e5SSebastian Reichel 
2448c0984e5SSebastian Reichel /*********************************************************************
2458c0984e5SSebastian Reichel  *		AC Power
2468c0984e5SSebastian Reichel  *********************************************************************/
wm8350_ac_get_prop(struct power_supply * psy,enum power_supply_property psp,union power_supply_propval * val)2478c0984e5SSebastian Reichel static int wm8350_ac_get_prop(struct power_supply *psy,
2488c0984e5SSebastian Reichel 			      enum power_supply_property psp,
2498c0984e5SSebastian Reichel 			      union power_supply_propval *val)
2508c0984e5SSebastian Reichel {
2518c0984e5SSebastian Reichel 	struct wm8350 *wm8350 = dev_get_drvdata(psy->dev.parent);
2528c0984e5SSebastian Reichel 	int ret = 0;
2538c0984e5SSebastian Reichel 
2548c0984e5SSebastian Reichel 	switch (psp) {
2558c0984e5SSebastian Reichel 	case POWER_SUPPLY_PROP_ONLINE:
2568c0984e5SSebastian Reichel 		val->intval = !!(wm8350_get_supplies(wm8350) &
2578c0984e5SSebastian Reichel 				 WM8350_LINE_SUPPLY);
2588c0984e5SSebastian Reichel 		break;
2598c0984e5SSebastian Reichel 	case POWER_SUPPLY_PROP_VOLTAGE_NOW:
2608c0984e5SSebastian Reichel 		val->intval = wm8350_read_line_uvolts(wm8350);
2618c0984e5SSebastian Reichel 		break;
2628c0984e5SSebastian Reichel 	default:
2638c0984e5SSebastian Reichel 		ret = -EINVAL;
2648c0984e5SSebastian Reichel 		break;
2658c0984e5SSebastian Reichel 	}
2668c0984e5SSebastian Reichel 	return ret;
2678c0984e5SSebastian Reichel }
2688c0984e5SSebastian Reichel 
2698c0984e5SSebastian Reichel static enum power_supply_property wm8350_ac_props[] = {
2708c0984e5SSebastian Reichel 	POWER_SUPPLY_PROP_ONLINE,
2718c0984e5SSebastian Reichel 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
2728c0984e5SSebastian Reichel };
2738c0984e5SSebastian Reichel 
2748c0984e5SSebastian Reichel /*********************************************************************
2758c0984e5SSebastian Reichel  *		USB Power
2768c0984e5SSebastian Reichel  *********************************************************************/
wm8350_usb_get_prop(struct power_supply * psy,enum power_supply_property psp,union power_supply_propval * val)2778c0984e5SSebastian Reichel static int wm8350_usb_get_prop(struct power_supply *psy,
2788c0984e5SSebastian Reichel 			       enum power_supply_property psp,
2798c0984e5SSebastian Reichel 			       union power_supply_propval *val)
2808c0984e5SSebastian Reichel {
2818c0984e5SSebastian Reichel 	struct wm8350 *wm8350 = dev_get_drvdata(psy->dev.parent);
2828c0984e5SSebastian Reichel 	int ret = 0;
2838c0984e5SSebastian Reichel 
2848c0984e5SSebastian Reichel 	switch (psp) {
2858c0984e5SSebastian Reichel 	case POWER_SUPPLY_PROP_ONLINE:
2868c0984e5SSebastian Reichel 		val->intval = !!(wm8350_get_supplies(wm8350) &
2878c0984e5SSebastian Reichel 				 WM8350_USB_SUPPLY);
2888c0984e5SSebastian Reichel 		break;
2898c0984e5SSebastian Reichel 	case POWER_SUPPLY_PROP_VOLTAGE_NOW:
2908c0984e5SSebastian Reichel 		val->intval = wm8350_read_usb_uvolts(wm8350);
2918c0984e5SSebastian Reichel 		break;
2928c0984e5SSebastian Reichel 	default:
2938c0984e5SSebastian Reichel 		ret = -EINVAL;
2948c0984e5SSebastian Reichel 		break;
2958c0984e5SSebastian Reichel 	}
2968c0984e5SSebastian Reichel 	return ret;
2978c0984e5SSebastian Reichel }
2988c0984e5SSebastian Reichel 
2998c0984e5SSebastian Reichel static enum power_supply_property wm8350_usb_props[] = {
3008c0984e5SSebastian Reichel 	POWER_SUPPLY_PROP_ONLINE,
3018c0984e5SSebastian Reichel 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
3028c0984e5SSebastian Reichel };
3038c0984e5SSebastian Reichel 
3048c0984e5SSebastian Reichel /*********************************************************************
3058c0984e5SSebastian Reichel  *		Battery properties
3068c0984e5SSebastian Reichel  *********************************************************************/
3078c0984e5SSebastian Reichel 
wm8350_bat_check_health(struct wm8350 * wm8350)3088c0984e5SSebastian Reichel static int wm8350_bat_check_health(struct wm8350 *wm8350)
3098c0984e5SSebastian Reichel {
3108c0984e5SSebastian Reichel 	u16 reg;
3118c0984e5SSebastian Reichel 
3128c0984e5SSebastian Reichel 	if (wm8350_read_battery_uvolts(wm8350) < 2850000)
3138c0984e5SSebastian Reichel 		return POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
3148c0984e5SSebastian Reichel 
3158c0984e5SSebastian Reichel 	reg = wm8350_reg_read(wm8350, WM8350_CHARGER_OVERRIDES);
3168c0984e5SSebastian Reichel 	if (reg & WM8350_CHG_BATT_HOT_OVRDE)
3178c0984e5SSebastian Reichel 		return POWER_SUPPLY_HEALTH_OVERHEAT;
3188c0984e5SSebastian Reichel 
3198c0984e5SSebastian Reichel 	if (reg & WM8350_CHG_BATT_COLD_OVRDE)
3208c0984e5SSebastian Reichel 		return POWER_SUPPLY_HEALTH_COLD;
3218c0984e5SSebastian Reichel 
3228c0984e5SSebastian Reichel 	return POWER_SUPPLY_HEALTH_GOOD;
3238c0984e5SSebastian Reichel }
3248c0984e5SSebastian Reichel 
wm8350_bat_get_charge_type(struct wm8350 * wm8350)3258c0984e5SSebastian Reichel static int wm8350_bat_get_charge_type(struct wm8350 *wm8350)
3268c0984e5SSebastian Reichel {
3278c0984e5SSebastian Reichel 	int state;
3288c0984e5SSebastian Reichel 
3298c0984e5SSebastian Reichel 	state = wm8350_reg_read(wm8350, WM8350_BATTERY_CHARGER_CONTROL_2) &
3308c0984e5SSebastian Reichel 	    WM8350_CHG_STS_MASK;
3318c0984e5SSebastian Reichel 	switch (state) {
3328c0984e5SSebastian Reichel 	case WM8350_CHG_STS_OFF:
3338c0984e5SSebastian Reichel 		return POWER_SUPPLY_CHARGE_TYPE_NONE;
3348c0984e5SSebastian Reichel 	case WM8350_CHG_STS_TRICKLE:
3358c0984e5SSebastian Reichel 		return POWER_SUPPLY_CHARGE_TYPE_TRICKLE;
3368c0984e5SSebastian Reichel 	case WM8350_CHG_STS_FAST:
3378c0984e5SSebastian Reichel 		return POWER_SUPPLY_CHARGE_TYPE_FAST;
3388c0984e5SSebastian Reichel 	default:
3398c0984e5SSebastian Reichel 		return POWER_SUPPLY_CHARGE_TYPE_UNKNOWN;
3408c0984e5SSebastian Reichel 	}
3418c0984e5SSebastian Reichel }
3428c0984e5SSebastian Reichel 
wm8350_bat_get_property(struct power_supply * psy,enum power_supply_property psp,union power_supply_propval * val)3438c0984e5SSebastian Reichel static int wm8350_bat_get_property(struct power_supply *psy,
3448c0984e5SSebastian Reichel 				   enum power_supply_property psp,
3458c0984e5SSebastian Reichel 				   union power_supply_propval *val)
3468c0984e5SSebastian Reichel {
3478c0984e5SSebastian Reichel 	struct wm8350 *wm8350 = dev_get_drvdata(psy->dev.parent);
3488c0984e5SSebastian Reichel 	int ret = 0;
3498c0984e5SSebastian Reichel 
3508c0984e5SSebastian Reichel 	switch (psp) {
3518c0984e5SSebastian Reichel 	case POWER_SUPPLY_PROP_STATUS:
3528c0984e5SSebastian Reichel 		val->intval = wm8350_batt_status(wm8350);
3538c0984e5SSebastian Reichel 		break;
3548c0984e5SSebastian Reichel 	case POWER_SUPPLY_PROP_ONLINE:
3558c0984e5SSebastian Reichel 		val->intval = !!(wm8350_get_supplies(wm8350) &
3568c0984e5SSebastian Reichel 				 WM8350_BATT_SUPPLY);
3578c0984e5SSebastian Reichel 		break;
3588c0984e5SSebastian Reichel 	case POWER_SUPPLY_PROP_VOLTAGE_NOW:
3598c0984e5SSebastian Reichel 		val->intval = wm8350_read_battery_uvolts(wm8350);
3608c0984e5SSebastian Reichel 		break;
3618c0984e5SSebastian Reichel 	case POWER_SUPPLY_PROP_HEALTH:
3628c0984e5SSebastian Reichel 		val->intval = wm8350_bat_check_health(wm8350);
3638c0984e5SSebastian Reichel 		break;
3648c0984e5SSebastian Reichel 	case POWER_SUPPLY_PROP_CHARGE_TYPE:
3658c0984e5SSebastian Reichel 		val->intval = wm8350_bat_get_charge_type(wm8350);
3668c0984e5SSebastian Reichel 		break;
3678c0984e5SSebastian Reichel 	default:
3688c0984e5SSebastian Reichel 		ret = -EINVAL;
3698c0984e5SSebastian Reichel 		break;
3708c0984e5SSebastian Reichel 	}
3718c0984e5SSebastian Reichel 
3728c0984e5SSebastian Reichel 	return ret;
3738c0984e5SSebastian Reichel }
3748c0984e5SSebastian Reichel 
3758c0984e5SSebastian Reichel static enum power_supply_property wm8350_bat_props[] = {
3768c0984e5SSebastian Reichel 	POWER_SUPPLY_PROP_STATUS,
3778c0984e5SSebastian Reichel 	POWER_SUPPLY_PROP_ONLINE,
3788c0984e5SSebastian Reichel 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
3798c0984e5SSebastian Reichel 	POWER_SUPPLY_PROP_HEALTH,
3808c0984e5SSebastian Reichel 	POWER_SUPPLY_PROP_CHARGE_TYPE,
3818c0984e5SSebastian Reichel };
3828c0984e5SSebastian Reichel 
3838c0984e5SSebastian Reichel static const struct power_supply_desc wm8350_ac_desc = {
3848c0984e5SSebastian Reichel 	.name		= "wm8350-ac",
3858c0984e5SSebastian Reichel 	.type		= POWER_SUPPLY_TYPE_MAINS,
3868c0984e5SSebastian Reichel 	.properties	= wm8350_ac_props,
3878c0984e5SSebastian Reichel 	.num_properties	= ARRAY_SIZE(wm8350_ac_props),
3888c0984e5SSebastian Reichel 	.get_property	= wm8350_ac_get_prop,
3898c0984e5SSebastian Reichel };
3908c0984e5SSebastian Reichel 
3918c0984e5SSebastian Reichel static const struct power_supply_desc wm8350_battery_desc = {
3928c0984e5SSebastian Reichel 	.name		= "wm8350-battery",
3938c0984e5SSebastian Reichel 	.properties	= wm8350_bat_props,
3948c0984e5SSebastian Reichel 	.num_properties	= ARRAY_SIZE(wm8350_bat_props),
3958c0984e5SSebastian Reichel 	.get_property	= wm8350_bat_get_property,
3968c0984e5SSebastian Reichel 	.use_for_apm	= 1,
3978c0984e5SSebastian Reichel };
3988c0984e5SSebastian Reichel 
3998c0984e5SSebastian Reichel static const struct power_supply_desc wm8350_usb_desc = {
4008c0984e5SSebastian Reichel 	.name		= "wm8350-usb",
4018c0984e5SSebastian Reichel 	.type		= POWER_SUPPLY_TYPE_USB,
4028c0984e5SSebastian Reichel 	.properties	= wm8350_usb_props,
4038c0984e5SSebastian Reichel 	.num_properties	= ARRAY_SIZE(wm8350_usb_props),
4048c0984e5SSebastian Reichel 	.get_property	= wm8350_usb_get_prop,
4058c0984e5SSebastian Reichel };
4068c0984e5SSebastian Reichel 
4078c0984e5SSebastian Reichel /*********************************************************************
4088c0984e5SSebastian Reichel  *		Initialisation
4098c0984e5SSebastian Reichel  *********************************************************************/
4108c0984e5SSebastian Reichel 
wm8350_init_charger(struct wm8350 * wm8350)411b0b14b5bSJiasheng Jiang static int wm8350_init_charger(struct wm8350 *wm8350)
4128c0984e5SSebastian Reichel {
413b0b14b5bSJiasheng Jiang 	int ret;
414b0b14b5bSJiasheng Jiang 
4158c0984e5SSebastian Reichel 	/* register our interest in charger events */
416b0b14b5bSJiasheng Jiang 	ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT,
4178c0984e5SSebastian Reichel 			    wm8350_charger_handler, 0, "Battery hot", wm8350);
418b0b14b5bSJiasheng Jiang 	if (ret)
419b0b14b5bSJiasheng Jiang 		goto err;
420b0b14b5bSJiasheng Jiang 
421b0b14b5bSJiasheng Jiang 	ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD,
4228c0984e5SSebastian Reichel 			    wm8350_charger_handler, 0, "Battery cold", wm8350);
423b0b14b5bSJiasheng Jiang 	if (ret)
424b0b14b5bSJiasheng Jiang 		goto free_chg_bat_hot;
425b0b14b5bSJiasheng Jiang 
426b0b14b5bSJiasheng Jiang 	ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL,
4278c0984e5SSebastian Reichel 			    wm8350_charger_handler, 0, "Battery fail", wm8350);
428b0b14b5bSJiasheng Jiang 	if (ret)
429b0b14b5bSJiasheng Jiang 		goto free_chg_bat_cold;
430b0b14b5bSJiasheng Jiang 
431b0b14b5bSJiasheng Jiang 	ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_TO,
4328c0984e5SSebastian Reichel 			    wm8350_charger_handler, 0,
4338c0984e5SSebastian Reichel 			    "Charger timeout", wm8350);
434b0b14b5bSJiasheng Jiang 	if (ret)
435b0b14b5bSJiasheng Jiang 		goto free_chg_bat_fail;
436b0b14b5bSJiasheng Jiang 
437b0b14b5bSJiasheng Jiang 	ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_END,
4388c0984e5SSebastian Reichel 			    wm8350_charger_handler, 0,
4398c0984e5SSebastian Reichel 			    "Charge end", wm8350);
440b0b14b5bSJiasheng Jiang 	if (ret)
441b0b14b5bSJiasheng Jiang 		goto free_chg_to;
442b0b14b5bSJiasheng Jiang 
443b0b14b5bSJiasheng Jiang 	ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_START,
4448c0984e5SSebastian Reichel 			    wm8350_charger_handler, 0,
4458c0984e5SSebastian Reichel 			    "Charge start", wm8350);
446b0b14b5bSJiasheng Jiang 	if (ret)
447b0b14b5bSJiasheng Jiang 		goto free_chg_end;
448b0b14b5bSJiasheng Jiang 
449b0b14b5bSJiasheng Jiang 	ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY,
4508c0984e5SSebastian Reichel 			    wm8350_charger_handler, 0,
4518c0984e5SSebastian Reichel 			    "Fast charge ready", wm8350);
452b0b14b5bSJiasheng Jiang 	if (ret)
453b0b14b5bSJiasheng Jiang 		goto free_chg_start;
454b0b14b5bSJiasheng Jiang 
455b0b14b5bSJiasheng Jiang 	ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9,
4568c0984e5SSebastian Reichel 			    wm8350_charger_handler, 0,
4578c0984e5SSebastian Reichel 			    "Battery <3.9V", wm8350);
458b0b14b5bSJiasheng Jiang 	if (ret)
459b0b14b5bSJiasheng Jiang 		goto free_chg_fast_rdy;
460b0b14b5bSJiasheng Jiang 
461b0b14b5bSJiasheng Jiang 	ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1,
4628c0984e5SSebastian Reichel 			    wm8350_charger_handler, 0,
4638c0984e5SSebastian Reichel 			    "Battery <3.1V", wm8350);
464b0b14b5bSJiasheng Jiang 	if (ret)
465b0b14b5bSJiasheng Jiang 		goto free_chg_vbatt_lt_3p9;
466b0b14b5bSJiasheng Jiang 
467b0b14b5bSJiasheng Jiang 	ret = wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85,
4688c0984e5SSebastian Reichel 			    wm8350_charger_handler, 0,
4698c0984e5SSebastian Reichel 			    "Battery <2.85V", wm8350);
470b0b14b5bSJiasheng Jiang 	if (ret)
471b0b14b5bSJiasheng Jiang 		goto free_chg_vbatt_lt_3p1;
4728c0984e5SSebastian Reichel 
4738c0984e5SSebastian Reichel 	/* and supply change events */
474b0b14b5bSJiasheng Jiang 	ret = wm8350_register_irq(wm8350, WM8350_IRQ_EXT_USB_FB,
4758c0984e5SSebastian Reichel 			    wm8350_charger_handler, 0, "USB", wm8350);
476b0b14b5bSJiasheng Jiang 	if (ret)
477b0b14b5bSJiasheng Jiang 		goto free_chg_vbatt_lt_2p85;
478b0b14b5bSJiasheng Jiang 
479b0b14b5bSJiasheng Jiang 	ret = wm8350_register_irq(wm8350, WM8350_IRQ_EXT_WALL_FB,
4808c0984e5SSebastian Reichel 			    wm8350_charger_handler, 0, "Wall", wm8350);
481b0b14b5bSJiasheng Jiang 	if (ret)
482b0b14b5bSJiasheng Jiang 		goto free_ext_usb_fb;
483b0b14b5bSJiasheng Jiang 
484b0b14b5bSJiasheng Jiang 	ret = wm8350_register_irq(wm8350, WM8350_IRQ_EXT_BAT_FB,
4858c0984e5SSebastian Reichel 			    wm8350_charger_handler, 0, "Battery", wm8350);
486b0b14b5bSJiasheng Jiang 	if (ret)
487b0b14b5bSJiasheng Jiang 		goto free_ext_wall_fb;
488b0b14b5bSJiasheng Jiang 
489b0b14b5bSJiasheng Jiang 	return 0;
490b0b14b5bSJiasheng Jiang 
491b0b14b5bSJiasheng Jiang free_ext_wall_fb:
492b0b14b5bSJiasheng Jiang 	wm8350_free_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, wm8350);
493b0b14b5bSJiasheng Jiang free_ext_usb_fb:
494b0b14b5bSJiasheng Jiang 	wm8350_free_irq(wm8350, WM8350_IRQ_EXT_USB_FB, wm8350);
495b0b14b5bSJiasheng Jiang free_chg_vbatt_lt_2p85:
496b0b14b5bSJiasheng Jiang 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, wm8350);
497b0b14b5bSJiasheng Jiang free_chg_vbatt_lt_3p1:
498b0b14b5bSJiasheng Jiang 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, wm8350);
499b0b14b5bSJiasheng Jiang free_chg_vbatt_lt_3p9:
500b0b14b5bSJiasheng Jiang 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, wm8350);
501b0b14b5bSJiasheng Jiang free_chg_fast_rdy:
502b0b14b5bSJiasheng Jiang 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, wm8350);
503b0b14b5bSJiasheng Jiang free_chg_start:
504b0b14b5bSJiasheng Jiang 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_START, wm8350);
505b0b14b5bSJiasheng Jiang free_chg_end:
506b0b14b5bSJiasheng Jiang 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_END, wm8350);
507b0b14b5bSJiasheng Jiang free_chg_to:
508b0b14b5bSJiasheng Jiang 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_TO, wm8350);
509b0b14b5bSJiasheng Jiang free_chg_bat_fail:
510b0b14b5bSJiasheng Jiang 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, wm8350);
511b0b14b5bSJiasheng Jiang free_chg_bat_cold:
512b0b14b5bSJiasheng Jiang 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, wm8350);
513b0b14b5bSJiasheng Jiang free_chg_bat_hot:
514b0b14b5bSJiasheng Jiang 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, wm8350);
515b0b14b5bSJiasheng Jiang err:
516b0b14b5bSJiasheng Jiang 	return ret;
5178c0984e5SSebastian Reichel }
5188c0984e5SSebastian Reichel 
free_charger_irq(struct wm8350 * wm8350)5198c0984e5SSebastian Reichel static void free_charger_irq(struct wm8350 *wm8350)
5208c0984e5SSebastian Reichel {
5218c0984e5SSebastian Reichel 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, wm8350);
5228c0984e5SSebastian Reichel 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, wm8350);
5238c0984e5SSebastian Reichel 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, wm8350);
5248c0984e5SSebastian Reichel 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_TO, wm8350);
5258c0984e5SSebastian Reichel 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_END, wm8350);
5268c0984e5SSebastian Reichel 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_START, wm8350);
5276dee930fSJiasheng Jiang 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, wm8350);
5288c0984e5SSebastian Reichel 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, wm8350);
5298c0984e5SSebastian Reichel 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, wm8350);
5308c0984e5SSebastian Reichel 	wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, wm8350);
5318c0984e5SSebastian Reichel 	wm8350_free_irq(wm8350, WM8350_IRQ_EXT_USB_FB, wm8350);
5328c0984e5SSebastian Reichel 	wm8350_free_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, wm8350);
5338c0984e5SSebastian Reichel 	wm8350_free_irq(wm8350, WM8350_IRQ_EXT_BAT_FB, wm8350);
5348c0984e5SSebastian Reichel }
5358c0984e5SSebastian Reichel 
wm8350_power_probe(struct platform_device * pdev)5368c0984e5SSebastian Reichel static int wm8350_power_probe(struct platform_device *pdev)
5378c0984e5SSebastian Reichel {
5388c0984e5SSebastian Reichel 	struct wm8350 *wm8350 = platform_get_drvdata(pdev);
5398c0984e5SSebastian Reichel 	struct wm8350_power *power = &wm8350->power;
5408c0984e5SSebastian Reichel 	struct wm8350_charger_policy *policy = power->policy;
5418c0984e5SSebastian Reichel 	int ret;
5428c0984e5SSebastian Reichel 
5438c0984e5SSebastian Reichel 	power->ac = power_supply_register(&pdev->dev, &wm8350_ac_desc, NULL);
5448c0984e5SSebastian Reichel 	if (IS_ERR(power->ac))
5458c0984e5SSebastian Reichel 		return PTR_ERR(power->ac);
5468c0984e5SSebastian Reichel 
5478c0984e5SSebastian Reichel 	power->battery = power_supply_register(&pdev->dev, &wm8350_battery_desc,
5488c0984e5SSebastian Reichel 					       NULL);
5498c0984e5SSebastian Reichel 	if (IS_ERR(power->battery)) {
5508c0984e5SSebastian Reichel 		ret = PTR_ERR(power->battery);
5518c0984e5SSebastian Reichel 		goto battery_failed;
5528c0984e5SSebastian Reichel 	}
5538c0984e5SSebastian Reichel 
5548c0984e5SSebastian Reichel 	power->usb = power_supply_register(&pdev->dev, &wm8350_usb_desc, NULL);
5558c0984e5SSebastian Reichel 	if (IS_ERR(power->usb)) {
5568c0984e5SSebastian Reichel 		ret = PTR_ERR(power->usb);
5578c0984e5SSebastian Reichel 		goto usb_failed;
5588c0984e5SSebastian Reichel 	}
5598c0984e5SSebastian Reichel 
5608c0984e5SSebastian Reichel 	ret = device_create_file(&pdev->dev, &dev_attr_charger_state);
5618c0984e5SSebastian Reichel 	if (ret < 0)
5628c0984e5SSebastian Reichel 		dev_warn(wm8350->dev, "failed to add charge sysfs: %d\n", ret);
5638c0984e5SSebastian Reichel 	ret = 0;
5648c0984e5SSebastian Reichel 
5658c0984e5SSebastian Reichel 	wm8350_init_charger(wm8350);
5668c0984e5SSebastian Reichel 	if (wm8350_charger_config(wm8350, policy) == 0) {
5678c0984e5SSebastian Reichel 		wm8350_reg_unlock(wm8350);
5688c0984e5SSebastian Reichel 		wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CHG_ENA);
5698c0984e5SSebastian Reichel 		wm8350_reg_lock(wm8350);
5708c0984e5SSebastian Reichel 	}
5718c0984e5SSebastian Reichel 
5728c0984e5SSebastian Reichel 	return ret;
5738c0984e5SSebastian Reichel 
5748c0984e5SSebastian Reichel usb_failed:
5758c0984e5SSebastian Reichel 	power_supply_unregister(power->battery);
5768c0984e5SSebastian Reichel battery_failed:
5778c0984e5SSebastian Reichel 	power_supply_unregister(power->ac);
5788c0984e5SSebastian Reichel 
5798c0984e5SSebastian Reichel 	return ret;
5808c0984e5SSebastian Reichel }
5818c0984e5SSebastian Reichel 
wm8350_power_remove(struct platform_device * pdev)5828c0984e5SSebastian Reichel static int wm8350_power_remove(struct platform_device *pdev)
5838c0984e5SSebastian Reichel {
5848c0984e5SSebastian Reichel 	struct wm8350 *wm8350 = platform_get_drvdata(pdev);
5858c0984e5SSebastian Reichel 	struct wm8350_power *power = &wm8350->power;
5868c0984e5SSebastian Reichel 
5878c0984e5SSebastian Reichel 	free_charger_irq(wm8350);
5888c0984e5SSebastian Reichel 	device_remove_file(&pdev->dev, &dev_attr_charger_state);
5898c0984e5SSebastian Reichel 	power_supply_unregister(power->battery);
5908c0984e5SSebastian Reichel 	power_supply_unregister(power->ac);
5918c0984e5SSebastian Reichel 	power_supply_unregister(power->usb);
5928c0984e5SSebastian Reichel 	return 0;
5938c0984e5SSebastian Reichel }
5948c0984e5SSebastian Reichel 
5958c0984e5SSebastian Reichel static struct platform_driver wm8350_power_driver = {
5968c0984e5SSebastian Reichel 	.probe = wm8350_power_probe,
5978c0984e5SSebastian Reichel 	.remove = wm8350_power_remove,
5988c0984e5SSebastian Reichel 	.driver = {
5998c0984e5SSebastian Reichel 		.name = "wm8350-power",
6008c0984e5SSebastian Reichel 	},
6018c0984e5SSebastian Reichel };
6028c0984e5SSebastian Reichel 
6038c0984e5SSebastian Reichel module_platform_driver(wm8350_power_driver);
6048c0984e5SSebastian Reichel 
6058c0984e5SSebastian Reichel MODULE_LICENSE("GPL");
6068c0984e5SSebastian Reichel MODULE_DESCRIPTION("Power supply driver for WM8350");
6078c0984e5SSebastian Reichel MODULE_ALIAS("platform:wm8350-power");
608