If shared-irq specified in device tree, request irq as shared.
Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
---
drivers/power/supply/max17042_battery.c | 3 ++-
include/linux/power/max17042_battery.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c
index 496c3e1f2ee6..f3d89d4d5c42 100644
--- a/drivers/power/supply/max17042_battery.c
+++ b/drivers/power/supply/max17042_battery.c
@@ -933,6 +933,7 @@ max17042_get_of_pdata(struct max17042_chip *chip)
pdata->vmin = INT_MIN;
if (of_property_read_s32(np, "maxim,over-volt", &pdata->vmax))
pdata->vmax = INT_MAX;
+ pdata->is_irq_shared = of_property_read_bool(np, "shared-irq");
return pdata;
}
@@ -1109,7 +1110,7 @@ static int max17042_probe(struct i2c_client *client)
* On ACPI systems the IRQ may be handled by ACPI-event code,
* so we need to share (if the ACPI code is willing to share).
*/
- if (acpi_id)
+ if (acpi_id || chip->pdata->is_irq_shared)
flags |= IRQF_SHARED | IRQF_PROBE_SHARED;
ret = devm_request_threaded_irq(&client->dev, client->irq,
diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h
index c417abd2ab70..1261dbaa5e8f 100644
--- a/include/linux/power/max17042_battery.h
+++ b/include/linux/power/max17042_battery.h
@@ -250,6 +250,7 @@ struct max17042_platform_data {
int num_init_data; /* Number of enties in init_data array */
bool enable_current_sense;
bool enable_por_init; /* Use POR init from Maxim appnote */
+ bool is_irq_shared;
/*
* R_sns in micro-ohms.
--
2.39.2