[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241109-b4-max17042-v1-2-9e2b07e54e76@gmail.com>
Date: Sat, 09 Nov 2024 15:44:34 +0300
From: Dzmitry Sankouski <dsankouski@...il.com>
To: Hans de Goede <hdegoede@...hat.com>,
Krzysztof Kozlowski <krzk@...nel.org>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Sebastian Krzyszkowiak <sebastian.krzyszkowiak@...i.sm>,
Purism Kernel Team <kernel@...i.sm>, Sebastian Reichel <sre@...nel.org>,
Rob Herring <robh@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
Alim Akhtar <alim.akhtar@...sung.com>, Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>, Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>
Cc: linux-pm@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-samsung-soc@...r.kernel.org, imx@...ts.linux.dev,
linux-arm-msm@...r.kernel.org, Dzmitry Sankouski <dsankouski@...il.com>
Subject: [PATCH 2/4] power: supply: max17042: implement dts shared-irq
If shared-irq specified in device tree, request irq as shared.
Signed-off-by: Dzmitry Sankouski <dsankouski@...il.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
Powered by blists - more mailing lists