On Tue, Aug 06, 2019 at 07:38:32AM +0000, Sa, Nuno wrote: > Hi all, > > I'm currently developing a driver for a hwmon device and I have a couple of questions that maybe someone > in the list can help me with. The device can be found in: > https://www.analog.com/media/en/technical-documentation/data-sheets/LTC2947.pdf > > This device also has support for measuring charge which, as far as i understand, is not a standard type > for hwmon subsystem. So, my question is: How should I handle this? Should I just add a SENSOR_DEVICE_ATTR() > or is there a more appropriate way of handling this (using power supply subsystem)? > The hwmon subsystem is not the appropriate subsystem to report charge levels (measured in Ampere-seconds as far as I can see). hwmon is about hardware monitoring. > Another thing, is that the device supports continuous mode and single shot readings. Only in continuous mode > we can measure energy and charge, and the device can handle switching modes on runtime. So, can we just add a > sysfs control file under /sys/class/hwmon/device or is it not the way to go? > I am not in favor of supporting single-shot measurements in the first place. Most chips support it, but it is hardly ever supported by drivers, for the most part because power savings are negligible and the downside of supporting it (programming complexity, delayed readings) is substantial. What is your use case for both requirements (reporting charge levels and single-shot mode) ? Both seem mutually exclusive. Thanks, Guenter