summaryrefslogtreecommitdiff
path: root/board/elemi/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/elemi/board.c')
-rw-r--r--board/elemi/board.c84
1 files changed, 45 insertions, 39 deletions
diff --git a/board/elemi/board.c b/board/elemi/board.c
index 1aaf5e1d95..6b166e1206 100644
--- a/board/elemi/board.c
+++ b/board/elemi/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -42,7 +42,7 @@
#include "gpio_list.h" /* Must come after other header files. */
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
/* Keyboard scan setting */
__override struct keyboard_scan_config keyscan_config = {
@@ -72,7 +72,7 @@ union volteer_cbi_fw_config fw_config_defaults = {
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_PP5000_FAN,
};
@@ -101,8 +101,8 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(68), \
[EC_TEMP_THRESH_HALT] = C_TO_K(70), \
@@ -118,8 +118,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CHARGER \
- { \
+#define THERMAL_CHARGER \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(78), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -136,8 +136,8 @@ __maybe_unused static const struct ec_thermal_config thermal_charger =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_REGULATOR \
- { \
+#define THERMAL_REGULATOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(68), \
[EC_TEMP_THRESH_HALT] = C_TO_K(70), \
@@ -248,8 +248,8 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, kb_backlight_disable, HOOK_PRIO_DEFAULT);
__override void board_ps8xxx_tcpc_init(int port)
{
/* b/189587527: Set Displayport EQ loss up to 10dB */
- tcpc_addr_write(port, PS8XXX_I2C_ADDR1_P1_FLAGS,
- PS8815_REG_DP_EQ_SETTING,
+ tcpc_addr_write(
+ port, PS8XXX_I2C_ADDR1_P1_FLAGS, PS8815_REG_DP_EQ_SETTING,
PS8815_DPEQ_LOSS_UP_10DB << PS8815_REG_DP_EQ_COMP_SHIFT);
}
@@ -258,11 +258,14 @@ __override void board_ps8xxx_tcpc_init(int port)
* virtual_usb_mux_driver so the AP gets notified of mux changes and updates
* the TCSS configuration on state changes.
*/
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .next_mux = NULL,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
+ .next = NULL,
};
/******************************************************************************/
@@ -277,8 +280,7 @@ static void ps8815_reset(void)
int val;
gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 0);
- msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS,
- PS8815_PWR_H_RST_H_DELAY_MS));
+ msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, PS8815_PWR_H_RST_H_DELAY_MS));
gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 1);
msleep(PS8815_FW_INIT_DELAY_MS);
@@ -289,16 +291,16 @@ static void ps8815_reset(void)
CPRINTS("%s: patching ps8815 registers", __func__);
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f was %02x", val);
- if (i2c_write8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
+ if (i2c_write8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f,
+ 0x31) == EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f set to 0x31");
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f now %02x", val);
}
@@ -308,7 +310,7 @@ void board_reset_pd_mcu(void)
/* Daughterboard specific reset for port 1 */
ps8815_reset();
usb_mux_hpd_update(USBC_PORT_C1, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
__override void board_cbi_init(void)
@@ -391,17 +393,21 @@ BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
/******************************************************************************/
/* USBC mux configuration - Tiger Lake includes internal mux */
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -458,13 +464,13 @@ int ppc_get_alert_status(int port)
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {1, 4}, {1, 3}, {1, 6}, {1, 7},
- {3, 1}, {2, 0}, {1, 5}, {2, 6}, {2, 7},
- {2, 1}, {2, 4}, {2, 5}, {1, 2}, {2, 3},
- {2, 2}, {3, 0}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 },
+ { 0, 7 }, { 1, 4 }, { 1, 3 }, { 1, 6 }, { 1, 7 },
+ { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 },
+ { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif