[PATCH 3/3] power: reset: sc27xx: Drop unused driver

Otto Pflüger posted 3 patches 4 months ago
There is a newer version of this series
[PATCH 3/3] power: reset: sc27xx: Drop unused driver
Posted by Otto Pflüger 4 months ago
This driver was never actually probed because it was missing an OF match
table and was not integrated into the MFD driver. Remove it now that the
power off functionality is handled directly in the MFD driver.

Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
 drivers/power/reset/Kconfig           |  9 ----
 drivers/power/reset/Makefile          |  1 -
 drivers/power/reset/sc27xx-poweroff.c | 79 -----------------------------------
 3 files changed, 89 deletions(-)

diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index 8248895ca90389c1db33c7b09e5f5925a9034cee..c4a28f6f04f6be13d20ce2b08427fd1679b1df5a 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -320,15 +320,6 @@ config SYSCON_REBOOT_MODE
 	  register, then the bootloader can read it to take different
 	  action according to the mode.
 
-config POWER_RESET_SC27XX
-	tristate "Spreadtrum SC27xx PMIC power-off driver"
-	depends on MFD_SC27XX_PMIC || COMPILE_TEST
-	help
-	  This driver supports powering off a system through
-	  Spreadtrum SC27xx series PMICs. The SC27xx series
-	  PMICs includes the SC2720, SC2721, SC2723, SC2730
-	  and SC2731 chips.
-
 config NVMEM_REBOOT_MODE
 	tristate "Generic NVMEM reboot mode driver"
 	depends on OF
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
index 51da87e05ce76bc608d961485063555c3ba5d96c..cabaa0de2de68794bea5f9523855bb9ef0083ef0 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -37,6 +37,5 @@ obj-$(CONFIG_POWER_RESET_SYSCON_POWEROFF) += syscon-poweroff.o
 obj-$(CONFIG_POWER_RESET_RMOBILE) += rmobile-reset.o
 obj-$(CONFIG_REBOOT_MODE) += reboot-mode.o
 obj-$(CONFIG_SYSCON_REBOOT_MODE) += syscon-reboot-mode.o
-obj-$(CONFIG_POWER_RESET_SC27XX) += sc27xx-poweroff.o
 obj-$(CONFIG_NVMEM_REBOOT_MODE) += nvmem-reboot-mode.o
 obj-$(CONFIG_POWER_MLXBF) += pwr-mlxbf.o
diff --git a/drivers/power/reset/sc27xx-poweroff.c b/drivers/power/reset/sc27xx-poweroff.c
deleted file mode 100644
index 90287c31992c4889f9241e82a21a1949ecca7702..0000000000000000000000000000000000000000
--- a/drivers/power/reset/sc27xx-poweroff.c
+++ /dev/null
@@ -1,79 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2018 Spreadtrum Communications Inc.
- * Copyright (C) 2018 Linaro Ltd.
- */
-
-#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>
-#include <linux/syscore_ops.h>
-
-#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;
-
-/*
- * On Spreadtrum platform, we need power off system through external SC27xx
- * series PMICs, and it is one similar SPI bus mapped by regmap to access PMIC,
- * which is not fast io access.
- *
- * So before stopping other cores, we need release other cores' resource by
- * taking cpus down to avoid racing regmap or spi mutex lock when poweroff
- * system through PMIC.
- */
-static void sc27xx_poweroff_shutdown(void)
-{
-#ifdef CONFIG_HOTPLUG_CPU
-	int cpu;
-
-	for_each_online_cpu(cpu) {
-		if (cpu != smp_processor_id())
-			remove_cpu(cpu);
-	}
-#endif
-}
-
-static struct syscore_ops poweroff_syscore_ops = {
-	.shutdown = sc27xx_poweroff_shutdown,
-};
-
-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);
-}
-
-static int sc27xx_poweroff_probe(struct platform_device *pdev)
-{
-	if (regmap)
-		return -EINVAL;
-
-	regmap = dev_get_regmap(pdev->dev.parent, NULL);
-	if (!regmap)
-		return -ENODEV;
-
-	pm_power_off = sc27xx_poweroff_do_poweroff;
-	register_syscore_ops(&poweroff_syscore_ops);
-	return 0;
-}
-
-static struct platform_driver sc27xx_poweroff_driver = {
-	.probe = sc27xx_poweroff_probe,
-	.driver = {
-		.name = "sc27xx-poweroff",
-	},
-};
-module_platform_driver(sc27xx_poweroff_driver);
-
-MODULE_DESCRIPTION("Power off driver for SC27XX PMIC Device");
-MODULE_AUTHOR("Baolin Wang <baolin.wang@unisoc.com>");
-MODULE_LICENSE("GPL v2");

-- 
2.50.0

Re: [PATCH 3/3] power: reset: sc27xx: Drop unused driver
Posted by Sebastian Reichel 3 months, 1 week ago
Hi,

On Tue, Oct 07, 2025 at 08:14:21PM +0200, Otto Pflüger wrote:
> This driver was never actually probed because it was missing an OF match
> table and was not integrated into the MFD driver. Remove it now that the
> power off functionality is handled directly in the MFD driver.
> 
> Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>

Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>

-- Sebastian

>  drivers/power/reset/Kconfig           |  9 ----
>  drivers/power/reset/Makefile          |  1 -
>  drivers/power/reset/sc27xx-poweroff.c | 79 -----------------------------------
>  3 files changed, 89 deletions(-)
> 
> diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
> index 8248895ca90389c1db33c7b09e5f5925a9034cee..c4a28f6f04f6be13d20ce2b08427fd1679b1df5a 100644
> --- a/drivers/power/reset/Kconfig
> +++ b/drivers/power/reset/Kconfig
> @@ -320,15 +320,6 @@ config SYSCON_REBOOT_MODE
>  	  register, then the bootloader can read it to take different
>  	  action according to the mode.
>  
> -config POWER_RESET_SC27XX
> -	tristate "Spreadtrum SC27xx PMIC power-off driver"
> -	depends on MFD_SC27XX_PMIC || COMPILE_TEST
> -	help
> -	  This driver supports powering off a system through
> -	  Spreadtrum SC27xx series PMICs. The SC27xx series
> -	  PMICs includes the SC2720, SC2721, SC2723, SC2730
> -	  and SC2731 chips.
> -
>  config NVMEM_REBOOT_MODE
>  	tristate "Generic NVMEM reboot mode driver"
>  	depends on OF
> diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
> index 51da87e05ce76bc608d961485063555c3ba5d96c..cabaa0de2de68794bea5f9523855bb9ef0083ef0 100644
> --- a/drivers/power/reset/Makefile
> +++ b/drivers/power/reset/Makefile
> @@ -37,6 +37,5 @@ obj-$(CONFIG_POWER_RESET_SYSCON_POWEROFF) += syscon-poweroff.o
>  obj-$(CONFIG_POWER_RESET_RMOBILE) += rmobile-reset.o
>  obj-$(CONFIG_REBOOT_MODE) += reboot-mode.o
>  obj-$(CONFIG_SYSCON_REBOOT_MODE) += syscon-reboot-mode.o
> -obj-$(CONFIG_POWER_RESET_SC27XX) += sc27xx-poweroff.o
>  obj-$(CONFIG_NVMEM_REBOOT_MODE) += nvmem-reboot-mode.o
>  obj-$(CONFIG_POWER_MLXBF) += pwr-mlxbf.o
> diff --git a/drivers/power/reset/sc27xx-poweroff.c b/drivers/power/reset/sc27xx-poweroff.c
> deleted file mode 100644
> index 90287c31992c4889f9241e82a21a1949ecca7702..0000000000000000000000000000000000000000
> --- a/drivers/power/reset/sc27xx-poweroff.c
> +++ /dev/null
> @@ -1,79 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * Copyright (C) 2018 Spreadtrum Communications Inc.
> - * Copyright (C) 2018 Linaro Ltd.
> - */
> -
> -#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>
> -#include <linux/syscore_ops.h>
> -
> -#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;
> -
> -/*
> - * On Spreadtrum platform, we need power off system through external SC27xx
> - * series PMICs, and it is one similar SPI bus mapped by regmap to access PMIC,
> - * which is not fast io access.
> - *
> - * So before stopping other cores, we need release other cores' resource by
> - * taking cpus down to avoid racing regmap or spi mutex lock when poweroff
> - * system through PMIC.
> - */
> -static void sc27xx_poweroff_shutdown(void)
> -{
> -#ifdef CONFIG_HOTPLUG_CPU
> -	int cpu;
> -
> -	for_each_online_cpu(cpu) {
> -		if (cpu != smp_processor_id())
> -			remove_cpu(cpu);
> -	}
> -#endif
> -}
> -
> -static struct syscore_ops poweroff_syscore_ops = {
> -	.shutdown = sc27xx_poweroff_shutdown,
> -};
> -
> -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);
> -}
> -
> -static int sc27xx_poweroff_probe(struct platform_device *pdev)
> -{
> -	if (regmap)
> -		return -EINVAL;
> -
> -	regmap = dev_get_regmap(pdev->dev.parent, NULL);
> -	if (!regmap)
> -		return -ENODEV;
> -
> -	pm_power_off = sc27xx_poweroff_do_poweroff;
> -	register_syscore_ops(&poweroff_syscore_ops);
> -	return 0;
> -}
> -
> -static struct platform_driver sc27xx_poweroff_driver = {
> -	.probe = sc27xx_poweroff_probe,
> -	.driver = {
> -		.name = "sc27xx-poweroff",
> -	},
> -};
> -module_platform_driver(sc27xx_poweroff_driver);
> -
> -MODULE_DESCRIPTION("Power off driver for SC27XX PMIC Device");
> -MODULE_AUTHOR("Baolin Wang <baolin.wang@unisoc.com>");
> -MODULE_LICENSE("GPL v2");
> 
> -- 
> 2.50.0
>