From: Alper Nebi Yasak Date: Thu, 18 Aug 2022 15:24:05 +0000 (+0300) Subject: hwdb: Add Chromebook accel orientation quirks based on sysfs label X-Git-Tag: v252-rc1~415^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fea267f8c71d0edffee5ccbb806755fb626c5e29;p=thirdparty%2Fsystemd.git 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. --- diff --git a/hwdb.d/60-sensor.hwdb b/hwdb.d/60-sensor.hwdb index b8331243c62..a0f870bd0a5 100644 --- a/hwdb.d/60-sensor.hwdb +++ b/hwdb.d/60-sensor.hwdb @@ -413,11 +413,17 @@ sensor:modalias:acpi:KXCJ9000*:dmi:*:bvrZY-8-BI-PX4S70VTR400-X423B-005-D:*:rvnAM # CrOS EC & kernel drivers internally correct for per-board sensor orientations, # but they return values in the inverse direction (Android & W3C specs vs HID). sensor:modalias:platform:cros-ec-accel:* - ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, -1 - sensor:modalias:platform:cros-ec-accel-legacy:* +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 #########################################