hwmon: (ina2xx) Improve current and power reading precision
Subsystems (2)
RFC PATCH 1/1 hwmon: (ina2xx) Improve current and power reading precision
=== Background ===
The ina2xx chip has a CALIBRATION register that's used to configure calibration value to get the scale of current and power measurement results from their registers. It basically follows two equations:
1) CAL = calibration factor / (current_lsb_A * rshunt_Ohm) [ calibration factor: 0.04096 for ina219; 0.00512 for ina226 ]
2) current_lsb_A = max_curr_A / 2^15
According to these two equations, calibration value, current scale, max_curr_A, and shunt resistor value are related factors.
The driver has been using two methods for these two equations:
A) Used a fixed current_lsb at 1 mA scale
B) Using a fixed calibration value at 4096|2048 for ina219|226
=== Problem ===
Both methods simplify software routine by fixing one factor, which sacrifices the precision of the hardware measurement results.
Using ina226 for example, with method A, the current scale was 1mA and the power scale was 25mA.
With method B, calibration value is fixed at 2048 so the precision is decided by shunt resistor value. It sounds reasonable since the hardware engineers can use a larger shunt resistor when they need higher resolution. However, they often concern power burning across the resistor as well, so the resistor usually won't be so large: a typical value 1000 micro-ohms, which results in a current scale at 2.5 mA and a power sacle at 62.5 mW.
When measuring a 1.8v voltage running a small current (e.g. 33 mA), the power value (that's supposed to be 59.4 mW) becomes inaccurate due to the larger scale (25mA for method A; 62.5 mA for method B).
Also, worth mentioning: method B was added by commit 5d389b125186 ("hwmon: (ina2xx) Make calibration register value fixed") stating that 4096|2048 is the best value for ina219|in226. However, their datasheets do not seem to mention this "best" keyword. Actually, they are merely minimum calibration values. See below calculation:
Equation 1, mentioned at Background section:
CAL = calibration factor / (current_lsb_A * rshunt_Ohm)
=> min CAL = calibration factor / (max current_lsb_A * rshunt_Ohm)
[calibration factor is 0.00512 for ina226]
Equation 2, mentioned at Background section:
current_lsb_A = max_curr_A / 2^15
=> max current_lsb_A = (upper bound of max_curr_A) / 2^15
Equation Aux:
(upper bound of max_curr_A) = max Vshunt / rshunt_Ohm [max Vshunt is 81.92 mA mentioned in ina226 datasheet]
Combining three equations:
min CAL = 0.00512 / (0.08192 / rshunt_Ohm / 2^15 * rshunt_Ohm)
= 0.00512 / (0.08192 / 2^15) = 2048
=== Solution ===
Being implied in the previous two paragraphs, both methods result in inaccurate measurements due to the large lsb values because of the fixed factors for the calculations.
To address this problem, this patch introduces a sysfs attribute "max_curr" (maximum expected current_lsb_mA) to allow user to set the current_lsb_uA via this max_curr according to Equation 2, for precision based on the use case, so they'll be able to indirectly control the calibration_value through Equation 1.
(In order not to break existing platforms, this change continues
using 4096|2048 as a default calibration value but renames them from "best" to "min")
Then the change introduces a pair of macros for Equation 1 and 2 and adds the calibration_factor back for Equation 1.
=== Testing ===
Fixed factors:
shunt_resistor = 1000 uO
in1_input = 1799 mV
Before:
max_curr = 81920 mA
calibration_value = 2048
when curr1_input = 33 mA,
power1_input = 125000 uW (expected 59367 uW)
when curr1_input = 35 mA
power1_input = 125000 uW (expected 62965 uW)After:
set "max_curr" to 5145 mA (smallest within the valid range) calibration_value = 32611
when curr1_input = 32 mA
power1_input = 58875 uW (expected 57568 uW)
when curr1_input = 35 mA
power1_input = 62800 uW (expected 62965 uW)=== Summary ===
- "shunt_resistor" attribute sets rshunt and "max_curr" boundaries
- "max_curr" sysfs attribute decides current_lsb_uA and power_lsb_uW
- ina2xx_init() still uses 4096|2048 as default calibration setting
* All of them will calibrate as the factor of Equation 1 is changed
---
Note:
This change is rebased upon the following Documentation change:
Documentation: hwmon: Add descriptions for ina2xx sysfs entries
which was sent to the mail-list and is now under review already.
Documentation/hwmon/ina2xx | 2 + drivers/hwmon/ina2xx.c | 233 ++++++++++++++++++++++++++++++------- 2 files changed, 192 insertions(+), 43 deletions(-)
Documentation/hwmon/ina2xx +2 -0
@@ -71,6 +71,8 @@ in1_input Bus voltage(mV) channel curr1_input Current(mA) measurement channel power1_input Power(uW) measurement channel shunt_resistor Shunt resistance(uOhm) channel +max_curr Maximum expected current used to improve precision + of readings of current and power measurements Sysfs entries for ina226, ina230 and ina231 only -------------
drivers/hwmon/ina2xx.c +190 -43
322 lines not on this page · raw message
Signature · 1 line
2.17.1
Quoted 1 line · On Mittwoch, 21. November 2018 02:26:29 CET Nicolin Chen wrote:
=== Background ===
[...]
Quoted 8 lines
=== Problem ===
Both methods simplify software routine by fixing one factor, which sacrifices the precision of the hardware measurement results.Using ina226 for example, with method A, the current scale was 1mA and the power scale was 25mA.
Quoted 7 lines
With method B, calibration value is fixed at 2048 so the precision is decided by shunt resistor value. It sounds reasonable since the hardware engineers can use a larger shunt resistor when they need higher resolution. However, they often concern power burning across the resistor as well, so the resistor usually won't be so large: a typical value 1000 micro-ohms, which results in a current scale at 2.5 mA and a power sacle at 62.5 mW.
Power loss surely is a concern, but figures should be kept reasonable.
1. You mention 1.8V bus voltage, and currents in the 30mA range. Using the 1mOhm current shunt:
U_S = R_S * I_S 1e-3 Ohm * 30e-3 A = 30e-6 V (30uV) P_S = U_S * I_S = 30e-6V * 30e-3 A = 900e-9W = 0.9 uW
INA219 Power Supply (Datasheet)
Min operating Voltage: 3V
Quiescent Current: 0.7mA
-> Min power: 2.1mW
So the INA219 alone uses 2.1mW, 1000 times more than the shunt.
Another concern may be voltage drop over the shunt, but for this case you have a nominal voltage of 1.8V, so 30uV are 0.001%.
Quoted 3 lines
When measuring a 1.8v voltage running a small current (e.g. 33 mA), the power value (that's supposed to be 59.4 mW) becomes inaccurate due to the larger scale (25mA for method A; 62.5 mA for method B).
Another look into the datasheet reveals, even at full gain (PGA=1), the LSB is 40mV / 2^12 = 40mV / 4096 ~ 10uV. So when the current ADC reads out as 3*LSB, this anything between 25mA and 35mA. This is the best case figure.
On top of quantisation error, you have the ADC offset voltage (V_OS), which is given as (for PGA=1, best case): (+-) 10uV typical, (+-) 100uV max.
So, if you want to have meaningful readouts adjust your shunt to a reasonable value. Even 100 times the current value will have no measurable effect on you system (power loss: 90uW, voltage drop: 3mV).
Kind regards,
Stefan
(Removing "[email protected]" since it's not reachable any more)
Hi Stefan,
Thank you for the comments.
Quoted 23 lines · Stefan
Quoted 7 lines
=== Problem ===
Both methods simplify software routine by fixing one factor, which sacrifices the precision of the hardware measurement results.Using ina226 for example, with method A, the current scale was 1mA and the power scale was 25mA.
Quoted 7 lines
With method B, calibration value is fixed at 2048 so the precision is decided by shunt resistor value. It sounds reasonable since the hardware engineers can use a larger shunt resistor when they need higher resolution. However, they often concern power burning across the resistor as well, so the resistor usually won't be so large: a typical value 1000 micro-ohms, which results in a current scale at 2.5 mA and a power sacle at 62.5 mW.
Power loss surely is a concern, but figures should be kept reasonable.
1. You mention 1.8V bus voltage, and currents in the 30mA range. Using the 1mOhm current shunt:
U_S=R_S*I_S1e-3 Ohm * 30e-3 A = 30e-6 V (30uV)P_S=U_S*I_S= 30e-6V * 30e-3 A = 900e-9W = 0.9 uW
Quoted 6 lines
INA219 Power Supply (Datasheet)
Min operating Voltage: 3V
Quiescent Current: 0.7mA
-> Min power: 2.1mWSo the INA219 alone uses 2.1mW, 1000 times more than the shunt.
Chip can enter power-down or one-shot mode. Though this upstream driver doesn't have these two mode supports yet, I am working on it so they'll be added.
Quoted 6 lines
Another concern may be voltage drop over the shunt, but for this case you have a nominal voltage of 1.8V, so 30uV are 0.001%.
Quoted 3 lines
When measuring a 1.8v voltage running a small current (e.g. 33 mA), the power value (that's supposed to be 59.4 mW) becomes inaccurate due to the larger scale (25mA for method A; 62.5 mA for method B).
Just found out that I have typos here: 25mW and 62.5mW.
Quoted 3 lines
Another look into the datasheet reveals, even at full gain (PGA=1), the LSB is 40mV / 2^12 = 40mV / 4096 ~ 10uV. So when the current ADC reads out as 3*LSB, this anything between 25mA and 35mA. This is the best case figure.
Current read doesn't get affected a lot actually, since hwmon ABI also reports current value in unit mA. However, the power read is the matter here. With a 62.5mW power_lsb, power results are kinda useless on my system.
Quoted 6 lines
On top of quantisation error, you have the ADC offset voltage (
V_OS), which is given as (for PGA=1, best case): (+-) 10uV typical, (+-) 100uV max.So, if you want to have meaningful readouts adjust your shunt to a reasonable value. Even 100 times the current value will have no measurable effect on you system (power loss: 90uW, voltage drop: 3mV).
I understand your last point. But I believe that'd be a separate idea to improve precision but not an alternative one from driver aspect. Yes, I agree using a larger shunt resistor is always one way to get precision, but it doesn't give an excuse for software driver to be less optimized.
The truth is that calibration value is set to the minimum value, giving the best range of current measurement meanwhile the worst precision. You can argue that our hardware engineers might have been too conservative by putting a not-big-enough resistor. But they may also argue that software driver doesn't optimize while the register is totally configurable. I believe both sides have their own reasons.
But apparently configuring in software is fairly less expensive. And it doesn't sound convincing to me by telling them "hey guys, go to change your hardware design because we will not set that register": We have more than thousands of products in the market (all battery powered so being conservative), so not possible to recall all of them back just to place larger shunt resistors.
Quoted 1 line
From my point of view, there's nothing wrong for hardware folks
being conservative to put a smaller resistor since the software has the capability to improve precision with a single I2C write.
A separate topic, I actually thought about setting the default calibration value using a number somewhere in the middle of the best range and the best precision. But it looks that I am right to keep the default to minimum value so that no existing users will be affected.
So my patch merely gives an opportunity for those conservative designers to fine-tune the software for a better precision. It is necessary since there are such designers/users and products. And it isn't supposed to affect existing users.
Thank you
Nicolin
Quoted 35 lines · On Mittwoch, 21. November 2018 20:40:52 CET Nicolin Chen wrote:
(Removing "[email protected]" since it's not reachable any more)
Hi Stefan,
Thank you for the comments.
Quoted 28 lines · Stefan
Quoted 7 lines
=== Problem ===
Both methods simplify software routine by fixing one factor, which sacrifices the precision of the hardware measurement results.Using ina226 for example, with method A, the current scale was 1mA and the power scale was 25mA.
Quoted 7 lines
With method B, calibration value is fixed at 2048 so the precision is decided by shunt resistor value. It sounds reasonable since the hardware engineers can use a larger shunt resistor when they need higher resolution. However, they often concern power burning across the resistor as well, so the resistor usually won't be so large: a typical value 1000 micro-ohms, which results in a current scale at 2.5 mA and a power sacle at 62.5 mW.
Power loss surely is a concern, but figures should be kept reasonable.
1. You mention 1.8V bus voltage, and currents in the 30mA range. Using the 1mOhm current shunt:
U_S=R_S*I_S1e-3 Ohm * 30e-3 A = 30e-6 V (30uV)P_S=U_S*I_S= 30e-6V * 30e-3 A = 900e-9W = 0.9 uWINA219 Power Supply (Datasheet)
Min operating Voltage: 3V
Quiescent Current: 0.7mA
-> Min power: 2.1mW
Quoted 5 lines
Quoted 1 line
So the INA219 alone uses 2.1mW, 1000 times more than the shunt.
Chip can enter power-down or one-shot mode. Though this upstream driver doesn't have these two mode supports yet, I am working on it so they'll be added.
The power-down current is 6uA, so even if you never leave power-down mode, you are down to 18uW. But on top of that, you need power for the conversion, and you need power for communication.
Quoted 9 lines
Quoted 6 lines
Another concern may be voltage drop over the shunt, but for this case you have a nominal voltage of 1.8V, so 30uV are 0.001%.
Quoted 3 lines
When measuring a 1.8v voltage running a small current (e.g. 33 mA), the power value (that's supposed to be 59.4 mW) becomes inaccurate due to the larger scale (25mA for method A; 62.5 mA for method B).
Just found out that I have typos here: 25mW and 62.5mW.
Quoted 8 lines
Quoted 4 lines
Another look into the datasheet reveals, even at full gain (PGA=1), the LSB is 40mV / 2^12 = 40mV / 4096 ~ 10uV. So when the current ADC reads out as 3*LSB, this anything between 25mA and 35mA. This is the best case figure.
Current read doesn't get affected a lot actually, since hwmon ABI also reports current value in unit mA. However, the power read is the matter here. With a 62.5mW
power_lsb, power results are kinda useless on my system.
The reported current does not matter here, actually. Internally, the ADC value will have an uncertainty of 10mA (at PGA=1). At 1.8V, your uncertainty is 18mW. And thats *only* the quantization noise. It wont get better than that.
Also note, you are apparently using the ina2xx hwmon driver - I strongly advise against it, you should either use the ina2xx driver from the IIO subsystem directly, or use the IIO driver via iio-hwmon.
1. INA219 is not properly supported by the hwmon driver, see the changes in the IIO driver.
2. The IIO driver has many more features:
- setting the PGA (INA219)
- setting the bus voltage range (INA219)
- selecting the conversion time (INA219/226)
There is also always the possibility to read the bus and shunt voltage registers and calculate the power manually.
Regards,
Stefan
Guenter Roeck
maintainerQuoted 72 lines · Stefan
Quoted 35 lines · On Mittwoch, 21. November 2018 20:40:52 CET Nicolin Chen wrote:
(Removing "[email protected]" since it's not reachable any more)
Hi Stefan,
Thank you for the comments.
Quoted 28 lines · Stefan
Quoted 7 lines
=== Problem ===
Both methods simplify software routine by fixing one factor, which sacrifices the precision of the hardware measurement results.Using ina226 for example, with method A, the current scale was 1mA and the power scale was 25mA.
Quoted 7 lines
With method B, calibration value is fixed at 2048 so the precision is decided by shunt resistor value. It sounds reasonable since the hardware engineers can use a larger shunt resistor when they need higher resolution. However, they often concern power burning across the resistor as well, so the resistor usually won't be so large: a typical value 1000 micro-ohms, which results in a current scale at 2.5 mA and a power sacle at 62.5 mW.
Power loss surely is a concern, but figures should be kept reasonable.
1. You mention 1.8V bus voltage, and currents in the 30mA range. Using the 1mOhm current shunt:
U_S=R_S*I_S1e-3 Ohm * 30e-3 A = 30e-6 V (30uV)P_S=U_S*I_S= 30e-6V * 30e-3 A = 900e-9W = 0.9 uWINA219 Power Supply (Datasheet)
Min operating Voltage: 3V
Quiescent Current: 0.7mA
-> Min power: 2.1mWQuoted 5 lines
Quoted 1 line
So the INA219 alone uses 2.1mW, 1000 times more than the shunt.
Chip can enter power-down or one-shot mode. Though this upstream driver doesn't have these two mode supports yet, I am working on it so they'll be added.
The power-down current is 6uA, so even if you never leave power-down mode, you are down to 18uW. But on top of that, you need power for the conversion, and you need power for communication.
Quoted 9 lines
Quoted 6 lines
Another concern may be voltage drop over the shunt, but for this case you have a nominal voltage of 1.8V, so 30uV are 0.001%.
Quoted 3 lines
When measuring a 1.8v voltage running a small current (e.g. 33 mA), the power value (that's supposed to be 59.4 mW) becomes inaccurate due to the larger scale (25mA for method A; 62.5 mA for method B).
Just found out that I have typos here: 25mW and 62.5mW.
Quoted 8 lines
Quoted 4 lines
Another look into the datasheet reveals, even at full gain (PGA=1), the LSB is 40mV / 2^12 = 40mV / 4096 ~ 10uV. So when the current ADC reads out as 3*LSB, this anything between 25mA and 35mA. This is the best case figure.
Current read doesn't get affected a lot actually, since hwmon ABI also reports current value in unit mA. However, the power read is the matter here. With a 62.5mW
power_lsb, power results are kinda useless on my system.The reported current does not matter here, actually. Internally, the ADC value will have an uncertainty of 10mA (at PGA=1). At 1.8V, your uncertainty is 18mW. And thats *only* the quantization noise. It wont get better than that.
Also note, you are apparently using the ina2xx hwmon driver - I strongly advise against it, you should either use the ina2xx driver from the IIO subsystem directly, or use the IIO driver via iio-hwmon.
Quoted 7 lines
1. INA219 is not properly supported by the hwmon driver, see the changes in the IIO driver.
2. The IIO driver has many more features:
- setting the PGA (INA219)
- setting the bus voltage range (INA219)
- selecting the conversion time (INA219/226)
I agree. Not because of the functionality per se ("not properly supported, see changes in IIO driver" is a bit vague given the number of changes there), but you don't really use both ina3221 and ina219 as hwmon device. Afer all, one-shot mode effectively turns off limit tracking.
Ultimately it would be nice if iio would support limits and alarms, and iio-hwmon could read and report those. This would enable us to drop the iio-hwmon driver.
Guenter
Hi Stefan,
Sorry for a super late reply. I took a long vacation.
Quoted 13 lines · Stefan
Quoted 13 lines
Quoted 6 lines
Another concern may be voltage drop over the shunt, but for this case you have a nominal voltage of 1.8V, so 30uV are 0.001%.
Quoted 3 lines
When measuring a 1.8v voltage running a small current (e.g. 33 mA), the power value (that's supposed to be 59.4 mW) becomes inaccurate due to the larger scale (25mA for method A; 62.5 mA for method B).
Just found out that I have typos here: 25mW and 62.5mW.
Quoted 4 lines
Another look into the datasheet reveals, even at full gain (PGA=1), the LSB is 40mV / 2^12 = 40mV / 4096 ~ 10uV. So when the current ADC reads out as 3*LSB, this anything between 25mA and 35mA. This is the best case figure.
Quoted 8 lines
Quoted 4 lines
Current read doesn't get affected a lot actually, since hwmon ABI also reports current value in unit mA. However, the power read is the matter here. With a 62.5mW
power_lsb, power results are kinda useless on my system.The reported current does not matter here, actually. Internally, the ADC value will have an uncertainty of 10mA (at PGA=1). At 1.8V, your uncertainty is 18mW. And thats *only* the quantization noise. It wont get better than that.
The fact is that I do get better power results after setting the calibration value to 0x7ff. That's the necessity of this change.
Quoted 3 lines
Also note, you are apparently using the ina2xx hwmon driver - I strongly advise against it, you should either use the ina2xx driver from the IIO subsystem directly, or use the IIO driver via iio-hwmon.
The IIO version is also using the minimum calibration value. It will not solve my problem here.
Quoted 2 lines
There is also always the possibility to read the bus and shunt voltage registers and calculate the power manually.
Won't that be a waste since the hardware could have provided a better accuracy? It would need more I2C bus reads and cpu cycles for calculation.
I don't get why you're against a setting for calibration value. This is how the hardware got designed to cover different cases. Since we do have such a case that needs some accuracy, it'd be fair to add it into the driver. Plus, the feature won't change the minimum calibration value at all -- everyone would be happy.
Thanks
Nicolin
Quoted 44 lines · Nicolin Chen
Hi Stefan,
Sorry for a super late reply. I took a long vacation.
Quoted 13 lines · Stefan
Quoted 13 lines
Quoted 6 lines
Another concern may be voltage drop over the shunt, but for this case you have a nominal voltage of 1.8V, so 30uV are 0.001%.
Quoted 3 lines
When measuring a 1.8v voltage running a small current (e.g. 33 mA), the power value (that's supposed to be 59.4 mW) becomes inaccurate due to the larger scale (25mA for method A; 62.5 mA for method B).
Just found out that I have typos here: 25mW and 62.5mW.
Quoted 4 lines
Another look into the datasheet reveals, even at full gain (PGA=1), the LSB is 40mV / 2^12 = 40mV / 4096 ~ 10uV. So when the current ADC reads out as 3*LSB, this anything between 25mA and 35mA. This is the best case figure.
Quoted 8 lines
Quoted 4 lines
Current read doesn't get affected a lot actually, since hwmon ABI also reports current value in unit mA. However, the power read is the matter here. With a 62.5mW
power_lsb, power results are kinda useless on my system.The reported current does not matter here, actually. Internally, the ADC value will have an uncertainty of 10mA (at PGA=1). At 1.8V, your uncertainty is 18mW. And thats *only* the quantization noise. It wont get better than that.
The fact is that I do get better power results after setting the calibration value to
0x7ff. That's the necessity of this change.Quoted 3 lines
Also note, you are apparently using the ina2xx hwmon driver - I strongly advise against it, you should either use the ina2xx driver from the IIO subsystem directly, or use the IIO driver via iio-hwmon.
The IIO version is also using the minimum calibration value. It will not solve my problem here.
Quoted 2 lines
There is also always the possibility to read the bus and shunt voltage registers and calculate the power manually.
Won't that be a waste since the hardware could have provided a better accuracy? It would need more I2C bus reads and cpu cycles for calculation.
Quoted 5 lines
I don't get why you're against a setting for calibration value. This is how the hardware got designed to cover different cases. Since we do have such a case that needs some accuracy, it'd be fair to add it into the driver. Plus, the feature won't change the minimum calibration value at all -- everyone would be happy.
Stefan,
Would you please kindly give an ack to this intention so that we can at least move forward for patch review?
Neither changing hardware resistor values nor simply ignoring the inaccuracy is acceptable for us. Since configuring that calibration register value can help our use cases, we really need this setting to be available in the driver.
Guenter,
Do you have any input regarding this change? I would like to hear an opinion from you.
Thank you
Guenter Roeck
maintainerQuoted 61 lines · Nicolin Chen
Quoted 44 lines · Nicolin Chen
Hi Stefan,
Sorry for a super late reply. I took a long vacation.
Quoted 13 lines · Stefan
Quoted 13 lines
Quoted 6 lines
Another concern may be voltage drop over the shunt, but for this case you have a nominal voltage of 1.8V, so 30uV are 0.001%.
Quoted 3 lines
When measuring a 1.8v voltage running a small current (e.g. 33 mA), the power value (that's supposed to be 59.4 mW) becomes inaccurate due to the larger scale (25mA for method A; 62.5 mA for method B).
Just found out that I have typos here: 25mW and 62.5mW.
Quoted 4 lines
Another look into the datasheet reveals, even at full gain (PGA=1), the LSB is 40mV / 2^12 = 40mV / 4096 ~ 10uV. So when the current ADC reads out as 3*LSB, this anything between 25mA and 35mA. This is the best case figure.
Quoted 8 lines
Quoted 4 lines
Current read doesn't get affected a lot actually, since hwmon ABI also reports current value in unit mA. However, the power read is the matter here. With a 62.5mW
power_lsb, power results are kinda useless on my system.The reported current does not matter here, actually. Internally, the ADC value will have an uncertainty of 10mA (at PGA=1). At 1.8V, your uncertainty is 18mW. And thats *only* the quantization noise. It wont get better than that.
The fact is that I do get better power results after setting the calibration value to
0x7ff. That's the necessity of this change.Quoted 3 lines
Also note, you are apparently using the ina2xx hwmon driver - I strongly advise against it, you should either use the ina2xx driver from the IIO subsystem directly, or use the IIO driver via iio-hwmon.
The IIO version is also using the minimum calibration value. It will not solve my problem here.
Quoted 2 lines
There is also always the possibility to read the bus and shunt voltage registers and calculate the power manually.
Won't that be a waste since the hardware could have provided a better accuracy? It would need more I2C bus reads and cpu cycles for calculation.
Quoted 5 lines
I don't get why you're against a setting for calibration value. This is how the hardware got designed to cover different cases. Since we do have such a case that needs some accuracy, it'd be fair to add it into the driver. Plus, the feature won't change the minimum calibration value at all -- everyone would be happy.
Stefan,
Would you please kindly give an ack to this intention so that we can at least move forward for patch review?
Neither changing hardware resistor values nor simply ignoring the inaccuracy is acceptable for us. Since configuring that calibration register value can help our use cases, we really need this setting to be available in the driver.
Quoted 5 lines
Guenter,
Do you have any input regarding this change? I would like to hear an opinion from you.
I have one claim stating that your change won't make a difference, and your claim that it would. That leaves me with no choice but to spend a large amount of time with the datasheet, and possibly with my evaluation boards, trying to find out who is correct. Unfortunately, time is scarce to come by those days. I would very much prefer for you folks to sort out your differences and present me with a single opinion.
Long term the best solution would really be to replace the hwmon driver with the iio driver and use the iio-hwmon bridge. The ina2xx driver doesn't support limits, so there is no real benefit of using the hwmon driver over the iio driver, at least assuming that the iio driver supports all the attributes. So maybe you should make your case for the changes in the iio driver.
Guenter
Hi Guenter,
Quoted 8 lines · Guenter Roeck
I have one claim stating that your change won't make a difference, and your claim that it would. That leaves me with no choice but to spend a large amount of time with the datasheet, and possibly with my evaluation boards, trying to find out who is correct. Unfortunately, time is scarce to come by those days. I would very much prefer for you folks to sort out your differences and present me with a single opinion.
Quoted 6 lines
Long term the best solution would really be to replace the hwmon driver with the iio driver and use the iio-hwmon bridge. The ina2xx driver doesn't support limits, so there is no real benefit of using the hwmon driver over the iio driver, at least assuming that the iio driver supports all the attributes. So maybe you should make your case for the changes in the iio driver.
Thanks for the input. Let's drop this hwmon change then.