Re: [PATCH 3/4] liss331d1: accelerometer driver

2010-04-15 Thread Pavel Machek
On Wed 2010-04-14 13:52:00, Alan Cox wrote:
> From: Kalhan Trisal 
> 
> The acceleremeter driver reads the x,y,z coordinate registers and provides
> the information to user through the input layer
> 
> Conversion to input device, clean up and porting of retry fixes needed
> for AAVA done by Alan Cox.

Out of interest, what is AAVA?
Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] liss331d1: accelerometer driver

2010-04-15 Thread Alan Cox
> Err. Anyone get a feeling of deja vu here?
> 
> http://lists.lm-sensors.org/pipermail/lm-sensors/2009-September/026706.html
> 
> When Kalhan originally posted this driver it was pointed out that it
> was compatible with the existing one.  A complete lack of
> communications lead to Kalhan (and someone else, might have been Eric
> or Samu, can't recall) both implementing i2c support in the driver.
> Can't find it right now but I'm fairly sure Kahlan reported that
> worked fine for this chip as well?
> 
> So looks like a lack of communications here and that Alan has picked
> up an unnecessary driver.

Thanks it does indeed - except for the retry logic which has come from
another platform source and can be submitted in turn. Only other thing I
see odd is that the existing driver prints a scary error message when
there is no IRQ rather than just an info message.

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] liss331d1: accelerometer driver

2010-04-15 Thread Jonathan Cameron
On 04/14/10 23:12, Éric Piel wrote:
> Op 14-04-10 14:52, Alan Cox schreef:
>> From: Kalhan Trisal 
>>
>> The acceleremeter driver reads the x,y,z coordinate registers and provides
>> the information to user through the input layer
>>
>> Conversion to input device, clean up and porting of retry fixes needed
>> for AAVA done by Alan Cox.
> Hello,
> 
> I wouldn't want to be too picky, if this driver works fine with your
> hardware and it's tested, why not, but from looking at the spec of this
> chip (and at the code of this driver), it looks like it could be
> completely compatible with the lis3lv02d driver (with lis3lv02d_i2c).
> Same registers, including the WHO_AM_I register which returns 0x3B
> (which is a supported version).
> 
> Have you tried and there were some specific incompatibilities? To me, it
> looks like the only thing not in the lis3lv02d is the read with multiple
> retries, and it could be easily added if necessary for your hardware.
> 
> Cheers,
> Eric
Err. Anyone get a feeling of deja vu here?

http://lists.lm-sensors.org/pipermail/lm-sensors/2009-September/026706.html

When Kalhan originally posted this driver it was pointed out that it was 
compatible
with the existing one.  A complete lack of communications lead to Kalhan (and 
someone
else, might have been Eric or Samu, can't recall) both implementing i2c support
in the driver. Can't find it right now but I'm fairly sure Kahlan reported that 
worked
fine for this chip as well?

So looks like a lack of communications here and that Alan has picked up an 
unnecessary
driver.

Jonathan
> 
>>
>> Signed-off-by: Kalhan Trisal 
>> Signed-off-by: Alan Cox 
>> ---
>>
>>  drivers/hwmon/Kconfig|8 +
>>  drivers/hwmon/Makefile   |1 
>>  drivers/hwmon/lis331dl.c |  286 
>> ++
>>  3 files changed, 295 insertions(+), 0 deletions(-)
>>  create mode 100644 drivers/hwmon/lis331dl.c
>>
>>
>> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
>> index 1fa2533..6868b9d 100644
>> --- a/drivers/hwmon/Kconfig
>> +++ b/drivers/hwmon/Kconfig
>> @@ -1104,6 +1104,14 @@ config SENSORS_ISL29020
>>Range values can be configured using sysfs.
>>Lux data is accessible via sysfs.
>>  
>> +config SENSORS_LIS331DL
>> +tristate "STMicroeletronics LIS331DL three-axis digital accelerometer"
>> +depends on I2C
>> +help
>> +  If you say yes here you get support for the Accelerometer  Devices
>> +  Device can be configured using sysfs.
>> +  x y Z data can be   accessible via sysfs.
>> +
>>  if ACPI
>>  
>>  comment "ACPI drivers"
>> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
>> index 13d6832..ebeb2a2 100644
>> --- a/drivers/hwmon/Makefile
>> +++ b/drivers/hwmon/Makefile
>> @@ -60,6 +60,7 @@ obj-$(CONFIG_SENSORS_K10TEMP)  += k10temp.o
>>  obj-$(CONFIG_SENSORS_LIS3LV02D) += lis3lv02d.o hp_accel.o
>>  obj-$(CONFIG_SENSORS_LIS3_SPI)  += lis3lv02d.o lis3lv02d_spi.o
>>  obj-$(CONFIG_SENSORS_LIS3_I2C)  += lis3lv02d.o lis3lv02d_i2c.o
>> +obj-$(CONFIG_SENSORS_LIS331DL)  += lis331dl.o
>>  obj-$(CONFIG_SENSORS_LM63)  += lm63.o
>>  obj-$(CONFIG_SENSORS_LM70)  += lm70.o
>>  obj-$(CONFIG_SENSORS_LM73)  += lm73.o
>> diff --git a/drivers/hwmon/lis331dl.c b/drivers/hwmon/lis331dl.c
>> new file mode 100644
>> index 000..34009eb
>> --- /dev/null
>> +++ b/drivers/hwmon/lis331dl.c
>> @@ -0,0 +1,286 @@
>> +/*
>> + * lis331dl.c - ST LIS331DL  Accelerometer Driver
>> + *
>> + * Copyright (C) 2009 Intel Corp
>> + *
>> + *  
>> ~~
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License as published by
>> + * the Free Software Foundation; version 2 of the License.
>> + *
>> + * This program is distributed in the hope that it will be useful, but
>> + * WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>> + * General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU General Public License along
>> + * with this program; if not, write to the Free Software Foundation, Inc.,
>> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
>> + * 
>> ~~
>> + *
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +
>> +#define POLL_INTERVAL   50
>> +
>> +struct lis331dl {
>> +struct input_polled_dev *idev;
>> +struct i2c_client *client;
>> +struct mutex update_lock;
>> +};
>> +
>> +static ssize_t data_rate_show(struct device *dev,
>> +struct device_attribute *attr, char *buf)
>> +{
>> +struct i2c_client *client = to_i2c_client(dev);
>> +int val;
>> +int speed = 100;
>> +
>> +val = i2c_smb

Re: [PATCH 3/4] liss331d1: accelerometer driver

2010-04-15 Thread Éric Piel
On 15/04/10 01:05, Neil Brown wrote:
:
> 
> The Openmoko Freerunner has as lis302D which is an SPI version of a very
> similar device, so making the one driver work on that was well would be nice
> if possible.
Definitely!

> 
> The lis302d can detect threshold crossings and taps as well as simple
> orientation and I found it useful to include support for those in the driver
> as well.
> In particular:
>  1/ I allowed the 'data_rate' that was programmed to be any number (including 
> fractions and 0) and the driver would report at that rate, using a timer
> for rates below 50Hz.
> When the app is only interested in long-term change, this can
> significantly reduce the amount of data that has to be handled by
> userspace.
Samu (from Nokia) has started to had such idea via the patch
lis3-setup-poll-interval-limits.patch which in now in the -mm tree. It
allows to specify the polling rate via the input interface
(/sys/devices/platform/lis3lv02d/input/input8/poll). But for now I don't
think the actual refresh rate is updated automatically, it would be a
nice addition.


> 
>  2/ I allowed a 'threshold' to be set so that changes bigger than that get
> notified promptly even if that is faster than the requested data rate
It could be interesting too... but what interface are you using for the
userspace to specify this threshold? A sysfs file?

> 
>  3/ I allowed taps to be detected and reported as BTN_X BTN_Y and BTN_Z
> input events.
This one should now be working with Samu's patch
lis3-interrupt-handlers-for-8bit-wakeup-and-click-events.patch also in
the -mm tree.

> 
> Would it be sensible to include that support in this driver?  The
> LIS331DL seem to have the same threshold and tap support.
So all in all, if you could have a look at what changes are necessary to
get the lis3lv02d driver work with your hardware, it would be great. (I
suspect it should be quite little.)

See you,
Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] liss331d1: accelerometer driver

2010-04-14 Thread Alan Cox
> I wouldn't want to be too picky, if this driver works fine with your
> hardware and it's tested, why not, but from looking at the spec of
> this chip (and at the code of this driver), it looks like it could be
> completely compatible with the lis3lv02d driver (with lis3lv02d_i2c).
> Same registers, including the WHO_AM_I register which returns 0x3B
> (which is a supported version).

I will take a look in detail. The IRQ bit is different and as you say
the retries can be added to it anyway.

> 
> Have you tried and there were some specific incompatibilities? 

I am picking this project up rather than being directly responsible for
its history - chances are nobody has.

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] liss331d1: accelerometer driver

2010-04-14 Thread Neil Brown
On Thu, 15 Apr 2010 00:34:29 +0200
Daniel Mack  wrote:

> On Thu, Apr 15, 2010 at 12:12:21AM +0200, Éric Piel wrote:
> > Op 14-04-10 14:52, Alan Cox schreef:
> > > From: Kalhan Trisal 
> > > 
> > > The acceleremeter driver reads the x,y,z coordinate registers and provides
> > > the information to user through the input layer
> > > 
> > > Conversion to input device, clean up and porting of retry fixes needed
> > > for AAVA done by Alan Cox.
> > Hello,
> > 
> > I wouldn't want to be too picky, if this driver works fine with your
> > hardware and it's tested, why not, but from looking at the spec of this
> > chip (and at the code of this driver), it looks like it could be
> > completely compatible with the lis3lv02d driver (with lis3lv02d_i2c).
> > Same registers, including the WHO_AM_I register which returns 0x3B
> > (which is a supported version).
> > 
> > Have you tried and there were some specific incompatibilities? To me, it
> > looks like the only thing not in the lis3lv02d is the read with multiple
> > retries, and it could be easily added if necessary for your hardware.
> 
> Yes, that would be better. Also because there's also a SPI version of
> the lis331dl. If support for this chip would be incorporated in the
> existing driver, they would automatically be supported as well.
> 

The Openmoko Freerunner has as lis302D which is an SPI version of a very
similar device, so making the one driver work on that was well would be nice
if possible.

The lis302d can detect threshold crossings and taps as well as simple
orientation and I found it useful to include support for those in the driver
as well.
In particular:
 1/ I allowed the 'data_rate' that was programmed to be any number (including 
fractions and 0) and the driver would report at that rate, using a timer
for rates below 50Hz.
When the app is only interested in long-term change, this can
significantly reduce the amount of data that has to be handled by
userspace.

 2/ I allowed a 'threshold' to be set so that changes bigger than that get
notified promptly even if that is faster than the requested data rate

 3/ I allowed taps to be detected and reported as BTN_X BTN_Y and BTN_Z
input events.

Would it be sensible to include that support in this driver?  The
LIS331DL seem to have the same threshold and tap support.

NeilBrown



> Daniel
> 
> 
> > > Signed-off-by: Kalhan Trisal 
> > > Signed-off-by: Alan Cox 
> > > ---
> > > 
> > >  drivers/hwmon/Kconfig|8 +
> > >  drivers/hwmon/Makefile   |1 
> > >  drivers/hwmon/lis331dl.c |  286 
> > > ++
> > >  3 files changed, 295 insertions(+), 0 deletions(-)
> > >  create mode 100644 drivers/hwmon/lis331dl.c
> > > 
> > > 
> > > diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> > > index 1fa2533..6868b9d 100644
> > > --- a/drivers/hwmon/Kconfig
> > > +++ b/drivers/hwmon/Kconfig
> > > @@ -1104,6 +1104,14 @@ config SENSORS_ISL29020
> > > Range values can be configured using sysfs.
> > > Lux data is accessible via sysfs.
> > >  
> > > +config SENSORS_LIS331DL
> > > + tristate "STMicroeletronics LIS331DL three-axis digital accelerometer"
> > > + depends on I2C
> > > + help
> > > +   If you say yes here you get support for the Accelerometer  Devices
> > > +   Device can be configured using sysfs.
> > > +   x y Z data can be   accessible via sysfs.
> > > +
> > >  if ACPI
> > >  
> > >  comment "ACPI drivers"
> > > diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
> > > index 13d6832..ebeb2a2 100644
> > > --- a/drivers/hwmon/Makefile
> > > +++ b/drivers/hwmon/Makefile
> > > @@ -60,6 +60,7 @@ obj-$(CONFIG_SENSORS_K10TEMP)   += k10temp.o
> > >  obj-$(CONFIG_SENSORS_LIS3LV02D) += lis3lv02d.o hp_accel.o
> > >  obj-$(CONFIG_SENSORS_LIS3_SPI)   += lis3lv02d.o lis3lv02d_spi.o
> > >  obj-$(CONFIG_SENSORS_LIS3_I2C)   += lis3lv02d.o lis3lv02d_i2c.o
> > > +obj-$(CONFIG_SENSORS_LIS331DL)   += lis331dl.o
> > >  obj-$(CONFIG_SENSORS_LM63)   += lm63.o
> > >  obj-$(CONFIG_SENSORS_LM70)   += lm70.o
> > >  obj-$(CONFIG_SENSORS_LM73)   += lm73.o
> > > diff --git a/drivers/hwmon/lis331dl.c b/drivers/hwmon/lis331dl.c
> > > new file mode 100644
> > > index 000..34009eb
> > > --- /dev/null
> > > +++ b/drivers/hwmon/lis331dl.c
> > > @@ -0,0 +1,286 @@
> > > +/*
> > > + * lis331dl.c - ST LIS331DL  Accelerometer Driver
> > > + *
> > > + * Copyright (C) 2009 Intel Corp
> > > + *
> > > + *  
> > > ~~
> > > + *
> > > + * This program is free software; you can redistribute it and/or modify
> > > + * it under the terms of the GNU General Public License as published by
> > > + * the Free Software Foundation; version 2 of the License.
> > > + *
> > > + * This program is distributed in the hope that it will be useful, but
> > > + * WITHOUT ANY WARRANTY; without even the implied warranty of
> > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. S

Re: [PATCH 3/4] liss331d1: accelerometer driver

2010-04-14 Thread Daniel Mack
On Thu, Apr 15, 2010 at 12:12:21AM +0200, Éric Piel wrote:
> Op 14-04-10 14:52, Alan Cox schreef:
> > From: Kalhan Trisal 
> > 
> > The acceleremeter driver reads the x,y,z coordinate registers and provides
> > the information to user through the input layer
> > 
> > Conversion to input device, clean up and porting of retry fixes needed
> > for AAVA done by Alan Cox.
> Hello,
> 
> I wouldn't want to be too picky, if this driver works fine with your
> hardware and it's tested, why not, but from looking at the spec of this
> chip (and at the code of this driver), it looks like it could be
> completely compatible with the lis3lv02d driver (with lis3lv02d_i2c).
> Same registers, including the WHO_AM_I register which returns 0x3B
> (which is a supported version).
> 
> Have you tried and there were some specific incompatibilities? To me, it
> looks like the only thing not in the lis3lv02d is the read with multiple
> retries, and it could be easily added if necessary for your hardware.

Yes, that would be better. Also because there's also a SPI version of
the lis331dl. If support for this chip would be incorporated in the
existing driver, they would automatically be supported as well.

Daniel


> > Signed-off-by: Kalhan Trisal 
> > Signed-off-by: Alan Cox 
> > ---
> > 
> >  drivers/hwmon/Kconfig|8 +
> >  drivers/hwmon/Makefile   |1 
> >  drivers/hwmon/lis331dl.c |  286 
> > ++
> >  3 files changed, 295 insertions(+), 0 deletions(-)
> >  create mode 100644 drivers/hwmon/lis331dl.c
> > 
> > 
> > diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> > index 1fa2533..6868b9d 100644
> > --- a/drivers/hwmon/Kconfig
> > +++ b/drivers/hwmon/Kconfig
> > @@ -1104,6 +1104,14 @@ config SENSORS_ISL29020
> >   Range values can be configured using sysfs.
> >   Lux data is accessible via sysfs.
> >  
> > +config SENSORS_LIS331DL
> > +   tristate "STMicroeletronics LIS331DL three-axis digital accelerometer"
> > +   depends on I2C
> > +   help
> > + If you say yes here you get support for the Accelerometer  Devices
> > + Device can be configured using sysfs.
> > + x y Z data can be   accessible via sysfs.
> > +
> >  if ACPI
> >  
> >  comment "ACPI drivers"
> > diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
> > index 13d6832..ebeb2a2 100644
> > --- a/drivers/hwmon/Makefile
> > +++ b/drivers/hwmon/Makefile
> > @@ -60,6 +60,7 @@ obj-$(CONFIG_SENSORS_K10TEMP) += k10temp.o
> >  obj-$(CONFIG_SENSORS_LIS3LV02D) += lis3lv02d.o hp_accel.o
> >  obj-$(CONFIG_SENSORS_LIS3_SPI) += lis3lv02d.o lis3lv02d_spi.o
> >  obj-$(CONFIG_SENSORS_LIS3_I2C) += lis3lv02d.o lis3lv02d_i2c.o
> > +obj-$(CONFIG_SENSORS_LIS331DL) += lis331dl.o
> >  obj-$(CONFIG_SENSORS_LM63) += lm63.o
> >  obj-$(CONFIG_SENSORS_LM70) += lm70.o
> >  obj-$(CONFIG_SENSORS_LM73) += lm73.o
> > diff --git a/drivers/hwmon/lis331dl.c b/drivers/hwmon/lis331dl.c
> > new file mode 100644
> > index 000..34009eb
> > --- /dev/null
> > +++ b/drivers/hwmon/lis331dl.c
> > @@ -0,0 +1,286 @@
> > +/*
> > + * lis331dl.c - ST LIS331DL  Accelerometer Driver
> > + *
> > + * Copyright (C) 2009 Intel Corp
> > + *
> > + *  
> > ~~
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License as published by
> > + * the Free Software Foundation; version 2 of the License.
> > + *
> > + * This program is distributed in the hope that it will be useful, but
> > + * WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> > + * General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU General Public License along
> > + * with this program; if not, write to the Free Software Foundation, Inc.,
> > + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
> > + * 
> > ~~
> > + *
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +
> > +#define POLL_INTERVAL  50
> > +
> > +struct lis331dl {
> > +   struct input_polled_dev *idev;
> > +   struct i2c_client *client;
> > +   struct mutex update_lock;
> > +};
> > +
> > +static ssize_t data_rate_show(struct device *dev,
> > +   struct device_attribute *attr, char *buf)
> > +{
> > +   struct i2c_client *client = to_i2c_client(dev);
> > +   int val;
> > +   int speed = 100;
> > +
> > +   val = i2c_smbus_read_byte_data(client, 0x20);
> > +   if (val & 0x80); /* 1= 400HZ 0= 100HZ */
> > +   speed = 400;
> > +   return sprintf(buf, "%d\n", speed);
> > +}
> > +
> > +static ssize_t power_mode_show(struct device *dev,
> > +   struct device_attribute *attr, char *buf)
> > +{

Re: [PATCH 3/4] liss331d1: accelerometer driver

2010-04-14 Thread Éric Piel
Op 14-04-10 14:52, Alan Cox schreef:
> From: Kalhan Trisal 
> 
> The acceleremeter driver reads the x,y,z coordinate registers and provides
> the information to user through the input layer
> 
> Conversion to input device, clean up and porting of retry fixes needed
> for AAVA done by Alan Cox.
Hello,

I wouldn't want to be too picky, if this driver works fine with your
hardware and it's tested, why not, but from looking at the spec of this
chip (and at the code of this driver), it looks like it could be
completely compatible with the lis3lv02d driver (with lis3lv02d_i2c).
Same registers, including the WHO_AM_I register which returns 0x3B
(which is a supported version).

Have you tried and there were some specific incompatibilities? To me, it
looks like the only thing not in the lis3lv02d is the read with multiple
retries, and it could be easily added if necessary for your hardware.

Cheers,
Eric


> 
> Signed-off-by: Kalhan Trisal 
> Signed-off-by: Alan Cox 
> ---
> 
>  drivers/hwmon/Kconfig|8 +
>  drivers/hwmon/Makefile   |1 
>  drivers/hwmon/lis331dl.c |  286 
> ++
>  3 files changed, 295 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/hwmon/lis331dl.c
> 
> 
> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> index 1fa2533..6868b9d 100644
> --- a/drivers/hwmon/Kconfig
> +++ b/drivers/hwmon/Kconfig
> @@ -1104,6 +1104,14 @@ config SENSORS_ISL29020
> Range values can be configured using sysfs.
> Lux data is accessible via sysfs.
>  
> +config SENSORS_LIS331DL
> + tristate "STMicroeletronics LIS331DL three-axis digital accelerometer"
> + depends on I2C
> + help
> +   If you say yes here you get support for the Accelerometer  Devices
> +   Device can be configured using sysfs.
> +   x y Z data can be   accessible via sysfs.
> +
>  if ACPI
>  
>  comment "ACPI drivers"
> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
> index 13d6832..ebeb2a2 100644
> --- a/drivers/hwmon/Makefile
> +++ b/drivers/hwmon/Makefile
> @@ -60,6 +60,7 @@ obj-$(CONFIG_SENSORS_K10TEMP)   += k10temp.o
>  obj-$(CONFIG_SENSORS_LIS3LV02D) += lis3lv02d.o hp_accel.o
>  obj-$(CONFIG_SENSORS_LIS3_SPI)   += lis3lv02d.o lis3lv02d_spi.o
>  obj-$(CONFIG_SENSORS_LIS3_I2C)   += lis3lv02d.o lis3lv02d_i2c.o
> +obj-$(CONFIG_SENSORS_LIS331DL)   += lis331dl.o
>  obj-$(CONFIG_SENSORS_LM63)   += lm63.o
>  obj-$(CONFIG_SENSORS_LM70)   += lm70.o
>  obj-$(CONFIG_SENSORS_LM73)   += lm73.o
> diff --git a/drivers/hwmon/lis331dl.c b/drivers/hwmon/lis331dl.c
> new file mode 100644
> index 000..34009eb
> --- /dev/null
> +++ b/drivers/hwmon/lis331dl.c
> @@ -0,0 +1,286 @@
> +/*
> + * lis331dl.c - ST LIS331DL  Accelerometer Driver
> + *
> + * Copyright (C) 2009 Intel Corp
> + *
> + *  
> ~~
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; version 2 of the License.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, write to the Free Software Foundation, Inc.,
> + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
> + * ~~
> + *
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +
> +#define POLL_INTERVAL50
> +
> +struct lis331dl {
> + struct input_polled_dev *idev;
> + struct i2c_client *client;
> + struct mutex update_lock;
> +};
> +
> +static ssize_t data_rate_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct i2c_client *client = to_i2c_client(dev);
> + int val;
> + int speed = 100;
> +
> + val = i2c_smbus_read_byte_data(client, 0x20);
> + if (val & 0x80); /* 1= 400HZ 0= 100HZ */
> + speed = 400;
> + return sprintf(buf, "%d\n", speed);
> +}
> +
> +static ssize_t power_mode_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct i2c_client *client = to_i2c_client(dev);
> + int val;
> +
> + val = i2c_smbus_read_byte_data(client, 0x20) & 0x40;
> + if (val == 0x40)
> + val = 1;
> + return sprintf(buf, "%d\n", val);
> +}
> +
> +static int read_with_retries(struct i2c_client *client, int r)
> +{
> + int retries;
> + int ret;
> + 
> + for (retries = 0; retries < 5; retries++) {
> + ret = i2c_smbus_read_byte_data(cl