Messages in this thread | | | Date | Wed, 11 Feb 2009 00:34:34 +0100 | From | Éric Piel <> | Subject | Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models |
| |
Giuseppe Bilotta schreef: > On Tue, Feb 10, 2009 at 10:39 PM, Giuseppe Bilotta > <giuseppe.bilotta@gmail.com> wrote: >> On Tue, Feb 10, 2009 at 11:10 AM, Pavel Machek <pavel@suse.cz> wrote: >>> Yeah, that patch. Not sure what to do next... you could grab lis3 >>> manual and see if you can setup chip by hand to get better results... >> As Eric pointed out, it looks definitely like an endianness problem, >> although there are a few strange things which are happening at the >> same time. Is the lis3 manual available online somewhere, or can I >> request it to the mfgr? > > 'k, found it on the STMicroelectronics website. Reading the doc about > LIS3LV02DL I see that WHO_AM_I should return 3Ah, but my sensor > returns 3Bh. I'll see if I find the correct datasheet for this one > instead, it might have info about the differences. Ah, yes, that would explain a lots of things! Your chip is 8bits! The original reporter had not reported anything and I didn't pay attention to this "little" detail when comparing the specs.
> One thing that I noticed is that (modulo axis inversion) I'm able to > use the sensor correctly if I set the thing to only use the high byte, > totally discarding the lower byte: > return *((s8*)(&hi)); > Maybe this sensor needs a different setup to return 12 instead of 8 > bits of information. So you either have the lis302dl or the lis202dl (2 axes only): http://www.st.com/stonline/products/literature/ds/12726/lis302dl.htm http://www.st.com/stonline/products/literature/ds/13624/lis202dl.htm
I'd guess you have the one with 3 axes as all the axes had changing values. More optimistically I'll imagine that no HP laptop has the 2D chip, which unfortunately share the same who_am_i value.
So to get it working you need to change the lis3lv02d_read_16() function to only read the low byte and put the high byte to FFh if the high bit (80h) is set (I guess it's a signed integer). Then for completeness you need to put MDPS_MAX_VAL to 128.
Does it work?
Once this is verified, you should add a flag in the driver for the device to know whether it's 8bits or 12bits. This would be set at initialization according to the who_am_i value.
Eric
| |