Skip to content
Snippets Groups Projects
Commit 1dc6f8f4 authored by Oleksii Kutuzov's avatar Oleksii Kutuzov
Browse files

[DRIVER][MFD] bd718x7: Add support for no-interrupt property

On some SECO modules the interrupt of the bd718x7 is not connected to
anything, but the PMIC functionality is needed anyway. For such
modules it would be helpfull if the probe function succeeds without an
interrupt configured.

Ported from seco-ne/kernel/linux-imx-kuk!442 (f1e987f5)
parent dcf91754
No related merge requests found
......@@ -137,10 +137,16 @@ static int bd718xx_i2c_probe(struct i2c_client *i2c,
unsigned int chip_type;
struct mfd_cell *mfd;
int cells;
bool no_interrupt = false;
if (!i2c->irq) {
// Read the "no-interrupt" property from the device tree
no_interrupt = of_property_read_bool(i2c->dev.of_node, "seco,no-interrupt");
if (!i2c->irq && !no_interrupt) {
dev_err(&i2c->dev, "No IRQ configured\n");
return -EINVAL;
} else if (no_interrupt) {
dev_info(&i2c->dev, "No IRQ configured, but no-interrupt property is set\n");
}
bd718xx = devm_kzalloc(&i2c->dev, sizeof(struct bd718xx), GFP_KERNEL);
......@@ -174,30 +180,34 @@ static int bd718xx_i2c_probe(struct i2c_client *i2c,
return PTR_ERR(bd718xx->chip.regmap);
}
ret = devm_regmap_add_irq_chip(&i2c->dev, bd718xx->chip.regmap,
bd718xx->chip_irq, IRQF_ONESHOT, 0,
&bd718xx_irq_chip, &bd718xx->irq_data);
if (ret) {
dev_err(&i2c->dev, "Failed to add irq_chip\n");
return ret;
if (!no_interrupt) {
ret = devm_regmap_add_irq_chip(&i2c->dev, bd718xx->chip.regmap,
bd718xx->chip_irq, IRQF_ONESHOT, 0,
&bd718xx_irq_chip, &bd718xx->irq_data);
if (ret) {
dev_err(&i2c->dev, "Failed to add irq_chip\n");
return ret;
}
}
ret = bd718xx_init_press_duration(bd718xx);
if (ret)
return ret;
ret = regmap_irq_get_virq(bd718xx->irq_data, BD718XX_INT_PWRBTN_S);
if (!no_interrupt) {
ret = regmap_irq_get_virq(bd718xx->irq_data, BD718XX_INT_PWRBTN_S);
if (ret < 0) {
dev_err(&i2c->dev, "Failed to get the IRQ\n");
return ret;
}
if (ret < 0) {
dev_err(&i2c->dev, "Failed to get the IRQ\n");
return ret;
}
button.irq = ret;
button.irq = ret;
}
ret = devm_mfd_add_devices(bd718xx->chip.dev, PLATFORM_DEVID_AUTO,
mfd, cells, NULL, 0,
regmap_irq_get_domain(bd718xx->irq_data));
!no_interrupt ? regmap_irq_get_domain(bd718xx->irq_data) : NULL);
if (ret)
dev_err(&i2c->dev, "Failed to create subdevices\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment