Re: [PATCH v4 2/2] rtc: max31335: add driver support

From: Guenter Roeck
Date: Thu Nov 02 2023 - 13:17:28 EST


On 11/2/23 09:57, Alexandre Belloni wrote:
[ ... ]
+static int max31335_read_offset(struct device *dev, long *offset)
+{
+ struct max31335_data *max31335 = dev_get_drvdata(dev);
+ u32 value;
+ int ret;
+
+ ret = regmap_read(max31335->regmap, MAX31335_AGING_OFFSET,
&value);
+ if (ret)
+ return ret;
+
+ *offset = value;

This is super dubious, what is the unit of MAX31335_AGING_OFFSET ?


There is not additional information on the AGING_OFFSET register (no
other offset registers).
I treated it as a raw value that user can write/read. Should I drop the
offset implementation?


The value exposed to userspace is in parts per billion. If you can't do
the conversion, then you have to drop it.


The max31334 datasheet says "Resolution = 0.477ppm". Again, the datasheet for
max31335 is not public, so it is impossible to say what the resolution is
for that chip, but I would assume that it is documented.

Guenter