Some optimization for SC27XX poweroff driver
Subsystems (2)
Baolin Wang
maintainercover Some optimization for SC27XX poweroff driver
This patch set fixes external subsystems' power issue and allows the SC27XX poweroff driver building into a module.
Baolin Wang (2):
power: reset: sc27xx: Change to use cpu_down()
power: reset: sc27xx: Allow the SC27XX poweroff driver building into a
module
Sherry Zong (1):
power: reset: sc27xx: Power off the external subsystems' connection
drivers/power/reset/Kconfig | 2 +- drivers/power/reset/sc27xx-poweroff.c | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-)
Signature · 1 line
1.9.1
Baolin Wang
maintainerPATCH 1/3 power: reset: sc27xx: Power off the external subsystems' connection
From: Sherry Zong <[email protected]>
When powering off the whole system, we should power off some external subsystems' connection firstly, otherwise some external subsystems will hold some power and result in powering down abnormally.
--- drivers/power/reset/sc27xx-poweroff.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/power/reset/sc27xx-poweroff.c +5 -0
@@ -13,6 +13,8 @@#define SC27XX_PWR_PD_HW 0xc2c#define SC27XX_PWR_OFF_EN BIT(0) +#define SC27XX_SLP_CTRL 0xdf0 +#define SC27XX_LDO_XTL_EN BIT(3)static struct regmap *regmap;
@@ -40,6 +42,9 @@ static void sc27xx_poweroff_shutdown(void)static void sc27xx_poweroff_do_poweroff (void ) { +/* Disable the external subsys connection's power firstly */ +regmap_write (regmap,SC27XX_SLP_CTRL ,SC27XX_LDO_XTL_EN ); +regmap_write (regmap,SC27XX_PWR_PD_HW ,SC27XX_PWR_OFF_EN ); }
Signature · 1 line
1.9.1
Baolin Wang
maintainerPATCH 2/3 power: reset: sc27xx: Change to use cpu_down()
In reply to Baolin WangTo allow the SC27XX driver can be built as a module, and the freeze_secondary_cpus() symbol is not exported, thus we can change to use the exported cpu_down() API to shut down other cpus to avoid racing, which is same as the freeze_secondary_cpus().
--- drivers/power/reset/sc27xx-poweroff.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/power/reset/sc27xx-poweroff.c +6 -3
@@ -29,10 +29,13 @@*/ static void sc27xx_poweroff_shutdown (void ) { -#ifdef CONFIG_PM_SLEEP_SMP -int cpu =smp_processor_id (); +#ifdef CONFIG_HOTPLUG_CPU +int cpu; -freeze_secondary_cpus (cpu); +for_each_online_cpu (cpu) { +if (cpu !=smp_processor_id ()) +cpu_down (cpu); + }#endif }
Signature · 1 line
1.9.1
Baolin Wang
maintainerPATCH 3/3 power: reset: sc27xx: Allow the SC27XX poweroff driver building into a module
In reply to Baolin WangChange the config to 'tristate' and use module_platform_driver() to allow the SC27XX poweroff driver building into a module, as well as adding some mudule information.
--- drivers/power/reset/Kconfig | 2 +- drivers/power/reset/sc27xx-poweroff.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/power/reset/Kconfig +1 -1
@@ -248,7 +248,7 @@ config SYSCON_REBOOT_MODE action according to the mode. config POWER_RESET_SC27XX - bool "Spreadtrum SC27xx PMIC power-off driver" + tristate "Spreadtrum SC27xx PMIC power-off driver" depends on MFD_SC27XX_PMIC || COMPILE_TEST help This driver supports powering off a system through
drivers/power/reset/sc27xx-poweroff.c +6 -1
@@ -6,6 +6,7 @@#include <linux/cpu.h> #include <linux/kernel.h> +#include <linux/module.h> #include <linux/platform_device.h> #include <linux/pm.h> #include <linux/regmap.h>
@@ -71,4 +72,8 @@ static int sc27xx_poweroff_probe(struct platform_device *pdev) .name = "sc27xx-poweroff", }, }; -builtin_platform_driver (sc27xx_poweroff_driver); +module_platform_driver (sc27xx_poweroff_driver); + +MODULE_DESCRIPTION ("Power off driver for SC27XX PMIC Device" ); +MODULE_AUTHOR ("Baolin Wang <[email protected]>" ); +MODULE_LICENSE ("GPL v2" );
Signature · 1 line
1.9.1
Sebastian Reichel
maintainerHi,
Quoted 2 lines · Baolin Wang
This patch set fixes external subsystems' power issue and allows the SC27XX poweroff driver building into a module.
Thanks, queued.
-- Sebastian
Quoted 15 lines
Baolin Wang (2):
power: reset: sc27xx: Change to usecpu_down()
power: reset: sc27xx: Allow the SC27XX poweroff driver building into a
moduleSherry Zong (1):
power: reset: sc27xx: Power off the external subsystems' connectiondrivers/power/reset/Kconfig | 2 +- drivers/power/reset/sc27xx-poweroff.c | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-)Signature · 1 line
1.9.1