summaryrefslogtreecommitdiff
path: root/board/kinox
diff options
context:
space:
mode:
Diffstat (limited to 'board/kinox')
-rw-r--r--board/kinox/board.c58
-rw-r--r--board/kinox/board.h116
-rw-r--r--board/kinox/build.mk2
-rw-r--r--board/kinox/ec.tasklist2
-rw-r--r--board/kinox/fans.c10
-rw-r--r--board/kinox/fw_config.c4
-rw-r--r--board/kinox/fw_config.h8
-rw-r--r--board/kinox/gpio.inc8
-rw-r--r--board/kinox/i2c.c2
-rw-r--r--board/kinox/led.c17
-rw-r--r--board/kinox/power_detection.c375
-rw-r--r--board/kinox/pwm.c35
-rw-r--r--board/kinox/sensors.c52
-rw-r--r--board/kinox/usbc_config.c31
-rw-r--r--board/kinox/usbc_config.h9
15 files changed, 351 insertions, 378 deletions
diff --git a/board/kinox/board.c b/board/kinox/board.c
index a814c7a20d..7c55fba876 100644
--- a/board/kinox/board.c
+++ b/board/kinox/board.c
@@ -1,9 +1,9 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "assert.h"
+#include "builtin/assert.h"
#include "button.h"
#include "charge_manager.h"
#include "charge_state_v2.h"
@@ -11,7 +11,6 @@
#include "compile_time_macros.h"
#include "console.h"
#include "cros_board_info.h"
-#include "fw_config.h"
#include "gpio.h"
#include "gpio_signal.h"
#include "power_button.h"
@@ -21,12 +20,13 @@
#include "throttle_ap.h"
#include "usbc_config.h"
#include "usbc_ppc.h"
+#include "fw_config.h"
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
/******************************************************************************/
/* USB-A charging control */
@@ -40,8 +40,6 @@ BUILD_ASSERT(ARRAY_SIZE(usb_port_enable) == USB_PORT_COUNT);
int board_set_active_charge_port(int port)
{
- int rv;
-
CPRINTS("Requested charge port change to %d", port);
/*
@@ -64,15 +62,23 @@ int board_set_active_charge_port(int port)
if (board_vbus_source_enabled(port))
return EC_ERROR_INVAL;
- /* Don't change the charge port */
- if (charge_manager_get_active_charge_port() != CHARGE_PORT_NONE)
- return EC_ERROR_INVAL;
-
- /* Make sure BJ adapter is sourcing power */
- if (port == CHARGE_PORT_BARRELJACK &&
- gpio_get_level(GPIO_BJ_ADP_PRESENT_ODL)) {
- CPRINTS("BJ port selected, but not present!");
- return EC_ERROR_INVAL;
+ if (!chipset_in_state(CHIPSET_STATE_ANY_OFF)) {
+ int bj_active, bj_requested;
+
+ if (charge_manager_get_active_charge_port() != CHARGE_PORT_NONE)
+ /* Change is only permitted while the system is off */
+ return EC_ERROR_INVAL;
+
+ /*
+ * Current setting is no charge port but the AP is on, so the
+ * charge manager is out of sync (probably because we're
+ * reinitializing after sysjump). Reject requests that aren't
+ * in sync with our outputs.
+ */
+ bj_active = !gpio_get_level(GPIO_EN_PPVAR_BJ_ADP_L);
+ bj_requested = port == CHARGE_PORT_BARRELJACK;
+ if (bj_active != bj_requested)
+ return EC_ERROR_INVAL;
}
CPRINTS("New charger p%d", port);
@@ -80,19 +86,12 @@ int board_set_active_charge_port(int port)
switch (port) {
case CHARGE_PORT_TYPEC0:
gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 1);
- rv = ppc_vbus_sink_enable(CHARGE_PORT_TYPEC0, 1);
- if (rv) {
- CPRINTS("Failed to enable C0 sink path");
- return rv;
- }
break;
case CHARGE_PORT_BARRELJACK:
- rv = ppc_vbus_sink_enable(CHARGE_PORT_TYPEC0, 0);
- if (rv) {
- CPRINTS("Failed to disable C0 sink path");
- return rv;
- }
- gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 0);
+ /* Make sure BJ adapter is sourcing power */
+ if (gpio_get_level(GPIO_BJ_ADP_PRESENT_ODL))
+ return EC_ERROR_INVAL;
+ ppc_vbus_sink_enable(0, 0);
break;
default:
return EC_ERROR_INVAL;
@@ -101,8 +100,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
}
@@ -122,5 +121,6 @@ DECLARE_HOOK(HOOK_INIT, adp_state_init, HOOK_PRIO_INIT_CHARGE_MANAGER + 1);
static void board_init(void)
{
+ gpio_enable_interrupt(GPIO_BJ_ADP_PRESENT_ODL);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/kinox/board.h b/board/kinox/board.h
index 6637fbfec1..5e22e22269 100644
--- a/board/kinox/board.h
+++ b/board/kinox/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,37 +19,36 @@
/* HDMI CEC */
#define CONFIG_CEC
#define CEC_GPIO_OUT GPIO_HDMI_CEC_OUT
-#define CEC_GPIO_IN GPIO_HDMI_CEC_IN
+#define CEC_GPIO_IN GPIO_HDMI_CEC_IN
#define CEC_GPIO_PULL_UP GPIO_HDMI_CEC_PULL_UP
/* USB Type A Features */
-#define USB_PORT_COUNT 4
+#define USB_PORT_COUNT 4
#define CONFIG_USB_PORT_POWER_DUMB
/* USB Type C and USB PD defines */
-#define CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY
-
#define CONFIG_USB_PD_PPC
#define CONFIG_USB_PD_TCPM_PS8815
#define CONFIG_USB_PD_TCPM_PS8815_FORCE_DID
+#undef CONFIG_USB_PD_TCPM_NCT38XX
#define CONFIG_USBC_PPC_SYV682X
#undef CONFIG_SYV682X_HV_ILIM
#define CONFIG_SYV682X_HV_ILIM SYV682X_HV_ILIM_5_50
/* TODO: b/177608416 - measure and check these values on brya */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/* The design should support up to 100W. */
/* TODO(b/197702356): Set the max PD to 60W now and change it
* to 100W after we verify it.
*/
-#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
-#define PD_MAX_POWER_MW 100000
-#define PD_MAX_CURRENT_MA 5000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
+#define PD_MAX_POWER_MW 100000
+#define PD_MAX_CURRENT_MA 5000
+#define PD_MAX_VOLTAGE_MV 20000
/*
* Macros for GPIO signals used in common code that don't match the
@@ -57,52 +56,44 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
-#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_OD
-#define GPIO_RECOVERY_L_2 GPIO_GSC_EC_RECOVERY_BTN_OD
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_OD
+#define GPIO_RECOVERY_L_2 GPIO_GSC_EC_RECOVERY_BTN_OD
/* I2C Bus Configuration */
-#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT6_1
-
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT6_1
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x58
+#define I2C_ADDR_EEPROM_FLAGS 0x50
/* I2C control host command */
#define CONFIG_HOSTCMD_I2C_CONTROL
-/* Enabling Thunderbolt-compatible mode */
-#define CONFIG_USB_PD_TBT_COMPAT_MODE
-
-/* Enabling USB4 mode */
-#define CONFIG_USB_PD_USB4
-
/* Thermal features */
#define CONFIG_THERMISTOR
#define CONFIG_TEMP_SENSOR
@@ -116,24 +107,18 @@
* TODO(b/197478860): Enable the fan control. We need
* to check the sensor value and adjust the fan speed.
*/
- #define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FANS FAN_CH_COUNT
/* Include math_util for bitmask_uint64 used in pd_timers */
#define CONFIG_MATH_UTIL
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
-enum adp_id {
- UNKNOWN,
- TINY,
- TIO1,
- TIO2,
- TYPEC
-};
+enum adp_id { UNKNOWN, TINY, TIO1, TIO2, TYPEC };
struct adpater_id_params {
int min_voltage;
@@ -170,27 +155,20 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum ioex_port {
- IOEX_C0_NCT38XX = 0,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_PORT_COUNT };
enum pwm_channel {
- PWM_CH_LED_GREEN, /* PWM0 */
- PWM_CH_FAN, /* PWM5 */
- PWM_CH_LED_RED, /* PWM2 */
+ PWM_CH_LED_GREEN, /* PWM0 */
+ PWM_CH_FAN, /* PWM5 */
+ PWM_CH_LED_RED, /* PWM2 */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
+
+extern void adp_connect_interrupt(enum gpio_signal signal);
#endif /* !__ASSEMBLER__ */
diff --git a/board/kinox/build.mk b/board/kinox/build.mk
index 440d137968..3eb2d2b2d5 100644
--- a/board/kinox/build.mk
+++ b/board/kinox/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2022 The Chromium OS Authors. All rights reserved.
+# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/kinox/ec.tasklist b/board/kinox/ec.tasklist
index 025d8f86b4..6524d9c2b0 100644
--- a/board/kinox/ec.tasklist
+++ b/board/kinox/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kinox/fans.c b/board/kinox/fans.c
index a82a61648d..cb65e95f62 100644
--- a/board/kinox/fans.c
+++ b/board/kinox/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP12000_FAN,
};
@@ -37,9 +37,9 @@ static const struct fan_conf fan_conf_0 = {
* Set minimum at around 30% PWM.
*/
static const struct fan_rpm fan_rpm_0 = {
- .rpm_min = 750,
- .rpm_start = 750,
- .rpm_max = 5200,
+ .rpm_min = 1000,
+ .rpm_start = 1000,
+ .rpm_max = 4200,
};
const struct fan_t fans[FAN_CH_COUNT] = {
diff --git a/board/kinox/fw_config.c b/board/kinox/fw_config.c
index 02f39e70f4..9736de1110 100644
--- a/board/kinox/fw_config.c
+++ b/board/kinox/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
static union kinox_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/kinox/fw_config.h b/board/kinox/fw_config.h
index 0d79d55376..a3efa7bfe9 100644
--- a/board/kinox/fw_config.h
+++ b/board/kinox/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,11 +14,7 @@
* Source of truth is the project/brask/kinox/config.star configuration file.
*/
-enum ec_cfg_dp_display {
- ABSENT = 0,
- DB_HDMI = 1,
- DB_DP = 2
-};
+enum ec_cfg_dp_display { ABSENT = 0, DB_HDMI = 1, DB_DP = 2 };
union kinox_cbi_fw_config {
struct {
diff --git a/board/kinox/gpio.inc b/board/kinox/gpio.inc
index d21782ba37..f3d94ebf07 100644
--- a/board/kinox/gpio.inc
+++ b/board/kinox/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,6 +19,7 @@ GPIO_INT(SYS_SLP_S0IX_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_inte
GPIO_INT(USB_C0_BC12_INT_ODL, PIN(C, 6), GPIO_INT_FALLING, bc12_interrupt)
GPIO_INT(USB_C0_PPC_INT_ODL, PIN(F, 5), GPIO_INT_FALLING, ppc_interrupt)
GPIO_INT(USB_C0_TCPC_INT_ODL, PIN(A, 2), GPIO_INT_FALLING, tcpc_alert_event)
+GPIO_INT(BJ_ADP_PRESENT_ODL, PIN(8, 2), GPIO_INT_BOTH | GPIO_PULL_UP, adp_connect_interrupt)
GPIO_INT(EC_RECOVERY_BTN_OD, PIN(2, 3), GPIO_INT_BOTH, button_interrupt)
/* CCD */
@@ -29,7 +30,7 @@ GPIO(EC_ENTERING_RW, PIN(0, 3), GPIO_OUT_LOW)
GPIO(EC_GSC_PACKET_MODE, PIN(7, 5), GPIO_OUT_LOW)
/* Fan */
-GPIO(EN_PP12000_FAN, PIN(6, 1), GPIO_OUT_HIGH)
+GPIO(EN_PP12000_FAN, PIN(6, 1), GPIO_OUT_LOW)
/* Display */
GPIO(DP_CONN_OC_ODL, PIN(2, 5), GPIO_INPUT)
@@ -37,7 +38,6 @@ GPIO(HDMI_CONN_OC_ODL, PIN(2, 4), GPIO_INPUT)
/* BarrelJack */
GPIO(EN_PPVAR_BJ_ADP_L, PIN(0, 7), GPIO_OUT_LOW)
-GPIO(BJ_ADP_PRESENT_ODL, PIN(8, 2), GPIO_INPUT)
/* Chipset PCH */
GPIO(EC_PCHHOT_ODL, PIN(7, 4), GPIO_INPUT)
@@ -58,7 +58,7 @@ GPIO(CPU_C10_GATE_L, PIN(6, 7), GPIO_INPUT)
GPIO(EC_PCH_PWR_BTN_ODL, PIN(C, 1), GPIO_ODR_HIGH)
GPIO(GSC_EC_RECOVERY_BTN_OD, PIN(2, 2), GPIO_INPUT)
-GPIO(SIO_LEGO_EN, PIN(9, 6), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(SIO_LEGO_EN_L, PIN(9, 6), GPIO_OUT_LOW)
/* HDMI CEC */
/* TODO(b/197474873): Enable HDMI CEC */
diff --git a/board/kinox/i2c.c b/board/kinox/i2c.c
index d58deaa89a..0213134fcb 100644
--- a/board/kinox/i2c.c
+++ b/board/kinox/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kinox/led.c b/board/kinox/led.c
index 00381fa7f4..d2a9a599cf 100644
--- a/board/kinox/led.c
+++ b/board/kinox/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,16 +19,16 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_GPIO, format, ##args)
/*
* Due to the CSME-Lite processing, upon startup the CPU transitions through
* S0->S3->S5->S3->S0, causing the LED to turn on/off/on, so
* delay turning off the LED during suspend/shutdown.
*/
-#define LED_CPU_DELAY_MS (2000 * MSEC)
+#define LED_CPU_DELAY_MS (2000 * MSEC)
-const enum ec_led_id supported_led_ids[] = {EC_LED_ID_POWER_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
enum led_color {
@@ -84,9 +84,9 @@ static int set_color(enum ec_led_id id, enum led_color color, int duty)
}
}
-#define LED_PULSE_US (2 * SECOND)
+#define LED_PULSE_US (2 * SECOND)
/* 40 msec for nice and smooth transition. */
-#define LED_PULSE_TICK_US (40 * MSEC)
+#define LED_PULSE_TICK_US (40 * MSEC)
/*
* When pulsing is enabled, brightness is incremented by <duty_inc> every
@@ -217,7 +217,7 @@ void show_critical_error(void)
set_color(EC_LED_ID_POWER_LED, LED_RED, 100);
}
-static int command_led(int argc, char **argv)
+static int command_led(int argc, const char **argv)
{
enum ec_led_id id = EC_LED_ID_POWER_LED;
@@ -242,8 +242,7 @@ static int command_led(int argc, char **argv)
}
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(led, command_led,
- "[debug|red|green|off|alert|crit]",
+DECLARE_CONSOLE_COMMAND(led, command_led, "[debug|red|green|off|alert|crit]",
"Turn on/off LED.");
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
diff --git a/board/kinox/power_detection.c b/board/kinox/power_detection.c
index 54ca591252..c5b4a1a1ab 100644
--- a/board/kinox/power_detection.c
+++ b/board/kinox/power_detection.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -17,215 +17,211 @@
#include "util.h"
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
/******************************************************************************/
-static const char * const adp_id_names[] = {
- "unknown",
- "tiny",
- "tio1",
- "tio2",
- "typec",
+static const char *const adp_id_names[] = {
+ "unknown", "tiny", "tio1", "tio2", "typec",
};
/* ADP_ID control */
struct adpater_id_params tio1_power[] = {
{
- .min_voltage = 3300,
- .max_voltage = 3300,
- .charge_voltage = 20000,
- .charge_current = 6000,
- .watt = 120,
- .obp95 = 1990,
- .obp85 = 1780,
+ .min_voltage = 2816,
+ .max_voltage = 2816,
+ .charge_voltage = 20000,
+ .charge_current = 6000,
+ .watt = 120,
+ .obp95 = 1990,
+ .obp85 = 1780,
},
};
struct adpater_id_params tio2_power[] = {
{
- .min_voltage = 0,
- .max_voltage = 68,
- .charge_voltage = 20000,
- .charge_current = 8500,
- .watt = 170,
- .obp95 = 2820,
- .obp85 = 916,
+ .min_voltage = 0,
+ .max_voltage = 68,
+ .charge_voltage = 20000,
+ .charge_current = 8500,
+ .watt = 170,
+ .obp95 = 2820,
+ .obp85 = 916,
},
{
- .min_voltage = 68,
- .max_voltage = 142,
- .charge_voltage = 20000,
- .charge_current = 2250,
- .watt = 45,
- .obp95 = 750,
- .obp85 = 670,
+ .min_voltage = 68,
+ .max_voltage = 142,
+ .charge_voltage = 20000,
+ .charge_current = 2250,
+ .watt = 45,
+ .obp95 = 750,
+ .obp85 = 670,
},
{
- .min_voltage = 200,
- .max_voltage = 288,
- .charge_voltage = 20000,
- .charge_current = 3250,
- .watt = 65,
- .obp95 = 1080,
- .obp85 = 960,
+ .min_voltage = 200,
+ .max_voltage = 288,
+ .charge_voltage = 20000,
+ .charge_current = 3250,
+ .watt = 65,
+ .obp95 = 1080,
+ .obp85 = 960,
},
{
- .min_voltage = 531,
- .max_voltage = 607,
- .charge_voltage = 20000,
- .charge_current = 6000,
- .watt = 120,
- .obp95 = 1990,
- .obp85 = 1780,
+ .min_voltage = 384,
+ .max_voltage = 480,
+ .charge_voltage = 20000,
+ .charge_current = 7500,
+ .watt = 150,
+ .obp95 = 2490,
+ .obp85 = 2220,
},
{
- .min_voltage = 384,
- .max_voltage = 480,
- .charge_voltage = 20000,
- .charge_current = 7500,
- .watt = 150,
- .obp95 = 2490,
- .obp85 = 2220,
+ .min_voltage = 531,
+ .max_voltage = 607,
+ .charge_voltage = 20000,
+ .charge_current = 6000,
+ .watt = 120,
+ .obp95 = 1990,
+ .obp85 = 1780,
},
{
- .min_voltage = 1062,
- .max_voltage = 1126,
- .charge_voltage = 20000,
- .charge_current = 8500,
- .watt = 170,
- .obp95 = 2820,
- .obp85 = 916,
+ .min_voltage = 1062,
+ .max_voltage = 1126,
+ .charge_voltage = 20000,
+ .charge_current = 8500,
+ .watt = 170,
+ .obp95 = 2820,
+ .obp85 = 916,
},
{
- .min_voltage = 2816,
- .max_voltage = 3300,
- .charge_voltage = 20000,
- .charge_current = 6000,
- .watt = 120,
- .obp95 = 1990,
- .obp85 = 1780,
+ .min_voltage = 2816,
+ .max_voltage = 2816,
+ .charge_voltage = 20000,
+ .charge_current = 6000,
+ .watt = 120,
+ .obp95 = 1990,
+ .obp85 = 1780,
},
};
struct adpater_id_params tiny_power[] = {
{
- .min_voltage = 68,
- .max_voltage = 142,
- .charge_voltage = 20000,
- .charge_current = 2250,
- .watt = 45,
- .obp95 = 750,
- .obp85 = 670,
+ .min_voltage = 68,
+ .max_voltage = 142,
+ .charge_voltage = 20000,
+ .charge_current = 2250,
+ .watt = 45,
+ .obp95 = 750,
+ .obp85 = 670,
},
{
- .min_voltage = 200,
- .max_voltage = 288,
- .charge_voltage = 20000,
- .charge_current = 3250,
- .watt = 65,
- .obp95 = 1080,
- .obp85 = 960,
+ .min_voltage = 200,
+ .max_voltage = 288,
+ .charge_voltage = 20000,
+ .charge_current = 3250,
+ .watt = 65,
+ .obp95 = 1080,
+ .obp85 = 960,
},
{
- .min_voltage = 384,
- .max_voltage = 480,
- .charge_voltage = 20000,
- .charge_current = 4500,
- .watt = 90,
- .obp95 = 1490,
- .obp85 = 1330,
+ .min_voltage = 384,
+ .max_voltage = 480,
+ .charge_voltage = 20000,
+ .charge_current = 4500,
+ .watt = 90,
+ .obp95 = 1490,
+ .obp85 = 1330,
},
{
- .min_voltage = 531,
- .max_voltage = 607,
- .charge_voltage = 20000,
- .charge_current = 6000,
- .watt = 120,
- .obp95 = 0x2D3,
- .obp85 = 0x286,
+ .min_voltage = 531,
+ .max_voltage = 607,
+ .charge_voltage = 20000,
+ .charge_current = 6000,
+ .watt = 120,
+ .obp95 = 0x2D3,
+ .obp85 = 0x286,
},
{
- .min_voltage = 653,
- .max_voltage = 783,
- .charge_voltage = 20000,
- .charge_current = 6750,
- .watt = 135,
- .obp95 = 2240,
- .obp85 = 2000,
+ .min_voltage = 653,
+ .max_voltage = 783,
+ .charge_voltage = 20000,
+ .charge_current = 6750,
+ .watt = 135,
+ .obp95 = 2240,
+ .obp85 = 2000,
},
{
- .min_voltage = 851,
- .max_voltage = 997,
- .charge_voltage = 20000,
- .charge_current = 7500,
- .watt = 150,
- .obp95 = 2490,
- .obp85 = 2220,
+ .min_voltage = 851,
+ .max_voltage = 997,
+ .charge_voltage = 20000,
+ .charge_current = 7500,
+ .watt = 150,
+ .obp95 = 2490,
+ .obp85 = 2220,
},
{
- .min_voltage = 1063,
- .max_voltage = 1226,
- .charge_voltage = 20000,
- .charge_current = 8500,
- .watt = 170,
- .obp95 = 2820,
- .obp85 = 916,
+ .min_voltage = 1063,
+ .max_voltage = 1226,
+ .charge_voltage = 20000,
+ .charge_current = 8500,
+ .watt = 170,
+ .obp95 = 2820,
+ .obp85 = 916,
},
{
- .min_voltage = 1749,
- .max_voltage = 1968,
- .charge_voltage = 20000,
- .charge_current = 11500,
- .watt = 230,
- .obp95 = 3810,
- .obp85 = 3410,
+ .min_voltage = 1749,
+ .max_voltage = 1968,
+ .charge_voltage = 20000,
+ .charge_current = 11500,
+ .watt = 230,
+ .obp95 = 3810,
+ .obp85 = 3410,
},
};
struct adpater_id_params typec_power[] = {
{
- .charge_voltage = 20000,
- .charge_current = 1500,
- .watt = 30,
- .obp95 = 500,
- .obp85 = 440,
+ .charge_voltage = 20000,
+ .charge_current = 1500,
+ .watt = 30,
+ .obp95 = 500,
+ .obp85 = 440,
},
{
- .charge_voltage = 15000,
- .charge_current = 2000,
- .watt = 30,
- .obp95 = 660,
- .obp85 = 590,
+ .charge_voltage = 15000,
+ .charge_current = 2000,
+ .watt = 30,
+ .obp95 = 660,
+ .obp85 = 590,
},
{
- .charge_voltage = 20000,
- .charge_current = 2250,
- .watt = 45,
- .obp95 = 750,
- .obp85 = 670,
+ .charge_voltage = 20000,
+ .charge_current = 2250,
+ .watt = 45,
+ .obp95 = 750,
+ .obp85 = 670,
},
{
- .charge_voltage = 15000,
- .charge_current = 3000,
- .watt = 45,
- .obp95 = 990,
- .obp85 = 890,
+ .charge_voltage = 15000,
+ .charge_current = 3000,
+ .watt = 45,
+ .obp95 = 990,
+ .obp85 = 890,
},
{
- .charge_voltage = 20000,
- .charge_current = 3250,
- .watt = 65,
- .obp95 = 1080,
- .obp85 = 960,
+ .charge_voltage = 20000,
+ .charge_current = 3250,
+ .watt = 65,
+ .obp95 = 1080,
+ .obp85 = 960,
},
{
- .charge_voltage = 20000,
- .charge_current = 5000,
- .watt = 100,
- .obp95 = 1660,
- .obp85 = 1480,
+ .charge_voltage = 20000,
+ .charge_current = 5000,
+ .watt = 100,
+ .obp95 = 1660,
+ .obp85 = 1480,
},
};
@@ -241,7 +237,7 @@ void obp_point_95(void)
/* Trigger the PROCHOT */
gpio_set_level(GPIO_EC_PROCHOT_ODL, 0);
- CPRINTF("Adapter voltage over then 95%% trigger prochot.");
+ CPRINTS("Adapter voltage over 95%% trigger prochot.");
}
void obp_point_85(void)
@@ -253,20 +249,20 @@ void obp_point_85(void)
/* Release the PROCHOT */
gpio_set_level(GPIO_EC_PROCHOT_ODL, 1);
- CPRINTF("Adapter voltage less then 85%% release prochot.");
+ CPRINTS("Adapter voltage lower than 85%% release prochot.");
}
struct npcx_adc_thresh_t adc_obp_point_95 = {
.adc_ch = ADC_PWR_IN_IMON,
.adc_thresh_cb = obp_point_95,
- .thresh_assert = 3300, /* Default */
+ .thresh_assert = 3300, /* Default */
};
struct npcx_adc_thresh_t adc_obp_point_85 = {
.adc_ch = ADC_PWR_IN_IMON,
.adc_thresh_cb = obp_point_85,
.lower_or_higher = 1,
- .thresh_assert = 0, /* Default */
+ .thresh_assert = 0, /* Default */
};
static void set_up_adc_irqs(void)
@@ -295,14 +291,16 @@ void set_the_obp(int power_type_index, int adp_type)
switch (adp_type) {
case TIO1:
case TIO2:
+ gpio_set_level(GPIO_SIO_LEGO_EN_L, 0);
charge_manager_update_charge(
- CHARGE_SUPPLIER_PROPRIETARY,
- DEDICATED_CHARGE_PORT, &pi);
+ CHARGE_SUPPLIER_PROPRIETARY,
+ DEDICATED_CHARGE_PORT, &pi);
break;
case TINY:
- charge_manager_update_charge(
- CHARGE_SUPPLIER_DEDICATED,
- DEDICATED_CHARGE_PORT, &pi);
+ gpio_set_level(GPIO_SIO_LEGO_EN_L, 1);
+ charge_manager_update_charge(CHARGE_SUPPLIER_DEDICATED,
+ DEDICATED_CHARGE_PORT,
+ &pi);
break;
}
}
@@ -323,10 +321,10 @@ void set_the_obp(int power_type_index, int adp_type)
* | | |
* |---220 ms---|-----400 ms-----|
*
- * Tiny: Twice adapter ADC values are less than 0x3FF.
- * TIO1: Twice adapter ADC values are 0x3FF.
- * TIO2: First adapter ADC value less than 0x3FF.
- * Second adpater ADC value is 0x3FF.
+ * Tiny: Twice adapter ADC values are less than 2.816v.
+ * TIO1: Twice adapter ADC values are 2.816v.
+ * TIO2: First adapter ADC value less than 2.816v.
+ * Second adpater ADC value is 2.816v.
*/
static void adp_id_deferred(void);
DECLARE_DEFERRED(adp_id_deferred);
@@ -344,36 +342,39 @@ void adp_id_deferred(void)
adp_id_value_debounce = adp_id_value;
/* for delay the 400ms to get the next APD_ID value */
hook_call_deferred(&adp_id_deferred_data, 400 * MSEC);
- } else if (adp_id_value_debounce == 0x3FF && adp_id_value == 0x3FF) {
+ } else if (adp_id_value_debounce == ADC_MAX_VOLT &&
+ adp_id_value == ADC_MAX_VOLT) {
adp_finial_adc_value = adp_id_value;
adp_type = TIO1;
- } else if (adp_id_value_debounce < 0x3FF && adp_id_value == 0x3FF) {
+ } else if (adp_id_value_debounce < ADC_MAX_VOLT &&
+ adp_id_value == ADC_MAX_VOLT) {
adp_finial_adc_value = adp_id_value_debounce;
adp_type = TIO2;
- } else if (adp_id_value_debounce < 0x3FF && adp_id_value < 0x3FF) {
+ } else if (adp_id_value_debounce < ADC_MAX_VOLT &&
+ adp_id_value < ADC_MAX_VOLT) {
adp_finial_adc_value = adp_id_value;
adp_type = TINY;
} else {
CPRINTS("ADP_ID mismatch anything!");
- /* Set the default 65w adaptor max ADC value */
- adp_finial_adc_value = 0x69;
+ /* Set the default TINY 45w adapter */
+ adp_finial_adc_value = 142;
adp_type = TINY;
}
switch (adp_type) {
case TIO1:
- power_type_len = sizeof(tio1_power) /
- sizeof(struct adpater_id_params);
+ power_type_len =
+ sizeof(tio1_power) / sizeof(struct adpater_id_params);
memcpy(&power_type, &tio1_power, sizeof(tio1_power));
break;
case TIO2:
- power_type_len = sizeof(tio2_power) /
- sizeof(struct adpater_id_params);
+ power_type_len =
+ sizeof(tio2_power) / sizeof(struct adpater_id_params);
memcpy(&power_type, &tio2_power, sizeof(tio2_power));
break;
case TINY:
- power_type_len = sizeof(tiny_power) /
- sizeof(struct adpater_id_params);
+ power_type_len =
+ sizeof(tiny_power) / sizeof(struct adpater_id_params);
memcpy(&power_type, &tiny_power, sizeof(tiny_power));
break;
}
@@ -388,10 +389,19 @@ void adp_id_deferred(void)
static void barrel_jack_setting(void)
{
+ struct charge_port_info pi = { 0 };
/* Check ADP_ID when barrel jack is present */
- if (!gpio_get_level(GPIO_BJ_ADP_PRESENT_ODL))
+ if (!gpio_get_level(GPIO_BJ_ADP_PRESENT_ODL)) {
+ /* Set the default TINY 45w adapter */
+ pi.voltage = 20000;
+ pi.current = 2250;
+
+ charge_manager_update_charge(CHARGE_SUPPLIER_DEDICATED,
+ DEDICATED_CHARGE_PORT, &pi);
+
/* Delay 220ms to get the first ADP_ID value */
hook_call_deferred(&adp_id_deferred_data, 220 * MSEC);
+ }
}
DECLARE_HOOK(HOOK_INIT, barrel_jack_setting, HOOK_PRIO_DEFAULT);
@@ -405,13 +415,13 @@ static void typec_adapter_setting(void)
/* Check the barrel jack is not present */
if (gpio_get_level(GPIO_BJ_ADP_PRESENT_ODL)) {
adapter_current_ma = charge_manager_get_charger_current();
- power_type_len = sizeof(typec_power) /
- sizeof(struct adpater_id_params);
+ power_type_len =
+ sizeof(typec_power) / sizeof(struct adpater_id_params);
memcpy(&power_type, &typec_power, sizeof(typec_power));
for (i = (power_type_len - 1); i >= 0; i--) {
if (adapter_current_ma >=
- power_type[i].charge_current) {
+ power_type[i].charge_current) {
set_the_obp(i, adp_type);
break;
}
@@ -419,3 +429,10 @@ static void typec_adapter_setting(void)
}
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, typec_adapter_setting, HOOK_PRIO_DEFAULT);
+
+/* IRQ for BJ plug/unplug. It shouldn't be called if BJ is the power source. */
+void adp_connect_interrupt(enum gpio_signal signal)
+{
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
+ hook_call_deferred(&adp_id_deferred_data, 0);
+}
diff --git a/board/kinox/pwm.c b/board/kinox/pwm.c
index 112ee62c8c..ce1f83e187 100644
--- a/board/kinox/pwm.c
+++ b/board/kinox/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,34 +11,23 @@
#include "pwm_chip.h"
const struct pwm_t pwm_channels[] = {
- [PWM_CH_LED_GREEN] = {
- .channel = 0,
- .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- .freq = 2000
- },
- [PWM_CH_FAN] = {
- .channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000
- },
- [PWM_CH_LED_RED] = {
- .channel = 2,
- .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- .freq = 2000
- },
+ [PWM_CH_LED_GREEN] = { .channel = 0,
+ .flags = PWM_CONFIG_ACTIVE_LOW |
+ PWM_CONFIG_DSLEEP |
+ PWM_CONFIG_OPEN_DRAIN,
+ .freq = 2000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
+ [PWM_CH_LED_RED] = { .channel = 2,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
static void board_pwm_init(void)
{
- /*
- * TODO(b/197478860): Turn on the fan at 100% by default
- * We need to find tune the fan speed according to the
- * thermal sensor value.
- */
pwm_enable(PWM_CH_FAN, 1);
- pwm_set_duty(PWM_CH_FAN, 100);
-
pwm_enable(PWM_CH_LED_RED, 1);
pwm_enable(PWM_CH_LED_GREEN, 1);
}
diff --git a/board/kinox/sensors.c b/board/kinox/sensors.c
index e444664e8f..86c60b1427 100644
--- a/board/kinox/sensors.c
+++ b/board/kinox/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,37 +56,29 @@ const struct adc_t adc_channels[] = {
.name = "ADP_ID",
.input_ch = NPCX_ADC_CH4,
.factor_mul = ADC_MAX_VOLT,
- .factor_div = ADC_READ_MAX + 1,
+ .factor_div = ADC_READ_MAX,
},
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Temperature sensor configuration */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1_CPU] = {
- .name = "CPU",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1_CPU
- },
- [TEMP_SENSOR_2_CPU_VR] = {
- .name = "CPU VR",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_CPU_VR
- },
- [TEMP_SENSOR_3_WIFI] = {
- .name = "WIFI",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3_WIFI
- },
- [TEMP_SENSOR_4_DIMM] = {
- .name = "DIMM",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4_DIMM
- },
+ [TEMP_SENSOR_1_CPU] = { .name = "CPU",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1_CPU },
+ [TEMP_SENSOR_2_CPU_VR] = { .name = "CPU VR",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2_CPU_VR },
+ [TEMP_SENSOR_3_WIFI] = { .name = "WIFI",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3_WIFI },
+ [TEMP_SENSOR_4_DIMM] = { .name = "DIMM",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4_DIMM },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -100,8 +92,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(95), \
@@ -112,8 +104,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
[EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
[EC_TEMP_THRESH_HALT] = C_TO_K(90), \
}, \
- .temp_fan_off = C_TO_K(35), \
- .temp_fan_max = C_TO_K(65), \
+ .temp_fan_off = C_TO_K(25), \
+ .temp_fan_max = C_TO_K(75), \
}
__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
diff --git a/board/kinox/usbc_config.c b/board/kinox/usbc_config.c
index a5c171bede..feeb3be6d1 100644
--- a/board/kinox/usbc_config.c
+++ b/board/kinox/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,8 +28,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* USBC TCPC configuration */
const struct tcpc_config_t tcpc_config[] = {
@@ -61,19 +61,24 @@ BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
/* USBC mux configuration - Alder Lake includes internal mux */
-static const struct usb_mux usbc0_usb3_retimer = {
- .usb_port = USBC_PORT_C0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+static const struct usb_mux_chain usbc0_usb3_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- /* PS8815 */
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc0_usb3_retimer,
+ .mux = &(const struct usb_mux) {
+ /* PS8815 */
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc0_usb3_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
diff --git a/board/kinox/usbc_config.h b/board/kinox/usbc_config.h
index b294eb69c8..7a212f8fb6 100644
--- a/board/kinox/usbc_config.h
+++ b/board/kinox/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,11 +8,8 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_COUNT };
#endif /* __CROS_EC_USBC_CONFIG_H */