2023-05-25 21:39:36

by Maximilian Luz

[permalink] [raw]
Subject: [PATCH 0/2] 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(+)

--
2.40.1



2023-05-25 21:44:16

by Maximilian Luz

[permalink] [raw]
Subject: [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")
Signed-off-by: Maximilian Luz <[email protected]>
---
drivers/platform/surface/surface_aggregator_tabletsw.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/platform/surface/surface_aggregator_tabletsw.c b/drivers/platform/surface/surface_aggregator_tabletsw.c
index 8f52b62d1c195..4a029f5db20a9 100644
--- a/drivers/platform/surface/surface_aggregator_tabletsw.c
+++ b/drivers/platform/surface/surface_aggregator_tabletsw.c
@@ -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:
--
2.40.1


2023-05-25 21:44:55

by Maximilian Luz

[permalink] [raw]
Subject: [PATCH 2/2] platform/surface: aggregator_tabletsw: Add support for book mode in POS 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: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")
Signed-off-by: Maximilian Luz <[email protected]>
---
drivers/platform/surface/surface_aggregator_tabletsw.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/platform/surface/surface_aggregator_tabletsw.c b/drivers/platform/surface/surface_aggregator_tabletsw.c
index 4a029f5db20a9..c0a1a5869246e 100644
--- a/drivers/platform/surface/surface_aggregator_tabletsw.c
+++ b/drivers/platform/surface/surface_aggregator_tabletsw.c
@@ -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:
--
2.40.1


2023-05-30 09:43:10

by Hans de Goede

[permalink] [raw]
Subject: Re: [PATCH 0/2] platform/surface: aggregator_tabletsw: Add support for book mode

Hi,

On 5/25/23 23:32, Maximilian Luz wrote:
> 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.

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






> 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(+)
>