From 623b89a51152d59bdf82dfdfcfcfb4c76c52a884 Mon Sep 17 00:00:00 2001 From: Philip Chen Date: Fri, 9 Aug 2019 14:49:38 -0700 Subject: acpi: Notify AP when setting DPTF profile number Assuming a device without hall sensor is switched from clamshell mode all the way to 360-degree-flipped mode, the event sequence is like: (a) When the device hits 200-degree, it switches to tablet mode. (b) We notify AP to re-read DPTF profile from ACPI. (c) When the device hits 300-degree, it switches to 360-degree flipped mode and updates DPTF profile in EC space. Since the DPTF profile is switched in (c) while AP re-reads the DPTF profile in (b), AP wouldn't update DPTF profile for 360-degree-flipped mode. To fix this issue, let's notify AP when updating DPTF profile. BUG=b:139168228 BRANCH=none TEST=manually test on Nautilus/Hatch and confirm trip temperature is updated in flipped-360-degree mode Change-Id: I3bc61fb3d7808bf17f7da7ebc606307fbbf026fc Signed-off-by: Philip Chen Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1747166 Reviewed-by: Paul Fagerburg Reviewed-by: Daisuke Nojiri Commit-Queue: Philip Chen Tested-by: Philip Chen --- common/acpi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/acpi.c b/common/acpi.c index e741fc2abc..68134a86e0 100644 --- a/common/acpi.c +++ b/common/acpi.c @@ -111,9 +111,14 @@ int acpi_dptf_set_profile_num(int n) { int ret = acpi_dptf_is_profile_valid(n); - if (ret == EC_SUCCESS) + if (ret == EC_SUCCESS) { current_dptf_profile = n; - + if (IS_ENABLED(CONFIG_DPTF_MULTI_PROFILE) && + IS_ENABLED(CONFIG_HOSTCMD_EVENTS)) { + /* Notify kernel to update DPTF profile */ + host_set_single_event(EC_HOST_EVENT_MODE_CHANGE); + } + } return ret; } -- cgit v1.2.1