summaryrefslogtreecommitdiff
path: root/board/nami
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2018-11-28 16:39:16 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-12-06 22:06:54 -0800
commit952f707baf2f5d77496be25117661b6edbdf323f (patch)
tree1603f42f19d1c5d48b4d3f2b72ef69d59462aa51 /board/nami
parentde73abca39bb953411cb0906deb7b60a0f064f73 (diff)
downloadchrome-ec-952f707baf2f5d77496be25117661b6edbdf323f.tar.gz
Nami: Define charge LED behavior for Syndra
Syndra does not have a power LED. We'll use the charge LED to show system status using the following pattern: Charge: Amber on Full: White on Discharge in s0: White on Discharge in s3: White on 1 sec off 1 sec Discharge in s5: off Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:120105950 BRANCH=none TEST=Set MODEL_ID=1 and verify charge LED behaves as expected on Sona. Change-Id: I42228a7ad2f736dd98520d4652981138d8c0e44e Reviewed-on: https://chromium-review.googlesource.com/1354492 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'board/nami')
-rw-r--r--board/nami/board.c5
-rw-r--r--board/nami/board.h9
-rw-r--r--board/nami/led.c18
3 files changed, 30 insertions, 2 deletions
diff --git a/board/nami/board.c b/board/nami/board.c
index 3957eba1ae..41b74d0968 100644
--- a/board/nami/board.c
+++ b/board/nami/board.c
@@ -72,6 +72,7 @@
uint16_t board_version;
uint8_t oem = PROJECT_NAMI;
uint32_t sku;
+uint8_t model;
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -901,6 +902,10 @@ static void cbi_init(void)
sku = val;
CPRINTS("SKU: 0x%08x", sku);
+ if (cbi_get_model_id(&val) == EC_SUCCESS)
+ model = val;
+ CPRINTS("MODEL: 0x%08x", model);
+
if (board_version < 0x300)
/* Previous boards have GPIO42 connected to TP_INT_CONN */
gpio_set_flags(GPIO_USB2_ID, GPIO_INPUT);
diff --git a/board/nami/board.h b/board/nami/board.h
index ab11a95cee..5bf1eb013f 100644
--- a/board/nami/board.h
+++ b/board/nami/board.h
@@ -286,6 +286,14 @@ enum oem_id {
PROJECT_COUNT,
};
+enum model_id {
+ /* Sona variants */
+ MODEL_SYNDRA = 1,
+ /* Akali variants */
+ MODEL_EKKO = 1,
+ MODEL_BARD = 2,
+};
+
#define SKU_ID_MASK_CONVERTIBLE (1 << 9)
#define SKU_ID_MASK_KEYPAD (1 << 15)
@@ -317,6 +325,7 @@ void board_set_tcpc_power_mode(int port, int mode);
extern uint16_t board_version;
extern uint8_t oem;
extern uint32_t sku;
+extern uint8_t model;
/* SKU_ID[24:31] are dedicated to OEM customization */
#define CBI_SKU_CUSTOM_FIELD(val) ((val) >> 24)
diff --git a/board/nami/led.c b/board/nami/led.c
index 97a575dd68..a2866769c2 100644
--- a/board/nami/led.c
+++ b/board/nami/led.c
@@ -185,6 +185,15 @@ const static led_patterns battery_pattern_3 = {
{{LED_WHITE, PULSE_NO}, {LED_WHITE, PULSE_NO}, {LED_WHITE, PULSE_NO}},
};
+const static led_patterns battery_pattern_4 = {
+ /* discharging: s0, s3, s5 */
+ {{LED_WHITE, PULSE_NO}, {LED_WHITE, BLINK(10)}, {LED_OFF, PULSE_NO}},
+ /* charging: s0, s3, s5 */
+ {{LED_AMBER, PULSE_NO}, {LED_AMBER, PULSE_NO}, {LED_AMBER, PULSE_NO}},
+ /* full: s0, s3, s5 */
+ {{LED_WHITE, PULSE_NO}, {LED_WHITE, PULSE_NO}, {LED_WHITE, PULSE_NO}},
+};
+
/* Patterns for battery LED and power LED. Initialized at run-time. */
static led_patterns const *patterns[2];
/* Pattern for battery error. Only blinking battery LED is supported. */
@@ -205,8 +214,13 @@ static void led_init(void)
patterns[0] = &battery_pattern_0;
break;
case PROJECT_SONA:
- patterns[0] = &battery_pattern_1;
- patterns[1] = &power_pattern_1;
+ if (model == MODEL_SYNDRA) {
+ /* Syndra doesn't have power LED */
+ patterns[0] = &battery_pattern_4;
+ } else {
+ patterns[0] = &battery_pattern_1;
+ patterns[1] = &power_pattern_1;
+ }
battery_error.pulse = BLINK(5);
low_battery_soc = 100; /* 10.0% */
break;