Skip to contentSkip to conversation

platform/surface: aggregator_tabletsw: Add support for book mode

PATCH In review Maximilian Luz 2 participants 4 messages May 25, 2023 – May 30, 2023

Subsystems (3)
lore
Share & tools
lore

Maximilian Luz

author maintainer
#0 lore raw

cover platform/surface: aggregator_tabletsw: Add support for book mode

Surface devices with a type-cover have an additional "book" mode. This mode is activated when the device is oriented in portrait mode and the type-cover is in an open position (including completely folded back; unlike in landscape orientation there are no special modes for any of the intermediate positions).

Currently, this mode is unsupported by the tablet switch driver, leading to an error message (see individual commits for the exact messages). Since the keyboard and touchpad input gets deactivated in this mode, map it to tablet-mode.

I've split this change into two patches, one for each of the subsystems (KIP and POS). This a) allows proper attribution via the "Fixes" tag and
b) with that should allow them to be backported fairly easily.

Maximilian Luz (2):
platform/surface: aggregator_tabletsw: Add support for book mode in
KIP subsystem
platform/surface: aggregator_tabletsw: Add support for book mode in
POS subsystem

 drivers/platform/surface/surface_aggregator_tabletsw.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
Signature · 1 line
2.40.1
author maintainer
#1 lore raw

PATCH 1/2 platform/surface: aggregator_tabletsw: Add support for book mode in KIP subsystem

Devices with a type-cover have an additional "book" mode, deactivating type-cover input and turning off its backlight. This is currently unsupported, leading to the warning

surface_aggregator_tablet_mode_switch 01:0e:01:00:01: unknown KIP cover state: 6

Therefore, add support for this state and map it to enable tablet-mode.

Fixes 9f794056db5b ("platform/surface: Add KIP/POS tablet-mode switch driver")
---
 drivers/platform/surface/surface_aggregator_tabletsw.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/platform/surface/surface_aggregator_tabletsw.c +5 -0
index 8f52b62d1c195..4a029f5db20a9 100644
@@ -210,6 +210,7 @@ enum ssam_kip_cover_state {
 	SSAM_KIP_COVER_STATE_LAPTOP        = 0x03,
 	SSAM_KIP_COVER_STATE_FOLDED_CANVAS = 0x04,
 	SSAM_KIP_COVER_STATE_FOLDED_BACK   = 0x05,
+	SSAM_KIP_COVER_STATE_BOOK          = 0x06,
 };
 
 static const char *ssam_kip_cover_state_name(struct ssam_tablet_sw *sw,
@@ -231,6 +232,9 @@ static const char *ssam_kip_cover_state_name(struct ssam_tablet_sw *sw,
 	case SSAM_KIP_COVER_STATE_FOLDED_BACK:
 		return "folded-back";
 
+	case SSAM_KIP_COVER_STATE_BOOK:
+		return "book";
+
 	default:
 		dev_warn(&sw->sdev->dev, "unknown KIP cover state: %u\n", state->state);
 		return "<unknown>";
@@ -244,6 +248,7 @@ static bool ssam_kip_cover_state_is_tablet_mode(struct ssam_tablet_sw *sw,
 	case SSAM_KIP_COVER_STATE_DISCONNECTED:
 	case SSAM_KIP_COVER_STATE_FOLDED_CANVAS:
 	case SSAM_KIP_COVER_STATE_FOLDED_BACK:
+	case SSAM_KIP_COVER_STATE_BOOK:
 		return true;
 
 	case SSAM_KIP_COVER_STATE_CLOSED:
Signature · 1 line
2.40.1
author maintainer
#2 lore raw

PATCH 2/2 platform/surface: aggregator_tabletsw: Add support for book mode in POS subsystem

In reply to Maximilian Luz

Devices with a type-cover have an additional "book" mode, deactivating type-cover input and turning off its backlight. This is currently unsupported, leading to the warning

surface_aggregator_tablet_mode_switch 01:26:01:00:01: unknown device posture for type-cover: 6

Therefore, add support for this state and map it to enable tablet-mode.

Fixes 37ff64cd81ff ("platform/surface: aggregator_tabletsw: Add support for Type-Cover posture source")
---
 drivers/platform/surface/surface_aggregator_tabletsw.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/platform/surface/surface_aggregator_tabletsw.c +5 -0
index 4a029f5db20a9..c0a1a5869246e 100644
@@ -340,6 +340,7 @@ enum ssam_pos_state_cover {
 	SSAM_POS_COVER_LAPTOP        = 0x03,
 	SSAM_POS_COVER_FOLDED_CANVAS = 0x04,
 	SSAM_POS_COVER_FOLDED_BACK   = 0x05,
+	SSAM_POS_COVER_BOOK          = 0x06,
 };
 
 enum ssam_pos_state_sls {
@@ -372,6 +373,9 @@ static const char *ssam_pos_state_name_cover(struct ssam_tablet_sw *sw, u32 stat
 	case SSAM_POS_COVER_FOLDED_BACK:
 		return "folded-back";
 
+	case SSAM_POS_COVER_BOOK:
+		return "book";
+
 	default:
 		dev_warn(&sw->sdev->dev, "unknown device posture for type-cover: %u\n", state);
 		return "<unknown>";
@@ -421,6 +425,7 @@ static bool ssam_pos_state_is_tablet_mode_cover(struct ssam_tablet_sw *sw, u32 s
 	case SSAM_POS_COVER_DISCONNECTED:
 	case SSAM_POS_COVER_FOLDED_CANVAS:
 	case SSAM_POS_COVER_FOLDED_BACK:
+	case SSAM_POS_COVER_BOOK:
 		return true;
 
 	case SSAM_POS_COVER_CLOSED:
Signature · 1 line
2.40.1
#3 lore raw
In reply to Maximilian Luz

Hi,

Quoted 6 lines · Maximilian Luz

Surface devices with a type-cover have an additional "book" mode. This mode is activated when the device is oriented in portrait mode and the type-cover is in an open position (including completely folded back; unlike in landscape orientation there are no special modes for any of the intermediate positions).

Quoted 8 lines

Currently, this mode is unsupported by the tablet switch driver, leading to an error message (see individual commits for the exact messages). Since the keyboard and touchpad input gets deactivated in this mode, map it to tablet-mode.

I've split this change into two patches, one for each of the subsystems (KIP and POS). This a) allows proper attribution via the "Fixes" tag and
b) with that should allow them to be backported fairly easily.

Thank you for your patch series, I've applied this series to my fixes branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=fixes

I will include this series in my next fixes pull-req to Linus for the current kernel development cycle.

Regards,

Hans

Quoted 9 lines

Maximilian Luz (2):
platform/surface: aggregator_tabletsw: Add support for book mode in
KIP subsystem
platform/surface: aggregator_tabletsw: Add support for book mode in
POS subsystem

 drivers/platform/surface/surface_aggregator_tabletsw.c | 10 ++++++++++
 1 file changed, 10 insertions(+)