summaryrefslogtreecommitdiff
path: root/board/kukui
diff options
context:
space:
mode:
Diffstat (limited to 'board/kukui')
-rw-r--r--board/kukui/board.c109
-rw-r--r--board/kukui/board.h23
-rw-r--r--board/kukui/build.mk2
-rw-r--r--board/kukui/ec.tasklist2
-rw-r--r--board/kukui/gpio.inc2
-rw-r--r--board/kukui/led.c24
6 files changed, 75 insertions, 87 deletions
diff --git a/board/kukui/board.c b/board/kukui/board.c
index a3468b62ca..6fafc949e1 100644
--- a/board/kukui/board.c
+++ b/board/kukui/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,6 +27,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"
@@ -43,8 +44,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)
{
@@ -65,30 +66,27 @@ static void motion_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);
@@ -96,15 +94,14 @@ 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);
/******************************************************************************/
@@ -134,8 +131,7 @@ void board_set_dp_mux_control(int output_enable, int polarity)
gpio_set_level(GPIO_USB_C0_DP_POLARITY, polarity);
}
-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 */
@@ -162,13 +158,17 @@ __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 usbc0_mux0 = {
+ .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,
+};
+
+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 = &usbc0_mux0,
},
};
@@ -266,9 +266,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);
return usb_c_extpower_present || kukui_pogo_extpower_present();
}
@@ -357,15 +356,15 @@ static void board_rev_init(void)
/* configure PI3USB9201 to USB Path ON Mode */
i2c_write8(I2C_PORT_BC12, BC12_I2C_ADDR_FLAGS,
PI3USB9201_REG_CTRL_1,
- (PI3USB9201_USB_PATH_ON <<
- PI3USB9201_REG_CTRL_1_MODE_SHIFT));
+ (PI3USB9201_USB_PATH_ON
+ << PI3USB9201_REG_CTRL_1_MODE_SHIFT));
}
if (board_get_version() < 5) {
gpio_set_flags(GPIO_USB_C0_DP_OE_L, GPIO_OUT_HIGH);
gpio_set_flags(GPIO_USB_C0_DP_POLARITY, GPIO_OUT_LOW);
- usb_muxes[0].driver = &virtual_usb_mux_driver;
- usb_muxes[0].hpd_update = &virtual_hpd_update;
+ usbc0_mux0.driver = &virtual_usb_mux_driver;
+ usbc0_mux0.hpd_update = &virtual_hpd_update;
}
}
DECLARE_HOOK(HOOK_INIT, board_rev_init, HOOK_PRIO_INIT_ADC + 1);
@@ -438,26 +437,20 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
/* Matrix to rotate accelerometer into standard reference frame */
#ifdef BOARD_KUKUI
-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) } };
#else
-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) } };
#endif /* BOARD_KUKUI */
#ifdef CONFIG_MAG_BMI_BMM150
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t mag_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 mag_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
#endif /* CONFIG_MAG_BMI_BMM150 */
struct motion_sensor_t motion_sensors[] = {
@@ -632,7 +625,6 @@ static void motion_interrupt(enum gpio_signal signal)
#elif !defined(VARIANT_KUKUI_NO_SENSORS)
bmi160_interrupt(signal);
#endif /* BOARD_KRANE, !VARIANT_KUKUI_NO_SENSORS */
-
}
#endif /* SECTION_IS_RW */
@@ -669,9 +661,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;
diff --git a/board/kukui/board.h b/board/kukui/board.h
index 8cedd195e1..94c05a1209 100644
--- a/board/kukui/board.h
+++ b/board/kukui/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -37,9 +37,9 @@
/* Battery */
#ifdef BOARD_KRANE
-#define BATTERY_DESIRED_CHARGING_CURRENT 3500 /* mA */
+#define BATTERY_DESIRED_CHARGING_CURRENT 3500 /* mA */
#else
-#define BATTERY_DESIRED_CHARGING_CURRENT 2000 /* mA */
+#define BATTERY_DESIRED_CHARGING_CURRENT 2000 /* mA */
#endif /* BOARD_KRANE */
#ifdef BOARD_KRANE
@@ -79,19 +79,18 @@
/* 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_ALS 1
+#define I2C_PORT_ACCEL 1
+#define I2C_PORT_BC12 1
+#define I2C_PORT_ALS 1
/* Route sbs host requests to virtual battery driver */
#define VIRTUAL_BATTERY_ADDR_FLAGS 0x0B
diff --git a/board/kukui/build.mk b/board/kukui/build.mk
index 694879cee6..b60b9cf091 100644
--- a/board/kukui/build.mk
+++ b/board/kukui/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 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/kukui/ec.tasklist b/board/kukui/ec.tasklist
index 9ba564ce52..2551038b66 100644
--- a/board/kukui/ec.tasklist
+++ b/board/kukui/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 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/kukui/gpio.inc b/board/kukui/gpio.inc
index eed1fea828..efac70d681 100644
--- a/board/kukui/gpio.inc
+++ b/board/kukui/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 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/kukui/led.c b/board/kukui/led.c
index 59f7681754..9cfdf855be 100644
--- a/board/kukui/led.c
+++ b/board/kukui/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -17,15 +17,15 @@ const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
static enum charge_state prv_chstate = PWR_STATE_INIT;
-#define LED_OFF MT6370_LED_ID_OFF
-#define LED_RED MT6370_LED_ID1
-#define LED_GREEN MT6370_LED_ID2
-#define LED_BLUE MT6370_LED_ID3
+#define LED_OFF MT6370_LED_ID_OFF
+#define LED_RED MT6370_LED_ID1
+#define LED_GREEN MT6370_LED_ID2
+#define LED_BLUE MT6370_LED_ID3
-#define LED_MASK_OFF 0
-#define LED_MASK_RED MT6370_MASK_RGB_ISNK1DIM_EN
-#define LED_MASK_GREEN MT6370_MASK_RGB_ISNK2DIM_EN
-#define LED_MASK_BLUE MT6370_MASK_RGB_ISNK3DIM_EN
+#define LED_MASK_OFF 0
+#define LED_MASK_RED MT6370_MASK_RGB_ISNK1DIM_EN
+#define LED_MASK_GREEN MT6370_MASK_RGB_ISNK2DIM_EN
+#define LED_MASK_BLUE MT6370_MASK_RGB_ISNK3DIM_EN
static void kukui_led_set_battery(void)
{
@@ -35,8 +35,7 @@ static void kukui_led_set_battery(void)
chstate = charge_get_state();
- if (prv_chstate == chstate &&
- chstate != PWR_STATE_DISCHARGE)
+ if (prv_chstate == chstate && chstate != PWR_STATE_DISCHARGE)
return;
prv_chstate = chstate;
@@ -62,8 +61,7 @@ static void kukui_led_set_battery(void)
return;
}
- if (prv_r == br[EC_LED_COLOR_RED] &&
- prv_g == br[EC_LED_COLOR_GREEN] &&
+ if (prv_r == br[EC_LED_COLOR_RED] && prv_g == br[EC_LED_COLOR_GREEN] &&
prv_b == br[EC_LED_COLOR_BLUE])
return;