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 <frieder.schrempf@kontron.de>
Link: https://patch.msgid.link/20240708084107.38986-5-frieder@fris.de
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Frieder Schrempf 2024-07-08 10:40:34 +02:00 committed by Mark Brown
parent 6070471088
commit 83808c5406
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -891,11 +891,6 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
unsigned int reset_ctrl; unsigned int reset_ctrl;
int ret; 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); pca9450 = devm_kzalloc(&i2c->dev, sizeof(struct pca9450), GFP_KERNEL);
if (!pca9450) if (!pca9450)
return -ENOMEM; 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, if (pca9450->irq) {
pca9450_irq_handler, ret = devm_request_threaded_irq(pca9450->dev, pca9450->irq, NULL,
(IRQF_TRIGGER_FALLING | IRQF_ONESHOT), pca9450_irq_handler,
"pca9450-irq", pca9450); (IRQF_TRIGGER_FALLING | IRQF_ONESHOT),
if (ret != 0) { "pca9450-irq", pca9450);
dev_err(pca9450->dev, "Failed to request IRQ: %d\n", if (ret != 0) {
pca9450->irq); dev_err(pca9450->dev, "Failed to request IRQ: %d\n",
return ret; pca9450->irq);
} return ret;
/* Unmask all interrupt except PWRON/WDOG/RSVD */ }
ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_INT1_MSK, /* Unmask all interrupt except PWRON/WDOG/RSVD */
IRQ_VR_FLT1 | IRQ_VR_FLT2 | IRQ_LOWVSYS | ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_INT1_MSK,
IRQ_THERM_105 | IRQ_THERM_125, IRQ_VR_FLT1 | IRQ_VR_FLT2 | IRQ_LOWVSYS |
IRQ_PWRON | IRQ_WDOGB | IRQ_RSVD); IRQ_THERM_105 | IRQ_THERM_125,
if (ret) { IRQ_PWRON | IRQ_WDOGB | IRQ_RSVD);
dev_err(&i2c->dev, "Unmask irq error\n"); if (ret) {
return ret; dev_err(&i2c->dev, "Unmask irq error\n");
return ret;
}
} }
/* Clear PRESET_EN bit in BUCK123_DVS to use DVS registers */ /* Clear PRESET_EN bit in BUCK123_DVS to use DVS registers */