[lm-sensors] [PATCH] hwmon: INA219 and INA226 support
Guenter Roeck
guenter.roeck at ericsson.com
Tue May 8 19:57:19 CEST 2012
On Tue, 2012-05-08 at 13:43 -0400, Felten, Lothar wrote:
> Hello,
>
> This patch brings support for the Texas Instruments INA219 and INA226 power monitors.
>
> Signed-off-by: Lothar Felten <l-felten at ti.com>
Ah, just found something else:
[ ... ]
> + switch (data->kind) {
> + case ina219:
> + /* device configuration */
> + ina2xx_write_word(client, INA2XX_CONFIG, INA219_CONFIG_DEFAULT);
> +
> + /* set current LSB to 1mA, shunt is in uOhms */
> + /* (equation 13 in datasheet) */
> + ina2xx_write_word(client, INA2XX_CALIBRATION, (40960 / shunt));
shunt is now in uOhm, so I suspect the above is probably no longer
correct. Can you verify ?
> + dev_info(&client->dev,
> + "power monitor INA219 (Rshunt = %li uOhm)\n", shunt);
> + data->registers = INA219_REGISTERS;
> + break;
> + case ina226:
> + /* device configuration */
> + ina2xx_write_word(client, INA2XX_CONFIG, INA226_CONFIG_DEFAULT);
> +
> + /* set current LSB to 1mA, shunt is in uOhms */
> + /* (equation 1 in datasheet)*/
> + ina2xx_write_word(client, INA2XX_CALIBRATION, (5120 / shunt));
Same here. With 10,000 uOhm default, the above doesn't really make sense
anymore, and should probably be something like
5120000 / shunt
[ Oh, and the ( ) around the equation isn't needed ... ]
Please have a look and resubmit.
Thanks,
Guenter
More information about the lm-sensors
mailing list