Re: [PATCH] LIS3LV02Dx Accelerometer driver

From: Pavel Machek
Date: Mon Oct 27 2008 - 05:01:26 EST


Hi!

Thanks for taking the patch...

> > +/* 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?

No, I do not think so. The device is noisy enough that it will
"always" generate a change -- even when sittig on the desktop
quietly. We could switch to interrupt mode but it would just give us
iterrupts at 40Hz.

For harddisk protection it _might_ be possible to do something clever
with threshold comparator on the chip, but... we are not even using
the comparator for now.
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-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/