All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart
@ 2018-06-06  9:59 Marek Vasut
  2018-06-06  9:59 ` [PATCH v5 02/14] mfd: da9063: Replace mfd_add_devices " Marek Vasut
                   ` (13 more replies)
  0 siblings, 14 replies; 28+ messages in thread
From: Marek Vasut @ 2018-06-06  9:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Vasut, Geert Uytterhoeven, Lee Jones, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

Use devm_regmap_add_irq_chip() instead of plain regmap_add_irq_chip(),
which removes the need for da9063_irq_exit() altogether and also
fixes a bug in da9063_device_init() where the da9063_irq_exit() was
not called in a failpath.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Steve Twiss <stwiss.opensource@diasemi.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org
---
V5: New patch
---
 drivers/mfd/da9063-core.c       | 1 -
 drivers/mfd/da9063-irq.c        | 8 ++------
 include/linux/mfd/da9063/core.h | 1 -
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/mfd/da9063-core.c b/drivers/mfd/da9063-core.c
index 6c2870d4e754..2647bb371d86 100644
--- a/drivers/mfd/da9063-core.c
+++ b/drivers/mfd/da9063-core.c
@@ -238,7 +238,6 @@ int da9063_device_init(struct da9063 *da9063, unsigned int irq)
 void da9063_device_exit(struct da9063 *da9063)
 {
 	mfd_remove_devices(da9063->dev);
-	da9063_irq_exit(da9063);
 }
 
 MODULE_DESCRIPTION("PMIC driver for Dialog DA9063");
diff --git a/drivers/mfd/da9063-irq.c b/drivers/mfd/da9063-irq.c
index 207bbfe55449..da6ceb41f0d1 100644
--- a/drivers/mfd/da9063-irq.c
+++ b/drivers/mfd/da9063-irq.c
@@ -170,7 +170,8 @@ int da9063_irq_init(struct da9063 *da9063)
 		return -EINVAL;
 	}
 
-	ret = regmap_add_irq_chip(da9063->regmap, da9063->chip_irq,
+	ret = devm_regmap_add_irq_chip(da9063->dev, da9063->regmap,
+			da9063->chip_irq,
 			IRQF_TRIGGER_LOW | IRQF_ONESHOT | IRQF_SHARED,
 			da9063->irq_base, &da9063_irq_chip,
 			&da9063->regmap_irq);
@@ -182,8 +183,3 @@ int da9063_irq_init(struct da9063 *da9063)
 
 	return 0;
 }
-
-void da9063_irq_exit(struct da9063 *da9063)
-{
-	regmap_del_irq_chip(da9063->chip_irq, da9063->regmap_irq);
-}
diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h
index f3ae65db4c86..9ab7049977aa 100644
--- a/include/linux/mfd/da9063/core.h
+++ b/include/linux/mfd/da9063/core.h
@@ -95,6 +95,5 @@ int da9063_device_init(struct da9063 *da9063, unsigned int irq);
 int da9063_irq_init(struct da9063 *da9063);
 
 void da9063_device_exit(struct da9063 *da9063);
-void da9063_irq_exit(struct da9063 *da9063);
 
 #endif /* __MFD_DA9063_CORE_H__ */
-- 
2.16.2

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

* [PATCH v5 02/14] mfd: da9063: Replace mfd_add_devices with devm counterpart
  2018-06-06  9:59 [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
@ 2018-06-06  9:59 ` Marek Vasut
  2018-06-07  7:07   ` Lee Jones
  2018-06-06  9:59 ` [PATCH v5 03/14] mfd: da9063: Use regmap_reg_range Marek Vasut
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Marek Vasut @ 2018-06-06  9:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Vasut, Geert Uytterhoeven, Lee Jones, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

Use devm_mfd_add_devices() instead of plain mfd_add_devices(), which
removes the need for da9063_device_exit() altogether and also for the
.remove callback in da9063-i2c.c .

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Steve Twiss <stwiss.opensource@diasemi.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org
---
V5: New patch
---
 drivers/mfd/da9063-core.c       | 11 +++--------
 drivers/mfd/da9063-i2c.c        | 10 ----------
 include/linux/mfd/da9063/core.h |  2 --
 3 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/drivers/mfd/da9063-core.c b/drivers/mfd/da9063-core.c
index 2647bb371d86..76258e5709f8 100644
--- a/drivers/mfd/da9063-core.c
+++ b/drivers/mfd/da9063-core.c
@@ -226,20 +226,15 @@ int da9063_device_init(struct da9063 *da9063, unsigned int irq)
 
 	da9063->irq_base = regmap_irq_chip_get_base(da9063->regmap_irq);
 
-	ret = mfd_add_devices(da9063->dev, -1, da9063_devs,
-			      ARRAY_SIZE(da9063_devs), NULL, da9063->irq_base,
-			      NULL);
+	ret = devm_mfd_add_devices(da9063->dev, -1, da9063_devs,
+				   ARRAY_SIZE(da9063_devs), NULL,
+				   da9063->irq_base, NULL);
 	if (ret)
 		dev_err(da9063->dev, "Cannot add MFD cells\n");
 
 	return ret;
 }
 
-void da9063_device_exit(struct da9063 *da9063)
-{
-	mfd_remove_devices(da9063->dev);
-}
-
 MODULE_DESCRIPTION("PMIC driver for Dialog DA9063");
 MODULE_AUTHOR("Krystian Garbaciak");
 MODULE_AUTHOR("Michal Hajduk");
diff --git a/drivers/mfd/da9063-i2c.c b/drivers/mfd/da9063-i2c.c
index 981805a2c521..29456e807ed4 100644
--- a/drivers/mfd/da9063-i2c.c
+++ b/drivers/mfd/da9063-i2c.c
@@ -270,15 +270,6 @@ static int da9063_i2c_probe(struct i2c_client *i2c,
 	return da9063_device_init(da9063, i2c->irq);
 }
 
-static int da9063_i2c_remove(struct i2c_client *i2c)
-{
-	struct da9063 *da9063 = i2c_get_clientdata(i2c);
-
-	da9063_device_exit(da9063);
-
-	return 0;
-}
-
 static const struct i2c_device_id da9063_i2c_id[] = {
 	{"da9063", PMIC_DA9063},
 	{},
@@ -291,7 +282,6 @@ static struct i2c_driver da9063_i2c_driver = {
 		.of_match_table = of_match_ptr(da9063_dt_ids),
 	},
 	.probe    = da9063_i2c_probe,
-	.remove   = da9063_i2c_remove,
 	.id_table = da9063_i2c_id,
 };
 
diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h
index 9ab7049977aa..8e6684d884e0 100644
--- a/include/linux/mfd/da9063/core.h
+++ b/include/linux/mfd/da9063/core.h
@@ -94,6 +94,4 @@ struct da9063 {
 int da9063_device_init(struct da9063 *da9063, unsigned int irq);
 int da9063_irq_init(struct da9063 *da9063);
 
-void da9063_device_exit(struct da9063 *da9063);
-
 #endif /* __MFD_DA9063_CORE_H__ */
-- 
2.16.2

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

* [PATCH v5 03/14] mfd: da9063: Use regmap_reg_range
  2018-06-06  9:59 [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
  2018-06-06  9:59 ` [PATCH v5 02/14] mfd: da9063: Replace mfd_add_devices " Marek Vasut
@ 2018-06-06  9:59 ` Marek Vasut
  2018-06-06 11:33   ` Geert Uytterhoeven
  2018-06-07  7:06   ` Lee Jones
  2018-06-06  9:59 ` [PATCH v5 04/14] mfd: da9063: Use REGMAP_IRQ_REG Marek Vasut
                   ` (11 subsequent siblings)
  13 siblings, 2 replies; 28+ messages in thread
From: Marek Vasut @ 2018-06-06  9:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Vasut, Geert Uytterhoeven, Lee Jones, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

Convert the regmap_range tables to use regmap_reg_range() macro.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Steve Twiss <stwiss.opensource@diasemi.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org
---
V5: New patch
---
 drivers/mfd/da9063-i2c.c | 174 ++++++++++++-----------------------------------
 1 file changed, 42 insertions(+), 132 deletions(-)

diff --git a/drivers/mfd/da9063-i2c.c b/drivers/mfd/da9063-i2c.c
index 29456e807ed4..e9797153bc19 100644
--- a/drivers/mfd/da9063-i2c.c
+++ b/drivers/mfd/da9063-i2c.c
@@ -29,78 +29,33 @@
 #include <linux/regulator/of_regulator.h>
 
 static const struct regmap_range da9063_ad_readable_ranges[] = {
-	{
-		.range_min = DA9063_REG_PAGE_CON,
-		.range_max = DA9063_AD_REG_SECOND_D,
-	}, {
-		.range_min = DA9063_REG_SEQ,
-		.range_max = DA9063_REG_ID_32_31,
-	}, {
-		.range_min = DA9063_REG_SEQ_A,
-		.range_max = DA9063_REG_AUTO3_LOW,
-	}, {
-		.range_min = DA9063_REG_T_OFFSET,
-		.range_max = DA9063_AD_REG_GP_ID_19,
-	}, {
-		.range_min = DA9063_REG_CHIP_ID,
-		.range_max = DA9063_REG_CHIP_VARIANT,
-	},
+	regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_AD_REG_SECOND_D),
+	regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_ID_32_31),
+	regmap_reg_range(DA9063_REG_SEQ_A, DA9063_REG_AUTO3_LOW),
+	regmap_reg_range(DA9063_REG_T_OFFSET, DA9063_AD_REG_GP_ID_19),
+	regmap_reg_range(DA9063_REG_CHIP_ID, DA9063_REG_CHIP_VARIANT),
 };
 
 static const struct regmap_range da9063_ad_writeable_ranges[] = {
-	{
-		.range_min = DA9063_REG_PAGE_CON,
-		.range_max = DA9063_REG_PAGE_CON,
-	}, {
-		.range_min = DA9063_REG_FAULT_LOG,
-		.range_max = DA9063_REG_VSYS_MON,
-	}, {
-		.range_min = DA9063_REG_COUNT_S,
-		.range_max = DA9063_AD_REG_ALARM_Y,
-	}, {
-		.range_min = DA9063_REG_SEQ,
-		.range_max = DA9063_REG_ID_32_31,
-	}, {
-		.range_min = DA9063_REG_SEQ_A,
-		.range_max = DA9063_REG_AUTO3_LOW,
-	}, {
-		.range_min = DA9063_REG_CONFIG_I,
-		.range_max = DA9063_AD_REG_MON_REG_4,
-	}, {
-		.range_min = DA9063_AD_REG_GP_ID_0,
-		.range_max = DA9063_AD_REG_GP_ID_19,
-	},
+	regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_REG_PAGE_CON),
+	regmap_reg_range(DA9063_REG_FAULT_LOG, DA9063_REG_VSYS_MON),
+	regmap_reg_range(DA9063_REG_COUNT_S, DA9063_AD_REG_ALARM_Y),
+	regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_ID_32_31),
+	regmap_reg_range(DA9063_REG_SEQ_A, DA9063_REG_AUTO3_LOW),
+	regmap_reg_range(DA9063_REG_CONFIG_I, DA9063_AD_REG_MON_REG_4),
+	regmap_reg_range(DA9063_AD_REG_GP_ID_0, DA9063_AD_REG_GP_ID_19),
 };
 
 static const struct regmap_range da9063_ad_volatile_ranges[] = {
-	{
-		.range_min = DA9063_REG_PAGE_CON,
-		.range_max = DA9063_REG_EVENT_D,
-	}, {
-		.range_min = DA9063_REG_CONTROL_A,
-		.range_max = DA9063_REG_CONTROL_B,
-	}, {
-		.range_min = DA9063_REG_CONTROL_E,
-		.range_max = DA9063_REG_CONTROL_F,
-	}, {
-		.range_min = DA9063_REG_BCORE2_CONT,
-		.range_max = DA9063_REG_LDO11_CONT,
-	}, {
-		.range_min = DA9063_REG_DVC_1,
-		.range_max = DA9063_REG_ADC_MAN,
-	}, {
-		.range_min = DA9063_REG_ADC_RES_L,
-		.range_max = DA9063_AD_REG_SECOND_D,
-	}, {
-		.range_min = DA9063_REG_SEQ,
-		.range_max = DA9063_REG_SEQ,
-	}, {
-		.range_min = DA9063_REG_EN_32K,
-		.range_max = DA9063_REG_EN_32K,
-	}, {
-		.range_min = DA9063_AD_REG_MON_REG_5,
-		.range_max = DA9063_AD_REG_MON_REG_6,
-	},
+	regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_REG_EVENT_D),
+	regmap_reg_range(DA9063_REG_CONTROL_A, DA9063_REG_CONTROL_B),
+	regmap_reg_range(DA9063_REG_CONTROL_E, DA9063_REG_CONTROL_F),
+	regmap_reg_range(DA9063_REG_BCORE2_CONT, DA9063_REG_LDO11_CONT),
+	regmap_reg_range(DA9063_REG_DVC_1, DA9063_REG_ADC_MAN),
+	regmap_reg_range(DA9063_REG_ADC_RES_L, DA9063_AD_REG_SECOND_D),
+	regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_SEQ),
+	regmap_reg_range(DA9063_REG_EN_32K, DA9063_REG_EN_32K),
+	regmap_reg_range(DA9063_AD_REG_MON_REG_5, DA9063_AD_REG_MON_REG_6),
 };
 
 static const struct regmap_access_table da9063_ad_readable_table = {
@@ -119,78 +74,33 @@ static const struct regmap_access_table da9063_ad_volatile_table = {
 };
 
 static const struct regmap_range da9063_bb_readable_ranges[] = {
-	{
-		.range_min = DA9063_REG_PAGE_CON,
-		.range_max = DA9063_BB_REG_SECOND_D,
-	}, {
-		.range_min = DA9063_REG_SEQ,
-		.range_max = DA9063_REG_ID_32_31,
-	}, {
-		.range_min = DA9063_REG_SEQ_A,
-		.range_max = DA9063_REG_AUTO3_LOW,
-	}, {
-		.range_min = DA9063_REG_T_OFFSET,
-		.range_max = DA9063_BB_REG_GP_ID_19,
-	}, {
-		.range_min = DA9063_REG_CHIP_ID,
-		.range_max = DA9063_REG_CHIP_VARIANT,
-	},
+	regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_BB_REG_SECOND_D),
+	regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_ID_32_31),
+	regmap_reg_range(DA9063_REG_SEQ_A, DA9063_REG_AUTO3_LOW),
+	regmap_reg_range(DA9063_REG_T_OFFSET, DA9063_BB_REG_GP_ID_19),
+	regmap_reg_range(DA9063_REG_CHIP_ID, DA9063_REG_CHIP_VARIANT),
 };
 
 static const struct regmap_range da9063_bb_writeable_ranges[] = {
-	{
-		.range_min = DA9063_REG_PAGE_CON,
-		.range_max = DA9063_REG_PAGE_CON,
-	}, {
-		.range_min = DA9063_REG_FAULT_LOG,
-		.range_max = DA9063_REG_VSYS_MON,
-	}, {
-		.range_min = DA9063_REG_COUNT_S,
-		.range_max = DA9063_BB_REG_ALARM_Y,
-	}, {
-		.range_min = DA9063_REG_SEQ,
-		.range_max = DA9063_REG_ID_32_31,
-	}, {
-		.range_min = DA9063_REG_SEQ_A,
-		.range_max = DA9063_REG_AUTO3_LOW,
-	}, {
-		.range_min = DA9063_REG_CONFIG_I,
-		.range_max = DA9063_BB_REG_MON_REG_4,
-	}, {
-		.range_min = DA9063_BB_REG_GP_ID_0,
-		.range_max = DA9063_BB_REG_GP_ID_19,
-	},
+	regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_REG_PAGE_CON),
+	regmap_reg_range(DA9063_REG_FAULT_LOG, DA9063_REG_VSYS_MON),
+	regmap_reg_range(DA9063_REG_COUNT_S, DA9063_BB_REG_ALARM_Y),
+	regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_ID_32_31),
+	regmap_reg_range(DA9063_REG_SEQ_A, DA9063_REG_AUTO3_LOW),
+	regmap_reg_range(DA9063_REG_CONFIG_I, DA9063_BB_REG_MON_REG_4),
+	regmap_reg_range(DA9063_BB_REG_GP_ID_0, DA9063_BB_REG_GP_ID_19),
 };
 
 static const struct regmap_range da9063_bb_volatile_ranges[] = {
-	{
-		.range_min = DA9063_REG_PAGE_CON,
-		.range_max = DA9063_REG_EVENT_D,
-	}, {
-		.range_min = DA9063_REG_CONTROL_A,
-		.range_max = DA9063_REG_CONTROL_B,
-	}, {
-		.range_min = DA9063_REG_CONTROL_E,
-		.range_max = DA9063_REG_CONTROL_F,
-	}, {
-		.range_min = DA9063_REG_BCORE2_CONT,
-		.range_max = DA9063_REG_LDO11_CONT,
-	}, {
-		.range_min = DA9063_REG_DVC_1,
-		.range_max = DA9063_REG_ADC_MAN,
-	}, {
-		.range_min = DA9063_REG_ADC_RES_L,
-		.range_max = DA9063_BB_REG_SECOND_D,
-	}, {
-		.range_min = DA9063_REG_SEQ,
-		.range_max = DA9063_REG_SEQ,
-	}, {
-		.range_min = DA9063_REG_EN_32K,
-		.range_max = DA9063_REG_EN_32K,
-	}, {
-		.range_min = DA9063_BB_REG_MON_REG_5,
-		.range_max = DA9063_BB_REG_MON_REG_6,
-	},
+	regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_REG_EVENT_D),
+	regmap_reg_range(DA9063_REG_CONTROL_A, DA9063_REG_CONTROL_B),
+	regmap_reg_range(DA9063_REG_CONTROL_E, DA9063_REG_CONTROL_F),
+	regmap_reg_range(DA9063_REG_BCORE2_CONT, DA9063_REG_LDO11_CONT),
+	regmap_reg_range(DA9063_REG_DVC_1, DA9063_REG_ADC_MAN),
+	regmap_reg_range(DA9063_REG_ADC_RES_L, DA9063_BB_REG_SECOND_D),
+	regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_SEQ),
+	regmap_reg_range(DA9063_REG_EN_32K, DA9063_REG_EN_32K),
+	regmap_reg_range(DA9063_BB_REG_MON_REG_5, DA9063_BB_REG_MON_REG_6),
 };
 
 static const struct regmap_access_table da9063_bb_readable_table = {
-- 
2.16.2

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

* [PATCH v5 04/14] mfd: da9063: Use REGMAP_IRQ_REG
  2018-06-06  9:59 [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
  2018-06-06  9:59 ` [PATCH v5 02/14] mfd: da9063: Replace mfd_add_devices " Marek Vasut
  2018-06-06  9:59 ` [PATCH v5 03/14] mfd: da9063: Use regmap_reg_range Marek Vasut
@ 2018-06-06  9:59 ` Marek Vasut
  2018-06-06 11:31   ` Geert Uytterhoeven
  2018-06-07  7:05   ` Lee Jones
  2018-06-06  9:59 ` [PATCH v5 05/14] mfd: da9063: Use PLATFORM_DEVID_NONE Marek Vasut
                   ` (10 subsequent siblings)
  13 siblings, 2 replies; 28+ messages in thread
From: Marek Vasut @ 2018-06-06  9:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Vasut, Geert Uytterhoeven, Lee Jones, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

Convert the regmap_irq table to use REGMAP_IRQ_REG().

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Steve Twiss <stwiss.opensource@diasemi.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org
Acked-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
V3: New patch
Note: A sed oneliner was used:
      sed -i "/\[DA9063_IRQ_/ {N;N;N;s/\n//g;s/.*\[\(DA9063_IRQ_[^]]\+\)].*reg_offset = \([^,]\+\),.* = \([^,]\+\),.*/\tREGMAP_IRQ_REG(\1, \2, \3),/}" drivers/mfd/da9063-irq.c
V4: Formatting fixes with "s/,/&\r\t\t      /" on the array
    Drop extra newline in da9063_irq_chip
V5: No change
---
 drivers/mfd/da9063-irq.c | 175 ++++++++++++++++-------------------------------
 1 file changed, 58 insertions(+), 117 deletions(-)

diff --git a/drivers/mfd/da9063-irq.c b/drivers/mfd/da9063-irq.c
index da6ceb41f0d1..044bd867f540 100644
--- a/drivers/mfd/da9063-irq.c
+++ b/drivers/mfd/da9063-irq.c
@@ -28,132 +28,73 @@
 
 static const struct regmap_irq da9063_irqs[] = {
 	/* DA9063 event A register */
-	[DA9063_IRQ_ONKEY] = {
-		.reg_offset = DA9063_REG_EVENT_A_OFFSET,
-		.mask = DA9063_M_ONKEY,
-	},
-	[DA9063_IRQ_ALARM] = {
-		.reg_offset = DA9063_REG_EVENT_A_OFFSET,
-		.mask = DA9063_M_ALARM,
-	},
-	[DA9063_IRQ_TICK] = {
-		.reg_offset = DA9063_REG_EVENT_A_OFFSET,
-		.mask = DA9063_M_TICK,
-	},
-	[DA9063_IRQ_ADC_RDY] = {
-		.reg_offset = DA9063_REG_EVENT_A_OFFSET,
-		.mask = DA9063_M_ADC_RDY,
-	},
-	[DA9063_IRQ_SEQ_RDY] = {
-		.reg_offset = DA9063_REG_EVENT_A_OFFSET,
-		.mask = DA9063_M_SEQ_RDY,
-	},
+	REGMAP_IRQ_REG(DA9063_IRQ_ONKEY,
+		       DA9063_REG_EVENT_A_OFFSET, DA9063_M_ONKEY),
+	REGMAP_IRQ_REG(DA9063_IRQ_ALARM,
+		       DA9063_REG_EVENT_A_OFFSET, DA9063_M_ALARM),
+	REGMAP_IRQ_REG(DA9063_IRQ_TICK,
+		       DA9063_REG_EVENT_A_OFFSET, DA9063_M_TICK),
+	REGMAP_IRQ_REG(DA9063_IRQ_ADC_RDY,
+		       DA9063_REG_EVENT_A_OFFSET, DA9063_M_ADC_RDY),
+	REGMAP_IRQ_REG(DA9063_IRQ_SEQ_RDY,
+		       DA9063_REG_EVENT_A_OFFSET, DA9063_M_SEQ_RDY),
 	/* DA9063 event B register */
-	[DA9063_IRQ_WAKE] = {
-		.reg_offset = DA9063_REG_EVENT_B_OFFSET,
-		.mask = DA9063_M_WAKE,
-	},
-	[DA9063_IRQ_TEMP] = {
-		.reg_offset = DA9063_REG_EVENT_B_OFFSET,
-		.mask = DA9063_M_TEMP,
-	},
-	[DA9063_IRQ_COMP_1V2] = {
-		.reg_offset = DA9063_REG_EVENT_B_OFFSET,
-		.mask = DA9063_M_COMP_1V2,
-	},
-	[DA9063_IRQ_LDO_LIM] = {
-		.reg_offset = DA9063_REG_EVENT_B_OFFSET,
-		.mask = DA9063_M_LDO_LIM,
-	},
-	[DA9063_IRQ_REG_UVOV] = {
-		.reg_offset = DA9063_REG_EVENT_B_OFFSET,
-		.mask = DA9063_M_UVOV,
-	},
-	[DA9063_IRQ_DVC_RDY] = {
-		.reg_offset = DA9063_REG_EVENT_B_OFFSET,
-		.mask = DA9063_M_DVC_RDY,
-	},
-	[DA9063_IRQ_VDD_MON] = {
-		.reg_offset = DA9063_REG_EVENT_B_OFFSET,
-		.mask = DA9063_M_VDD_MON,
-	},
-	[DA9063_IRQ_WARN] = {
-		.reg_offset = DA9063_REG_EVENT_B_OFFSET,
-		.mask = DA9063_M_VDD_WARN,
-	},
+	REGMAP_IRQ_REG(DA9063_IRQ_WAKE,
+		       DA9063_REG_EVENT_B_OFFSET, DA9063_M_WAKE),
+	REGMAP_IRQ_REG(DA9063_IRQ_TEMP,
+		       DA9063_REG_EVENT_B_OFFSET, DA9063_M_TEMP),
+	REGMAP_IRQ_REG(DA9063_IRQ_COMP_1V2,
+		       DA9063_REG_EVENT_B_OFFSET, DA9063_M_COMP_1V2),
+	REGMAP_IRQ_REG(DA9063_IRQ_LDO_LIM,
+		       DA9063_REG_EVENT_B_OFFSET, DA9063_M_LDO_LIM),
+	REGMAP_IRQ_REG(DA9063_IRQ_REG_UVOV,
+		       DA9063_REG_EVENT_B_OFFSET, DA9063_M_UVOV),
+	REGMAP_IRQ_REG(DA9063_IRQ_DVC_RDY,
+		       DA9063_REG_EVENT_B_OFFSET, DA9063_M_DVC_RDY),
+	REGMAP_IRQ_REG(DA9063_IRQ_VDD_MON,
+		       DA9063_REG_EVENT_B_OFFSET, DA9063_M_VDD_MON),
+	REGMAP_IRQ_REG(DA9063_IRQ_WARN,
+		       DA9063_REG_EVENT_B_OFFSET, DA9063_M_VDD_WARN),
 	/* DA9063 event C register */
-	[DA9063_IRQ_GPI0] = {
-		.reg_offset = DA9063_REG_EVENT_C_OFFSET,
-		.mask = DA9063_M_GPI0,
-	},
-	[DA9063_IRQ_GPI1] = {
-		.reg_offset = DA9063_REG_EVENT_C_OFFSET,
-		.mask = DA9063_M_GPI1,
-	},
-	[DA9063_IRQ_GPI2] = {
-		.reg_offset = DA9063_REG_EVENT_C_OFFSET,
-		.mask = DA9063_M_GPI2,
-	},
-	[DA9063_IRQ_GPI3] = {
-		.reg_offset = DA9063_REG_EVENT_C_OFFSET,
-		.mask = DA9063_M_GPI3,
-	},
-	[DA9063_IRQ_GPI4] = {
-		.reg_offset = DA9063_REG_EVENT_C_OFFSET,
-		.mask = DA9063_M_GPI4,
-	},
-	[DA9063_IRQ_GPI5] = {
-		.reg_offset = DA9063_REG_EVENT_C_OFFSET,
-		.mask = DA9063_M_GPI5,
-	},
-	[DA9063_IRQ_GPI6] = {
-		.reg_offset = DA9063_REG_EVENT_C_OFFSET,
-		.mask = DA9063_M_GPI6,
-	},
-	[DA9063_IRQ_GPI7] = {
-		.reg_offset = DA9063_REG_EVENT_C_OFFSET,
-		.mask = DA9063_M_GPI7,
-	},
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI0,
+		       DA9063_REG_EVENT_C_OFFSET, DA9063_M_GPI0),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI1,
+		       DA9063_REG_EVENT_C_OFFSET, DA9063_M_GPI1),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI2,
+		       DA9063_REG_EVENT_C_OFFSET, DA9063_M_GPI2),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI3,
+		       DA9063_REG_EVENT_C_OFFSET, DA9063_M_GPI3),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI4,
+		       DA9063_REG_EVENT_C_OFFSET, DA9063_M_GPI4),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI5,
+		       DA9063_REG_EVENT_C_OFFSET, DA9063_M_GPI5),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI6,
+		       DA9063_REG_EVENT_C_OFFSET, DA9063_M_GPI6),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI7,
+		       DA9063_REG_EVENT_C_OFFSET, DA9063_M_GPI7),
 	/* DA9063 event D register */
-	[DA9063_IRQ_GPI8] = {
-		.reg_offset = DA9063_REG_EVENT_D_OFFSET,
-		.mask = DA9063_M_GPI8,
-	},
-	[DA9063_IRQ_GPI9] = {
-		.reg_offset = DA9063_REG_EVENT_D_OFFSET,
-		.mask = DA9063_M_GPI9,
-	},
-	[DA9063_IRQ_GPI10] = {
-		.reg_offset = DA9063_REG_EVENT_D_OFFSET,
-		.mask = DA9063_M_GPI10,
-	},
-	[DA9063_IRQ_GPI11] = {
-		.reg_offset = DA9063_REG_EVENT_D_OFFSET,
-		.mask = DA9063_M_GPI11,
-	},
-	[DA9063_IRQ_GPI12] = {
-		.reg_offset = DA9063_REG_EVENT_D_OFFSET,
-		.mask = DA9063_M_GPI12,
-	},
-	[DA9063_IRQ_GPI13] = {
-		.reg_offset = DA9063_REG_EVENT_D_OFFSET,
-		.mask = DA9063_M_GPI13,
-	},
-	[DA9063_IRQ_GPI14] = {
-		.reg_offset = DA9063_REG_EVENT_D_OFFSET,
-		.mask = DA9063_M_GPI14,
-	},
-	[DA9063_IRQ_GPI15] = {
-		.reg_offset = DA9063_REG_EVENT_D_OFFSET,
-		.mask = DA9063_M_GPI15,
-	},
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI8,
+		       DA9063_REG_EVENT_D_OFFSET, DA9063_M_GPI8),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI9,
+		       DA9063_REG_EVENT_D_OFFSET, DA9063_M_GPI9),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI10,
+		       DA9063_REG_EVENT_D_OFFSET, DA9063_M_GPI10),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI11,
+		       DA9063_REG_EVENT_D_OFFSET, DA9063_M_GPI11),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI12,
+		       DA9063_REG_EVENT_D_OFFSET, DA9063_M_GPI12),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI13,
+		       DA9063_REG_EVENT_D_OFFSET, DA9063_M_GPI13),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI14,
+		       DA9063_REG_EVENT_D_OFFSET, DA9063_M_GPI14),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI15,
+		       DA9063_REG_EVENT_D_OFFSET, DA9063_M_GPI15),
 };
 
 static const struct regmap_irq_chip da9063_irq_chip = {
 	.name = "da9063-irq",
 	.irqs = da9063_irqs,
 	.num_irqs = DA9063_NUM_IRQ,
-
 	.num_regs = 4,
 	.status_base = DA9063_REG_EVENT_A,
 	.mask_base = DA9063_REG_IRQ_MASK_A,
-- 
2.16.2

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

* [PATCH v5 05/14] mfd: da9063: Use PLATFORM_DEVID_NONE
  2018-06-06  9:59 [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
                   ` (2 preceding siblings ...)
  2018-06-06  9:59 ` [PATCH v5 04/14] mfd: da9063: Use REGMAP_IRQ_REG Marek Vasut
@ 2018-06-06  9:59 ` Marek Vasut
  2018-06-06  9:59 ` [PATCH v5 06/14] mfd: da9063: Replace DA9063_NUM_IRQ with ARRAY_SIZE Marek Vasut
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Marek Vasut @ 2018-06-06  9:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Vasut, Geert Uytterhoeven, Lee Jones, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

Use PLATFORM_DEVID_NONE instead of -1 in mfd_add_devices.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Steve Twiss <stwiss.opensource@diasemi.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
---
V4: New patch
V5: Rebase on top of new 01 and 02 patches
---
 drivers/mfd/da9063-core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/da9063-core.c b/drivers/mfd/da9063-core.c
index 76258e5709f8..f57558590283 100644
--- a/drivers/mfd/da9063-core.c
+++ b/drivers/mfd/da9063-core.c
@@ -226,9 +226,9 @@ int da9063_device_init(struct da9063 *da9063, unsigned int irq)
 
 	da9063->irq_base = regmap_irq_chip_get_base(da9063->regmap_irq);
 
-	ret = devm_mfd_add_devices(da9063->dev, -1, da9063_devs,
-				   ARRAY_SIZE(da9063_devs), NULL,
-				   da9063->irq_base, NULL);
+	ret = devm_mfd_add_devices(da9063->dev, PLATFORM_DEVID_NONE,
+				   da9063_devs, ARRAY_SIZE(da9063_devs),
+				   NULL, da9063->irq_base, NULL);
 	if (ret)
 		dev_err(da9063->dev, "Cannot add MFD cells\n");
 
-- 
2.16.2

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

* [PATCH v5 06/14] mfd: da9063: Replace DA9063_NUM_IRQ with ARRAY_SIZE
  2018-06-06  9:59 [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
                   ` (3 preceding siblings ...)
  2018-06-06  9:59 ` [PATCH v5 05/14] mfd: da9063: Use PLATFORM_DEVID_NONE Marek Vasut
@ 2018-06-06  9:59 ` Marek Vasut
  2018-06-06  9:59 ` [PATCH v5 07/14] mfd: da9063: Rename PMIC_DA9063 to PMIC_CHIP_ID_DA9063 Marek Vasut
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Marek Vasut @ 2018-06-06  9:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Vasut, Geert Uytterhoeven, Lee Jones, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

Replace DA9063_NUM_IRQ macro which is not used anywhere with
plain ARRAY_SIZE().

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Steve Twiss <stwiss.opensource@diasemi.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
---
V4: New patch
V5: Remove DA9063_IRQ_BASE_OFFSET
---
 drivers/mfd/da9063-irq.c        | 2 +-
 include/linux/mfd/da9063/core.h | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/mfd/da9063-irq.c b/drivers/mfd/da9063-irq.c
index 044bd867f540..579947f83486 100644
--- a/drivers/mfd/da9063-irq.c
+++ b/drivers/mfd/da9063-irq.c
@@ -94,7 +94,7 @@ static const struct regmap_irq da9063_irqs[] = {
 static const struct regmap_irq_chip da9063_irq_chip = {
 	.name = "da9063-irq",
 	.irqs = da9063_irqs,
-	.num_irqs = DA9063_NUM_IRQ,
+	.num_irqs = ARRAY_SIZE(da9063_irqs),
 	.num_regs = 4,
 	.status_base = DA9063_REG_EVENT_A,
 	.mask_base = DA9063_REG_IRQ_MASK_A,
diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h
index 8e6684d884e0..260cd5834861 100644
--- a/include/linux/mfd/da9063/core.h
+++ b/include/linux/mfd/da9063/core.h
@@ -72,9 +72,6 @@ enum da9063_irqs {
 	DA9063_IRQ_GPI15,
 };
 
-#define DA9063_IRQ_BASE_OFFSET	0
-#define DA9063_NUM_IRQ		(DA9063_IRQ_GPI15 + 1 - DA9063_IRQ_BASE_OFFSET)
-
 struct da9063 {
 	/* Device */
 	struct device	*dev;
-- 
2.16.2

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

* [PATCH v5 07/14] mfd: da9063: Rename PMIC_DA9063 to PMIC_CHIP_ID_DA9063
  2018-06-06  9:59 [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
                   ` (4 preceding siblings ...)
  2018-06-06  9:59 ` [PATCH v5 06/14] mfd: da9063: Replace DA9063_NUM_IRQ with ARRAY_SIZE Marek Vasut
@ 2018-06-06  9:59 ` Marek Vasut
  2018-06-06  9:59 ` [PATCH v5 08/14] mfd: da9063: Replace model with type Marek Vasut
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Marek Vasut @ 2018-06-06  9:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Vasut, Geert Uytterhoeven, Lee Jones, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

The PMIC_DA9063 is a complete misnomer, it denotes the value of the
DA9063 chip ID register, so rename it as such. It is also the value
of chip ID register of DA9063L though, so drop the enum as all the
DA9063 "models" share the same chip ID and thus the distinction will
have to be made using DT or otherwise.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Steve Twiss <stwiss.opensource@diasemi.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org
Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
V2: No change
V3: No change
V4: No change
V5: No change
---
 drivers/mfd/da9063-core.c            | 2 +-
 drivers/mfd/da9063-i2c.c             | 2 +-
 drivers/regulator/da9063-regulator.c | 2 +-
 include/linux/mfd/da9063/core.h      | 4 +---
 4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/da9063-core.c b/drivers/mfd/da9063-core.c
index f57558590283..c54777cc2f12 100644
--- a/drivers/mfd/da9063-core.c
+++ b/drivers/mfd/da9063-core.c
@@ -192,7 +192,7 @@ int da9063_device_init(struct da9063 *da9063, unsigned int irq)
 		dev_err(da9063->dev, "Cannot read chip model id.\n");
 		return -EIO;
 	}
-	if (model != PMIC_DA9063) {
+	if (model != PMIC_CHIP_ID_DA9063) {
 		dev_err(da9063->dev, "Invalid chip model id: 0x%02x\n", model);
 		return -ENODEV;
 	}
diff --git a/drivers/mfd/da9063-i2c.c b/drivers/mfd/da9063-i2c.c
index e9797153bc19..d1fe88777e3f 100644
--- a/drivers/mfd/da9063-i2c.c
+++ b/drivers/mfd/da9063-i2c.c
@@ -181,7 +181,7 @@ static int da9063_i2c_probe(struct i2c_client *i2c,
 }
 
 static const struct i2c_device_id da9063_i2c_id[] = {
-	{"da9063", PMIC_DA9063},
+	{ "da9063", PMIC_CHIP_ID_DA9063 },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, da9063_i2c_id);
diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index 6a8f9cd69f52..87c884ae0064 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -585,7 +585,7 @@ static struct da9063_dev_model regulators_models[] = {
 	{
 		.regulator_info = da9063_regulator_info,
 		.n_regulators = ARRAY_SIZE(da9063_regulator_info),
-		.dev_model = PMIC_DA9063,
+		.dev_model = PMIC_CHIP_ID_DA9063,
 	},
 	{ }
 };
diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h
index 260cd5834861..e015b065db7e 100644
--- a/include/linux/mfd/da9063/core.h
+++ b/include/linux/mfd/da9063/core.h
@@ -29,9 +29,7 @@
 #define DA9063_DRVNAME_RTC		"da9063-rtc"
 #define DA9063_DRVNAME_VIBRATION	"da9063-vibration"
 
-enum da9063_models {
-	PMIC_DA9063 = 0x61,
-};
+#define PMIC_CHIP_ID_DA9063		0x61
 
 enum da9063_variant_codes {
 	PMIC_DA9063_AD = 0x3,
-- 
2.16.2

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

* [PATCH v5 08/14] mfd: da9063: Replace model with type
  2018-06-06  9:59 [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
                   ` (5 preceding siblings ...)
  2018-06-06  9:59 ` [PATCH v5 07/14] mfd: da9063: Rename PMIC_DA9063 to PMIC_CHIP_ID_DA9063 Marek Vasut
@ 2018-06-06  9:59 ` Marek Vasut
  2018-06-11 14:45   ` kbuild test robot
  2018-06-06  9:59 ` [PATCH v5 09/14] mfd: da9063: Add DA9063L type Marek Vasut
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Marek Vasut @ 2018-06-06  9:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Vasut, Geert Uytterhoeven, Lee Jones, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

The model number stored in the struct da9063 is the same for all
variants of the da9063 since it is the chip ID, which is always
the same. Replace that with a separate identifier instead, which
allows us to discern the DA9063 variants by setting the type
based on either DT match or otherwise.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Steve Twiss <stwiss.opensource@diasemi.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org
Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
---
V2: Drop useless cast of id->driver_data
V3: Fix kernel 0day error , s/dev_model/type/
V4: No change
V5: No change
---
 drivers/mfd/da9063-core.c            | 1 -
 drivers/mfd/da9063-i2c.c             | 5 +++--
 drivers/regulator/da9063-regulator.c | 6 +++---
 include/linux/mfd/da9063/core.h      | 6 +++++-
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/da9063-core.c b/drivers/mfd/da9063-core.c
index c54777cc2f12..ded59990f18c 100644
--- a/drivers/mfd/da9063-core.c
+++ b/drivers/mfd/da9063-core.c
@@ -215,7 +215,6 @@ int da9063_device_init(struct da9063 *da9063, unsigned int irq)
 		return -ENODEV;
 	}
 
-	da9063->model = model;
 	da9063->variant_code = variant_code;
 
 	ret = da9063_irq_init(da9063);
diff --git a/drivers/mfd/da9063-i2c.c b/drivers/mfd/da9063-i2c.c
index d1fe88777e3f..6fe9c3464b41 100644
--- a/drivers/mfd/da9063-i2c.c
+++ b/drivers/mfd/da9063-i2c.c
@@ -146,7 +146,7 @@ static const struct of_device_id da9063_dt_ids[] = {
 };
 MODULE_DEVICE_TABLE(of, da9063_dt_ids);
 static int da9063_i2c_probe(struct i2c_client *i2c,
-	const struct i2c_device_id *id)
+			    const struct i2c_device_id *id)
 {
 	struct da9063 *da9063;
 	int ret;
@@ -158,6 +158,7 @@ static int da9063_i2c_probe(struct i2c_client *i2c,
 	i2c_set_clientdata(i2c, da9063);
 	da9063->dev = &i2c->dev;
 	da9063->chip_irq = i2c->irq;
+	da9063->type = id->driver_data;
 
 	if (da9063->variant_code == PMIC_DA9063_AD) {
 		da9063_regmap_config.rd_table = &da9063_ad_readable_table;
@@ -181,7 +182,7 @@ static int da9063_i2c_probe(struct i2c_client *i2c,
 }
 
 static const struct i2c_device_id da9063_i2c_id[] = {
-	{ "da9063", PMIC_CHIP_ID_DA9063 },
+	{ "da9063", PMIC_TYPE_DA9063 },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, da9063_i2c_id);
diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index 87c884ae0064..eeb0d431dda1 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -98,7 +98,7 @@ struct da9063_regulator_info {
 struct da9063_dev_model {
 	const struct da9063_regulator_info	*regulator_info;
 	unsigned				n_regulators;
-	unsigned				dev_model;
+	enum da9063_type			type;
 };
 
 /* Single regulator settings */
@@ -585,7 +585,7 @@ static struct da9063_dev_model regulators_models[] = {
 	{
 		.regulator_info = da9063_regulator_info,
 		.n_regulators = ARRAY_SIZE(da9063_regulator_info),
-		.dev_model = PMIC_CHIP_ID_DA9063,
+		.type = PMIC_TYPE_DA9063,
 	},
 	{ }
 };
@@ -741,7 +741,7 @@ static int da9063_regulator_probe(struct platform_device *pdev)
 
 	/* Find regulators set for particular device model */
 	for (model = regulators_models; model->regulator_info; model++) {
-		if (model->dev_model == da9063->model)
+		if (model->type == da9063->type)
 			break;
 	}
 	if (!model->regulator_info) {
diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h
index e015b065db7e..9e36097adc42 100644
--- a/include/linux/mfd/da9063/core.h
+++ b/include/linux/mfd/da9063/core.h
@@ -31,6 +31,10 @@
 
 #define PMIC_CHIP_ID_DA9063		0x61
 
+enum da9063_type {
+	PMIC_TYPE_DA9063 = 0,
+};
+
 enum da9063_variant_codes {
 	PMIC_DA9063_AD = 0x3,
 	PMIC_DA9063_BB = 0x5,
@@ -73,7 +77,7 @@ enum da9063_irqs {
 struct da9063 {
 	/* Device */
 	struct device	*dev;
-	unsigned short	model;
+	enum da9063_type type;
 	unsigned char	variant_code;
 	unsigned int	flags;
 
-- 
2.16.2

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

* [PATCH v5 09/14] mfd: da9063: Add DA9063L type
  2018-06-06  9:59 [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
                   ` (6 preceding siblings ...)
  2018-06-06  9:59 ` [PATCH v5 08/14] mfd: da9063: Replace model with type Marek Vasut
@ 2018-06-06  9:59 ` Marek Vasut
  2018-06-06  9:59 ` [PATCH v5 10/14] mfd: da9063: Add custom regmap for DA9063L Marek Vasut
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Marek Vasut @ 2018-06-06  9:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Vasut, Geert Uytterhoeven, Lee Jones, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

Add type for DA9063L, which is a reduced variant of the DA9063
without RTC block and with less regulators.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Steve Twiss <stwiss.opensource@diasemi.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
V2: No change
V3: No change
V4: No change
V5: No change
---
 include/linux/mfd/da9063/core.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h
index 9e36097adc42..71b09154e2db 100644
--- a/include/linux/mfd/da9063/core.h
+++ b/include/linux/mfd/da9063/core.h
@@ -33,6 +33,7 @@
 
 enum da9063_type {
 	PMIC_TYPE_DA9063 = 0,
+	PMIC_TYPE_DA9063L,
 };
 
 enum da9063_variant_codes {
-- 
2.16.2

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

* [PATCH v5 10/14] mfd: da9063: Add custom regmap for DA9063L
  2018-06-06  9:59 [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
                   ` (7 preceding siblings ...)
  2018-06-06  9:59 ` [PATCH v5 09/14] mfd: da9063: Add DA9063L type Marek Vasut
@ 2018-06-06  9:59 ` Marek Vasut
  2018-06-06 10:00 ` [PATCH v5 11/14] mfd: da9063: Add custom IRQ map " Marek Vasut
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Marek Vasut @ 2018-06-06  9:59 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Vasut, Geert Uytterhoeven, Lee Jones, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

The DA9063L does not have an RTC. Add custom regmap for DA9063L to
prevent access into that register block.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Steve Twiss <stwiss.opensource@diasemi.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
---
V3: New patch
V4: Drop mention of buggy datasheet in the commit message
V5: Use regmap_reg_range macro
---
 drivers/mfd/da9063-i2c.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/drivers/mfd/da9063-i2c.c b/drivers/mfd/da9063-i2c.c
index 6fe9c3464b41..a449a9263dd7 100644
--- a/drivers/mfd/da9063-i2c.c
+++ b/drivers/mfd/da9063-i2c.c
@@ -118,6 +118,50 @@ static const struct regmap_access_table da9063_bb_volatile_table = {
 	.n_yes_ranges = ARRAY_SIZE(da9063_bb_volatile_ranges),
 };
 
+static const struct regmap_range da9063l_bb_readable_ranges[] = {
+	regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_REG_MON_A10_RES),
+	regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_ID_32_31),
+	regmap_reg_range(DA9063_REG_SEQ_A, DA9063_REG_AUTO3_LOW),
+	regmap_reg_range(DA9063_REG_T_OFFSET, DA9063_BB_REG_GP_ID_19),
+	regmap_reg_range(DA9063_REG_CHIP_ID, DA9063_REG_CHIP_VARIANT),
+};
+
+static const struct regmap_range da9063l_bb_writeable_ranges[] = {
+	regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_REG_PAGE_CON),
+	regmap_reg_range(DA9063_REG_FAULT_LOG, DA9063_REG_VSYS_MON),
+	regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_ID_32_31),
+	regmap_reg_range(DA9063_REG_SEQ_A, DA9063_REG_AUTO3_LOW),
+	regmap_reg_range(DA9063_REG_CONFIG_I, DA9063_BB_REG_MON_REG_4),
+	regmap_reg_range(DA9063_BB_REG_GP_ID_0, DA9063_BB_REG_GP_ID_19),
+};
+
+static const struct regmap_range da9063l_bb_volatile_ranges[] = {
+	regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_REG_EVENT_D),
+	regmap_reg_range(DA9063_REG_CONTROL_A, DA9063_REG_CONTROL_B),
+	regmap_reg_range(DA9063_REG_CONTROL_E, DA9063_REG_CONTROL_F),
+	regmap_reg_range(DA9063_REG_BCORE2_CONT, DA9063_REG_LDO11_CONT),
+	regmap_reg_range(DA9063_REG_DVC_1, DA9063_REG_ADC_MAN),
+	regmap_reg_range(DA9063_REG_ADC_RES_L, DA9063_REG_MON_A10_RES),
+	regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_SEQ),
+	regmap_reg_range(DA9063_REG_EN_32K, DA9063_REG_EN_32K),
+	regmap_reg_range(DA9063_BB_REG_MON_REG_5, DA9063_BB_REG_MON_REG_6),
+};
+
+static const struct regmap_access_table da9063l_bb_readable_table = {
+	.yes_ranges = da9063l_bb_readable_ranges,
+	.n_yes_ranges = ARRAY_SIZE(da9063l_bb_readable_ranges),
+};
+
+static const struct regmap_access_table da9063l_bb_writeable_table = {
+	.yes_ranges = da9063l_bb_writeable_ranges,
+	.n_yes_ranges = ARRAY_SIZE(da9063l_bb_writeable_ranges),
+};
+
+static const struct regmap_access_table da9063l_bb_volatile_table = {
+	.yes_ranges = da9063l_bb_volatile_ranges,
+	.n_yes_ranges = ARRAY_SIZE(da9063l_bb_volatile_ranges),
+};
+
 static const struct regmap_range_cfg da9063_range_cfg[] = {
 	{
 		.range_min = DA9063_REG_PAGE_CON,
@@ -164,6 +208,10 @@ static int da9063_i2c_probe(struct i2c_client *i2c,
 		da9063_regmap_config.rd_table = &da9063_ad_readable_table;
 		da9063_regmap_config.wr_table = &da9063_ad_writeable_table;
 		da9063_regmap_config.volatile_table = &da9063_ad_volatile_table;
+	} else if (da9063->type == PMIC_TYPE_DA9063L) {
+		da9063_regmap_config.rd_table = &da9063l_bb_readable_table;
+		da9063_regmap_config.wr_table = &da9063l_bb_writeable_table;
+		da9063_regmap_config.volatile_table = &da9063l_bb_volatile_table;
 	} else {
 		da9063_regmap_config.rd_table = &da9063_bb_readable_table;
 		da9063_regmap_config.wr_table = &da9063_bb_writeable_table;
-- 
2.16.2

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

* [PATCH v5 11/14] mfd: da9063: Add custom IRQ map for DA9063L
  2018-06-06  9:59 [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
                   ` (8 preceding siblings ...)
  2018-06-06  9:59 ` [PATCH v5 10/14] mfd: da9063: Add custom regmap for DA9063L Marek Vasut
@ 2018-06-06 10:00 ` Marek Vasut
  2018-06-06 10:00 ` [PATCH v5 12/14] mfd: da9063: Register RTC only on DA9063L Marek Vasut
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Marek Vasut @ 2018-06-06 10:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Vasut, Geert Uytterhoeven, Lee Jones, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

The DA9063L does not have an RTC. Add custom IRQ map for DA9063L to
ignore the Alarm and Tick IRQs from the PMIC.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Steve Twiss <stwiss.opensource@diasemi.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
---
V3: New patch
V4: - Formatting fixes
    - Drop extra newline in da9063l_irq_chip
    - Drop mention of the buggy datasheet in commit message
V5: Rebase on top of new 01 and 02 patches
---
 drivers/mfd/da9063-irq.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 79 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/da9063-irq.c b/drivers/mfd/da9063-irq.c
index 579947f83486..ecc0c8ce6c58 100644
--- a/drivers/mfd/da9063-irq.c
+++ b/drivers/mfd/da9063-irq.c
@@ -102,8 +102,81 @@ static const struct regmap_irq_chip da9063_irq_chip = {
 	.init_ack_masked = true,
 };
 
+static const struct regmap_irq da9063l_irqs[] = {
+	/* DA9063 event A register */
+	REGMAP_IRQ_REG(DA9063_IRQ_ONKEY,
+		       DA9063_REG_EVENT_A_OFFSET, DA9063_M_ONKEY),
+	REGMAP_IRQ_REG(DA9063_IRQ_ADC_RDY,
+		       DA9063_REG_EVENT_A_OFFSET, DA9063_M_ADC_RDY),
+	REGMAP_IRQ_REG(DA9063_IRQ_SEQ_RDY,
+		       DA9063_REG_EVENT_A_OFFSET, DA9063_M_SEQ_RDY),
+	/* DA9063 event B register */
+	REGMAP_IRQ_REG(DA9063_IRQ_WAKE,
+		       DA9063_REG_EVENT_B_OFFSET, DA9063_M_WAKE),
+	REGMAP_IRQ_REG(DA9063_IRQ_TEMP,
+		       DA9063_REG_EVENT_B_OFFSET, DA9063_M_TEMP),
+	REGMAP_IRQ_REG(DA9063_IRQ_COMP_1V2,
+		       DA9063_REG_EVENT_B_OFFSET, DA9063_M_COMP_1V2),
+	REGMAP_IRQ_REG(DA9063_IRQ_LDO_LIM,
+		       DA9063_REG_EVENT_B_OFFSET, DA9063_M_LDO_LIM),
+	REGMAP_IRQ_REG(DA9063_IRQ_REG_UVOV,
+		       DA9063_REG_EVENT_B_OFFSET, DA9063_M_UVOV),
+	REGMAP_IRQ_REG(DA9063_IRQ_DVC_RDY,
+		       DA9063_REG_EVENT_B_OFFSET, DA9063_M_DVC_RDY),
+	REGMAP_IRQ_REG(DA9063_IRQ_VDD_MON,
+		       DA9063_REG_EVENT_B_OFFSET, DA9063_M_VDD_MON),
+	REGMAP_IRQ_REG(DA9063_IRQ_WARN,
+		       DA9063_REG_EVENT_B_OFFSET, DA9063_M_VDD_WARN),
+	/* DA9063 event C register */
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI0,
+		       DA9063_REG_EVENT_C_OFFSET, DA9063_M_GPI0),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI1,
+		       DA9063_REG_EVENT_C_OFFSET, DA9063_M_GPI1),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI2,
+		       DA9063_REG_EVENT_C_OFFSET, DA9063_M_GPI2),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI3,
+		       DA9063_REG_EVENT_C_OFFSET, DA9063_M_GPI3),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI4,
+		       DA9063_REG_EVENT_C_OFFSET, DA9063_M_GPI4),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI5,
+		       DA9063_REG_EVENT_C_OFFSET, DA9063_M_GPI5),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI6,
+		       DA9063_REG_EVENT_C_OFFSET, DA9063_M_GPI6),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI7,
+		       DA9063_REG_EVENT_C_OFFSET, DA9063_M_GPI7),
+	/* DA9063 event D register */
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI8,
+		       DA9063_REG_EVENT_D_OFFSET, DA9063_M_GPI8),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI9,
+		       DA9063_REG_EVENT_D_OFFSET, DA9063_M_GPI9),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI10,
+		       DA9063_REG_EVENT_D_OFFSET, DA9063_M_GPI10),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI11,
+		       DA9063_REG_EVENT_D_OFFSET, DA9063_M_GPI11),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI12,
+		       DA9063_REG_EVENT_D_OFFSET, DA9063_M_GPI12),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI13,
+		       DA9063_REG_EVENT_D_OFFSET, DA9063_M_GPI13),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI14,
+		       DA9063_REG_EVENT_D_OFFSET, DA9063_M_GPI14),
+	REGMAP_IRQ_REG(DA9063_IRQ_GPI15,
+		       DA9063_REG_EVENT_D_OFFSET, DA9063_M_GPI15),
+};
+
+static const struct regmap_irq_chip da9063l_irq_chip = {
+	.name = "da9063l-irq",
+	.irqs = da9063l_irqs,
+	.num_irqs = ARRAY_SIZE(da9063l_irqs),
+	.num_regs = 4,
+	.status_base = DA9063_REG_EVENT_A,
+	.mask_base = DA9063_REG_IRQ_MASK_A,
+	.ack_base = DA9063_REG_EVENT_A,
+	.init_ack_masked = true,
+};
+
 int da9063_irq_init(struct da9063 *da9063)
 {
+	const struct regmap_irq_chip *irq_chip;
 	int ret;
 
 	if (!da9063->chip_irq) {
@@ -111,11 +184,15 @@ int da9063_irq_init(struct da9063 *da9063)
 		return -EINVAL;
 	}
 
+	if (da9063->type == PMIC_TYPE_DA9063)
+		irq_chip = &da9063_irq_chip;
+	else
+		irq_chip = &da9063l_irq_chip;
+
 	ret = devm_regmap_add_irq_chip(da9063->dev, da9063->regmap,
 			da9063->chip_irq,
 			IRQF_TRIGGER_LOW | IRQF_ONESHOT | IRQF_SHARED,
-			da9063->irq_base, &da9063_irq_chip,
-			&da9063->regmap_irq);
+			da9063->irq_base, irq_chip, &da9063->regmap_irq);
 	if (ret) {
 		dev_err(da9063->dev, "Failed to reguest IRQ %d: %d\n",
 				da9063->chip_irq, ret);
-- 
2.16.2

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

* [PATCH v5 12/14] mfd: da9063: Register RTC only on DA9063L
  2018-06-06  9:59 [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
                   ` (9 preceding siblings ...)
  2018-06-06 10:00 ` [PATCH v5 11/14] mfd: da9063: Add custom IRQ map " Marek Vasut
@ 2018-06-06 10:00 ` Marek Vasut
  2018-06-06 10:00 ` [PATCH v5 13/14] regulator: da9063: Handle less LDOs " Marek Vasut
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Marek Vasut @ 2018-06-06 10:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Vasut, Geert Uytterhoeven, Lee Jones, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

The DA9063L does not contain RTC block, unlike the full DA9063.
Split the RTC block into separate mfd cell and register it only
on DA9063.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Steve Twiss <stwiss.opensource@diasemi.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
---
V2: No change
V3: Rework of mfd: da9063: Disallow RTC on DA9063L
V4: - Change the original failure text
    - Use PLATFORM_DEVID_NONE in mfd_add_devices
V5: Rebase on top of new 01 and 02 patches
---
 drivers/mfd/da9063-core.c | 31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/da9063-core.c b/drivers/mfd/da9063-core.c
index ded59990f18c..6e4ce49b4405 100644
--- a/drivers/mfd/da9063-core.c
+++ b/drivers/mfd/da9063-core.c
@@ -76,7 +76,7 @@ static struct resource da9063_hwmon_resources[] = {
 };
 
 
-static const struct mfd_cell da9063_devs[] = {
+static const struct mfd_cell da9063_common_devs[] = {
 	{
 		.name		= DA9063_DRVNAME_REGULATORS,
 		.num_resources	= ARRAY_SIZE(da9063_regulators_resources),
@@ -100,15 +100,19 @@ static const struct mfd_cell da9063_devs[] = {
 		.resources	= da9063_onkey_resources,
 		.of_compatible = "dlg,da9063-onkey",
 	},
+	{
+		.name		= DA9063_DRVNAME_VIBRATION,
+	},
+};
+
+/* Only present on DA9063 , not on DA9063L */
+static const struct mfd_cell da9063_devs[] = {
 	{
 		.name		= DA9063_DRVNAME_RTC,
 		.num_resources	= ARRAY_SIZE(da9063_rtc_resources),
 		.resources	= da9063_rtc_resources,
 		.of_compatible	= "dlg,da9063-rtc",
 	},
-	{
-		.name		= DA9063_DRVNAME_VIBRATION,
-	},
 };
 
 static int da9063_clear_fault_log(struct da9063 *da9063)
@@ -226,10 +230,23 @@ int da9063_device_init(struct da9063 *da9063, unsigned int irq)
 	da9063->irq_base = regmap_irq_chip_get_base(da9063->regmap_irq);
 
 	ret = devm_mfd_add_devices(da9063->dev, PLATFORM_DEVID_NONE,
-				   da9063_devs, ARRAY_SIZE(da9063_devs),
+				   da9063_common_devs,
+				   ARRAY_SIZE(da9063_common_devs),
 				   NULL, da9063->irq_base, NULL);
-	if (ret)
-		dev_err(da9063->dev, "Cannot add MFD cells\n");
+	if (ret) {
+		dev_err(da9063->dev, "Failed to add child devices\n");
+		return ret;
+	}
+
+	if (da9063->type == PMIC_TYPE_DA9063) {
+		ret = devm_mfd_add_devices(da9063->dev, PLATFORM_DEVID_NONE,
+					   da9063_devs, ARRAY_SIZE(da9063_devs),
+					   NULL, da9063->irq_base, NULL);
+		if (ret) {
+			dev_err(da9063->dev, "Failed to add child devices\n");
+			return ret;
+		}
+	}
 
 	return ret;
 }
-- 
2.16.2

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

* [PATCH v5 13/14] regulator: da9063: Handle less LDOs on DA9063L
  2018-06-06  9:59 [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
                   ` (10 preceding siblings ...)
  2018-06-06 10:00 ` [PATCH v5 12/14] mfd: da9063: Register RTC only on DA9063L Marek Vasut
@ 2018-06-06 10:00 ` Marek Vasut
  2018-06-06 10:00 ` [PATCH v5 14/14] mfd: da9063: Add DA9063L support Marek Vasut
  2018-06-07  8:04 ` [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
  13 siblings, 0 replies; 28+ messages in thread
From: Marek Vasut @ 2018-06-06 10:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Vasut, Geert Uytterhoeven, Lee Jones, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

Move the LDOs present only on DA9063 at the end of the list, so that
the DA9063L can simply indicate less LDOs and still share the list of
regulators with DA9063.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Steve Twiss <stwiss.opensource@diasemi.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org
Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
---
V2: No change
V3: No change
V4: Change subject s/mfd/regulator/
V5: No change
---
 drivers/regulator/da9063-regulator.c | 76 +++++++++++++++++++++---------------
 1 file changed, 45 insertions(+), 31 deletions(-)

diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index eeb0d431dda1..0c09e73e0b23 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -529,6 +529,32 @@ static const struct da9063_regulator_info da9063_regulator_info[] = {
 		.ilimit = BFIELD(DA9063_REG_BUCK_ILIM_A,
 				 DA9063_BMEM_ILIM_MASK),
 	},
+	{
+		DA9063_LDO(DA9063, LDO3, 900, 20, 3440),
+		.suspend = BFIELD(DA9063_REG_DVC_1, DA9063_VLDO3_SEL),
+		.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO3_LIM),
+	},
+	{
+		DA9063_LDO(DA9063, LDO7, 900, 50, 3600),
+		.suspend = BFIELD(DA9063_REG_LDO7_CONT, DA9063_VLDO7_SEL),
+		.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO7_LIM),
+	},
+	{
+		DA9063_LDO(DA9063, LDO8, 900, 50, 3600),
+		.suspend = BFIELD(DA9063_REG_LDO8_CONT, DA9063_VLDO8_SEL),
+		.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO8_LIM),
+	},
+	{
+		DA9063_LDO(DA9063, LDO9, 950, 50, 3600),
+		.suspend = BFIELD(DA9063_REG_LDO9_CONT, DA9063_VLDO9_SEL),
+	},
+	{
+		DA9063_LDO(DA9063, LDO11, 900, 50, 3600),
+		.suspend = BFIELD(DA9063_REG_LDO11_CONT, DA9063_VLDO11_SEL),
+		.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO11_LIM),
+	},
+
+	/* The following LDOs are present only on DA9063, not on DA9063L */
 	{
 		DA9063_LDO(DA9063, LDO1, 600, 20, 1860),
 		.suspend = BFIELD(DA9063_REG_DVC_1, DA9063_VLDO1_SEL),
@@ -537,11 +563,6 @@ static const struct da9063_regulator_info da9063_regulator_info[] = {
 		DA9063_LDO(DA9063, LDO2, 600, 20, 1860),
 		.suspend = BFIELD(DA9063_REG_DVC_1, DA9063_VLDO2_SEL),
 	},
-	{
-		DA9063_LDO(DA9063, LDO3, 900, 20, 3440),
-		.suspend = BFIELD(DA9063_REG_DVC_1, DA9063_VLDO3_SEL),
-		.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO3_LIM),
-	},
 	{
 		DA9063_LDO(DA9063, LDO4, 900, 20, 3440),
 		.suspend = BFIELD(DA9063_REG_DVC_2, DA9063_VLDO4_SEL),
@@ -555,29 +576,11 @@ static const struct da9063_regulator_info da9063_regulator_info[] = {
 		DA9063_LDO(DA9063, LDO6, 900, 50, 3600),
 		.suspend = BFIELD(DA9063_REG_LDO6_CONT, DA9063_VLDO6_SEL),
 	},
-	{
-		DA9063_LDO(DA9063, LDO7, 900, 50, 3600),
-		.suspend = BFIELD(DA9063_REG_LDO7_CONT, DA9063_VLDO7_SEL),
-		.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO7_LIM),
-	},
-	{
-		DA9063_LDO(DA9063, LDO8, 900, 50, 3600),
-		.suspend = BFIELD(DA9063_REG_LDO8_CONT, DA9063_VLDO8_SEL),
-		.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO8_LIM),
-	},
-	{
-		DA9063_LDO(DA9063, LDO9, 950, 50, 3600),
-		.suspend = BFIELD(DA9063_REG_LDO9_CONT, DA9063_VLDO9_SEL),
-	},
+
 	{
 		DA9063_LDO(DA9063, LDO10, 900, 50, 3600),
 		.suspend = BFIELD(DA9063_REG_LDO10_CONT, DA9063_VLDO10_SEL),
 	},
-	{
-		DA9063_LDO(DA9063, LDO11, 900, 50, 3600),
-		.suspend = BFIELD(DA9063_REG_LDO11_CONT, DA9063_VLDO11_SEL),
-		.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO11_LIM),
-	},
 };
 
 /* Link chip model with regulators info table */
@@ -587,6 +590,11 @@ static struct da9063_dev_model regulators_models[] = {
 		.n_regulators = ARRAY_SIZE(da9063_regulator_info),
 		.type = PMIC_TYPE_DA9063,
 	},
+	{
+		.regulator_info = da9063_regulator_info,
+		.n_regulators = ARRAY_SIZE(da9063_regulator_info) - 6,
+		.type = PMIC_TYPE_DA9063L,
+	},
 	{ }
 };
 
@@ -641,28 +649,34 @@ static struct of_regulator_match da9063_matches[] = {
 	[DA9063_ID_BPERI]            = { .name = "bperi",           },
 	[DA9063_ID_BCORES_MERGED]    = { .name = "bcores-merged"    },
 	[DA9063_ID_BMEM_BIO_MERGED]  = { .name = "bmem-bio-merged", },
+	[DA9063_ID_LDO3]             = { .name = "ldo3",            },
+	[DA9063_ID_LDO7]             = { .name = "ldo7",            },
+	[DA9063_ID_LDO8]             = { .name = "ldo8",            },
+	[DA9063_ID_LDO9]             = { .name = "ldo9",            },
+	[DA9063_ID_LDO11]            = { .name = "ldo11",           },
+	/* The following LDOs are present only on DA9063, not on DA9063L */
 	[DA9063_ID_LDO1]             = { .name = "ldo1",            },
 	[DA9063_ID_LDO2]             = { .name = "ldo2",            },
-	[DA9063_ID_LDO3]             = { .name = "ldo3",            },
 	[DA9063_ID_LDO4]             = { .name = "ldo4",            },
 	[DA9063_ID_LDO5]             = { .name = "ldo5",            },
 	[DA9063_ID_LDO6]             = { .name = "ldo6",            },
-	[DA9063_ID_LDO7]             = { .name = "ldo7",            },
-	[DA9063_ID_LDO8]             = { .name = "ldo8",            },
-	[DA9063_ID_LDO9]             = { .name = "ldo9",            },
 	[DA9063_ID_LDO10]            = { .name = "ldo10",           },
-	[DA9063_ID_LDO11]            = { .name = "ldo11",           },
 };
 
 static struct da9063_regulators_pdata *da9063_parse_regulators_dt(
 		struct platform_device *pdev,
 		struct of_regulator_match **da9063_reg_matches)
 {
+	struct da9063 *da9063 = dev_get_drvdata(pdev->dev.parent);
 	struct da9063_regulators_pdata *pdata;
 	struct da9063_regulator_data *rdata;
 	struct device_node *node;
+	int da9063_matches_len = ARRAY_SIZE(da9063_matches);
 	int i, n, num;
 
+	if (da9063->type == PMIC_TYPE_DA9063L)
+		da9063_matches_len -= 6;
+
 	node = of_get_child_by_name(pdev->dev.parent->of_node, "regulators");
 	if (!node) {
 		dev_err(&pdev->dev, "Regulators device node not found\n");
@@ -670,7 +684,7 @@ static struct da9063_regulators_pdata *da9063_parse_regulators_dt(
 	}
 
 	num = of_regulator_match(&pdev->dev, node, da9063_matches,
-				 ARRAY_SIZE(da9063_matches));
+				 da9063_matches_len);
 	of_node_put(node);
 	if (num < 0) {
 		dev_err(&pdev->dev, "Failed to match regulators\n");
@@ -689,7 +703,7 @@ static struct da9063_regulators_pdata *da9063_parse_regulators_dt(
 	pdata->n_regulators = num;
 
 	n = 0;
-	for (i = 0; i < ARRAY_SIZE(da9063_matches); i++) {
+	for (i = 0; i < da9063_matches_len; i++) {
 		if (!da9063_matches[i].init_data)
 			continue;
 
-- 
2.16.2

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

* [PATCH v5 14/14] mfd: da9063: Add DA9063L support
  2018-06-06  9:59 [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
                   ` (11 preceding siblings ...)
  2018-06-06 10:00 ` [PATCH v5 13/14] regulator: da9063: Handle less LDOs " Marek Vasut
@ 2018-06-06 10:00 ` Marek Vasut
  2018-06-07  8:04 ` [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
  13 siblings, 0 replies; 28+ messages in thread
From: Marek Vasut @ 2018-06-06 10:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Vasut, Geert Uytterhoeven, Lee Jones, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

Add support for DA9063L, which is a reduced variant of the DA9063
with less regulators and without RTC.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Steve Twiss <stwiss.opensource@diasemi.com>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-renesas-soc@vger.kernel.org
Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Steve Twiss <stwiss.opensource@diasemi.com>
---
V2: No change
V3: No change
V4: No change
V5: No change
---
 drivers/mfd/da9063-i2c.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/da9063-i2c.c b/drivers/mfd/da9063-i2c.c
index a449a9263dd7..50a24b1921d0 100644
--- a/drivers/mfd/da9063-i2c.c
+++ b/drivers/mfd/da9063-i2c.c
@@ -186,6 +186,7 @@ static struct regmap_config da9063_regmap_config = {
 
 static const struct of_device_id da9063_dt_ids[] = {
 	{ .compatible = "dlg,da9063", },
+	{ .compatible = "dlg,da9063l", },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, da9063_dt_ids);
@@ -231,6 +232,7 @@ static int da9063_i2c_probe(struct i2c_client *i2c,
 
 static const struct i2c_device_id da9063_i2c_id[] = {
 	{ "da9063", PMIC_TYPE_DA9063 },
+	{ "da9063l", PMIC_TYPE_DA9063L },
 	{},
 };
 MODULE_DEVICE_TABLE(i2c, da9063_i2c_id);
-- 
2.16.2

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

* Re: [PATCH v5 04/14] mfd: da9063: Use REGMAP_IRQ_REG
  2018-06-06  9:59 ` [PATCH v5 04/14] mfd: da9063: Use REGMAP_IRQ_REG Marek Vasut
@ 2018-06-06 11:31   ` Geert Uytterhoeven
  2018-06-06 16:06     ` Marek Vasut
  2018-06-07  7:05   ` Lee Jones
  1 sibling, 1 reply; 28+ messages in thread
From: Geert Uytterhoeven @ 2018-06-06 11:31 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Linux Kernel Mailing List, Marek Vasut, Geert Uytterhoeven,
	Lee Jones, Mark Brown, Steve Twiss, Wolfram Sang, Linux-Renesas

Hi Marek,

On Wed, Jun 6, 2018 at 11:59 AM, Marek Vasut <marek.vasut@gmail.com> wrote:
> Convert the regmap_irq table to use REGMAP_IRQ_REG().
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

Again:
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v5 03/14] mfd: da9063: Use regmap_reg_range
  2018-06-06  9:59 ` [PATCH v5 03/14] mfd: da9063: Use regmap_reg_range Marek Vasut
@ 2018-06-06 11:33   ` Geert Uytterhoeven
  2018-06-07  7:06   ` Lee Jones
  1 sibling, 0 replies; 28+ messages in thread
From: Geert Uytterhoeven @ 2018-06-06 11:33 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Linux Kernel Mailing List, Marek Vasut, Geert Uytterhoeven,
	Lee Jones, Mark Brown, Steve Twiss, Wolfram Sang, Linux-Renesas

2018-06-06 11:59 GMT+02:00 Marek Vasut <marek.vasut@gmail.com>:
> Convert the regmap_range tables to use regmap_reg_range() macro.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v5 04/14] mfd: da9063: Use REGMAP_IRQ_REG
  2018-06-06 11:31   ` Geert Uytterhoeven
@ 2018-06-06 16:06     ` Marek Vasut
  2018-06-07  7:01       ` Lee Jones
  2018-06-07  7:40       ` Geert Uytterhoeven
  0 siblings, 2 replies; 28+ messages in thread
From: Marek Vasut @ 2018-06-06 16:06 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linux Kernel Mailing List, Marek Vasut, Geert Uytterhoeven,
	Lee Jones, Mark Brown, Steve Twiss, Wolfram Sang, Linux-Renesas

On 06/06/2018 01:31 PM, Geert Uytterhoeven wrote:
> Hi Marek,
> 
> On Wed, Jun 6, 2018 at 11:59 AM, Marek Vasut <marek.vasut@gmail.com> wrote:
>> Convert the regmap_irq table to use REGMAP_IRQ_REG().
>>
>> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> 
> Again:
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Added.

And the obvious question is, what do you all use to collect these tags?
Doing it manually sucks.

-- 
Best regards,
Marek Vasut

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

* Re: [PATCH v5 04/14] mfd: da9063: Use REGMAP_IRQ_REG
  2018-06-06 16:06     ` Marek Vasut
@ 2018-06-07  7:01       ` Lee Jones
  2018-06-07  7:40       ` Geert Uytterhoeven
  1 sibling, 0 replies; 28+ messages in thread
From: Lee Jones @ 2018-06-07  7:01 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Geert Uytterhoeven, Linux Kernel Mailing List, Marek Vasut,
	Geert Uytterhoeven, Mark Brown, Steve Twiss, Wolfram Sang,
	Linux-Renesas

On Wed, 06 Jun 2018, Marek Vasut wrote:

> On 06/06/2018 01:31 PM, Geert Uytterhoeven wrote:
> > Hi Marek,
> > 
> > On Wed, Jun 6, 2018 at 11:59 AM, Marek Vasut <marek.vasut@gmail.com> wrote:
> >> Convert the regmap_irq table to use REGMAP_IRQ_REG().
> >>
> >> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> > 
> > Again:
> > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> Added.
> 
> And the obvious question is, what do you all use to collect these tags?
> Doing it manually sucks.

Manually for me.  Copy paste.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v5 04/14] mfd: da9063: Use REGMAP_IRQ_REG
  2018-06-06  9:59 ` [PATCH v5 04/14] mfd: da9063: Use REGMAP_IRQ_REG Marek Vasut
  2018-06-06 11:31   ` Geert Uytterhoeven
@ 2018-06-07  7:05   ` Lee Jones
  1 sibling, 0 replies; 28+ messages in thread
From: Lee Jones @ 2018-06-07  7:05 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-kernel, Marek Vasut, Geert Uytterhoeven, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

On Wed, 06 Jun 2018, Marek Vasut wrote:

> Convert the regmap_irq table to use REGMAP_IRQ_REG().
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Steve Twiss <stwiss.opensource@diasemi.com>
> Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Cc: linux-renesas-soc@vger.kernel.org
> Acked-by: Steve Twiss <stwiss.opensource@diasemi.com>
> ---
> V3: New patch
> Note: A sed oneliner was used:
>       sed -i "/\[DA9063_IRQ_/ {N;N;N;s/\n//g;s/.*\[\(DA9063_IRQ_[^]]\+\)].*reg_offset = \([^,]\+\),.* = \([^,]\+\),.*/\tREGMAP_IRQ_REG(\1, \2, \3),/}" drivers/mfd/da9063-irq.c
> V4: Formatting fixes with "s/,/&\r\t\t      /" on the array
>     Drop extra newline in da9063_irq_chip
> V5: No change
> ---
>  drivers/mfd/da9063-irq.c | 175 ++++++++++++++++-------------------------------
>  1 file changed, 58 insertions(+), 117 deletions(-)

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v5 03/14] mfd: da9063: Use regmap_reg_range
  2018-06-06  9:59 ` [PATCH v5 03/14] mfd: da9063: Use regmap_reg_range Marek Vasut
  2018-06-06 11:33   ` Geert Uytterhoeven
@ 2018-06-07  7:06   ` Lee Jones
  1 sibling, 0 replies; 28+ messages in thread
From: Lee Jones @ 2018-06-07  7:06 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-kernel, Marek Vasut, Geert Uytterhoeven, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

On Wed, 06 Jun 2018, Marek Vasut wrote:

> Convert the regmap_range tables to use regmap_reg_range() macro.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Steve Twiss <stwiss.opensource@diasemi.com>
> Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Cc: linux-renesas-soc@vger.kernel.org
> ---
> V5: New patch
> ---
>  drivers/mfd/da9063-i2c.c | 174 ++++++++++++-----------------------------------
>  1 file changed, 42 insertions(+), 132 deletions(-)

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v5 02/14] mfd: da9063: Replace mfd_add_devices with devm counterpart
  2018-06-06  9:59 ` [PATCH v5 02/14] mfd: da9063: Replace mfd_add_devices " Marek Vasut
@ 2018-06-07  7:07   ` Lee Jones
  0 siblings, 0 replies; 28+ messages in thread
From: Lee Jones @ 2018-06-07  7:07 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-kernel, Marek Vasut, Geert Uytterhoeven, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

On Wed, 06 Jun 2018, Marek Vasut wrote:

> Use devm_mfd_add_devices() instead of plain mfd_add_devices(), which
> removes the need for da9063_device_exit() altogether and also for the
> .remove callback in da9063-i2c.c .
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Steve Twiss <stwiss.opensource@diasemi.com>
> Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Cc: linux-renesas-soc@vger.kernel.org
> ---
> V5: New patch
> ---
>  drivers/mfd/da9063-core.c       | 11 +++--------
>  drivers/mfd/da9063-i2c.c        | 10 ----------
>  include/linux/mfd/da9063/core.h |  2 --
>  3 files changed, 3 insertions(+), 20 deletions(-)

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v5 04/14] mfd: da9063: Use REGMAP_IRQ_REG
  2018-06-06 16:06     ` Marek Vasut
  2018-06-07  7:01       ` Lee Jones
@ 2018-06-07  7:40       ` Geert Uytterhoeven
  1 sibling, 0 replies; 28+ messages in thread
From: Geert Uytterhoeven @ 2018-06-07  7:40 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Linux Kernel Mailing List, Marek Vasut, Geert Uytterhoeven,
	Lee Jones, Mark Brown, Steve Twiss, Wolfram Sang, Linux-Renesas

Hi Marek,

On Wed, Jun 6, 2018 at 6:06 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> On 06/06/2018 01:31 PM, Geert Uytterhoeven wrote:
>> On Wed, Jun 6, 2018 at 11:59 AM, Marek Vasut <marek.vasut@gmail.com> wrote:
>>> Convert the regmap_irq table to use REGMAP_IRQ_REG().
>>> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
>>
>> Again:
>> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> Added.
>
> And the obvious question is, what do you all use to collect these tags?
> Doing it manually sucks.

1. Add green star (in gmail) to email supplying tag,
2. Once in a while, filter using has:green-star, and git rebase -i my queue,
   adding tags and changelogs to the commits in git.

Hope this helps.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart
  2018-06-06  9:59 [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
                   ` (12 preceding siblings ...)
  2018-06-06 10:00 ` [PATCH v5 14/14] mfd: da9063: Add DA9063L support Marek Vasut
@ 2018-06-07  8:04 ` Marek Vasut
  2018-06-07 12:41   ` Lee Jones
  13 siblings, 1 reply; 28+ messages in thread
From: Marek Vasut @ 2018-06-07  8:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Vasut, Geert Uytterhoeven, Lee Jones, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

On 06/06/2018 11:59 AM, Marek Vasut wrote:
> Use devm_regmap_add_irq_chip() instead of plain regmap_add_irq_chip(),
> which removes the need for da9063_irq_exit() altogether and also
> fixes a bug in da9063_device_init() where the da9063_irq_exit() was
> not called in a failpath.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Steve Twiss <stwiss.opensource@diasemi.com>
> Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Cc: linux-renesas-soc@vger.kernel.org

So it's just this one patch that's missing AB/RB and the series should
be good?

> ---
> V5: New patch
> ---
>  drivers/mfd/da9063-core.c       | 1 -
>  drivers/mfd/da9063-irq.c        | 8 ++------
>  include/linux/mfd/da9063/core.h | 1 -
>  3 files changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/mfd/da9063-core.c b/drivers/mfd/da9063-core.c
> index 6c2870d4e754..2647bb371d86 100644
> --- a/drivers/mfd/da9063-core.c
> +++ b/drivers/mfd/da9063-core.c
> @@ -238,7 +238,6 @@ int da9063_device_init(struct da9063 *da9063, unsigned int irq)
>  void da9063_device_exit(struct da9063 *da9063)
>  {
>  	mfd_remove_devices(da9063->dev);
> -	da9063_irq_exit(da9063);
>  }
>  
>  MODULE_DESCRIPTION("PMIC driver for Dialog DA9063");
> diff --git a/drivers/mfd/da9063-irq.c b/drivers/mfd/da9063-irq.c
> index 207bbfe55449..da6ceb41f0d1 100644
> --- a/drivers/mfd/da9063-irq.c
> +++ b/drivers/mfd/da9063-irq.c
> @@ -170,7 +170,8 @@ int da9063_irq_init(struct da9063 *da9063)
>  		return -EINVAL;
>  	}
>  
> -	ret = regmap_add_irq_chip(da9063->regmap, da9063->chip_irq,
> +	ret = devm_regmap_add_irq_chip(da9063->dev, da9063->regmap,
> +			da9063->chip_irq,
>  			IRQF_TRIGGER_LOW | IRQF_ONESHOT | IRQF_SHARED,
>  			da9063->irq_base, &da9063_irq_chip,
>  			&da9063->regmap_irq);
> @@ -182,8 +183,3 @@ int da9063_irq_init(struct da9063 *da9063)
>  
>  	return 0;
>  }
> -
> -void da9063_irq_exit(struct da9063 *da9063)
> -{
> -	regmap_del_irq_chip(da9063->chip_irq, da9063->regmap_irq);
> -}
> diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h
> index f3ae65db4c86..9ab7049977aa 100644
> --- a/include/linux/mfd/da9063/core.h
> +++ b/include/linux/mfd/da9063/core.h
> @@ -95,6 +95,5 @@ int da9063_device_init(struct da9063 *da9063, unsigned int irq);
>  int da9063_irq_init(struct da9063 *da9063);
>  
>  void da9063_device_exit(struct da9063 *da9063);
> -void da9063_irq_exit(struct da9063 *da9063);
>  
>  #endif /* __MFD_DA9063_CORE_H__ */
> 


-- 
Best regards,
Marek Vasut

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

* Re: [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart
  2018-06-07  8:04 ` [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
@ 2018-06-07 12:41   ` Lee Jones
  2018-06-07 13:19     ` Marek Vasut
  0 siblings, 1 reply; 28+ messages in thread
From: Lee Jones @ 2018-06-07 12:41 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-kernel, Marek Vasut, Geert Uytterhoeven, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

On Thu, 07 Jun 2018, Marek Vasut wrote:

> On 06/06/2018 11:59 AM, Marek Vasut wrote:
> > Use devm_regmap_add_irq_chip() instead of plain regmap_add_irq_chip(),
> > which removes the need for da9063_irq_exit() altogether and also
> > fixes a bug in da9063_device_init() where the da9063_irq_exit() was
> > not called in a failpath.
> > 
> > Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> > Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> > Cc: Lee Jones <lee.jones@linaro.org>
> > Cc: Mark Brown <broonie@kernel.org>
> > Cc: Steve Twiss <stwiss.opensource@diasemi.com>
> > Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > Cc: linux-renesas-soc@vger.kernel.org
> 
> So it's just this one patch that's missing AB/RB and the series should
> be good?

Looks fine. Although we'll let it sit for a while in case anyone else
has any thoughts.

The merge window is currently open, so there is no rush to apply.

> > ---
> > V5: New patch
> > ---
> >  drivers/mfd/da9063-core.c       | 1 -
> >  drivers/mfd/da9063-irq.c        | 8 ++------
> >  include/linux/mfd/da9063/core.h | 1 -
> >  3 files changed, 2 insertions(+), 8 deletions(-)

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart
  2018-06-07 12:41   ` Lee Jones
@ 2018-06-07 13:19     ` Marek Vasut
  2018-06-08  6:37       ` Lee Jones
  0 siblings, 1 reply; 28+ messages in thread
From: Marek Vasut @ 2018-06-07 13:19 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-kernel, Marek Vasut, Geert Uytterhoeven, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

On 06/07/2018 02:41 PM, Lee Jones wrote:
> On Thu, 07 Jun 2018, Marek Vasut wrote:
> 
>> On 06/06/2018 11:59 AM, Marek Vasut wrote:
>>> Use devm_regmap_add_irq_chip() instead of plain regmap_add_irq_chip(),
>>> which removes the need for da9063_irq_exit() altogether and also
>>> fixes a bug in da9063_device_init() where the da9063_irq_exit() was
>>> not called in a failpath.
>>>
>>> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
>>> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
>>> Cc: Lee Jones <lee.jones@linaro.org>
>>> Cc: Mark Brown <broonie@kernel.org>
>>> Cc: Steve Twiss <stwiss.opensource@diasemi.com>
>>> Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
>>> Cc: linux-renesas-soc@vger.kernel.org
>>
>> So it's just this one patch that's missing AB/RB and the series should
>> be good?
> 
> Looks fine. Although we'll let it sit for a while in case anyone else
> has any thoughts.

Fine by me.

> The merge window is currently open, so there is no rush to apply.

This is still 4.18 material ? Hum, OK.

>>> ---
>>> V5: New patch
>>> ---
>>>  drivers/mfd/da9063-core.c       | 1 -
>>>  drivers/mfd/da9063-irq.c        | 8 ++------
>>>  include/linux/mfd/da9063/core.h | 1 -
>>>  3 files changed, 2 insertions(+), 8 deletions(-)
> 
> For my own reference:
>   Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>

Added to my tree.

-- 
Best regards,
Marek Vasut

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

* Re: [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart
  2018-06-07 13:19     ` Marek Vasut
@ 2018-06-08  6:37       ` Lee Jones
  2018-06-08  8:50         ` Marek Vasut
  0 siblings, 1 reply; 28+ messages in thread
From: Lee Jones @ 2018-06-08  6:37 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-kernel, Marek Vasut, Geert Uytterhoeven, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

On Thu, 07 Jun 2018, Marek Vasut wrote:

> On 06/07/2018 02:41 PM, Lee Jones wrote:
> > On Thu, 07 Jun 2018, Marek Vasut wrote:
> > 
> >> On 06/06/2018 11:59 AM, Marek Vasut wrote:
> >>> Use devm_regmap_add_irq_chip() instead of plain regmap_add_irq_chip(),
> >>> which removes the need for da9063_irq_exit() altogether and also
> >>> fixes a bug in da9063_device_init() where the da9063_irq_exit() was
> >>> not called in a failpath.
> >>>
> >>> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> >>> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> >>> Cc: Lee Jones <lee.jones@linaro.org>
> >>> Cc: Mark Brown <broonie@kernel.org>
> >>> Cc: Steve Twiss <stwiss.opensource@diasemi.com>
> >>> Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
> >>> Cc: linux-renesas-soc@vger.kernel.org
> >>
> >> So it's just this one patch that's missing AB/RB and the series should
> >> be good?
> > 
> > Looks fine. Although we'll let it sit for a while in case anyone else
> > has any thoughts.
> 
> Fine by me.
> 
> > The merge window is currently open, so there is no rush to apply.
> 
> This is still 4.18 material ? Hum, OK.

You mean this could be added to v4.18?  If so, not a chance.  I
normally cut off accepting trivial patches at around -rc6(ish).  Large
sets like this require a longer soak in -next for all of the build
bots and testers to have their wicked way with them and for potential
merge conflicts to show.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart
  2018-06-08  6:37       ` Lee Jones
@ 2018-06-08  8:50         ` Marek Vasut
  0 siblings, 0 replies; 28+ messages in thread
From: Marek Vasut @ 2018-06-08  8:50 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-kernel, Marek Vasut, Geert Uytterhoeven, Mark Brown,
	Steve Twiss, Wolfram Sang, linux-renesas-soc

On 06/08/2018 08:37 AM, Lee Jones wrote:
> On Thu, 07 Jun 2018, Marek Vasut wrote:
> 
>> On 06/07/2018 02:41 PM, Lee Jones wrote:
>>> On Thu, 07 Jun 2018, Marek Vasut wrote:
>>>
>>>> On 06/06/2018 11:59 AM, Marek Vasut wrote:
>>>>> Use devm_regmap_add_irq_chip() instead of plain regmap_add_irq_chip(),
>>>>> which removes the need for da9063_irq_exit() altogether and also
>>>>> fixes a bug in da9063_device_init() where the da9063_irq_exit() was
>>>>> not called in a failpath.
>>>>>
>>>>> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
>>>>> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
>>>>> Cc: Lee Jones <lee.jones@linaro.org>
>>>>> Cc: Mark Brown <broonie@kernel.org>
>>>>> Cc: Steve Twiss <stwiss.opensource@diasemi.com>
>>>>> Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
>>>>> Cc: linux-renesas-soc@vger.kernel.org
>>>>
>>>> So it's just this one patch that's missing AB/RB and the series should
>>>> be good?
>>>
>>> Looks fine. Although we'll let it sit for a while in case anyone else
>>> has any thoughts.
>>
>> Fine by me.
>>
>>> The merge window is currently open, so there is no rush to apply.
>>
>> This is still 4.18 material ? Hum, OK.
> 
> You mean this could be added to v4.18?  If so, not a chance.  I
> normally cut off accepting trivial patches at around -rc6(ish).  Large
> sets like this require a longer soak in -next for all of the build
> bots and testers to have their wicked way with them and for potential
> merge conflicts to show.

Fine

-- 
Best regards,
Marek Vasut

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

* Re: [PATCH v5 08/14] mfd: da9063: Replace model with type
  2018-06-06  9:59 ` [PATCH v5 08/14] mfd: da9063: Replace model with type Marek Vasut
@ 2018-06-11 14:45   ` kbuild test robot
  0 siblings, 0 replies; 28+ messages in thread
From: kbuild test robot @ 2018-06-11 14:45 UTC (permalink / raw)
  To: Marek Vasut
  Cc: kbuild-all, linux-kernel, Marek Vasut, Geert Uytterhoeven,
	Lee Jones, Mark Brown, Steve Twiss, Wolfram Sang,
	linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 15856 bytes --]

Hi Marek,

I love your patch! Yet something to improve:

[auto build test ERROR on ljones-mfd/for-mfd-next]
[also build test ERROR on v4.17 next-20180608]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Marek-Vasut/mfd-da9063-Replace-regmap_add_irq_chip-with-devm-counterpart/20180607-152143
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: mips-allmodconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   drivers/input/joystick/analog.c:176:2: warning: #warning Precise timer not defined for this architecture. [-Wcpp]
    #warning Precise timer not defined for this architecture.
     ^~~~~~~
   drivers/mfd/cros_ec_dev.c:265:13: warning: '__remove' defined but not used [-Wunused-function]
    static void __remove(struct device *dev) { }
                ^~~~~~~~
   drivers/regulator/da9063-regulator.c: In function 'da9063_regulator_probe':
>> drivers/regulator/da9063-regulator.c:749:10: error: 'struct da9063' has no member named 'model'
       da9063->model);
             ^~
   make[3]: *** [drivers/regulator/da9063-regulator.o] Error 1
   make[3]: Target '__build' not remade because of errors.
   make[2]: *** [drivers/regulator] Error 2
   drivers/spi/spi-sh-msiof.c:77:0: warning: "STR" redefined
    #define STR 0x40 /* Status Register */
    
   In file included from arch/mips/include/asm/mach-generic/spaces.h:15:0,
                    from arch/mips/include/asm/addrspace.h:13,
                    from arch/mips/include/asm/barrier.h:11,
                    from include/linux/compiler.h:245,
                    from arch/mips/include/asm/bitops.h:16,
                    from include/linux/bitops.h:38,
                    from include/linux/bitmap.h:8,
                    from drivers/spi/spi-sh-msiof.c:14:
   arch/mips/include/asm/mipsregs.h:29:0: note: this is the location of the previous definition
    #define STR(x) __STR(x)
    
   In file included from arch/mips/include/asm/sibyte/sb1250.h:41:0,
                    from drivers/watchdog/sb_wdog.c:58:
   arch/mips/include/asm/sibyte/bcm1480_scd.h:274:0: warning: "M_SPC_CFG_CLEAR" redefined
    #define M_SPC_CFG_CLEAR   M_BCM1480_SPC_CFG_CLEAR
    
   In file included from arch/mips/include/asm/sibyte/sb1250.h:40:0,
                    from drivers/watchdog/sb_wdog.c:58:
   arch/mips/include/asm/sibyte/sb1250_scd.h:405:0: note: this is the location of the previous definition
    #define M_SPC_CFG_CLEAR  _SB_MAKEMASK1(32)
    
   In file included from arch/mips/include/asm/sibyte/sb1250.h:41:0,
                    from drivers/watchdog/sb_wdog.c:58:
   arch/mips/include/asm/sibyte/bcm1480_scd.h:275:0: warning: "M_SPC_CFG_ENABLE" redefined
    #define M_SPC_CFG_ENABLE  M_BCM1480_SPC_CFG_ENABLE
    
   In file included from arch/mips/include/asm/sibyte/sb1250.h:40:0,
                    from drivers/watchdog/sb_wdog.c:58:
   arch/mips/include/asm/sibyte/sb1250_scd.h:406:0: note: this is the location of the previous definition
    #define M_SPC_CFG_ENABLE _SB_MAKEMASK1(33)
    
   make[2]: Target '__build' not remade because of errors.

vim +749 drivers/regulator/da9063-regulator.c

69ca3e58 Krystian Garbaciak 2013-07-29  715  
69ca3e58 Krystian Garbaciak 2013-07-29  716  static int da9063_regulator_probe(struct platform_device *pdev)
69ca3e58 Krystian Garbaciak 2013-07-29  717  {
69ca3e58 Krystian Garbaciak 2013-07-29  718  	struct da9063 *da9063 = dev_get_drvdata(pdev->dev.parent);
69ca3e58 Krystian Garbaciak 2013-07-29  719  	struct da9063_pdata *da9063_pdata = dev_get_platdata(da9063->dev);
0fdfd40a Geert Uytterhoeven 2013-09-09  720  	struct of_regulator_match *da9063_reg_matches = NULL;
69ca3e58 Krystian Garbaciak 2013-07-29  721  	struct da9063_regulators_pdata *regl_pdata;
69ca3e58 Krystian Garbaciak 2013-07-29  722  	const struct da9063_dev_model *model;
69ca3e58 Krystian Garbaciak 2013-07-29  723  	struct da9063_regulators *regulators;
69ca3e58 Krystian Garbaciak 2013-07-29  724  	struct da9063_regulator *regl;
69ca3e58 Krystian Garbaciak 2013-07-29  725  	struct regulator_config config;
69ca3e58 Krystian Garbaciak 2013-07-29  726  	bool bcores_merged, bmem_bio_merged;
69ca3e58 Krystian Garbaciak 2013-07-29  727  	int id, irq, n, n_regulators, ret, val;
69ca3e58 Krystian Garbaciak 2013-07-29  728  	size_t size;
69ca3e58 Krystian Garbaciak 2013-07-29  729  
69ca3e58 Krystian Garbaciak 2013-07-29  730  	regl_pdata = da9063_pdata ? da9063_pdata->regulators_pdata : NULL;
69ca3e58 Krystian Garbaciak 2013-07-29  731  
69ca3e58 Krystian Garbaciak 2013-07-29  732  	if (!regl_pdata)
69ca3e58 Krystian Garbaciak 2013-07-29  733  		regl_pdata = da9063_parse_regulators_dt(pdev,
69ca3e58 Krystian Garbaciak 2013-07-29  734  							&da9063_reg_matches);
69ca3e58 Krystian Garbaciak 2013-07-29  735  
69ca3e58 Krystian Garbaciak 2013-07-29  736  	if (IS_ERR(regl_pdata) || regl_pdata->n_regulators == 0) {
69ca3e58 Krystian Garbaciak 2013-07-29  737  		dev_err(&pdev->dev,
69ca3e58 Krystian Garbaciak 2013-07-29  738  			"No regulators defined for the platform\n");
b6615659 Dan Carpenter      2017-08-30  739  		return -ENODEV;
69ca3e58 Krystian Garbaciak 2013-07-29  740  	}
69ca3e58 Krystian Garbaciak 2013-07-29  741  
69ca3e58 Krystian Garbaciak 2013-07-29  742  	/* Find regulators set for particular device model */
69ca3e58 Krystian Garbaciak 2013-07-29  743  	for (model = regulators_models; model->regulator_info; model++) {
22fbf3a1 Marek Vasut        2018-06-06  744  		if (model->type == da9063->type)
69ca3e58 Krystian Garbaciak 2013-07-29  745  			break;
69ca3e58 Krystian Garbaciak 2013-07-29  746  	}
69ca3e58 Krystian Garbaciak 2013-07-29  747  	if (!model->regulator_info) {
69ca3e58 Krystian Garbaciak 2013-07-29  748  		dev_err(&pdev->dev, "Chip model not recognised (%u)\n",
69ca3e58 Krystian Garbaciak 2013-07-29 @749  			da9063->model);
69ca3e58 Krystian Garbaciak 2013-07-29  750  		return -ENODEV;
69ca3e58 Krystian Garbaciak 2013-07-29  751  	}
69ca3e58 Krystian Garbaciak 2013-07-29  752  
69ca3e58 Krystian Garbaciak 2013-07-29  753  	ret = regmap_read(da9063->regmap, DA9063_REG_CONFIG_H, &val);
69ca3e58 Krystian Garbaciak 2013-07-29  754  	if (ret < 0) {
69ca3e58 Krystian Garbaciak 2013-07-29  755  		dev_err(&pdev->dev,
69ca3e58 Krystian Garbaciak 2013-07-29  756  			"Error while reading BUCKs configuration\n");
8a7963d5 Sachin Kamat       2014-02-18  757  		return ret;
69ca3e58 Krystian Garbaciak 2013-07-29  758  	}
69ca3e58 Krystian Garbaciak 2013-07-29  759  	bcores_merged = val & DA9063_BCORE_MERGE;
69ca3e58 Krystian Garbaciak 2013-07-29  760  	bmem_bio_merged = val & DA9063_BUCK_MERGE;
69ca3e58 Krystian Garbaciak 2013-07-29  761  
69ca3e58 Krystian Garbaciak 2013-07-29  762  	n_regulators = model->n_regulators;
69ca3e58 Krystian Garbaciak 2013-07-29  763  	if (bcores_merged)
69ca3e58 Krystian Garbaciak 2013-07-29  764  		n_regulators -= 2; /* remove BCORE1, BCORE2 */
69ca3e58 Krystian Garbaciak 2013-07-29  765  	else
69ca3e58 Krystian Garbaciak 2013-07-29  766  		n_regulators--;    /* remove BCORES_MERGED */
69ca3e58 Krystian Garbaciak 2013-07-29  767  	if (bmem_bio_merged)
69ca3e58 Krystian Garbaciak 2013-07-29  768  		n_regulators -= 2; /* remove BMEM, BIO */
69ca3e58 Krystian Garbaciak 2013-07-29  769  	else
69ca3e58 Krystian Garbaciak 2013-07-29  770  		n_regulators--;    /* remove BMEM_BIO_MERGED */
69ca3e58 Krystian Garbaciak 2013-07-29  771  
69ca3e58 Krystian Garbaciak 2013-07-29  772  	/* Allocate memory required by usable regulators */
69ca3e58 Krystian Garbaciak 2013-07-29  773  	size = sizeof(struct da9063_regulators) +
69ca3e58 Krystian Garbaciak 2013-07-29  774  		n_regulators * sizeof(struct da9063_regulator);
69ca3e58 Krystian Garbaciak 2013-07-29  775  	regulators = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
8b5baa56 Sachin Kamat       2014-02-20  776  	if (!regulators)
69ca3e58 Krystian Garbaciak 2013-07-29  777  		return -ENOMEM;
69ca3e58 Krystian Garbaciak 2013-07-29  778  
69ca3e58 Krystian Garbaciak 2013-07-29  779  	regulators->n_regulators = n_regulators;
69ca3e58 Krystian Garbaciak 2013-07-29  780  	platform_set_drvdata(pdev, regulators);
69ca3e58 Krystian Garbaciak 2013-07-29  781  
69ca3e58 Krystian Garbaciak 2013-07-29  782  	/* Register all regulators declared in platform information */
69ca3e58 Krystian Garbaciak 2013-07-29  783  	n = 0;
69ca3e58 Krystian Garbaciak 2013-07-29  784  	id = 0;
69ca3e58 Krystian Garbaciak 2013-07-29  785  	while (n < regulators->n_regulators) {
69ca3e58 Krystian Garbaciak 2013-07-29  786  		/* Skip regulator IDs depending on merge mode configuration */
69ca3e58 Krystian Garbaciak 2013-07-29  787  		switch (id) {
69ca3e58 Krystian Garbaciak 2013-07-29  788  		case DA9063_ID_BCORE1:
69ca3e58 Krystian Garbaciak 2013-07-29  789  		case DA9063_ID_BCORE2:
69ca3e58 Krystian Garbaciak 2013-07-29  790  			if (bcores_merged) {
69ca3e58 Krystian Garbaciak 2013-07-29  791  				id++;
69ca3e58 Krystian Garbaciak 2013-07-29  792  				continue;
69ca3e58 Krystian Garbaciak 2013-07-29  793  			}
69ca3e58 Krystian Garbaciak 2013-07-29  794  			break;
69ca3e58 Krystian Garbaciak 2013-07-29  795  		case DA9063_ID_BMEM:
69ca3e58 Krystian Garbaciak 2013-07-29  796  		case DA9063_ID_BIO:
69ca3e58 Krystian Garbaciak 2013-07-29  797  			if (bmem_bio_merged) {
69ca3e58 Krystian Garbaciak 2013-07-29  798  				id++;
69ca3e58 Krystian Garbaciak 2013-07-29  799  				continue;
69ca3e58 Krystian Garbaciak 2013-07-29  800  			}
69ca3e58 Krystian Garbaciak 2013-07-29  801  			break;
69ca3e58 Krystian Garbaciak 2013-07-29  802  		case DA9063_ID_BCORES_MERGED:
69ca3e58 Krystian Garbaciak 2013-07-29  803  			if (!bcores_merged) {
69ca3e58 Krystian Garbaciak 2013-07-29  804  				id++;
69ca3e58 Krystian Garbaciak 2013-07-29  805  				continue;
69ca3e58 Krystian Garbaciak 2013-07-29  806  			}
69ca3e58 Krystian Garbaciak 2013-07-29  807  			break;
69ca3e58 Krystian Garbaciak 2013-07-29  808  		case DA9063_ID_BMEM_BIO_MERGED:
69ca3e58 Krystian Garbaciak 2013-07-29  809  			if (!bmem_bio_merged) {
69ca3e58 Krystian Garbaciak 2013-07-29  810  				id++;
69ca3e58 Krystian Garbaciak 2013-07-29  811  				continue;
69ca3e58 Krystian Garbaciak 2013-07-29  812  			}
69ca3e58 Krystian Garbaciak 2013-07-29  813  			break;
69ca3e58 Krystian Garbaciak 2013-07-29  814  		}
69ca3e58 Krystian Garbaciak 2013-07-29  815  
69ca3e58 Krystian Garbaciak 2013-07-29  816  		/* Initialise regulator structure */
69ca3e58 Krystian Garbaciak 2013-07-29  817  		regl = &regulators->regulator[n];
69ca3e58 Krystian Garbaciak 2013-07-29  818  		regl->hw = da9063;
69ca3e58 Krystian Garbaciak 2013-07-29  819  		regl->info = &model->regulator_info[id];
69ca3e58 Krystian Garbaciak 2013-07-29  820  		regl->desc = regl->info->desc;
69ca3e58 Krystian Garbaciak 2013-07-29  821  		regl->desc.type = REGULATOR_VOLTAGE;
69ca3e58 Krystian Garbaciak 2013-07-29  822  		regl->desc.owner = THIS_MODULE;
69ca3e58 Krystian Garbaciak 2013-07-29  823  
69ca3e58 Krystian Garbaciak 2013-07-29  824  		if (regl->info->mode.reg)
69ca3e58 Krystian Garbaciak 2013-07-29  825  			regl->mode = devm_regmap_field_alloc(&pdev->dev,
69ca3e58 Krystian Garbaciak 2013-07-29  826  					da9063->regmap, regl->info->mode);
69ca3e58 Krystian Garbaciak 2013-07-29  827  		if (regl->info->suspend.reg)
69ca3e58 Krystian Garbaciak 2013-07-29  828  			regl->suspend = devm_regmap_field_alloc(&pdev->dev,
69ca3e58 Krystian Garbaciak 2013-07-29  829  					da9063->regmap, regl->info->suspend);
69ca3e58 Krystian Garbaciak 2013-07-29  830  		if (regl->info->sleep.reg)
69ca3e58 Krystian Garbaciak 2013-07-29  831  			regl->sleep = devm_regmap_field_alloc(&pdev->dev,
69ca3e58 Krystian Garbaciak 2013-07-29  832  					da9063->regmap, regl->info->sleep);
69ca3e58 Krystian Garbaciak 2013-07-29  833  		if (regl->info->suspend_sleep.reg)
69ca3e58 Krystian Garbaciak 2013-07-29  834  			regl->suspend_sleep = devm_regmap_field_alloc(&pdev->dev,
69ca3e58 Krystian Garbaciak 2013-07-29  835  					da9063->regmap, regl->info->suspend_sleep);
69ca3e58 Krystian Garbaciak 2013-07-29  836  		if (regl->info->ilimit.reg)
69ca3e58 Krystian Garbaciak 2013-07-29  837  			regl->ilimit = devm_regmap_field_alloc(&pdev->dev,
69ca3e58 Krystian Garbaciak 2013-07-29  838  					da9063->regmap, regl->info->ilimit);
69ca3e58 Krystian Garbaciak 2013-07-29  839  
69ca3e58 Krystian Garbaciak 2013-07-29  840  		/* Register regulator */
69ca3e58 Krystian Garbaciak 2013-07-29  841  		memset(&config, 0, sizeof(config));
69ca3e58 Krystian Garbaciak 2013-07-29  842  		config.dev = &pdev->dev;
69ca3e58 Krystian Garbaciak 2013-07-29  843  		config.init_data = da9063_get_regulator_initdata(regl_pdata, id);
69ca3e58 Krystian Garbaciak 2013-07-29  844  		config.driver_data = regl;
69ca3e58 Krystian Garbaciak 2013-07-29  845  		if (da9063_reg_matches)
69ca3e58 Krystian Garbaciak 2013-07-29  846  			config.of_node = da9063_reg_matches[id].of_node;
69ca3e58 Krystian Garbaciak 2013-07-29  847  		config.regmap = da9063->regmap;
e97bba91 Jingoo Han         2013-09-30  848  		regl->rdev = devm_regulator_register(&pdev->dev, &regl->desc,
e97bba91 Jingoo Han         2013-09-30  849  						     &config);
e515800b Axel Lin           2013-08-30  850  		if (IS_ERR(regl->rdev)) {
69ca3e58 Krystian Garbaciak 2013-07-29  851  			dev_err(&pdev->dev,
69ca3e58 Krystian Garbaciak 2013-07-29  852  				"Failed to register %s regulator\n",
69ca3e58 Krystian Garbaciak 2013-07-29  853  				regl->desc.name);
e97bba91 Jingoo Han         2013-09-30  854  			return PTR_ERR(regl->rdev);
69ca3e58 Krystian Garbaciak 2013-07-29  855  		}
69ca3e58 Krystian Garbaciak 2013-07-29  856  		id++;
69ca3e58 Krystian Garbaciak 2013-07-29  857  		n++;
69ca3e58 Krystian Garbaciak 2013-07-29  858  	}
69ca3e58 Krystian Garbaciak 2013-07-29  859  
69ca3e58 Krystian Garbaciak 2013-07-29  860  	/* LDOs overcurrent event support */
69ca3e58 Krystian Garbaciak 2013-07-29  861  	irq = platform_get_irq_byname(pdev, "LDO_LIM");
69ca3e58 Krystian Garbaciak 2013-07-29  862  	if (irq < 0) {
69ca3e58 Krystian Garbaciak 2013-07-29  863  		dev_err(&pdev->dev, "Failed to get IRQ.\n");
e97bba91 Jingoo Han         2013-09-30  864  		return irq;
69ca3e58 Krystian Garbaciak 2013-07-29  865  	}
69ca3e58 Krystian Garbaciak 2013-07-29  866  
d87aef91 Axel Lin           2015-05-31  867  	ret = devm_request_threaded_irq(&pdev->dev, irq,
69ca3e58 Krystian Garbaciak 2013-07-29  868  				NULL, da9063_ldo_lim_event,
69ca3e58 Krystian Garbaciak 2013-07-29  869  				IRQF_TRIGGER_LOW | IRQF_ONESHOT,
69ca3e58 Krystian Garbaciak 2013-07-29  870  				"LDO_LIM", regulators);
69ca3e58 Krystian Garbaciak 2013-07-29  871  	if (ret) {
d87aef91 Axel Lin           2015-05-31  872  		dev_err(&pdev->dev, "Failed to request LDO_LIM IRQ.\n");
d87aef91 Axel Lin           2015-05-31  873  		return ret;
69ca3e58 Krystian Garbaciak 2013-07-29  874  	}
69ca3e58 Krystian Garbaciak 2013-07-29  875  
69ca3e58 Krystian Garbaciak 2013-07-29  876  	return 0;
69ca3e58 Krystian Garbaciak 2013-07-29  877  }
69ca3e58 Krystian Garbaciak 2013-07-29  878  

:::::: The code at line 749 was first introduced by commit
:::::: 69ca3e58d17854f8fa72d85aea6bf4614ad25a56 regulator: da9063: Add Dialog DA9063 voltage regulators support.

:::::: TO: Krystian Garbaciak <krystian.garbaciak@diasemi.com>
:::::: CC: Mark Brown <broonie@linaro.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 55189 bytes --]

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

end of thread, other threads:[~2018-06-11  6:31 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-06  9:59 [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
2018-06-06  9:59 ` [PATCH v5 02/14] mfd: da9063: Replace mfd_add_devices " Marek Vasut
2018-06-07  7:07   ` Lee Jones
2018-06-06  9:59 ` [PATCH v5 03/14] mfd: da9063: Use regmap_reg_range Marek Vasut
2018-06-06 11:33   ` Geert Uytterhoeven
2018-06-07  7:06   ` Lee Jones
2018-06-06  9:59 ` [PATCH v5 04/14] mfd: da9063: Use REGMAP_IRQ_REG Marek Vasut
2018-06-06 11:31   ` Geert Uytterhoeven
2018-06-06 16:06     ` Marek Vasut
2018-06-07  7:01       ` Lee Jones
2018-06-07  7:40       ` Geert Uytterhoeven
2018-06-07  7:05   ` Lee Jones
2018-06-06  9:59 ` [PATCH v5 05/14] mfd: da9063: Use PLATFORM_DEVID_NONE Marek Vasut
2018-06-06  9:59 ` [PATCH v5 06/14] mfd: da9063: Replace DA9063_NUM_IRQ with ARRAY_SIZE Marek Vasut
2018-06-06  9:59 ` [PATCH v5 07/14] mfd: da9063: Rename PMIC_DA9063 to PMIC_CHIP_ID_DA9063 Marek Vasut
2018-06-06  9:59 ` [PATCH v5 08/14] mfd: da9063: Replace model with type Marek Vasut
2018-06-11 14:45   ` kbuild test robot
2018-06-06  9:59 ` [PATCH v5 09/14] mfd: da9063: Add DA9063L type Marek Vasut
2018-06-06  9:59 ` [PATCH v5 10/14] mfd: da9063: Add custom regmap for DA9063L Marek Vasut
2018-06-06 10:00 ` [PATCH v5 11/14] mfd: da9063: Add custom IRQ map " Marek Vasut
2018-06-06 10:00 ` [PATCH v5 12/14] mfd: da9063: Register RTC only on DA9063L Marek Vasut
2018-06-06 10:00 ` [PATCH v5 13/14] regulator: da9063: Handle less LDOs " Marek Vasut
2018-06-06 10:00 ` [PATCH v5 14/14] mfd: da9063: Add DA9063L support Marek Vasut
2018-06-07  8:04 ` [PATCH v5 01/14] mfd: da9063: Replace regmap_add_irq_chip with devm counterpart Marek Vasut
2018-06-07 12:41   ` Lee Jones
2018-06-07 13:19     ` Marek Vasut
2018-06-08  6:37       ` Lee Jones
2018-06-08  8:50         ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.