Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+6 -2
+6 -2
drivers/hwmon/ina238.c
··· 60 60 #define INA238_ADC_CONFIG_DEFAULT 0xfb6a 61 61 /* Configure alerts to be based on averaged value (SLOWALERT) */ 62 62 #define INA238_DIAG_ALERT_DEFAULT 0x2000 63 + #define INA238_DIAG_ALERT_APOL BIT(12) 63 64 /* 64 65 * This driver uses a fixed calibration value in order to scale current/power 65 66 * based on a fixed shunt resistor value. This allows for conversion within the ··· 794 793 } 795 794 796 795 /* Setup alert/alarm configuration */ 797 - ret = regmap_write(data->regmap, INA238_DIAG_ALERT, 798 - INA238_DIAG_ALERT_DEFAULT); 796 + config = INA238_DIAG_ALERT_DEFAULT; 797 + if (device_property_read_bool(dev, "ti,alert-polarity-active-high")) 798 + config |= INA238_DIAG_ALERT_APOL; 799 + 800 + ret = regmap_write(data->regmap, INA238_DIAG_ALERT, config); 799 801 if (ret < 0) { 800 802 dev_err(dev, "error configuring the device: %d\n", ret); 801 803 return -ENODEV;