.. | .. |
---|
6 | 6 | |
---|
7 | 7 | #include <linux/cpu.h> |
---|
8 | 8 | #include <linux/kernel.h> |
---|
| 9 | +#include <linux/module.h> |
---|
9 | 10 | #include <linux/platform_device.h> |
---|
10 | 11 | #include <linux/pm.h> |
---|
11 | 12 | #include <linux/regmap.h> |
---|
.. | .. |
---|
13 | 14 | |
---|
14 | 15 | #define SC27XX_PWR_PD_HW 0xc2c |
---|
15 | 16 | #define SC27XX_PWR_OFF_EN BIT(0) |
---|
| 17 | +#define SC27XX_SLP_CTRL 0xdf0 |
---|
| 18 | +#define SC27XX_LDO_XTL_EN BIT(3) |
---|
16 | 19 | |
---|
17 | 20 | static struct regmap *regmap; |
---|
18 | 21 | |
---|
.. | .. |
---|
27 | 30 | */ |
---|
28 | 31 | static void sc27xx_poweroff_shutdown(void) |
---|
29 | 32 | { |
---|
30 | | -#ifdef CONFIG_PM_SLEEP_SMP |
---|
31 | | - int cpu = smp_processor_id(); |
---|
| 33 | +#ifdef CONFIG_HOTPLUG_CPU |
---|
| 34 | + int cpu; |
---|
32 | 35 | |
---|
33 | | - freeze_secondary_cpus(cpu); |
---|
| 36 | + for_each_online_cpu(cpu) { |
---|
| 37 | + if (cpu != smp_processor_id()) |
---|
| 38 | + remove_cpu(cpu); |
---|
| 39 | + } |
---|
34 | 40 | #endif |
---|
35 | 41 | } |
---|
36 | 42 | |
---|
.. | .. |
---|
40 | 46 | |
---|
41 | 47 | static void sc27xx_poweroff_do_poweroff(void) |
---|
42 | 48 | { |
---|
| 49 | + /* Disable the external subsys connection's power firstly */ |
---|
| 50 | + regmap_write(regmap, SC27XX_SLP_CTRL, SC27XX_LDO_XTL_EN); |
---|
| 51 | + |
---|
43 | 52 | regmap_write(regmap, SC27XX_PWR_PD_HW, SC27XX_PWR_OFF_EN); |
---|
44 | 53 | } |
---|
45 | 54 | |
---|
.. | .. |
---|
63 | 72 | .name = "sc27xx-poweroff", |
---|
64 | 73 | }, |
---|
65 | 74 | }; |
---|
66 | | -builtin_platform_driver(sc27xx_poweroff_driver); |
---|
| 75 | +module_platform_driver(sc27xx_poweroff_driver); |
---|
| 76 | + |
---|
| 77 | +MODULE_DESCRIPTION("Power off driver for SC27XX PMIC Device"); |
---|
| 78 | +MODULE_AUTHOR("Baolin Wang <baolin.wang@unisoc.com>"); |
---|
| 79 | +MODULE_LICENSE("GPL v2"); |
---|