summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2025-09-01 18:37:15 +0300
committerGuenter Roeck <linux@roeck-us.net>2025-09-08 02:34:55 +0300
commit807e315bf9509f4d57eca687c9732ce16c3ef843 (patch)
tree2acf547f8cd5bbb495e8ce5a8569e90859699012 /drivers/hwmon
parentcc67b875c9e40ef7628219a37447c477d5324dc1 (diff)
downloadlinux-807e315bf9509f4d57eca687c9732ce16c3ef843.tar.xz
hwmon: (ina238) Support active-high alert polarity
All chips supported by this driver support configurable active-high alert priority. This is already documented in the devicetree description. Add support for it to the driver. Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Tested-by: Chris Packham <chris.packham@alliedtelesis.co.nz> # INA780 Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/ina238.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/hwmon/ina238.c b/drivers/hwmon/ina238.c
index 4d5b383b2521..24e396c69ae2 100644
--- a/drivers/hwmon/ina238.c
+++ b/drivers/hwmon/ina238.c
@@ -60,6 +60,7 @@
#define INA238_ADC_CONFIG_DEFAULT 0xfb6a
/* Configure alerts to be based on averaged value (SLOWALERT) */
#define INA238_DIAG_ALERT_DEFAULT 0x2000
+#define INA238_DIAG_ALERT_APOL BIT(12)
/*
* This driver uses a fixed calibration value in order to scale current/power
* based on a fixed shunt resistor value. This allows for conversion within the
@@ -793,8 +794,11 @@ static int ina238_probe(struct i2c_client *client)
}
/* Setup alert/alarm configuration */
- ret = regmap_write(data->regmap, INA238_DIAG_ALERT,
- INA238_DIAG_ALERT_DEFAULT);
+ config = INA238_DIAG_ALERT_DEFAULT;
+ if (device_property_read_bool(dev, "ti,alert-polarity-active-high"))
+ config |= INA238_DIAG_ALERT_APOL;
+
+ ret = regmap_write(data->regmap, INA238_DIAG_ALERT, config);
if (ret < 0) {
dev_err(dev, "error configuring the device: %d\n", ret);
return -ENODEV;