[PATCH v2 7/7] mfd: qcom-pm8008: Tolerate missing interrupt
From: Jishnu Prakash
Date: Wed Oct 14 2026 - 06:36:23 EST
From: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
PM8010 is often wired up with the interrupt pin tied to ground. Only
register the IRQ infrastructure if we have a parent irq.
Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
Co-developed-by: Dhruvin Rajpura <drajpura@xxxxxxxxxxxxxxxx>
Signed-off-by: Dhruvin Rajpura <drajpura@xxxxxxxxxxxxxxxx>
Co-developed-by: Jishnu Prakash <jishnu.prakash@xxxxxxxxxxxxxxxx>
Signed-off-by: Jishnu Prakash <jishnu.prakash@xxxxxxxxxxxxxxxx>
---
drivers/mfd/qcom-pm8008.c | 82 ++++++++++++++++++++++++++++++++++-------------
1 file changed, 60 insertions(+), 22 deletions(-)
diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c
index 4179427f3891..8b1bbb4052a7 100644
--- a/drivers/mfd/qcom-pm8008.c
+++ b/drivers/mfd/qcom-pm8008.c
@@ -208,6 +208,14 @@ static const struct mfd_cell pm8010_cells[] = {
MFD_CELL_RES("qpnp-temp-alarm", pm8008_temp_res),
};
+static const struct mfd_cell pm8008_no_irq_cells[] = {
+ MFD_CELL_NAME("pm8008-regulator"),
+};
+
+static const struct mfd_cell pm8010_no_irq_cells[] = {
+ MFD_CELL_NAME("pm8010-regulator"),
+};
+
static void devm_irq_domain_fwnode_release(void *data)
{
struct fwnode_handle *fwnode = data;
@@ -215,19 +223,50 @@ static void devm_irq_domain_fwnode_release(void *data)
irq_domain_free_fwnode(fwnode);
}
+static int pm8008_irq_config(struct device *dev, int irq, struct regmap *regmap,
+ const struct regmap_irq_chip *irq_chip_desc,
+ struct regmap_irq_chip_data **irq_data)
+{
+ struct fwnode_handle *fwnode;
+ char *name;
+ int ret;
+
+ name = devm_kasprintf(dev, GFP_KERNEL, "%pOF-internal", dev->of_node);
+ if (!name)
+ return -ENOMEM;
+
+ name = strreplace(name, '/', ':');
+
+ fwnode = irq_domain_alloc_named_fwnode(name);
+ if (!fwnode)
+ return -ENOMEM;
+
+ ret = devm_add_action_or_reset(dev, devm_irq_domain_fwnode_release, fwnode);
+ if (ret)
+ return ret;
+
+ ret = devm_regmap_add_irq_chip_fwnode(dev, fwnode, regmap, irq,
+ IRQF_SHARED, 0, irq_chip_desc,
+ irq_data);
+ if (ret) {
+ dev_err(dev, "failed to add IRQ chip: %d\n", ret);
+ return ret;
+ }
+
+ return 0;
+}
+
static int pm8008_probe(struct i2c_client *client)
{
- struct regmap_irq_chip_data *irq_data;
+ struct regmap_irq_chip_data *irq_data = NULL;
const struct regmap_irq_chip *irq_chip_desc;
struct device *dev = &client->dev;
const struct mfd_cell *mfd_cells;
struct regmap *regmap, *regmap2;
- struct fwnode_handle *fwnode;
struct i2c_client *dummy;
struct gpio_desc *reset;
unsigned long pmic_type;
int num_mfd_cells;
- char *name;
int ret;
pmic_type = (unsigned long)of_device_get_match_data(dev);
@@ -248,6 +287,19 @@ static int pm8008_probe(struct i2c_client *client)
return -EINVAL;
}
+ if (!client->irq) {
+ switch (pmic_type) {
+ case TYPE_PM8008:
+ mfd_cells = pm8008_no_irq_cells;
+ num_mfd_cells = ARRAY_SIZE(pm8008_no_irq_cells);
+ break;
+ case TYPE_PM8010:
+ mfd_cells = pm8010_no_irq_cells;
+ num_mfd_cells = ARRAY_SIZE(pm8010_no_irq_cells);
+ break;
+ }
+ }
+
dummy = devm_i2c_new_dummy_device(dev, client->adapter, client->addr + 1);
if (IS_ERR(dummy)) {
ret = PTR_ERR(dummy);
@@ -278,25 +330,11 @@ static int pm8008_probe(struct i2c_client *client)
*/
usleep_range(1000, 2000);
- name = devm_kasprintf(dev, GFP_KERNEL, "%pOF-internal", dev->of_node);
- if (!name)
- return -ENOMEM;
-
- name = strreplace(name, '/', ':');
-
- fwnode = irq_domain_alloc_named_fwnode(name);
- if (!fwnode)
- return -ENOMEM;
-
- ret = devm_add_action_or_reset(dev, devm_irq_domain_fwnode_release, fwnode);
- if (ret)
- return ret;
-
- ret = devm_regmap_add_irq_chip_fwnode(dev, fwnode, regmap, client->irq,
- IRQF_SHARED, 0, irq_chip_desc, &irq_data);
- if (ret) {
- dev_err(dev, "failed to add IRQ chip: %d\n", ret);
- return ret;
+ if (client->irq) {
+ ret = pm8008_irq_config(dev, client->irq, regmap, irq_chip_desc,
+ &irq_data);
+ if (ret)
+ return ret;
}
return devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, mfd_cells,
--
2.43.0