hwdb: Add Chromebook accel orientation quirks based on sysfs label

The base-mounted accelerometer on Chromebooks return values same as the
display when the lid angle is 180 degrees, instead of when the lid is
closed. To match userspace expectations we must further rotate the
existing accelerometer mounting matrix by 180 degrees around the X axis:

    [[-1,  0,  0],    [[ 1,  0,  0],    [[-1,  0,  0],
     [ 0, -1,  0],  X  [ 0, -1,  0],  =  [ 0,  1,  0],
     [ 0,  0, -1]]     [ 0,  0, -1]]     [ 0,  0,  1]]

A previous commit lets us distinguish between the two cros-ec-accel
devices on these boards by their 'label' sysfs file. Add hwdb entries
that make base-mounted accelerometers use this correct matrix, and
display-mounted ones use the existing one.

Note that the cros-ec-accel drivers use 'label' only since Linux v6.0.
The old match strings are not removed to support older kernels, even
though they are only correct for the display-mounted sensor.

systemd-commit fea267f8c71d0edffee5ccbb806755fb626c5e29
Author: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Date:   Thu Aug 18 18:24:05 2022 +0300
This commit is contained in:
Boian Bonev 2022-09-22 01:28:34 +03:00
parent fa741e87a8
commit 9f366b943d
No known key found for this signature in database
GPG Key ID: 1365720913D2F22D
1 changed files with 11 additions and 0 deletions

View File

@ -402,6 +402,17 @@ sensor:modalias:platform:cros-ec-accel:dmi:*svnGoogle:pnVayne*:*
sensor:modalias:platform:cros-ec-accel:dmi:*Google_Nocturne*:* sensor:modalias:platform:cros-ec-accel:dmi:*Google_Nocturne*:*
ACCEL_MOUNT_MATRIX=1, 0, 0; 0, -1, 0; 0, 0, 1 ACCEL_MOUNT_MATRIX=1, 0, 0; 0, -1, 0; 0, 0, 1
sensor:modalias:platform:cros-ec-accel:*
sensor:accel-display:modalias:platform:cros-ec-accel:*
sensor:accel-display:modalias:platform:cros-ec-accel-legacy:*
ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, -1
# Base accel reports the same as display when lid angle is 180 degrees (vs 0),
# so it needs an additional 180 degree rotation around the X axis.
sensor:accel-base:modalias:platform:cros-ec-accel:*
sensor:accel-base:modalias:platform:cros-ec-accel-legacy:*
ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, 1, 0; 0, 0, 1
######################################### #########################################
# GP-electronic # GP-electronic
######################################### #########################################