Re: [PATCH] LIS3LV02Dx Accelerometer driver

From: Andrew Morton
Date: Mon Oct 27 2008 - 02:39:36 EST


On Wed, 22 Oct 2008 17:44:59 +0200 Pavel Machek <pavel@xxxxxxx> wrote:

>
> LIS3LV02Dx Accelerometer driver
>
> This adds a driver to the accelerometer sensor found in several HP
> laptops (under the commercial names of "HP Mobile Data Protection
> System 3D" and "HP 3D driveguard"). It tries to have more or less the
> same interfaces as the hdaps and other accelerometer drivers: in sysfs
> and as a joystick.
>
> This driver was first written by Yan Burman. Eric Piel has updated it
> and slimed it up (including the removal of an interface to access to
> the free-fall feature of the sensor because it is not reliable enough
> for now). Pavel Machek removed few more features and switched locking
> from semaphore to mutex.
>
> Several people have contributed to the database of the axes.
>
> ...
>
> +/* joystick device poll interval in milliseconds */
> +#define MDPS_POLL_INTERVAL 50
>
> ...
>
> +static int lis3lv02d_joystick_kthread(void *data)
> +{
> + int x, y, z;
> +
> + while (!kthread_should_stop()) {
> + lis3lv02d_get_xyz(adev.device->handle, &x, &y, &z);
> + input_report_abs(adev.idev, ABS_X, x - adev.xcalib);
> + input_report_abs(adev.idev, ABS_Y, y - adev.ycalib);
> + input_report_abs(adev.idev, ABS_Z, z - adev.zcalib);
> +
> + input_sync(adev.idev);
> +
> + try_to_freeze();
> + msleep_interruptible(MDPS_POLL_INTERVAL);

You'll have the powertop police on your tail.

Is there no alternative?

> + }
> +
> + return 0;
> +}

--
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/