summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ec/starlabs/merlin/Kconfig7
-rw-r--r--src/ec/starlabs/merlin/ec.h4
-rw-r--r--src/ec/starlabs/merlin/nuvoton.c21
-rw-r--r--src/ec/starlabs/merlin/variants/apl/ecdefs.h1
-rw-r--r--src/ec/starlabs/merlin/variants/cezanne/ecdefs.h4
-rw-r--r--src/ec/starlabs/merlin/variants/cml/ecdefs.h4
-rw-r--r--src/ec/starlabs/merlin/variants/glk/ecdefs.h1
-rw-r--r--src/ec/starlabs/merlin/variants/glkr/ecdefs.h1
-rw-r--r--src/ec/starlabs/merlin/variants/glkr/emem.asl1
-rw-r--r--src/ec/starlabs/merlin/variants/kbl/ecdefs.h1
-rw-r--r--src/ec/starlabs/merlin/variants/merlin/ecdefs.h1
-rw-r--r--src/ec/starlabs/merlin/variants/tgl/ecdefs.h4
12 files changed, 50 insertions, 0 deletions
diff --git a/src/ec/starlabs/merlin/Kconfig b/src/ec/starlabs/merlin/Kconfig
index ff6077a806..6ccd21791c 100644
--- a/src/ec/starlabs/merlin/Kconfig
+++ b/src/ec/starlabs/merlin/Kconfig
@@ -50,6 +50,13 @@ config EC_STARLABS_FAN
help
Select if the mainboard has a fan.
+config EC_STARLABS_FAST_CHARGE
+ bool
+ default n
+ depends on EC_STARLABS_NUVOTON
+ help
+ Select if the mainboard supports fast charging.
+
config EC_STARLABS_MAX_CHARGE
bool
default n
diff --git a/src/ec/starlabs/merlin/ec.h b/src/ec/starlabs/merlin/ec.h
index 6a6cda5ee1..ca1d081f0c 100644
--- a/src/ec/starlabs/merlin/ec.h
+++ b/src/ec/starlabs/merlin/ec.h
@@ -71,6 +71,10 @@
#define CHARGE_80 0xbb
#define CHARGE_60 0xaa
+/* Fast Charge Setting */
+#define CHARGE_RATE_NORMAL 0x00
+#define CHARGE_RATE_FAST 0x01
+
/* Fan Mode Setting */
#define FAN_NORMAL 0x00
#define FAN_AGGRESSIVE 0xbb
diff --git a/src/ec/starlabs/merlin/nuvoton.c b/src/ec/starlabs/merlin/nuvoton.c
index ee8a66176f..e62f3dcb53 100644
--- a/src/ec/starlabs/merlin/nuvoton.c
+++ b/src/ec/starlabs/merlin/nuvoton.c
@@ -137,6 +137,27 @@ static void merlin_init(struct device *dev)
ARRAY_SIZE(max_charge)));
/*
+ * Fast Charge
+ *
+ * Setting: fast_charge
+ *
+ * Values: Normal, Fast
+ * Default: Normal
+ *
+ */
+ const uint8_t fast_charge[] = {
+ CHARGE_RATE_NORMAL,
+ CHARGE_RATE_FAST
+ };
+
+ if (CONFIG(EC_STARLABS_FAST_CHARGE))
+ ec_write(ECRAM_FAST_CHARGE,
+ get_ec_value_from_option("fast_charge",
+ 0,
+ fast_charge,
+ ARRAY_SIZE(fast_charge)));
+
+ /*
* Fan Mode
*
* Setting: fan_mode
diff --git a/src/ec/starlabs/merlin/variants/apl/ecdefs.h b/src/ec/starlabs/merlin/variants/apl/ecdefs.h
index bb791bc9dc..fa7e79b148 100644
--- a/src/ec/starlabs/merlin/variants/apl/ecdefs.h
+++ b/src/ec/starlabs/merlin/variants/apl/ecdefs.h
@@ -22,5 +22,6 @@
#define ECRAM_FN_CTRL_REVERSE 0x2d
#define ECRAM_MAX_CHARGE dead_code_t(uint8_t)
#define ECRAM_FAN_MODE dead_code_t(uint8_t)
+#define ECRAM_FAST_CHARGE dead_code_t(uint8_t)
#endif
diff --git a/src/ec/starlabs/merlin/variants/cezanne/ecdefs.h b/src/ec/starlabs/merlin/variants/cezanne/ecdefs.h
index a75720e34e..6a3bad9286 100644
--- a/src/ec/starlabs/merlin/variants/cezanne/ecdefs.h
+++ b/src/ec/starlabs/merlin/variants/cezanne/ecdefs.h
@@ -1,5 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <assert.h>
+#include <stdint.h>
+
/*
* EC communication interface for ITE Embedded Controller
*/
@@ -19,5 +22,6 @@
#define ECRAM_FN_CTRL_REVERSE 0x22
#define ECRAM_MAX_CHARGE 0x23
#define ECRAM_FAN_MODE 0x24
+#define ECRAM_FAST_CHARGE dead_code_t(uint8_t)
#endif
diff --git a/src/ec/starlabs/merlin/variants/cml/ecdefs.h b/src/ec/starlabs/merlin/variants/cml/ecdefs.h
index 78c032997a..6a24bc4deb 100644
--- a/src/ec/starlabs/merlin/variants/cml/ecdefs.h
+++ b/src/ec/starlabs/merlin/variants/cml/ecdefs.h
@@ -1,5 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <assert.h>
+#include <stdint.h>
+
/*
* EC communication interface for ITE Embedded Controller
*/
@@ -19,5 +22,6 @@
#define ECRAM_KBL_STATE 0x18
#define ECRAM_KBL_BRIGHTNESS 0x19
#define ECRAM_FN_LOCK_STATE 0x2c
+#define ECRAM_FAST_CHARGE dead_code_t(uint8_t)
#endif
diff --git a/src/ec/starlabs/merlin/variants/glk/ecdefs.h b/src/ec/starlabs/merlin/variants/glk/ecdefs.h
index 7407267041..fefdd141c9 100644
--- a/src/ec/starlabs/merlin/variants/glk/ecdefs.h
+++ b/src/ec/starlabs/merlin/variants/glk/ecdefs.h
@@ -22,5 +22,6 @@
#define ECRAM_FN_CTRL_REVERSE 0x2d
#define ECRAM_MAX_CHARGE dead_code_t(uint8_t)
#define ECRAM_FAN_MODE dead_code_t(uint8_t)
+#define ECRAM_FAST_CHARGE dead_code_t(uint8_t)
#endif
diff --git a/src/ec/starlabs/merlin/variants/glkr/ecdefs.h b/src/ec/starlabs/merlin/variants/glkr/ecdefs.h
index 51b34dfd3e..038c378fb2 100644
--- a/src/ec/starlabs/merlin/variants/glkr/ecdefs.h
+++ b/src/ec/starlabs/merlin/variants/glkr/ecdefs.h
@@ -22,5 +22,6 @@
#define ECRAM_FN_CTRL_REVERSE 0x13
#define ECRAM_MAX_CHARGE dead_code_t(uint8_t)
#define ECRAM_FAN_MODE dead_code_t(uint8_t)
+#define ECRAM_FAST_CHARGE 0x18
#endif
diff --git a/src/ec/starlabs/merlin/variants/glkr/emem.asl b/src/ec/starlabs/merlin/variants/glkr/emem.asl
index 4f7c10053b..6fa827eea8 100644
--- a/src/ec/starlabs/merlin/variants/glkr/emem.asl
+++ b/src/ec/starlabs/merlin/variants/glkr/emem.asl
@@ -26,6 +26,7 @@ Field (ECF2, ByteAcc, Lock, Preserve)
FLKE, 8, // Function Lock State
KLSE, 8, // Keyboard Backlight State
KLBE, 8, // Keyboard Backlight Brightness
+ FSCH, 8, // Fast Charge
Offset(0x20),
RCMD, 8, // Send EC command
diff --git a/src/ec/starlabs/merlin/variants/kbl/ecdefs.h b/src/ec/starlabs/merlin/variants/kbl/ecdefs.h
index a9dda92716..3b693173af 100644
--- a/src/ec/starlabs/merlin/variants/kbl/ecdefs.h
+++ b/src/ec/starlabs/merlin/variants/kbl/ecdefs.h
@@ -22,5 +22,6 @@
#define ECRAM_FAN_MODE 0x42
#define ECRAM_FN_CTRL_REVERSE 0x43
#define ECRAM_MAX_CHARGE dead_code_t(uint8_t)
+#define ECRAM_FAST_CHARGE dead_code_t(uint8_t)
#endif
diff --git a/src/ec/starlabs/merlin/variants/merlin/ecdefs.h b/src/ec/starlabs/merlin/variants/merlin/ecdefs.h
index 48357d964a..f02c73a27c 100644
--- a/src/ec/starlabs/merlin/variants/merlin/ecdefs.h
+++ b/src/ec/starlabs/merlin/variants/merlin/ecdefs.h
@@ -19,5 +19,6 @@
#define ECRAM_KBL_TIMEOUT 0x35
#define ECRAM_FAN_MODE 0x50
#define ECRAM_MAX_CHARGE 0x51
+#define ECRAM_FAST_CHARGE 0x52
#endif
diff --git a/src/ec/starlabs/merlin/variants/tgl/ecdefs.h b/src/ec/starlabs/merlin/variants/tgl/ecdefs.h
index 3441bc073f..cbc7b86e10 100644
--- a/src/ec/starlabs/merlin/variants/tgl/ecdefs.h
+++ b/src/ec/starlabs/merlin/variants/tgl/ecdefs.h
@@ -1,5 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <assert.h>
+#include <stdint.h>
+
/*
* EC communication interface for ITE Embedded Controller
*/
@@ -19,5 +22,6 @@
#define ECRAM_FN_CTRL_REVERSE 0x17
#define ECRAM_MAX_CHARGE 0x1a
#define ECRAM_FAN_MODE 0x1b
+#define ECRAM_FAST_CHARGE dead_code_t(uint8_t)
#endif