lkml.org 
[lkml]   [2009]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ds2782 battery gas gauge driver
On Wed, 24 Jun 2009 18:18:34 +0400, Anton Vorontsov wrote:
> On Wed, Jun 17, 2009 at 11:09:08AM +0200, Jean Delvare wrote:
> > Hi Ryan,
> >
> > On Tue, 16 Jun 2009 16:17:35 +1200, Ryan Mallon wrote:
> > > Add support for the the ds2782 standalone I2C gas-gauge.
> > >
> > > Signed-off-by: Ryan Mallon <ryan@bluewatersys.com>
> >
> > I suggest you send this patch to the maintainers of the power supply
> > subsystem for review: Anton Vorontsov and David Woodhouse (Cc'd.)
>
> Thanks for Cc'ing and for the review, Jean.

You're welcome.

> [...]
> > > +static int ds2782_get_temp(struct ds2782_info *info)
> > > +{
> > > + u16 raw;
> > > + s16 temp;
> > > +
> > > + /* Temperature is measured in units of 0.125 degrees celcius */
> > > + raw = ds2782_read_reg16(info, DS2782_REG_TEMP_MSB);
> > > + temp = (raw >> 5) & 0x7ff;
> > > + if (raw & (1 << 15))
> > > + temp |= 0xf800;
> > > + return (temp * 125) / 100;
> > > +}
> >
> > I don't know if the power supply class has a standard to reporting
> > temperature values, but the hwmon class does, and it says that
> > temperatures should be reported in millidegrees C. That's not what you
> > do here AFAICS. It might be convenient to register a hwmon class device
> > and export the temperature there, so that libsensors picks it.
>
> Hwmon feels like a good idea. But no, drivers should not bother
> with registering hwmon classes. Instead, some day we might want to
> create power_supply_hwmon.c interface (like _sysfs.c that we have
> already), the interface would register all needed stuff. And all
> drivers will benefit right away without any modifications.

Sounds like a very good plan indeed.

--
Jean Delvare


\
 
 \ /
  Last update: 2009-06-24 21:49    [W:0.052 / U:2.860 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site