59 lines
1.6 KiB
Diff
59 lines
1.6 KiB
Diff
diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c
|
|
index 6e9592c2..0121a819 100644
|
|
--- a/drivers/regulator/act8865-regulator.c
|
|
+++ b/drivers/regulator/act8865-regulator.c
|
|
@@ -27,6 +27,7 @@
|
|
#include <linux/of_device.h>
|
|
#include <linux/regulator/of_regulator.h>
|
|
#include <linux/regmap.h>
|
|
+#include <linux/reboot.h>
|
|
|
|
/*
|
|
* ACT8600 Global Register Map.
|
|
@@ -133,6 +134,8 @@
|
|
#define ACT8865_VOLTAGE_NUM 64
|
|
#define ACT8600_SUDCDC_VOLTAGE_NUM 255
|
|
|
|
+#define ACT8846_SIPC_MASK 0x01
|
|
+
|
|
struct act8865 {
|
|
struct regmap *regmap;
|
|
int off_reg;
|
|
@@ -412,6 +415,21 @@ static void act8865_power_off(void)
|
|
while (1);
|
|
}
|
|
|
|
+static int act8846_power_cycle(struct notifier_block *this,
|
|
+ unsigned long code, void *unused)
|
|
+{
|
|
+ struct act8865 *act8846;
|
|
+ act8846 = i2c_get_clientdata(act8865_i2c_client);
|
|
+ regmap_write(act8846->regmap, ACT8846_GLB_OFF_CTRL, ACT8846_SIPC_MASK);
|
|
+
|
|
+ return NOTIFY_DONE;
|
|
+}
|
|
+
|
|
+static struct notifier_block act8846_restart_handler = {
|
|
+ .notifier_call = act8846_power_cycle,
|
|
+ .priority = 129,
|
|
+};
|
|
+
|
|
static int act8865_pmic_probe(struct i2c_client *client,
|
|
const struct i2c_device_id *i2c_id)
|
|
{
|
|
@@ -512,6 +530,14 @@ static int act8865_pmic_probe(struct i2c_client *client,
|
|
} else {
|
|
dev_err(dev, "Failed to set poweroff capability\n");
|
|
}
|
|
+
|
|
+ if (type == ACT8846) {
|
|
+ act8865_i2c_client = client;
|
|
+ ret = register_restart_handler(&act8846_restart_handler);
|
|
+ if (ret)
|
|
+ pr_err("%s: cannot register restart handler, %d\n",
|
|
+ __func__, ret);
|
|
+ }
|
|
}
|
|
|
|
/* Finally register devices */
|