X86 platform drivers
 help / color / mirror / Atom feed
* [PATCH] platform/x86/amd: pmf: Use meta + L for screen lock command
@ 2025-03-21 19:30 Mario Limonciello
  2025-03-21 21:16 ` Armin Wolf
  0 siblings, 1 reply; 6+ messages in thread
From: Mario Limonciello @ 2025-03-21 19:30 UTC (permalink / raw)
  To: mario.limonciello, Shyam-sundar.S-k, hdegoede, ilpo.jarvinen
  Cc: platform-driver-x86

From: Mario Limonciello <mario.limonciello@amd.com>

In practice userspace software doesn't react to KEY_SCREENLOCK by
default.  So any time that the PMF policies would suggest to lock
the screen (for example from an HPD sensor event) userspace isn't
configured to do it properly.

However userspace is configured for meta + L as this is the default
in the ecosystem. Adjust the PMF driver to send meta + L.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/platform/x86/amd/pmf/tee-if.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/amd/pmf/tee-if.c b/drivers/platform/x86/amd/pmf/tee-if.c
index 8c88769ea1d87..2c00f2baeec7b 100644
--- a/drivers/platform/x86/amd/pmf/tee-if.c
+++ b/drivers/platform/x86/amd/pmf/tee-if.c
@@ -151,7 +151,13 @@ static void amd_pmf_apply_policies(struct amd_pmf_dev *dev, struct ta_pmf_enact_
 				amd_pmf_update_uevents(dev, KEY_SUSPEND);
 				break;
 			case 2:
-				amd_pmf_update_uevents(dev, KEY_SCREENLOCK);
+				input_report_key(dev->pmf_idev, KEY_LEFTMETA, 1);
+				input_report_key(dev->pmf_idev, KEY_L, 1);
+				input_sync(dev->pmf_idev);
+				input_report_key(dev->pmf_idev, KEY_L, 0);
+				input_sync(dev->pmf_idev);
+				input_report_key(dev->pmf_idev, KEY_LEFTMETA, 0);
+				input_sync(dev->pmf_idev);
 				break;
 			default:
 				dev_err(dev->dev, "Invalid PMF policy system state: %d\n", val);
@@ -422,8 +428,9 @@ static int amd_pmf_register_input_device(struct amd_pmf_dev *dev)
 	dev->pmf_idev->phys = "amd-pmf/input0";
 
 	input_set_capability(dev->pmf_idev, EV_KEY, KEY_SLEEP);
-	input_set_capability(dev->pmf_idev, EV_KEY, KEY_SCREENLOCK);
 	input_set_capability(dev->pmf_idev, EV_KEY, KEY_SUSPEND);
+	input_set_capability(dev->pmf_idev, EV_KEY, KEY_L);
+	input_set_capability(dev->pmf_idev, EV_KEY, KEY_LEFTMETA);
 
 	err = input_register_device(dev->pmf_idev);
 	if (err) {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-04-03 15:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-21 19:30 [PATCH] platform/x86/amd: pmf: Use meta + L for screen lock command Mario Limonciello
2025-03-21 21:16 ` Armin Wolf
2025-03-21 22:25   ` Mario Limonciello
2025-03-31 17:49     ` Mario Limonciello
2025-04-03  1:48       ` Armin Wolf
2025-04-03 15:57         ` Mario Limonciello

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox