[PATCH] ad7418 driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux