On 3/4/25 02:03, Dzmitry Sankouski wrote:
ср, 26 февр. 2025 г. в 16:53, Guenter Roeck <linux@xxxxxxxxxxxx>:
On 2/25/25 11:11, Dzmitry Sankouski wrote:
Add support for max77705 hwmon. Includes charger input, system bus, and
vbyp measurements.
Signed-off-by: Dzmitry Sankouski <dsankouski@xxxxxxxxx>
---
Maxim MAX77705 is a Companion Power Management and Type-C interface IC.
It includes charger and fuel gauge blocks, and is capable of measuring
charger input current, system bus volatage and current, and bypass
voltage.
This patch add support for mentioned measurements.
(...)
+
+struct channel_desc {
+ u8 reg;
+ u8 avg_reg;
+ const char *const label;
+ // register resolution. nano Volts for voltage, nano Amperes for current
+ u64 resolution;
Why u64 ?
Resolution is in nano Volts, and VBYP value is typically 5v, which leads to
u32 overflow.
That is not a valid reason. The resolution itself does not overflow.
The conversion to 64-bit calculations can be done there.
(...)
This is unusual for an mfd driver. Why not pass regmap from the parent
driver ?
This limits access to shared device register map by using readable table
with related registers only.
I do not see that as valid reason to implement separate regmaps. That
only complicates the code.
Guenter