48 lines
1.3 KiB
Diff
48 lines
1.3 KiB
Diff
|
From f83aab50e22ba523f29c7e3139af5eeaf4d7915a Mon Sep 17 00:00:00 2001
|
||
|
From: Ondrej Jirman <megi@xff.cz>
|
||
|
Date: Mon, 19 Jun 2023 01:41:02 +0200
|
||
|
Subject: [PATCH 372/464] 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 a424cd13ca68..56bbfb175f38 100644
|
||
|
--- a/drivers/mfd/rk8xx-core.c
|
||
|
+++ b/drivers/mfd/rk8xx-core.c
|
||
|
@@ -528,6 +528,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
|
||
|
|