8d419f
From f06a6ff8b3dba8ba48ca5bb6ebaa04a86b4c06d6 Mon Sep 17 00:00:00 2001
8d419f
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
8d419f
Date: Wed, 10 Aug 2022 22:09:32 +0300
8d419f
Subject: [PATCH] hwdb: Apply existing accel orientation quirk to all
8d419f
 Chromebooks
8d419f
8d419f
The cros-ec-accel and cros-ec-accel-legacy kernel modules internally
8d419f
correct for the board-specific accelerometer mounting orientations.
8d419f
Their sensor outputs are in a standard reference frame consistent across
8d419f
different boards, so the orientation matrix already added for a number
8d419f
of devices should apply to every device using cros-ec accelerometers.
8d419f
The different matrix for the 'Nocturne' board seems to be an error.
8d419f
8d419f
Replace the existing hwdb rules for select Chromebooks with generic
8d419f
rules that apply to all Chromebooks.
8d419f
8d419f
(cherry picked from commit 1800f7098a3e91a1d28697ef11a15e4b4193d21f)
8d419f
8d419f
Related: #2087778
8d419f
---
8d419f
 hwdb.d/60-sensor.hwdb | 22 ++++------------------
8d419f
 1 file changed, 4 insertions(+), 18 deletions(-)
8d419f
8d419f
diff --git a/hwdb.d/60-sensor.hwdb b/hwdb.d/60-sensor.hwdb
8d419f
index 1c3f6b62bb..7978675943 100644
8d419f
--- a/hwdb.d/60-sensor.hwdb
8d419f
+++ b/hwdb.d/60-sensor.hwdb
8d419f
@@ -406,27 +406,13 @@ sensor:modalias:acpi:KXCJ9000*:dmi:*:bvrZY-8-BI-PX4S70VTR400-X423B-005-D:*:rvnAM
8d419f
 #########################################
8d419f
 # Google Chromebooks
8d419f
 #########################################
8d419f
-sensor:modalias:platform:cros-ec-accel:dmi:*:svnGOOGLE:*
8d419f
- ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, -1
8d419f
-
8d419f
-# caroline board (Samsung Chromebook Pro) reports itself as svnGoogle
8d419f
-sensor:modalias:platform:cros-ec-accel:dmi:*:svnGoogle:pnCaroline*:*
8d419f
- ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, -1
8d419f
-
8d419f
-# Dell Inspiron Chromebook 14 2-in-1
8d419f
-sensor:modalias:platform:cros-ec-accel:dmi:*svnGoogle:pnVayne*:*
8d419f
- ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, -1
8d419f
-
8d419f
-# nocturne board (Google Pixel Slate)
8d419f
-sensor:modalias:platform:cros-ec-accel:dmi:*Google_Nocturne*:*
8d419f
- ACCEL_MOUNT_MATRIX=1, 0, 0; 0, -1, 0; 0, 0, 1
8d419f
 
8d419f
-# rammus board (Asus Chromebook Flip C433)
8d419f
-sensor:modalias:platform:cros-ec-accel:dmi:*svnGoogle:pnRammus*:*
8d419f
+# CrOS EC & kernel drivers internally correct for per-board sensor orientations,
8d419f
+# but they return values in the inverse direction (Android & W3C specs vs HID).
8d419f
+sensor:modalias:platform:cros-ec-accel:*
8d419f
  ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, -1
8d419f
 
8d419f
-# Lenovo ThinkPad C13 Yoga
8d419f
-sensor:modalias:platform:cros-ec-accel:dmi:*svnGoogle:pnMorphius*:*
8d419f
+sensor:modalias:platform:cros-ec-accel-legacy:*
8d419f
  ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, -1
8d419f
 
8d419f
 #########################################