Skip to content

Commit 83808c5

Browse files
fschrempfbroonie
authored andcommitted
regulator: pca9450: Make IRQ optional
The IRQ line might not be connected on some boards. Allow the driver to be probed without it. Signed-off-by: Frieder Schrempf <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 6070471 commit 83808c5

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

drivers/regulator/pca9450-regulator.c

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -891,11 +891,6 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
891891
unsigned int reset_ctrl;
892892
int ret;
893893

894-
if (!i2c->irq) {
895-
dev_err(&i2c->dev, "No IRQ configured?\n");
896-
return -EINVAL;
897-
}
898-
899894
pca9450 = devm_kzalloc(&i2c->dev, sizeof(struct pca9450), GFP_KERNEL);
900895
if (!pca9450)
901896
return -ENOMEM;
@@ -967,23 +962,25 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
967962
}
968963
}
969964

970-
ret = devm_request_threaded_irq(pca9450->dev, pca9450->irq, NULL,
971-
pca9450_irq_handler,
972-
(IRQF_TRIGGER_FALLING | IRQF_ONESHOT),
973-
"pca9450-irq", pca9450);
974-
if (ret != 0) {
975-
dev_err(pca9450->dev, "Failed to request IRQ: %d\n",
976-
pca9450->irq);
977-
return ret;
978-
}
979-
/* Unmask all interrupt except PWRON/WDOG/RSVD */
980-
ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_INT1_MSK,
981-
IRQ_VR_FLT1 | IRQ_VR_FLT2 | IRQ_LOWVSYS |
982-
IRQ_THERM_105 | IRQ_THERM_125,
983-
IRQ_PWRON | IRQ_WDOGB | IRQ_RSVD);
984-
if (ret) {
985-
dev_err(&i2c->dev, "Unmask irq error\n");
986-
return ret;
965+
if (pca9450->irq) {
966+
ret = devm_request_threaded_irq(pca9450->dev, pca9450->irq, NULL,
967+
pca9450_irq_handler,
968+
(IRQF_TRIGGER_FALLING | IRQF_ONESHOT),
969+
"pca9450-irq", pca9450);
970+
if (ret != 0) {
971+
dev_err(pca9450->dev, "Failed to request IRQ: %d\n",
972+
pca9450->irq);
973+
return ret;
974+
}
975+
/* Unmask all interrupt except PWRON/WDOG/RSVD */
976+
ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_INT1_MSK,
977+
IRQ_VR_FLT1 | IRQ_VR_FLT2 | IRQ_LOWVSYS |
978+
IRQ_THERM_105 | IRQ_THERM_125,
979+
IRQ_PWRON | IRQ_WDOGB | IRQ_RSVD);
980+
if (ret) {
981+
dev_err(&i2c->dev, "Unmask irq error\n");
982+
return ret;
983+
}
987984
}
988985

989986
/* Clear PRESET_EN bit in BUCK123_DVS to use DVS registers */

0 commit comments

Comments
 (0)