summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2014-02-10 16:21:05 -0800
committerIsaac Christensen <isaac.christensen@se-eng.com>2014-09-19 21:38:34 +0200
commite6b280e24b02552dc43510ed7fadce4a7105e4a2 (patch)
tree60996f44c59f59e2faa0c5e48a8490b510bedcab /src
parent0c0efa7e50fdd75c6154af67d2ddbebe317c7b55 (diff)
chrome ec: Add support for limiting charger current
Update the ec_commands header (direct from EC source) and add support for the new charger current limit interface which will be used by DPTF. Change-Id: Ia9a2a84b612a2982dbe996f07a856be6cd53ebdb Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185758 Reviewed-by: Aaron Durbin <adurbin@chromium.org> (cherry picked from commit 1fcca2d75856ecefd3aeb1c551182aa76d649466) Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com> Reviewed-on: http://review.coreboot.org/6925 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/ec/google/chromeec/acpi/ec.asl20
-rw-r--r--src/ec/google/chromeec/ec_commands.h67
2 files changed, 86 insertions, 1 deletions
diff --git a/src/ec/google/chromeec/acpi/ec.asl b/src/ec/google/chromeec/acpi/ec.asl
index 1d698a1f1e..5218c88c40 100644
--- a/src/ec/google/chromeec/acpi/ec.asl
+++ b/src/ec/google/chromeec/acpi/ec.asl
@@ -52,6 +52,7 @@ Device (EC0)
PATI, 8, // Programmable Auxiliary Trip Sensor ID
PATT, 8, // Programmable Auxiliary Trip Threshold
PATC, 8, // Programmable Auxiliary Trip Commit
+ CHGL, 8, // Charger Current Limit
}
OperationRegion (EMEM, SystemIO, EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE)
@@ -380,7 +381,7 @@ Device (EC0)
/*
* Thermal Threshold Event
- */
+ */
Method (_Q09, 0, NotSerialized)
{
If (Acquire (^PATM, 1000)) {
@@ -404,6 +405,23 @@ Device (EC0)
Release (^PATM)
}
+ /*
+ * Set Charger Current Limit
+ * Arg0 = Current Limit in 64mA steps
+ */
+ Method (CHGS, 1, Serialized)
+ {
+ Store (ToInteger (Arg0), ^CHGL)
+ }
+
+ /*
+ * Disable Charger Current Limit
+ */
+ Method (CHGD, 0, Serialized)
+ {
+ Store (0xFF, ^CHGL)
+ }
+
#include "ac.asl"
#include "battery.asl"
}
diff --git a/src/ec/google/chromeec/ec_commands.h b/src/ec/google/chromeec/ec_commands.h
index afb8925b2e..bf7aa6b3b1 100644
--- a/src/ec/google/chromeec/ec_commands.h
+++ b/src/ec/google/chromeec/ec_commands.h
@@ -249,6 +249,11 @@ enum host_event_code {
/* Suggest that the AP resume normal speed */
EC_HOST_EVENT_THROTTLE_STOP = 19,
+ /* Hang detect logic detected a hang and host event timeout expired */
+ EC_HOST_EVENT_HANG_DETECT = 20,
+ /* Hang detect logic detected a hang and warm rebooted the AP */
+ EC_HOST_EVENT_HANG_REBOOT = 21,
+
/*
* 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
@@ -1707,6 +1712,60 @@ struct ec_response_i2c_passthru {
uint8_t data[]; /* Data read by messages concatenated here */
} __packed;
+/*****************************************************************************/
+/* Power button hang detect */
+
+#define EC_CMD_HANG_DETECT 0x9f
+
+/* Reasons to start hang detection timer */
+/* Power button pressed */
+#define EC_HANG_START_ON_POWER_PRESS (1 << 0)
+
+/* Lid closed */
+#define EC_HANG_START_ON_LID_CLOSE (1 << 1)
+
+ /* Lid opened */
+#define EC_HANG_START_ON_LID_OPEN (1 << 2)
+
+/* Start of AP S3->S0 transition (booting or resuming from suspend) */
+#define EC_HANG_START_ON_RESUME (1 << 3)
+
+/* Reasons to cancel hang detection */
+
+/* Power button released */
+#define EC_HANG_STOP_ON_POWER_RELEASE (1 << 8)
+
+/* Any host command from AP received */
+#define EC_HANG_STOP_ON_HOST_COMMAND (1 << 9)
+
+/* Stop on end of AP S0->S3 transition (suspending or shutting down) */
+#define EC_HANG_STOP_ON_SUSPEND (1 << 10)
+
+/*
+ * If this flag is set, all the other fields are ignored, and the hang detect
+ * timer is started. This provides the AP a way to start the hang timer
+ * without reconfiguring any of the other hang detect settings. Note that
+ * you must previously have configured the timeouts.
+ */
+#define EC_HANG_START_NOW (1 << 30)
+
+/*
+ * If this flag is set, all the other fields are ignored (including
+ * EC_HANG_START_NOW). This provides the AP a way to stop the hang timer
+ * without reconfiguring any of the other hang detect settings.
+ */
+#define EC_HANG_STOP_NOW (1 << 31)
+
+struct ec_params_hang_detect {
+ /* Flags; see EC_HANG_* */
+ uint32_t flags;
+
+ /* Timeout in msec before generating host event, if enabled */
+ uint16_t host_event_timeout_msec;
+
+ /* Timeout in msec before generating warm reboot, if enabled */
+ uint16_t warm_reboot_timeout_msec;
+} __packed;
/*****************************************************************************/
/* Debug commands for battery charging */
@@ -1912,6 +1971,14 @@ struct ec_params_reboot_ec {
* write 0x1 to [0x07] -- disable threshold 1
*/
+/* DPTF battery charging current limit */
+#define EC_ACPI_MEM_CHARGING_LIMIT 0x08
+
+/* Charging limit is specified in 64 mA steps */
+#define EC_ACPI_MEM_CHARGING_LIMIT_STEP_MA 64
+/* Value to disable DPTF battery charging limit */
+#define EC_ACPI_MEM_CHARGING_LIMIT_DISABLED 0xff
+
/* Current version of ACPI memory address space */
#define EC_ACPI_MEM_VERSION_CURRENT 1