public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frieder Schrempf <frieder@fris.de>
To: Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org, Mark Brown <broonie@kernel.org>
Cc: Frieder Schrempf <frieder.schrempf@kontron.de>,
	Bo Liu <liubo03@inspur.com>, Joy Zou <joy.zou@nxp.com>,
	Rob Herring <robh@kernel.org>
Subject: [PATCH 6/7] regulator: pca9450: Make IRQ optional
Date: Tue,  2 Jul 2024 12:31:18 +0200	[thread overview]
Message-ID: <20240702103155.321855-7-frieder@fris.de> (raw)
In-Reply-To: <20240702103155.321855-1-frieder@fris.de>

From: Frieder Schrempf <frieder.schrempf@kontron.de>

The IRQ line might not be connected on some boards. Allow the driver
to be probed without it.

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
---
 drivers/regulator/pca9450-regulator.c | 41 +++++++++++++--------------
 1 file changed, 19 insertions(+), 22 deletions(-)

diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c
index be488c5dff140..9714afe347dcc 100644
--- a/drivers/regulator/pca9450-regulator.c
+++ b/drivers/regulator/pca9450-regulator.c
@@ -891,11 +891,6 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
 	unsigned int reset_ctrl;
 	int ret;
 
-	if (!i2c->irq) {
-		dev_err(&i2c->dev, "No IRQ configured?\n");
-		return -EINVAL;
-	}
-
 	pca9450 = devm_kzalloc(&i2c->dev, sizeof(struct pca9450), GFP_KERNEL);
 	if (!pca9450)
 		return -ENOMEM;
@@ -967,23 +962,25 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
 		}
 	}
 
-	ret = devm_request_threaded_irq(pca9450->dev, pca9450->irq, NULL,
-					pca9450_irq_handler,
-					(IRQF_TRIGGER_FALLING | IRQF_ONESHOT),
-					"pca9450-irq", pca9450);
-	if (ret != 0) {
-		dev_err(pca9450->dev, "Failed to request IRQ: %d\n",
-			pca9450->irq);
-		return ret;
-	}
-	/* Unmask all interrupt except PWRON/WDOG/RSVD */
-	ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_INT1_MSK,
-				IRQ_VR_FLT1 | IRQ_VR_FLT2 | IRQ_LOWVSYS |
-				IRQ_THERM_105 | IRQ_THERM_125,
-				IRQ_PWRON | IRQ_WDOGB | IRQ_RSVD);
-	if (ret) {
-		dev_err(&i2c->dev, "Unmask irq error\n");
-		return ret;
+	if (pca9450->irq) {
+		ret = devm_request_threaded_irq(pca9450->dev, pca9450->irq, NULL,
+						pca9450_irq_handler,
+						(IRQF_TRIGGER_FALLING | IRQF_ONESHOT),
+						"pca9450-irq", pca9450);
+		if (ret != 0) {
+			dev_err(pca9450->dev, "Failed to request IRQ: %d\n",
+				pca9450->irq);
+			return ret;
+		}
+		/* Unmask all interrupt except PWRON/WDOG/RSVD */
+		ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_INT1_MSK,
+					IRQ_VR_FLT1 | IRQ_VR_FLT2 | IRQ_LOWVSYS |
+					IRQ_THERM_105 | IRQ_THERM_125,
+					IRQ_PWRON | IRQ_WDOGB | IRQ_RSVD);
+		if (ret) {
+			dev_err(&i2c->dev, "Unmask irq error\n");
+			return ret;
+		}
 	}
 
 	/* Clear PRESET_EN bit in BUCK123_DVS to use DVS registers */
-- 
2.45.2


  parent reply	other threads:[~2024-07-02 10:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-02 10:31 [PATCH 0/7] Add support for Kontron OSM-S i.MX93 SoM and carrier board Frieder Schrempf
2024-07-02 10:31 ` [PATCH 1/7] dt-bindings: eeprom: at24: Move compatible for Belling BL24C16A to proper place Frieder Schrempf
2024-07-02 14:20   ` Krzysztof Kozlowski
2024-07-02 10:31 ` [PATCH 2/7] dt-bindings: eeprom: at24: Add compatible for ONSemi N24S64B Frieder Schrempf
2024-07-02 14:22   ` Krzysztof Kozlowski
2024-07-02 10:31 ` [PATCH 3/7] dt-bindings: gpio: vf610: Allow gpio-line-names to be set Frieder Schrempf
2024-07-02 14:23   ` Krzysztof Kozlowski
2024-07-03  7:43     ` Frieder Schrempf
2024-07-02 10:31 ` [PATCH 4/7] dt-bindings: regulator: pca9450: Make interrupt optional Frieder Schrempf
2024-07-02 14:24   ` Krzysztof Kozlowski
2024-07-03  7:44     ` Frieder Schrempf
2024-07-02 10:31 ` [PATCH 5/7] dt-bindings: arm: fsl: Add Kontron i.MX93 OSM-S based boards Frieder Schrempf
2024-07-02 14:25   ` Krzysztof Kozlowski
2024-07-02 10:31 ` Frieder Schrempf [this message]
2024-07-02 10:31 ` [PATCH 7/7] arm64: dts: Add support for Kontron i.MX93 OSM-S SoM and BL carrier board Frieder Schrempf
2024-07-02 10:36   ` Frieder Schrempf
2024-07-03  9:59 ` [PATCH 0/7] Add support for Kontron OSM-S i.MX93 SoM and " Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240702103155.321855-7-frieder@fris.de \
    --to=frieder@fris.de \
    --cc=broonie@kernel.org \
    --cc=frieder.schrempf@kontron.de \
    --cc=joy.zou@nxp.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liubo03@inspur.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox