| .. | .. |
|---|
| 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; |
|---|
| .. | .. |
|---|
| 59 | 61 | { .compatible = "rockchip,pm-rk3328",}, |
|---|
| 60 | 62 | { .compatible = "rockchip,pm-rk3368",}, |
|---|
| 61 | 63 | { .compatible = "rockchip,pm-rk3399",}, |
|---|
| 64 | + { .compatible = "rockchip,pm-rk3528",}, |
|---|
| 65 | + { .compatible = "rockchip,pm-rk3562",}, |
|---|
| 62 | 66 | { .compatible = "rockchip,pm-rk3568",}, |
|---|
| 67 | + { .compatible = "rockchip,pm-rk3588",}, |
|---|
| 63 | 68 | { .compatible = "rockchip,pm-rv1126",}, |
|---|
| 64 | 69 | { }, |
|---|
| 65 | 70 | }; |
|---|
| 66 | 71 | |
|---|
| 72 | +#ifndef MODULE |
|---|
| 67 | 73 | static void rockchip_pm_virt_pwroff_prepare(void) |
|---|
| 68 | 74 | { |
|---|
| 69 | 75 | int error; |
|---|
| 70 | 76 | |
|---|
| 71 | 77 | regulator_suspend_prepare(PM_SUSPEND_MEM); |
|---|
| 72 | 78 | |
|---|
| 73 | | - error = disable_nonboot_cpus(); |
|---|
| 79 | + error = suspend_disable_secondary_cpus(); |
|---|
| 74 | 80 | if (error) { |
|---|
| 75 | 81 | pr_err("Disable nonboot cpus failed!\n"); |
|---|
| 76 | 82 | return; |
|---|
| .. | .. |
|---|
| 158 | 164 | |
|---|
| 159 | 165 | return 0; |
|---|
| 160 | 166 | } |
|---|
| 167 | +#endif |
|---|
| 161 | 168 | |
|---|
| 162 | 169 | static int pm_config_probe(struct platform_device *pdev) |
|---|
| 163 | 170 | { |
|---|
| .. | .. |
|---|
| 168 | 175 | int gpio_temp[10]; |
|---|
| 169 | 176 | u32 sleep_debug_en = 0; |
|---|
| 170 | 177 | u32 apios_suspend = 0; |
|---|
| 178 | + u32 io_ret_config = 0; |
|---|
| 179 | + u32 sleep_pin_config[2] = {0}; |
|---|
| 180 | +#ifndef MODULE |
|---|
| 171 | 181 | u32 virtual_poweroff_en = 0; |
|---|
| 182 | +#endif |
|---|
| 172 | 183 | enum of_gpio_flags flags; |
|---|
| 173 | 184 | int i = 0; |
|---|
| 174 | 185 | int length; |
|---|
| 186 | + int ret; |
|---|
| 175 | 187 | |
|---|
| 176 | 188 | match_id = of_match_node(pm_match_table, pdev->dev.of_node); |
|---|
| 177 | 189 | if (!match_id) |
|---|
| .. | .. |
|---|
| 239 | 251 | 0); |
|---|
| 240 | 252 | |
|---|
| 241 | 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, |
|---|
| 242 | 275 | "rockchip,virtual-poweroff", |
|---|
| 243 | 276 | &virtual_poweroff_en, 1) && |
|---|
| 244 | 277 | virtual_poweroff_en) |
|---|
| .. | .. |
|---|
| 248 | 281 | parse_sleep_config(node, i); |
|---|
| 249 | 282 | parse_on_off_regulator(node, i); |
|---|
| 250 | 283 | } |
|---|
| 284 | +#endif |
|---|
| 251 | 285 | |
|---|
| 252 | 286 | return 0; |
|---|
| 253 | 287 | } |
|---|
| 254 | 288 | |
|---|
| 289 | +#ifndef MODULE |
|---|
| 255 | 290 | static int pm_config_prepare(struct device *dev) |
|---|
| 256 | 291 | { |
|---|
| 257 | 292 | int i; |
|---|
| .. | .. |
|---|
| 299 | 334 | static const struct dev_pm_ops rockchip_pm_ops = { |
|---|
| 300 | 335 | .prepare = pm_config_prepare, |
|---|
| 301 | 336 | }; |
|---|
| 337 | +#endif |
|---|
| 302 | 338 | |
|---|
| 303 | 339 | static struct platform_driver pm_driver = { |
|---|
| 304 | 340 | .probe = pm_config_probe, |
|---|
| 305 | 341 | .driver = { |
|---|
| 306 | 342 | .name = "rockchip-pm", |
|---|
| 307 | 343 | .of_match_table = pm_match_table, |
|---|
| 344 | +#ifndef MODULE |
|---|
| 308 | 345 | .pm = &rockchip_pm_ops, |
|---|
| 346 | +#endif |
|---|
| 309 | 347 | }, |
|---|
| 310 | 348 | }; |
|---|
| 311 | 349 | |
|---|