Linux-RTC Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/9] mfd/rtc/regulator: Drop board file support for Samsung PMIC
@ 2021-04-20 17:01 Krzysztof Kozlowski
  2021-04-20 17:01 ` [PATCH 1/9] mfd: sec: Drop support for board files and require devicetree Krzysztof Kozlowski
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20 17:01 UTC (permalink / raw)
  To: Lee Jones, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz,
	Liam Girdwood, Mark Brown, Alessandro Zummo, Alexandre Belloni,
	linux-kernel, linux-samsung-soc, linux-rtc
  Cc: Marek Szyprowski, Sylwester Nawrocki

Hi,

The Samsung PMIC drivers since long time are used only on devicetree
platforms (Samsung Exynos) and there are no users with board files.

Drop the support for board files entirely and depend on OF for matching.

This makes the code smaller and simpler.

Dependencies
============
The MFD pieces are rebased on my previous sec-core dirver changes:
mfd: sec: Simplify getting of_device_id match data
https://lore.kernel.org/linux-samsung-soc/20210420113929.278082-1-krzysztof.kozlowski@canonical.com/T/#t

Applying - can be independent
=============================
The last RTC and regulator patches can be picked up independently via
regulator and rtc trees.  There are no board files currently, so the
code in these drivers is basically dead code and feature-bisection is
preserved.

Best regards,
Krzysztof


Krzysztof Kozlowski (9):
  mfd: sec: Drop support for board files and require devicetree
  mfd: sec: Remove unused cfg_pmic_irq in platform data
  mfd: sec: Remove unused device_type in platform data
  mfd: sec: Remove unused irq_base in platform data
  mfd: sec: Enable wakeup from suspend via devicetree property
  mfd: sec: Remove unused platform data members
  rtc: s5m: Remove reference to parent's device pdata
  regulator: s2mpa01: Drop initialization via platform data
  regulator: s2mps11: Drop initialization via platform data

 drivers/mfd/Kconfig              |  1 +
 drivers/mfd/sec-core.c           | 64 +++++---------------------------
 drivers/mfd/sec-irq.c            |  4 +-
 drivers/regulator/s2mpa01.c      |  4 --
 drivers/regulator/s2mps11.c      | 22 +----------
 drivers/rtc/rtc-s5m.c            |  6 ---
 include/linux/mfd/samsung/core.h | 33 ----------------
 7 files changed, 14 insertions(+), 120 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/9] mfd: sec: Drop support for board files and require devicetree
  2021-04-20 17:01 [PATCH 0/9] mfd/rtc/regulator: Drop board file support for Samsung PMIC Krzysztof Kozlowski
@ 2021-04-20 17:01 ` Krzysztof Kozlowski
  2021-04-20 17:01 ` [PATCH 2/9] mfd: sec: Remove unused cfg_pmic_irq in platform data Krzysztof Kozlowski
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20 17:01 UTC (permalink / raw)
  To: Lee Jones, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz,
	Liam Girdwood, Mark Brown, Alessandro Zummo, Alexandre Belloni,
	linux-kernel, linux-samsung-soc, linux-rtc
  Cc: Marek Szyprowski, Sylwester Nawrocki

The Samsung PMIC drivers since long time are used only on devicetree
platforms (Samsung Exynos) and there are no users with board files.

Drop the support for board files entirely and depend on OF for matching.

Suggested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/mfd/Kconfig    |  1 +
 drivers/mfd/sec-core.c | 59 +++++++++++-------------------------------
 2 files changed, 16 insertions(+), 44 deletions(-)

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 5c7f2b100191..93a1610128c8 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1133,6 +1133,7 @@ config MFD_RN5T618
 config MFD_SEC_CORE
 	tristate "Samsung Electronics PMIC Series Support"
 	depends on I2C=y
+	depends on OF || COMPILE_TEST
 	select MFD_CORE
 	select REGMAP_I2C
 	select REGMAP_IRQ
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 15dd4c579937..c61c1fc62165 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -94,7 +94,6 @@ static const struct mfd_cell s2mpu02_devs[] = {
 	{ .name = "s2mpu02-regulator", },
 };
 
-#ifdef CONFIG_OF
 static const struct of_device_id sec_dt_match[] = {
 	{
 		.compatible = "samsung,s5m8767-pmic",
@@ -122,7 +121,6 @@ static const struct of_device_id sec_dt_match[] = {
 	},
 };
 MODULE_DEVICE_TABLE(of, sec_dt_match);
-#endif
 
 static bool s2mpa01_volatile(struct device *dev, unsigned int reg)
 {
@@ -282,7 +280,6 @@ static void sec_pmic_configure(struct sec_pmic_dev *sec_pmic)
 	}
 }
 
-#ifdef CONFIG_OF
 /*
  * Only the common platform data elements for s5m8767 are parsed here from the
  * device tree. Other sub-modules of s5m8767 such as pmic, rtc , charger and
@@ -313,28 +310,12 @@ sec_pmic_i2c_parse_dt_pdata(struct device *dev)
 						"samsung,s2mps11-wrstbi-ground");
 	return pd;
 }
-#else
-static struct sec_platform_data *
-sec_pmic_i2c_parse_dt_pdata(struct device *dev)
-{
-	return NULL;
-}
-#endif
-
-static inline unsigned long sec_i2c_get_driver_data(struct i2c_client *i2c,
-						const struct i2c_device_id *id)
-{
-	if (i2c->dev.of_node)
-		return (unsigned long)of_device_get_match_data(&i2c->dev);
-
-	return id->driver_data;
-}
 
 static int sec_pmic_probe(struct i2c_client *i2c,
 			    const struct i2c_device_id *id)
 {
-	struct sec_platform_data *pdata = dev_get_platdata(&i2c->dev);
 	const struct regmap_config *regmap;
+	struct sec_platform_data *pdata;
 	const struct mfd_cell *sec_devs;
 	struct sec_pmic_dev *sec_pmic;
 	unsigned long device_type;
@@ -349,22 +330,19 @@ static int sec_pmic_probe(struct i2c_client *i2c,
 	sec_pmic->dev = &i2c->dev;
 	sec_pmic->i2c = i2c;
 	sec_pmic->irq = i2c->irq;
-	device_type = sec_i2c_get_driver_data(i2c, id);
-
-	if (sec_pmic->dev->of_node) {
-		pdata = sec_pmic_i2c_parse_dt_pdata(sec_pmic->dev);
-		if (IS_ERR(pdata)) {
-			ret = PTR_ERR(pdata);
-			return ret;
-		}
-		pdata->device_type = device_type;
-	}
-	if (pdata) {
-		sec_pmic->device_type = pdata->device_type;
-		sec_pmic->irq_base = pdata->irq_base;
-		sec_pmic->wakeup = pdata->wakeup;
-		sec_pmic->pdata = pdata;
+	device_type = (unsigned long)of_device_get_match_data(sec_pmic->dev);
+
+	pdata = sec_pmic_i2c_parse_dt_pdata(sec_pmic->dev);
+	if (IS_ERR(pdata)) {
+		ret = PTR_ERR(pdata);
+		return ret;
 	}
+	pdata->device_type = device_type;
+
+	sec_pmic->device_type = pdata->device_type;
+	sec_pmic->irq_base = pdata->irq_base;
+	sec_pmic->wakeup = pdata->wakeup;
+	sec_pmic->pdata = pdata;
 
 	switch (sec_pmic->device_type) {
 	case S2MPA01:
@@ -404,7 +382,7 @@ static int sec_pmic_probe(struct i2c_client *i2c,
 		return ret;
 	}
 
-	if (pdata && pdata->cfg_pmic_irq)
+	if (pdata->cfg_pmic_irq)
 		pdata->cfg_pmic_irq();
 
 	sec_irq_init(sec_pmic);
@@ -529,21 +507,14 @@ static int sec_pmic_resume(struct device *dev)
 
 static SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, sec_pmic_suspend, sec_pmic_resume);
 
-static const struct i2c_device_id sec_pmic_id[] = {
-	{ "sec_pmic", 0 },
-	{ }
-};
-MODULE_DEVICE_TABLE(i2c, sec_pmic_id);
-
 static struct i2c_driver sec_pmic_driver = {
 	.driver = {
 		   .name = "sec_pmic",
 		   .pm = &sec_pmic_pm_ops,
-		   .of_match_table = of_match_ptr(sec_dt_match),
+		   .of_match_table = sec_dt_match,
 	},
 	.probe = sec_pmic_probe,
 	.shutdown = sec_pmic_shutdown,
-	.id_table = sec_pmic_id,
 };
 module_i2c_driver(sec_pmic_driver);
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/9] mfd: sec: Remove unused cfg_pmic_irq in platform data
  2021-04-20 17:01 [PATCH 0/9] mfd/rtc/regulator: Drop board file support for Samsung PMIC Krzysztof Kozlowski
  2021-04-20 17:01 ` [PATCH 1/9] mfd: sec: Drop support for board files and require devicetree Krzysztof Kozlowski
@ 2021-04-20 17:01 ` Krzysztof Kozlowski
  2021-04-20 17:01 ` [PATCH 3/9] mfd: sec: Remove unused device_type " Krzysztof Kozlowski
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20 17:01 UTC (permalink / raw)
  To: Lee Jones, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz,
	Liam Girdwood, Mark Brown, Alessandro Zummo, Alexandre Belloni,
	linux-kernel, linux-samsung-soc, linux-rtc
  Cc: Marek Szyprowski, Sylwester Nawrocki

The 'cfg_pmic_irq' field of platform data structure is not used and can
be safely dropped.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/mfd/sec-core.c           | 3 ---
 include/linux/mfd/samsung/core.h | 1 -
 2 files changed, 4 deletions(-)

diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index c61c1fc62165..653d02b98d53 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -382,9 +382,6 @@ static int sec_pmic_probe(struct i2c_client *i2c,
 		return ret;
 	}
 
-	if (pdata->cfg_pmic_irq)
-		pdata->cfg_pmic_irq();
-
 	sec_irq_init(sec_pmic);
 
 	pm_runtime_set_active(sec_pmic->dev);
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index f1631a39acfc..68afc2b97a41 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -85,7 +85,6 @@ struct sec_platform_data {
 	int				num_regulators;
 
 	int				irq_base;
-	int				(*cfg_pmic_irq)(void);
 
 	bool				wakeup;
 	bool				buck_voltage_lock;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 3/9] mfd: sec: Remove unused device_type in platform data
  2021-04-20 17:01 [PATCH 0/9] mfd/rtc/regulator: Drop board file support for Samsung PMIC Krzysztof Kozlowski
  2021-04-20 17:01 ` [PATCH 1/9] mfd: sec: Drop support for board files and require devicetree Krzysztof Kozlowski
  2021-04-20 17:01 ` [PATCH 2/9] mfd: sec: Remove unused cfg_pmic_irq in platform data Krzysztof Kozlowski
@ 2021-04-20 17:01 ` Krzysztof Kozlowski
  2021-04-20 17:01 ` [PATCH 4/9] mfd: sec: Remove unused irq_base " Krzysztof Kozlowski
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20 17:01 UTC (permalink / raw)
  To: Lee Jones, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz,
	Liam Girdwood, Mark Brown, Alessandro Zummo, Alexandre Belloni,
	linux-kernel, linux-samsung-soc, linux-rtc
  Cc: Marek Szyprowski, Sylwester Nawrocki

The 'device_type' field of platform data structure is not used and can
be safely dropped.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/mfd/sec-core.c           | 5 +----
 include/linux/mfd/samsung/core.h | 1 -
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 653d02b98d53..4c4db3171ce6 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -318,7 +318,6 @@ static int sec_pmic_probe(struct i2c_client *i2c,
 	struct sec_platform_data *pdata;
 	const struct mfd_cell *sec_devs;
 	struct sec_pmic_dev *sec_pmic;
-	unsigned long device_type;
 	int ret, num_sec_devs;
 
 	sec_pmic = devm_kzalloc(&i2c->dev, sizeof(struct sec_pmic_dev),
@@ -330,16 +329,14 @@ static int sec_pmic_probe(struct i2c_client *i2c,
 	sec_pmic->dev = &i2c->dev;
 	sec_pmic->i2c = i2c;
 	sec_pmic->irq = i2c->irq;
-	device_type = (unsigned long)of_device_get_match_data(sec_pmic->dev);
 
 	pdata = sec_pmic_i2c_parse_dt_pdata(sec_pmic->dev);
 	if (IS_ERR(pdata)) {
 		ret = PTR_ERR(pdata);
 		return ret;
 	}
-	pdata->device_type = device_type;
 
-	sec_pmic->device_type = pdata->device_type;
+	sec_pmic->device_type = (unsigned long)of_device_get_match_data(sec_pmic->dev);
 	sec_pmic->irq_base = pdata->irq_base;
 	sec_pmic->wakeup = pdata->wakeup;
 	sec_pmic->pdata = pdata;
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 68afc2b97a41..bfde1b7c6303 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -81,7 +81,6 @@ int sec_irq_resume(struct sec_pmic_dev *sec_pmic);
 struct sec_platform_data {
 	struct sec_regulator_data	*regulators;
 	struct sec_opmode_data		*opmode;
-	int				device_type;
 	int				num_regulators;
 
 	int				irq_base;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 4/9] mfd: sec: Remove unused irq_base in platform data
  2021-04-20 17:01 [PATCH 0/9] mfd/rtc/regulator: Drop board file support for Samsung PMIC Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2021-04-20 17:01 ` [PATCH 3/9] mfd: sec: Remove unused device_type " Krzysztof Kozlowski
@ 2021-04-20 17:01 ` Krzysztof Kozlowski
  2021-04-20 17:02 ` [PATCH 5/9] mfd: sec: Enable wakeup from suspend via devicetree property Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20 17:01 UTC (permalink / raw)
  To: Lee Jones, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz,
	Liam Girdwood, Mark Brown, Alessandro Zummo, Alexandre Belloni,
	linux-kernel, linux-samsung-soc, linux-rtc
  Cc: Marek Szyprowski, Sylwester Nawrocki

The 'irq_base' field of platform data structure is not assigned,
therefore its default value of 0 has no impact and can be safely
dropped.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/mfd/sec-core.c           | 1 -
 drivers/mfd/sec-irq.c            | 4 +---
 include/linux/mfd/samsung/core.h | 3 ---
 3 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 4c4db3171ce6..a9d4fbc51997 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -337,7 +337,6 @@ static int sec_pmic_probe(struct i2c_client *i2c,
 	}
 
 	sec_pmic->device_type = (unsigned long)of_device_get_match_data(sec_pmic->dev);
-	sec_pmic->irq_base = pdata->irq_base;
 	sec_pmic->wakeup = pdata->wakeup;
 	sec_pmic->pdata = pdata;
 
diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c
index a98c5d165039..e473c2fb42d5 100644
--- a/drivers/mfd/sec-irq.c
+++ b/drivers/mfd/sec-irq.c
@@ -444,7 +444,6 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic)
 	if (!sec_pmic->irq) {
 		dev_warn(sec_pmic->dev,
 			 "No interrupt specified, no interrupts\n");
-		sec_pmic->irq_base = 0;
 		return 0;
 	}
 
@@ -482,8 +481,7 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic)
 	ret = devm_regmap_add_irq_chip(sec_pmic->dev, sec_pmic->regmap_pmic,
 				       sec_pmic->irq,
 				       IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
-				       sec_pmic->irq_base, sec_irq_chip,
-				       &sec_pmic->irq_data);
+				       0, sec_irq_chip, &sec_pmic->irq_data);
 	if (ret != 0) {
 		dev_err(sec_pmic->dev, "Failed to register IRQ chip: %d\n", ret);
 		return ret;
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index bfde1b7c6303..9864f13b7814 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -67,7 +67,6 @@ struct sec_pmic_dev {
 	struct i2c_client *i2c;
 
 	unsigned long device_type;
-	int irq_base;
 	int irq;
 	struct regmap_irq_chip_data *irq_data;
 
@@ -83,8 +82,6 @@ struct sec_platform_data {
 	struct sec_opmode_data		*opmode;
 	int				num_regulators;
 
-	int				irq_base;
-
 	bool				wakeup;
 	bool				buck_voltage_lock;
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 5/9] mfd: sec: Enable wakeup from suspend via devicetree property
  2021-04-20 17:01 [PATCH 0/9] mfd/rtc/regulator: Drop board file support for Samsung PMIC Krzysztof Kozlowski
                   ` (3 preceding siblings ...)
  2021-04-20 17:01 ` [PATCH 4/9] mfd: sec: Remove unused irq_base " Krzysztof Kozlowski
@ 2021-04-20 17:02 ` Krzysztof Kozlowski
  2021-04-20 17:02   ` [PATCH 6/9] mfd: sec: Remove unused platform data members Krzysztof Kozlowski
                     ` (3 more replies)
  2021-04-21 19:03 ` (subset) [PATCH 0/9] mfd/rtc/regulator: Drop board file support for Samsung PMIC Mark Brown
  2021-04-29 21:29 ` Alexandre Belloni
  6 siblings, 4 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20 17:02 UTC (permalink / raw)
  To: Lee Jones, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz,
	Liam Girdwood, Mark Brown, Alessandro Zummo, Alexandre Belloni,
	linux-kernel, linux-samsung-soc, linux-rtc
  Cc: Marek Szyprowski, Sylwester Nawrocki

Set device wakeup capability from devicetree property (done by drivers
core), instead of always setting it to 0 (because value in platform data
is not assigned).

This should not have visible effect on actual resuming from suspend
because the child device - S5M RTC driver - is responsible for waking
up and sets device wakeup unconditionally.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/mfd/sec-core.c           | 8 --------
 include/linux/mfd/samsung/core.h | 3 ---
 2 files changed, 11 deletions(-)

diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index a9d4fbc51997..1fb29c45f5cf 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -298,12 +298,6 @@ sec_pmic_i2c_parse_dt_pdata(struct device *dev)
 	if (!pd)
 		return ERR_PTR(-ENOMEM);
 
-	/*
-	 * ToDo: the 'wakeup' member in the platform data is more of a linux
-	 * specfic information. Hence, there is no binding for that yet and
-	 * not parsed here.
-	 */
-
 	pd->manual_poweroff = of_property_read_bool(dev->of_node,
 						"samsung,s2mps11-acokb-ground");
 	pd->disable_wrstbi = of_property_read_bool(dev->of_node,
@@ -337,7 +331,6 @@ static int sec_pmic_probe(struct i2c_client *i2c,
 	}
 
 	sec_pmic->device_type = (unsigned long)of_device_get_match_data(sec_pmic->dev);
-	sec_pmic->wakeup = pdata->wakeup;
 	sec_pmic->pdata = pdata;
 
 	switch (sec_pmic->device_type) {
@@ -429,7 +422,6 @@ static int sec_pmic_probe(struct i2c_client *i2c,
 	if (ret)
 		return ret;
 
-	device_init_wakeup(sec_pmic->dev, sec_pmic->wakeup);
 	sec_pmic_configure(sec_pmic);
 	sec_pmic_dump_rev(sec_pmic);
 
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 9864f13b7814..b0d049a56d16 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -69,8 +69,6 @@ struct sec_pmic_dev {
 	unsigned long device_type;
 	int irq;
 	struct regmap_irq_chip_data *irq_data;
-
-	bool wakeup;
 };
 
 int sec_irq_init(struct sec_pmic_dev *sec_pmic);
@@ -82,7 +80,6 @@ struct sec_platform_data {
 	struct sec_opmode_data		*opmode;
 	int				num_regulators;
 
-	bool				wakeup;
 	bool				buck_voltage_lock;
 
 	int				buck_gpios[3];
-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 6/9] mfd: sec: Remove unused platform data members
  2021-04-20 17:02 ` [PATCH 5/9] mfd: sec: Enable wakeup from suspend via devicetree property Krzysztof Kozlowski
@ 2021-04-20 17:02   ` Krzysztof Kozlowski
  2021-04-20 17:02   ` [PATCH 7/9] rtc: s5m: Remove reference to parent's device pdata Krzysztof Kozlowski
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20 17:02 UTC (permalink / raw)
  To: Lee Jones, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz,
	Liam Girdwood, Mark Brown, Alessandro Zummo, Alexandre Belloni,
	linux-kernel, linux-samsung-soc, linux-rtc
  Cc: Marek Szyprowski, Sylwester Nawrocki

The Samsung PMIC drivers for early chipsets like S5M8767 stored quite a
lot in platform data (struct sec_platform_data).  The s5m8767 regulator
driver currently references only some of its fields.  Newer regulator
drivers (e.g. s2mps11) use even less platform data fields.

Clean up the structure to reduce memory footprint and source code size.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 include/linux/mfd/samsung/core.h | 25 -------------------------
 1 file changed, 25 deletions(-)

diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index b0d049a56d16..f92fe090473d 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -80,8 +80,6 @@ struct sec_platform_data {
 	struct sec_opmode_data		*opmode;
 	int				num_regulators;
 
-	bool				buck_voltage_lock;
-
 	int				buck_gpios[3];
 	int				buck_ds[3];
 	unsigned int			buck2_voltage[8];
@@ -91,35 +89,12 @@ struct sec_platform_data {
 	unsigned int			buck4_voltage[8];
 	bool				buck4_gpiodvs;
 
-	int				buck_set1;
-	int				buck_set2;
-	int				buck_set3;
-	int				buck2_enable;
-	int				buck3_enable;
-	int				buck4_enable;
 	int				buck_default_idx;
-	int				buck2_default_idx;
-	int				buck3_default_idx;
-	int				buck4_default_idx;
-
 	int				buck_ramp_delay;
 
-	int				buck2_ramp_delay;
-	int				buck34_ramp_delay;
-	int				buck5_ramp_delay;
-	int				buck16_ramp_delay;
-	int				buck7810_ramp_delay;
-	int				buck9_ramp_delay;
-	int				buck24_ramp_delay;
-	int				buck3_ramp_delay;
-	int				buck7_ramp_delay;
-	int				buck8910_ramp_delay;
-
-	bool				buck1_ramp_enable;
 	bool				buck2_ramp_enable;
 	bool				buck3_ramp_enable;
 	bool				buck4_ramp_enable;
-	bool				buck6_ramp_enable;
 
 	int				buck2_init;
 	int				buck3_init;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 7/9] rtc: s5m: Remove reference to parent's device pdata
  2021-04-20 17:02 ` [PATCH 5/9] mfd: sec: Enable wakeup from suspend via devicetree property Krzysztof Kozlowski
  2021-04-20 17:02   ` [PATCH 6/9] mfd: sec: Remove unused platform data members Krzysztof Kozlowski
@ 2021-04-20 17:02   ` Krzysztof Kozlowski
  2021-04-20 17:02   ` [PATCH 8/9] regulator: s2mpa01: Drop initialization via platform data Krzysztof Kozlowski
  2021-04-20 17:02   ` [PATCH 9/9] regulator: s2mps11: " Krzysztof Kozlowski
  3 siblings, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20 17:02 UTC (permalink / raw)
  To: Lee Jones, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz,
	Liam Girdwood, Mark Brown, Alessandro Zummo, Alexandre Belloni,
	linux-kernel, linux-samsung-soc, linux-rtc
  Cc: Marek Szyprowski, Sylwester Nawrocki

The S5M RTC driver does not use parent's device (sec-core PMIC driver)
platform data so there is no need to check for it.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/rtc/rtc-s5m.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index 80b66f16db89..038269a6b08c 100644
--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -713,16 +713,10 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info)
 static int s5m_rtc_probe(struct platform_device *pdev)
 {
 	struct sec_pmic_dev *s5m87xx = dev_get_drvdata(pdev->dev.parent);
-	struct sec_platform_data *pdata = s5m87xx->pdata;
 	struct s5m_rtc_info *info;
 	const struct regmap_config *regmap_cfg;
 	int ret, alarm_irq;
 
-	if (!pdata) {
-		dev_err(pdev->dev.parent, "Platform data not supplied\n");
-		return -ENODEV;
-	}
-
 	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
 	if (!info)
 		return -ENOMEM;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 8/9] regulator: s2mpa01: Drop initialization via platform data
  2021-04-20 17:02 ` [PATCH 5/9] mfd: sec: Enable wakeup from suspend via devicetree property Krzysztof Kozlowski
  2021-04-20 17:02   ` [PATCH 6/9] mfd: sec: Remove unused platform data members Krzysztof Kozlowski
  2021-04-20 17:02   ` [PATCH 7/9] rtc: s5m: Remove reference to parent's device pdata Krzysztof Kozlowski
@ 2021-04-20 17:02   ` Krzysztof Kozlowski
  2021-04-20 17:02   ` [PATCH 9/9] regulator: s2mps11: " Krzysztof Kozlowski
  3 siblings, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20 17:02 UTC (permalink / raw)
  To: Lee Jones, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz,
	Liam Girdwood, Mark Brown, Alessandro Zummo, Alexandre Belloni,
	linux-kernel, linux-samsung-soc, linux-rtc
  Cc: Marek Szyprowski, Sylwester Nawrocki

None of the platforms with S2MPA01 use board files, so any
initialization via platform data can be safely removed.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/regulator/s2mpa01.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/regulator/s2mpa01.c b/drivers/regulator/s2mpa01.c
index 115f59530852..28b424fe7bea 100644
--- a/drivers/regulator/s2mpa01.c
+++ b/drivers/regulator/s2mpa01.c
@@ -340,7 +340,6 @@ static const struct regulator_desc regulators[] = {
 static int s2mpa01_pmic_probe(struct platform_device *pdev)
 {
 	struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
-	struct sec_platform_data *pdata = dev_get_platdata(iodev->dev);
 	struct regulator_config config = { };
 	struct s2mpa01_info *s2mpa01;
 	int i;
@@ -356,9 +355,6 @@ static int s2mpa01_pmic_probe(struct platform_device *pdev)
 	for (i = 0; i < S2MPA01_REGULATOR_MAX; i++) {
 		struct regulator_dev *rdev;
 
-		if (pdata)
-			config.init_data = pdata->regulators[i].initdata;
-
 		rdev = devm_regulator_register(&pdev->dev,
 						&regulators[i], &config);
 		if (IS_ERR(rdev)) {
-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 9/9] regulator: s2mps11: Drop initialization via platform data
  2021-04-20 17:02 ` [PATCH 5/9] mfd: sec: Enable wakeup from suspend via devicetree property Krzysztof Kozlowski
                     ` (2 preceding siblings ...)
  2021-04-20 17:02   ` [PATCH 8/9] regulator: s2mpa01: Drop initialization via platform data Krzysztof Kozlowski
@ 2021-04-20 17:02   ` Krzysztof Kozlowski
  3 siblings, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-20 17:02 UTC (permalink / raw)
  To: Lee Jones, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz,
	Liam Girdwood, Mark Brown, Alessandro Zummo, Alexandre Belloni,
	linux-kernel, linux-samsung-soc, linux-rtc
  Cc: Marek Szyprowski, Sylwester Nawrocki

None of the platforms with S2MPS11 use board files, so any
initialization via platform data can be safely removed.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/regulator/s2mps11.c | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 33cf84bce05a..ebc67e3ddd4f 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -1120,7 +1120,6 @@ static const struct regulator_desc s2mpu02_regulators[] = {
 static int s2mps11_pmic_probe(struct platform_device *pdev)
 {
 	struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
-	struct sec_platform_data *pdata = NULL;
 	struct of_regulator_match *rdata = NULL;
 	struct regulator_config config = { };
 	struct s2mps11_info *s2mps11;
@@ -1171,17 +1170,6 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
 	if (!s2mps11->ext_control_gpiod)
 		return -ENOMEM;
 
-	if (!iodev->dev->of_node) {
-		if (iodev->pdata) {
-			pdata = iodev->pdata;
-			goto common_reg;
-		} else {
-			dev_err(pdev->dev.parent,
-				"Platform data or DT node not supplied\n");
-			return -ENODEV;
-		}
-	}
-
 	rdata = kcalloc(rdev_num, sizeof(*rdata), GFP_KERNEL);
 	if (!rdata)
 		return -ENOMEM;
@@ -1193,7 +1181,6 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
 	if (ret)
 		goto out;
 
-common_reg:
 	platform_set_drvdata(pdev, s2mps11);
 
 	config.dev = &pdev->dev;
@@ -1202,13 +1189,8 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
 	for (i = 0; i < rdev_num; i++) {
 		struct regulator_dev *regulator;
 
-		if (pdata) {
-			config.init_data = pdata->regulators[i].initdata;
-			config.of_node = pdata->regulators[i].reg_node;
-		} else {
-			config.init_data = rdata[i].init_data;
-			config.of_node = rdata[i].of_node;
-		}
+		config.init_data = rdata[i].init_data;
+		config.of_node = rdata[i].of_node;
 		config.ena_gpiod = s2mps11->ext_control_gpiod[i];
 		/*
 		 * Hand the GPIO descriptor management over to the regulator
-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: (subset) [PATCH 0/9] mfd/rtc/regulator: Drop board file support for Samsung PMIC
  2021-04-20 17:01 [PATCH 0/9] mfd/rtc/regulator: Drop board file support for Samsung PMIC Krzysztof Kozlowski
                   ` (4 preceding siblings ...)
  2021-04-20 17:02 ` [PATCH 5/9] mfd: sec: Enable wakeup from suspend via devicetree property Krzysztof Kozlowski
@ 2021-04-21 19:03 ` Mark Brown
  2021-04-29 21:29 ` Alexandre Belloni
  6 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2021-04-21 19:03 UTC (permalink / raw)
  To: linux-rtc, Bartlomiej Zolnierkiewicz, linux-samsung-soc,
	Liam Girdwood, linux-kernel, Lee Jones, Alexandre Belloni,
	Alessandro Zummo, Krzysztof Kozlowski
  Cc: Mark Brown, Marek Szyprowski, Sylwester Nawrocki

On Tue, 20 Apr 2021 19:01:09 +0200, Krzysztof Kozlowski wrote:
> The Samsung PMIC drivers since long time are used only on devicetree
> platforms (Samsung Exynos) and there are no users with board files.
> 
> Drop the support for board files entirely and depend on OF for matching.
> 
> This makes the code smaller and simpler.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[8/9] regulator: s2mpa01: Drop initialization via platform data
      commit: 378b40ae1a8639f03192711573e478a367ccb6e1
[9/9] regulator: s2mps11: Drop initialization via platform data
      commit: beeab9bc8e85de6cacbbb2124a464166f2f5043d

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: (subset) [PATCH 0/9] mfd/rtc/regulator: Drop board file support for Samsung PMIC
  2021-04-20 17:01 [PATCH 0/9] mfd/rtc/regulator: Drop board file support for Samsung PMIC Krzysztof Kozlowski
                   ` (5 preceding siblings ...)
  2021-04-21 19:03 ` (subset) [PATCH 0/9] mfd/rtc/regulator: Drop board file support for Samsung PMIC Mark Brown
@ 2021-04-29 21:29 ` Alexandre Belloni
  6 siblings, 0 replies; 12+ messages in thread
From: Alexandre Belloni @ 2021-04-29 21:29 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Mark Brown, Alessandro Zummo,
	linux-samsung-soc, linux-rtc, Lee Jones,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, linux-kernel
  Cc: Alexandre Belloni, Marek Szyprowski, Sylwester Nawrocki

On Tue, 20 Apr 2021 19:01:09 +0200, Krzysztof Kozlowski wrote:
> The Samsung PMIC drivers since long time are used only on devicetree
> platforms (Samsung Exynos) and there are no users with board files.
> 
> Drop the support for board files entirely and depend on OF for matching.
> 
> This makes the code smaller and simpler.
> 
> [...]

Applied, thanks!

[7/9] rtc: s5m: Remove reference to parent's device pdata
      commit: aa364b12fd7404374a8a6c55ec2e4a70aba9a574

Best regards,
-- 
Alexandre Belloni <alexandre.belloni@bootlin.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, back to index

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20 17:01 [PATCH 0/9] mfd/rtc/regulator: Drop board file support for Samsung PMIC Krzysztof Kozlowski
2021-04-20 17:01 ` [PATCH 1/9] mfd: sec: Drop support for board files and require devicetree Krzysztof Kozlowski
2021-04-20 17:01 ` [PATCH 2/9] mfd: sec: Remove unused cfg_pmic_irq in platform data Krzysztof Kozlowski
2021-04-20 17:01 ` [PATCH 3/9] mfd: sec: Remove unused device_type " Krzysztof Kozlowski
2021-04-20 17:01 ` [PATCH 4/9] mfd: sec: Remove unused irq_base " Krzysztof Kozlowski
2021-04-20 17:02 ` [PATCH 5/9] mfd: sec: Enable wakeup from suspend via devicetree property Krzysztof Kozlowski
2021-04-20 17:02   ` [PATCH 6/9] mfd: sec: Remove unused platform data members Krzysztof Kozlowski
2021-04-20 17:02   ` [PATCH 7/9] rtc: s5m: Remove reference to parent's device pdata Krzysztof Kozlowski
2021-04-20 17:02   ` [PATCH 8/9] regulator: s2mpa01: Drop initialization via platform data Krzysztof Kozlowski
2021-04-20 17:02   ` [PATCH 9/9] regulator: s2mps11: " Krzysztof Kozlowski
2021-04-21 19:03 ` (subset) [PATCH 0/9] mfd/rtc/regulator: Drop board file support for Samsung PMIC Mark Brown
2021-04-29 21:29 ` Alexandre Belloni

Linux-RTC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rtc/0 linux-rtc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rtc linux-rtc/ https://lore.kernel.org/linux-rtc \
		linux-rtc@vger.kernel.org
	public-inbox-index linux-rtc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rtc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git