summaryrefslogtreecommitdiff
path: root/baseboard/goroh
diff options
context:
space:
mode:
Diffstat (limited to 'baseboard/goroh')
-rw-r--r--baseboard/goroh/baseboard.c87
-rw-r--r--baseboard/goroh/baseboard.h22
-rw-r--r--baseboard/goroh/baseboard_usbc_config.h2
-rw-r--r--baseboard/goroh/board_id.c19
-rw-r--r--baseboard/goroh/build.mk2
-rw-r--r--baseboard/goroh/usb_pd_policy.c6
-rw-r--r--baseboard/goroh/usbc_config.c43
7 files changed, 83 insertions, 98 deletions
diff --git a/baseboard/goroh/baseboard.c b/baseboard/goroh/baseboard.c
index d51b881753..f70f070fac 100644
--- a/baseboard/goroh/baseboard.c
+++ b/baseboard/goroh/baseboard.c
@@ -1,4 +1,4 @@
-/* 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.
*/
@@ -48,8 +48,8 @@
#include "gpio_list.h"
-#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)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
/* Wake-up pins for hibernate */
enum gpio_signal hibernate_wake_pins[] = {
@@ -68,11 +68,9 @@ const struct charger_config_t chg_chips[] = {
};
/* BC12 skeleton to make build happy. */
-struct bc12_config bc12_ports[CHARGE_PORT_COUNT] = {
-};
+struct bc12_config bc12_ports[CHARGE_PORT_COUNT] = {};
-const int usb_port_enable[USB_PORT_COUNT] = {
-};
+const int usb_port_enable[USB_PORT_COUNT] = {};
/* Called on AP S3 -> S0 transition */
static void board_chipset_resume(void)
@@ -109,34 +107,26 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "bat_chg",
- .port = IT83XX_I2C_CH_A,
- .kbps = 100,
- .scl = GPIO_I2C_A_SCL,
- .sda = GPIO_I2C_A_SDA
- },
- {
- .name = "sensor",
- .port = IT83XX_I2C_CH_B,
- .kbps = 400,
- .scl = GPIO_I2C_B_SCL,
- .sda = GPIO_I2C_B_SDA
- },
- {
- .name = "usb0",
- .port = IT83XX_I2C_CH_C,
- .kbps = 400,
- .scl = GPIO_I2C_C_SCL,
- .sda = GPIO_I2C_C_SDA
- },
- {
- .name = "usb1",
- .port = IT83XX_I2C_CH_E,
- .kbps = 400,
- .scl = GPIO_I2C_E_SCL,
- .sda = GPIO_I2C_E_SDA
- },
+ { .name = "bat_chg",
+ .port = IT83XX_I2C_CH_A,
+ .kbps = 100,
+ .scl = GPIO_I2C_A_SCL,
+ .sda = GPIO_I2C_A_SDA },
+ { .name = "sensor",
+ .port = IT83XX_I2C_CH_B,
+ .kbps = 400,
+ .scl = GPIO_I2C_B_SCL,
+ .sda = GPIO_I2C_B_SDA },
+ { .name = "usb0",
+ .port = IT83XX_I2C_CH_C,
+ .kbps = 400,
+ .scl = GPIO_I2C_C_SCL,
+ .sda = GPIO_I2C_C_SDA },
+ { .name = "usb1",
+ .port = IT83XX_I2C_CH_E,
+ .kbps = 400,
+ .scl = GPIO_I2C_E_SCL,
+ .sda = GPIO_I2C_E_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -145,7 +135,6 @@ int board_allow_i2c_passthru(const struct i2c_cmd_desc_t *cmd_desc)
return (cmd_desc->port == I2C_PORT_VIRTUAL_BATTERY);
}
-
void board_overcurrent_event(int port, int is_overcurrented)
{
/* TODO: check correct operation for GOROH */
@@ -155,21 +144,25 @@ const struct cc_para_t *board_get_cc_tuning_parameter(enum usbpd_port port)
{
const static struct cc_para_t
cc_parameter[CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT] = {
- {
- .rising_time = IT83XX_TX_PRE_DRIVING_TIME_1_UNIT,
- .falling_time = IT83XX_TX_PRE_DRIVING_TIME_2_UNIT,
- },
- {
- .rising_time = IT83XX_TX_PRE_DRIVING_TIME_1_UNIT,
- .falling_time = IT83XX_TX_PRE_DRIVING_TIME_2_UNIT,
- },
- };
+ {
+ .rising_time =
+ IT83XX_TX_PRE_DRIVING_TIME_1_UNIT,
+ .falling_time =
+ IT83XX_TX_PRE_DRIVING_TIME_2_UNIT,
+ },
+ {
+ .rising_time =
+ IT83XX_TX_PRE_DRIVING_TIME_1_UNIT,
+ .falling_time =
+ IT83XX_TX_PRE_DRIVING_TIME_2_UNIT,
+ },
+ };
return &cc_parameter[port];
}
-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)
{
charge_set_input_current_limit(
MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
diff --git a/baseboard/goroh/baseboard.h b/baseboard/goroh/baseboard.h
index c0246e9970..1488bb6fcf 100644
--- a/baseboard/goroh/baseboard.h
+++ b/baseboard/goroh/baseboard.h
@@ -1,4 +1,4 @@
-/* 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.
*/
@@ -73,20 +73,20 @@
#define CONFIG_KEYBOARD_BACKLIGHT
#define CONFIG_PWM_KBLIGHT
#define CONFIG_KBLIGHT_ENABLE_PIN
-#define GPIO_EN_KEYBOARD_BACKLIGHT GPIO_EN_PPVAR_KB_BL_X
+#define GPIO_EN_KEYBOARD_BACKLIGHT GPIO_EN_PPVAR_KB_BL_X
/* I2C */
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
#define CONFIG_I2C_PASSTHRU_RESTRICTED
#define CONFIG_I2C_VIRTUAL_BATTERY
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define I2C_PORT_EEPROM IT83XX_I2C_CH_A
#define I2C_PORT_CHARGER IT83XX_I2C_CH_A
#define I2C_PORT_BATTERY IT83XX_I2C_CH_A
#define I2C_PORT_ACCEL IT83XX_I2C_CH_B
-#define I2C_PORT_USB_C0 IT83XX_I2C_CH_C
-#define I2C_PORT_USB_C1 IT83XX_I2C_CH_E
+#define I2C_PORT_USB_C0 IT83XX_I2C_CH_C
+#define I2C_PORT_USB_C1 IT83XX_I2C_CH_E
#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
#define CONFIG_SMBUS_PEC
@@ -128,14 +128,14 @@
#define CONFIG_USB_PD_TCPMV2
#define CONFIG_USB_PD_TRY_SRC
#define CONFIG_USB_PD_VBUS_DETECT_PPC
-#define CONFIG_USB_PID 0x5566 /* TODO: update PID */
+#define CONFIG_USB_PID 0x5566 /* TODO: update PID */
#define CONFIG_USB_POWER_DELIVERY
#define PD_MAX_CURRENT_MA 3000
#define PD_MAX_VOLTAGE_MV 20000
#define PD_OPERATING_POWER_MW 15000
#define PD_MAX_POWER_MW 60000
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* USB-A */
@@ -174,13 +174,13 @@
(EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_CONNECTED) | \
EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_DISCONNECTED) | \
EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) | \
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_MODE_CHANGE) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_MODE_CHANGE) | \
EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON))
/* GPIO name remapping */
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
#ifndef __ASSEMBLER__
diff --git a/baseboard/goroh/baseboard_usbc_config.h b/baseboard/goroh/baseboard_usbc_config.h
index b5e76644ee..7da00c17d6 100644
--- a/baseboard/goroh/baseboard_usbc_config.h
+++ b/baseboard/goroh/baseboard_usbc_config.h
@@ -1,4 +1,4 @@
-/* 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.
*/
diff --git a/baseboard/goroh/board_id.c b/baseboard/goroh/board_id.c
index fd2001d8a3..7bc77d5229 100644
--- a/baseboard/goroh/board_id.c
+++ b/baseboard/goroh/board_id.c
@@ -1,4 +1,4 @@
-/* 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.
*/
@@ -34,21 +34,8 @@
* 14 | 47 | 680 | 3086.7
*/
const static int voltage_map[] = {
- 136,
- 388,
- 584,
- 785,
- 993,
- 1220,
- 1432,
- 1650,
- 1875,
- 2084,
- 2273,
- 2461,
- 2672,
- 2888,
- 3086,
+ 136, 388, 584, 785, 993, 1220, 1432, 1650,
+ 1875, 2084, 2273, 2461, 2672, 2888, 3086,
};
const int threshold_mv = 100;
diff --git a/baseboard/goroh/build.mk b/baseboard/goroh/build.mk
index 4488c4b395..6a3a386efb 100644
--- a/baseboard/goroh/build.mk
+++ b/baseboard/goroh/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# 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.
#
diff --git a/baseboard/goroh/usb_pd_policy.c b/baseboard/goroh/usb_pd_policy.c
index 5030489ec8..e92ced5e89 100644
--- a/baseboard/goroh/usb_pd_policy.c
+++ b/baseboard/goroh/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* 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.
*/
@@ -15,8 +15,8 @@
#error Goroh reference must have at least one 3.0 A port
#endif
-#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)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
void svdm_set_hpd_gpio(int port, int en)
{
diff --git a/baseboard/goroh/usbc_config.c b/baseboard/goroh/usbc_config.c
index 5a49d2ee2d..9d162ca783 100644
--- a/baseboard/goroh/usbc_config.c
+++ b/baseboard/goroh/usbc_config.c
@@ -1,4 +1,4 @@
-/* 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.
*/
@@ -14,14 +14,14 @@
#include "hooks.h"
#include "driver/tcpm/it8xxx2_pd_public.h"
#include "driver/ppc/syv682x_public.h"
-#include "driver/retimer/ps8818.h"
+#include "driver/retimer/ps8818_public.h"
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
#include "usbc_ppc.h"
#include "gpio.h"
#include "gpio_signal.h"
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
#ifdef CONFIG_BRINGUP
#define GPIO_SET_LEVEL(pin, lvl) gpio_set_level_verbose(CC_USBPD, pin, lvl)
@@ -62,7 +62,6 @@ static int goroh_usb_c0_set_mux(const struct usb_mux *me, mux_state_t mux_state,
mux_state = mux_state ^ USB_PD_MUX_POLARITY_INVERTED;
return virtual_usb_mux_driver.set(me, mux_state, ack_required);
-
}
static int goroh_usb_c0_get_mux(const struct usb_mux *me,
@@ -77,25 +76,32 @@ static struct usb_mux_driver goroh_usb_c0_mux_driver = {
.get = goroh_usb_c0_get_mux,
};
-static const struct usb_mux goroh_usb_c1_ps8818_retimer = {
- .usb_port = USBC_PORT_C1,
- .i2c_port = I2C_PORT_USB_C1,
- .i2c_addr_flags = PS8818_I2C_ADDR_FLAGS,
- .driver = &ps8818_usb_retimer_driver,
- .next_mux = NULL,
+static const struct usb_mux_chain goroh_usb_c1_ps8818_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .i2c_port = I2C_PORT_USB_C1,
+ .i2c_addr_flags = PS8818_I2C_ADDR_FLAGS,
+ .driver = &ps8818_usb_retimer_driver,
+ },
+ .next = NULL,
};
-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] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &goroh_usb_c0_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &goroh_usb_c0_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 = &goroh_usb_c1_ps8818_retimer,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &goroh_usb_c1_ps8818_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -128,7 +134,6 @@ void ppc_interrupt(enum gpio_signal signal)
syv682x_interrupt(1);
}
-
static void board_tcpc_init(void)
{
gpio_enable_interrupt(GPIO_USB_C0_FAULT_ODL);