mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
* import new layout for libreelec patches (no more mbox) * refactor existing patches to kernel 6.17 * fix uboot issue causing VOP IOMMU page fault and no screen
83 lines
2.1 KiB
Diff
83 lines
2.1 KiB
Diff
From 7f2d6a02498ce3fa7771893072e81b31f9bd64b2 Mon Sep 17 00:00:00 2001
|
|
From: Paolo Sabatino <paolo.sabatino@gmail.com>
|
|
Date: Fri, 24 Mar 2023 17:15:16 +0000
|
|
Subject: [PATCH] register act8846 restart handler for SIPC function
|
|
|
|
---
|
|
drivers/regulator/act8865-regulator.c | 27 +++++++++++++++++++++++++++
|
|
1 file changed, 27 insertions(+)
|
|
|
|
diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c
|
|
index b2a6ddc6f56d..1a88cfb1ba07 100644
|
|
--- a/drivers/regulator/act8865-regulator.c
|
|
+++ b/drivers/regulator/act8865-regulator.c
|
|
@@ -20,6 +20,7 @@
|
|
#include <linux/regulator/of_regulator.h>
|
|
#include <linux/regmap.h>
|
|
#include <dt-bindings/regulator/active-semi,8865-regulator.h>
|
|
+#include <linux/reboot.h>
|
|
|
|
/*
|
|
* ACT8600 Global Register Map.
|
|
@@ -141,6 +142,8 @@
|
|
#define ACT8865_VOLTAGE_NUM 64
|
|
#define ACT8600_SUDCDC_VOLTAGE_NUM 256
|
|
|
|
+#define ACT8846_SIPC_MASK 0x01
|
|
+
|
|
struct act8865 {
|
|
struct regmap *regmap;
|
|
int off_reg;
|
|
@@ -582,6 +585,32 @@ 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;
|
|
+
|
|
+ pr_info("act8846 restart handler, code: %ld\n", code);
|
|
+
|
|
+ if (code == SYS_RESTART) {
|
|
+
|
|
+ pr_info("act8846 restarting via SIPC\n");
|
|
+
|
|
+ act8846 = i2c_get_clientdata(act8865_i2c_client);
|
|
+ regmap_write(act8846->regmap, ACT8846_GLB_OFF_CTRL, ACT8846_SIPC_MASK);
|
|
+
|
|
+ return NOTIFY_OK;
|
|
+
|
|
+ }
|
|
+
|
|
+ return NOTIFY_DONE;
|
|
+}
|
|
+
|
|
+static struct notifier_block act8846_restart_handler = {
|
|
+ .notifier_call = act8846_power_cycle,
|
|
+ .priority = 255,
|
|
+};
|
|
+
|
|
static int act8600_charger_get_status(struct regmap *map)
|
|
{
|
|
unsigned int val;
|
|
@@ -731,6 +760,15 @@ static int act8865_pmic_probe(struct i2c_client *client)
|
|
} else {
|
|
dev_err(dev, "Failed to set poweroff capability, already defined\n");
|
|
}
|
|
+
|
|
+ if (type == ACT8846) {
|
|
+ act8865_i2c_client = client;
|
|
+ ret = register_reboot_notifier(&act8846_restart_handler);
|
|
+ pr_err("act8846 restart handler registered\n");
|
|
+ if (ret)
|
|
+ pr_err("%s: cannot register restart handler, %d\n",
|
|
+ __func__, ret);
|
|
+ }
|
|
}
|
|
|
|
/* Finally register devices */
|
|
--
|
|
2.34.1
|
|
|