summaryrefslogtreecommitdiff
path: root/board/garg
diff options
context:
space:
mode:
Diffstat (limited to 'board/garg')
-rw-r--r--board/garg/battery.c2
-rw-r--r--board/garg/board.c123
-rw-r--r--board/garg/board.h34
-rw-r--r--board/garg/build.mk2
-rw-r--r--board/garg/ec.tasklist2
-rw-r--r--board/garg/gpio.inc2
-rw-r--r--board/garg/led.c36
7 files changed, 96 insertions, 105 deletions
diff --git a/board/garg/battery.c b/board/garg/battery.c
index ac65572d09..5706344191 100644
--- a/board/garg/battery.c
+++ b/board/garg/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/garg/board.c b/board/garg/board.c
index de55f33c6a..60365a6312 100644
--- a/board/garg/board.c
+++ b/board/garg/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.
*/
@@ -44,11 +44,11 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define USB_PD_PORT_ANX7447 0
-#define USB_PD_PORT_PS8751 1
+#define USB_PD_PORT_ANX7447 0
+#define USB_PD_PORT_PS8751 1
static uint8_t sku_id;
@@ -58,17 +58,16 @@ static uint8_t sku_id;
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {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}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 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 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
static void ppc_interrupt(enum gpio_signal signal)
{
@@ -91,31 +90,31 @@ static void ppc_interrupt(enum gpio_signal signal)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_AMB] = {
- "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_CHARGER] = {
- "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_AMB] = { "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_CHARGER] = { "TEMP_CHARGER", NPCX_ADC_CH1,
+ ADC_MAX_VOLT, ADC_READ_MAX + 1, 0 },
/* Vbus sensing (1/10 voltage divider). */
- [ADC_VBUS_C0] = {
- "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
- [ADC_VBUS_C1] = {
- "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_VBUS_C0] = { "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_VBUS_C1] = { "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_BATTERY] = {.name = "Battery",
- .type = TEMP_SENSOR_TYPE_BATTERY,
- .read = charge_get_battery_temp,
- .idx = 0},
- [TEMP_SENSOR_AMBIENT] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_AMB},
- [TEMP_SENSOR_CHARGER] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_13k7_47k_4050b,
- .idx = ADC_TEMP_SENSOR_CHARGER},
+ [TEMP_SENSOR_BATTERY] = { .name = "Battery",
+ .type = TEMP_SENSOR_TYPE_BATTERY,
+ .read = charge_get_battery_temp,
+ .idx = 0 },
+ [TEMP_SENSOR_AMBIENT] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_AMB },
+ [TEMP_SENSOR_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_13k7_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -125,24 +124,17 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-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)}
-};
-
-const mat33_fp_t base_icm_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+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) } };
-static const mat33_fp_t base_bmi260_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_icm_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_bmi260_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* sensor private data */
static struct kionix_accel_data g_kx022_data;
@@ -256,20 +248,20 @@ struct motion_sensor_t icm426xx_base_accel = {
};
struct motion_sensor_t icm426xx_base_gyro = {
- .name = "Base Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_ICM426XX,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &icm426xx_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_icm426xx_data,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = &base_icm_ref,
- .min_frequency = ICM426XX_GYRO_MIN_FREQ,
- .max_frequency = ICM426XX_GYRO_MAX_FREQ,
+ .name = "Base Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_ICM426XX,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &icm426xx_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_icm426xx_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = &base_icm_ref,
+ .min_frequency = ICM426XX_GYRO_MIN_FREQ,
+ .max_frequency = ICM426XX_GYRO_MAX_FREQ,
};
struct motion_sensor_t bmi260_base_accel = {
@@ -318,7 +310,6 @@ struct motion_sensor_t bmi260_base_gyro = {
.max_frequency = BMI_GYRO_MAX_FREQ,
};
-
static int board_is_convertible(void)
{
/*
@@ -389,8 +380,8 @@ void board_hibernate_late(void)
const uint32_t hibernate_pins[][2] = {
/* Turn off LEDs before going to hibernate */
- {GPIO_BAT_LED_BLUE_L, GPIO_INPUT | GPIO_PULL_UP},
- {GPIO_BAT_LED_ORANGE_L, GPIO_INPUT | GPIO_PULL_UP},
+ { GPIO_BAT_LED_BLUE_L, GPIO_INPUT | GPIO_PULL_UP },
+ { GPIO_BAT_LED_ORANGE_L, GPIO_INPUT | GPIO_PULL_UP },
};
for (i = 0; i < ARRAY_SIZE(hibernate_pins); ++i)
diff --git a/board/garg/board.h b/board/garg/board.h
index 638c8c93a0..23f44b469e 100644
--- a/board/garg/board.h
+++ b/board/garg/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.
*/
@@ -10,6 +10,7 @@
/* Free up flash space */
#define CONFIG_LTO
+#undef CONFIG_CMD_BATTFAKE
/* Select Baseboard features */
#define VARIANT_OCTOPUS_EC_NPCX796FB
@@ -19,16 +20,16 @@
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
/* I2C bus configuraiton */
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
#define CONFIG_LED_COMMON
/* Sensors */
-#define CONFIG_ACCEL_KX022 /* Lid accel */
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
-#define CONFIG_ACCELGYRO_BMI260 /* 3rd Base accel */
-#define CONFIG_ACCELGYRO_ICM426XX /* 2nd Base accel */
-#define CONFIG_SYNC /* Camera VSYNC */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+#define CONFIG_ACCELGYRO_BMI260 /* 3rd Base accel */
+#define CONFIG_ACCELGYRO_ICM426XX /* 2nd Base accel */
+#define CONFIG_SYNC /* Camera VSYNC */
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
/* Sensors without hardware FIFO are in forced mode */
@@ -42,8 +43,7 @@
#define CONFIG_ACCELGYRO_ICM426XX_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-#define CONFIG_SYNC_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
+#define CONFIG_SYNC_INT_EVENT TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
@@ -68,10 +68,10 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_AMB, /* ADC0 */
- ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
- ADC_VBUS_C0, /* ADC9 */
- ADC_VBUS_C1, /* ADC4 */
+ ADC_TEMP_SENSOR_AMB, /* ADC0 */
+ ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
+ ADC_VBUS_C0, /* ADC9 */
+ ADC_VBUS_C1, /* ADC4 */
ADC_CH_COUNT
};
@@ -83,13 +83,7 @@ enum temp_sensor_id {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- VSYNC,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, VSYNC, SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/garg/build.mk b/board/garg/build.mk
index 137e208b53..fee77e38b5 100644
--- a/board/garg/build.mk
+++ b/board/garg/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/garg/ec.tasklist b/board/garg/ec.tasklist
index 6eac78a042..6c56976091 100644
--- a/board/garg/ec.tasklist
+++ b/board/garg/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/garg/gpio.inc b/board/garg/gpio.inc
index 995986d600..57feead408 100644
--- a/board/garg/gpio.inc
+++ b/board/garg/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.
*/
diff --git a/board/garg/led.c b/board/garg/led.c
index bc77efe9b9..eff8c1307b 100644
--- a/board/garg/led.c
+++ b/board/garg/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.
*
@@ -10,8 +10,8 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
@@ -19,18 +19,24 @@ __override const int led_charge_lvl_2 = 100;
/* Garg: Note there is only LED for charge / power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [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_BLUE, 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_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [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_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };