[lm-sensors] [PATCH] ad7418 driver
Jean Delvare
khali at linux-fr.org
Sun Dec 24 15:09:35 CET 2006
Ah, one more thing...
On Sun, 12 Nov 2006 15:37:24 +0100, Alessandro Zummo wrote:
> +#define show_adc(value) \
> +static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \
> +{ \
> + struct ad7418_data *data = ad7418_update_device(dev); \
> + return sprintf(buf, "%d\n", data->value >> 6); \
> +}
Here you return (almost) the raw register value, while the sysfs
interface standard says you must export the value in mV. According to
the datasheet, the ADC LSB is VREF/1024 with VREF = 2.5V, so you'd need
to return:
((data->value >> 6) * 2500 + 512) / 1024
--
Jean Delvare
More information about the lm-sensors
mailing list