summaryrefslogtreecommitdiff
path: root/board/katsu
diff options
context:
space:
mode:
Diffstat (limited to 'board/katsu')
-rw-r--r--board/katsu/board.c93
-rw-r--r--board/katsu/board.h34
-rw-r--r--board/katsu/build.mk2
-rw-r--r--board/katsu/ec.tasklist2
-rw-r--r--board/katsu/gpio.inc2
-rw-r--r--board/katsu/led.c14
6 files changed, 68 insertions, 79 deletions
diff --git a/board/katsu/board.c b/board/katsu/board.c
index a91f2c4afa..3527214f62 100644
--- a/board/katsu/board.c
+++ b/board/katsu/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.
*/
@@ -26,6 +26,7 @@
#include "host_command.h"
#include "i2c.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -42,8 +43,8 @@
#include "usb_pd_tcpm.h"
#include "util.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)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -60,45 +61,40 @@ static void gauge_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8)},
- [ADC_BATT_ID] = {"BATT_ID", 3300, 4096, 0, STM32_AIN(7)},
- [ADC_POGO_ADC_INT_L] = {"POGO_ADC_INT_L", 3300, 4096, 0, STM32_AIN(6)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(10) },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8) },
+ [ADC_BATT_ID] = { "BATT_ID", 3300, 4096, 0, STM32_AIN(7) },
+ [ADC_POGO_ADC_INT_L] = { "POGO_ADC_INT_L", 3300, 4096, 0,
+ STM32_AIN(6) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = 0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "other",
- .port = 1,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
+ { .name = "typec",
+ .port = 0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "other",
+ .port = 1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
@@ -118,8 +114,7 @@ struct mt6370_thermal_bound thermal_bound = {
.err = 4,
};
-static void board_hpd_update(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_update(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -146,13 +141,16 @@ __override const struct rt946x_init_setting *board_rt946x_init_setting(void)
return &battery_init_setting;
}
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_update,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_update,
+ },
},
};
@@ -244,9 +242,8 @@ int extpower_is_present(void)
if (board_vbus_source_enabled(CHARGE_PORT_USB_C))
usb_c_extpower_present = 0;
else
- usb_c_extpower_present = tcpm_check_vbus_level(
- CHARGE_PORT_USB_C,
- VBUS_PRESENT);
+ usb_c_extpower_present =
+ tcpm_check_vbus_level(CHARGE_PORT_USB_C, VBUS_PRESENT);
if (prev_usb_c_extpower_present != usb_c_extpower_present) {
if (usb_c_extpower_present)
@@ -332,11 +329,9 @@ static struct mutex g_lid_mutex;
static struct icm_drv_data_t g_icm426xx_data;
/* Matrix to rotate accelerometer into standard reference frame */
-static const mat33_fp_t lid_standard_ref = {
- {0, FLOAT_TO_FP(1), 0},
- {FLOAT_TO_FP(-1), 0, 0},
- {0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
/*
@@ -436,9 +431,8 @@ __override int board_charge_port_is_connected(int port)
return gpio_get_level(GPIO_POGO_VBUS_PRESENT);
}
-__override
-void board_fill_source_power_info(int port,
- struct ec_response_usb_pd_power_info *r)
+__override void
+board_fill_source_power_info(int port, struct ec_response_usb_pd_power_info *r)
{
r->meas.voltage_now = 3300;
r->meas.voltage_max = 3300;
@@ -451,13 +445,10 @@ void board_fill_source_power_info(int port,
static void mt6370_reg_fix(void)
{
i2c_update8(chg_chips[CHARGER_SOLO].i2c_port,
- chg_chips[CHARGER_SOLO].i2c_addr_flags,
- RT946X_REG_CHGCTRL1,
+ chg_chips[CHARGER_SOLO].i2c_addr_flags, RT946X_REG_CHGCTRL1,
BIT(3) | BIT(5), MASK_CLR);
i2c_update8(chg_chips[CHARGER_SOLO].i2c_port,
- chg_chips[CHARGER_SOLO].i2c_addr_flags,
- RT946X_REG_CHGCTRL2,
- BIT(5) | BIT(RT946X_SHIFT_BATDET_DIS_DLY),
- MASK_CLR);
+ chg_chips[CHARGER_SOLO].i2c_addr_flags, RT946X_REG_CHGCTRL2,
+ BIT(5) | BIT(RT946X_SHIFT_BATDET_DIS_DLY), MASK_CLR);
}
DECLARE_HOOK(HOOK_INIT, mt6370_reg_fix, HOOK_PRIO_DEFAULT);
diff --git a/board/katsu/board.h b/board/katsu/board.h
index afb5cf28e0..6f53801ffc 100644
--- a/board/katsu/board.h
+++ b/board/katsu/board.h
@@ -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.
*/
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_BOARD_H
#define __CROS_EC_BOARD_H
-#define BQ27541_ADDR 0x55
+#define BQ27541_ADDR 0x55
#define VARIANT_KUKUI_BATTERY_BQ27541
#define VARIANT_KUKUI_POGO_KEYBOARD
@@ -27,11 +27,10 @@
#define CONFIG_USB_MUX_RUNTIME_CONFIG
/* Battery */
-#define BATTERY_DESIRED_CHARGING_CURRENT 3500 /* mA */
+#define BATTERY_DESIRED_CHARGING_CURRENT 3500 /* mA */
#define CONFIG_CHARGER_MT6370_BACKLIGHT
-
/* Motion Sensors */
#ifdef SECTION_IS_RW
#define CONFIG_ACCELGYRO_ICM426XX
@@ -41,18 +40,17 @@
/* Camera VSYNC */
#define CONFIG_SYNC
#define CONFIG_SYNC_COMMAND
-#define CONFIG_SYNC_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
+#define CONFIG_SYNC_INT_EVENT TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
#endif /* SECTION_IS_RW */
/* I2C ports */
-#define I2C_PORT_CHARGER 0
-#define I2C_PORT_TCPC0 0
-#define I2C_PORT_USB_MUX 0
-#define I2C_PORT_BATTERY 1
+#define I2C_PORT_CHARGER 0
+#define I2C_PORT_TCPC0 0
+#define I2C_PORT_USB_MUX 0
+#define I2C_PORT_BATTERY 1
#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
-#define I2C_PORT_ACCEL 1
-#define I2C_PORT_BC12 1
+#define I2C_PORT_ACCEL 1
+#define I2C_PORT_BC12 1
/* Route sbs host requests to virtual battery driver */
#define VIRTUAL_BATTERY_ADDR_FLAGS 0x0B
@@ -63,12 +61,12 @@
#define CONFIG_MKBP_EVENT_WAKEUP_MASK \
(BIT(EC_MKBP_EVENT_SENSOR_FIFO) | BIT(EC_MKBP_EVENT_HOST_EVENT))
#undef CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK
-#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
- (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) |\
- 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_MODE_CHANGE))
+#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) | \
+ 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_MODE_CHANGE))
#define PD_OPERATING_POWER_MW 15000
diff --git a/board/katsu/build.mk b/board/katsu/build.mk
index 7a3953b8bb..52ee1b3354 100644
--- a/board/katsu/build.mk
+++ b/board/katsu/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# 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.
#
diff --git a/board/katsu/ec.tasklist b/board/katsu/ec.tasklist
index fc26f445b2..8be28c373d 100644
--- a/board/katsu/ec.tasklist
+++ b/board/katsu/ec.tasklist
@@ -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.
*/
diff --git a/board/katsu/gpio.inc b/board/katsu/gpio.inc
index f938153045..82f7ddb3af 100644
--- a/board/katsu/gpio.inc
+++ b/board/katsu/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * 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.
*/
diff --git a/board/katsu/led.c b/board/katsu/led.c
index c72f5e4cdb..3ce9466613 100644
--- a/board/katsu/led.c
+++ b/board/katsu/led.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.
*
@@ -16,13 +16,13 @@ const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
-#define LED_OFF MT6370_LED_ID_OFF
-#define LED_AMBER MT6370_LED_ID1
-#define LED_WHITE MT6370_LED_ID2
+#define LED_OFF MT6370_LED_ID_OFF
+#define LED_AMBER MT6370_LED_ID1
+#define LED_WHITE MT6370_LED_ID2
-#define LED_MASK_OFF 0
-#define LED_MASK_AMBER MT6370_MASK_RGB_ISNK1DIM_EN
-#define LED_MASK_WHITE MT6370_MASK_RGB_ISNK2DIM_EN
+#define LED_MASK_OFF 0
+#define LED_MASK_AMBER MT6370_MASK_RGB_ISNK1DIM_EN
+#define LED_MASK_WHITE MT6370_MASK_RGB_ISNK2DIM_EN
static void katsu_led_set_battery(void)
{