public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
@ 2009-02-07  0:48 Giuseppe Bilotta
  2009-02-07 14:47 ` Éric Piel
                   ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Giuseppe Bilotta @ 2009-02-07  0:48 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-kernel, Giuseppe Bilotta

Add support for HP Pavlion dv5 models, whose sensor has an inverted x
axis.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
My HP Pavilion dv5 has an inverted x axis of the accelerometer, so this
patch marks the inversion for all the dv5. I can include the full
dmidecode output if this is deemed necessary.

With the laptop standing still on my desk jstest reports X and Y values
fluctuating from -8k to +8k (more or less). I assume this is normal?

 drivers/hwmon/hp_accel.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c
index abf4dfc..5a379bd 100644
--- a/drivers/hwmon/hp_accel.c
+++ b/drivers/hwmon/hp_accel.c
@@ -179,6 +179,7 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = {
 	AXIS_DMI_MATCH("NC673x", "HP Compaq 673", xy_rotated_left_usd),
 	AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right),
 	AXIS_DMI_MATCH("NC671xx", "HP Compaq 671", xy_swap_yz_inverted),
+	AXIS_DMI_MATCH("HPDV5", "HP Pavilion dv5", x_inverted),
 	{ NULL, }
 /* Laptop models without axis info (yet):
  * "NC6910" "HP Compaq 6910"
-- 
1.6.1.399.g0d272


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-07  0:48 [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models Giuseppe Bilotta
@ 2009-02-07 14:47 ` Éric Piel
  2009-02-07 23:59   ` Giuseppe Bilotta
       [not found]   ` <498E46F2.1020401@gmail.com>
  2009-02-09  9:44 ` Pavel Machek
       [not found] ` <1234191743.3156.2.camel@localhost.localdomain>
  2 siblings, 2 replies; 27+ messages in thread
From: Éric Piel @ 2009-02-07 14:47 UTC (permalink / raw)
  To: Giuseppe Bilotta; +Cc: Pavel Machek, linux-kernel, Palatis Tseng, Andrew Morton

Giuseppe Bilotta schreef:
> Add support for HP Pavlion dv5 models, whose sensor has an inverted x
> axis.
> 
> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Eric Piel <Eric.Piel@tremplin-utc.net>

Looks good.
Andrew, would you mind queuing it?
> ---
> My HP Pavilion dv5 has an inverted x axis of the accelerometer, so this
> patch marks the inversion for all the dv5. I can include the full
> dmidecode output if this is deemed necessary.
> 
> With the laptop standing still on my desk jstest reports X and Y values
> fluctuating from -8k to +8k (more or less). I assume this is normal?
What does "k" stands for? If that's the unit of the joystick output:
yes, that's perfectly normal, just some noise/vibration. If that's 1000,
it's far too much to be normal.

Eric


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-07 14:47 ` Éric Piel
@ 2009-02-07 23:59   ` Giuseppe Bilotta
  2009-02-09  9:47     ` Pavel Machek
       [not found]   ` <498E46F2.1020401@gmail.com>
  1 sibling, 1 reply; 27+ messages in thread
From: Giuseppe Bilotta @ 2009-02-07 23:59 UTC (permalink / raw)
  To: Éric Piel; +Cc: Pavel Machek, linux-kernel, Palatis Tseng, Andrew Morton

On Sat, Feb 7, 2009 at 3:47 PM, Éric Piel <eric.piel@tremplin-utc.net> wrote:
> Giuseppe Bilotta schreef:
>> Add support for HP Pavlion dv5 models, whose sensor has an inverted x
>> axis.
>>
>> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
> Acked-by: Eric Piel <Eric.Piel@tremplin-utc.net>
>
> Looks good.
> Andrew, would you mind queuing it?
>> ---
>> My HP Pavilion dv5 has an inverted x axis of the accelerometer, so this
>> patch marks the inversion for all the dv5. I can include the full
>> dmidecode output if this is deemed necessary.
>>
>> With the laptop standing still on my desk jstest reports X and Y values
>> fluctuating from -8k to +8k (more or less). I assume this is normal?
> What does "k" stands for? If that's the unit of the joystick output:
> yes, that's perfectly normal, just some noise/vibration. If that's 1000,
> it's far too much to be normal.

k is for thousands. I thought it could have been normal because
someone (Pavel?) mentioned the disk park script trigged even if he was
just walking around, so I just assumed the sensor to be extremely
sensible. OTOH the maximum range of the sensor, as reported by jstest,
seems to be -32k to +32k, and 8k is about one forth of it. Considering
sometimes the fluctuations even peak to 12k, there might be something
else at play here. Any suggestions on helping debug the issue are
welcome.





-- 
Giuseppe "Oblomov" Bilotta

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-07  0:48 [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models Giuseppe Bilotta
  2009-02-07 14:47 ` Éric Piel
@ 2009-02-09  9:44 ` Pavel Machek
  2009-02-09  9:50   ` Giuseppe Bilotta
       [not found] ` <1234191743.3156.2.camel@localhost.localdomain>
  2 siblings, 1 reply; 27+ messages in thread
From: Pavel Machek @ 2009-02-09  9:44 UTC (permalink / raw)
  To: Giuseppe Bilotta; +Cc: linux-kernel

> Add support for HP Pavlion dv5 models, whose sensor has an inverted x
> axis.
> 
> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
> ---
> My HP Pavilion dv5 has an inverted x axis of the accelerometer, so this
> patch marks the inversion for all the dv5. I can include the full
> dmidecode output if this is deemed necessary.
> 
> With the laptop standing still on my desk jstest reports X and Y values
> fluctuating from -8k to +8k (more or less). I assume this is normal?

Well, on hp2140 it fluctuates 1000+-500 or so... But Z axis is still
significantly different.

How much is 7 while in "steady state" for you?
								Pavel

>  drivers/hwmon/hp_accel.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/hwmon/hp_accel.c b/drivers/hwmon/hp_accel.c
> index abf4dfc..5a379bd 100644
> --- a/drivers/hwmon/hp_accel.c
> +++ b/drivers/hwmon/hp_accel.c
> @@ -179,6 +179,7 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = {
>  	AXIS_DMI_MATCH("NC673x", "HP Compaq 673", xy_rotated_left_usd),
>  	AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right),
>  	AXIS_DMI_MATCH("NC671xx", "HP Compaq 671", xy_swap_yz_inverted),
> +	AXIS_DMI_MATCH("HPDV5", "HP Pavilion dv5", x_inverted),
>  	{ NULL, }
>  /* Laptop models without axis info (yet):
>   * "NC6910" "HP Compaq 6910"

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-07 23:59   ` Giuseppe Bilotta
@ 2009-02-09  9:47     ` Pavel Machek
  2009-02-09  9:53       ` Giuseppe Bilotta
  0 siblings, 1 reply; 27+ messages in thread
From: Pavel Machek @ 2009-02-09  9:47 UTC (permalink / raw)
  To: Giuseppe Bilotta; +Cc: ?ric Piel, linux-kernel, Palatis Tseng, Andrew Morton

> On Sat, Feb 7, 2009 at 3:47 PM, Éric Piel <eric.piel@tremplin-utc.net> wrote:
> > Giuseppe Bilotta schreef:
> >> Add support for HP Pavlion dv5 models, whose sensor has an inverted x
> >> axis.
> >>
> >> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
> > Acked-by: Eric Piel <Eric.Piel@tremplin-utc.net>
> >
> > Looks good.
> > Andrew, would you mind queuing it?
> >> ---
> >> My HP Pavilion dv5 has an inverted x axis of the accelerometer, so this
> >> patch marks the inversion for all the dv5. I can include the full
> >> dmidecode output if this is deemed necessary.
> >>
> >> With the laptop standing still on my desk jstest reports X and Y values
> >> fluctuating from -8k to +8k (more or less). I assume this is normal?
> > What does "k" stands for? If that's the unit of the joystick output:
> > yes, that's perfectly normal, just some noise/vibration. If that's 1000,
> > it's far too much to be normal.
> 
> k is for thousands. I thought it could have been normal because
> someone (Pavel?) mentioned the disk park script trigged even if he was
> just walking around, so I just assumed the sensor to be extremely

I believe that it is designed to trigger at walking.

> sensible. OTOH the maximum range of the sensor, as reported by jstest,
> seems to be -32k to +32k, and 8k is about one forth of it. Considering
> sometimes the fluctuations even peak to 12k, there might be something
> else at play here. Any suggestions on helping debug the issue are
> welcome.

Ok, at my machine it fluctuates around 1K when sitting on the desk,
and maximum range is about 13-15K. So your values seem little too noisy.

								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-09  9:44 ` Pavel Machek
@ 2009-02-09  9:50   ` Giuseppe Bilotta
  0 siblings, 0 replies; 27+ messages in thread
From: Giuseppe Bilotta @ 2009-02-09  9:50 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-kernel

On Mon, Feb 9, 2009 at 10:44 AM, Pavel Machek <pavel@suse.cz> wrote:
>> Add support for HP Pavlion dv5 models, whose sensor has an inverted x
>> axis.
>>
>> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
>> ---
>> My HP Pavilion dv5 has an inverted x axis of the accelerometer, so this
>> patch marks the inversion for all the dv5. I can include the full
>> dmidecode output if this is deemed necessary.
>>
>> With the laptop standing still on my desk jstest reports X and Y values
>> fluctuating from -8k to +8k (more or less). I assume this is normal?
>
> Well, on hp2140 it fluctuates 1000+-500 or so... But Z axis is still
> significantly different.
>
> How much is 7 while in "steady state" for you?
>                                                                Pavel

Assuming 7 here means Z, the Z axis fluctuates in the + range. All
three axis seem to hold to 4k most of the time (+ or - for X and Y,
only + for Z), with not infrequent peaks of 8k (+ or - for X and Y,
only + for Z), and seldom peaks at around 12k. Z seems to peak to 12k
more often, I only rarely manage to see X or Y peaking so high.

-- 
Giuseppe "Oblomov" Bilotta

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-09  9:47     ` Pavel Machek
@ 2009-02-09  9:53       ` Giuseppe Bilotta
  2009-02-09  9:58         ` Pavel Machek
  0 siblings, 1 reply; 27+ messages in thread
From: Giuseppe Bilotta @ 2009-02-09  9:53 UTC (permalink / raw)
  To: Pavel Machek; +Cc: ?ric Piel, linux-kernel, Palatis Tseng, Andrew Morton

2009/2/9 Pavel Machek <pavel@suse.cz>:
> Ok, at my machine it fluctuates around 1K when sitting on the desk,
> and maximum range is about 13-15K. So your values seem little too noisy.

I suspected as much. Do you think this is a hardware problem, or
something that can be worked around in software? Or maybe I just leave
in a very shaky neighborohood (although there's little or no car
traffic around here) ...

-- 
Giuseppe "Oblomov" Bilotta

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-09  9:53       ` Giuseppe Bilotta
@ 2009-02-09  9:58         ` Pavel Machek
  2009-02-09 11:45           ` Giuseppe Bilotta
  0 siblings, 1 reply; 27+ messages in thread
From: Pavel Machek @ 2009-02-09  9:58 UTC (permalink / raw)
  To: Giuseppe Bilotta; +Cc: ?ric Piel, linux-kernel, Palatis Tseng, Andrew Morton

> 2009/2/9 Pavel Machek <pavel@suse.cz>:
> > Ok, at my machine it fluctuates around 1K when sitting on the desk,
> > and maximum range is about 13-15K. So your values seem little too noisy.
> 
> I suspected as much. Do you think this is a hardware problem, or
> something that can be worked around in software? Or maybe I just leave
> in a very shaky neighborohood (although there's little or no car
> traffic around here) ...

I'd say that the driver is way too new to suspect hardware
problems. Could you try the new version from -mm? It does very minimum
setup, as recommended by HP...
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-09  9:58         ` Pavel Machek
@ 2009-02-09 11:45           ` Giuseppe Bilotta
  2009-02-09 13:33             ` Giuseppe Bilotta
  0 siblings, 1 reply; 27+ messages in thread
From: Giuseppe Bilotta @ 2009-02-09 11:45 UTC (permalink / raw)
  To: Pavel Machek; +Cc: ?ric Piel, linux-kernel, Palatis Tseng, Andrew Morton

On Mon, Feb 9, 2009 at 10:58 AM, Pavel Machek <pavel@suse.cz> wrote:
>> 2009/2/9 Pavel Machek <pavel@suse.cz>:
>> > Ok, at my machine it fluctuates around 1K when sitting on the desk,
>> > and maximum range is about 13-15K. So your values seem little too noisy.
>>
>> I suspected as much. Do you think this is a hardware problem, or
>> something that can be worked around in software? Or maybe I just leave
>> in a very shaky neighborohood (although there's little or no car
>> traffic around here) ...
>
> I'd say that the driver is way too new to suspect hardware
> problems. Could you try the new version from -mm? It does very minimum
> setup, as recommended by HP...

I can try, but I have never worked with the -mm tree, so I don't even
know where to get it. Is there a webpage or archived email I can read
to understand how to get and build the -mm tree? Is it git-tracked? Or
can I just get your patches for -mm and apply them on top of the
current git?

I will try this patch
http://lkml.indiana.edu/hypermail/linux/kernel/0901.2/00164.html in
the mean time, in case that's the patch which is in -mm.

-- 
Giuseppe "Oblomov" Bilotta

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-09 11:45           ` Giuseppe Bilotta
@ 2009-02-09 13:33             ` Giuseppe Bilotta
  2009-02-10 10:10               ` Pavel Machek
  0 siblings, 1 reply; 27+ messages in thread
From: Giuseppe Bilotta @ 2009-02-09 13:33 UTC (permalink / raw)
  To: Pavel Machek; +Cc: ?ric Piel, linux-kernel, Palatis Tseng, Andrew Morton

On Mon, Feb 9, 2009 at 12:45 PM, Giuseppe Bilotta
<giuseppe.bilotta@gmail.com> wrote:
> I will try this patch
> http://lkml.indiana.edu/hypermail/linux/kernel/0901.2/00164.html in
> the mean time, in case that's the patch which is in -mm.

With that patch I still get the same range of fluctuations.

-- 
Giuseppe "Oblomov" Bilotta

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
       [not found] ` <1234191743.3156.2.camel@localhost.localdomain>
@ 2009-02-09 16:50   ` Giuseppe Bilotta
  0 siblings, 0 replies; 27+ messages in thread
From: Giuseppe Bilotta @ 2009-02-09 16:50 UTC (permalink / raw)
  To: Jaswinder Singh Rajput; +Cc: linux-kernel

On Mon, Feb 9, 2009 at 4:02 PM, Jaswinder Singh Rajput
<jaswinder@kernel.org> wrote:
> On Sat, 2009-02-07 at 01:48 +0100, Giuseppe Bilotta wrote:
>> Add support for HP Pavlion dv5 models, whose sensor has an inverted x
>> axis.
>>
> How can I test this patch on HP dv5-1002us laptop.

lspnp (run by root, most likely) should show a device HPQ0004. If it's
present you have the sensor. I also have a big horrible sticker on my
palm rest advertising the protectsmart feature.

(Please use Reply-All)

-- 
Giuseppe "Oblomov" Bilotta

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
       [not found]   ` <498E46F2.1020401@gmail.com>
@ 2009-02-09 23:37     ` Éric Piel
       [not found]       ` <4990DEFD.4010700@gmail.com>
  0 siblings, 1 reply; 27+ messages in thread
From: Éric Piel @ 2009-02-09 23:37 UTC (permalink / raw)
  To: Palatis Tseng; +Cc: giuseppe.bilotta, LKML, Pavel Machek

Palatis Tseng schreef:
> Éric Piel 提到:
>>> With the laptop standing still on my desk jstest reports X and Y values
>>> fluctuating from -8k to +8k (more or less). I assume this is normal?
>> What does "k" stands for? If that's the unit of the joystick output:
>> yes, that's perfectly normal, just some noise/vibration. If that's 1000,
>> it's far too much to be normal.
>>
>> Eric
> "k" is for kilo, which means 1000.
> I verified this and found out that i've made a mistake. following the
> steps in
:
No problem, the patch from Giuseppe will get the axex fine :-)

However, could you let use know if you too, on your laptop, have huge
fluctuations even when the laptop is not moving? Could you give an idea
of the minimum and maximum values of each axis when the laptop is set
normally on the desk without touching it?

Thanks,
Eric

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-09 13:33             ` Giuseppe Bilotta
@ 2009-02-10 10:10               ` Pavel Machek
  2009-02-10 21:39                 ` Giuseppe Bilotta
  0 siblings, 1 reply; 27+ messages in thread
From: Pavel Machek @ 2009-02-10 10:10 UTC (permalink / raw)
  To: Giuseppe Bilotta; +Cc: ?ric Piel, linux-kernel, Palatis Tseng, Andrew Morton

> On Mon, Feb 9, 2009 at 12:45 PM, Giuseppe Bilotta
> <giuseppe.bilotta@gmail.com> wrote:
> > I will try this patch
> > http://lkml.indiana.edu/hypermail/linux/kernel/0901.2/00164.html in
> > the mean time, in case that's the patch which is in -mm.
> 
> With that patch I still get the same range of fluctuations.

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

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
       [not found]       ` <4990DEFD.4010700@gmail.com>
@ 2009-02-10 10:34         ` Éric Piel
  2009-02-10 11:07           ` Giuseppe Bilotta
  0 siblings, 1 reply; 27+ messages in thread
From: Éric Piel @ 2009-02-10 10:34 UTC (permalink / raw)
  To: Palatis Tseng, Giuseppe Bilotta; +Cc: Pavel Machek, LKML

(putting back the cc's, please keep them when answering)

Palatis Tseng schreef:
> Éric Piel 提到:
>> No problem, the patch from Giuseppe will get the axex fine :-)
>>
>> However, could you let use know if you too, on your laptop, have huge
>> fluctuations even when the laptop is not moving? Could you give an idea
>> of the minimum and maximum values of each axis when the laptop is set
>> normally on the desk without touching it?
>>
>> Thanks,
>> Eric
> I took a look at the patch but my axis on dv5 is Y_inverted (instead of
> X_inverted.) i patched my lis3lv02d.c and added:
> 
> === cut here ===
>    AXIS_DMI_MATCH("HPDV5", "HP Pavilion dv5", y_inverted),
> === cut here ===
> 
> and neverball worked just correct with it so i'm kinda sure my patch
> about the axis should be correct.
> 
> i've also tested with x_inverted, but whenever i evaluate the left side
> of my notebook the ball goes to the left side too which is not real-world
> behavier.
> 
> mine is a HP Pavilion dv5 1003ax with AMD PUMA platform.
> `dmidecode | grep "Product Name" says:
> (under "System Information"...)
>    Product Name: HP Pavilion dv5 Notebook PC
Giuseppe,
Palatis mentions that on his laptop the sensor is actually y_inverted.
Could you check your laptop? In particular it would be nice if you could
 describe the values for the four positions defined in the documentation
file. BTW, what is the exact version of your laptop? Is it the same as
Palatis?

Palatis, could you let us know if you also have a lot of "noise" in the
values. That is, if when using jstest /dev/input/js0 you see big changes
in the values. Is it like on Giuseppe's laptop of around 8000?

Moreover I'm wondering if this could be an error on LSB/MSB ordering.
Maybe looking at the raw values (cat
/sys/devices/platform/lis3lv02d/position) would give more insight...

See you,
Eric

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-10 10:34         ` Éric Piel
@ 2009-02-10 11:07           ` Giuseppe Bilotta
  2009-02-10 12:42             ` Éric Piel
  0 siblings, 1 reply; 27+ messages in thread
From: Giuseppe Bilotta @ 2009-02-10 11:07 UTC (permalink / raw)
  To: Éric Piel; +Cc: Palatis Tseng, Pavel Machek, LKML

On Tue, Feb 10, 2009 at 11:34 AM, Éric Piel <eric.piel@tremplin-utc.net> wrote:
> (putting back the cc's, please keep them when answering)
>
> Palatis Tseng schreef:
>> Éric Piel 提到:
>>> No problem, the patch from Giuseppe will get the axex fine :-)
>>>
>>> However, could you let use know if you too, on your laptop, have huge
>>> fluctuations even when the laptop is not moving? Could you give an idea
>>> of the minimum and maximum values of each axis when the laptop is set
>>> normally on the desk without touching it?
>>>
>>> Thanks,
>>> Eric
>> I took a look at the patch but my axis on dv5 is Y_inverted (instead of
>> X_inverted.) i patched my lis3lv02d.c and added:
>>
>> === cut here ===
>>    AXIS_DMI_MATCH("HPDV5", "HP Pavilion dv5", y_inverted),
>> === cut here ===
>>
>> and neverball worked just correct with it so i'm kinda sure my patch
>> about the axis should be correct.
>>
>> i've also tested with x_inverted, but whenever i evaluate the left side
>> of my notebook the ball goes to the left side too which is not real-world
>> behavier.
>>
>> mine is a HP Pavilion dv5 1003ax with AMD PUMA platform.
>> `dmidecode | grep "Product Name" says:
>> (under "System Information"...)
>>    Product Name: HP Pavilion dv5 Notebook PC
> Giuseppe,
> Palatis mentions that on his laptop the sensor is actually y_inverted.
> Could you check your laptop? In particular it would be nice if you could
>  describe the values for the four positions defined in the documentation
> file. BTW, what is the exact version of your laptop? Is it the same as
> Palatis?

With my patch applied:

Left raised: 0 -> 32k
Right raised: 0 -> -32k

Front raised: 1 -> -32k
back raised: 1 -> 32k

Upside down: 2 -> 32k

So it seems that my model inverts the Z axis too, I'll have to fix
that. However, this last test is tricky because unless the laptop is
completely upside down the Z axis can go from -32k to +32k with just a
couple of degrees (around the 90°)

I'll update my patch to invert the X and Z axis for my model.

> Palatis, could you let us know if you also have a lot of "noise" in the
> values. That is, if when using jstest /dev/input/js0 you see big changes
> in the values. Is it like on Giuseppe's laptop of around 8000?
>
> Moreover I'm wondering if this could be an error on LSB/MSB ordering.
> Maybe looking at the raw values (cat
> /sys/devices/platform/lis3lv02d/position) would give more insight...

amd64 architecture here. Laptop flat:

oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
(-256,256,14592)
oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
(0,256,14848)
oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
(-256,256,14848)
oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
(-256,0,14336)
oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
(-256,512,14336)
oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
(256,256,14592)

Left edge raised:
oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
(5120,512,13312)
oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
(5632,512,13312)

You might be onto something.

The dmi for my Pavilion is:

Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: Hewlett-Packard
        Product Name: HP Pavilion dv5 Notebook PC
        Version: F.09
        Serial Number: (x-ed out)
        UUID: (x-ed out)
        Wake-up Type: Power Switch
        SKU Number: (x-ed out)
        Family: 103C_5335KV

So it might be that different pavilions have different sensors?

-- 
Giuseppe "Oblomov" Bilotta

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-10 11:07           ` Giuseppe Bilotta
@ 2009-02-10 12:42             ` Éric Piel
  2009-02-10 20:29               ` Giuseppe Bilotta
  2009-02-10 21:28               ` Giuseppe Bilotta
  0 siblings, 2 replies; 27+ messages in thread
From: Éric Piel @ 2009-02-10 12:42 UTC (permalink / raw)
  To: Giuseppe Bilotta
  Cc: Éric Piel, Palatis Tseng, Pavel Machek, LKML, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 2453 bytes --]

Giuseppe Bilotta schreef:
:
> 
> With my patch applied:
> 
> Left raised: 0 -> 32k
> Right raised: 0 -> -32k
> 
> Front raised: 1 -> -32k
> back raised: 1 -> 32k
> 
> Upside down: 2 -> 32k
> 
> So it seems that my model inverts the Z axis too, I'll have to fix
> that. However, this last test is tricky because unless the laptop is
> completely upside down the Z axis can go from -32k to +32k with just a
> couple of degrees (around the 90°)
> 
> I'll update my patch to invert the X and Z axis for my model.
Let's have a look at this once the "big noise" problem is fixed, because
for now it's rather impossible to deduce anything meaningful.

Andrew, could you drop the patch in the mean time?

> 
>> Palatis, could you let us know if you also have a lot of "noise" in the
>> values. That is, if when using jstest /dev/input/js0 you see big changes
>> in the values. Is it like on Giuseppe's laptop of around 8000?
>>
>> Moreover I'm wondering if this could be an error on LSB/MSB ordering.
>> Maybe looking at the raw values (cat
>> /sys/devices/platform/lis3lv02d/position) would give more insight...
> 
> amd64 architecture here. Laptop flat:
> 
> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
> (-256,256,14592)
> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
> (0,256,14848)
> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
> (-256,256,14848)
> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
> (-256,0,14336)
> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
> (-256,512,14336)
> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
> (256,256,14592)
> 
> Left edge raised:
> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
> (5120,512,13312)
> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
> (5632,512,13312)
> 
> You might be onto something.
Yes, beautiful! All are multiples of 2⁸, so much a sign of MSB/LSB
inversion! And the good news is that the device just happens to have a
register to set the endianess: CTRL2/BLE . For now, in the driver, we
expect the device to be little endian (which is the default according to
the manual). So at initialization we could force the endianess and see
if that fix the problem.

Can you try something like this in lis3lv02d_poweron():
	adev.read(handle, CTRL_REG2, &val);
	val |= CTRL2_BDU | CTRL2_IEN;
+	val &= ~CTRL2_BLE;
	adev.write(handle, CTRL_REG2, val);

Eric



[-- Attachment #2: E_A_B_Piel.vcf --]
[-- Type: text/x-vcard, Size: 380 bytes --]

begin:vcard
fn;quoted-printable:=C3=89ric Piel
n;quoted-printable:Piel;=C3=89ric
org:Technical University of Delft;Software Engineering Research Group
adr:HB 08.080;;Mekelweg 4;Delft;;2628 CD;The Netherlands
email;internet:E.A.B.Piel@tudelft.nl
tel;work:+31 15 278 6338
tel;cell:+31 6 2437 9135
x-mozilla-html:FALSE
url:http://pieleric.free.fr
version:2.1
end:vcard


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-10 12:42             ` Éric Piel
@ 2009-02-10 20:29               ` Giuseppe Bilotta
  2009-02-10 20:31                 ` Giuseppe Bilotta
  2009-02-10 21:28               ` Giuseppe Bilotta
  1 sibling, 1 reply; 27+ messages in thread
From: Giuseppe Bilotta @ 2009-02-10 20:29 UTC (permalink / raw)
  To: Éric Piel
  Cc: Éric Piel, Palatis Tseng, Pavel Machek, LKML, Andrew Morton

On Tue, Feb 10, 2009 at 1:42 PM, Éric Piel <E.A.B.Piel@tudelft.nl> wrote:
> Giuseppe Bilotta schreef:
>> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
>> (-256,256,14592)
>> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
>> (0,256,14848)
>> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
>> (-256,256,14848)
>> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
>> (-256,0,14336)
>> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
>> (-256,512,14336)
>> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
>> (256,256,14592)
>>
>> Left edge raised:
>> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
>> (5120,512,13312)
>> oblomov@oblomov:~$ cat /sys/devices/platform/lis3lv02d/position
>> (5632,512,13312)
>>
>> You might be onto something.
> Yes, beautiful! All are multiples of 2⁸, so much a sign of MSB/LSB
> inversion! And the good news is that the device just happens to have a
> register to set the endianess: CTRL2/BLE . For now, in the driver, we
> expect the device to be little endian (which is the default according to
> the manual). So at initialization we could force the endianess and see
> if that fix the problem.
>
> Can you try something like this in lis3lv02d_poweron():
>        adev.read(handle, CTRL_REG2, &val);
>        val |= CTRL2_BDU | CTRL2_IEN;
> +       val &= ~CTRL2_BLE;
>        adev.write(handle, CTRL_REG2, val);

I reverted both my patch and the 'minimal init' patch from Pavel, then
added this line. However, it seems to change nothing. Even using
CTRL2_BLE instead of its negation doesn't seem to change much: same
fluctuations, and cat'ing the sysfs file still gives 256, 512 etc.


-- 
Giuseppe "Oblomov" Bilotta

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-10 20:29               ` Giuseppe Bilotta
@ 2009-02-10 20:31                 ` Giuseppe Bilotta
  0 siblings, 0 replies; 27+ messages in thread
From: Giuseppe Bilotta @ 2009-02-10 20:31 UTC (permalink / raw)
  To: Éric Piel
  Cc: Éric Piel, Palatis Tseng, Pavel Machek, LKML, Andrew Morton

On Tue, Feb 10, 2009 at 9:29 PM, Giuseppe Bilotta
<giuseppe.bilotta@gmail.com> wrote:
> I reverted both my patch and the 'minimal init' patch from Pavel, then
> added this line. However, it seems to change nothing. Even using
> CTRL2_BLE instead of its negation doesn't seem to change much: same
> fluctuations, and cat'ing the sysfs file still gives 256, 512 etc.

Discard this, I'm an idiot and I'm not doing the testing properly. BRB.

-- 
Giuseppe "Oblomov" Bilotta

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-10 12:42             ` Éric Piel
  2009-02-10 20:29               ` Giuseppe Bilotta
@ 2009-02-10 21:28               ` Giuseppe Bilotta
  2009-02-10 21:33                 ` Giuseppe Bilotta
  1 sibling, 1 reply; 27+ messages in thread
From: Giuseppe Bilotta @ 2009-02-10 21:28 UTC (permalink / raw)
  To: Éric Piel
  Cc: Éric Piel, Palatis Tseng, Pavel Machek, LKML, Andrew Morton

On Tue, Feb 10, 2009 at 1:42 PM, Éric Piel <E.A.B.Piel@tudelft.nl> wrote:
> Can you try something like this in lis3lv02d_poweron():
>        adev.read(handle, CTRL_REG2, &val);
>        val |= CTRL2_BDU | CTRL2_IEN;
> +       val &= ~CTRL2_BLE;
>        adev.write(handle, CTRL_REG2, val);

Ok, this is getting crazier and crazier. Apparently, setting the
CTRL2_BLE bit this way makes no difference, and so does setting it
with val |= (i.e. enabling it): in both cases, if I debug
lis3lv02d_read_16 I always get 0 in the lower byte and something in
the upper byte.

By forcefully swapping lo and hi I actually get very little
fluctuations in the Y and Z axes (so small that jstest doesn't detect
them), but I still get huge (4k) fluctuations in the X axis:
apparently, this axis has very small SIGNED fluctuations around the 0,
which translate to fluctuations between 255 and 1

Now, the lo/hi thing might be solved some other way (e.g. by checking
the BLE bit and relying on its setting instead of trying to force it,
and then swapping hi and lo as needed). But how do we solve the
SIGNEDNESS of lo ?


-- 
Giuseppe "Oblomov" Bilotta

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-10 21:28               ` Giuseppe Bilotta
@ 2009-02-10 21:33                 ` Giuseppe Bilotta
  0 siblings, 0 replies; 27+ messages in thread
From: Giuseppe Bilotta @ 2009-02-10 21:33 UTC (permalink / raw)
  To: Éric Piel
  Cc: Éric Piel, Palatis Tseng, Pavel Machek, LKML, Andrew Morton

On Tue, Feb 10, 2009 at 10:28 PM, Giuseppe Bilotta
<giuseppe.bilotta@gmail.com> wrote:
> On Tue, Feb 10, 2009 at 1:42 PM, Éric Piel <E.A.B.Piel@tudelft.nl> wrote:
>> Can you try something like this in lis3lv02d_poweron():
>>        adev.read(handle, CTRL_REG2, &val);
>>        val |= CTRL2_BDU | CTRL2_IEN;
>> +       val &= ~CTRL2_BLE;
>>        adev.write(handle, CTRL_REG2, val);
>
> Ok, this is getting crazier and crazier. Apparently, setting the
> CTRL2_BLE bit this way makes no difference, and so does setting it
> with val |= (i.e. enabling it): in both cases, if I debug
> lis3lv02d_read_16 I always get 0 in the lower byte and something in
> the upper byte.

To be precise, these are the result I get with some additional debug
info, with and without setting BLE.

Setting BLE on init:

[ 2891.428798] lis3lv02d: BLE: 0
[ 2891.452567] lis3lv02d: BLE: 32
[ 2891.476800] lis3lv02d: lo: 0 hi: 1
[ 2891.500616] lis3lv02d: lo: 0 hi: 3
[ 2891.524799] lis3lv02d: lo: 0 hi: 57

Resetting BLE on init:

[ 3006.661279] lis3lv02d: BLE: 0
[ 3006.684574] lis3lv02d: BLE: 0
[ 3006.709107] lis3lv02d: lo: 0 hi: 254
[ 3006.733144] lis3lv02d: lo: 0 hi: 2
[ 3006.757286] lis3lv02d: lo: 0 hi: 56

So it looks like (1) the BLE register is ignored (at least in my
sensor) and (2) it actually defaults to LE anyway.

-- 
Giuseppe "Oblomov" Bilotta

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-10 10:10               ` Pavel Machek
@ 2009-02-10 21:39                 ` Giuseppe Bilotta
  2009-02-10 22:47                   ` Éric Piel
  2009-02-10 22:48                   ` Giuseppe Bilotta
  0 siblings, 2 replies; 27+ messages in thread
From: Giuseppe Bilotta @ 2009-02-10 21:39 UTC (permalink / raw)
  To: Pavel Machek; +Cc: ?ric Piel, linux-kernel, Palatis Tseng, Andrew Morton

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?

-- 
Giuseppe "Oblomov" Bilotta

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-10 21:39                 ` Giuseppe Bilotta
@ 2009-02-10 22:47                   ` Éric Piel
  2009-02-10 22:48                   ` Giuseppe Bilotta
  1 sibling, 0 replies; 27+ messages in thread
From: Éric Piel @ 2009-02-10 22:47 UTC (permalink / raw)
  To: Giuseppe Bilotta; +Cc: Pavel Machek, linux-kernel, Palatis Tseng, Andrew Morton

Giuseppe Bilotta schreef:
> 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?
It's freely available at the original manufacturer website:
http://www.st.com/stonline/products/literature/ds/11115.htm

Eric

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-10 21:39                 ` Giuseppe Bilotta
  2009-02-10 22:47                   ` Éric Piel
@ 2009-02-10 22:48                   ` Giuseppe Bilotta
  2009-02-10 23:17                     ` Andrew Morton
                                       ` (2 more replies)
  1 sibling, 3 replies; 27+ messages in thread
From: Giuseppe Bilotta @ 2009-02-10 22:48 UTC (permalink / raw)
  To: Pavel Machek; +Cc: ?ric Piel, linux-kernel, Palatis Tseng, Andrew Morton

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.

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.

-- 
Giuseppe "Oblomov" Bilotta

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-10 22:48                   ` Giuseppe Bilotta
@ 2009-02-10 23:17                     ` Andrew Morton
  2009-02-10 23:22                       ` Éric Piel
  2009-02-10 23:17                     ` Éric Piel
  2009-02-10 23:34                     ` Éric Piel
  2 siblings, 1 reply; 27+ messages in thread
From: Andrew Morton @ 2009-02-10 23:17 UTC (permalink / raw)
  To: Giuseppe Bilotta; +Cc: pavel, eric.piel, linux-kernel, palatis

On Tue, 10 Feb 2009 23:48:14 +0100
Giuseppe Bilotta <giuseppe.bilotta@gmail.com> wrote:

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

I've lost the plot here.  I still intend to merge
lis3lv02d-add-axes-knowledge-of-hp-pavilion-dv5-models.patch into
2.6.29.  Someone please stop me if that is wrong.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-10 22:48                   ` Giuseppe Bilotta
  2009-02-10 23:17                     ` Andrew Morton
@ 2009-02-10 23:17                     ` Éric Piel
  2009-02-10 23:34                     ` Éric Piel
  2 siblings, 0 replies; 27+ messages in thread
From: Éric Piel @ 2009-02-10 23:17 UTC (permalink / raw)
  To: Giuseppe Bilotta; +Cc: Pavel Machek, linux-kernel, Palatis Tseng, Andrew Morton

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.
Yeah, we accept also 3Bh for the who_am_i (see in hp_accel.c). The 
reporter who had a laptop with such chip never reported any problem and 
I didn't pay attention enough to notice those chips have only 8bits 
precision.

> 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 probably have a lis202dl (which has only two axes of 8bits each) 
or a LIS302DL (3 axes of 8 bits):
http://www.st.com/stonline/products/literature/ds/13624/lis202dl.htm
http://www.st.com/stonline/products/literature/ds/12726/lis302dl.htm

Unfortunately, the WHO_AM_I register returns 3Bh in both cases. I'd tend 
to imagine it's a three axes chip, but you can confirm that by just 
checking if Z has any meaningful value. You can then modify 
lis3lv02d_read_16() to only return the byte as low byte and the high 
byte as FFh if the high bit of the value is set (because I guess they 
are signed integers). You also have to change MDPS_MAX_VAL to 128, to 
get things completely right.

Once we have this sorted, we should add a flag to know if the current 
device is 8 bits or 12 bits, depending on the value of who_am_i. This 
would allow the driver to work fine with both type of chip.

Eric

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-10 23:17                     ` Andrew Morton
@ 2009-02-10 23:22                       ` Éric Piel
  0 siblings, 0 replies; 27+ messages in thread
From: Éric Piel @ 2009-02-10 23:22 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Giuseppe Bilotta, pavel, linux-kernel, palatis

Andrew Morton schreef:
> On Tue, 10 Feb 2009 23:48:14 +0100
> Giuseppe Bilotta <giuseppe.bilotta@gmail.com> wrote:
> 
>> 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.
>>
>> 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.
>>
> 
> I've lost the plot here.  I still intend to merge
> lis3lv02d-add-axes-knowledge-of-hp-pavilion-dv5-models.patch into
> 2.6.29.  Someone please stop me if that is wrong.
Hi Andrew,
No, let's wait to get things settle down. You can discard the current 
patch. I think we should manage to get it working eventually, but the 
patch will be much bigger...

Eric

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models
  2009-02-10 22:48                   ` Giuseppe Bilotta
  2009-02-10 23:17                     ` Andrew Morton
  2009-02-10 23:17                     ` Éric Piel
@ 2009-02-10 23:34                     ` Éric Piel
  2 siblings, 0 replies; 27+ messages in thread
From: Éric Piel @ 2009-02-10 23:34 UTC (permalink / raw)
  To: Giuseppe Bilotta; +Cc: Pavel Machek, linux-kernel, Palatis Tseng, Andrew Morton

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2009-02-10 23:34 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-07  0:48 [PATCH] lis3lv02d: add axes knowledge of HP Pavilion dv5 models Giuseppe Bilotta
2009-02-07 14:47 ` Éric Piel
2009-02-07 23:59   ` Giuseppe Bilotta
2009-02-09  9:47     ` Pavel Machek
2009-02-09  9:53       ` Giuseppe Bilotta
2009-02-09  9:58         ` Pavel Machek
2009-02-09 11:45           ` Giuseppe Bilotta
2009-02-09 13:33             ` Giuseppe Bilotta
2009-02-10 10:10               ` Pavel Machek
2009-02-10 21:39                 ` Giuseppe Bilotta
2009-02-10 22:47                   ` Éric Piel
2009-02-10 22:48                   ` Giuseppe Bilotta
2009-02-10 23:17                     ` Andrew Morton
2009-02-10 23:22                       ` Éric Piel
2009-02-10 23:17                     ` Éric Piel
2009-02-10 23:34                     ` Éric Piel
     [not found]   ` <498E46F2.1020401@gmail.com>
2009-02-09 23:37     ` Éric Piel
     [not found]       ` <4990DEFD.4010700@gmail.com>
2009-02-10 10:34         ` Éric Piel
2009-02-10 11:07           ` Giuseppe Bilotta
2009-02-10 12:42             ` Éric Piel
2009-02-10 20:29               ` Giuseppe Bilotta
2009-02-10 20:31                 ` Giuseppe Bilotta
2009-02-10 21:28               ` Giuseppe Bilotta
2009-02-10 21:33                 ` Giuseppe Bilotta
2009-02-09  9:44 ` Pavel Machek
2009-02-09  9:50   ` Giuseppe Bilotta
     [not found] ` <1234191743.3156.2.camel@localhost.localdomain>
2009-02-09 16:50   ` Giuseppe Bilotta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox