[PATCH] Motion sensor SPI interface for GTA02

Werner Almesberger werner at openmoko.org
Wed Jan 9 21:22:11 CET 2008

I wrote:
> Thanks ! I'm debugging and cleaning it up now.

I checked in a first round. It doesn't work yet, but it doesn't crash
as badly anymore :-)

I've checked in the original patch as gta02-acc.patch in SVN revision
3799 and my changes as an update in revision 3800, so that it's easier
to see what I've changed.

Your original patch is quite clean, but I'd like to draw your attention
to a three small coding style issues:

- the "defensive programming" in __reg_read and __reg_write actually
  masked an incorrect invocation of __reg_write

- likewise, lis302dl_int_mode would fail silently if given an incorrect
  accelerometer number. (E.g., someone may think we count from 0, not
  1.) There are similar issues in the sysfs set_* functions, which I'll
  fix soon.

- named constants are much easier to read than just plain numbers,
  e.g., READ_BIT vs. 0x80, or the way how CTRL3 is now set

The driver still hangs, but since it's not enabled in our defconfig yet,
we can include the kernel code regardless. I'll continue chasing the
interrupt problem.

- Werner

More information about the openmoko-kernel mailing list