.. | .. |
---|
34 | 34 | RK_PM_STATE_MAX |
---|
35 | 35 | }; |
---|
36 | 36 | |
---|
| 37 | +#ifndef MODULE |
---|
37 | 38 | static const char * const pm_state_str[RK_PM_STATE_MAX] = { |
---|
38 | 39 | [RK_PM_MEM] = "mem", |
---|
39 | 40 | [RK_PM_MEM_LITE] = "mem-lite", |
---|
.. | .. |
---|
44 | 45 | struct regulator_dev *on_reg_list[MAX_ON_OFF_REG_NUM]; |
---|
45 | 46 | struct regulator_dev *off_reg_list[MAX_ON_OFF_REG_NUM]; |
---|
46 | 47 | } on_off_regs_list[RK_PM_STATE_MAX]; |
---|
| 48 | +#endif |
---|
47 | 49 | |
---|
48 | 50 | static struct rk_sleep_config { |
---|
49 | 51 | u32 mode_config; |
---|
.. | .. |
---|
60 | 62 | { .compatible = "rockchip,pm-rk3368",}, |
---|
61 | 63 | { .compatible = "rockchip,pm-rk3399",}, |
---|
62 | 64 | { .compatible = "rockchip,pm-rk3528",}, |
---|
| 65 | + { .compatible = "rockchip,pm-rk3562",}, |
---|
63 | 66 | { .compatible = "rockchip,pm-rk3568",}, |
---|
| 67 | + { .compatible = "rockchip,pm-rk3588",}, |
---|
64 | 68 | { .compatible = "rockchip,pm-rv1126",}, |
---|
65 | 69 | { }, |
---|
66 | 70 | }; |
---|
67 | 71 | |
---|
| 72 | +#ifndef MODULE |
---|
68 | 73 | static void rockchip_pm_virt_pwroff_prepare(void) |
---|
69 | 74 | { |
---|
70 | 75 | int error; |
---|
71 | 76 | |
---|
72 | 77 | regulator_suspend_prepare(PM_SUSPEND_MEM); |
---|
73 | 78 | |
---|
74 | | - error = disable_nonboot_cpus(); |
---|
| 79 | + error = suspend_disable_secondary_cpus(); |
---|
75 | 80 | if (error) { |
---|
76 | 81 | pr_err("Disable nonboot cpus failed!\n"); |
---|
77 | 82 | return; |
---|
.. | .. |
---|
159 | 164 | |
---|
160 | 165 | return 0; |
---|
161 | 166 | } |
---|
| 167 | +#endif |
---|
162 | 168 | |
---|
163 | 169 | static int pm_config_probe(struct platform_device *pdev) |
---|
164 | 170 | { |
---|
.. | .. |
---|
169 | 175 | int gpio_temp[10]; |
---|
170 | 176 | u32 sleep_debug_en = 0; |
---|
171 | 177 | u32 apios_suspend = 0; |
---|
| 178 | + u32 io_ret_config = 0; |
---|
| 179 | + u32 sleep_pin_config[2] = {0}; |
---|
| 180 | +#ifndef MODULE |
---|
172 | 181 | u32 virtual_poweroff_en = 0; |
---|
| 182 | +#endif |
---|
173 | 183 | enum of_gpio_flags flags; |
---|
174 | 184 | int i = 0; |
---|
175 | 185 | int length; |
---|
| 186 | + int ret; |
---|
176 | 187 | |
---|
177 | 188 | match_id = of_match_node(pm_match_table, pdev->dev.of_node); |
---|
178 | 189 | if (!match_id) |
---|
.. | .. |
---|
240 | 251 | 0); |
---|
241 | 252 | |
---|
242 | 253 | if (!of_property_read_u32_array(node, |
---|
| 254 | + "rockchip,sleep-io-ret-config", |
---|
| 255 | + &io_ret_config, 1)) { |
---|
| 256 | + ret = sip_smc_set_suspend_mode(SUSPEND_IO_RET_CONFIG, io_ret_config, 0); |
---|
| 257 | + if (ret) |
---|
| 258 | + dev_warn(&pdev->dev, |
---|
| 259 | + "sleep-io-ret-config failed (%d), check parameters or update trust\n", |
---|
| 260 | + ret); |
---|
| 261 | + } |
---|
| 262 | + |
---|
| 263 | + if (!of_property_read_u32_array(node, |
---|
| 264 | + "rockchip,sleep-pin-config", |
---|
| 265 | + sleep_pin_config, 2)) { |
---|
| 266 | + ret = sip_smc_set_suspend_mode(SLEEP_PIN_CONFIG, sleep_pin_config[0], sleep_pin_config[1]); |
---|
| 267 | + if (ret) |
---|
| 268 | + dev_warn(&pdev->dev, |
---|
| 269 | + "sleep-pin-config failed (%d), check parameters or update trust\n", |
---|
| 270 | + ret); |
---|
| 271 | + } |
---|
| 272 | + |
---|
| 273 | +#ifndef MODULE |
---|
| 274 | + if (!of_property_read_u32_array(node, |
---|
243 | 275 | "rockchip,virtual-poweroff", |
---|
244 | 276 | &virtual_poweroff_en, 1) && |
---|
245 | 277 | virtual_poweroff_en) |
---|
.. | .. |
---|
249 | 281 | parse_sleep_config(node, i); |
---|
250 | 282 | parse_on_off_regulator(node, i); |
---|
251 | 283 | } |
---|
| 284 | +#endif |
---|
252 | 285 | |
---|
253 | 286 | return 0; |
---|
254 | 287 | } |
---|
255 | 288 | |
---|
| 289 | +#ifndef MODULE |
---|
256 | 290 | static int pm_config_prepare(struct device *dev) |
---|
257 | 291 | { |
---|
258 | 292 | int i; |
---|
.. | .. |
---|
300 | 334 | static const struct dev_pm_ops rockchip_pm_ops = { |
---|
301 | 335 | .prepare = pm_config_prepare, |
---|
302 | 336 | }; |
---|
| 337 | +#endif |
---|
303 | 338 | |
---|
304 | 339 | static struct platform_driver pm_driver = { |
---|
305 | 340 | .probe = pm_config_probe, |
---|
306 | 341 | .driver = { |
---|
307 | 342 | .name = "rockchip-pm", |
---|
308 | 343 | .of_match_table = pm_match_table, |
---|
| 344 | +#ifndef MODULE |
---|
309 | 345 | .pm = &rockchip_pm_ops, |
---|
| 346 | +#endif |
---|
310 | 347 | }, |
---|
311 | 348 | }; |
---|
312 | 349 | |
---|