|
@@ -1,4 +1,4 @@
|
|
|
-From 4129a676dcdfa0675585e33858389e1f6a982995 Mon Sep 17 00:00:00 2001
|
|
|
+From 47a59a35c30490ec8a9f2204dbbd61fff55ec636 Mon Sep 17 00:00:00 2001
|
|
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
Date: Sat, 4 Mar 2023 20:09:36 +0100
|
|
|
Subject: [PATCH] platform/surface: aggregator_tabletsw: Properly handle
|
|
@@ -25,7 +25,7 @@ Patchset: surface-sam
|
|
|
1 file changed, 84 insertions(+), 39 deletions(-)
|
|
|
|
|
|
diff --git a/drivers/platform/surface/surface_aggregator_tabletsw.c b/drivers/platform/surface/surface_aggregator_tabletsw.c
|
|
|
-index 9fed800c7cc0..e8682f52558f 100644
|
|
|
+index a18e9fc7896b..f9a58db6afde 100644
|
|
|
--- a/drivers/platform/surface/surface_aggregator_tabletsw.c
|
|
|
+++ b/drivers/platform/surface/surface_aggregator_tabletsw.c
|
|
|
@@ -20,16 +20,23 @@
|
|
@@ -112,8 +112,8 @@ index 9fed800c7cc0..e8682f52558f 100644
|
|
|
input_set_capability(sw->mode_switch, EV_SW, SW_TABLET_MODE);
|
|
|
input_report_switch(sw->mode_switch, SW_TABLET_MODE, tablet);
|
|
|
|
|
|
-@@ -203,9 +212,10 @@ enum ssam_kip_cover_state {
|
|
|
- SSAM_KIP_COVER_STATE_FOLDED_BACK = 0x05,
|
|
|
+@@ -204,9 +213,10 @@ enum ssam_kip_cover_state {
|
|
|
+ SSAM_KIP_COVER_STATE_BOOK = 0x06,
|
|
|
};
|
|
|
|
|
|
-static const char *ssam_kip_cover_state_name(struct ssam_tablet_sw *sw, u32 state)
|
|
@@ -125,8 +125,8 @@ index 9fed800c7cc0..e8682f52558f 100644
|
|
|
case SSAM_KIP_COVER_STATE_DISCONNECTED:
|
|
|
return "disconnected";
|
|
|
|
|
|
-@@ -222,14 +232,15 @@ static const char *ssam_kip_cover_state_name(struct ssam_tablet_sw *sw, u32 stat
|
|
|
- return "folded-back";
|
|
|
+@@ -226,14 +236,15 @@ static const char *ssam_kip_cover_state_name(struct ssam_tablet_sw *sw, u32 stat
|
|
|
+ return "book";
|
|
|
|
|
|
default:
|
|
|
- dev_warn(&sw->sdev->dev, "unknown KIP cover state: %u\n", state);
|
|
@@ -144,7 +144,7 @@ index 9fed800c7cc0..e8682f52558f 100644
|
|
|
case SSAM_KIP_COVER_STATE_DISCONNECTED:
|
|
|
case SSAM_KIP_COVER_STATE_FOLDED_CANVAS:
|
|
|
case SSAM_KIP_COVER_STATE_FOLDED_BACK:
|
|
|
-@@ -240,7 +251,7 @@ static bool ssam_kip_cover_state_is_tablet_mode(struct ssam_tablet_sw *sw, u32 s
|
|
|
+@@ -245,7 +256,7 @@ static bool ssam_kip_cover_state_is_tablet_mode(struct ssam_tablet_sw *sw, u32 s
|
|
|
return false;
|
|
|
|
|
|
default:
|
|
@@ -153,7 +153,7 @@ index 9fed800c7cc0..e8682f52558f 100644
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
-@@ -252,7 +263,7 @@ SSAM_DEFINE_SYNC_REQUEST_R(__ssam_kip_get_cover_state, u8, {
|
|
|
+@@ -257,7 +268,7 @@ SSAM_DEFINE_SYNC_REQUEST_R(__ssam_kip_get_cover_state, u8, {
|
|
|
.instance_id = 0x00,
|
|
|
});
|
|
|
|
|
@@ -162,7 +162,7 @@ index 9fed800c7cc0..e8682f52558f 100644
|
|
|
{
|
|
|
int status;
|
|
|
u8 raw;
|
|
|
-@@ -263,7 +274,8 @@ static int ssam_kip_get_cover_state(struct ssam_tablet_sw *sw, u32 *state)
|
|
|
+@@ -268,7 +279,8 @@ static int ssam_kip_get_cover_state(struct ssam_tablet_sw *sw, u32 *state)
|
|
|
return status;
|
|
|
}
|
|
|
|
|
@@ -172,7 +172,7 @@ index 9fed800c7cc0..e8682f52558f 100644
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-@@ -312,11 +324,15 @@ MODULE_PARM_DESC(tablet_mode_in_slate_state, "Enable tablet mode in slate device
|
|
|
+@@ -317,11 +329,15 @@ MODULE_PARM_DESC(tablet_mode_in_slate_state, "Enable tablet mode in slate device
|
|
|
#define SSAM_EVENT_POS_CID_POSTURE_CHANGED 0x03
|
|
|
#define SSAM_POS_MAX_SOURCES 4
|
|
|
|
|
@@ -193,7 +193,7 @@ index 9fed800c7cc0..e8682f52558f 100644
|
|
|
};
|
|
|
|
|
|
struct ssam_sources_list {
|
|
|
-@@ -324,42 +340,68 @@ struct ssam_sources_list {
|
|
|
+@@ -329,42 +345,68 @@ struct ssam_sources_list {
|
|
|
__le32 id[SSAM_POS_MAX_SOURCES];
|
|
|
} __packed;
|
|
|
|
|
@@ -274,7 +274,7 @@ index 9fed800c7cc0..e8682f52558f 100644
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
-@@ -450,9 +492,10 @@ static int ssam_pos_get_posture_for_source(struct ssam_tablet_sw *sw, u32 source
|
|
|
+@@ -455,9 +497,10 @@ static int ssam_pos_get_posture_for_source(struct ssam_tablet_sw *sw, u32 source
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -286,7 +286,7 @@ index 9fed800c7cc0..e8682f52558f 100644
|
|
|
int status;
|
|
|
|
|
|
status = ssam_pos_get_source(sw, &source_id);
|
|
|
-@@ -461,13 +504,15 @@ static int ssam_pos_get_posture(struct ssam_tablet_sw *sw, u32 *state)
|
|
|
+@@ -466,13 +509,15 @@ static int ssam_pos_get_posture(struct ssam_tablet_sw *sw, u32 *state)
|
|
|
return status;
|
|
|
}
|
|
|
|
|
@@ -306,7 +306,7 @@ index 9fed800c7cc0..e8682f52558f 100644
|
|
|
--
|
|
|
2.41.0
|
|
|
|
|
|
-From d6efb411d97b392a4967157b5c1e2768e2348bc9 Mon Sep 17 00:00:00 2001
|
|
|
+From 57a06f3b8986e92ffe56c063efb95329a41f9208 Mon Sep 17 00:00:00 2001
|
|
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
Date: Sun, 19 Feb 2023 23:33:43 +0100
|
|
|
Subject: [PATCH] platform/surface: aggregator_tabletsw: Add support for
|
|
@@ -322,10 +322,10 @@ Patchset: surface-sam
|
|
|
1 file changed, 57 insertions(+)
|
|
|
|
|
|
diff --git a/drivers/platform/surface/surface_aggregator_tabletsw.c b/drivers/platform/surface/surface_aggregator_tabletsw.c
|
|
|
-index e8682f52558f..8f52b62d1c19 100644
|
|
|
+index f9a58db6afde..4a029f5db20a 100644
|
|
|
--- a/drivers/platform/surface/surface_aggregator_tabletsw.c
|
|
|
+++ b/drivers/platform/surface/surface_aggregator_tabletsw.c
|
|
|
-@@ -325,9 +325,18 @@ MODULE_PARM_DESC(tablet_mode_in_slate_state, "Enable tablet mode in slate device
|
|
|
+@@ -330,9 +330,18 @@ MODULE_PARM_DESC(tablet_mode_in_slate_state, "Enable tablet mode in slate device
|
|
|
#define SSAM_POS_MAX_SOURCES 4
|
|
|
|
|
|
enum ssam_pos_source_id {
|
|
@@ -344,7 +344,7 @@ index e8682f52558f..8f52b62d1c19 100644
|
|
|
enum ssam_pos_state_sls {
|
|
|
SSAM_POS_SLS_LID_CLOSED = 0x00,
|
|
|
SSAM_POS_SLS_LAPTOP = 0x01,
|
|
|
-@@ -340,6 +349,30 @@ struct ssam_sources_list {
|
|
|
+@@ -345,6 +354,30 @@ struct ssam_sources_list {
|
|
|
__le32 id[SSAM_POS_MAX_SOURCES];
|
|
|
} __packed;
|
|
|
|
|
@@ -375,7 +375,7 @@ index e8682f52558f..8f52b62d1c19 100644
|
|
|
static const char *ssam_pos_state_name_sls(struct ssam_tablet_sw *sw, u32 state)
|
|
|
{
|
|
|
switch (state) {
|
|
|
-@@ -365,6 +398,9 @@ static const char *ssam_pos_state_name(struct ssam_tablet_sw *sw,
|
|
|
+@@ -370,6 +403,9 @@ static const char *ssam_pos_state_name(struct ssam_tablet_sw *sw,
|
|
|
const struct ssam_tablet_sw_state *state)
|
|
|
{
|
|
|
switch (state->source) {
|
|
@@ -385,7 +385,7 @@ index e8682f52558f..8f52b62d1c19 100644
|
|
|
case SSAM_POS_SOURCE_SLS:
|
|
|
return ssam_pos_state_name_sls(sw, state->state);
|
|
|
|
|
|
-@@ -374,6 +410,24 @@ static const char *ssam_pos_state_name(struct ssam_tablet_sw *sw,
|
|
|
+@@ -379,6 +415,24 @@ static const char *ssam_pos_state_name(struct ssam_tablet_sw *sw,
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -410,7 +410,7 @@ index e8682f52558f..8f52b62d1c19 100644
|
|
|
static bool ssam_pos_state_is_tablet_mode_sls(struct ssam_tablet_sw *sw, u32 state)
|
|
|
{
|
|
|
switch (state) {
|
|
|
-@@ -397,6 +451,9 @@ static bool ssam_pos_state_is_tablet_mode(struct ssam_tablet_sw *sw,
|
|
|
+@@ -402,6 +456,9 @@ static bool ssam_pos_state_is_tablet_mode(struct ssam_tablet_sw *sw,
|
|
|
const struct ssam_tablet_sw_state *state)
|
|
|
{
|
|
|
switch (state->source) {
|
|
@@ -423,7 +423,7 @@ index e8682f52558f..8f52b62d1c19 100644
|
|
|
--
|
|
|
2.41.0
|
|
|
|
|
|
-From 24d73d4825bc34a93fc70a3cf242f5fc51816158 Mon Sep 17 00:00:00 2001
|
|
|
+From 56a23672142f7435662e91125ca30d20ae3099c6 Mon Sep 17 00:00:00 2001
|
|
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
Date: Sun, 19 Feb 2023 23:41:18 +0100
|
|
|
Subject: [PATCH] platform/surface: aggregator_registry: Add support for
|
|
@@ -454,67 +454,7 @@ index 296f72d52e6a..0fe5be539652 100644
|
|
|
--
|
|
|
2.41.0
|
|
|
|
|
|
-From c4f4c58d333db46428f0f116b559d1b80187a548 Mon Sep 17 00:00:00 2001
|
|
|
-From: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
-Date: Wed, 3 May 2023 02:02:21 +0200
|
|
|
-Subject: [PATCH] platform/surface: aggregator: Allow completion work-items to
|
|
|
- be executed in parallel
|
|
|
-
|
|
|
-Currently, event completion work-items are restricted to be run strictly
|
|
|
-in non-parallel fashion by the respective workqueue. However, this has
|
|
|
-lead to some problems:
|
|
|
-
|
|
|
-In some instances, the event notifier function called inside this
|
|
|
-completion workqueue takes a non-negligible amount of time to execute.
|
|
|
-One such example is the battery event handling code (surface_battery.c),
|
|
|
-which can result in a full battery information refresh, involving
|
|
|
-further synchronous communication with the EC inside the event handler.
|
|
|
-This is made worse if the communication fails spuriously, generally
|
|
|
-incurring a multi-second timeout.
|
|
|
-
|
|
|
-Since the event completions are run strictly non-parallel, this blocks
|
|
|
-other events from being propagated to the respective subsystems. This
|
|
|
-becomes especially noticeable for keyboard and touchpad input, which
|
|
|
-also funnel their events through this system. Here, users have reported
|
|
|
-occasional multi-second "freezes".
|
|
|
-
|
|
|
-Note, however, that the event handling system was never intended to run
|
|
|
-purely sequentially. Instead, we have one work struct per EC/SAM
|
|
|
-subsystem, processing the event queue for that subsystem. These work
|
|
|
-structs were intended to run in parallel, allowing sequential processing
|
|
|
-of work items for each subsystem but parallel processing of work items
|
|
|
-across subsystems.
|
|
|
-
|
|
|
-The only restriction to this is the way the workqueue is created.
|
|
|
-Therefore, replace create_workqueue() with alloc_workqueue() and do not
|
|
|
-restrict the maximum number of parallel work items to be executed on
|
|
|
-that queue, resolving any cross-subsystem blockage.
|
|
|
-
|
|
|
-Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem")
|
|
|
-Link: https://github.com/linux-surface/linux-surface/issues/1026
|
|
|
-Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
-Patchset: surface-sam
|
|
|
----
|
|
|
- drivers/platform/surface/aggregator/controller.c | 2 +-
|
|
|
- 1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
-
|
|
|
-diff --git a/drivers/platform/surface/aggregator/controller.c b/drivers/platform/surface/aggregator/controller.c
|
|
|
-index 535581c0471c..7fc602e01487 100644
|
|
|
---- a/drivers/platform/surface/aggregator/controller.c
|
|
|
-+++ b/drivers/platform/surface/aggregator/controller.c
|
|
|
-@@ -825,7 +825,7 @@ static int ssam_cplt_init(struct ssam_cplt *cplt, struct device *dev)
|
|
|
-
|
|
|
- cplt->dev = dev;
|
|
|
-
|
|
|
-- cplt->wq = create_workqueue(SSAM_CPLT_WQ_NAME);
|
|
|
-+ cplt->wq = alloc_workqueue(SSAM_CPLT_WQ_NAME, WQ_UNBOUND | WQ_MEM_RECLAIM, 0);
|
|
|
- if (!cplt->wq)
|
|
|
- return -ENOMEM;
|
|
|
-
|
|
|
---
|
|
|
-2.41.0
|
|
|
-
|
|
|
-From 1eff5a24a6ad7e976ec41a4707a200ffda9fe3af Mon Sep 17 00:00:00 2001
|
|
|
+From 5f500b5c2a9cd1b50f6d2e6c8e0018a840fa45ff Mon Sep 17 00:00:00 2001
|
|
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
Date: Thu, 18 May 2023 22:33:55 +0200
|
|
|
Subject: [PATCH] platform/surface: aggregator: Make to_ssam_device_driver()
|
|
@@ -550,61 +490,7 @@ index df81043b9e71..42b249b4c24b 100644
|
|
|
--
|
|
|
2.41.0
|
|
|
|
|
|
-From f742462433d3fa617972e717b4cdb66b26352fbf Mon Sep 17 00:00:00 2001
|
|
|
-From: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
-Date: Thu, 18 May 2023 22:53:12 +0200
|
|
|
-Subject: [PATCH] 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:03: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 <luzmaximilian@gmail.com>
|
|
|
-Patchset: surface-sam
|
|
|
----
|
|
|
- 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 8f52b62d1c19..4a029f5db20a 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.41.0
|
|
|
-
|
|
|
-From 860fcda843a8e5b1603eaddad257573adc40e95e Mon Sep 17 00:00:00 2001
|
|
|
+From d642e16932f9d8609d776ad3ca55ce84a4be6d8f Mon Sep 17 00:00:00 2001
|
|
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
Date: Thu, 18 May 2023 22:57:17 +0200
|
|
|
Subject: [PATCH] platform/surface: aggregator_tabletsw: Add support for book
|