summaryrefslogtreecommitdiff
path: root/board/gooey
diff options
context:
space:
mode:
Diffstat (limited to 'board/gooey')
-rw-r--r--board/gooey/battery.c2
-rw-r--r--board/gooey/board.c100
-rw-r--r--board/gooey/board.h30
-rw-r--r--board/gooey/build.mk2
-rw-r--r--board/gooey/ec.tasklist2
-rw-r--r--board/gooey/gpio.inc2
-rw-r--r--board/gooey/led.c59
-rw-r--r--board/gooey/usb_pd_policy.c6
8 files changed, 95 insertions, 108 deletions
diff --git a/board/gooey/battery.c b/board/gooey/battery.c
index c40e0d7ec7..e8cec5af5f 100644
--- a/board/gooey/battery.c
+++ b/board/gooey/battery.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.
*
diff --git a/board/gooey/board.c b/board/gooey/board.c
index fe7e2c3792..250f6afd61 100644
--- a/board/gooey/board.c
+++ b/board/gooey/board.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.
*/
@@ -40,7 +40,7 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
/* C0 interrupt line shared by BC 1.2 and charger */
@@ -84,7 +84,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)
@@ -114,8 +113,7 @@ DECLARE_DEFERRED(pendetect_deferred);
void pen_detect_interrupt(enum gpio_signal s)
{
/* Trigger deferred notification of pen detect change */
- hook_call_deferred(&pendetect_deferred_data,
- 500 * MSEC);
+ hook_call_deferred(&pendetect_deferred_data, 500 * MSEC);
}
void board_hibernate(void)
@@ -132,27 +130,21 @@ void board_hibernate(void)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -188,12 +180,15 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/* USB Muxes */
-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 = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
},
};
@@ -291,7 +286,6 @@ 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)
@@ -303,8 +297,7 @@ int board_set_active_charge_port(int port)
/* Disable all ports. */
if (port == CHARGE_PORT_NONE) {
- tcpc_write(0, TCPC_REG_COMMAND,
- TCPC_REG_COMMAND_SNK_CTRL_LOW);
+ tcpc_write(0, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SNK_CTRL_LOW);
raa489000_enable_asgate(0, false);
return EC_SUCCESS;
}
@@ -317,8 +310,7 @@ int board_set_active_charge_port(int port)
/* Enable requested charge port. */
if (raa489000_enable_asgate(port, true) ||
- tcpc_write(0, TCPC_REG_COMMAND,
- TCPC_REG_COMMAND_SNK_CTRL_HIGH)) {
+ tcpc_write(0, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SNK_CTRL_HIGH)) {
CPRINTUSB("p%d: sink path enable failed.", port);
return EC_ERROR_UNKNOWN;
}
@@ -360,17 +352,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrices to rotate accelerometers into the standard reference. */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* Sensor Data */
static struct stprivate_data g_lis2dwl_data;
@@ -452,14 +440,14 @@ const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
/* 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_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 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -508,8 +496,8 @@ static const struct ec_response_keybd_config gooey_keybd = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &gooey_keybd;
}
diff --git a/board/gooey/board.h b/board/gooey/board.h
index 4681fb5dcf..b586c0f334 100644
--- a/board/gooey/board.h
+++ b/board/gooey/board.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.
*/
@@ -24,9 +24,12 @@
/* Charger */
#define CONFIG_CHARGE_RAMP_HW
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr \
+ */
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC)
@@ -40,8 +43,8 @@
#define CONFIG_PWM
/* Sensors */
-#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
/* Sensors without hardware FIFO are in forced mode */
@@ -109,26 +112,17 @@ enum pwm_channel {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
ADC_CH_COUNT
};
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/gooey/build.mk b/board/gooey/build.mk
index ff15b3e8e4..f65b5e8f0c 100644
--- a/board/gooey/build.mk
+++ b/board/gooey/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/board/gooey/ec.tasklist b/board/gooey/ec.tasklist
index bdcbcdf074..8ccdfc81b2 100644
--- a/board/gooey/ec.tasklist
+++ b/board/gooey/ec.tasklist
@@ -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/board/gooey/gpio.inc b/board/gooey/gpio.inc
index 1eaae9e354..8eb1f5ef22 100644
--- a/board/gooey/gpio.inc
+++ b/board/gooey/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * 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/board/gooey/led.c b/board/gooey/led.c
index 6d55ce2932..5c7eb08407 100644
--- a/board/gooey/led.c
+++ b/board/gooey/led.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.
*
@@ -11,41 +11,46 @@
#include "gpio.h"
#include "pwm.h"
-#define LED_OFF_LVL 0
-#define LED_ON_LVL 1
+#define LED_OFF_LVL 0
+#define LED_ON_LVL 1
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF,
+ 0.5 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/gooey/usb_pd_policy.c b/board/gooey/usb_pd_policy.c
index b7c0ca21df..a7633b73ac 100644
--- a/board/gooey/usb_pd_policy.c
+++ b/board/gooey/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.
*/
@@ -13,8 +13,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.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)
int pd_check_vconn_swap(int port)
{