mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Jean Delvare <khali@linux-fr.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>,
	linux-kernel@vger.kernel.org, lm-sensors@lm-sensors.org
Subject: Re: [lm-sensors] [PATCH 12/22] hwmon: WM831x PMIC hardware monitoring  driver
Date: Mon, 27 Jul 2009 21:46:14 +0100	[thread overview]
Message-ID: <20090727204614.GA4386@sirena.org.uk> (raw)
In-Reply-To: <20090727214419.5a503821@hyperion.delvare>

On Mon, Jul 27, 2009 at 09:44:19PM +0200, Jean Delvare wrote:
> On Mon, 27 Jul 2009 14:46:02 +0100, Mark Brown wrote:

> > +Temperatures are sampled by a 12 bit ADC.  Chip and battery temperatures
> > +are available.  The chip temperature is calculated as:

> > +	Degrees celsius = (512.8 - data) / 1.0983

> The driver code says 512.18.

The code is correct, will update.

> >  obj-$(CONFIG_SENSORS_W83L786NG)	+= w83l786ng.o
> > +obj-$(CONFIG_SENSORS_WM831X)	+= wm831x-hwmon.o

> FWIW, I tend to dislike "x" for digits in driver names. What if a

Neither naming convention is entirely satisfactory; whatever is chosen
will cause hassle or confusion or some point.  It's one of those things
where I do find myself wishing for code names.

> Additionally it is inconsistent with the naming of the WM8350 driver
> below.

Yes, the WM8350 drivers (well, most of it) predate the WM8351 and
WM8352.

> > +	/* The conversion depends on the battery, leave to userspace */
> > +	return sprintf(buf, "%d\n", ret);
> > +}

> This is a problem. You are not supposed to return raw register values through
> the sysfs interface. Returning the voltage reading at the chip's pin is
> OK because you still return a voltage value. But a raw register value is
> not something the user should see. I agree that technically speaking, a
> good sensors.conf configuration file would work it out, but
> conceptually this is wrong.

Hrm, OK.  There's a potential small loss of accuracy from converting to
a voltage since the voltages are reported as milivolts but it is just a
simple multiplier.

> Can you say more about these batteries and how temperature measurement
> is different between them? If you can export a voltage reading to
> userspace than that would be OK (as I recall, we have at least one
> driver doing that already.)

Not really; it's intended to be a NTC thermistor but the driver is
rather at the mercy of the battery and any other external components
that the board has added.  I'll convert to reporting as a voltage for
consistency with the ABI.

> > +#define WM831X_NAMED_VOLTAGE(id, name) \
> > +	static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage,\
> > +				  NULL, name);		\
> 
> I guess you could just call WM831X_VOLTAGE(id, name).

That clashes with the unnamed voltage above.  I could also call them
_NAMED and _UNNAMED, I suppose.

I've fixed all your other issues, will repost tomorrow.

  reply	other threads:[~2009-07-27 20:46 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-27 13:45 [PATCH 0/22] WM831x drivers Mark Brown
2009-07-27 13:45 ` [PATCH 01/22] mfd: Allow multiple MFD cells with the same name Mark Brown
2009-07-27 13:45 ` [PATCH 02/22] mfd: Initial core support for WM831x series devices Mark Brown
2009-07-27 15:00   ` [PATCH] mfd: Fix comment cut'n'paste in register lock code Mark Brown
2009-07-27 13:45 ` [PATCH 03/22] mfd: Add WM831x interrupt support Mark Brown
2009-07-27 13:45 ` [PATCH 04/22] mfd: Add WM831x AUXADC support Mark Brown
2009-07-27 13:45 ` [PATCH 05/22] mfd: Conditionally add WM831x backlight subdevice Mark Brown
2009-07-27 13:45 ` [PATCH 06/22] mfd: Add basic WM831x OTP support Mark Brown
2009-07-27 13:45 ` [PATCH 07/22] mfd: Export ISEL values from WM831x core Mark Brown
2009-07-27 13:45 ` [PATCH 08/22] mfd: Hook WM831x into build system Mark Brown
2009-07-27 13:45 ` [PATCH 09/22] backlight: Add WM831x backlight driver Mark Brown
2009-07-27 13:46 ` [PATCH 10/22] gpio: Add WM831X GPIO driver Mark Brown
2009-07-27 20:27   ` David Brownell
2009-07-27 13:46 ` [PATCH 11/22] hwmon: Add WM835x PMIC hardware monitoring driver Mark Brown
2009-07-27 13:46 ` [PATCH 12/22] hwmon: WM831x " Mark Brown
2009-07-27 19:44   ` [lm-sensors] " Jean Delvare
2009-07-27 20:46     ` Mark Brown [this message]
2009-07-28  7:26       ` Jean Delvare
2009-07-28 14:11   ` [PATCH] " Mark Brown
2009-07-28 14:26     ` Jean Delvare
2009-07-28 14:50       ` Mark Brown
2009-07-28 14:52         ` Mark Brown
2009-08-04 11:33         ` Samuel Ortiz
2009-08-04 11:53           ` Jean Delvare
2009-07-27 13:46 ` [PATCH 13/22] Input: Add support for the WM831x ON pin Mark Brown
2009-07-27 15:38   ` Dmitry Torokhov
2009-07-27 15:41     ` Mark Brown
2009-07-28 14:13   ` [PATCH] " Mark Brown
2009-07-27 13:46 ` [PATCH 14/22] leds: Add WM831x status LED driver Mark Brown
2009-07-27 13:46 ` [PATCH 15/22] power_supply: Add driver for the PMU on WM831x PMICs Mark Brown
2009-07-27 13:46 ` [PATCH 16/22] regulator: Add WM831x DC-DC buck convertor support Mark Brown
2009-07-28 14:21   ` [PATCH 17/23] " Mark Brown
2009-07-27 13:46 ` [PATCH 17/22] regulator: Add WM831x LDO support Mark Brown
2009-07-28 14:22   ` [PATCH 18/23] " Mark Brown
2009-07-27 13:46 ` [PATCH 18/22] regulator: Add WM831x EPE support Mark Brown
2009-07-28 14:22   ` [PATCH 19/23] " Mark Brown
2009-07-27 13:46 ` [PATCH 19/22] regulator: Add WM831x DC-DC boost convertor support Mark Brown
2009-07-28 14:23   ` [PATCH] " Mark Brown
2009-07-27 13:46 ` [PATCH 20/22] regulator: Add WM831x ISINK support Mark Brown
2009-07-28 14:23   ` [PATCH] " Mark Brown
2009-07-27 13:46 ` [PATCH 21/22] RTC: Add support for RTCs on Wolfson WM831x devices Mark Brown
2009-07-28 14:18   ` [PATCH] " Mark Brown
2009-07-27 13:46 ` [PATCH 22/22] [WATCHDOG] Add support for WM831x watchdog Mark Brown
2009-08-04 11:35 ` [PATCH 0/22] WM831x drivers Samuel Ortiz
2009-08-04 11:44   ` Liam Girdwood
2009-08-04 14:07     ` Samuel Ortiz

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=20090727204614.GA4386@sirena.org.uk \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=sameo@linux.intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome