summaryrefslogtreecommitdiff
path: root/board/asurada
diff options
context:
space:
mode:
Diffstat (limited to 'board/asurada')
-rw-r--r--board/asurada/battery.c2
-rw-r--r--board/asurada/board.c72
-rw-r--r--board/asurada/board.h18
-rw-r--r--board/asurada/build.mk2
-rw-r--r--board/asurada/ec.tasklist2
-rw-r--r--board/asurada/gpio.inc2
-rw-r--r--board/asurada/led.c21
-rw-r--r--board/asurada/led_hayato.c63
-rw-r--r--board/asurada/usbc_config.c17
9 files changed, 95 insertions, 104 deletions
diff --git a/board/asurada/battery.c b/board/asurada/battery.c
index 6237a5058c..ad49477366 100644
--- a/board/asurada/battery.c
+++ b/board/asurada/battery.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.
*/
diff --git a/board/asurada/board.c b/board/asurada/board.c
index 83c95722ef..4e4aede76d 100644
--- a/board/asurada/board.c
+++ b/board/asurada/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.
*/
@@ -66,17 +66,15 @@ static enum base_accelgyro_type base_accelgyro_config;
/* Matrix to rotate accelerometer into standard reference frame */
/* for rev 0 */
static const mat33_fp_t base_standard_ref_rev0 = {
- {FLOAT_TO_FP(-1), 0, 0},
- {0, FLOAT_TO_FP(1), 0},
- {0, 0, FLOAT_TO_FP(-1)},
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) },
};
static void update_rotation_matrix(void)
{
- motion_sensors[BASE_ACCEL].rot_standard_ref =
- &base_standard_ref_rev0;
- motion_sensors[BASE_GYRO].rot_standard_ref =
- &base_standard_ref_rev0;
+ motion_sensors[BASE_ACCEL].rot_standard_ref = &base_standard_ref_rev0;
+ motion_sensors[BASE_GYRO].rot_standard_ref = &base_standard_ref_rev0;
}
DECLARE_HOOK(HOOK_INIT, update_rotation_matrix, HOOK_PRIO_INIT_ADC + 2);
@@ -138,9 +136,9 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
/* Matrix to rotate accelerometer into standard reference frame */
/* for Hayato */
static const mat33_fp_t base_standard_ref = {
- {0, FLOAT_TO_FP(1), 0},
- {FLOAT_TO_FP(-1), 0 , 0},
- {0, 0, FLOAT_TO_FP(1)},
+ { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) },
};
static void update_rotation_matrix(void)
@@ -151,8 +149,7 @@ static void update_rotation_matrix(void)
if (board_get_version() >= 2) {
motion_sensors[BASE_ACCEL].rot_standard_ref =
&base_standard_ref;
- motion_sensors[BASE_GYRO].rot_standard_ref =
- &base_standard_ref;
+ motion_sensors[BASE_GYRO].rot_standard_ref = &base_standard_ref;
}
}
DECLARE_HOOK(HOOK_INIT, update_rotation_matrix, HOOK_PRIO_INIT_ADC + 2);
@@ -340,28 +337,27 @@ static void board_detect_motionsense(void)
if (val == ICM426XX_CHIP_ICM40608) {
motion_sensors[BASE_ACCEL] = icm426xx_base_accel;
motion_sensors[BASE_GYRO] = icm426xx_base_gyro;
- base_accelgyro_config = BASE_GYRO_ICM426XX;
+ base_accelgyro_config = BASE_GYRO_ICM426XX;
ccprints("Base Accelgyro: ICM426XX");
} else {
base_accelgyro_config = BASE_GYRO_BMI160;
ccprints("Base Accelgyro: BMI160");
}
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_detect_motionsense,
- HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_detect_motionsense, HOOK_PRIO_DEFAULT);
DECLARE_HOOK(HOOK_INIT, board_detect_motionsense, HOOK_PRIO_DEFAULT);
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
/* Convert to mV (3000mV/1024). */
- {"VBUS_C0", ADC_MAX_MVOLT * 10, ADC_READ_MAX + 1, 0, CHIP_ADC_CH0},
- {"BOARD_ID_0", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH1},
- {"BOARD_ID_1", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH2},
+ { "VBUS_C0", ADC_MAX_MVOLT * 10, ADC_READ_MAX + 1, 0, CHIP_ADC_CH0 },
+ { "BOARD_ID_0", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH1 },
+ { "BOARD_ID_1", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH2 },
/* AMON/BMON gain = 17.97 */
- {"CHARGER_AMON_R", ADC_MAX_MVOLT * 1000 / 17.97, ADC_READ_MAX + 1, 0,
- CHIP_ADC_CH3},
- {"VBUS_C1", ADC_MAX_MVOLT * 10, ADC_READ_MAX + 1, 0, CHIP_ADC_CH5},
- {"CHARGER_PMON", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH6},
+ { "CHARGER_AMON_R", ADC_MAX_MVOLT * 1000 / 17.97, ADC_READ_MAX + 1, 0,
+ CHIP_ADC_CH3 },
+ { "VBUS_C1", ADC_MAX_MVOLT * 10, ADC_READ_MAX + 1, 0, CHIP_ADC_CH5 },
+ { "CHARGER_PMON", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH6 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -374,24 +370,18 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
* number of pwm channel greater than three.
*/
const struct pwm_t pwm_channels[] = {
- [PWM_CH_LED1] = {
- .channel = 0,
- .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW,
- .freq_hz = 324, /* maximum supported frequency */
- .pcfsr_sel = PWM_PRESCALER_C4
- },
- [PWM_CH_LED2] = {
- .channel = 1,
- .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW,
- .freq_hz = 324, /* maximum supported frequency */
- .pcfsr_sel = PWM_PRESCALER_C4
- },
- [PWM_CH_LED3] = {
- .channel = 2,
- .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW,
- .freq_hz = 324, /* maximum supported frequency */
- .pcfsr_sel = PWM_PRESCALER_C4
- },
+ [PWM_CH_LED1] = { .channel = 0,
+ .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW,
+ .freq_hz = 324, /* maximum supported frequency */
+ .pcfsr_sel = PWM_PRESCALER_C4 },
+ [PWM_CH_LED2] = { .channel = 1,
+ .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW,
+ .freq_hz = 324, /* maximum supported frequency */
+ .pcfsr_sel = PWM_PRESCALER_C4 },
+ [PWM_CH_LED3] = { .channel = 2,
+ .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW,
+ .freq_hz = 324, /* maximum supported frequency */
+ .pcfsr_sel = PWM_PRESCALER_C4 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
diff --git a/board/asurada/board.h b/board/asurada/board.h
index 85b10e69b3..6d9a19b884 100644
--- a/board/asurada/board.h
+++ b/board/asurada/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.
*/
@@ -41,7 +41,7 @@
#define PD_MAX_VOLTAGE_MV 20000
#define PD_MAX_POWER_MW 60000
#endif
-#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 */
/* Optional console commands */
@@ -49,7 +49,7 @@
#define CONFIG_CMD_SCRATCHPAD
#define CONFIG_CMD_STACKOVERFLOW
-#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 9000
+#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 9000
/* Sensor */
#define CONFIG_GMR_TABLET_MODE
@@ -118,12 +118,12 @@ enum sensor_id {
};
enum adc_channel {
- ADC_VBUS_C0, /* ADC 0 */
- ADC_BOARD_ID_0, /* ADC 1 */
- ADC_BOARD_ID_1, /* ADC 2 */
- ADC_CHARGER_AMON_R, /* ADC 3 */
- ADC_VBUS_C1, /* ADC 5 */
- ADC_CHARGER_PMON, /* ADC 6 */
+ ADC_VBUS_C0, /* ADC 0 */
+ ADC_BOARD_ID_0, /* ADC 1 */
+ ADC_BOARD_ID_1, /* ADC 2 */
+ ADC_CHARGER_AMON_R, /* ADC 3 */
+ ADC_VBUS_C1, /* ADC 5 */
+ ADC_CHARGER_PMON, /* ADC 6 */
/* Number of ADC channels */
ADC_CH_COUNT,
diff --git a/board/asurada/build.mk b/board/asurada/build.mk
index d6866f8568..72015fba95 100644
--- a/board/asurada/build.mk
+++ b/board/asurada/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/asurada/ec.tasklist b/board/asurada/ec.tasklist
index ff47718bae..c8e234a412 100644
--- a/board/asurada/ec.tasklist
+++ b/board/asurada/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/asurada/gpio.inc b/board/asurada/gpio.inc
index 75d1fbafa5..46700a7749 100644
--- a/board/asurada/gpio.inc
+++ b/board/asurada/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/asurada/led.c b/board/asurada/led.c
index 166ece92e9..ca29f0be45 100644
--- a/board/asurada/led.c
+++ b/board/asurada/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.
*
@@ -15,18 +15,16 @@
#include "stdbool.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_PWM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_PWM, format, ##args)
#define LED_OFF EC_LED_COLOR_COUNT
const enum ec_led_id supported_led_ids[] = {
/* Main LED */
- EC_LED_ID_LEFT_LED,
- EC_LED_ID_RIGHT_LED,
+ EC_LED_ID_LEFT_LED, EC_LED_ID_RIGHT_LED,
/* Not used, give them some random name for testing */
- EC_LED_ID_POWER_LED,
- EC_LED_ID_BATTERY_LED
+ EC_LED_ID_POWER_LED, EC_LED_ID_BATTERY_LED
};
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -85,8 +83,7 @@ static void led_set_color_battery(enum ec_led_colors color, int duty)
}
static enum ec_error_list set_color(enum ec_led_id led_id,
- enum ec_led_colors color,
- int duty)
+ enum ec_led_colors color, int duty)
{
switch (led_id) {
case EC_LED_ID_LEFT_LED:
@@ -174,13 +171,11 @@ static void update_led(enum ec_led_id led_id, bool is_active_charge_port,
if (chipset_in_state(CHIPSET_STATE_ON))
set_color(led_id, EC_LED_COLOR_WHITE, duty);
else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
- set_color(
- led_id,
- (tick % 8 < 6) ? EC_LED_COLOR_AMBER : LED_OFF,
- duty);
+ set_color(led_id,
+ (tick % 8 < 6) ? EC_LED_COLOR_AMBER : LED_OFF,
+ duty);
else
set_color(led_id, LED_OFF, 0);
-
}
}
diff --git a/board/asurada/led_hayato.c b/board/asurada/led_hayato.c
index 1d3108c47b..be1a352289 100644
--- a/board/asurada/led_hayato.c
+++ b/board/asurada/led_hayato.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,31 +14,40 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 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, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * 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,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
@@ -78,12 +87,12 @@ void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
{
if (led_id == EC_LED_ID_BATTERY_LED) {
brightness_range[EC_LED_COLOR_AMBER] =
- MT6360_LED_BRIGHTNESS_MAX;
+ MT6360_LED_BRIGHTNESS_MAX;
brightness_range[EC_LED_COLOR_WHITE] =
- MT6360_LED_BRIGHTNESS_MAX;
+ MT6360_LED_BRIGHTNESS_MAX;
} else if (led_id == EC_LED_ID_POWER_LED) {
brightness_range[EC_LED_COLOR_WHITE] =
- MT6360_LED_BRIGHTNESS_MAX;
+ MT6360_LED_BRIGHTNESS_MAX;
}
}
diff --git a/board/asurada/usbc_config.c b/board/asurada/usbc_config.c
index 63552980c3..ba6461b0f8 100644
--- a/board/asurada/usbc_config.c
+++ b/board/asurada/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.
*/
@@ -17,16 +17,13 @@ __override int syv682x_board_is_syv682c(int port)
void board_usb_mux_init(void)
{
if (board_get_sub_board() == SUB_BOARD_TYPEC) {
- ps8743_tune_usb_eq(&usb_muxes[1],
- PS8743_USB_EQ_TX_12_8_DB,
+ ps8743_tune_usb_eq(usb_muxes[1].mux, PS8743_USB_EQ_TX_12_8_DB,
PS8743_USB_EQ_RX_12_8_DB);
- ps8743_write(&usb_muxes[1],
- PS8743_REG_HS_DET_THRESHOLD,
- PS8743_USB_HS_THRESH_NEG_10);
- ps8743_field_update(&usb_muxes[1],
- PS8743_REG_DCI_CONFIG_2,
- PS8743_AUTO_DCI_MODE_MASK,
- PS8743_AUTO_DCI_MODE_FORCE_USB);
+ ps8743_write(usb_muxes[1].mux, PS8743_REG_HS_DET_THRESHOLD,
+ PS8743_USB_HS_THRESH_NEG_10);
+ ps8743_field_update(usb_muxes[1].mux, PS8743_REG_DCI_CONFIG_2,
+ PS8743_AUTO_DCI_MODE_MASK,
+ PS8743_AUTO_DCI_MODE_FORCE_USB);
}
}
DECLARE_HOOK(HOOK_INIT, board_usb_mux_init, HOOK_PRIO_INIT_I2C + 1);