All of lore.kernel.org
 help / color / mirror / Atom feed
From: khali@linux-fr.org (Jean Delvare)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] [PATCH] ad7418 driver
Date: Sun, 24 Dec 2006 14:09:35 +0000	[thread overview]
Message-ID: <20061224150935.a8327a03.khali@linux-fr.org> (raw)
In-Reply-To: <20061112153724.3e630d32@inspiron>

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


  parent reply	other threads:[~2006-12-24 14:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-12 14:37 [lm-sensors] [PATCH] ad7418 driver Alessandro Zummo
2006-12-24 11:41 ` Jean Delvare
2006-12-24 13:53 ` Jean Delvare
2006-12-24 14:09 ` Jean Delvare [this message]
2007-03-21 15:24 ` Jean Delvare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061224150935.a8327a03.khali@linux-fr.org \
    --to=khali@linux-fr.org \
    --cc=lm-sensors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.