platform/surface: aggregator_tabletsw: Properly handle different posture source IDs
authorMaximilian Luz <luzmaximilian@gmail.com>
Sat, 4 Mar 2023 19:46:09 +0000 (20:46 +0100)
committerHans de Goede <hdegoede@redhat.com>
Thu, 16 Mar 2023 13:43:11 +0000 (14:43 +0100)
commitb58a444d7f28ea59fd37a4615e6be86f5d45c880
treed3a76d2ccaf926807bf19b54f2c92e422d7b3cec
parent94227b9c88f3df8ac3025611719cebd125b5981a
platform/surface: aggregator_tabletsw: Properly handle different posture source IDs

The device posture subsystem (POS) can provide different posture
sources. Different sources can provide different posture states and
sources can be identified by their ID.

For example, screen posture of the Surface Laptop Studio (SLS), which is
currently the only supported source, uses a source ID of 0x03. The
Surface Pro 9 uses the same subsystem for its Type-Cover, however,
provides different states for that under the ID 0x00.

To eventually support the Surface Pro 9 and potential future devices, we
need to properly disambiguate between source IDs. Therefore, add the
source ID to the state we carry and determine the tablet-mode state (as
well as state names) based on that.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20230304194611.87770-2-luzmaximilian@gmail.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/surface/surface_aggregator_tabletsw.c