From f12a6f724447b58452c63e86d0fc13cd8e03e67d Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Sun, 8 Jan 2023 22:16:14 +0100 Subject: kernel 6.0.18 --- SOURCES/linux-surface.patch | 1545 +++++++++++++++++++++++++++++++++++----- SOURCES/patch-6.0-redhat.patch | 14 +- 2 files changed, 1358 insertions(+), 201 deletions(-) (limited to 'SOURCES') diff --git a/SOURCES/linux-surface.patch b/SOURCES/linux-surface.patch index 9eeb84b..ac9fec5 100644 --- a/SOURCES/linux-surface.patch +++ b/SOURCES/linux-surface.patch @@ -1,4 +1,4 @@ -From 3c97e0f82689012bd51bc01db291fb06fbc94750 Mon Sep 17 00:00:00 2001 +From bf4e42253b42fe68f4c1c350809930a64d26253e Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Sun, 18 Oct 2020 16:42:44 +0900 Subject: [PATCH] (surface3-oemb) add DMI matches for Surface 3 with broken DMI @@ -97,9 +97,9 @@ index 6beb00858c33..d82d77387a0a 100644 }; -- -2.38.1 +2.39.0 -From e8c9d38dd90a1d2141ee5b36faf122155051a508 Mon Sep 17 00:00:00 2001 +From 0a3c73c866294bef1aac20ab3d465d75f1ca7de3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Tue, 3 Nov 2020 13:28:04 +0100 Subject: [PATCH] mwifiex: Add quirk resetting the PCI bridge on MS Surface @@ -264,9 +264,164 @@ index d6ff964aec5b..5d30ae39d65e 100644 void mwifiex_initialize_quirks(struct pcie_service_card *card); int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev); -- -2.38.1 +2.39.0 -From 1a5210524194ca0bd4330828ca98e1ecdc02d72f Mon Sep 17 00:00:00 2001 +From 8afcd8d1453c9667b006676e3501276942751712 Mon Sep 17 00:00:00 2001 +From: Tsuchiya Yuto +Date: Sun, 4 Oct 2020 00:11:49 +0900 +Subject: [PATCH] mwifiex: pcie: disable bridge_d3 for Surface gen4+ + +Currently, mwifiex fw will crash after suspend on recent kernel series. +On Windows, it seems that the root port of wifi will never enter D3 state +(stay on D0 state). And on Linux, disabling the D3 state for the +bridge fixes fw crashing after suspend. + +This commit disables the D3 state of root port on driver initialization +and fixes fw crashing after suspend. + +Signed-off-by: Tsuchiya Yuto +Patchset: mwifiex +--- + drivers/net/wireless/marvell/mwifiex/pcie.c | 7 +++++ + .../wireless/marvell/mwifiex/pcie_quirks.c | 27 +++++++++++++------ + .../wireless/marvell/mwifiex/pcie_quirks.h | 1 + + 3 files changed, 27 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c +index 3aeff40179cf..a5f273248977 100644 +--- a/drivers/net/wireless/marvell/mwifiex/pcie.c ++++ b/drivers/net/wireless/marvell/mwifiex/pcie.c +@@ -368,6 +368,7 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev, + const struct pci_device_id *ent) + { + struct pcie_service_card *card; ++ struct pci_dev *parent_pdev = pci_upstream_bridge(pdev); + int ret; + + pr_debug("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n", +@@ -409,6 +410,12 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev, + return -1; + } + ++ /* disable bridge_d3 for Surface gen4+ devices to fix fw crashing ++ * after suspend ++ */ ++ if (card->quirks & QUIRK_NO_BRIDGE_D3) ++ parent_pdev->bridge_d3 = false; ++ + return 0; + } + +diff --git a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c b/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c +index f46b06f8d643..99b024ecbade 100644 +--- a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c ++++ b/drivers/net/wireless/marvell/mwifiex/pcie_quirks.c +@@ -14,7 +14,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = { + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Pro 4"), + }, + .driver_data = (void *)(QUIRK_FW_RST_D3COLD | +- QUIRK_DO_FLR_ON_BRIDGE), ++ QUIRK_DO_FLR_ON_BRIDGE | ++ QUIRK_NO_BRIDGE_D3), + }, + { + .ident = "Surface Pro 5", +@@ -24,7 +25,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = { + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "Surface_Pro_1796"), + }, + .driver_data = (void *)(QUIRK_FW_RST_D3COLD | +- QUIRK_DO_FLR_ON_BRIDGE), ++ QUIRK_DO_FLR_ON_BRIDGE | ++ QUIRK_NO_BRIDGE_D3), + }, + { + .ident = "Surface Pro 5 (LTE)", +@@ -34,7 +36,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = { + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "Surface_Pro_1807"), + }, + .driver_data = (void *)(QUIRK_FW_RST_D3COLD | +- QUIRK_DO_FLR_ON_BRIDGE), ++ QUIRK_DO_FLR_ON_BRIDGE | ++ QUIRK_NO_BRIDGE_D3), + }, + { + .ident = "Surface Pro 6", +@@ -43,7 +46,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = { + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Pro 6"), + }, + .driver_data = (void *)(QUIRK_FW_RST_D3COLD | +- QUIRK_DO_FLR_ON_BRIDGE), ++ QUIRK_DO_FLR_ON_BRIDGE | ++ QUIRK_NO_BRIDGE_D3), + }, + { + .ident = "Surface Book 1", +@@ -52,7 +56,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = { + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Book"), + }, + .driver_data = (void *)(QUIRK_FW_RST_D3COLD | +- QUIRK_DO_FLR_ON_BRIDGE), ++ QUIRK_DO_FLR_ON_BRIDGE | ++ QUIRK_NO_BRIDGE_D3), + }, + { + .ident = "Surface Book 2", +@@ -61,7 +66,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = { + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Book 2"), + }, + .driver_data = (void *)(QUIRK_FW_RST_D3COLD | +- QUIRK_DO_FLR_ON_BRIDGE), ++ QUIRK_DO_FLR_ON_BRIDGE | ++ QUIRK_NO_BRIDGE_D3), + }, + { + .ident = "Surface Laptop 1", +@@ -70,7 +76,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = { + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Laptop"), + }, + .driver_data = (void *)(QUIRK_FW_RST_D3COLD | +- QUIRK_DO_FLR_ON_BRIDGE), ++ QUIRK_DO_FLR_ON_BRIDGE | ++ QUIRK_NO_BRIDGE_D3), + }, + { + .ident = "Surface Laptop 2", +@@ -79,7 +86,8 @@ static const struct dmi_system_id mwifiex_quirk_table[] = { + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Laptop 2"), + }, + .driver_data = (void *)(QUIRK_FW_RST_D3COLD | +- QUIRK_DO_FLR_ON_BRIDGE), ++ QUIRK_DO_FLR_ON_BRIDGE | ++ QUIRK_NO_BRIDGE_D3), + }, + {} + }; +@@ -99,6 +107,9 @@ void mwifiex_initialize_quirks(struct pcie_service_card *card) + dev_info(&pdev->dev, "quirk reset_d3cold enabled\n"); + if (card->quirks & QUIRK_DO_FLR_ON_BRIDGE) + dev_info(&pdev->dev, "quirk do_flr_on_bridge enabled\n"); ++ if (card->quirks & QUIRK_NO_BRIDGE_D3) ++ dev_info(&pdev->dev, ++ "quirk no_brigde_d3 enabled\n"); + } + + static void mwifiex_pcie_set_power_d3cold(struct pci_dev *pdev) +diff --git a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.h b/drivers/net/wireless/marvell/mwifiex/pcie_quirks.h +index 5d30ae39d65e..c14eb56eb911 100644 +--- a/drivers/net/wireless/marvell/mwifiex/pcie_quirks.h ++++ b/drivers/net/wireless/marvell/mwifiex/pcie_quirks.h +@@ -5,6 +5,7 @@ + + #define QUIRK_FW_RST_D3COLD BIT(0) + #define QUIRK_DO_FLR_ON_BRIDGE BIT(1) ++#define QUIRK_NO_BRIDGE_D3 BIT(2) + + void mwifiex_initialize_quirks(struct pcie_service_card *card); + int mwifiex_pcie_reset_d3cold_quirk(struct pci_dev *pdev); +-- +2.39.0 + +From 1fff21c7ef643136d35d0d3ef42360d790d2db11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Thu, 25 Mar 2021 11:33:02 +0100 Subject: [PATCH] Bluetooth: btusb: Lower passive lescan interval on Marvell @@ -302,7 +457,7 @@ Patchset: mwifiex 1 file changed, 15 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c -index 1bb46cbff0fa..8aa8db5d4cde 100644 +index a132e7aba605..06e727ca038d 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -63,6 +63,7 @@ static struct usb_driver btusb_driver; @@ -321,7 +476,7 @@ index 1bb46cbff0fa..8aa8db5d4cde 100644 /* Intel Bluetooth devices */ { USB_DEVICE(0x8087, 0x0025), .driver_info = BTUSB_INTEL_COMBINED }, -@@ -3842,6 +3844,19 @@ static int btusb_probe(struct usb_interface *intf, +@@ -3848,6 +3850,19 @@ static int btusb_probe(struct usb_interface *intf, if (id->driver_info & BTUSB_MARVELL) hdev->set_bdaddr = btusb_set_bdaddr_marvell; @@ -342,9 +497,9 @@ index 1bb46cbff0fa..8aa8db5d4cde 100644 (id->driver_info & BTUSB_MEDIATEK)) { hdev->setup = btusb_mtk_setup; -- -2.38.1 +2.39.0 -From abff062e2f35a8e58053f248fc4dd8b808a93749 Mon Sep 17 00:00:00 2001 +From 0a874176828ae60dfa853fcacbe42c81acb9fae2 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sat, 27 Feb 2021 00:45:52 +0100 Subject: [PATCH] ath10k: Add module parameters to override board files @@ -366,7 +521,7 @@ Patchset: ath10k 1 file changed, 58 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c -index d1ac64026cb3..5c883a12d9f8 100644 +index 9a8ea7231a9e..06a62c04b25f 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -38,6 +38,9 @@ static bool fw_diag_log; @@ -399,7 +554,7 @@ index d1ac64026cb3..5c883a12d9f8 100644 static const struct ath10k_hw_params ath10k_hw_params_list[] = { { .id = QCA988X_HW_2_0_VERSION, -@@ -895,6 +904,42 @@ static int ath10k_init_configure_target(struct ath10k *ar) +@@ -911,6 +920,42 @@ static int ath10k_init_configure_target(struct ath10k *ar) return 0; } @@ -442,7 +597,7 @@ index d1ac64026cb3..5c883a12d9f8 100644 static const struct firmware *ath10k_fetch_fw_file(struct ath10k *ar, const char *dir, const char *file) -@@ -909,6 +954,19 @@ static const struct firmware *ath10k_fetch_fw_file(struct ath10k *ar, +@@ -925,6 +970,19 @@ static const struct firmware *ath10k_fetch_fw_file(struct ath10k *ar, if (dir == NULL) dir = "."; @@ -463,9 +618,9 @@ index d1ac64026cb3..5c883a12d9f8 100644 ret = firmware_request_nowarn(&fw, filename, ar->dev); ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot fw request '%s': %d\n", -- -2.38.1 +2.39.0 -From 5687662d0c5880de172f5cd6667034a2197e772a Mon Sep 17 00:00:00 2001 +From f1899447af710b26d802c2ef39870d8da134c6c4 Mon Sep 17 00:00:00 2001 From: Dorian Stoll Date: Thu, 30 Jul 2020 13:21:53 +0200 Subject: [PATCH] misc: mei: Add missing IPTS device IDs @@ -501,9 +656,9 @@ index 5435604327a7..1165ee4f5928 100644 {MEI_PCI_DEVICE(MEI_DEV_ID_TGP_LP, MEI_ME_PCH15_CFG)}, -- -2.38.1 +2.39.0 -From a09de6da693be52da43fe35fc7ff76269f162237 Mon Sep 17 00:00:00 2001 +From 60601384b67fb77fa7cd7a15748e9b858f2e5b4d Mon Sep 17 00:00:00 2001 From: Dorian Stoll Date: Thu, 6 Aug 2020 11:20:41 +0200 Subject: [PATCH] misc: Add support for Intel Precise Touch & Stylus @@ -1969,9 +2124,9 @@ index 000000000000..53fb86a88f97 + +#endif /* _IPTS_UAPI_H_ */ -- -2.38.1 +2.39.0 -From 730820b1dbfd732a51653bbe789a84c0669575ad Mon Sep 17 00:00:00 2001 +From 9bf06b18d485c3106536d4c90306a43fc22eae50 Mon Sep 17 00:00:00 2001 From: Liban Hannan Date: Tue, 12 Apr 2022 23:31:12 +0100 Subject: [PATCH] iommu: ipts: use IOMMU passthrough mode for IPTS @@ -1993,7 +2148,7 @@ Patchset: ipts 1 file changed, 24 insertions(+) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c -index ecc0b05b2796..4c895b5f7e2d 100644 +index 412b106d2a39..5246e3f25ac1 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -37,6 +37,8 @@ @@ -2020,7 +2175,7 @@ index ecc0b05b2796..4c895b5f7e2d 100644 const struct iommu_ops intel_iommu_ops; -@@ -2603,6 +2607,9 @@ static int device_def_domain_type(struct device *dev) +@@ -2601,6 +2605,9 @@ static int device_def_domain_type(struct device *dev) if ((iommu_identity_mapping & IDENTMAP_GFX) && IS_GFX_DEVICE(pdev)) return IOMMU_DOMAIN_IDENTITY; @@ -2030,7 +2185,7 @@ index ecc0b05b2796..4c895b5f7e2d 100644 } return 0; -@@ -2992,6 +2999,9 @@ static int __init init_dmars(void) +@@ -2990,6 +2997,9 @@ static int __init init_dmars(void) if (!dmar_map_gfx) iommu_identity_mapping |= IDENTMAP_GFX; @@ -2069,9 +2224,1033 @@ index ecc0b05b2796..4c895b5f7e2d 100644 { if (risky_device(dev)) -- -2.38.1 +2.39.0 + +From 91f23116f351fd47b02b04da4c76ea783c9eebf7 Mon Sep 17 00:00:00 2001 +From: Maximilian Luz +Date: Sat, 5 Nov 2022 21:23:53 +0100 +Subject: [PATCH] platform/surface: aggregator: Improve documentation and + handling of message target and source IDs + +The `tid_in` and `tid_out` fields of the serial hub protocol command +struct (struct ssh_command) are actually source and target IDs, +indicating the peer from which the message originated and the peer for +which it is intended. + +Change the naming of those fields accordingly and improve the protocol +documenation. Additionally, introduce an enum containing all currently +known peers, i.e. targets and sources. + +Signed-off-by: Maximilian Luz +Patchset: surface-sam +--- + .../driver-api/surface_aggregator/client.rst | 4 +- + .../driver-api/surface_aggregator/ssh.rst | 36 +++++++++-------- + .../platform/surface/aggregator/controller.c | 12 +++--- + .../platform/surface/aggregator/ssh_msgb.h | 4 +- + include/linux/surface_aggregator/controller.h | 4 +- + include/linux/surface_aggregator/serial_hub.h | 40 +++++++++++++------ + 6 files changed, 58 insertions(+), 42 deletions(-) + +diff --git a/Documentation/driver-api/surface_aggregator/client.rst b/Documentation/driver-api/surface_aggregator/client.rst +index 27f95abdbe99..9d7411223a84 100644 +--- a/Documentation/driver-api/surface_aggregator/client.rst ++++ b/Documentation/driver-api/surface_aggregator/client.rst +@@ -191,7 +191,7 @@ data received from it is converted from little-endian to host endianness. + * they do not correspond to an actual SAM/EC request. + */ + rqst.target_category = SSAM_SSH_TC_SAM; +- rqst.target_id = 0x01; ++ rqst.target_id = SSAM_SSH_TID_SAM; + rqst.command_id = 0x02; + rqst.instance_id = 0x03; + rqst.flags = SSAM_REQUEST_HAS_RESPONSE; +@@ -241,7 +241,7 @@ one of the generator macros, for example via: + + SSAM_DEFINE_SYNC_REQUEST_W(__ssam_tmp_perf_mode_set, __le32, { + .target_category = SSAM_SSH_TC_TMP, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x03, + .instance_id = 0x00, + }); +diff --git a/Documentation/driver-api/surface_aggregator/ssh.rst b/Documentation/driver-api/surface_aggregator/ssh.rst +index bf007d6c9873..18fd0f0aee84 100644 +--- a/Documentation/driver-api/surface_aggregator/ssh.rst ++++ b/Documentation/driver-api/surface_aggregator/ssh.rst +@@ -13,6 +13,7 @@ + .. |DATA_NSQ| replace:: ``DATA_NSQ`` + .. |TC| replace:: ``TC`` + .. |TID| replace:: ``TID`` ++.. |SID| replace:: ``SID`` + .. |IID| replace:: ``IID`` + .. |RQID| replace:: ``RQID`` + .. |CID| replace:: ``CID`` +@@ -219,13 +220,13 @@ following fields, packed together and in order: + - |u8| + - Target category. + +- * - |TID| (out) ++ * - |TID| + - |u8| +- - Target ID for outgoing (host to EC) commands. ++ - Target ID for commands/messages. + +- * - |TID| (in) ++ * - |SID| + - |u8| +- - Target ID for incoming (EC to host) commands. ++ - Source ID for commands/messages. + + * - |IID| + - |u8| +@@ -286,19 +287,20 @@ general, however, a single target category should map to a single reserved + event request ID. + + Furthermore, requests, responses, and events have an associated target ID +-(``TID``). This target ID is split into output (host to EC) and input (EC to +-host) fields, with the respecting other field (e.g. output field on incoming +-messages) set to zero. Two ``TID`` values are known: Primary (``0x01``) and +-secondary (``0x02``). In general, the response to a request should have the +-same ``TID`` value, however, the field (output vs. input) should be used in +-accordance to the direction in which the response is sent (i.e. on the input +-field, as responses are generally sent from the EC to the host). +- +-Note that, even though requests and events should be uniquely identifiable +-by target category and command ID alone, the EC may require specific +-target ID and instance ID values to accept a command. A command that is +-accepted for ``TID=1``, for example, may not be accepted for ``TID=2`` +-and vice versa. ++(``TID``) and source ID (``SID``). These two fields indicate where a message ++originates from (``SID``) and what the intended target of the message is ++(``TID``). Note that a response to a specific request therefore has the source ++and target IDs swapped when compared to the original request (i.e. the request ++target is the response source and the request source is the response target). ++See (:c:type:`enum ssh_request_id `) for possible values of ++both. ++ ++Note that, even though requests and events should be uniquely identifiable by ++target category and command ID alone, the EC may require specific target ID and ++instance ID values to accept a command. A command that is accepted for ++``TID=1``, for example, may not be accepted for ``TID=2`` and vice versa. While ++this may not always hold in reality, you can think of different target/source ++IDs indicating different physical ECs with potentially different feature sets. + + + Limitations and Observations +diff --git a/drivers/platform/surface/aggregator/controller.c b/drivers/platform/surface/aggregator/controller.c +index 43e765199137..54bfb1f3d2dc 100644 +--- a/drivers/platform/surface/aggregator/controller.c ++++ b/drivers/platform/surface/aggregator/controller.c +@@ -994,7 +994,7 @@ static void ssam_handle_event(struct ssh_rtl *rtl, + + item->rqid = get_unaligned_le16(&cmd->rqid); + item->event.target_category = cmd->tc; +- item->event.target_id = cmd->tid_in; ++ item->event.target_id = cmd->sid; + item->event.command_id = cmd->cid; + item->event.instance_id = cmd->iid; + memcpy(&item->event.data[0], data->ptr, data->len); +@@ -1777,35 +1777,35 @@ EXPORT_SYMBOL_GPL(ssam_request_sync_with_buffer); + + SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_get_firmware_version, __le32, { + .target_category = SSAM_SSH_TC_SAM, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x13, + .instance_id = 0x00, + }); + + SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_notif_display_off, u8, { + .target_category = SSAM_SSH_TC_SAM, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x15, + .instance_id = 0x00, + }); + + SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_notif_display_on, u8, { + .target_category = SSAM_SSH_TC_SAM, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x16, + .instance_id = 0x00, + }); + + SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_notif_d0_exit, u8, { + .target_category = SSAM_SSH_TC_SAM, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x33, + .instance_id = 0x00, + }); + + SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_notif_d0_entry, u8, { + .target_category = SSAM_SSH_TC_SAM, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x34, + .instance_id = 0x00, + }); +diff --git a/drivers/platform/surface/aggregator/ssh_msgb.h b/drivers/platform/surface/aggregator/ssh_msgb.h +index f3ecad92eefd..438873e06098 100644 +--- a/drivers/platform/surface/aggregator/ssh_msgb.h ++++ b/drivers/platform/surface/aggregator/ssh_msgb.h +@@ -189,8 +189,8 @@ static inline void msgb_push_cmd(struct msgbuf *msgb, u8 seq, u16 rqid, + + __msgb_push_u8(msgb, SSH_PLD_TYPE_CMD); /* Payload type. */ + __msgb_push_u8(msgb, rqst->target_category); /* Target category. */ +- __msgb_push_u8(msgb, rqst->target_id); /* Target ID (out). */ +- __msgb_push_u8(msgb, 0x00); /* Target ID (in). */ ++ __msgb_push_u8(msgb, rqst->target_id); /* Target ID. */ ++ __msgb_push_u8(msgb, SSAM_SSH_TID_HOST); /* Source ID. */ + __msgb_push_u8(msgb, rqst->instance_id); /* Instance ID. */ + __msgb_push_u16(msgb, rqid); /* Request ID. */ + __msgb_push_u8(msgb, rqst->command_id); /* Command ID. */ +diff --git a/include/linux/surface_aggregator/controller.h b/include/linux/surface_aggregator/controller.h +index d11a1c6e3186..8932bc0bae18 100644 +--- a/include/linux/surface_aggregator/controller.h ++++ b/include/linux/surface_aggregator/controller.h +@@ -912,10 +912,10 @@ enum ssam_event_mask { + }) + + #define SSAM_EVENT_REGISTRY_SAM \ +- SSAM_EVENT_REGISTRY(SSAM_SSH_TC_SAM, 0x01, 0x0b, 0x0c) ++ SSAM_EVENT_REGISTRY(SSAM_SSH_TC_SAM, SSAM_SSH_TID_SAM, 0x0b, 0x0c) + + #define SSAM_EVENT_REGISTRY_KIP \ +- SSAM_EVENT_REGISTRY(SSAM_SSH_TC_KIP, 0x02, 0x27, 0x28) ++ SSAM_EVENT_REGISTRY(SSAM_SSH_TC_KIP, SSAM_SSH_TID_KIP, 0x27, 0x28) + + #define SSAM_EVENT_REGISTRY_REG(tid)\ + SSAM_EVENT_REGISTRY(SSAM_SSH_TC_REG, tid, 0x01, 0x02) +diff --git a/include/linux/surface_aggregator/serial_hub.h b/include/linux/surface_aggregator/serial_hub.h +index 45501b6e54e8..5c4ae1a26183 100644 +--- a/include/linux/surface_aggregator/serial_hub.h ++++ b/include/linux/surface_aggregator/serial_hub.h +@@ -83,23 +83,21 @@ enum ssh_payload_type { + + /** + * struct ssh_command - Payload of a command-type frame. +- * @type: The type of the payload. See &enum ssh_payload_type. Should be +- * SSH_PLD_TYPE_CMD for this struct. +- * @tc: Command target category. +- * @tid_out: Output target ID. Should be zero if this an incoming (EC to host) +- * message. +- * @tid_in: Input target ID. Should be zero if this is an outgoing (host to +- * EC) message. +- * @iid: Instance ID. +- * @rqid: Request ID. Used to match requests with responses and differentiate +- * between responses and events. +- * @cid: Command ID. ++ * @type: The type of the payload. See &enum ssh_payload_type. Should be ++ * SSH_PLD_TYPE_CMD for this struct. ++ * @tc: Command target category. ++ * @tid: Target ID. Indicates the target of the message. ++ * @sid: Source ID. Indicates the source of the message. ++ * @iid: Instance ID. ++ * @rqid: Request ID. Used to match requests with responses and differentiate ++ * between responses and events. ++ * @cid: Command ID. + */ + struct ssh_command { + u8 type; + u8 tc; +- u8 tid_out; +- u8 tid_in; ++ u8 tid; ++ u8 sid; + u8 iid; + __le16 rqid; + u8 cid; +@@ -280,6 +278,22 @@ struct ssam_span { + size_t len; + }; + ++/** ++ * enum ssam_ssh_tid - Target/source IDs for Serial Hub messages. ++ * @SSAM_SSH_TID_HOST: We as the kernel Serial Hub driver. ++ * @SSAM_SSH_TID_SAM: The Surface Aggregator EC. ++ * @SSAM_SSH_TID_KIP: Keyboard and perihperal controller. ++ * @SSAM_SSH_TID_DEBUG: Debug connector. ++ * @SSAM_SSH_TID_SURFLINK: SurfLink connector. ++ */ ++enum ssam_ssh_tid { ++ SSAM_SSH_TID_HOST = 0x00, ++ SSAM_SSH_TID_SAM = 0x01, ++ SSAM_SSH_TID_KIP = 0x02, ++ SSAM_SSH_TID_DEBUG = 0x03, ++ SSAM_SSH_TID_SURFLINK = 0x04, ++}; ++ + /* + * Known SSH/EC target categories. + * +-- +2.39.0 -From 8696c6504d1ee31bca940d8fd1dddb5fdaaf00e6 Mon Sep 17 00:00:00 2001 +From ac0428a6fceffef1e7f70ceaf13747d84dbd42ee Mon Sep 17 00:00:00 2001 +From: Maximilian Luz +Date: Sat, 5 Nov 2022 21:30:58 +0100 +Subject: [PATCH] platform/surface: aggregator: Ignore command messages not + intended for us + +It is possible that we (the host/kernel driver) receive command messages +that are not intended for us. Ignore those for now. + +The whole story is a bit more complicated: It is possible to enable +debug output on SAM, which is sent via SSH command messages. By default +this output is sent to a debug connector, with its own target ID +(TID=0x03). It is possible to override the target of the debug output +and set it to the host/kernel driver. This, however, does not change the +original target ID of the message. Meaning, we receive messages with +TID=0x03 (debug) but expect to only receive messages with TID=0x00 +(host). + +The problem is that the different target ID also comes with a different +scope of request IDs. In particular, these do not follow the standard +event rules (i.e. do not fall into a set of small reserved values). +Therefore, current message handling interprets them as responses to +pending requests and tries to match them up via the request ID. However, +these debug output messages are not in fact responses, and therefore +this will at best fail to find the request and at worst pass on the +wrong data as response for a request. + +Therefore ignore any command messages not intended for us (host) for +now. We can implement support for the debug messages once we have a +better understanding of them. + +Note that this may also provide a bit more stability and avoid some +driver confusion in case any other targets want to talk to us in the +future, since we don't yet know what to do with those as well. A warning +for the dropped messages should suffice for now and also give us a +chance of discovering new targets if they come along without any +potential for bugs/instabilities. + +Signed-off-by: Maximilian Luz +Patchset: surface-sam +--- + .../surface/aggregator/ssh_request_layer.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/drivers/platform/surface/aggregator/ssh_request_layer.c b/drivers/platform/surface/aggregator/ssh_request_layer.c +index f5565570f16c..90634dcacabf 100644 +--- a/drivers/platform/surface/aggregator/ssh_request_layer.c ++++ b/drivers/platform/surface/aggregator/ssh_request_layer.c +@@ -916,6 +916,21 @@ static void ssh_rtl_rx_command(struct ssh_ptl *p, const struct ssam_span *data) + if (sshp_parse_command(dev, data, &command, &command_data)) + return; + ++ /* ++ * Check if the message was intended for us. If not, drop it. ++ * ++ * Note: We will need to change this to handle debug messages. On newer ++ * generation devices, these seem to be sent to SSAM_SSH_TID_DEBUG. We ++ * as host can still receive them as they can be forwarded via an ++ * override option on SAM, but doing so does not change the target ID ++ * to SSAM_SSH_TID_HOST. ++ */ ++ if (command->tid != SSAM_SSH_TID_HOST) { ++ rtl_warn(rtl, "rtl: dropping message not intended for us (tid = %#04x)\n", ++ command->tid); ++ return; ++ } ++ + if (ssh_rqid_is_event(get_unaligned_le16(&command->rqid))) + ssh_rtl_rx_event(rtl, command, &command_data); + else +-- +2.39.0 + +From f61dd358bf4035f1649ca6157b267724415b7cb2 Mon Sep 17 00:00:00 2001 +From: Maximilian Luz +Date: Sat, 5 Nov 2022 21:42:19 +0100 +Subject: [PATCH] platform/surface: aggregator: Add target and source IDs to + command trace events + +Add command source and target IDs to trace events. + +Tracing support for the Surface Aggregator driver was originally +implemented at a time when only two peers were known: Host and SAM. We +now know that there are at least five, with three actively being used +(Host, SAM, KIP; four with Debug if you want to count manually enabling +that interface). So it makes sense to also explicitly name the peers +involved when tracing. + +Signed-off-by: Maximilian Luz +Patchset: surface-sam +--- + drivers/platform/surface/aggregator/trace.h | 73 +++++++++++++++++++-- + 1 file changed, 67 insertions(+), 6 deletions(-) + +diff --git a/drivers/platform/surface/aggregator/trace.h b/drivers/platform/surface/aggregator/trace.h +index 2a2c17771d01..55cc61bba1da 100644 +--- a/drivers/platform/surface/aggregator/trace.h ++++ b/drivers/platform/surface/aggregator/trace.h +@@ -96,6 +96,7 @@ TRACE_DEFINE_ENUM(SSAM_SSH_TC_POS); + #define SSAM_SEQ_NOT_APPLICABLE ((u16)-1) + #define SSAM_RQID_NOT_APPLICABLE ((u32)-1) + #define SSAM_SSH_TC_NOT_APPLICABLE 0 ++#define SSAM_SSH_TID_NOT_APPLICABLE ((u8)-1) + + #ifndef _SURFACE_AGGREGATOR_TRACE_HELPERS + #define _SURFACE_AGGREGATOR_TRACE_HELPERS +@@ -150,12 +151,44 @@ static inline u32 ssam_trace_get_request_id(const struct ssh_packet *p) + return get_unaligned_le16(&p->data.ptr[SSH_MSGOFFSET_COMMAND(rqid)]); + } + ++/** ++ * ssam_trace_get_request_tid() - Read the packet's request target ID. ++ * @p: The packet. ++ * ++ * Return: Returns the packet's request target ID (TID) field if the packet ++ * represents a request with command data, or %SSAM_SSH_TID_NOT_APPLICABLE ++ * if not (e.g. flush request, control packet). ++ */ ++static inline u32 ssam_trace_get_request_tid(const struct ssh_packet *p) ++{ ++ if (!p->data.ptr || p->data.len < SSH_COMMAND_MESSAGE_LENGTH(0)) ++ return SSAM_SSH_TID_NOT_APPLICABLE; ++ ++ return get_unaligned_le16(&p->data.ptr[SSH_MSGOFFSET_COMMAND(tid)]); ++} ++ ++/** ++ * ssam_trace_get_request_sid() - Read the packet's request source ID. ++ * @p: The packet. ++ * ++ * Return: Returns the packet's request source ID (SID) field if the packet ++ * represents a request with command data, or %SSAM_SSH_TID_NOT_APPLICABLE ++ * if not (e.g. flush request, control packet). ++ */ ++static inline u32 ssam_trace_get_request_sid(const struct ssh_packet *p) ++{ ++ if (!p->data.ptr || p->data.len < SSH_COMMAND_MESSAGE_LENGTH(0)) ++ return SSAM_SSH_TID_NOT_APPLICABLE; ++ ++ return get_unaligned_le16(&p->data.ptr[SSH_MSGOFFSET_COMMAND(sid)]); ++} ++ + /** + * ssam_trace_get_request_tc() - Read the packet's request target category. + * @p: The packet. + * + * Return: Returns the packet's request target category (TC) field if the +- * packet represents a request with command data, or %SSAM_TC_NOT_APPLICABLE ++ * packet represents a request with command data, or %SSAM_SSH_TC_NOT_APPLICABLE + * if not (e.g. flush request, control packet). + */ + static inline u32 ssam_trace_get_request_tc(const struct ssh_packet *p) +@@ -232,8 +265,18 @@ static inline u32 ssam_trace_get_request_tc(const struct ssh_packet *p) + { SSAM_RQID_NOT_APPLICABLE, "N/A" } \ + ) + +-#define ssam_show_ssh_tc(rqid) \ +- __print_symbolic(rqid, \ ++#define ssam_show_ssh_tid(tid) \ ++ __print_symbolic(tid, \ ++ { SSAM_SSH_TID_NOT_APPLICABLE, "N/A" }, \ ++ { SSAM_SSH_TID_HOST, "Host" }, \ ++ { SSAM_SSH_TID_SAM, "SAM" }, \ ++ { SSAM_SSH_TID_KIP, "KIP" }, \ ++ { SSAM_SSH_TID_DEBUG, "Debug" }, \ ++ { SSAM_SSH_TID_SURFLINK, "SurfLink" } \ ++ ) ++ ++#define ssam_show_ssh_tc(tc) \ ++ __print_symbolic(tc, \ + { SSAM_SSH_TC_NOT_APPLICABLE, "N/A" }, \ + { SSAM_SSH_TC_SAM, "SAM" }, \ + { SSAM_SSH_TC_BAT, "BAT" }, \ +@@ -313,6 +356,8 @@ DECLARE_EVENT_CLASS(ssam_command_class, + TP_STRUCT__entry( + __field(u16, rqid) + __field(u16, len) ++ __field(u8, tid) ++ __field(u8, sid) + __field(u8, tc) + __field(u8, cid) + __field(u8, iid) +@@ -320,14 +365,18 @@ DECLARE_EVENT_CLASS(ssam_command_class, + + TP_fast_assign( + __entry->rqid = get_unaligned_le16(&cmd->rqid); ++ __entry->tid = cmd->tid; ++ __entry->sid = cmd->sid; + __entry->tc = cmd->tc; + __entry->cid = cmd->cid; + __entry->iid = cmd->iid; + __entry->len = len; + ), + +- TP_printk("rqid=%#06x, tc=%s, cid=%#04x, iid=%#04x, len=%u", ++ TP_printk("rqid=%#06x, tid=%s, sid=%s, tc=%s, cid=%#04x, iid=%#04x, len=%u", + __entry->rqid, ++ ssam_show_ssh_tid(__entry->tid), ++ ssam_show_ssh_tid(__entry->sid), + ssam_show_ssh_tc(__entry->tc), + __entry->cid, + __entry->iid, +@@ -430,6 +479,8 @@ DECLARE_EVENT_CLASS(ssam_request_class, + __field(u8, tc) + __field(u16, cid) + __field(u16, iid) ++ __field(u8, tid) ++ __field(u8, sid) + ), + + TP_fast_assign( +@@ -439,16 +490,20 @@ DECLARE_EVENT_CLASS(ssam_request_class, + __entry->state = READ_ONCE(request->state); + __entry->rqid = ssam_trace_get_request_id(p); + ssam_trace_ptr_uid(p, __entry->uid); ++ __entry->tid = ssam_trace_get_request_tid(p); ++ __entry->sid = ssam_trace_get_request_sid(p); + __entry->tc = ssam_trace_get_request_tc(p); + __entry->cid = ssam_trace_get_command_field_u8(p, cid); + __entry->iid = ssam_trace_get_command_field_u8(p, iid); + ), + +- TP_printk("uid=%s, rqid=%s, ty=%s, sta=%s, tc=%s, cid=%s, iid=%s", ++ TP_printk("uid=%s, rqid=%s, ty=%s, sta=%s, tid=%s, sid=%s, tc=%s, cid=%s, iid=%s", + __entry->uid, + ssam_show_request_id(__entry->rqid), + ssam_show_request_type(__entry->state), + ssam_show_request_state(__entry->state), ++ ssam_show_ssh_tid(__entry->tid), ++ ssam_show_ssh_tid(__entry->sid), + ssam_show_ssh_tc(__entry->tc), + ssam_show_generic_u8_field(__entry->cid), + ssam_show_generic_u8_field(__entry->iid) +@@ -474,6 +529,8 @@ DECLARE_EVENT_CLASS(ssam_request_status_class, + __field(u8, tc) + __field(u16, cid) + __field(u16, iid) ++ __field(u8, tid) ++ __field(u8, sid) + ), + + TP_fast_assign( +@@ -484,16 +541,20 @@ DECLARE_EVENT_CLASS(ssam_request_status_class, + __entry->rqid = ssam_trace_get_request_id(p); + __entry->status = status; + ssam_trace_ptr_uid(p, __entry->uid); ++ __entry->tid = ssam_trace_get_request_tid(p); ++ __entry->sid = ssam_trace_get_request_sid(p); + __entry->tc = ssam_trace_get_request_tc(p); + __entry->cid = ssam_trace_get_command_field_u8(p, cid); + __entry->iid = ssam_trace_get_command_field_u8(p, iid); + ), + +- TP_printk("uid=%s, rqid=%s, ty=%s, sta=%s, tc=%s, cid=%s, iid=%s, status=%d", ++ TP_printk("uid=%s, rqid=%s, ty=%s, sta=%s, tid=%s, sid=%s, tc=%s, cid=%s, iid=%s, status=%d", + __entry->uid, + ssam_show_request_id(__entry->rqid), + ssam_show_request_type(__entry->state), + ssam_show_request_state(__entry->state), ++ ssam_show_ssh_tid(__entry->tid), ++ ssam_show_ssh_tid(__entry->sid), + ssam_show_ssh_tc(__entry->tc), + ssam_show_generic_u8_field(__entry->cid), + ssam_show_generic_u8_field(__entry->iid), +-- +2.39.0 + +From 96ab89bad347e0da3226840a2eb3374259dc87bc Mon Sep 17 00:00:00 2001 +From: Maximilian Luz +Date: Sat, 5 Nov 2022 21:32:16 +0100 +Subject: [PATCH] platform/surface: aggregator_hub: Use target-ID enum instead + of hard-coding values + +Instead of hard-coding the target ID, use the respective enum +ssam_ssh_tid value. + +Signed-off-by: Maximilian Luz +Patchset: surface-sam +--- + drivers/platform/surface/surface_aggregator_hub.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/platform/surface/surface_aggregator_hub.c b/drivers/platform/surface/surface_aggregator_hub.c +index 43061514be38..62f27cdb6ca8 100644 +--- a/drivers/platform/surface/surface_aggregator_hub.c ++++ b/drivers/platform/surface/surface_aggregator_hub.c +@@ -214,7 +214,7 @@ static void ssam_hub_remove(struct ssam_device *sdev) + + SSAM_DEFINE_SYNC_REQUEST_R(ssam_bas_query_opmode, u8, { + .target_category = SSAM_SSH_TC_BAS, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x0d, + .instance_id = 0x00, + }); +@@ -292,7 +292,7 @@ static const struct ssam_hub_desc base_hub = { + + SSAM_DEFINE_SYNC_REQUEST_R(__ssam_kip_query_state, u8, { + .target_category = SSAM_SSH_TC_KIP, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x2c, + .instance_id = 0x00, + }); +-- +2.39.0 + +From ce4c80d47d379496759ac5f0fa2f84cf69bcb7b8 Mon Sep 17 00:00:00 2001 +From: Maximilian Luz +Date: Sat, 5 Nov 2022 21:33:26 +0100 +Subject: [PATCH] platform/surface: aggregator_tabletsw: Use target-ID enum + instead of hard-coding values + +Instead of hard-coding the target ID, use the respective enum +ssam_ssh_tid value. + +Signed-off-by: Maximilian Luz +Patchset: surface-sam +--- + drivers/platform/surface/surface_aggregator_tabletsw.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/platform/surface/surface_aggregator_tabletsw.c b/drivers/platform/surface/surface_aggregator_tabletsw.c +index 27d95a6a7851..bd8cd453c393 100644 +--- a/drivers/platform/surface/surface_aggregator_tabletsw.c ++++ b/drivers/platform/surface/surface_aggregator_tabletsw.c +@@ -247,7 +247,7 @@ static bool ssam_kip_cover_state_is_tablet_mode(struct ssam_tablet_sw *sw, u32 s + + SSAM_DEFINE_SYNC_REQUEST_R(__ssam_kip_get_cover_state, u8, { + .target_category = SSAM_SSH_TC_KIP, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x1d, + .instance_id = 0x00, + }); +@@ -371,7 +371,7 @@ static int ssam_pos_get_sources_list(struct ssam_tablet_sw *sw, struct ssam_sour + int status; + + rqst.target_category = SSAM_SSH_TC_POS; +- rqst.target_id = 0x01; ++ rqst.target_id = SSAM_SSH_TID_SAM; + rqst.command_id = 0x01; + rqst.instance_id = 0x00; + rqst.flags = SSAM_REQUEST_HAS_RESPONSE; +@@ -430,7 +430,7 @@ static int ssam_pos_get_source(struct ssam_tablet_sw *sw, u32 *source_id) + + SSAM_DEFINE_SYNC_REQUEST_WR(__ssam_pos_get_posture_for_source, __le32, __le32, { + .target_category = SSAM_SSH_TC_POS, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x02, + .instance_id = 0x00, + }); +-- +2.39.0 + +From 7398db18064b427803b35cb187557a4db93765e2 Mon Sep 17 00:00:00 2001 +From: Maximilian Luz +Date: Sat, 5 Nov 2022 21:34:06 +0100 +Subject: [PATCH] platform/surface: dtx: Use target-ID enum instead of + hard-coding values + +Instead of hard-coding the target ID, use the respective enum +ssam_ssh_tid value. + +Signed-off-by: Maximilian Luz +Patchset: surface-sam +--- + drivers/platform/surface/surface_dtx.c | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/drivers/platform/surface/surface_dtx.c b/drivers/platform/surface/surface_dtx.c +index ed36944467f9..0de76a784a35 100644 +--- a/drivers/platform/surface/surface_dtx.c ++++ b/drivers/platform/surface/surface_dtx.c +@@ -71,63 +71,63 @@ static_assert(sizeof(struct ssam_bas_base_info) == 2); + + SSAM_DEFINE_SYNC_REQUEST_N(ssam_bas_latch_lock, { + .target_category = SSAM_SSH_TC_BAS, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x06, + .instance_id = 0x00, + }); + + SSAM_DEFINE_SYNC_REQUEST_N(ssam_bas_latch_unlock, { + .target_category = SSAM_SSH_TC_BAS, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x07, + .instance_id = 0x00, + }); + + SSAM_DEFINE_SYNC_REQUEST_N(ssam_bas_latch_request, { + .target_category = SSAM_SSH_TC_BAS, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x08, + .instance_id = 0x00, + }); + + SSAM_DEFINE_SYNC_REQUEST_N(ssam_bas_latch_confirm, { + .target_category = SSAM_SSH_TC_BAS, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x09, + .instance_id = 0x00, + }); + + SSAM_DEFINE_SYNC_REQUEST_N(ssam_bas_latch_heartbeat, { + .target_category = SSAM_SSH_TC_BAS, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x0a, + .instance_id = 0x00, + }); + + SSAM_DEFINE_SYNC_REQUEST_N(ssam_bas_latch_cancel, { + .target_category = SSAM_SSH_TC_BAS, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x0b, + .instance_id = 0x00, + }); + + SSAM_DEFINE_SYNC_REQUEST_R(ssam_bas_get_base, struct ssam_bas_base_info, { + .target_category = SSAM_SSH_TC_BAS, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x0c, + .instance_id = 0x00, + }); + + SSAM_DEFINE_SYNC_REQUEST_R(ssam_bas_get_device_mode, u8, { + .target_category = SSAM_SSH_TC_BAS, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x0d, + .instance_id = 0x00, + }); + + SSAM_DEFINE_SYNC_REQUEST_R(ssam_bas_get_latch_status, u8, { + .target_category = SSAM_SSH_TC_BAS, +- .target_id = 0x01, ++ .target_id = SSAM_SSH_TID_SAM, + .command_id = 0x11, + .instance_id = 0x00, + }); +-- +2.39.0 + +From a26d560c4ea2e18333d02015506274f94b81f062 Mon Sep 17 00:00:00 2001 +From: Maximilian Luz +Date: Sat, 5 Nov 2022 21:40:06 +0100 +Subject: [PATCH] HID: surface-hid: Use target-ID enum instead of hard-coding + values + +Instead of hard-coding the target ID, use the respective enum +ssam_ssh_tid value. + +Signed-off-by: Maximilian Luz +Patchset: surface-sam +--- + drivers/hid/surface-hid/surface_kbd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/hid/surface-hid/surface_kbd.c b/drivers/hid/surface-hid/surface_kbd.c +index 0635341bc517..42933bf3e925 100644 +--- a/drivers/hid/surface-hid/surface_kbd.c ++++ b/drivers/hid/surface-hid/surface_kbd.c +@@ -250,7 +250,7 @@ static int surface_kbd_probe(struct platform_device *pdev) + + shid->uid.domain = SSAM_DOMAIN_SERIALHUB; + shid->uid.category = SSAM_SSH_TC_KBD; +- shid->uid.target = 2; ++ shid->uid.target = SSAM_SSH_TID_KIP; + shid->uid.instance = 0; + shid->uid.function = 0; + +-- +2.39.0 + +From 3111088adbc891b8e976d664179ab97a75e5019f Mon Sep 17 00:00:00 2001 +From: Maximilian Luz +Date: Sat, 5 Nov 2022 21:45:28 +0100 +Subject: [PATCH] platform/surface: aggregator: Enforce use of target-ID enum + in device ID macros + +Similar to the target category (TC), the target ID (TID) can be one +value out of a small number of choices, given in enum ssam_ssh_tid. + +In the device ID macros, SSAM_SDEV() and SSAM_VDEV() we already use text +expansion to, both, remove some textual clutter for the target category +values and enforce that the value belongs to the known set. Now that we +know the names for the target IDs, use the same trick for them as well. + +Also rename the SSAM_ANY_x macros to SSAM_SSH_x_ANY to better fit in. + +Signed-off-by: Maximilian Luz +Patchset: surface-sam +--- + drivers/hid/surface-hid/surface_hid.c | 2 +- + .../platform/surface/surface_aggregator_hub.c | 4 +- + .../surface/surface_aggregator_tabletsw.c | 4 +- + drivers/platform/surface/surface_dtx.c | 2 +- + .../surface/surface_platform_profile.c | 2 +- + drivers/power/supply/surface_battery.c | 4 +- + drivers/power/supply/surface_charger.c | 2 +- + include/linux/surface_aggregator/device.h | 50 +++++++++---------- + 8 files changed, 35 insertions(+), 35 deletions(-) + +diff --git a/drivers/hid/surface-hid/surface_hid.c b/drivers/hid/surface-hid/surface_hid.c +index d4aa8c81903a..aa80d83a83d1 100644 +--- a/drivers/hid/surface-hid/surface_hid.c ++++ b/drivers/hid/surface-hid/surface_hid.c +@@ -230,7 +230,7 @@ static void surface_hid_remove(struct ssam_device *sdev) + } + + static const struct ssam_device_id surface_hid_match[] = { +- { SSAM_SDEV(HID, SSAM_ANY_TID, SSAM_ANY_IID, 0x00) }, ++ { SSAM_SDEV(HID, ANY, SSAM_SSH_IID_ANY, 0x00) }, + { }, + }; + MODULE_DEVICE_TABLE(ssam, surface_hid_match); +diff --git a/drivers/platform/surface/surface_aggregator_hub.c b/drivers/platform/surface/surface_aggregator_hub.c +index 62f27cdb6ca8..6abd1efe2088 100644 +--- a/drivers/platform/surface/surface_aggregator_hub.c ++++ b/drivers/platform/surface/surface_aggregator_hub.c +@@ -348,8 +348,8 @@ static const struct ssam_hub_desc kip_hub = { + /* -- Driver registration. -------------------------------------------------- */ + + static const struct ssam_device_id ssam_hub_match[] = { +- { SSAM_VDEV(HUB, 0x01, SSAM_SSH_TC_KIP, 0x00), (unsigned long)&kip_hub }, +- { SSAM_VDEV(HUB, 0x02, SSAM_SSH_TC_BAS, 0x00), (unsigned long)&base_hub }, ++ { SSAM_VDEV(HUB, SAM, SSAM_SSH_TC_KIP, 0x00), (unsigned long)&kip_hub }, ++ { SSAM_VDEV(HUB, KIP, SSAM_SSH_TC_BAS, 0x00), (unsigned long)&base_hub }, + { } + }; + MODULE_DEVICE_TABLE(ssam, ssam_hub_match); +diff --git a/drivers/platform/surface/surface_aggregator_tabletsw.c b/drivers/platform/surface/surface_aggregator_tabletsw.c +index bd8cd453c393..6147aa887939 100644 +--- a/drivers/platform/surface/surface_aggregator_tabletsw.c ++++ b/drivers/platform/surface/surface_aggregator_tabletsw.c +@@ -510,8 +510,8 @@ static const struct ssam_tablet_sw_desc ssam_pos_sw_desc = { + /* -- Driver registration. -------------------------------------------------- */ + + static const struct ssam_device_id ssam_tablet_sw_match[] = { +- { SSAM_SDEV(KIP, 0x01, 0x00, 0x01), (unsigned long)&ssam_kip_sw_desc }, +- { SSAM_SDEV(POS, 0x01, 0x00, 0x01), (unsigned long)&ssam_pos_sw_desc }, ++ { SSAM_SDEV(KIP, SAM, 0x00, 0x01), (unsigned long)&ssam_kip_sw_desc }, ++ { SSAM_SDEV(POS, SAM, 0x00, 0x01), (unsigned long)&ssam_pos_sw_desc }, + { }, + }; + MODULE_DEVICE_TABLE(ssam, ssam_tablet_sw_match); +diff --git a/drivers/platform/surface/surface_dtx.c b/drivers/platform/surface/surface_dtx.c +index 0de76a784a35..30cbde278c59 100644 +--- a/drivers/platform/surface/surface_dtx.c ++++ b/drivers/platform/surface/surface_dtx.c +@@ -1214,7 +1214,7 @@ static void surface_dtx_ssam_remove(struct ssam_device *sdev) + } + + static const struct ssam_device_id surface_dtx_ssam_match[] = { +- { SSAM_SDEV(BAS, 0x01, 0x00, 0x00) }, ++ { SSAM_SDEV(BAS, SAM, 0x00, 0x00) }, + { }, + }; + MODULE_DEVICE_TABLE(ssam, surface_dtx_ssam_match); +diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c +index fbf2e11fd6ce..f433a13c3689 100644 +--- a/drivers/platform/surface/surface_platform_profile.c ++++ b/drivers/platform/surface/surface_platform_profile.c +@@ -169,7 +169,7 @@ static void surface_platform_profile_remove(struct ssam_device *sdev) + } + + static const struct ssam_device_id ssam_platform_profile_match[] = { +- { SSAM_SDEV(TMP, 0x01, 0x00, 0x01) }, ++ { SSAM_SDEV(TMP, SAM, 0x00, 0x01) }, + { }, + }; + MODULE_DEVICE_TABLE(ssam, ssam_platform_profile_match); +diff --git a/drivers/power/supply/surface_battery.c b/drivers/power/supply/surface_battery.c +index 540707882bb0..19d2f8834e56 100644 +--- a/drivers/power/supply/surface_battery.c ++++ b/drivers/power/supply/surface_battery.c +@@ -852,8 +852,8 @@ static const struct spwr_psy_properties spwr_psy_props_bat2_sb3 = { + }; + + static const struct ssam_device_id surface_battery_match[] = { +- { SSAM_SDEV(BAT, 0x01, 0x01, 0x00), (unsigned long)&spwr_psy_props_bat1 }, +- { SSAM_SDEV(BAT, 0x02, 0x01, 0x00), (unsigned long)&spwr_psy_props_bat2_sb3 }, ++ { SSAM_SDEV(BAT, SAM, 0x01, 0x00), (unsigned long)&spwr_psy_props_bat1 }, ++ { SSAM_SDEV(BAT, KIP, 0x01, 0x00), (unsigned long)&spwr_psy_props_bat2_sb3 }, + { }, + }; + MODULE_DEVICE_TABLE(ssam, surface_battery_match); +diff --git a/drivers/power/supply/surface_charger.c b/drivers/power/supply/surface_charger.c +index 59182d55742d..cabdd8da12d0 100644 +--- a/drivers/power/supply/surface_charger.c ++++ b/drivers/power/supply/surface_charger.c +@@ -260,7 +260,7 @@ static const struct spwr_psy_properties spwr_psy_props_adp1 = { + }; + + static const struct ssam_device_id surface_ac_match[] = { +- { SSAM_SDEV(BAT, 0x01, 0x01, 0x01), (unsigned long)&spwr_psy_props_adp1 }, ++ { SSAM_SDEV(BAT, SAM, 0x01, 0x01), (unsigned long)&spwr_psy_props_adp1 }, + { }, + }; + MODULE_DEVICE_TABLE(ssam, surface_ac_match); +diff --git a/include/linux/surface_aggregator/device.h b/include/linux/surface_aggregator/device.h +index 46c45d1b6368..4da20b7a0ee5 100644 +--- a/include/linux/surface_aggregator/device.h ++++ b/include/linux/surface_aggregator/device.h +@@ -68,9 +68,9 @@ struct ssam_device_uid { + * match_flags member of the device ID structure. Do not use them directly + * with struct ssam_device_id or struct ssam_device_uid. + */ +-#define SSAM_ANY_TID 0xffff +-#define SSAM_ANY_IID 0xffff +-#define SSAM_ANY_FUN 0xffff ++#define SSAM_SSH_TID_ANY 0xffff ++#define SSAM_SSH_IID_ANY 0xffff ++#define SSAM_SSH_FUN_ANY 0xffff + + /** + * SSAM_DEVICE() - Initialize a &struct ssam_device_id with the given +@@ -83,25 +83,25 @@ struct ssam_device_uid { + * + * Initializes a &struct ssam_device_id with the given parameters. See &struct + * ssam_device_uid for details regarding the parameters. The special values +- * %SSAM_ANY_TID, %SSAM_ANY_IID, and %SSAM_ANY_FUN can be used to specify that ++ * %SSAM_SSH_TID_ANY, %SSAM_SSH_IID_ANY, and %SSAM_SSH_FUN_ANY can be used to specify that + * matching should ignore target ID, instance ID, and/or sub-function, + * respectively. This macro initializes the ``match_flags`` field based on the + * given parameters. + * + * Note: The parameters @d and @cat must be valid &u8 values, the parameters +- * @tid, @iid, and @fun must be either valid &u8 values or %SSAM_ANY_TID, +- * %SSAM_ANY_IID, or %SSAM_ANY_FUN, respectively. Other non-&u8 values are not ++ * @tid, @iid, and @fun must be either valid &u8 values or %SSAM_SSH_TID_ANY, ++ * %SSAM_SSH_IID_ANY, or %SSAM_SSH_FUN_ANY, respectively. Other non-&u8 values are not + * allowed. + */ + #define SSAM_DEVICE(d, cat, tid, iid, fun) \ +- .match_flags = (((tid) != SSAM_ANY_TID) ? SSAM_MATCH_TARGET : 0) \ +- | (((iid) != SSAM_ANY_IID) ? SSAM_MATCH_INSTANCE : 0) \ +- | (((fun) != SSAM_ANY_FUN) ? SSAM_MATCH_FUNCTION : 0), \ ++ .match_flags = (((tid) != SSAM_SSH_TID_ANY) ? SSAM_MATCH_TARGET : 0) \ ++ | (((iid) != SSAM_SSH_IID_ANY) ? SSAM_MATCH_INSTANCE : 0) \ ++ | (((fun) != SSAM_SSH_FUN_ANY) ? SSAM_MATCH_FUNCTION : 0), \ + .domain = d, \ + .category = cat, \ +- .target = __builtin_choose_expr((tid) != SSAM_ANY_TID, (tid), 0), \ +- .instance = __builtin_choose_expr((iid) != SSAM_ANY_IID, (iid), 0), \ +- .function = __builtin_choose_expr((fun) != SSAM_ANY_FUN, (fun), 0) ++ .target = __builtin_choose_expr((tid) != SSAM_SSH_TID_ANY, (tid), 0), \ ++ .instance = __builtin_choose_expr((iid) != SSAM_SSH_IID_ANY, (iid), 0), \ ++ .function = __builtin_choose_expr((fun) != SSAM_SSH_FUN_ANY, (fun), 0) + + /** + * SSAM_VDEV() - Initialize a &struct ssam_device_id as virtual device with +@@ -113,18 +113,18 @@ struct ssam_device_uid { + * + * Initializes a &struct ssam_device_id with the given parameters in the + * virtual domain. See &struct ssam_device_uid for details regarding the +- * parameters. The special values %SSAM_ANY_TID, %SSAM_ANY_IID, and +- * %SSAM_ANY_FUN can be used to specify that matching should ignore target ID, ++ * parameters. The special values %SSAM_SSH_TID_ANY, %SSAM_SSH_IID_ANY, and ++ * %SSAM_SSH_FUN_ANY can be used to specify that matching should ignore target ID, + * instance ID, and/or sub-function, respectively. This macro initializes the + * ``match_flags`` field based on the given parameters. + * + * Note: The parameter @cat must be a valid &u8 value, the parameters @tid, +- * @iid, and @fun must be either valid &u8 values or %SSAM_ANY_TID, +- * %SSAM_ANY_IID, or %SSAM_ANY_FUN, respectively. Other non-&u8 values are not ++ * @iid, and @fun must be either valid &u8 values or %SSAM_SSH_TID_ANY, ++ * %SSAM_SSH_IID_ANY, or %SSAM_SSH_FUN_ANY, respectively. Other non-&u8 values are not + * allowed. + */ + #define SSAM_VDEV(cat, tid, iid, fun) \ +- SSAM_DEVICE(SSAM_DOMAIN_VIRTUAL, SSAM_VIRTUAL_TC_##cat, tid, iid, fun) ++ SSAM_DEVICE(SSAM_DOMAIN_VIRTUAL, SSAM_VIRTUAL_TC_##cat, SSAM_SSH_TID_##tid, iid, fun) + + /** + * SSAM_SDEV() - Initialize a &struct ssam_device_id as physical SSH device +@@ -136,18 +136,18 @@ struct ssam_device_uid { + * + * Initializes a &struct ssam_device_id with the given parameters in the SSH + * domain. See &struct ssam_device_uid for details regarding the parameters. +- * The special values %SSAM_ANY_TID, %SSAM_ANY_IID, and %SSAM_ANY_FUN can be +- * used to specify that matching should ignore target ID, instance ID, and/or +- * sub-function, respectively. This macro initializes the ``match_flags`` +- * field based on the given parameters. ++ * The special values %SSAM_SSH_TID_ANY, %SSAM_SSH_IID_ANY, and ++ * %SSAM_SSH_FUN_ANY can be used to specify that matching should ignore target ++ * ID, instance ID, and/or sub-function, respectively. This macro initializes ++ * the ``match_flags`` field based on the given parameters. + * + * Note: The parameter @cat must be a valid &u8 value, the parameters @tid, +- * @iid, and @fun must be either valid &u8 values or %SSAM_ANY_TID, +- * %SSAM_ANY_IID, or %SSAM_ANY_FUN, respectively. Other non-&u8 values are not +- * allowed. ++ * @iid, and @fun must be either valid &u8 values or %SSAM_SSH_TID_ANY, ++ * %SSAM_SSH_IID_ANY, or %SSAM_SSH_FUN_ANY, respectively. Other non-&u8 values ++ * are not allowed. + */ + #define SSAM_SDEV(cat, tid, iid, fun) \ +- SSAM_DEVICE(SSAM_DOMAIN_SERIALHUB, SSAM_SSH_TC_##cat, tid, iid, fun) ++ SSAM_DEVICE(SSAM_DOMAIN_SERIALHUB, SSAM_SSH_TC_##cat, SSAM_SSH_TID_##tid, iid, fun) + + /* + * enum ssam_device_flags - Flags for SSAM client devices. +-- +2.39.0 + +From 750fd72a40d0b59cf14d2f60d96129e07c8feb3b Mon Sep 17 00:00:00 2001 +From: Maximilian Luz +Date: Sat, 5 Nov 2022 21:46:37 +0100 +Subject: [PATCH] platform/surface: aggregator_registry: Fix target-ID of + base-hub + +The target ID of the base hub is currently set to KIP (keyboard/ +peripherals). However, even though it manages such devices with the KIP +target ID, the base hub itself is actually accessed via the SAM target +ID. So set it accordingly. + +Signed-off-by: Maximilian Luz +Patchset: surface-sam +--- + drivers/platform/surface/surface_aggregator_hub.c | 2 +- + drivers/platform/surface/surface_aggregator_registry.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/platform/surface/surface_aggregator_hub.c b/drivers/platform/surface/surface_aggregator_hub.c +index 6abd1efe2088..8b8b80228c14 100644 +--- a/drivers/platform/surface/surface_aggregator_hub.c ++++ b/drivers/platform/surface/surface_aggregator_hub.c +@@ -349,7 +349,7 @@ static const struct ssam_hub_desc kip_hub = { + + static const struct ssam_device_id ssam_hub_match[] = { + { SSAM_VDEV(HUB, SAM, SSAM_SSH_TC_KIP, 0x00), (unsigned long)&kip_hub }, +- { SSAM_VDEV(HUB, KIP, SSAM_SSH_TC_BAS, 0x00), (unsigned long)&base_hub }, ++ { SSAM_VDEV(HUB, SAM, SSAM_SSH_TC_BAS, 0x00), (unsigned long)&base_hub }, + { } + }; + MODULE_DEVICE_TABLE(ssam, ssam_hub_match); +diff --git a/drivers/platform/surface/surface_aggregator_registry.c b/drivers/platform/surface/surface_aggregator_registry.c +index 023f126121d7..296f72d52e6a 100644 +--- a/drivers/platform/surface/surface_aggregator_registry.c ++++ b/drivers/platform/surface/surface_aggregator_registry.c +@@ -46,7 +46,7 @@ static const struct software_node ssam_node_hub_kip = { + + /* 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", ++ .name = "ssam:00:00:01:11:00", + .parent = &ssam_node_root, + }; + +-- +2.39.0 + +From 39de2cbafc518c16f54502cba518292fa327c2ba Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sat, 25 Jul 2020 17:19:53 +0200 Subject: [PATCH] i2c: acpi: Implement RawBytes read access @@ -2181,9 +3360,9 @@ index 08b561f0709d..d7c397bce0f0 100644 dev_warn(&adapter->dev, "protocol 0x%02x not supported for client 0x%02x\n", accessor_type, client->addr); -- -2.38.1 +2.39.0 -From 7e4238440be15bc04cfd8d127367a209e0940022 Mon Sep 17 00:00:00 2001 +From e6873dbb15c7462b6bf0ed744a0a9533a3221c3c Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sat, 13 Feb 2021 16:41:18 +0100 Subject: [PATCH] platform/surface: Add driver for Surface Book 1 dGPU switch @@ -2404,9 +3583,9 @@ index 000000000000..8b816ed8f35c +MODULE_DESCRIPTION("Discrete GPU Power-Switch for Surface Book 1"); +MODULE_LICENSE("GPL"); -- -2.38.1 +2.39.0 -From 8991bf274ff740a7450f836ede983fe78831c106 Mon Sep 17 00:00:00 2001 +From 9720c3a721dce97129a6237686f595f6fa1a0c46 Mon Sep 17 00:00:00 2001 From: Sachi King Date: Tue, 5 Oct 2021 00:05:09 +1100 Subject: [PATCH] Input: soc_button_array - support AMD variant Surface devices @@ -2428,10 +3607,10 @@ Patchset: surface-button 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c -index 480476121c01..36e1bf7b7a01 100644 +index 09489380afda..0f02411a60f1 100644 --- a/drivers/input/misc/soc_button_array.c +++ b/drivers/input/misc/soc_button_array.c -@@ -495,8 +495,8 @@ static const struct soc_device_data soc_device_MSHW0028 = { +@@ -507,8 +507,8 @@ static const struct soc_device_data soc_device_MSHW0028 = { * Both, the Surface Pro 4 (surfacepro3_button.c) and the above mentioned * devices use MSHW0040 for power and volume buttons, however the way they * have to be addressed differs. Make sure that we only load this drivers @@ -2442,7 +3621,7 @@ index 480476121c01..36e1bf7b7a01 100644 */ #define MSHW0040_DSM_REVISION 0x01 #define MSHW0040_DSM_GET_OMPR 0x02 // get OEM Platform Revision -@@ -507,31 +507,14 @@ static const guid_t MSHW0040_DSM_UUID = +@@ -519,31 +519,14 @@ static const guid_t MSHW0040_DSM_UUID = static int soc_device_check_MSHW0040(struct device *dev) { acpi_handle handle = ACPI_HANDLE(dev); @@ -2481,9 +3660,9 @@ index 480476121c01..36e1bf7b7a01 100644 /* -- -2.38.1 +2.39.0 -From 135725875006c05db9b8b4d2a9fb2762dce97234 Mon Sep 17 00:00:00 2001 +From 5d18576868861ca3940c80571624244e680d88c1 Mon Sep 17 00:00:00 2001 From: Sachi King Date: Tue, 5 Oct 2021 00:22:57 +1100 Subject: [PATCH] platform/surface: surfacepro3_button: don't load on amd @@ -2553,9 +3732,9 @@ index 242fb690dcaf..30eea54dbb47 100644 -- -2.38.1 +2.39.0 -From 57fa94c5a26bf24cdb99b9f7135b156f379ba742 Mon Sep 17 00:00:00 2001 +From 13d49496820a68c21b5ac20041d2cf74867432bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Thu, 5 Nov 2020 13:09:45 +0100 Subject: [PATCH] hid/multitouch: Turn off Type Cover keyboard backlight when @@ -2591,7 +3770,7 @@ Patchset: surface-typecover 1 file changed, 98 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c -index 91a4d3fc30e0..458537bf4a8e 100644 +index 372cbdd223e0..fe849df6a948 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -34,7 +34,10 @@ @@ -2773,7 +3952,7 @@ index 91a4d3fc30e0..458537bf4a8e 100644 del_timer_sync(&td->release_timer); sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group); -@@ -2191,6 +2282,11 @@ static const struct hid_device_id mt_devices[] = { +@@ -2195,6 +2286,11 @@ static const struct hid_device_id mt_devices[] = { MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_CSR2) }, @@ -2786,9 +3965,9 @@ index 91a4d3fc30e0..458537bf4a8e 100644 { .driver_data = MT_CLS_GOOGLE, HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_GOOGLE, -- -2.38.1 +2.39.0 -From b2b83714f120894994c701f2ccaddcbceab37b7c Mon Sep 17 00:00:00 2001 +From e41b6a2bd630af9fbdd8fb867b864ebacb32cffa Mon Sep 17 00:00:00 2001 From: PJungkamp Date: Fri, 25 Feb 2022 12:04:25 +0100 Subject: [PATCH] hid/multitouch: Add support for surface pro type cover tablet @@ -2817,7 +3996,7 @@ Patchset: surface-typecover 1 file changed, 122 insertions(+), 26 deletions(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c -index 458537bf4a8e..3d7d002a662f 100644 +index fe849df6a948..3a7a43eb9fbe 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -76,6 +76,7 @@ MODULE_LICENSE("GPL"); @@ -3086,9 +4265,9 @@ index 458537bf4a8e..3d7d002a662f 100644 unregister_pm_notifier(&td->pm_notifier); del_timer_sync(&td->release_timer); -- -2.38.1 +2.39.0 -From 1da322aaee27fbeb57d1c5ae4c9815e61c13a2ee Mon Sep 17 00:00:00 2001 +From 430f74608d06e994535175627d00b7d62abdd828 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 10 Oct 2021 20:56:57 +0200 Subject: [PATCH] ACPI: delay enumeration of devices with a _DEP pointing to an @@ -3148,10 +4327,10 @@ Patchset: cameras 1 file changed, 3 insertions(+) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c -index 42cec8120f18..72d0e599120f 100644 +index adfeb5770efd..a355c64899f8 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c -@@ -2108,6 +2108,9 @@ static acpi_status acpi_bus_check_add_2(acpi_handle handle, u32 lvl_not_used, +@@ -2109,6 +2109,9 @@ static acpi_status acpi_bus_check_add_2(acpi_handle handle, u32 lvl_not_used, static void acpi_default_enumeration(struct acpi_device *device) { @@ -3162,9 +4341,9 @@ index 42cec8120f18..72d0e599120f 100644 * Do not enumerate devices with enumeration_by_parent flag set as * they will be enumerated by their respective parents. -- -2.38.1 +2.39.0 -From a01e3c26872c6fd5872fbaacbc28b049666ceefc Mon Sep 17 00:00:00 2001 +From 21d0337ca18b7a923f5ccd9e67aa978848f29efd Mon Sep 17 00:00:00 2001 From: zouxiaoh Date: Fri, 25 Jun 2021 08:52:59 +0800 Subject: [PATCH] iommu: intel-ipu: use IOMMU passthrough mode for Intel IPUs @@ -3190,7 +4369,7 @@ Patchset: cameras 1 file changed, 30 insertions(+) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c -index 4c895b5f7e2d..f68f031dee46 100644 +index 5246e3f25ac1..646a84a545e6 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -37,6 +37,12 @@ @@ -3221,7 +4400,7 @@ index 4c895b5f7e2d..f68f031dee46 100644 #define IDENTMAP_IPTS 16 const struct iommu_ops intel_iommu_ops; -@@ -2608,6 +2616,9 @@ static int device_def_domain_type(struct device *dev) +@@ -2606,6 +2614,9 @@ static int device_def_domain_type(struct device *dev) if ((iommu_identity_mapping & IDENTMAP_GFX) && IS_GFX_DEVICE(pdev)) return IOMMU_DOMAIN_IDENTITY; @@ -3231,7 +4410,7 @@ index 4c895b5f7e2d..f68f031dee46 100644 if ((iommu_identity_mapping & IDENTMAP_IPTS) && IS_IPTS(pdev)) return IOMMU_DOMAIN_IDENTITY; } -@@ -2999,6 +3010,9 @@ static int __init init_dmars(void) +@@ -2997,6 +3008,9 @@ static int __init init_dmars(void) if (!dmar_map_gfx) iommu_identity_mapping |= IDENTMAP_GFX; @@ -3279,9 +4458,9 @@ index 4c895b5f7e2d..f68f031dee46 100644 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9D3E, quirk_iommu_ipts); -- -2.38.1 +2.39.0 -From b230cd2a5edce8159650e62d0d9d08f747cad31c Mon Sep 17 00:00:00 2001 +From 21b1211e77ae7cc95bb37f071279692a91c984f4 Mon Sep 17 00:00:00 2001 From: Daniel Scally Date: Sun, 10 Oct 2021 20:57:02 +0200 Subject: [PATCH] platform/x86: int3472: Enable I2c daisy chain @@ -3316,9 +4495,9 @@ index 22f61b47f9e5..e1de1ff40bba 100644 return 0; -- -2.38.1 +2.39.0 -From 93168a83c8861680db54dde07dfcb10d42c1e9c7 Mon Sep 17 00:00:00 2001 +From 192278672d992a5b7b265b9e3f4dd3ff1a40be2a Mon Sep 17 00:00:00 2001 From: Daniel Scally Date: Thu, 28 Oct 2021 21:55:16 +0100 Subject: [PATCH] media: i2c: Add driver for DW9719 VCM @@ -3822,9 +5001,9 @@ index 000000000000..8451c75b696b +MODULE_DESCRIPTION("DW9719 VCM Driver"); +MODULE_LICENSE("GPL"); -- -2.38.1 +2.39.0 -From 88c4b8f25be8353c1c57dbdcb925b209e02ac49d Mon Sep 17 00:00:00 2001 +From daa4ef965d72676c34d26d6d2ba3b47d35c860f9 Mon Sep 17 00:00:00 2001 From: Daniel Scally Date: Wed, 4 May 2022 23:21:45 +0100 Subject: [PATCH] media: ipu3-cio2: Move functionality from .complete() to @@ -3937,9 +5116,9 @@ index a3fe547b7fce..5648f29ced7b 100644 static int cio2_parse_firmware(struct cio2_device *cio2) -- -2.38.1 +2.39.0 -From 7a735d80c21df58382d2c3d33748f867bf05fd67 Mon Sep 17 00:00:00 2001 +From babc2aa098f54e0fe830242e2b5a9f19be0922c1 Mon Sep 17 00:00:00 2001 From: Daniel Scally Date: Thu, 2 Jun 2022 22:15:56 +0100 Subject: [PATCH] media: ipu3-cio2: Re-add .complete() to ipu3-cio2 @@ -3980,9 +5159,9 @@ index 5648f29ced7b..957a30cd369d 100644 static int cio2_parse_firmware(struct cio2_device *cio2) -- -2.38.1 +2.39.0 -From 9e13a833faa1b5e7110a8ef939fd628d16cbfef4 Mon Sep 17 00:00:00 2001 +From 913f266da3ed3df1276361c5c9a3f352cc2f3a14 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Fri, 15 Jul 2022 23:48:00 +0200 Subject: [PATCH] drivers/media/i2c: Fix DW9719 dependencies @@ -4009,140 +5188,9 @@ index 98d081efeef7..c67966cafe10 100644 select VIDEO_V4L2_SUBDEV_API select V4L2_ASYNC -- -2.38.1 - -From 6036672bab4a63b554485dca3b743df8047b9ac3 Mon Sep 17 00:00:00 2001 -From: Maximilian Luz -Date: Wed, 7 Sep 2022 15:38:08 +0200 -Subject: [PATCH] ipu3-imgu: Fix NULL pointer dereference in - imgu_subdev_set_selection() - -Calling v4l2_subdev_get_try_crop() and v4l2_subdev_get_try_compose() -with a subdev state of NULL leads to a NULL pointer dereference. This -can currently happen in imgu_subdev_set_selection() when the state -passed in is NULL, as this method first gets pointers to both the "try" -and "active" states and only then decides which to use. - -The same issue has been addressed for imgu_subdev_get_selection() with -commit 30d03a0de650 ("ipu3-imgu: Fix NULL pointer dereference in active -selection access"). However the issue still persists in -imgu_subdev_set_selection(). - -Therefore, apply a similar fix as done in the aforementioned commit to -imgu_subdev_set_selection(). To keep things a bit cleaner, introduce -helper functions for "crop" and "compose" access and use them in both -imgu_subdev_set_selection() and imgu_subdev_get_selection(). - -Fixes: 0d346d2a6f54 ("media: v4l2-subdev: add subdev-wide state struct") -Cc: stable@vger.kernel.org # for v5.14 and later -Signed-off-by: Maximilian Luz -Patchset: cameras ---- - drivers/staging/media/ipu3/ipu3-v4l2.c | 57 +++++++++++++++----------- - 1 file changed, 34 insertions(+), 23 deletions(-) - -diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c -index 2234bb8d48b3..490ba0eb249b 100644 ---- a/drivers/staging/media/ipu3/ipu3-v4l2.c -+++ b/drivers/staging/media/ipu3/ipu3-v4l2.c -@@ -188,6 +188,28 @@ static int imgu_subdev_set_fmt(struct v4l2_subdev *sd, - return 0; - } - -+static struct v4l2_rect * -+imgu_subdev_get_crop(struct imgu_v4l2_subdev *sd, -+ struct v4l2_subdev_state *sd_state, unsigned int pad, -+ enum v4l2_subdev_format_whence which) -+{ -+ if (which == V4L2_SUBDEV_FORMAT_TRY) -+ return v4l2_subdev_get_try_crop(&sd->subdev, sd_state, pad); -+ else -+ return &sd->rect.eff; -+} -+ -+static struct v4l2_rect * -+imgu_subdev_get_compose(struct imgu_v4l2_subdev *sd, -+ struct v4l2_subdev_state *sd_state, unsigned int pad, -+ enum v4l2_subdev_format_whence which) -+{ -+ if (which == V4L2_SUBDEV_FORMAT_TRY) -+ return v4l2_subdev_get_try_compose(&sd->subdev, sd_state, pad); -+ else -+ return &sd->rect.bds; -+} -+ - static int imgu_subdev_get_selection(struct v4l2_subdev *sd, - struct v4l2_subdev_state *sd_state, - struct v4l2_subdev_selection *sel) -@@ -200,18 +222,12 @@ static int imgu_subdev_get_selection(struct v4l2_subdev *sd, - - switch (sel->target) { - case V4L2_SEL_TGT_CROP: -- if (sel->which == V4L2_SUBDEV_FORMAT_TRY) -- sel->r = *v4l2_subdev_get_try_crop(sd, sd_state, -- sel->pad); -- else -- sel->r = imgu_sd->rect.eff; -+ sel->r = *imgu_subdev_get_crop(imgu_sd, sd_state, sel->pad, -+ sel->which); - return 0; - case V4L2_SEL_TGT_COMPOSE: -- if (sel->which == V4L2_SUBDEV_FORMAT_TRY) -- sel->r = *v4l2_subdev_get_try_compose(sd, sd_state, -- sel->pad); -- else -- sel->r = imgu_sd->rect.bds; -+ sel->r = *imgu_subdev_get_compose(imgu_sd, sd_state, sel->pad, -+ sel->which); - return 0; - default: - return -EINVAL; -@@ -223,10 +239,9 @@ static int imgu_subdev_set_selection(struct v4l2_subdev *sd, - struct v4l2_subdev_selection *sel) - { - struct imgu_device *imgu = v4l2_get_subdevdata(sd); -- struct imgu_v4l2_subdev *imgu_sd = container_of(sd, -- struct imgu_v4l2_subdev, -- subdev); -- struct v4l2_rect *rect, *try_sel; -+ struct imgu_v4l2_subdev *imgu_sd = -+ container_of(sd, struct imgu_v4l2_subdev, subdev); -+ struct v4l2_rect *rect; - - dev_dbg(&imgu->pci_dev->dev, - "set subdev %u sel which %u target 0x%4x rect [%ux%u]", -@@ -238,22 +253,18 @@ static int imgu_subdev_set_selection(struct v4l2_subdev *sd, - - switch (sel->target) { - case V4L2_SEL_TGT_CROP: -- try_sel = v4l2_subdev_get_try_crop(sd, sd_state, sel->pad); -- rect = &imgu_sd->rect.eff; -+ rect = imgu_subdev_get_crop(imgu_sd, sd_state, sel->pad, -+ sel->which); - break; - case V4L2_SEL_TGT_COMPOSE: -- try_sel = v4l2_subdev_get_try_compose(sd, sd_state, sel->pad); -- rect = &imgu_sd->rect.bds; -+ rect = imgu_subdev_get_compose(imgu_sd, sd_state, sel->pad, -+ sel->which); - break; - default: - return -EINVAL; - } - -- if (sel->which == V4L2_SUBDEV_FORMAT_TRY) -- *try_sel = sel->r; -- else -- *rect = sel->r; -- -+ *rect = sel->r; - return 0; - } - --- -2.38.1 +2.39.0 -From 6ebcbcebe441381c19768044c655735725139c99 Mon Sep 17 00:00:00 2001 +From 17553e3e80c6efea023e3ed54131ee02a32fb2ef Mon Sep 17 00:00:00 2001 From: Sachi King Date: Sat, 29 May 2021 17:47:38 +1000 Subject: [PATCH] ACPI: Add quirk for Surface Laptop 4 AMD missing irq 7 @@ -4207,9 +5255,9 @@ index 907cc98b1938..0116d27b29ea 100644 mp_config_acpi_legacy_irqs(); -- -2.38.1 +2.39.0 -From a2037d0d5c58bd7973ad372c7788fc31fa2f9b72 Mon Sep 17 00:00:00 2001 +From d8080092e1c6700c9fba3442a8c25946ef168876 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Thu, 3 Jun 2021 14:04:26 +0200 Subject: [PATCH] ACPI: Add AMD 13" Surface Laptop 4 model to irq 7 override @@ -4249,5 +5297,114 @@ index 0116d27b29ea..af102c6f8e5b 100644 }; -- -2.38.1 +2.39.0 + +From c66f37c54939a3aa60ecacf00b4cc226599d021f Mon Sep 17 00:00:00 2001 +From: "Bart Groeneveld | GPX Solutions B.V" +Date: Mon, 5 Dec 2022 16:08:46 +0100 +Subject: [PATCH] acpi: allow usage of acpi_tad on HW-reduced platforms + +The specification [1] allows so-called HW-reduced platforms, +which do not implement everything, especially the wakeup related stuff. + +In that case, it is still usable as a RTC. This is helpful for [2] +and [3], which is about a device with no other working RTC, +but it does have an HW-reduced TAD, which can be used as a RTC instead. + +[1]: https://uefi.org/specs/ACPI/6.5/09_ACPI_Defined_Devices_and_Device_Specific_Objects.html#time-and-alarm-device +[2]: https://bugzilla.kernel.org/show_bug.cgi?id=212313 +[3]: https://github.com/linux-surface/linux-surface/issues/415 + +Signed-off-by: Bart Groeneveld | GPX Solutions B.V. +Patchset: rtc +--- + drivers/acpi/acpi_tad.c | 35 ++++++++++++++++++++++++----------- + 1 file changed, 24 insertions(+), 11 deletions(-) + +diff --git a/drivers/acpi/acpi_tad.c b/drivers/acpi/acpi_tad.c +index e9b8e8305e23..944276934e7e 100644 +--- a/drivers/acpi/acpi_tad.c ++++ b/drivers/acpi/acpi_tad.c +@@ -432,6 +432,14 @@ static ssize_t caps_show(struct device *dev, struct device_attribute *attr, + + static DEVICE_ATTR_RO(caps); + ++static struct attribute *acpi_tad_attrs[] = { ++ &dev_attr_caps.attr, ++ NULL, ++}; ++static const struct attribute_group acpi_tad_attr_group = { ++ .attrs = acpi_tad_attrs, ++}; ++ + static ssize_t ac_alarm_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) + { +@@ -480,15 +488,14 @@ static ssize_t ac_status_show(struct device *dev, struct device_attribute *attr, + + static DEVICE_ATTR_RW(ac_status); + +-static struct attribute *acpi_tad_attrs[] = { +- &dev_attr_caps.attr, ++static struct attribute *acpi_tad_ac_attrs[] = { + &dev_attr_ac_alarm.attr, + &dev_attr_ac_policy.attr, + &dev_attr_ac_status.attr, + NULL, + }; +-static const struct attribute_group acpi_tad_attr_group = { +- .attrs = acpi_tad_attrs, ++static const struct attribute_group acpi_tad_ac_attr_group = { ++ .attrs = acpi_tad_ac_attrs, + }; + + static ssize_t dc_alarm_store(struct device *dev, struct device_attribute *attr, +@@ -563,13 +570,18 @@ static int acpi_tad_remove(struct platform_device *pdev) + + pm_runtime_get_sync(dev); + ++ if (dd->capabilities & ACPI_TAD_AC_WAKE) ++ sysfs_remove_group(&dev->kobj, &acpi_tad_ac_attr_group); ++ + if (dd->capabilities & ACPI_TAD_DC_WAKE) + sysfs_remove_group(&dev->kobj, &acpi_tad_dc_attr_group); + + sysfs_remove_group(&dev->kobj, &acpi_tad_attr_group); + +- acpi_tad_disable_timer(dev, ACPI_TAD_AC_TIMER); +- acpi_tad_clear_status(dev, ACPI_TAD_AC_TIMER); ++ if (dd->capabilities & ACPI_TAD_AC_WAKE) { ++ acpi_tad_disable_timer(dev, ACPI_TAD_AC_TIMER); ++ acpi_tad_clear_status(dev, ACPI_TAD_AC_TIMER); ++ } + if (dd->capabilities & ACPI_TAD_DC_WAKE) { + acpi_tad_disable_timer(dev, ACPI_TAD_DC_TIMER); + acpi_tad_clear_status(dev, ACPI_TAD_DC_TIMER); +@@ -604,11 +616,6 @@ static int acpi_tad_probe(struct platform_device *pdev) + return -ENODEV; + } + +- if (!acpi_has_method(handle, "_PRW")) { +- dev_info(dev, "Missing _PRW\n"); +- return -ENODEV; +- } +- + dd = devm_kzalloc(dev, sizeof(*dd), GFP_KERNEL); + if (!dd) + return -ENOMEM; +@@ -637,6 +644,12 @@ static int acpi_tad_probe(struct platform_device *pdev) + if (ret) + goto fail; + ++ if (caps & ACPI_TAD_AC_WAKE) { ++ ret = sysfs_create_group(&dev->kobj, &acpi_tad_ac_attr_group); ++ if (ret) ++ goto fail; ++ } ++ + if (caps & ACPI_TAD_DC_WAKE) { + ret = sysfs_create_group(&dev->kobj, &acpi_tad_dc_attr_group); + if (ret) +-- +2.39.0 diff --git a/SOURCES/patch-6.0-redhat.patch b/SOURCES/patch-6.0-redhat.patch index 53cb710..3106d49 100644 --- a/SOURCES/patch-6.0-redhat.patch +++ b/SOURCES/patch-6.0-redhat.patch @@ -48,7 +48,7 @@ 47 files changed, 767 insertions(+), 367 deletions(-) diff --git a/Makefile b/Makefile -index a0ddac5b7caf..4928c29f049a 100644 +index 0104f69d30bb..20a377175eed 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,10 @@ $(if $(filter __%, $(MAKECMDGOALS)), \ @@ -331,7 +331,7 @@ index bbf7029e224b..cf7faa970dd6 100644 dmi_decode_ipmi((const struct dmi_header *) dev->device_data); diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c -index c9e32d100b7e..bfe9bd1fde24 100644 +index b151cbfc3d9b..8ec5772f8bb0 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -35,6 +35,7 @@ @@ -342,7 +342,7 @@ index c9e32d100b7e..bfe9bd1fde24 100644 #include #define IPMI_DRIVER_VERSION "39.2" -@@ -5520,8 +5521,21 @@ static int __init ipmi_init_msghandler_mod(void) +@@ -5522,8 +5523,21 @@ static int __init ipmi_init_msghandler_mod(void) { int rv; @@ -1269,7 +1269,7 @@ index 49238ddd39ee..5d8c37c3e15a 100644 if (!pci_dev->driver) return 0; diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c -index 95bc329e74c0..107afa0a5b03 100644 +index a484da1a9c66..29dc20615d36 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -2706,24 +2706,12 @@ int pci_prepare_to_sleep(struct pci_dev *dev) @@ -2086,10 +2086,10 @@ index e137cf15aae9..2ed2341f7967 100755 # Use make KBUILD_ABS_SRCTREE=1 {tags|cscope} # to force full paths for a non-O= build diff --git a/security/integrity/platform_certs/load_uefi.c b/security/integrity/platform_certs/load_uefi.c -index b78753d27d8e..f0b37800431a 100644 +index d1fdd113450a..182e8090cfe8 100644 --- a/security/integrity/platform_certs/load_uefi.c +++ b/security/integrity/platform_certs/load_uefi.c -@@ -73,7 +73,8 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid, +@@ -74,7 +74,8 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid, return NULL; if (*status != EFI_BUFFER_TOO_SMALL) { @@ -2099,7 +2099,7 @@ index b78753d27d8e..f0b37800431a 100644 return NULL; } -@@ -84,7 +85,8 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid, +@@ -85,7 +86,8 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid, *status = efi.get_variable(name, guid, NULL, &lsize, db); if (*status != EFI_SUCCESS) { kfree(db); -- cgit v1.2.3