Re: [PATCH] lis3: add click function

From: Pavel Machek
Date: Thu Jun 11 2009 - 17:08:25 EST


On Thu 2009-06-11 21:55:46, Daniel Mack wrote:
> The LIS3 accelerometer chip has a 'click' feature which can be used to
> detect sudden motion on any of the three axis. Configuration data is
> passed via spi platform_data and no action is taken if that's not
> specified, so it won't harm any existing platform.
>
> To make the configuration effective, the IRQ lines need to be set up
> appropriately. This patch also adds a way to do that from board support
> code.
>
> The DD_* definitions were removed because I couldn't find any reference
> of them in the datasheet and the overlapped with the CLICK_ register
> space.
>
> Signed-off-by: Daniel Mack <daniel@xxxxxxxx>
> Cc: Pavel Machek <pavel@xxxxxx>
> Cc: Eric Piel <eric.piel@xxxxxxxxxxxxxxxx>

Well, patch looks mostly okay, but it would be nice to separate
cleanups onto separate patch...

> index 07ae74b..8d50ef2 100644
> --- a/drivers/hwmon/lis3lv02d_spi.c
> +++ b/drivers/hwmon/lis3lv02d_spi.c
> @@ -66,21 +66,22 @@ static int __devinit lis302dl_spi_probe(struct spi_device *spi)
> if (ret < 0)
> return ret;
>
> - lis3_dev.bus_priv = spi;
> - lis3_dev.init = lis3_spi_init;
> - lis3_dev.read = lis3_spi_read;
> - lis3_dev.write = lis3_spi_write;
> - lis3_dev.irq = spi->irq;
> - lis3_dev.ac = lis3lv02d_axis_normal;
> + lis3_dev.bus_priv = spi;
> + lis3_dev.init = lis3_spi_init;
> + lis3_dev.read = lis3_spi_read;
> + lis3_dev.write = lis3_spi_write;
> + lis3_dev.irq = spi->irq;
> + lis3_dev.ac = lis3lv02d_axis_normal;
> + lis3_dev.pdata = spi->dev.platform_data;
> spi_set_drvdata(spi, &lis3_dev);
>
> - ret = lis3lv02d_init_device(&lis3_dev);
> - return ret;
> + return lis3lv02d_init_device(&lis3_dev);
> }
>
> static int __devexit lis302dl_spi_remove(struct spi_device *spi)
> {
> struct lis3lv02d *lis3 = spi_get_drvdata(spi);
> +
> lis3lv02d_joystick_disable();
> lis3lv02d_poweroff(lis3);
> return 0;

--
(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-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/