* [PATCH 0/3] mfd: da9062: Make the use of IRQ optional @ 2022-11-22 9:58 ` Christoph Niedermaier 0 siblings, 0 replies; 16+ messages in thread From: Christoph Niedermaier @ 2022-11-22 9:58 UTC (permalink / raw) To: linux-arm-kernel Cc: Christoph Niedermaier, Support Opensource, Adam Thomson, Liam Girdwood, Mark Brown, Marek Vasut, kernel, linux-kernel For the core functionality of the MFD DA9061/62 IRQ isn't needed. This series removes the requirement for an IRQ. This is done by modifing the MFD driver and regulator driver to setup the device without IRQ. This makes the DA9061/62 chip useable for designs which haven't connected the IRQ pin. I tested it with a DHCOM i.MX6ULL, which is powered by a DA9061. In this series, the DT binding file is also adapted. Christoph Niedermaier (3): dt-bindings: mfd: da9062: Move IRQ to optional properties mfd: da9062: Remove IRQ requirement regulator: da9062: Make the use of IRQ optional --- Cc: Support Opensource <support.opensource@diasemi.com> Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Marek Vasut <marex@denx.de> Cc: kernel@dh-electronics.com Cc: linux-kernel@vger.kernel.org To: linux-arm-kernel@lists.infradead.org --- Documentation/devicetree/bindings/mfd/da9062.txt | 11 +-- drivers/mfd/da9062-core.c | 98 ++++++++++++++++++------ drivers/regulator/da9062-regulator.c | 7 +- 3 files changed, 82 insertions(+), 34 deletions(-) -- 2.11.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 0/3] mfd: da9062: Make the use of IRQ optional @ 2022-11-22 9:58 ` Christoph Niedermaier 0 siblings, 0 replies; 16+ messages in thread From: Christoph Niedermaier @ 2022-11-22 9:58 UTC (permalink / raw) To: linux-arm-kernel Cc: Christoph Niedermaier, Support Opensource, Adam Thomson, Liam Girdwood, Mark Brown, Marek Vasut, kernel, linux-kernel For the core functionality of the MFD DA9061/62 IRQ isn't needed. This series removes the requirement for an IRQ. This is done by modifing the MFD driver and regulator driver to setup the device without IRQ. This makes the DA9061/62 chip useable for designs which haven't connected the IRQ pin. I tested it with a DHCOM i.MX6ULL, which is powered by a DA9061. In this series, the DT binding file is also adapted. Christoph Niedermaier (3): dt-bindings: mfd: da9062: Move IRQ to optional properties mfd: da9062: Remove IRQ requirement regulator: da9062: Make the use of IRQ optional --- Cc: Support Opensource <support.opensource@diasemi.com> Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Marek Vasut <marex@denx.de> Cc: kernel@dh-electronics.com Cc: linux-kernel@vger.kernel.org To: linux-arm-kernel@lists.infradead.org --- Documentation/devicetree/bindings/mfd/da9062.txt | 11 +-- drivers/mfd/da9062-core.c | 98 ++++++++++++++++++------ drivers/regulator/da9062-regulator.c | 7 +- 3 files changed, 82 insertions(+), 34 deletions(-) -- 2.11.0 ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/3] dt-bindings: mfd: da9062: Move IRQ to optional properties 2022-11-22 9:58 ` Christoph Niedermaier @ 2022-11-22 9:58 ` Christoph Niedermaier -1 siblings, 0 replies; 16+ messages in thread From: Christoph Niedermaier @ 2022-11-22 9:58 UTC (permalink / raw) To: linux-arm-kernel Cc: Christoph Niedermaier, Support Opensource, Adam Thomson, Lee Jones, Rob Herring, Krzysztof Kozlowski, Marek Vasut, kernel, devicetree Move IRQ to optional properties, because the MFD DA9061/62 is usable without IRQ. This makes the chip usable for designs that don't have the IRQ pin connected. Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> --- Cc: Support Opensource <support.opensource@diasemi.com> Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Cc: Lee Jones <lee@kernel.org> Cc: Rob Herring <robh+dt@kernel.org> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org> Cc: Marek Vasut <marex@denx.de> Cc: kernel@dh-electronics.com Cc: devicetree@vger.kernel.org To: linux-kernel@vger.kernel.org --- Documentation/devicetree/bindings/mfd/da9062.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/da9062.txt b/Documentation/devicetree/bindings/mfd/da9062.txt index bab0d0e66cb3..fe580206e18d 100644 --- a/Documentation/devicetree/bindings/mfd/da9062.txt +++ b/Documentation/devicetree/bindings/mfd/da9062.txt @@ -33,11 +33,6 @@ Required properties: "dlg,da9061" for DA9061 - reg : Specifies the I2C slave address (this defaults to 0x58 but it can be modified to match the chip's OTP settings). -- interrupts : IRQ line information. -- interrupt-controller - -See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt for -further information on IRQ bindings. Optional properties: @@ -48,6 +43,12 @@ Optional properties: See Documentation/devicetree/bindings/gpio/gpio.txt for further information on GPIO bindings. +- interrupts : IRQ line information. +- interrupt-controller + +See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt for +further information on IRQ bindings. + Sub-nodes: - regulators : This node defines the settings for the LDOs and BUCKs. -- 2.11.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 1/3] dt-bindings: mfd: da9062: Move IRQ to optional properties @ 2022-11-22 9:58 ` Christoph Niedermaier 0 siblings, 0 replies; 16+ messages in thread From: Christoph Niedermaier @ 2022-11-22 9:58 UTC (permalink / raw) To: linux-arm-kernel Cc: Christoph Niedermaier, Support Opensource, Adam Thomson, Lee Jones, Rob Herring, Krzysztof Kozlowski, Marek Vasut, kernel, devicetree Move IRQ to optional properties, because the MFD DA9061/62 is usable without IRQ. This makes the chip usable for designs that don't have the IRQ pin connected. Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> --- Cc: Support Opensource <support.opensource@diasemi.com> Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Cc: Lee Jones <lee@kernel.org> Cc: Rob Herring <robh+dt@kernel.org> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org> Cc: Marek Vasut <marex@denx.de> Cc: kernel@dh-electronics.com Cc: devicetree@vger.kernel.org To: linux-kernel@vger.kernel.org --- Documentation/devicetree/bindings/mfd/da9062.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/da9062.txt b/Documentation/devicetree/bindings/mfd/da9062.txt index bab0d0e66cb3..fe580206e18d 100644 --- a/Documentation/devicetree/bindings/mfd/da9062.txt +++ b/Documentation/devicetree/bindings/mfd/da9062.txt @@ -33,11 +33,6 @@ Required properties: "dlg,da9061" for DA9061 - reg : Specifies the I2C slave address (this defaults to 0x58 but it can be modified to match the chip's OTP settings). -- interrupts : IRQ line information. -- interrupt-controller - -See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt for -further information on IRQ bindings. Optional properties: @@ -48,6 +43,12 @@ Optional properties: See Documentation/devicetree/bindings/gpio/gpio.txt for further information on GPIO bindings. +- interrupts : IRQ line information. +- interrupt-controller + +See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt for +further information on IRQ bindings. + Sub-nodes: - regulators : This node defines the settings for the LDOs and BUCKs. -- 2.11.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] dt-bindings: mfd: da9062: Move IRQ to optional properties 2022-11-22 9:58 ` Christoph Niedermaier @ 2022-11-22 10:18 ` Krzysztof Kozlowski -1 siblings, 0 replies; 16+ messages in thread From: Krzysztof Kozlowski @ 2022-11-22 10:18 UTC (permalink / raw) To: Christoph Niedermaier, linux-arm-kernel Cc: Support Opensource, Adam Thomson, Lee Jones, Rob Herring, Krzysztof Kozlowski, Marek Vasut, kernel, devicetree On 22/11/2022 10:58, Christoph Niedermaier wrote: > Move IRQ to optional properties, because the MFD DA9061/62 > is usable without IRQ. This makes the chip usable for designs > that don't have the IRQ pin connected. > > Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> > --- > Cc: Support Opensource <support.opensource@diasemi.com> > Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> > Cc: Lee Jones <lee@kernel.org> > Cc: Rob Herring <robh+dt@kernel.org> > Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org> > Cc: Marek Vasut <marex@denx.de> > Cc: kernel@dh-electronics.com > Cc: devicetree@vger.kernel.org > To: linux-kernel@vger.kernel.org > --- > Documentation/devicetree/bindings/mfd/da9062.txt | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] dt-bindings: mfd: da9062: Move IRQ to optional properties @ 2022-11-22 10:18 ` Krzysztof Kozlowski 0 siblings, 0 replies; 16+ messages in thread From: Krzysztof Kozlowski @ 2022-11-22 10:18 UTC (permalink / raw) To: Christoph Niedermaier, linux-arm-kernel Cc: Support Opensource, Adam Thomson, Lee Jones, Rob Herring, Krzysztof Kozlowski, Marek Vasut, kernel, devicetree On 22/11/2022 10:58, Christoph Niedermaier wrote: > Move IRQ to optional properties, because the MFD DA9061/62 > is usable without IRQ. This makes the chip usable for designs > that don't have the IRQ pin connected. > > Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> > --- > Cc: Support Opensource <support.opensource@diasemi.com> > Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> > Cc: Lee Jones <lee@kernel.org> > Cc: Rob Herring <robh+dt@kernel.org> > Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org> > Cc: Marek Vasut <marex@denx.de> > Cc: kernel@dh-electronics.com > Cc: devicetree@vger.kernel.org > To: linux-kernel@vger.kernel.org > --- > Documentation/devicetree/bindings/mfd/da9062.txt | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] dt-bindings: mfd: da9062: Move IRQ to optional properties 2022-11-22 9:58 ` Christoph Niedermaier @ 2022-12-08 13:14 ` Lee Jones -1 siblings, 0 replies; 16+ messages in thread From: Lee Jones @ 2022-12-08 13:14 UTC (permalink / raw) To: Christoph Niedermaier Cc: linux-arm-kernel, Support Opensource, Adam Thomson, Rob Herring, Krzysztof Kozlowski, Marek Vasut, kernel, devicetree On Tue, 22 Nov 2022, Christoph Niedermaier wrote: > Move IRQ to optional properties, because the MFD DA9061/62 > is usable without IRQ. This makes the chip usable for designs > that don't have the IRQ pin connected. > > Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> > --- > Cc: Support Opensource <support.opensource@diasemi.com> > Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> > Cc: Lee Jones <lee@kernel.org> > Cc: Rob Herring <robh+dt@kernel.org> > Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org> > Cc: Marek Vasut <marex@denx.de> > Cc: kernel@dh-electronics.com > Cc: devicetree@vger.kernel.org > To: linux-kernel@vger.kernel.org > --- > Documentation/devicetree/bindings/mfd/da9062.txt | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) Applied, thanks. -- Lee Jones [李琼斯] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] dt-bindings: mfd: da9062: Move IRQ to optional properties @ 2022-12-08 13:14 ` Lee Jones 0 siblings, 0 replies; 16+ messages in thread From: Lee Jones @ 2022-12-08 13:14 UTC (permalink / raw) To: Christoph Niedermaier Cc: linux-arm-kernel, Support Opensource, Adam Thomson, Rob Herring, Krzysztof Kozlowski, Marek Vasut, kernel, devicetree On Tue, 22 Nov 2022, Christoph Niedermaier wrote: > Move IRQ to optional properties, because the MFD DA9061/62 > is usable without IRQ. This makes the chip usable for designs > that don't have the IRQ pin connected. > > Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> > --- > Cc: Support Opensource <support.opensource@diasemi.com> > Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> > Cc: Lee Jones <lee@kernel.org> > Cc: Rob Herring <robh+dt@kernel.org> > Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org> > Cc: Marek Vasut <marex@denx.de> > Cc: kernel@dh-electronics.com > Cc: devicetree@vger.kernel.org > To: linux-kernel@vger.kernel.org > --- > Documentation/devicetree/bindings/mfd/da9062.txt | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) Applied, thanks. -- Lee Jones [李琼斯] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 2/3] mfd: da9062: Remove IRQ requirement 2022-11-22 9:58 ` Christoph Niedermaier @ 2022-11-22 9:58 ` Christoph Niedermaier -1 siblings, 0 replies; 16+ messages in thread From: Christoph Niedermaier @ 2022-11-22 9:58 UTC (permalink / raw) To: linux-arm-kernel Cc: Christoph Niedermaier, Support Opensource, Adam Thomson, Liam Girdwood, Mark Brown, Marek Vasut, kernel, linux-kernel 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. Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> --- Cc: Support Opensource <support.opensource@diasemi.com> Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Marek Vasut <marex@denx.de> Cc: kernel@dh-electronics.com Cc: linux-kernel@vger.kernel.org To: linux-arm-kernel@lists.infradead.org --- drivers/mfd/da9062-core.c | 98 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 73 insertions(+), 25 deletions(-) diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c index a26e473507c7..9255f86a527c 100644 --- a/drivers/mfd/da9062-core.c +++ b/drivers/mfd/da9062-core.c @@ -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) { 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; } -- 2.11.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/3] mfd: da9062: Remove IRQ requirement @ 2022-11-22 9:58 ` Christoph Niedermaier 0 siblings, 0 replies; 16+ messages in thread From: Christoph Niedermaier @ 2022-11-22 9:58 UTC (permalink / raw) To: linux-arm-kernel Cc: Christoph Niedermaier, Support Opensource, Adam Thomson, Liam Girdwood, Mark Brown, Marek Vasut, kernel, linux-kernel 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. Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> --- Cc: Support Opensource <support.opensource@diasemi.com> Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Marek Vasut <marex@denx.de> Cc: kernel@dh-electronics.com Cc: linux-kernel@vger.kernel.org To: linux-arm-kernel@lists.infradead.org --- drivers/mfd/da9062-core.c | 98 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 73 insertions(+), 25 deletions(-) diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c index a26e473507c7..9255f86a527c 100644 --- a/drivers/mfd/da9062-core.c +++ b/drivers/mfd/da9062-core.c @@ -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) { 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; } -- 2.11.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/3] regulator: da9062: Make the use of IRQ optional 2022-11-22 9:58 ` Christoph Niedermaier @ 2022-11-22 9:58 ` Christoph Niedermaier -1 siblings, 0 replies; 16+ messages in thread From: Christoph Niedermaier @ 2022-11-22 9:58 UTC (permalink / raw) To: linux-arm-kernel Cc: Christoph Niedermaier, Support Opensource, Adam Thomson, Liam Girdwood, Mark Brown, Marek Vasut, kernel, linux-kernel 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. Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> --- Cc: Support Opensource <support.opensource@diasemi.com> Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Marek Vasut <marex@denx.de> Cc: kernel@dh-electronics.com Cc: linux-kernel@vger.kernel.org To: linux-arm-kernel@lists.infradead.org --- drivers/regulator/da9062-regulator.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062-regulator.c index 1a6324001027..653e1844dd61 100644 --- a/drivers/regulator/da9062-regulator.c +++ b/drivers/regulator/da9062-regulator.c @@ -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, -- 2.11.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/3] regulator: da9062: Make the use of IRQ optional @ 2022-11-22 9:58 ` Christoph Niedermaier 0 siblings, 0 replies; 16+ messages in thread From: Christoph Niedermaier @ 2022-11-22 9:58 UTC (permalink / raw) To: linux-arm-kernel Cc: Christoph Niedermaier, Support Opensource, Adam Thomson, Liam Girdwood, Mark Brown, Marek Vasut, kernel, linux-kernel 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. Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> --- Cc: Support Opensource <support.opensource@diasemi.com> Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Marek Vasut <marex@denx.de> Cc: kernel@dh-electronics.com Cc: linux-kernel@vger.kernel.org To: linux-arm-kernel@lists.infradead.org --- drivers/regulator/da9062-regulator.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062-regulator.c index 1a6324001027..653e1844dd61 100644 --- a/drivers/regulator/da9062-regulator.c +++ b/drivers/regulator/da9062-regulator.c @@ -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, -- 2.11.0 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] regulator: da9062: Make the use of IRQ optional 2022-11-22 9:58 ` Christoph Niedermaier @ 2022-11-22 12:10 ` Mark Brown -1 siblings, 0 replies; 16+ messages in thread From: Mark Brown @ 2022-11-22 12:10 UTC (permalink / raw) To: Christoph Niedermaier Cc: linux-arm-kernel, Support Opensource, Adam Thomson, Liam Girdwood, Marek Vasut, kernel, linux-kernel [-- Attachment #1: Type: text/plain, Size: 286 bytes --] On Tue, Nov 22, 2022 at 10:58:33AM +0100, Christoph Niedermaier wrote: > 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. Acked-by: Mark Brown <broonie@kernel.org> [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] regulator: da9062: Make the use of IRQ optional @ 2022-11-22 12:10 ` Mark Brown 0 siblings, 0 replies; 16+ messages in thread From: Mark Brown @ 2022-11-22 12:10 UTC (permalink / raw) To: Christoph Niedermaier Cc: linux-arm-kernel, Support Opensource, Adam Thomson, Liam Girdwood, Marek Vasut, kernel, linux-kernel [-- Attachment #1.1: Type: text/plain, Size: 286 bytes --] On Tue, Nov 22, 2022 at 10:58:33AM +0100, Christoph Niedermaier wrote: > 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. Acked-by: Mark Brown <broonie@kernel.org> [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] [-- Attachment #2: Type: text/plain, Size: 176 bytes --] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH 3/3] regulator: da9062: Make the use of IRQ optional 2022-11-22 9:58 ` Christoph Niedermaier @ 2022-11-23 11:09 ` DLG Adam Ward -1 siblings, 0 replies; 16+ messages in thread From: DLG Adam Ward @ 2022-11-23 11:09 UTC (permalink / raw) To: Christoph Niedermaier, linux-arm-kernel Cc: Support Opensource, Liam Girdwood, Mark Brown, Marek Vasut, kernel, linux-kernel On Tue, Nov 22, 2022 at 10:58:33AM +0100, Christoph Niedermaier wrote: > 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. Reviewed-by: Adam Ward <DLG-Adam.Ward.opensource@dm.renesas.com> Thanks, Adam _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH 3/3] regulator: da9062: Make the use of IRQ optional @ 2022-11-23 11:09 ` DLG Adam Ward 0 siblings, 0 replies; 16+ messages in thread From: DLG Adam Ward @ 2022-11-23 11:09 UTC (permalink / raw) To: Christoph Niedermaier, linux-arm-kernel Cc: Support Opensource, Liam Girdwood, Mark Brown, Marek Vasut, kernel, linux-kernel On Tue, Nov 22, 2022 at 10:58:33AM +0100, Christoph Niedermaier wrote: > 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. Reviewed-by: Adam Ward <DLG-Adam.Ward.opensource@dm.renesas.com> Thanks, Adam ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2022-12-08 13:15 UTC | newest] Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-11-22 9:58 [PATCH 0/3] mfd: da9062: Make the use of IRQ optional Christoph Niedermaier 2022-11-22 9:58 ` Christoph Niedermaier 2022-11-22 9:58 ` [PATCH 1/3] dt-bindings: mfd: da9062: Move IRQ to optional properties Christoph Niedermaier 2022-11-22 9:58 ` Christoph Niedermaier 2022-11-22 10:18 ` Krzysztof Kozlowski 2022-11-22 10:18 ` Krzysztof Kozlowski 2022-12-08 13:14 ` Lee Jones 2022-12-08 13:14 ` Lee Jones 2022-11-22 9:58 ` [PATCH 2/3] mfd: da9062: Remove IRQ requirement Christoph Niedermaier 2022-11-22 9:58 ` Christoph Niedermaier 2022-11-22 9:58 ` [PATCH 3/3] regulator: da9062: Make the use of IRQ optional Christoph Niedermaier 2022-11-22 9:58 ` Christoph Niedermaier 2022-11-22 12:10 ` Mark Brown 2022-11-22 12:10 ` Mark Brown 2022-11-23 11:09 ` DLG Adam Ward 2022-11-23 11:09 ` DLG Adam Ward
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.