summaryrefslogtreecommitdiff
path: root/board/cappy2/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/cappy2/board.c')
-rw-r--r--board/cappy2/board.c55
1 files changed, 26 insertions, 29 deletions
diff --git a/board/cappy2/board.c b/board/cappy2/board.c
index c6f560b503..de651ac874 100644
--- a/board/cappy2/board.c
+++ b/board/cappy2/board.c
@@ -1,11 +1,10 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* cappy2 board-specific configuration */
-
#include "adc_chip.h"
#include "button.h"
#include "cbi_fw_config.h"
@@ -39,8 +38,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -80,7 +79,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
@@ -159,7 +157,6 @@ __override void board_power_5v_enable(int enable)
*/
gpio_set_level(GPIO_EN_PP5000, !!enable);
gpio_set_level(GPIO_EN_USB_A0_VBUS, !!enable);
-
}
int board_is_sourcing_vbus(int port)
@@ -168,13 +165,11 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
int old_port;
@@ -234,8 +229,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)
{
int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
@@ -289,12 +284,15 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = PS8743_I2C_ADDR0_FLAG,
- .driver = &ps8743_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = PS8743_I2C_ADDR0_FLAG,
+ .driver = &ps8743_usb_mux_driver,
+ },
},
};
@@ -341,23 +339,22 @@ void board_init(void)
/* modify AC DC prochot value */
isl923x_set_ac_prochot(CHARGER_SOLO, 4096);
isl923x_set_dc_prochot(CHARGER_SOLO, 6000);
-
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Cpu",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Cpu",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);