summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjames_chao <james_chao@asus.com>2016-07-26 12:03:00 +0800
committerchrome-bot <chrome-bot@chromium.org>2016-08-09 22:11:09 -0700
commitc144822368a3b112c4aeaafd24f208e38b650fe9 (patch)
treeee5f88072b4cbefa684c6f545456a23bd1ab44f0
parentf5f92bb83e3c89df3f0bf6b4844e070fba8a8159 (diff)
downloadchrome-ec-c144822368a3b112c4aeaafd24f208e38b650fe9.tar.gz
Acpi: Notify host when orientation changes
1. EC send EC_HOST_EVENT_MODE_CHANGE(29/0x1D) when mode changes 2. Host read current "physical mode" from EC ERAM 3. Host Nodify DPTF object BUG=chrome-os-partner:53526 BRANCH=master TEST=make buildall Change-Id: I3ede1ffd203024199884b3a0c56347ae630e6062 Signed-off-by: james_chao <james_chao@asus.com> Reviewed-on: https://chromium-review.googlesource.com/363220 Commit-Ready: BoChao Jhan <james_chao@asus.com> Tested-by: BoChao Jhan <james_chao@asus.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--common/acpi.c7
-rw-r--r--include/config.h3
-rw-r--r--include/ec_commands.h10
3 files changed, 20 insertions, 0 deletions
diff --git a/common/acpi.c b/common/acpi.c
index f4aba3af9b..f73dfd2db5 100644
--- a/common/acpi.c
+++ b/common/acpi.c
@@ -167,6 +167,13 @@ int acpi_ap_to_ec(int is_cmd, uint8_t value, uint8_t *resultptr)
result = EC_ACPI_MEM_CHARGING_LIMIT_DISABLED;
break;
#endif
+
+#ifdef CONFIG_DPTF_DEVICE_ORIENTATION
+ case EC_ACPI_MEM_DEVICE_ORIENTATION:
+ result = board_get_device_orientation();
+ break;
+#endif
+
default:
result = acpi_read(acpi_addr);
break;
diff --git a/include/config.h b/include/config.h
index a752e4c4d1..929c830013 100644
--- a/include/config.h
+++ b/include/config.h
@@ -810,6 +810,9 @@
*/
#undef CONFIG_FAN_UPDATE_PERIOD
+/* Send event when mode change, host read acpi memory and select DPTF table */
+#undef CONFIG_DPTF_DEVICE_ORIENTATION
+
/*****************************************************************************/
/* Flash configuration */
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 45a2d7b30a..463bec7d9a 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -306,6 +306,13 @@
#define EC_ACPI_MEM_CHARGING_LIMIT_DISABLED 0xff
/*
+ * Report device orientation
+ * bit 0 device is tablet mode
+ */
+#define EC_ACPI_MEM_DEVICE_ORIENTATION 0x09
+#define EC_ACPI_MEM_DEVICE_TABLET_MODE 0x01
+
+/*
* ACPI addresses 0x20 - 0xff map to EC_MEMMAP offset 0x00 - 0xdf. This data
* is read-only from the AP. Added in EC_ACPI_MEM_VERSION 2.
*/
@@ -443,6 +450,9 @@ enum host_event_code {
/* EC desires to change state of host-controlled USB mux */
EC_HOST_EVENT_USB_MUX = 28,
+ /* TABLET/LAPTOP mode event*/
+ EC_HOST_EVENT_MODE_CHANGE = 29,
+
/*
* The high bit of the event mask is not used as a host event code. If
* it reads back as set, then the entire event mask should be