From bcbcebd833f6a37c224b53028baeaa39f86564f3 Mon Sep 17 00:00:00 2001 From: Finley Xiao Date: Wed, 28 Jun 2023 15:00:26 +0800 Subject: [PATCH] soc: rockchip: opp_select: implement rockchip_uninit_opp_table() Signed-off-by: Finley Xiao Change-Id: I5c3a8248af267609e363046baeb7014cb8471166 --- drivers/soc/rockchip/rockchip_opp_select.c | 25 ++++++++++++++++++++++ include/soc/rockchip/rockchip_opp_select.h | 7 ++++++ 2 files changed, 32 insertions(+) diff --git a/drivers/soc/rockchip/rockchip_opp_select.c b/drivers/soc/rockchip/rockchip_opp_select.c index 8caae5ccbbf3..7f3095c4f235 100644 --- a/drivers/soc/rockchip/rockchip_opp_select.c +++ b/drivers/soc/rockchip/rockchip_opp_select.c @@ -1925,6 +1925,31 @@ out: } EXPORT_SYMBOL(rockchip_init_opp_table); +void rockchip_uninit_opp_table(struct device *dev, struct rockchip_opp_info *info) +{ + struct opp_table *opp_table; + + if (info) { + kfree(info->opp_table); + info->opp_table = NULL; + devm_kfree(dev, info->clks); + info->clks = NULL; + devm_kfree(dev, info->volt_rm_tbl); + info->volt_rm_tbl = NULL; + } + + opp_table = dev_pm_opp_get_opp_table(dev); + if (IS_ERR(opp_table)) + return; + dev_pm_opp_of_remove_table(dev); + if (opp_table->prop_name) + dev_pm_opp_put_prop_name(opp_table); + if (opp_table->supported_hw) + dev_pm_opp_put_supported_hw(opp_table); + dev_pm_opp_put_opp_table(opp_table); +} +EXPORT_SYMBOL(rockchip_uninit_opp_table); + MODULE_DESCRIPTION("ROCKCHIP OPP Select"); MODULE_AUTHOR("Finley Xiao , Liang Chen "); MODULE_LICENSE("GPL"); diff --git a/include/soc/rockchip/rockchip_opp_select.h b/include/soc/rockchip/rockchip_opp_select.h index 60f01b4d589b..6d595f94f12c 100644 --- a/include/soc/rockchip/rockchip_opp_select.h +++ b/include/soc/rockchip/rockchip_opp_select.h @@ -130,6 +130,8 @@ int rockchip_set_intermediate_rate(struct device *dev, int rockchip_init_opp_table(struct device *dev, struct rockchip_opp_info *info, char *lkg_name, char *reg_name); +void rockchip_uninit_opp_table(struct device *dev, + struct rockchip_opp_info *info); #else static inline int rockchip_of_get_leakage(struct device *dev, char *lkg_name, int *leakage) @@ -266,6 +268,11 @@ static inline int rockchip_init_opp_table(struct device *dev, return -EOPNOTSUPP; } +static inline void rockchip_uninit_opp_table(struct device *dev, + struct rockchip_opp_info *info) +{ +} + #endif /* CONFIG_ROCKCHIP_OPP */ #endif