summaryrefslogtreecommitdiff
path: root/board/dratini
diff options
context:
space:
mode:
Diffstat (limited to 'board/dratini')
-rw-r--r--board/dratini/battery.c2
-rw-r--r--board/dratini/board.c119
-rw-r--r--board/dratini/board.h38
-rw-r--r--board/dratini/build.mk2
-rw-r--r--board/dratini/ec.tasklist2
-rw-r--r--board/dratini/gpio.inc6
-rw-r--r--board/dratini/led.c59
7 files changed, 112 insertions, 116 deletions
diff --git a/board/dratini/battery.c b/board/dratini/battery.c
index 77c84cd973..5cb57e4ba5 100644
--- a/board/dratini/battery.c
+++ b/board/dratini/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 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/dratini/board.c b/board/dratini/board.c
index 61634d3a7b..84759b74b6 100644
--- a/board/dratini/board.c
+++ b/board/dratini/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -43,8 +43,8 @@
#include "usbc_ppc.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 check_reboot_deferred(void);
DECLARE_DEFERRED(check_reboot_deferred);
@@ -128,16 +128,16 @@ static void bc12_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* 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);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 100 },
- [PWM_CH_FAN] = {.channel = 5, .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
+ [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 100 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -163,16 +163,20 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-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_PD_PORT_TCPC_0] = {
- .usb_port = USB_PD_PORT_TCPC_0,
- .driver = &anx7447_usb_mux_driver,
- .hpd_update = &anx7447_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_0,
+ .driver = &anx7447_usb_mux_driver,
+ .hpd_update = &anx7447_tcpc_update_hpd_status,
+ },
},
[USB_PD_PORT_TCPC_1] = {
- .usb_port = USB_PD_PORT_TCPC_1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -201,17 +205,13 @@ static struct bmi_drv_data_t g_bmi160_data;
static struct accelgyro_saved_data_t g_bma255_data;
/* Matrix to rotate accelrator into standard reference frame */
-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) } };
-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) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -291,7 +291,7 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -310,44 +310,43 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_1] = {
- "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_2] = {
- "TEMP_5V_REG", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_3] = {
- "TEMP_CPU", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_1] = { "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_2] = { "TEMP_5V_REG", NPCX_ADC_CH1, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_3] = { "TEMP_CPU", NPCX_ADC_CH2, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "5V Reg",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "CPU",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
+ [TEMP_SENSOR_1] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "5V Reg",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "CPU",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-
/* Dratini Temperature sensors */
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(73), \
@@ -366,8 +365,8 @@ __maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_B \
- { \
+#define THERMAL_B \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(68), \
@@ -404,8 +403,8 @@ bool board_is_convertible(void)
* Dratini is not.
* Unprovisioned SKU 255.
*/
- return sku_id == 21 || sku_id == 22 || sku_id == 23 ||
- sku_id == 24 || sku_id == 255;
+ return sku_id == 21 || sku_id == 22 || sku_id == 23 || sku_id == 24 ||
+ sku_id == 255;
}
static void board_update_sensor_config_from_sku(void)
@@ -485,7 +484,7 @@ bool board_has_kb_backlight(void)
* Unprovisioned: 255
*/
return sku_id == 2 || sku_id == 3 || sku_id == 5 || sku_id == 8 ||
- sku_id == 22 || sku_id == 24 || sku_id == 255;
+ sku_id == 22 || sku_id == 24 || sku_id == 255;
}
__override uint32_t board_override_feature_flags0(uint32_t flags0)
@@ -503,15 +502,15 @@ __override uint32_t board_override_feature_flags0(uint32_t flags0)
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {1, 4}, {1, 3}, {1, 6}, {1, 7},
- {3, 1}, {2, 0}, {1, 5}, {2, 6}, {2, 7},
- {2, 1}, {2, 4}, {2, 5}, {1, 2}, {2, 3},
- {2, 2}, {3, 0}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 },
+ { 0, 7 }, { 1, 4 }, { 1, 3 }, { 1, 6 }, { 1, 7 },
+ { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 },
+ { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
/* Disable HDMI power while AP is suspended / off */
@@ -540,7 +539,7 @@ __override void board_chipset_forced_shutdown(void)
hook_call_deferred(&check_reboot_deferred_data, -1);
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_forced_shutdown,
- HOOK_PRIO_DEFAULT);
+ HOOK_PRIO_DEFAULT);
static void check_reboot_deferred(void)
{
diff --git a/board/dratini/board.h b/board/dratini/board.h
index 82c09494f5..9bb4347158 100644
--- a/board/dratini/board.h
+++ b/board/dratini/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,10 +30,10 @@
* Dratini's battery takes several seconds to come back out of its disconnect
* state (~4 seconds, but give it 6 for margin).
*/
-#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT
+#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT
#define CONFIG_POWER_BUTTON_INIT_TIMEOUT 6
-#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 5000
+#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 5000
/* Sensors */
/* BMI160 Base accel/gyro */
@@ -112,16 +112,16 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
#ifndef __ASSEMBLER__
@@ -129,9 +129,9 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_TEMP_SENSOR_3, /* ADC2 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_TEMP_SENSOR_3, /* ADC2 */
ADC_CH_COUNT
};
@@ -142,11 +142,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_FAN,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_FAN, PWM_CH_COUNT };
enum fan_channel {
FAN_CH_0 = 0,
diff --git a/board/dratini/build.mk b/board/dratini/build.mk
index 733912454f..13153c1526 100644
--- a/board/dratini/build.mk
+++ b/board/dratini/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 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/dratini/ec.tasklist b/board/dratini/ec.tasklist
index 4a1024a091..829be2b7c8 100644
--- a/board/dratini/ec.tasklist
+++ b/board/dratini/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 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/dratini/gpio.inc b/board/dratini/gpio.inc
index c242919a89..b8649ca3b1 100644
--- a/board/dratini/gpio.inc
+++ b/board/dratini/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -17,10 +17,10 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_EC_RSMRST_L, PIN(E, 2), GPIO_INT_BOTH, intel_x86_rsmrst_signal_interrupt)
diff --git a/board/dratini/led.c b/board/dratini/led.c
index a5a8e9e158..029ae11da8 100644
--- a/board/dratini/led.c
+++ b/board/dratini/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -24,11 +24,9 @@
#define LED_TICKS_PER_CYCLE 10
#define LED_ON_TICKS 5
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_LEFT_LED,
- EC_LED_ID_RIGHT_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_LEFT_LED,
+ EC_LED_ID_RIGHT_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -36,7 +34,7 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void led_set_color_battery(int port, enum led_color color)
@@ -147,7 +145,6 @@ static void led_set_battery(void)
{
static int battery_ticks;
static int power_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -158,15 +155,14 @@ static void led_set_battery(void)
*/
if (!board_is_convertible()) {
if (chipset_in_state(CHIPSET_STATE_SUSPEND |
- CHIPSET_STATE_STANDBY) &&
- charge_get_state() != PWR_STATE_CHARGE) {
-
+ CHIPSET_STATE_STANDBY) &&
+ charge_get_state() != PWR_STATE_CHARGE) {
power_ticks++;
- led_set_color_battery(0, power_ticks & 0x4 ?
- LED_WHITE : LED_OFF);
- led_set_color_battery(1, power_ticks & 0x4 ?
- LED_WHITE : LED_OFF);
+ led_set_color_battery(0, power_ticks & 0x4 ? LED_WHITE :
+ LED_OFF);
+ led_set_color_battery(1, power_ticks & 0x4 ? LED_WHITE :
+ LED_OFF);
return;
}
}
@@ -181,9 +177,12 @@ static void led_set_battery(void)
case PWR_STATE_DISCHARGE:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
if (charge_get_percent() < 10)
- led_set_color_battery(0, (battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_WHITE : LED_OFF);
+ led_set_color_battery(
+ 0,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
else
led_set_color_battery(0, LED_OFF);
}
@@ -192,19 +191,20 @@ static void led_set_battery(void)
led_set_color_battery(1, LED_OFF);
break;
case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x2) ?
- LED_WHITE : LED_OFF);
+ set_active_port_color((battery_ticks & 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color(
+ (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
@@ -222,9 +222,10 @@ static void led_set_power(void)
led_set_color_power(LED_WHITE);
else if (chipset_in_state(CHIPSET_STATE_SUSPEND |
CHIPSET_STATE_STANDBY))
- led_set_color_power((power_tick %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_WHITE : LED_OFF);
+ led_set_color_power(
+ (power_tick % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
else
led_set_color_power(LED_OFF);
}