soc: rockchip: pm_config: support sleep_io_config

Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
Change-Id: Idbb08bb3f7c1deff8e53348dbee1a13785568b75
This commit is contained in:
XiaoDong Huang
2023-12-18 09:57:23 +08:00
committed by Tao Huang
parent 945dd8e6cb
commit f109558947
2 changed files with 35 additions and 0 deletions
+33
View File
@@ -374,6 +374,38 @@ out:
return ret;
}
static int parse_io_config(struct device *dev)
{
int ret = 0, cnt;
struct device_node *node = dev->of_node;
struct rk_sleep_config *config = &sleep_config[RK_PM_MEM];
cnt = of_property_count_u32_elems(node, "rockchip,sleep-io-config");
if (cnt > 0) {
/* 0 as the last element of virtual_pwroff_irqs */
config->sleep_io_config =
devm_kmalloc_array(dev, cnt, sizeof(u32), GFP_KERNEL);
if (!config->sleep_io_config) {
ret = -ENOMEM;
goto out;
}
ret = of_property_read_u32_array(node, "rockchip,sleep-io-config",
config->sleep_io_config, cnt);
if (ret) {
dev_err(dev, "get rockchip,sleep-io-config error\n");
goto out;
}
config->sleep_io_config_cnt = cnt;
} else {
dev_dbg(dev, "not set sleep-pin-config\n");
}
out:
return ret;
}
static int pm_config_probe(struct platform_device *pdev)
{
const struct of_device_id *match_id;
@@ -488,6 +520,7 @@ static int pm_config_probe(struct platform_device *pdev)
ret);
}
parse_io_config(&pdev->dev);
parse_mcu_sleep_config(node);
#ifndef MODULE
@@ -13,6 +13,8 @@ struct rk_sleep_config {
u32 pwm_regulator_config;
u32 *power_ctrl_config;
u32 power_ctrl_config_cnt;
u32 *sleep_io_config;
u32 sleep_io_config_cnt;
u32 apios_suspend;
u32 io_ret_config;
u32 sleep_pin_config[2];