18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd 48c2ecf20Sopenharmony_ci * Author: Tony Xie <tony.xie@rock-chips.com> 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <linux/init.h> 88c2ecf20Sopenharmony_ci#include <linux/io.h> 98c2ecf20Sopenharmony_ci#include <linux/kernel.h> 108c2ecf20Sopenharmony_ci#include <linux/of.h> 118c2ecf20Sopenharmony_ci#include <linux/of_address.h> 128c2ecf20Sopenharmony_ci#include <linux/regmap.h> 138c2ecf20Sopenharmony_ci#include <linux/suspend.h> 148c2ecf20Sopenharmony_ci#include <linux/mfd/syscon.h> 158c2ecf20Sopenharmony_ci#include <linux/regulator/machine.h> 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#include <asm/cacheflush.h> 188c2ecf20Sopenharmony_ci#include <asm/tlbflush.h> 198c2ecf20Sopenharmony_ci#include <asm/suspend.h> 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#include "pm.h" 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci/* These enum are option of low power mode */ 248c2ecf20Sopenharmony_cienum { 258c2ecf20Sopenharmony_ci ROCKCHIP_ARM_OFF_LOGIC_NORMAL = 0, 268c2ecf20Sopenharmony_ci ROCKCHIP_ARM_OFF_LOGIC_DEEP = 1, 278c2ecf20Sopenharmony_ci}; 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_cistruct rockchip_pm_data { 308c2ecf20Sopenharmony_ci const struct platform_suspend_ops *ops; 318c2ecf20Sopenharmony_ci int (*init)(struct device_node *np); 328c2ecf20Sopenharmony_ci}; 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_cistatic void __iomem *rk3288_bootram_base; 358c2ecf20Sopenharmony_cistatic phys_addr_t rk3288_bootram_phy; 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_cistatic struct regmap *pmu_regmap; 388c2ecf20Sopenharmony_cistatic struct regmap *sgrf_regmap; 398c2ecf20Sopenharmony_cistatic struct regmap *grf_regmap; 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_cistatic u32 rk3288_pmu_pwr_mode_con; 428c2ecf20Sopenharmony_cistatic u32 rk3288_sgrf_soc_con0; 438c2ecf20Sopenharmony_cistatic u32 rk3288_sgrf_cpu_con0; 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_cistatic inline u32 rk3288_l2_config(void) 468c2ecf20Sopenharmony_ci{ 478c2ecf20Sopenharmony_ci u32 l2ctlr; 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci asm("mrc p15, 1, %0, c9, c0, 2" : "=r" (l2ctlr)); 508c2ecf20Sopenharmony_ci return l2ctlr; 518c2ecf20Sopenharmony_ci} 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_cistatic void __init rk3288_config_bootdata(void) 548c2ecf20Sopenharmony_ci{ 558c2ecf20Sopenharmony_ci rkpm_bootdata_cpusp = rk3288_bootram_phy + (SZ_4K - 8); 568c2ecf20Sopenharmony_ci rkpm_bootdata_cpu_code = __pa_symbol(cpu_resume); 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci rkpm_bootdata_l2ctlr_f = 1; 598c2ecf20Sopenharmony_ci rkpm_bootdata_l2ctlr = rk3288_l2_config(); 608c2ecf20Sopenharmony_ci} 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#define GRF_UOC0_CON0 0x320 638c2ecf20Sopenharmony_ci#define GRF_UOC1_CON0 0x334 648c2ecf20Sopenharmony_ci#define GRF_UOC2_CON0 0x348 658c2ecf20Sopenharmony_ci#define GRF_SIDDQ BIT(13) 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_cistatic bool rk3288_slp_disable_osc(void) 688c2ecf20Sopenharmony_ci{ 698c2ecf20Sopenharmony_ci static const u32 reg_offset[] = { GRF_UOC0_CON0, GRF_UOC1_CON0, 708c2ecf20Sopenharmony_ci GRF_UOC2_CON0 }; 718c2ecf20Sopenharmony_ci u32 reg, i; 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci /* 748c2ecf20Sopenharmony_ci * if any usb phy is still on(GRF_SIDDQ==0), that means we need the 758c2ecf20Sopenharmony_ci * function of usb wakeup, so do not switch to 32khz, since the usb phy 768c2ecf20Sopenharmony_ci * clk does not connect to 32khz osc 778c2ecf20Sopenharmony_ci */ 788c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(reg_offset); i++) { 798c2ecf20Sopenharmony_ci regmap_read(grf_regmap, reg_offset[i], ®); 808c2ecf20Sopenharmony_ci if (!(reg & GRF_SIDDQ)) 818c2ecf20Sopenharmony_ci return false; 828c2ecf20Sopenharmony_ci } 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci return true; 858c2ecf20Sopenharmony_ci} 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_cistatic void rk3288_slp_mode_set(int level) 888c2ecf20Sopenharmony_ci{ 898c2ecf20Sopenharmony_ci u32 mode_set, mode_set1; 908c2ecf20Sopenharmony_ci bool osc_disable = rk3288_slp_disable_osc(); 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci regmap_read(sgrf_regmap, RK3288_SGRF_CPU_CON0, &rk3288_sgrf_cpu_con0); 938c2ecf20Sopenharmony_ci regmap_read(sgrf_regmap, RK3288_SGRF_SOC_CON0, &rk3288_sgrf_soc_con0); 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci regmap_read(pmu_regmap, RK3288_PMU_PWRMODE_CON, 968c2ecf20Sopenharmony_ci &rk3288_pmu_pwr_mode_con); 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci /* 998c2ecf20Sopenharmony_ci * SGRF_FAST_BOOT_EN - system to boot from FAST_BOOT_ADDR 1008c2ecf20Sopenharmony_ci * PCLK_WDT_GATE - disable WDT during suspend. 1018c2ecf20Sopenharmony_ci */ 1028c2ecf20Sopenharmony_ci regmap_write(sgrf_regmap, RK3288_SGRF_SOC_CON0, 1038c2ecf20Sopenharmony_ci SGRF_PCLK_WDT_GATE | SGRF_FAST_BOOT_EN 1048c2ecf20Sopenharmony_ci | SGRF_PCLK_WDT_GATE_WRITE | SGRF_FAST_BOOT_EN_WRITE); 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci /* 1078c2ecf20Sopenharmony_ci * The dapswjdp can not auto reset before resume, that cause it may 1088c2ecf20Sopenharmony_ci * access some illegal address during resume. Let's disable it before 1098c2ecf20Sopenharmony_ci * suspend, and the MASKROM will enable it back. 1108c2ecf20Sopenharmony_ci */ 1118c2ecf20Sopenharmony_ci regmap_write(sgrf_regmap, RK3288_SGRF_CPU_CON0, SGRF_DAPDEVICEEN_WRITE); 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci /* booting address of resuming system is from this register value */ 1148c2ecf20Sopenharmony_ci regmap_write(sgrf_regmap, RK3288_SGRF_FAST_BOOT_ADDR, 1158c2ecf20Sopenharmony_ci rk3288_bootram_phy); 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci mode_set = BIT(PMU_GLOBAL_INT_DISABLE) | BIT(PMU_L2FLUSH_EN) | 1188c2ecf20Sopenharmony_ci BIT(PMU_SREF0_ENTER_EN) | BIT(PMU_SREF1_ENTER_EN) | 1198c2ecf20Sopenharmony_ci BIT(PMU_DDR0_GATING_EN) | BIT(PMU_DDR1_GATING_EN) | 1208c2ecf20Sopenharmony_ci BIT(PMU_PWR_MODE_EN) | BIT(PMU_CHIP_PD_EN) | 1218c2ecf20Sopenharmony_ci BIT(PMU_SCU_EN); 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci mode_set1 = BIT(PMU_CLR_CORE) | BIT(PMU_CLR_CPUP); 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci if (level == ROCKCHIP_ARM_OFF_LOGIC_DEEP) { 1268c2ecf20Sopenharmony_ci /* arm off, logic deep sleep */ 1278c2ecf20Sopenharmony_ci mode_set |= BIT(PMU_BUS_PD_EN) | BIT(PMU_PMU_USE_LF) | 1288c2ecf20Sopenharmony_ci BIT(PMU_DDR1IO_RET_EN) | BIT(PMU_DDR0IO_RET_EN) | 1298c2ecf20Sopenharmony_ci BIT(PMU_ALIVE_USE_LF) | BIT(PMU_PLL_PD_EN); 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci if (osc_disable) 1328c2ecf20Sopenharmony_ci mode_set |= BIT(PMU_OSC_24M_DIS); 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci mode_set1 |= BIT(PMU_CLR_ALIVE) | BIT(PMU_CLR_BUS) | 1358c2ecf20Sopenharmony_ci BIT(PMU_CLR_PERI) | BIT(PMU_CLR_DMA); 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci regmap_write(pmu_regmap, RK3288_PMU_WAKEUP_CFG1, 1388c2ecf20Sopenharmony_ci PMU_ARMINT_WAKEUP_EN); 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci /* 1418c2ecf20Sopenharmony_ci * In deep suspend we use PMU_PMU_USE_LF to let the rk3288 1428c2ecf20Sopenharmony_ci * switch its main clock supply to the alternative 32kHz 1438c2ecf20Sopenharmony_ci * source. Therefore set 30ms on a 32kHz clock for pmic 1448c2ecf20Sopenharmony_ci * stabilization. Similar 30ms on 24MHz for the other 1458c2ecf20Sopenharmony_ci * mode below. 1468c2ecf20Sopenharmony_ci */ 1478c2ecf20Sopenharmony_ci regmap_write(pmu_regmap, RK3288_PMU_STABL_CNT, 32 * 30); 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ci /* only wait for stabilization, if we turned the osc off */ 1508c2ecf20Sopenharmony_ci regmap_write(pmu_regmap, RK3288_PMU_OSC_CNT, 1518c2ecf20Sopenharmony_ci osc_disable ? 32 * 30 : 0); 1528c2ecf20Sopenharmony_ci } else { 1538c2ecf20Sopenharmony_ci /* 1548c2ecf20Sopenharmony_ci * arm off, logic normal 1558c2ecf20Sopenharmony_ci * if pmu_clk_core_src_gate_en is not set, 1568c2ecf20Sopenharmony_ci * wakeup will be error 1578c2ecf20Sopenharmony_ci */ 1588c2ecf20Sopenharmony_ci mode_set |= BIT(PMU_CLK_CORE_SRC_GATE_EN); 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci regmap_write(pmu_regmap, RK3288_PMU_WAKEUP_CFG1, 1618c2ecf20Sopenharmony_ci PMU_ARMINT_WAKEUP_EN | PMU_GPIOINT_WAKEUP_EN); 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci /* 30ms on a 24MHz clock for pmic stabilization */ 1648c2ecf20Sopenharmony_ci regmap_write(pmu_regmap, RK3288_PMU_STABL_CNT, 24000 * 30); 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci /* oscillator is still running, so no need to wait */ 1678c2ecf20Sopenharmony_ci regmap_write(pmu_regmap, RK3288_PMU_OSC_CNT, 0); 1688c2ecf20Sopenharmony_ci } 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ci regmap_write(pmu_regmap, RK3288_PMU_PWRMODE_CON, mode_set); 1718c2ecf20Sopenharmony_ci regmap_write(pmu_regmap, RK3288_PMU_PWRMODE_CON1, mode_set1); 1728c2ecf20Sopenharmony_ci} 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_cistatic void rk3288_slp_mode_set_resume(void) 1758c2ecf20Sopenharmony_ci{ 1768c2ecf20Sopenharmony_ci regmap_write(sgrf_regmap, RK3288_SGRF_CPU_CON0, 1778c2ecf20Sopenharmony_ci rk3288_sgrf_cpu_con0 | SGRF_DAPDEVICEEN_WRITE); 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ci regmap_write(pmu_regmap, RK3288_PMU_PWRMODE_CON, 1808c2ecf20Sopenharmony_ci rk3288_pmu_pwr_mode_con); 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci regmap_write(sgrf_regmap, RK3288_SGRF_SOC_CON0, 1838c2ecf20Sopenharmony_ci rk3288_sgrf_soc_con0 | SGRF_PCLK_WDT_GATE_WRITE 1848c2ecf20Sopenharmony_ci | SGRF_FAST_BOOT_EN_WRITE); 1858c2ecf20Sopenharmony_ci} 1868c2ecf20Sopenharmony_ci 1878c2ecf20Sopenharmony_cistatic int rockchip_lpmode_enter(unsigned long arg) 1888c2ecf20Sopenharmony_ci{ 1898c2ecf20Sopenharmony_ci flush_cache_all(); 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_ci cpu_do_idle(); 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci pr_err("%s: Failed to suspend\n", __func__); 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_ci return 1; 1968c2ecf20Sopenharmony_ci} 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_cistatic int rk3288_suspend_enter(suspend_state_t state) 1998c2ecf20Sopenharmony_ci{ 2008c2ecf20Sopenharmony_ci local_fiq_disable(); 2018c2ecf20Sopenharmony_ci 2028c2ecf20Sopenharmony_ci rk3288_slp_mode_set(ROCKCHIP_ARM_OFF_LOGIC_NORMAL); 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci cpu_suspend(0, rockchip_lpmode_enter); 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_ci rk3288_slp_mode_set_resume(); 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci local_fiq_enable(); 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci return 0; 2118c2ecf20Sopenharmony_ci} 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_cistatic int rk3288_suspend_prepare(void) 2148c2ecf20Sopenharmony_ci{ 2158c2ecf20Sopenharmony_ci return regulator_suspend_prepare(PM_SUSPEND_MEM); 2168c2ecf20Sopenharmony_ci} 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_cistatic void rk3288_suspend_finish(void) 2198c2ecf20Sopenharmony_ci{ 2208c2ecf20Sopenharmony_ci if (regulator_suspend_finish()) 2218c2ecf20Sopenharmony_ci pr_err("%s: Suspend finish failed\n", __func__); 2228c2ecf20Sopenharmony_ci} 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_cistatic int __init rk3288_suspend_init(struct device_node *np) 2258c2ecf20Sopenharmony_ci{ 2268c2ecf20Sopenharmony_ci struct device_node *sram_np; 2278c2ecf20Sopenharmony_ci struct resource res; 2288c2ecf20Sopenharmony_ci int ret; 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci pmu_regmap = syscon_node_to_regmap(np); 2318c2ecf20Sopenharmony_ci if (IS_ERR(pmu_regmap)) { 2328c2ecf20Sopenharmony_ci pr_err("%s: could not find pmu regmap\n", __func__); 2338c2ecf20Sopenharmony_ci return PTR_ERR(pmu_regmap); 2348c2ecf20Sopenharmony_ci } 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_ci sgrf_regmap = syscon_regmap_lookup_by_compatible( 2378c2ecf20Sopenharmony_ci "rockchip,rk3288-sgrf"); 2388c2ecf20Sopenharmony_ci if (IS_ERR(sgrf_regmap)) { 2398c2ecf20Sopenharmony_ci pr_err("%s: could not find sgrf regmap\n", __func__); 2408c2ecf20Sopenharmony_ci return PTR_ERR(sgrf_regmap); 2418c2ecf20Sopenharmony_ci } 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci grf_regmap = syscon_regmap_lookup_by_compatible( 2448c2ecf20Sopenharmony_ci "rockchip,rk3288-grf"); 2458c2ecf20Sopenharmony_ci if (IS_ERR(grf_regmap)) { 2468c2ecf20Sopenharmony_ci pr_err("%s: could not find grf regmap\n", __func__); 2478c2ecf20Sopenharmony_ci return PTR_ERR(grf_regmap); 2488c2ecf20Sopenharmony_ci } 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci sram_np = of_find_compatible_node(NULL, NULL, 2518c2ecf20Sopenharmony_ci "rockchip,rk3288-pmu-sram"); 2528c2ecf20Sopenharmony_ci if (!sram_np) { 2538c2ecf20Sopenharmony_ci pr_err("%s: could not find bootram dt node\n", __func__); 2548c2ecf20Sopenharmony_ci return -ENODEV; 2558c2ecf20Sopenharmony_ci } 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_ci rk3288_bootram_base = of_iomap(sram_np, 0); 2588c2ecf20Sopenharmony_ci if (!rk3288_bootram_base) { 2598c2ecf20Sopenharmony_ci pr_err("%s: could not map bootram base\n", __func__); 2608c2ecf20Sopenharmony_ci of_node_put(sram_np); 2618c2ecf20Sopenharmony_ci return -ENOMEM; 2628c2ecf20Sopenharmony_ci } 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci ret = of_address_to_resource(sram_np, 0, &res); 2658c2ecf20Sopenharmony_ci if (ret) { 2668c2ecf20Sopenharmony_ci pr_err("%s: could not get bootram phy addr\n", __func__); 2678c2ecf20Sopenharmony_ci of_node_put(sram_np); 2688c2ecf20Sopenharmony_ci return ret; 2698c2ecf20Sopenharmony_ci } 2708c2ecf20Sopenharmony_ci rk3288_bootram_phy = res.start; 2718c2ecf20Sopenharmony_ci 2728c2ecf20Sopenharmony_ci of_node_put(sram_np); 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ci rk3288_config_bootdata(); 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_ci /* copy resume code and data to bootsram */ 2778c2ecf20Sopenharmony_ci memcpy(rk3288_bootram_base, rockchip_slp_cpu_resume, 2788c2ecf20Sopenharmony_ci rk3288_bootram_sz); 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci return 0; 2818c2ecf20Sopenharmony_ci} 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_cistatic const struct platform_suspend_ops rk3288_suspend_ops = { 2848c2ecf20Sopenharmony_ci .enter = rk3288_suspend_enter, 2858c2ecf20Sopenharmony_ci .valid = suspend_valid_only_mem, 2868c2ecf20Sopenharmony_ci .prepare = rk3288_suspend_prepare, 2878c2ecf20Sopenharmony_ci .finish = rk3288_suspend_finish, 2888c2ecf20Sopenharmony_ci}; 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_cistatic const struct rockchip_pm_data rk3288_pm_data __initconst = { 2918c2ecf20Sopenharmony_ci .ops = &rk3288_suspend_ops, 2928c2ecf20Sopenharmony_ci .init = rk3288_suspend_init, 2938c2ecf20Sopenharmony_ci}; 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_cistatic const struct of_device_id rockchip_pmu_of_device_ids[] __initconst = { 2968c2ecf20Sopenharmony_ci { 2978c2ecf20Sopenharmony_ci .compatible = "rockchip,rk3288-pmu", 2988c2ecf20Sopenharmony_ci .data = &rk3288_pm_data, 2998c2ecf20Sopenharmony_ci }, 3008c2ecf20Sopenharmony_ci { /* sentinel */ }, 3018c2ecf20Sopenharmony_ci}; 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_civoid __init rockchip_suspend_init(void) 3048c2ecf20Sopenharmony_ci{ 3058c2ecf20Sopenharmony_ci const struct rockchip_pm_data *pm_data; 3068c2ecf20Sopenharmony_ci const struct of_device_id *match; 3078c2ecf20Sopenharmony_ci struct device_node *np; 3088c2ecf20Sopenharmony_ci int ret; 3098c2ecf20Sopenharmony_ci 3108c2ecf20Sopenharmony_ci np = of_find_matching_node_and_match(NULL, rockchip_pmu_of_device_ids, 3118c2ecf20Sopenharmony_ci &match); 3128c2ecf20Sopenharmony_ci if (!match) { 3138c2ecf20Sopenharmony_ci pr_err("Failed to find PMU node\n"); 3148c2ecf20Sopenharmony_ci return; 3158c2ecf20Sopenharmony_ci } 3168c2ecf20Sopenharmony_ci pm_data = (struct rockchip_pm_data *) match->data; 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci if (pm_data->init) { 3198c2ecf20Sopenharmony_ci ret = pm_data->init(np); 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_ci if (ret) { 3228c2ecf20Sopenharmony_ci pr_err("%s: matches init error %d\n", __func__, ret); 3238c2ecf20Sopenharmony_ci return; 3248c2ecf20Sopenharmony_ci } 3258c2ecf20Sopenharmony_ci } 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_ci suspend_set_ops(pm_data->ops); 3288c2ecf20Sopenharmony_ci} 329