build/patch/kernel/archive/sunxi-6.4/patches.megous/mfd-rk8xx-Add-support-for-RK806-power-off.patch

48 lines
1.3 KiB
Diff
Raw Permalink Normal View History

From b921a321a29a605cdfe4baf5ce771e49f630dcc9 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Mon, 19 Jun 2023 01:41:02 +0200
Subject: [PATCH 468/469] mfd: rk8xx: Add support for RK806 power off
Use DEV_OFF bit to power off the PMIC, when rockchip,system-power-controller
is selected in DTS.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/mfd/rk8xx-core.c | 6 ++++++
include/linux/mfd/rk808.h | 2 ++
2 files changed, 8 insertions(+)
diff --git a/drivers/mfd/rk8xx-core.c b/drivers/mfd/rk8xx-core.c
index 67f529d583b0..99d07b36b003 100644
--- a/drivers/mfd/rk8xx-core.c
+++ b/drivers/mfd/rk8xx-core.c
@@ -529,6 +529,12 @@ static int rk808_power_off(struct sys_off_data *data)
reg = RK805_DEV_CTRL_REG;
bit = DEV_OFF;
break;
+ case RK806_ID:
+ ret = regmap_write(rk808->regmap, RK806_SYS_CFG3, RK806_DEV_OFF);
+ if (ret)
+ dev_err(rk808->dev, "Failed to shutdown device!\n");
+
+ return NOTIFY_DONE;
case RK808_ID:
reg = RK808_DEVCTRL_REG,
bit = DEV_OFF_RST;
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index e06ecffaf6bc..76642f60bafa 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -634,6 +634,8 @@ enum rk805_reg {
#define RK806_CMD_LEN_MSK 0x0f
#define RK806_REG_H 0x00
+#define RK806_DEV_OFF 0x01
+
#define VERSION_AB 0x01
enum rk806_reg_id {
--
2.34.1