All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maximilian Luz <luzmaximilian@gmail.com>
To: Hans de Goede <hdegoede@redhat.com>,
	Jiri Kosina <jikos@kernel.org>,
	Sebastian Reichel <sre@kernel.org>
Cc: Mark Gross <markgross@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	Jonathan Corbet <corbet@lwn.net>,
	platform-driver-x86@vger.kernel.org, linux-input@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-doc@vger.kernel.org,
	Maximilian Luz <luzmaximilian@gmail.com>
Subject: [PATCH v2 12/12] platform/surface: aggregator_registry: Add support for keyboard cover on Surface Pro 8
Date: Fri, 27 May 2022 04:34:47 +0200	[thread overview]
Message-ID: <20220527023447.2460025-13-luzmaximilian@gmail.com> (raw)
In-Reply-To: <20220527023447.2460025-1-luzmaximilian@gmail.com>

Add support for the detachable keyboard cover on the Surface Pro 8.

The keyboard cover on the Surface Pro 8 is, unlike the keyboard covers
of earlier Surface Pro generations, handled via the Surface System
Aggregator Module (SSAM). The keyboard and touchpad (as well as other
HID input devices) of this cover are standard SSAM HID client devices
(just like keyboard and touchpad on e.g. the Surface Laptop 3 and 4),
however, some care needs to be taken as they can be physically detached
(similarly to the Surface Book 3). Specifically, the respective SSAM
client devices need to be removed when the keyboard cover has been
detached and (re-)initialized when the keyboard cover has been
(re-)attached.

On the Surface Pro 8, detachment of the keyboard cover (and by extension
its devices) is managed via the KIP subsystem. Therefore, said devices
need to be registered under the KIP device hub, which in turn will
remove and re-create/re-initialize those devices as needed.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
---

Changes in v2:
  - Change order of KIP and BAS hub definitions to reflect IDs.

---
 .../surface/surface_aggregator_registry.c     | 37 ++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/surface/surface_aggregator_registry.c b/drivers/platform/surface/surface_aggregator_registry.c
index f15cef60630f..bf3303f1aa71 100644
--- a/drivers/platform/surface/surface_aggregator_registry.c
+++ b/drivers/platform/surface/surface_aggregator_registry.c
@@ -41,6 +41,12 @@ static const struct software_node ssam_node_root = {
 	.name = "ssam_platform_hub",
 };
 
+/* KIP device hub (connects keyboard cover devices on Surface Pro 8). */
+static const struct software_node ssam_node_hub_kip = {
+	.name = "ssam:00:00:01:0e:00",
+	.parent = &ssam_node_root,
+};
+
 /* Base device hub (devices attached to Surface Book 3 base). */
 static const struct software_node ssam_node_hub_base = {
 	.name = "ssam:00:00:02:11:00",
@@ -155,6 +161,30 @@ static const struct software_node ssam_node_hid_base_iid6 = {
 	.parent = &ssam_node_hub_base,
 };
 
+/* HID keyboard (KIP hub). */
+static const struct software_node ssam_node_hid_kip_keyboard = {
+	.name = "ssam:01:15:02:01:00",
+	.parent = &ssam_node_hub_kip,
+};
+
+/* HID pen stash (KIP hub; pen taken / stashed away evens). */
+static const struct software_node ssam_node_hid_kip_penstash = {
+	.name = "ssam:01:15:02:02:00",
+	.parent = &ssam_node_hub_kip,
+};
+
+/* HID touchpad (KIP hub). */
+static const struct software_node ssam_node_hid_kip_touchpad = {
+	.name = "ssam:01:15:02:03:00",
+	.parent = &ssam_node_hub_kip,
+};
+
+/* HID device instance 5 (KIP hub, unknown HID device). */
+static const struct software_node ssam_node_hid_kip_iid5 = {
+	.name = "ssam:01:15:02:05:00",
+	.parent = &ssam_node_hub_kip,
+};
+
 /*
  * Devices for 5th- and 6th-generations models:
  * - Surface Book 2,
@@ -230,10 +260,15 @@ static const struct software_node *ssam_node_group_sp7[] = {
 
 static const struct software_node *ssam_node_group_sp8[] = {
 	&ssam_node_root,
+	&ssam_node_hub_kip,
 	&ssam_node_bat_ac,
 	&ssam_node_bat_main,
 	&ssam_node_tmp_pprof,
-	/* TODO: Add support for keyboard cover. */
+	&ssam_node_hid_kip_keyboard,
+	&ssam_node_hid_kip_penstash,
+	&ssam_node_hid_kip_touchpad,
+	&ssam_node_hid_kip_iid5,
+	/* TODO: Add support for tablet mode switch. */
 	NULL,
 };
 
-- 
2.36.1


  parent reply	other threads:[~2022-05-27  2:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27  2:34 [PATCH v2 00/12] platform/surface: aggregator: Add support for client hot-removal Maximilian Luz
2022-05-27  2:34 ` [PATCH v2 01/12] platform/surface: aggregator: Allow is_ssam_device() to be used when CONFIG_SURFACE_AGGREGATOR_BUS is disabled Maximilian Luz
2022-05-27  2:34 ` [PATCH v2 02/12] platform/surface: aggregator: Allow devices to be marked as hot-removed Maximilian Luz
2022-05-27  2:34 ` [PATCH v2 03/12] platform/surface: aggregator: Allow notifiers to avoid communication on unregistering Maximilian Luz
2022-05-27  2:34 ` [PATCH v2 04/12] platform/surface: aggregator_registry: Use client device wrappers for notifier registration Maximilian Luz
2022-05-27  2:34 ` [PATCH v2 05/12] power/supply: surface_charger: " Maximilian Luz
2022-06-09 18:01   ` Sebastian Reichel
2022-05-27  2:34 ` [PATCH v2 06/12] power/supply: surface_battery: " Maximilian Luz
2022-06-09 18:01   ` Sebastian Reichel
2022-05-27  2:34 ` [PATCH v2 07/12] HID: surface-hid: Add support for hot-removal Maximilian Luz
2022-05-27  2:34 ` [PATCH v2 08/12] platform/surface: aggregator: Add comment for KIP subsystem category Maximilian Luz
2022-05-27  2:34 ` [PATCH v2 09/12] platform/surface: aggregator_registry: Generify subsystem hub functionality Maximilian Luz
2022-05-27  2:34 ` [PATCH v2 10/12] platform/surface: aggregator_registry: Change device ID for base hub Maximilian Luz
2022-05-27  2:34 ` [PATCH v2 11/12] platform/surface: aggregator_registry: Add KIP device hub Maximilian Luz
2022-05-27  2:34 ` Maximilian Luz [this message]
2022-06-13 15:27 ` [PATCH v2 00/12] platform/surface: aggregator: Add support for client hot-removal Hans de Goede
2022-06-14  7:48   ` Benjamin Tissoires

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220527023447.2460025-13-luzmaximilian@gmail.com \
    --to=luzmaximilian@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=corbet@lwn.net \
    --cc=hdegoede@redhat.com \
    --cc=jikos@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.