diff options
Diffstat (limited to 'board/ampton')
-rw-r--r-- | board/ampton/battery.c | 2 | ||||
-rw-r--r-- | board/ampton/board.c | 123 | ||||
-rw-r--r-- | board/ampton/board.h | 25 | ||||
-rw-r--r-- | board/ampton/build.mk | 2 | ||||
-rw-r--r-- | board/ampton/ec.tasklist | 2 | ||||
-rw-r--r-- | board/ampton/gpio.inc | 2 | ||||
-rw-r--r-- | board/ampton/led.c | 40 |
7 files changed, 93 insertions, 103 deletions
diff --git a/board/ampton/battery.c b/board/ampton/battery.c index f52f0d5d7a..18bf4e591a 100644 --- a/board/ampton/battery.c +++ b/board/ampton/battery.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. * diff --git a/board/ampton/board.c b/board/ampton/board.c index 3e7bee1993..f1346a6b07 100644 --- a/board/ampton/board.c +++ b/board/ampton/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. */ @@ -65,8 +65,8 @@ int ppc_get_alert_status(int port) /******************************************************************************/ /* USB-C MUX Configuration */ -#define USB_PD_PORT_ITE_0 0 -#define USB_PD_PORT_ITE_1 1 +#define USB_PD_PORT_ITE_0 0 +#define USB_PD_PORT_ITE_1 1 static int tune_mux(const struct usb_mux *me); @@ -101,8 +101,8 @@ static int tune_mux(const struct usb_mux *me) /* Auto EQ disabled, compensate for channel lost up to 3.6dB */ RETURN_ERROR(mux_write(me, PS8XXX_REG_MUX_DP_EQ_CONFIGURATION, 0x98)); /* DP output swing adjustment +15% */ - RETURN_ERROR(mux_write(me, PS8XXX_REG_MUX_DP_OUTPUT_CONFIGURATION, - 0xc0)); + RETURN_ERROR( + mux_write(me, PS8XXX_REG_MUX_DP_OUTPUT_CONFIGURATION, 0xc0)); return EC_SUCCESS; } @@ -110,44 +110,44 @@ static int tune_mux(const struct usb_mux *me) /* ADC channels */ const struct adc_t adc_channels[] = { /* Vbus C0 sensing (10x voltage divider). PPVAR_USB_C0_VBUS */ - [ADC_VBUS_C0] = {.name = "VBUS_C0", - .factor_mul = 10 * ADC_MAX_MVOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - .channel = CHIP_ADC_CH13}, + [ADC_VBUS_C0] = { .name = "VBUS_C0", + .factor_mul = 10 * ADC_MAX_MVOLT, + .factor_div = ADC_READ_MAX + 1, + .shift = 0, + .channel = CHIP_ADC_CH13 }, /* Vbus C1 sensing (10x voltage divider). SUB_EC_ADC */ - [ADC_VBUS_C1] = {.name = "VBUS_C1", - .factor_mul = 10 * ADC_MAX_MVOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - .channel = CHIP_ADC_CH14}, + [ADC_VBUS_C1] = { .name = "VBUS_C1", + .factor_mul = 10 * ADC_MAX_MVOLT, + .factor_div = ADC_READ_MAX + 1, + .shift = 0, + .channel = CHIP_ADC_CH14 }, /* Convert to raw mV for thermistor table lookup */ - [ADC_TEMP_SENSOR_AMB] = {.name = "TEMP_AMB", - .factor_mul = ADC_MAX_MVOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - .channel = CHIP_ADC_CH3}, + [ADC_TEMP_SENSOR_AMB] = { .name = "TEMP_AMB", + .factor_mul = ADC_MAX_MVOLT, + .factor_div = ADC_READ_MAX + 1, + .shift = 0, + .channel = CHIP_ADC_CH3 }, /* Convert to raw mV for thermistor table lookup */ - [ADC_TEMP_SENSOR_CHARGER] = {.name = "TEMP_CHARGER", - .factor_mul = ADC_MAX_MVOLT, - .factor_div = ADC_READ_MAX + 1, - .shift = 0, - .channel = CHIP_ADC_CH5}, + [ADC_TEMP_SENSOR_CHARGER] = { .name = "TEMP_CHARGER", + .factor_mul = ADC_MAX_MVOLT, + .factor_div = ADC_READ_MAX + 1, + .shift = 0, + .channel = CHIP_ADC_CH5 }, }; 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}, - [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 }, + [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); @@ -156,35 +156,25 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); static struct mutex g_lid_mutex; static struct mutex g_base_mutex; -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)} -}; +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) } }; -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_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 }, + { FLOAT_TO_FP(1), 0, 0 }, + { 0, 0, FLOAT_TO_FP(1) } }; -const mat33_fp_t gyro_standard_ref = { - { 0, FLOAT_TO_FP(-1), 0}, - { FLOAT_TO_FP(1), 0, 0}, - { 0, 0, FLOAT_TO_FP(1)} -}; +const mat33_fp_t gyro_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_standard_ref_icm42607 = { - { 0, FLOAT_TO_FP(1), 0}, - { FLOAT_TO_FP(1), 0, 0}, - { 0, 0, FLOAT_TO_FP(-1)} -}; +const mat33_fp_t base_standard_ref_icm42607 = { { 0, FLOAT_TO_FP(1), 0 }, + { FLOAT_TO_FP(1), 0, 0 }, + { 0, 0, FLOAT_TO_FP(-1) } }; -const mat33_fp_t lid_standard_ref_sku57 = { - { FLOAT_TO_FP(1), 0, 0}, - { 0, FLOAT_TO_FP(-1), 0}, - { 0, 0, FLOAT_TO_FP(-1)} -}; +const mat33_fp_t lid_standard_ref_sku57 = { { FLOAT_TO_FP(1), 0, 0 }, + { 0, FLOAT_TO_FP(-1), 0 }, + { 0, 0, FLOAT_TO_FP(-1) } }; /* sensor private data */ static struct kionix_accel_data g_kx022_data; static struct bmi_drv_data_t g_bmi160_data; @@ -355,9 +345,9 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); static int board_is_convertible(void) { /* SKU IDs of Ampton & unprovisioned: 1, 2, 3, 4, 255 */ - return sku_id == 1 || sku_id == 2 || sku_id == 3 || sku_id == 4 - || sku_id == 57 || sku_id == 255; - } + return sku_id == 1 || sku_id == 2 || sku_id == 3 || sku_id == 4 || + sku_id == 57 || sku_id == 255; +} static int board_with_sensor_bma253(void) { @@ -389,13 +379,12 @@ static void board_update_sensor_config_from_sku(void) if (board_with_sensor_icm42607()) { motion_sensors[BASE_ACCEL] = motion_sensor_accel_icm42607; - motion_sensors[BASE_GYRO] = - motion_sensor_gyro_icm42607; + motion_sensors[BASE_GYRO] = motion_sensor_gyro_icm42607; ccprints("Gyro sensor: ICM-42607"); } if (sku_id == 57) motion_sensors[LID_ACCEL].rot_standard_ref = - &lid_standard_ref_sku57; + &lid_standard_ref_sku57; /* Enable Base Accel interrupt */ gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L); diff --git a/board/ampton/board.h b/board/ampton/board.h index d0a3cf5bc0..4a00f82cd2 100644 --- a/board/ampton/board.h +++ b/board/ampton/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. */ @@ -16,7 +16,7 @@ #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 /* EC console commands */ #define CONFIG_CMD_ACCELS @@ -28,7 +28,7 @@ #define CONFIG_LED_COMMON -#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 5000 +#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 5000 /* Sensors */ #define CONFIG_TEMP_SENSOR @@ -38,11 +38,11 @@ #define CONFIG_TEMP_SENSOR_POWER #define GPIO_TEMP_SENSOR_POWER GPIO_EN_PP3300 -#define CONFIG_ACCEL_BMA255 /* Lid accel */ -#define CONFIG_ACCEL_KX022 /* Lid accel */ -#define CONFIG_ACCELGYRO_BMI160 /* Base accel */ +#define CONFIG_ACCEL_BMA255 /* Lid accel */ +#define CONFIG_ACCEL_KX022 /* Lid accel */ +#define CONFIG_ACCELGYRO_BMI160 /* Base accel */ #define CONFIG_ACCELGYRO_ICM42607 /* Base accel */ -#define CONFIG_SYNC /* Camera VSYNC */ +#define CONFIG_SYNC /* Camera VSYNC */ #define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT /* Sensors without hardware FIFO are in forced mode */ @@ -57,8 +57,7 @@ TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) #define CONFIG_ACCELGYRO_ICM42607_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) /* Keyboard backlight is unimplemented in hardware */ #undef CONFIG_PWM @@ -90,13 +89,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/ampton/build.mk b/board/ampton/build.mk index cc6b73093e..daf4529f19 100644 --- a/board/ampton/build.mk +++ b/board/ampton/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/ampton/ec.tasklist b/board/ampton/ec.tasklist index 2703dd0b5c..466dd4c60f 100644 --- a/board/ampton/ec.tasklist +++ b/board/ampton/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/ampton/gpio.inc b/board/ampton/gpio.inc index 854a28655d..c1d7769668 100644 --- a/board/ampton/gpio.inc +++ b/board/ampton/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/ampton/led.c b/board/ampton/led.c index 40b0acdd9c..02bafec4e0 100644 --- a/board/ampton/led.c +++ b/board/ampton/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. * @@ -10,8 +10,8 @@ #include "led_common.h" #include "led_onoff_states.h" -#define LED_OFF_LVL 0 -#define LED_ON_LVL 1 +#define LED_OFF_LVL 0 +#define LED_ON_LVL 1 __override const int led_charge_lvl_1; @@ -19,19 +19,27 @@ __override const int led_charge_lvl_2 = 94; /* Ampton: 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_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] = {{EC_LED_COLOR_WHITE, 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_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] = { { EC_LED_COLOR_WHITE, + 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_WHITE, + 2 * LED_ONE_SEC }, + { EC_LED_COLOR_AMBER, + 2 * LED_ONE_SEC } }, + }; BUILD_ASSERT(ARRAY_SIZE(led_bat_state_table) == LED_NUM_STATES); const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED }; |