Skip to contentSkip to conversation

mfd: da9062: Remove IRQ requirement

PATCH In review Christoph Niedermaier 4 participants 6 messages Feb 9, 2023 – Mar 7, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 mfd: da9062: Remove IRQ requirement

This patch removes the requirement for an IRQ, because for the core functionality IRQ isn't needed. So this makes the DA9061/62 chip useable for designs which haven't connected the IRQ pin.

---
Cc: Support Opensource <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Adam Thomson <[email protected]>
Cc: Liam Girdwood <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: [email protected]
Cc: [email protected]
To: [email protected]
---
V2: - Rebase on current next 20230209
- Add Lee Jones to Cc list

---
 drivers/mfd/da9062-core.c | 98 +++++++++++++++++++++++++++++++++++------------
 1 file changed, 73 insertions(+), 25 deletions(-)
drivers/mfd/da9062-core.c +73 -25
index 40cde51e5719..caa597400dd1 100644
@@ -212,6 +212,27 @@ static const struct mfd_cell da9061_devs[] = {
 	},
 };
 
+static const struct mfd_cell da9061_devs_without_irq[] = {
+	{
+		.name		= "da9061-core",
+	},
+	{
+		.name		= "da9062-regulators",
+	},
+	{
+		.name		= "da9061-watchdog",
+		.of_compatible  = "dlg,da9061-watchdog",
+	},
+	{
+		.name		= "da9061-thermal",
+		.of_compatible  = "dlg,da9061-thermal",
+	},
+	{
+		.name		= "da9061-onkey",
+		.of_compatible = "dlg,da9061-onkey",
+	},
+};
+
 static const struct resource da9062_core_resources[] = {
 	DEFINE_RES_NAMED(DA9062_IRQ_VDD_WARN, 1, "VDD_WARN", IORESOURCE_IRQ),
 };
@@ -288,6 +309,35 @@ static const struct mfd_cell da9062_devs[] = {
 	},
 };
 
+static const struct mfd_cell da9062_devs_without_irq[] = {
+	{
+		.name		= "da9062-core",
+	},
+	{
+		.name		= "da9062-regulators",
+	},
+	{
+		.name		= "da9062-watchdog",
+		.of_compatible  = "dlg,da9062-watchdog",
+	},
+	{
+		.name		= "da9062-thermal",
+		.of_compatible  = "dlg,da9062-thermal",
+	},
+	{
+		.name		= "da9062-rtc",
+		.of_compatible  = "dlg,da9062-rtc",
+	},
+	{
+		.name		= "da9062-onkey",
+		.of_compatible	= "dlg,da9062-onkey",
+	},
+	{
+		.name		= "da9062-gpio",
+		.of_compatible	= "dlg,da9062-gpio",
+	},
+};
+
 static int da9062_clear_fault_log(struct da9062 *chip)
 {
 	int ret;
@@ -625,7 +675,7 @@ static int da9062_i2c_probe(struct i2c_client *i2c)
 {
 	const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
 	struct da9062 *chip;
-	unsigned int irq_base;
+	unsigned int irq_base = 0;
 	const struct mfd_cell *cell;
 	const struct regmap_irq_chip *irq_chip;
 	const struct regmap_config *config;
@@ -645,21 +695,16 @@ static int da9062_i2c_probe(struct i2c_client *i2c)
 	i2c_set_clientdata(i2c, chip);
 	chip->dev = &i2c->dev;
 
-	if (!i2c->irq) {
-		dev_err(chip->dev, "No IRQ configured\n");
-		return -EINVAL;
-	}
-
 	switch (chip->chip_type) {
 	case COMPAT_TYPE_DA9061:
-		cell = da9061_devs;
-		cell_num = ARRAY_SIZE(da9061_devs);
+		cell = i2c->irq ? da9061_devs : da9061_devs_without_irq;
+		cell_num = i2c->irq ? ARRAY_SIZE(da9061_devs) : ARRAY_SIZE(da9061_devs_without_irq);
 		irq_chip = &da9061_irq_chip;
 		config = &da9061_regmap_config;
 		break;
 	case COMPAT_TYPE_DA9062:
-		cell = da9062_devs;
-		cell_num = ARRAY_SIZE(da9062_devs);
+		cell = i2c->irq ? da9062_devs : da9062_devs_without_irq;
+		cell_num = i2c->irq ? ARRAY_SIZE(da9062_devs) : ARRAY_SIZE(da9062_devs_without_irq);
 		irq_chip = &da9062_irq_chip;
 		config = &da9062_regmap_config;
 		break;
@@ -695,29 +740,32 @@ static int da9062_i2c_probe(struct i2c_client *i2c)
 	if (ret)
 		return ret;
 
-	ret = da9062_configure_irq_type(chip, i2c->irq, &trigger_type);
-	if (ret < 0) {
-		dev_err(chip->dev, "Failed to configure IRQ type\n");
-		return ret;
-	}
+	if (i2c->irq) {
+		ret = da9062_configure_irq_type(chip, i2c->irq, &trigger_type);
+		if (ret < 0) {
+			dev_err(chip->dev, "Failed to configure IRQ type\n");
+			return ret;
+		}
 
-	ret = regmap_add_irq_chip(chip->regmap, i2c->irq,
-			trigger_type | IRQF_SHARED | IRQF_ONESHOT,
-			-1, irq_chip, &chip->regmap_irq);
-	if (ret) {
-		dev_err(chip->dev, "Failed to request IRQ %d: %d\n",
-			i2c->irq, ret);
-		return ret;
-	}
+		ret = regmap_add_irq_chip(chip->regmap, i2c->irq,
+				trigger_type | IRQF_SHARED | IRQF_ONESHOT,
+				-1, irq_chip, &chip->regmap_irq);
+		if (ret) {
+			dev_err(chip->dev, "Failed to request IRQ %d: %d\n",
+				i2c->irq, ret);
+			return ret;
+		}
 
-	irq_base = regmap_irq_chip_get_base(chip->regmap_irq);
+		irq_base = regmap_irq_chip_get_base(chip->regmap_irq);
+	}
 
 	ret = mfd_add_devices(chip->dev, PLATFORM_DEVID_NONE, cell,
 			      cell_num, NULL, irq_base,
 			      NULL);
 	if (ret) {
 		dev_err(chip->dev, "Cannot register child devices\n");
-		regmap_del_irq_chip(i2c->irq, chip->regmap_irq);
+		if (i2c->irq)
+			regmap_del_irq_chip(i2c->irq, chip->regmap_irq);
 		return ret;
 	}
 
Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 2/2 regulator: da9062: Make the use of IRQ optional

This patch makes the use of IRQ optional to make the DA9061/62 usable for designs that don't have the IRQ pin connected, because the regulator is usable without IRQ.

---
Cc: Support Opensource <[email protected]>
Cc: Adam Thomson <[email protected]>
Cc: Liam Girdwood <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: [email protected]
Cc: [email protected]
To: [email protected]
---
V2: - Rebase on current next 20230209
- Add Reviewed-by and Acked-by tags

---
 drivers/regulator/da9062-regulator.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/regulator/da9062-regulator.c +3 -4
index 1a6324001027..653e1844dd61 100644
@@ -1012,10 +1012,9 @@ static int da9062_regulator_probe(struct platform_device *pdev)
 	}
 
 	/* LDOs overcurrent event support */
-	irq = platform_get_irq_byname(pdev, "LDO_LIM");
-	if (irq < 0)
-		return irq;
-	regulators->irq_ldo_lim = irq;
+	regulators->irq_ldo_lim = platform_get_irq_byname_optional(pdev, "LDO_LIM");
+	if (regulators->irq_ldo_lim < 0)
+		return 0;
 
 	ret = devm_request_threaded_irq(&pdev->dev, irq,
 					NULL, da9062_ldo_lim_event,
Signature · 1 line
2.11.0
Reviewed-by on v2 1/2
#2 lore raw
In reply to Christoph Niedermaier
Quoted 5 lines · Christoph Niedermaier

This patch removes the requirement for an IRQ, because for the core functionality IRQ isn't needed. So this makes the DA9061/62 chip useable for designs which haven't connected the IRQ pin.

Quoted 13 lines

---
Cc: Support Opensource <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Adam Thomson <[email protected]>
Cc: Liam Girdwood <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: [email protected]
Cc: [email protected]
To: [email protected]
---
V2: - Rebase on current next 20230209
- Add Lee Jones to Cc list

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Reviewed-by Adam Ward on v2 1/2
#3 lore raw
In reply to Christoph Niedermaier
Quoted 5 lines · Christoph Niedermaier

This patch removes the requirement for an IRQ, because for the core functionality IRQ isn't needed. So this makes the DA9061/62 chip useable for designs which haven't connected the IRQ pin.

Quoted 13 lines

---
Cc: Support Opensource <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Adam Thomson <[email protected]>
Cc: Liam Girdwood <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: [email protected]
Cc: [email protected]
To: [email protected]
---
V2: - Rebase on current next 20230209
- Add Lee Jones to Cc list

Thanks!

maintainer
#4 lore raw
In reply to Christoph Niedermaier
Quoted 27 lines · Christoph Niedermaier

This patch removes the requirement for an IRQ, because for the core functionality IRQ isn't needed. So this makes the DA9061/62 chip useable for designs which haven't connected the IRQ pin.

---
Cc: Support Opensource <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Adam Thomson <[email protected]>
Cc: Liam Girdwood <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: [email protected]
Cc: [email protected]
To: [email protected]
---
V2: - Rebase on current next 20230209
- Add Lee Jones to Cc list

---
 drivers/mfd/da9062-core.c | 98 +++++++++++++++++++++++++++++++++++------------
 1 file changed, 73 insertions(+), 25 deletions(-)
drivers/mfd/da9062-core.c +0 -0
index 40cde51e5719..caa597400dd1 100644

drivers/mfd/da9062-core.c static const struct mfd_cell da9061_devs[] = { · line 215

Quoted 4 lines
drivers/mfd/da9062-core.c +1 -0
@@ -212,6 +212,27 @@ static const struct mfd_cell da9061_devs[] = {
 	},
 };
 
+static const struct mfd_cell da9061_devs_without_irq[] = {

"_noirq"

drivers/mfd/da9062-core.c static const struct mfd_cell da9061_devs[] = { · line 221

Quoted 6 lines
drivers/mfd/da9062-core.c +6 -0
+	{
+		.name		= "da9061-core",
+	},
+	{
+		.name		= "da9062-regulators",
+	},

Place the one line entries on one line please.

Even better, use MFD_CELL_NAME()

drivers/mfd/da9062-core.c static const struct mfd_cell da9061_devs[] = { · line 225

Quoted 4 lines
drivers/mfd/da9062-core.c +4 -0
+	{
+		.name		= "da9061-watchdog",
+		.of_compatible  = "dlg,da9061-watchdog",
+	},

MFD_CELL_OF(<name>, NULL, NULL, NULL, 0, <compatible>);

Quoted 35 lines
drivers/mfd/da9062-core.c +28 -0
+	{
+		.name		= "da9061-thermal",
+		.of_compatible  = "dlg,da9061-thermal",
+	},
+	{
+		.name		= "da9061-onkey",
+		.of_compatible = "dlg,da9061-onkey",
+	},
+};
+
 static const struct resource da9062_core_resources[] = {
 	DEFINE_RES_NAMED(DA9062_IRQ_VDD_WARN, 1, "VDD_WARN", IORESOURCE_IRQ),
 };
@@ -288,6 +309,35 @@ static const struct mfd_cell da9062_devs[] = {
 	},
 };
 
+static const struct mfd_cell da9062_devs_without_irq[] = {
+	{
+		.name		= "da9062-core",
+	},
+	{
+		.name		= "da9062-regulators",
+	},
+	{
+		.name		= "da9062-watchdog",
+		.of_compatible  = "dlg,da9062-watchdog",
+	},
+	{
+		.name		= "da9062-thermal",
+		.of_compatible  = "dlg,da9062-thermal",
+	},
+	{
+		.name		= "da9062-rtc",
+		.of_compatible  = "dlg,da9062-rtc",

drivers/mfd/da9062-core.c static const struct mfd_cell da9062_devs[] = { · line 339

Quoted 10 lines
drivers/mfd/da9062-core.c +10 -0
+	},
+	{
+		.name		= "da9062-onkey",
+		.of_compatible	= "dlg,da9062-onkey",
+	},
+	{
+		.name		= "da9062-gpio",
+		.of_compatible	= "dlg,da9062-gpio",
+	},
+};

As above.

Quoted 17 lines
drivers/mfd/da9062-core.c +1 -2
 static int da9062_clear_fault_log(struct da9062 *chip)
 {
 	int ret;
@@ -625,7 +675,7 @@ static int da9062_i2c_probe(struct i2c_client *i2c)
 {
 	const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
 	struct da9062 *chip;
-	unsigned int irq_base;
+	unsigned int irq_base = 0;
 	const struct mfd_cell *cell;
 	const struct regmap_irq_chip *irq_chip;
 	const struct regmap_config *config;
@@ -645,21 +695,16 @@ static int da9062_i2c_probe(struct i2c_client *i2c)
 	i2c_set_clientdata(i2c, chip);
 	chip->dev = &i2c->dev;
 
-	if (!i2c->irq) {

drivers/mfd/da9062-core.c static int da9062_i2c_probe(struct i2c_client *i2c) · line 701

Quoted 10 lines
drivers/mfd/da9062-core.c +2 -6
-		dev_err(chip->dev, "No IRQ configured\n");
-		return -EINVAL;
-	}
-
 	switch (chip->chip_type) {
 	case COMPAT_TYPE_DA9061:
-		cell = da9061_devs;
-		cell_num = ARRAY_SIZE(da9061_devs);
+		cell = i2c->irq ? da9061_devs : da9061_devs_without_irq;
+		cell_num = i2c->irq ? ARRAY_SIZE(da9061_devs) : ARRAY_SIZE(da9061_devs_without_irq);

This is hideous.

Why not just NULLify the resources below instead?

drivers/mfd/da9062-core.c static int da9062_i2c_probe(struct i2c_client *i2c) · line 708

Quoted 9 lines
drivers/mfd/da9062-core.c +2 -2
 		irq_chip = &da9061_irq_chip;
 		config = &da9061_regmap_config;
 		break;
 	case COMPAT_TYPE_DA9062:
-		cell = da9062_devs;
-		cell_num = ARRAY_SIZE(da9062_devs);
+		cell = i2c->irq ? da9062_devs : da9062_devs_without_irq;
+		cell_num = i2c->irq ? ARRAY_SIZE(da9062_devs) : ARRAY_SIZE(da9062_devs_without_irq);
 		irq_chip = &da9062_irq_chip;

Still setting this despite no IRQs?

drivers/mfd/da9062-core.c static int da9062_i2c_probe(struct i2c_client *i2c) · line 710

Quoted 2 lines
drivers/mfd/da9062-core.c +0 -0
 		config = &da9062_regmap_config;
 		break;

__
_||_
\ /
\/

[...]

if (i2c->irq <= 0)
cell->resources = NULL;
cell->num_resources = 0;

Quoted 51 lines
drivers/mfd/da9062-core.c +18 -15
@@ -695,29 +740,32 @@ static int da9062_i2c_probe(struct i2c_client *i2c)
 	if (ret)
 		return ret;
 
-	ret = da9062_configure_irq_type(chip, i2c->irq, &trigger_type);
-	if (ret < 0) {
-		dev_err(chip->dev, "Failed to configure IRQ type\n");
-		return ret;
-	}
+	if (i2c->irq) {
+		ret = da9062_configure_irq_type(chip, i2c->irq, &trigger_type);
+		if (ret < 0) {
+			dev_err(chip->dev, "Failed to configure IRQ type\n");
+			return ret;
+		}
 
-	ret = regmap_add_irq_chip(chip->regmap, i2c->irq,
-			trigger_type | IRQF_SHARED | IRQF_ONESHOT,
-			-1, irq_chip, &chip->regmap_irq);
-	if (ret) {
-		dev_err(chip->dev, "Failed to request IRQ %d: %d\n",
-			i2c->irq, ret);
-		return ret;
-	}
+		ret = regmap_add_irq_chip(chip->regmap, i2c->irq,
+				trigger_type | IRQF_SHARED | IRQF_ONESHOT,
+				-1, irq_chip, &chip->regmap_irq);
+		if (ret) {
+			dev_err(chip->dev, "Failed to request IRQ %d: %d\n",
+				i2c->irq, ret);
+			return ret;
+		}
 
-	irq_base = regmap_irq_chip_get_base(chip->regmap_irq);
+		irq_base = regmap_irq_chip_get_base(chip->regmap_irq);
+	}
 
 	ret = mfd_add_devices(chip->dev, PLATFORM_DEVID_NONE, cell,
 			      cell_num, NULL, irq_base,
 			      NULL);
 	if (ret) {
 		dev_err(chip->dev, "Cannot register child devices\n");
-		regmap_del_irq_chip(i2c->irq, chip->regmap_irq);
+		if (i2c->irq)
+			regmap_del_irq_chip(i2c->irq, chip->regmap_irq);
 		return ret;
 	}
 
Signature · 1 line
2.11.0
Signature · 1 line
Lee Jones [李琼斯]
#5 lore raw

From: Lee Jones [mailto:[email protected]]
Sent: Friday, March 3, 2023 9:42 AM

Quoted 46 lines · Christoph Niedermaier
Quoted 28 lines

This patch removes the requirement for an IRQ, because for the core functionality IRQ isn't needed. So this makes the DA9061/62 chip useable for designs which haven't connected the IRQ pin.

---
Cc: Support Opensource <[email protected]>
Cc: Lee Jones <[email protected]>
Cc: Adam Thomson <[email protected]>
Cc: Liam Girdwood <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: [email protected]
Cc: [email protected]
To: [email protected]
---
V2: - Rebase on current next 20230209
- Add Lee Jones to Cc list

---
 drivers/mfd/da9062-core.c | 98 +++++++++++++++++++++++++++++++++++------------
 1 file changed, 73 insertions(+), 25 deletions(-)
drivers/mfd/da9062-core.c +0 -0
index 40cde51e5719..caa597400dd1 100644

drivers/mfd/da9062-core.c static const struct mfd_cell da9061_devs[] = { · line 215

Quoted 4 lines
drivers/mfd/da9062-core.c +1 -0
@@ -212,6 +212,27 @@ static const struct mfd_cell da9061_devs[] = {
      },
 };
 
+static const struct mfd_cell da9061_devs_without_irq[] = {

"_noirq"

drivers/mfd/da9062-core.c static const struct mfd_cell da9061_devs[] = { · line 221

Quoted 6 lines
drivers/mfd/da9062-core.c +6 -0
+     {
+             .name           = "da9061-core",
+     },
+     {
+             .name           = "da9062-regulators",
+     },

Place the one line entries on one line please.

Quoted 9 lines

Even better, use MFD_CELL_NAME()

drivers/mfd/da9062-core.c static const struct mfd_cell da9061_devs[] = { · line 225

Quoted 4 lines
drivers/mfd/da9062-core.c +4 -0
+     {
+             .name           = "da9061-watchdog",
+             .of_compatible  = "dlg,da9061-watchdog",
+     },

MFD_CELL_OF(<name>, NULL, NULL, NULL, 0, <compatible>);

I will convert all to MFD_CELL_NAME() in version 3.

Quoted 39 lines
Quoted 39 lines
drivers/mfd/da9062-core.c +32 -0
+     {
+             .name           = "da9061-thermal",
+             .of_compatible  = "dlg,da9061-thermal",
+     },
+     {
+             .name           = "da9061-onkey",
+             .of_compatible = "dlg,da9061-onkey",
+     },
+};
+
 static const struct resource da9062_core_resources[] = {
      DEFINE_RES_NAMED(DA9062_IRQ_VDD_WARN, 1, "VDD_WARN", IORESOURCE_IRQ),
 };
@@ -288,6 +309,35 @@ static const struct mfd_cell da9062_devs[] = {
      },
 };
 
+static const struct mfd_cell da9062_devs_without_irq[] = {
+     {
+             .name           = "da9062-core",
+     },
+     {
+             .name           = "da9062-regulators",
+     },
+     {
+             .name           = "da9062-watchdog",
+             .of_compatible  = "dlg,da9062-watchdog",
+     },
+     {
+             .name           = "da9062-thermal",
+             .of_compatible  = "dlg,da9062-thermal",
+     },
+     {
+             .name           = "da9062-rtc",
+             .of_compatible  = "dlg,da9062-rtc",
+     },
+     {
+             .name           = "da9062-onkey",
+             .of_compatible  = "dlg,da9062-onkey",
Quoted 9 lines

drivers/mfd/da9062-core.c static const struct mfd_cell da9062_devs[] = { · line 339

Quoted 6 lines
drivers/mfd/da9062-core.c +6 -0
+     },
+     {
+             .name           = "da9062-gpio",
+             .of_compatible  = "dlg,da9062-gpio",
+     },
+};

As above.

I will convert all to MFD_CELL_NAME() in version 3.

Quoted 42 lines
Quoted 17 lines
drivers/mfd/da9062-core.c +1 -2
 static int da9062_clear_fault_log(struct da9062 *chip)
 {
      int ret;
@@ -625,7 +675,7 @@ static int da9062_i2c_probe(struct i2c_client *i2c)
 {
      const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
      struct da9062 *chip;
-     unsigned int irq_base;
+     unsigned int irq_base = 0;
      const struct mfd_cell *cell;
      const struct regmap_irq_chip *irq_chip;
      const struct regmap_config *config;
@@ -645,21 +695,16 @@ static int da9062_i2c_probe(struct i2c_client *i2c)
      i2c_set_clientdata(i2c, chip);
      chip->dev = &i2c->dev;
 
-     if (!i2c->irq) {

drivers/mfd/da9062-core.c static int da9062_i2c_probe(struct i2c_client *i2c) · line 701

Quoted 10 lines
drivers/mfd/da9062-core.c +2 -6
-             dev_err(chip->dev, "No IRQ configured\n");
-             return -EINVAL;
-     }
-
      switch (chip->chip_type) {
      case COMPAT_TYPE_DA9061:
-             cell = da9061_devs;
-             cell_num = ARRAY_SIZE(da9061_devs);
+             cell = i2c->irq ? da9061_devs : da9061_devs_without_irq;
+             cell_num = i2c->irq ? ARRAY_SIZE(da9061_devs) : ARRAY_SIZE(da9061_devs_without_irq);

This is hideous.

Why not just NULLify the resources below instead?

drivers/mfd/da9062-core.c static int da9062_i2c_probe(struct i2c_client *i2c) · line 708

Quoted 9 lines
drivers/mfd/da9062-core.c +2 -2
              irq_chip = &da9061_irq_chip;
              config = &da9061_regmap_config;
              break;
      case COMPAT_TYPE_DA9062:
-             cell = da9062_devs;
-             cell_num = ARRAY_SIZE(da9062_devs);
+             cell = i2c->irq ? da9062_devs : da9062_devs_without_irq;
+             cell_num = i2c->irq ? ARRAY_SIZE(da9062_devs) : ARRAY_SIZE(da9062_devs_without_irq);
              irq_chip = &da9062_irq_chip;
Quoted 1 line

Still setting this despite no IRQs?

I will take it into account in version 3.

Quoted 8 lines

drivers/mfd/da9062-core.c static int da9062_i2c_probe(struct i2c_client *i2c) · line 710

Quoted 3 lines
drivers/mfd/da9062-core.c +0 -0
              config = &da9062_regmap_config;
              break;

__
_||_
\ /
\/

Quoted 5 lines

[...]

if (i2c->irq <= 0)
cell->resources = NULL;
cell->num_resources = 0;

But it is an array. I then have to go through it completely and check if it is related to IRQ. I will try to refactor the my code to be less hideous and send a version 3.

Quoted 38 lines
Quoted 38 lines
drivers/mfd/da9062-core.c +16 -14
@@ -695,29 +740,32 @@ static int da9062_i2c_probe(struct i2c_client *i2c)
      if (ret)
              return ret;
 
-     ret = da9062_configure_irq_type(chip, i2c->irq, &trigger_type);
-     if (ret < 0) {
-             dev_err(chip->dev, "Failed to configure IRQ type\n");
-             return ret;
-     }
+     if (i2c->irq) {
+             ret = da9062_configure_irq_type(chip, i2c->irq, &trigger_type);
+             if (ret < 0) {
+                     dev_err(chip->dev, "Failed to configure IRQ type\n");
+                     return ret;
+             }
 
-     ret = regmap_add_irq_chip(chip->regmap, i2c->irq,
-                     trigger_type | IRQF_SHARED | IRQF_ONESHOT,
-                     -1, irq_chip, &chip->regmap_irq);
-     if (ret) {
-             dev_err(chip->dev, "Failed to request IRQ %d: %d\n",
-                     i2c->irq, ret);
-             return ret;
-     }
+             ret = regmap_add_irq_chip(chip->regmap, i2c->irq,
+                             trigger_type | IRQF_SHARED | IRQF_ONESHOT,
+                             -1, irq_chip, &chip->regmap_irq);
+             if (ret) {
+                     dev_err(chip->dev, "Failed to request IRQ %d: %d\n",
+                             i2c->irq, ret);
+                     return ret;
+             }
 
-     irq_base = regmap_irq_chip_get_base(chip->regmap_irq);
+             irq_base = regmap_irq_chip_get_base(chip->regmap_irq);
+     }
 
Quoted 11 lines

drivers/mfd/da9062-core.c static int da9062_i2c_probe(struct i2c_client *i2c) · line 771

Quoted 11 lines
drivers/mfd/da9062-core.c +2 -1
      ret = mfd_add_devices(chip->dev, PLATFORM_DEVID_NONE, cell,
                            cell_num, NULL, irq_base,
                            NULL);
      if (ret) {
              dev_err(chip->dev, "Cannot register child devices\n");
-             regmap_del_irq_chip(i2c->irq, chip->regmap_irq);
+             if (i2c->irq)
+                     regmap_del_irq_chip(i2c->irq, chip->regmap_irq);
              return ret;
      }
 

Regards
Christoph
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel