summaryrefslogtreecommitdiff
path: root/zephyr/program/nissa
diff options
context:
space:
mode:
authorYH Lin <yueherngl@google.com>2023-05-11 20:47:00 +0000
committerYH Lin <yueherngl@google.com>2023-05-11 20:47:00 +0000
commit8641442366bd7c2c133e302a57f904dfac3c896b (patch)
treed0dca100ca02a89210decc54b7124d26bb75ef6a /zephyr/program/nissa
parente79a9dab1721c3d7da1475f3f802c4ea871a48ec (diff)
parent5df400b0377c9e1b5bb6cfc53ba7dfedde91f944 (diff)
downloadchrome-ec-8641442366bd7c2c133e302a57f904dfac3c896b.tar.gz
Merge remote-tracking branch cros/main into firmware-brya-14505.B-main
Generated by: util/update_release_branch.py --baseboard brya --relevant_paths_file baseboard/brya/relevant-paths.txt firmware-brya-14505.B-main Relevant changes: git log --oneline e79a9dab17..5df400b037 -- baseboard/brya board/agah board/anahera board/banshee board/brya board/crota board/felwinter board/gimble board/hades board/kano board/marasov board/mithrax board/omnigul board/osiris board/primus board/redrix board/taeko board/taniks board/vell board/volmar driver/bc12/pi3usb9201_public.* driver/charger/bq25710.* driver/ppc/nx20p348x.* driver/ppc/syv682x_public.* driver/retimer/bb_retimer_public.* driver/tcpm/nct38xx.* driver/tcpm/ps8xxx_public.* driver/tcpm/tcpci.* include/power/alderlake* include/intel_x86.h power/alderlake* power/intel_x86.c util/getversion.sh 76d2b9b1e4 battery: Deprecate CONFIG_BATTERY_LEVEL_NEAR_FULL 3d5b996f73 Hades: Fast forward DSW_PWROK to PCH_PWROK 56af450c1a Agah: Fast forward DSW_PWROK to PCH_PWROK b729eab7c7 charger: Move charger_state_v2.h into charge_state.h 47acf64182 charger: Rename charge_get_state() to led_pwr_get_state() 632c7c935a power/x86: Add dedicated interrupt handler for pwrok 0fff3a0bd4 omnigul: Add condition use Accel and Gyro by FWCONFIG. 7540daff3f driver/tcpm/nct38xx: Remove write to RO register 3f279f30d4 GPU: Rename DC_ATLEAST_SOC to DC_ATMOST_SOC BRANCH=None BUG=b:218332694 b:216485035 b:280818345 b:280351196 b:280001153 BUG=b:279918234 TEST=`emerge-[brya,hades,draco] chromeos-ec` Force-Relevant-Builds: all Change-Id: I19f2f6c5573d8c748ac63b488a808f10de352b1d Signed-off-by: YH Lin <yueherngl@google.com>
Diffstat (limited to 'zephyr/program/nissa')
-rw-r--r--zephyr/program/nissa/CMakeLists.txt1
-rw-r--r--zephyr/program/nissa/craask/src/usbc.c2
-rw-r--r--zephyr/program/nissa/joxer/src/usbc.c2
-rw-r--r--zephyr/program/nissa/nereid/src/usbc.c2
-rw-r--r--zephyr/program/nissa/nivviks/src/usbc.c2
-rw-r--r--zephyr/program/nissa/pujjo/src/usbc.c2
-rw-r--r--zephyr/program/nissa/src/common.c2
-rw-r--r--zephyr/program/nissa/uldren/cbi.dtsi46
-rw-r--r--zephyr/program/nissa/uldren/led_policy.dtsi2
-rw-r--r--zephyr/program/nissa/uldren/src/fan.c41
-rw-r--r--zephyr/program/nissa/uldren/src/usbc.c2
-rw-r--r--zephyr/program/nissa/xivu/led_policy.dtsi4
-rw-r--r--zephyr/program/nissa/xivu/src/usbc.c2
-rw-r--r--zephyr/program/nissa/xivur/src/usbc.c2
-rw-r--r--zephyr/program/nissa/yaviks/project.conf3
-rw-r--r--zephyr/program/nissa/yaviks/src/led.c4
-rw-r--r--zephyr/program/nissa/yaviks/src/usbc.c21
-rw-r--r--zephyr/program/nissa/yavilla/gpio.dtsi3
-rw-r--r--zephyr/program/nissa/yavilla/project.conf4
-rw-r--r--zephyr/program/nissa/yavilla/src/keyboard.c72
-rw-r--r--zephyr/program/nissa/yavilla/src/led.c98
-rw-r--r--zephyr/program/nissa/yavilla/src/usbc.c21
22 files changed, 202 insertions, 136 deletions
diff --git a/zephyr/program/nissa/CMakeLists.txt b/zephyr/program/nissa/CMakeLists.txt
index e2f85139bf..cd45f00a3a 100644
--- a/zephyr/program/nissa/CMakeLists.txt
+++ b/zephyr/program/nissa/CMakeLists.txt
@@ -118,7 +118,6 @@ if(DEFINED CONFIG_BOARD_ULDREN)
"uldren/src/kb_backlight.c"
"uldren/src/keyboard.c"
)
- zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_FAN "uldren/src/fan.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC "uldren/src/usbc.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CHARGER "uldren/src/charger.c")
endif()
diff --git a/zephyr/program/nissa/craask/src/usbc.c b/zephyr/program/nissa/craask/src/usbc.c
index 88fc54d3a3..5df3a09bb8 100644
--- a/zephyr/program/nissa/craask/src/usbc.c
+++ b/zephyr/program/nissa/craask/src/usbc.c
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-#include "charge_state_v2.h"
+#include "charge_state.h"
#include "chipset.h"
#include "driver/charger/isl923x_public.h"
#include "driver/retimer/anx7483_public.h"
diff --git a/zephyr/program/nissa/joxer/src/usbc.c b/zephyr/program/nissa/joxer/src/usbc.c
index e3e18e0f33..54fea2f663 100644
--- a/zephyr/program/nissa/joxer/src/usbc.c
+++ b/zephyr/program/nissa/joxer/src/usbc.c
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-#include "charge_state_v2.h"
+#include "charge_state.h"
#include "chipset.h"
#include "driver/charger/sm5803.h"
#include "driver/tcpm/it83xx_pd.h"
diff --git a/zephyr/program/nissa/nereid/src/usbc.c b/zephyr/program/nissa/nereid/src/usbc.c
index e3e18e0f33..54fea2f663 100644
--- a/zephyr/program/nissa/nereid/src/usbc.c
+++ b/zephyr/program/nissa/nereid/src/usbc.c
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-#include "charge_state_v2.h"
+#include "charge_state.h"
#include "chipset.h"
#include "driver/charger/sm5803.h"
#include "driver/tcpm/it83xx_pd.h"
diff --git a/zephyr/program/nissa/nivviks/src/usbc.c b/zephyr/program/nissa/nivviks/src/usbc.c
index 88fc54d3a3..5df3a09bb8 100644
--- a/zephyr/program/nissa/nivviks/src/usbc.c
+++ b/zephyr/program/nissa/nivviks/src/usbc.c
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-#include "charge_state_v2.h"
+#include "charge_state.h"
#include "chipset.h"
#include "driver/charger/isl923x_public.h"
#include "driver/retimer/anx7483_public.h"
diff --git a/zephyr/program/nissa/pujjo/src/usbc.c b/zephyr/program/nissa/pujjo/src/usbc.c
index 59d876c4db..0b5fe3b809 100644
--- a/zephyr/program/nissa/pujjo/src/usbc.c
+++ b/zephyr/program/nissa/pujjo/src/usbc.c
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-#include "charge_state_v2.h"
+#include "charge_state.h"
#include "chipset.h"
#include "driver/charger/isl923x_public.h"
#include "driver/retimer/anx7483_public.h"
diff --git a/zephyr/program/nissa/src/common.c b/zephyr/program/nissa/src/common.c
index def29ccd02..aaca2ecc6b 100644
--- a/zephyr/program/nissa/src/common.c
+++ b/zephyr/program/nissa/src/common.c
@@ -4,7 +4,7 @@
*/
#include "battery.h"
-#include "charge_state_v2.h"
+#include "charge_state.h"
#include "charger.h"
#include "chipset.h"
#include "hooks.h"
diff --git a/zephyr/program/nissa/uldren/cbi.dtsi b/zephyr/program/nissa/uldren/cbi.dtsi
index 9d865a38bb..02aa0607f9 100644
--- a/zephyr/program/nissa/uldren/cbi.dtsi
+++ b/zephyr/program/nissa/uldren/cbi.dtsi
@@ -7,44 +7,47 @@
/* Uldren-specific fw_config fields. */
nissa-fw-config {
/*
- * FW_CONFIG field to enable KB back light or not.
+ * FW_CONFIG field to enable USB DB.
*/
- kb-bl {
- enum-name = "FW_KB_BL";
- start = <4>;
- size = <1>;
+ sub-board {
+ enum-name = "FW_SUB_BOARD";
+ start = <1>;
+ size = <2>;
- no-kb-bl {
+ sub-board-1 {
compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_KB_BL_NOT_PRESENT";
+ enum-name = "FW_SUB_BOARD_1";
value = <0>;
- default;
};
- kb-bl-present {
+ sub-board-2 {
compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_KB_BL_PRESENT";
- value = <1>;
+ enum-name = "FW_SUB_BOARD_2";
+ value = <3>;
+ };
+ sub-board-3 {
+ compatible = "cros-ec,cbi-fw-config-value";
+ enum-name = "FW_SUB_BOARD_3";
+ value = <2>;
};
};
-
/*
- * FW_CONFIG field to enable USB DB.
+ * FW_CONFIG field to enable KB back light or not.
*/
- db-usb {
- enum-name = "FW_DB_USB";
- start = <6>;
+ kb-bl {
+ enum-name = "FW_KB_BL";
+ start = <5>;
size = <1>;
- no-db-usb {
+ no-kb-bl {
compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_DB_USB_NOT_PRESENT";
+ enum-name = "FW_KB_BL_NOT_PRESENT";
value = <0>;
+ default;
};
- db-usb-present {
+ kb-bl-present {
compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_DB_USB_PRESENT";
+ enum-name = "FW_KB_BL_PRESENT";
value = <1>;
- default;
};
};
@@ -67,5 +70,6 @@
value = <1>;
};
};
+/delete-node/ fan;
};
};
diff --git a/zephyr/program/nissa/uldren/led_policy.dtsi b/zephyr/program/nissa/uldren/led_policy.dtsi
index 95c614cafc..afc4e25f71 100644
--- a/zephyr/program/nissa/uldren/led_policy.dtsi
+++ b/zephyr/program/nissa/uldren/led_policy.dtsi
@@ -7,7 +7,7 @@
power-state-charge {
charge-state = "PWR_STATE_CHARGE";
batt-lvl = <BATTERY_LEVEL_EMPTY
- BATTERY_LEVEL_NEAR_FULL>;
+ BATTERY_LEVEL_FULL>;
color-0 {
led-color = <&color_white>;
diff --git a/zephyr/program/nissa/uldren/src/fan.c b/zephyr/program/nissa/uldren/src/fan.c
deleted file mode 100644
index 32f9d3c65e..0000000000
--- a/zephyr/program/nissa/uldren/src/fan.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright 2023 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "cros_cbi.h"
-#include "fan.h"
-#include "gpio/gpio.h"
-#include "hooks.h"
-
-#include <zephyr/devicetree.h>
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/logging/log.h>
-
-LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
-
-/*
- * Nirwen fan support
- */
-static void fan_init(void)
-{
- int ret;
- uint32_t val;
- /*
- * Retrieve the fan config.
- */
- ret = cros_cbi_get_fw_config(FW_FAN, &val);
- if (ret != 0) {
- LOG_ERR("Error retrieving CBI FW_CONFIG field %d", FW_FAN);
- return;
- }
- if (val != FW_FAN_PRESENT) {
- /* Disable the fan */
- fan_set_count(0);
- } else {
- /* Configure the fan enable GPIO */
- gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL(gpio_fan_enable),
- GPIO_OUTPUT);
- }
-}
-DECLARE_HOOK(HOOK_INIT, fan_init, HOOK_PRIO_POST_FIRST);
diff --git a/zephyr/program/nissa/uldren/src/usbc.c b/zephyr/program/nissa/uldren/src/usbc.c
index aaba5492dd..33c63472e8 100644
--- a/zephyr/program/nissa/uldren/src/usbc.c
+++ b/zephyr/program/nissa/uldren/src/usbc.c
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-#include "charge_state_v2.h"
+#include "charge_state.h"
#include "chipset.h"
#include "driver/charger/isl923x_public.h"
#include "driver/retimer/anx7483_public.h"
diff --git a/zephyr/program/nissa/xivu/led_policy.dtsi b/zephyr/program/nissa/xivu/led_policy.dtsi
index 562e361ec5..598480f865 100644
--- a/zephyr/program/nissa/xivu/led_policy.dtsi
+++ b/zephyr/program/nissa/xivu/led_policy.dtsi
@@ -14,8 +14,8 @@
power-state-charge-lvl-2 {
charge-state = "PWR_STATE_CHARGE";
- /* Battery percent range (>= 95%, <= Near Full) */
- batt-lvl = <95 97>;
+ /* Battery percent range (>= 95%, <= 100%) */
+ batt-lvl = <95 100>;
color-0 {
led-color = <&color_white>;
diff --git a/zephyr/program/nissa/xivu/src/usbc.c b/zephyr/program/nissa/xivu/src/usbc.c
index 6b95a3b1f4..d77abf37db 100644
--- a/zephyr/program/nissa/xivu/src/usbc.c
+++ b/zephyr/program/nissa/xivu/src/usbc.c
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-#include "charge_state_v2.h"
+#include "charge_state.h"
#include "chipset.h"
#include "driver/charger/isl923x_public.h"
#include "driver/retimer/anx7483_public.h"
diff --git a/zephyr/program/nissa/xivur/src/usbc.c b/zephyr/program/nissa/xivur/src/usbc.c
index 639bd3adbb..a0bd74b3a6 100644
--- a/zephyr/program/nissa/xivur/src/usbc.c
+++ b/zephyr/program/nissa/xivur/src/usbc.c
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-#include "charge_state_v2.h"
+#include "charge_state.h"
#include "chipset.h"
#include "driver/charger/isl923x_public.h"
#include "driver/retimer/anx7483_public.h"
diff --git a/zephyr/program/nissa/yaviks/project.conf b/zephyr/program/nissa/yaviks/project.conf
index 2e52005cad..06c63967c6 100644
--- a/zephyr/program/nissa/yaviks/project.conf
+++ b/zephyr/program/nissa/yaviks/project.conf
@@ -45,3 +45,6 @@ CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART=y
CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART_CDP_SDP_ONLY=y
CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART_DEFAULT_CDP=y
CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART_INVERTED=y
+
+# Charger
+CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT_DERATE_PCT=0
diff --git a/zephyr/program/nissa/yaviks/src/led.c b/zephyr/program/nissa/yaviks/src/led.c
index 7671bd3a92..db93ae4b47 100644
--- a/zephyr/program/nissa/yaviks/src/led.c
+++ b/zephyr/program/nissa/yaviks/src/led.c
@@ -140,7 +140,7 @@ static void led_set_battery(void)
* system suspend with non-charging state.
*/
if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) &&
- charge_get_state() != PWR_STATE_CHARGE) {
+ led_pwr_get_state() != PWR_STATE_CHARGE) {
suspend_ticks++;
led_set_color_battery(RIGHT_PORT,
@@ -158,7 +158,7 @@ static void led_set_battery(void)
suspend_ticks = 0;
- switch (charge_get_state()) {
+ switch (led_pwr_get_state()) {
case PWR_STATE_CHARGE:
/* Always indicate when charging, even in suspend. */
set_active_port_color(LED_AMBER);
diff --git a/zephyr/program/nissa/yaviks/src/usbc.c b/zephyr/program/nissa/yaviks/src/usbc.c
index c9950ae73b..307109fa9d 100644
--- a/zephyr/program/nissa/yaviks/src/usbc.c
+++ b/zephyr/program/nissa/yaviks/src/usbc.c
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-#include "charge_state_v2.h"
+#include "charge_state.h"
#include "chipset.h"
#include "driver/charger/sm5803.h"
#include "driver/tcpm/it83xx_pd.h"
@@ -235,6 +235,25 @@ __override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
}
}
+__override void board_set_charge_limit(int port, int supplier, int charge_ma,
+ int max_ma, int charge_mv)
+{
+ /*
+ * b:213937755: Yaviks C1 port is OCPC (One Charger IC Per Type-C)
+ * architecture, The charging current is controlled by increasing Vsys.
+ * However, the charger SM5803 is not limit current while Vsys
+ * increasing, we can see the current overshoot to ~3.6A to cause
+ * C1 port brownout with low power charger (5V). To avoid C1 port
+ * brownout at low power charger connected. Limit charge current to 2A.
+ */
+ if (charge_mv <= 5000 && port == 1)
+ charge_ma = MIN(charge_ma, 2000);
+ else
+ charge_ma = charge_ma * 96 / 100;
+
+ charge_set_input_current_limit(charge_ma, charge_mv);
+}
+
void board_reset_pd_mcu(void)
{
/*
diff --git a/zephyr/program/nissa/yavilla/gpio.dtsi b/zephyr/program/nissa/yavilla/gpio.dtsi
index d063b897d9..a18e674b11 100644
--- a/zephyr/program/nissa/yavilla/gpio.dtsi
+++ b/zephyr/program/nissa/yavilla/gpio.dtsi
@@ -209,6 +209,9 @@
gpio_c0_charger_led_amber_l: c0_charger_led_amber_l {
gpios = <&gpioj 7 GPIO_OUTPUT_HIGH>;
};
+ gpio_power_led_white_l: power_led_white_l {
+ gpios = <&gpioa 3 GPIO_OUTPUT_HIGH>;
+ };
gpio_ec_kso_02_inv: ec_kso_02_inv {
gpios = <&gpioksol 2 GPIO_OUTPUT_HIGH>;
enum-name = "GPIO_KBD_KSO2";
diff --git a/zephyr/program/nissa/yavilla/project.conf b/zephyr/program/nissa/yavilla/project.conf
index bbabd05b37..30818c4419 100644
--- a/zephyr/program/nissa/yavilla/project.conf
+++ b/zephyr/program/nissa/yavilla/project.conf
@@ -31,6 +31,7 @@ CONFIG_PLATFORM_EC_CUSTOM_FAN_CONTROL=y
# LED
CONFIG_PLATFORM_EC_LED_PWM=n
+CONFIG_PLATFORM_EC_LED_ONOFF_STATES=n
CONFIG_NISSA_SUB_BOARD=n
@@ -40,3 +41,6 @@ CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART=y
CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART_CDP_SDP_ONLY=y
CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART_DEFAULT_CDP=y
CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART_INVERTED=y
+
+# Charger
+CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT_DERATE_PCT=0
diff --git a/zephyr/program/nissa/yavilla/src/keyboard.c b/zephyr/program/nissa/yavilla/src/keyboard.c
index 93db22132f..d942405faa 100644
--- a/zephyr/program/nissa/yavilla/src/keyboard.c
+++ b/zephyr/program/nissa/yavilla/src/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The ChromiumOS Authors
+/* Copyright 2023 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,24 +14,8 @@
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
-/* Keyboard scan setting */
-__override struct keyboard_scan_config keyscan_config = {
- /* Increase from 50 us, because KSO_02 passes through the H1. */
- .output_settle_us = 80,
- /* Other values should be the same as the default configuration. */
- .debounce_down_us = 9 * MSEC,
- .debounce_up_us = 30 * MSEC,
- .scan_period_us = 3 * MSEC,
- .min_post_scan_delay_us = 1000,
- .poll_timeout_us = 100 * MSEC,
- .actual_key_mask = {
- 0x1c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xa4, 0xff, 0xf6, 0x55, 0xfe, 0xff, 0xff, 0xff, /* full set */
- },
-};
-
-static const struct ec_response_keybd_config yavilla_kb_w_kb_light = {
- .num_top_row_keys = 13,
+static const struct ec_response_keybd_config kb_tablet_present = {
+ .num_top_row_keys = 10,
.action_keys = {
TK_BACK, /* T1 */
TK_REFRESH, /* T2 */
@@ -40,18 +24,16 @@ static const struct ec_response_keybd_config yavilla_kb_w_kb_light = {
TK_SNAPSHOT, /* T5 */
TK_BRIGHTNESS_DOWN, /* T6 */
TK_BRIGHTNESS_UP, /* T7 */
- TK_KBD_BKLIGHT_TOGGLE, /* T8 */
- TK_PLAY_PAUSE, /* T9 */
- TK_MICMUTE, /* T10 */
- TK_VOL_MUTE, /* T11 */
- TK_VOL_DOWN, /* T12 */
- TK_VOL_UP, /* T13 */
+ TK_VOL_MUTE, /* T8 */
+ TK_VOL_DOWN, /* T9 */
+ TK_VOL_UP, /* T10 */
},
- .capabilities = KEYBD_CAP_NUMERIC_KEYPAD,
+ .capabilities = KEYBD_CAP_SCRNLOCK_KEY,
+ /* No function keys, no numeric keypad */
};
-static const struct ec_response_keybd_config yavilla_kb_wo_kb_light = {
- .num_top_row_keys = 13,
+static const struct ec_response_keybd_config kb_tablet_absent = {
+ .num_top_row_keys = 10,
.action_keys = {
TK_BACK, /* T1 */
TK_REFRESH, /* T2 */
@@ -60,14 +42,11 @@ static const struct ec_response_keybd_config yavilla_kb_wo_kb_light = {
TK_SNAPSHOT, /* T5 */
TK_BRIGHTNESS_DOWN, /* T6 */
TK_BRIGHTNESS_UP, /* T7 */
- TK_PLAY_PAUSE, /* T8 */
- TK_MICMUTE, /* T9 */
- TK_VOL_MUTE, /* T10 */
- TK_VOL_DOWN, /* T11 */
- TK_VOL_UP, /* T12 */
- TK_MENU, /* T13 */
+ TK_VOL_MUTE, /* T8 */
+ TK_VOL_DOWN, /* T9 */
+ TK_VOL_UP, /* T10 */
},
- .capabilities = KEYBD_CAP_NUMERIC_KEYPAD,
+ /* No function keys, no numeric keypad and no screenlock key */
};
__override const struct ec_response_keybd_config *
@@ -75,12 +54,12 @@ board_vivaldi_keybd_config(void)
{
uint32_t val;
- cros_cbi_get_fw_config(FW_KB_BACKLIGHT, &val);
+ cros_cbi_get_fw_config(FW_TABLET, &val);
- if (val == FW_KB_BACKLIGHT_OFF)
- return &yavilla_kb_wo_kb_light;
+ if (val == FW_TABLET_PRESENT)
+ return &kb_tablet_present;
else
- return &yavilla_kb_w_kb_light;
+ return &kb_tablet_absent;
}
/*
@@ -109,17 +88,16 @@ DECLARE_HOOK(HOOK_INIT, kb_layout_init, HOOK_PRIO_POST_FIRST);
/*
* Map keyboard connector pins to EC GPIO pins for factory test.
* Pins mapped to {-1, -1} are skipped.
- * The connector has 30 pins total, and there is no pin 0.
+ * The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
{ -1, -1 }, { GPIO_KSOH, 4 }, { GPIO_KSOH, 0 }, { GPIO_KSOH, 1 },
- { GPIO_KSOH, 3 }, { GPIO_KSOH, 2 }, { -1, -1 }, { -1, -1 },
- { GPIO_KSOL, 5 }, { GPIO_KSOL, 6 }, { -1, -1 }, { GPIO_KSOL, 3 },
- { GPIO_KSOL, 2 }, { GPIO_KSI, 0 }, { GPIO_KSOL, 1 }, { GPIO_KSOL, 4 },
- { GPIO_KSI, 3 }, { GPIO_KSI, 2 }, { GPIO_KSOL, 0 }, { GPIO_KSI, 5 },
- { GPIO_KSI, 4 }, { GPIO_KSOL, 7 }, { GPIO_KSI, 6 }, { GPIO_KSI, 7 },
- { GPIO_KSI, 1 }, { -1, -1 }, { GPIO_KSOH, 5 }, { -1, -1 },
- { GPIO_KSOH, 6 }, { -1, -1 }, { -1, -1 },
+ { GPIO_KSOH, 3 }, { GPIO_KSOH, 2 }, { GPIO_KSOL, 5 }, { GPIO_KSOL, 6 },
+ { GPIO_KSOL, 3 }, { GPIO_KSOL, 2 }, { GPIO_KSI, 0 }, { GPIO_KSOL, 1 },
+ { GPIO_KSOL, 4 }, { GPIO_KSI, 3 }, { GPIO_KSI, 2 }, { GPIO_KSOL, 0 },
+ { GPIO_KSI, 5 }, { GPIO_KSI, 4 }, { GPIO_KSOL, 7 }, { GPIO_KSI, 6 },
+ { GPIO_KSI, 7 }, { GPIO_KSI, 1 }, { -1, -1 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
ARRAY_SIZE(keyboard_factory_scan_pins);
diff --git a/zephyr/program/nissa/yavilla/src/led.c b/zephyr/program/nissa/yavilla/src/led.c
index a1ae6b24cf..d123af8142 100644
--- a/zephyr/program/nissa/yavilla/src/led.c
+++ b/zephyr/program/nissa/yavilla/src/led.c
@@ -7,6 +7,7 @@
#include "charge_manager.h"
#include "charge_state.h"
#include "chipset.h"
+#include "cros_cbi.h"
#include "ec_commands.h"
#include "gpio.h"
#include "hooks.h"
@@ -15,9 +16,16 @@
#include <stdint.h>
+#include <zephyr/logging/log.h>
+
+LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
+
#define BAT_LED_ON 0
#define BAT_LED_OFF 1
+#define PWR_LED_ON 0
+#define PWR_LED_OFF 1
+
#define BATT_LOW_BCT 10
#define LED_TICKS_PER_CYCLE 4
@@ -25,8 +33,11 @@
#define LED_ON_TICKS 2
#define POWER_LED_ON_S3_TICKS 2
-const enum ec_led_id supported_led_ids[] = { EC_LED_ID_LEFT_LED,
- EC_LED_ID_RIGHT_LED };
+static bool power_led_support;
+
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_RIGHT_LED,
+ EC_LED_ID_LEFT_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -37,16 +48,16 @@ enum led_color {
LED_COLOR_COUNT /* Number of colors, not a color itself */
};
-enum led_port { LEFT_PORT = 0, RIGHT_PORT };
+enum led_port { RIGHT_PORT = 0, LEFT_PORT };
static void led_set_color_battery(int port, enum led_color color)
{
const struct gpio_dt_spec *amber_led, *white_led;
- if (port == LEFT_PORT) {
+ if (port == RIGHT_PORT) {
amber_led = GPIO_DT_FROM_NODELABEL(gpio_c0_charger_led_amber_l);
white_led = GPIO_DT_FROM_NODELABEL(gpio_c0_charger_led_white_l);
- } else if (port == RIGHT_PORT) {
+ } else if (port == LEFT_PORT) {
amber_led = GPIO_DT_FROM_NODELABEL(gpio_c1_charger_led_amber_l);
white_led = GPIO_DT_FROM_NODELABEL(gpio_c1_charger_led_white_l);
}
@@ -69,6 +80,22 @@ static void led_set_color_battery(int port, enum led_color color)
}
}
+static void led_set_color_power(enum led_color color)
+{
+ switch (color) {
+ case LED_OFF:
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_power_led_white_l),
+ PWR_LED_OFF);
+ break;
+ case LED_WHITE:
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_power_led_white_l),
+ PWR_LED_ON);
+ break;
+ default:
+ break;
+ }
+}
+
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
{
switch (led_id) {
@@ -80,6 +107,9 @@ void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
brightness_range[EC_LED_COLOR_WHITE] = 1;
brightness_range[EC_LED_COLOR_AMBER] = 1;
break;
+ case EC_LED_ID_POWER_LED:
+ brightness_range[EC_LED_COLOR_WHITE] = 1;
+ break;
default:
break;
}
@@ -104,6 +134,12 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
else
led_set_color_battery(RIGHT_PORT, LED_OFF);
break;
+ case EC_LED_ID_POWER_LED:
+ if (brightness[EC_LED_COLOR_WHITE] != 0)
+ led_set_color_power(LED_WHITE);
+ else
+ led_set_color_power(LED_OFF);
+ break;
default:
return EC_ERROR_PARAM1;
}
@@ -135,12 +171,12 @@ static void led_set_battery(void)
battery_ticks++;
/*
- * Override battery LEDs for Yavilla, Yavilla is non-power LED
- * design, blinking both two side battery white LEDs to indicate
+ * Override battery LEDs for Yavilla without power led support,
+ * blinking both two side battery white LEDs to indicate
* system suspend with non-charging state.
*/
- if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) &&
- charge_get_state() != PWR_STATE_CHARGE) {
+ if (!power_led_support && chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) &&
+ led_pwr_get_state() != PWR_STATE_CHARGE) {
suspend_ticks++;
led_set_color_battery(RIGHT_PORT,
@@ -158,7 +194,7 @@ static void led_set_battery(void)
suspend_ticks = 0;
- switch (charge_get_state()) {
+ switch (led_pwr_get_state()) {
case PWR_STATE_CHARGE:
/* Always indicate when charging, even in suspend. */
set_active_port_color(LED_AMBER);
@@ -223,9 +259,51 @@ static void led_set_battery(void)
}
}
+static void led_set_power(void)
+{
+ static int power_ticks;
+
+ power_ticks++;
+
+ if (chipset_in_state(CHIPSET_STATE_ON))
+ led_set_color_power(LED_WHITE);
+ else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
+ led_set_color_power((power_ticks % LED_TICKS_PER_CYCLE_S3 <
+ POWER_LED_ON_S3_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
+ else
+ led_set_color_power(LED_OFF);
+}
+
+static void power_led_check(void)
+{
+ int ret;
+ uint32_t val;
+
+ /*
+ * Retrieve the tablet config.
+ */
+ ret = cros_cbi_get_fw_config(FW_TABLET, &val);
+ if (ret != 0) {
+ LOG_ERR("Error retrieving CBI FW_CONFIG field %d", FW_TABLET);
+ return;
+ }
+
+ if (val == FW_TABLET_PRESENT)
+ power_led_support = true;
+ else /* Clameshell */
+ power_led_support = false;
+}
+DECLARE_HOOK(HOOK_INIT, power_led_check, HOOK_PRIO_DEFAULT);
+
/* Called by hook task every TICK(IT83xx 500ms) */
static void led_tick(void)
{
led_set_battery();
+
+ if (power_led_support &&
+ led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
+ led_set_power();
}
DECLARE_HOOK(HOOK_TICK, led_tick, HOOK_PRIO_DEFAULT);
diff --git a/zephyr/program/nissa/yavilla/src/usbc.c b/zephyr/program/nissa/yavilla/src/usbc.c
index c9950ae73b..3cbdd23625 100644
--- a/zephyr/program/nissa/yavilla/src/usbc.c
+++ b/zephyr/program/nissa/yavilla/src/usbc.c
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-#include "charge_state_v2.h"
+#include "charge_state.h"
#include "chipset.h"
#include "driver/charger/sm5803.h"
#include "driver/tcpm/it83xx_pd.h"
@@ -235,6 +235,25 @@ __override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
}
}
+__override void board_set_charge_limit(int port, int supplier, int charge_ma,
+ int max_ma, int charge_mv)
+{
+ /*
+ * b:213937755: Yavilla C1 port is OCPC (One Charger IC Per Type-C)
+ * architecture, The charging current is controlled by increasing Vsys.
+ * However, the charger SM5803 is not limit current while Vsys
+ * increasing, we can see the current overshoot to ~3.6A to cause
+ * C1 port brownout with low power charger (5V). To avoid C1 port
+ * brownout at low power charger connected. Limit charge current to 2A.
+ */
+ if (charge_mv <= 5000 && port == 1)
+ charge_ma = MIN(charge_ma, 2000);
+ else
+ charge_ma = charge_ma * 96 / 100;
+
+ charge_set_input_current_limit(charge_ma, charge_mv);
+}
+
void board_reset_pd_mcu(void)
{
/*