Skip to content

Commit

Permalink
Merge pull request #3 from DatumSystems/fix-ina226-driver
Browse files Browse the repository at this point in the history
Fix ina2xx driver shunt voltage reporting.
  • Loading branch information
mcarlin-ds committed Aug 21, 2021
2 parents 9fb0d50 + b9022b7 commit 090ee28
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/hwmon/ina2xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

/* common register definitions */
#define INA2XX_CONFIG 0x00
#define INA2XX_SHUNT_VOLTAGE 0x01 /* readonly */
#define INA2XX_SHUNT_VOLTAGE 0x01 /* readonly */
#define INA2XX_BUS_VOLTAGE 0x02 /* readonly */
#define INA2XX_POWER 0x03 /* readonly */
#define INA2XX_CURRENT 0x04 /* readonly */
Expand Down Expand Up @@ -259,7 +259,8 @@ static int ina2xx_get_value(struct ina2xx_data *data, u8 reg,
switch (reg) {
case INA2XX_SHUNT_VOLTAGE:
/* signed register */
val = DIV_ROUND_CLOSEST((s16)regval, data->config->shunt_div);
val = (s16)regval * 1000;
val = DIV_ROUND_CLOSEST(val, data->config->shunt_div);
break;
case INA2XX_BUS_VOLTAGE:
val = (regval >> data->config->bus_voltage_shift)
Expand Down

0 comments on commit 090ee28

Please sign in to comment.