aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/da9063-core.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-06-23 17:31:27 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-23 17:31:27 -0700
commit84e9c87e6ffc519fdf91949482a65672a7314c9a (patch)
tree29775d71f1f58c41365ce597192524cf5544b340 /drivers/mfd/da9063-core.c
parentMerge tag 'regulator-v4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator (diff)
parentmfd: lpc_ich: Assign subdevice ids automatically (diff)
downloadlinux-dev-84e9c87e6ffc519fdf91949482a65672a7314c9a.tar.xz
linux-dev-84e9c87e6ffc519fdf91949482a65672a7314c9a.zip
Merge tag 'mfd-for-linus-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD updates from Lee Jones: "Changes to existing drivers: - Constify structures; throughout the subsystem - Move support to DT in; cros_ec - DT changes and documentation; cros-ec, max77693, max77686, arizona, da9063 - ACPI changes and documentation; mfd-core - Use different platform specific API in; cros_ec_*, arizona-core - Remove unused parent field from; cros_ec_i2c - Add wake-up/reset delay in; cross_ec_spi, arizona-core - Staticise structures/functions in; cros_ec - Remove redundant code; arizona-core, max77686 - Bugfix; twl4030-power - Allow compile test; aat2870, tps65910 - MAINTAINERS adaptions; samsung, syscon - Resource Management (devm_*); arizona-core - Refactor Reset code; arizona-core - Insist on at least one full boot; arizona-core - Trivial formatting; arizona-core - Add low-power-sleep; arizona-core - IRQ ONESHOT changes; twl4030-irq, mc13xxx-core, wm831x-auxadc, htc-i2cpld, wm8350-core, ab8500-debugfs, ab8500-gpadc, si476x-i2c (Re-)moved drivers: - Move protocol helpers out to drivers/platform; cros_ec New drivers/supported devices: - Add support for AXP22x into axp20x - Add support for OnKey into da9063-core - Add support for Pinctrl into mt6397-core - New STMicroelectronics LPC Watchdog driver - New STMicroelectronics LPC Real-Time Clock driver" * tag 'mfd-for-linus-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (59 commits) mfd: lpc_ich: Assign subdevice ids automatically mfd: si476x-i2c: Pass the IRQF_ONESHOT flag mfd: ab8500-gpadc: Pass the IRQF_ONESHOT flag mfd: ab8500-debugfs: Pass the IRQF_ONESHOT flag mfd: wm8350-core: Pass the IRQF_ONESHOT flag mfd: htc-i2cpld: Pass the IRQF_ONESHOT flag mfd: wm831x-auxadc: Pass the IRQF_ONESHOT flag mfd: mc13xxx-core: Pass the IRQF_ONESHOT flag mfd: twl4030-irq: Pass the IRQF_ONESHOT flag mfd: mt6397-core: Add GPIO sub-module support mfd: arizona: Add convience defines for micd_rate/micd_bias_starttime mfd: dt: Add bindings for DA9063 OnKey mfd: da9063: Add support for OnKey driver mfd: arizona: Fix incorrect Makefile conditionals mfd: arizona: Add stub for wm5102_patch() mfd: Check ACPI device companion before checking resources Documentation: Add WM8998/WM1814 device tree bindings mfd: arizona: Split INx_MODE into two fields mfd: wm5110: Add delay before releasing reset line mfd: arizona: Add better support for system suspend ...
Diffstat (limited to 'drivers/mfd/da9063-core.c')
-rw-r--r--drivers/mfd/da9063-core.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/drivers/mfd/da9063-core.c b/drivers/mfd/da9063-core.c
index facd3610ac77..af841c165787 100644
--- a/drivers/mfd/da9063-core.c
+++ b/drivers/mfd/da9063-core.c
@@ -60,6 +60,7 @@ static struct resource da9063_rtc_resources[] = {
static struct resource da9063_onkey_resources[] = {
{
+ .name = "ONKEY",
.start = DA9063_IRQ_ONKEY,
.end = DA9063_IRQ_ONKEY,
.flags = IORESOURCE_IRQ,
@@ -97,6 +98,7 @@ static const struct mfd_cell da9063_devs[] = {
.name = DA9063_DRVNAME_ONKEY,
.num_resources = ARRAY_SIZE(da9063_onkey_resources),
.resources = da9063_onkey_resources,
+ .of_compatible = "dlg,da9063-onkey",
},
{
.name = DA9063_DRVNAME_RTC,
@@ -109,12 +111,64 @@ static const struct mfd_cell da9063_devs[] = {
},
};
+static int da9063_clear_fault_log(struct da9063 *da9063)
+{
+ int ret = 0;
+ int fault_log = 0;
+
+ ret = regmap_read(da9063->regmap, DA9063_REG_FAULT_LOG, &fault_log);
+ if (ret < 0) {
+ dev_err(da9063->dev, "Cannot read FAULT_LOG.\n");
+ return -EIO;
+ }
+
+ if (fault_log) {
+ if (fault_log & DA9063_TWD_ERROR)
+ dev_dbg(da9063->dev,
+ "Fault log entry detected: DA9063_TWD_ERROR\n");
+ if (fault_log & DA9063_POR)
+ dev_dbg(da9063->dev,
+ "Fault log entry detected: DA9063_POR\n");
+ if (fault_log & DA9063_VDD_FAULT)
+ dev_dbg(da9063->dev,
+ "Fault log entry detected: DA9063_VDD_FAULT\n");
+ if (fault_log & DA9063_VDD_START)
+ dev_dbg(da9063->dev,
+ "Fault log entry detected: DA9063_VDD_START\n");
+ if (fault_log & DA9063_TEMP_CRIT)
+ dev_dbg(da9063->dev,
+ "Fault log entry detected: DA9063_TEMP_CRIT\n");
+ if (fault_log & DA9063_KEY_RESET)
+ dev_dbg(da9063->dev,
+ "Fault log entry detected: DA9063_KEY_RESET\n");
+ if (fault_log & DA9063_NSHUTDOWN)
+ dev_dbg(da9063->dev,
+ "Fault log entry detected: DA9063_NSHUTDOWN\n");
+ if (fault_log & DA9063_WAIT_SHUT)
+ dev_dbg(da9063->dev,
+ "Fault log entry detected: DA9063_WAIT_SHUT\n");
+ }
+
+ ret = regmap_write(da9063->regmap,
+ DA9063_REG_FAULT_LOG,
+ fault_log);
+ if (ret < 0)
+ dev_err(da9063->dev,
+ "Cannot reset FAULT_LOG values %d\n", ret);
+
+ return ret;
+}
+
int da9063_device_init(struct da9063 *da9063, unsigned int irq)
{
struct da9063_pdata *pdata = da9063->dev->platform_data;
int model, variant_id, variant_code;
int ret;
+ ret = da9063_clear_fault_log(da9063);
+ if (ret < 0)
+ dev_err(da9063->dev, "Cannot clear fault log\n");
+
if (pdata) {
da9063->flags = pdata->flags;
da9063->irq_base = pdata->irq_base;