diff options
author | Bernie Thompson <bhthompson@chromium.org> | 2015-10-23 14:18:05 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-10-27 13:19:52 -0700 |
commit | df038776b4a20178ab777354797d597ac1e95d5d (patch) | |
tree | cb90de357c02ea2ae5b03b629bb1c8344008baeb /board/cyan | |
parent | 2bd7dce32eed716b850c370f79717ad47da17c01 (diff) | |
download | chrome-ec-df038776b4a20178ab777354797d597ac1e95d5d.tar.gz |
Remove cyan ec configuration
We no longer need to build cyan on ToT, so we can remove it.
BUG=chrome-os-partner:44576
TEST=None
BRANCH=None
Change-Id: Ifaad4570cb8e1c427e0c341073e4bacd29462974
Signed-off-by: Bernie Thompson <bhthompson@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/309000
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'board/cyan')
l--------- | board/cyan/Makefile | 1 | ||||
-rw-r--r-- | board/cyan/battery.c | 35 | ||||
-rw-r--r-- | board/cyan/board.c | 224 | ||||
-rw-r--r-- | board/cyan/board.h | 113 | ||||
-rw-r--r-- | board/cyan/build.mk | 14 | ||||
-rw-r--r-- | board/cyan/ec.tasklist | 29 | ||||
-rw-r--r-- | board/cyan/gpio.inc | 140 | ||||
-rw-r--r-- | board/cyan/led.c | 216 | ||||
-rw-r--r-- | board/cyan/lfw/gpio.inc | 16 |
9 files changed, 0 insertions, 788 deletions
diff --git a/board/cyan/Makefile b/board/cyan/Makefile deleted file mode 120000 index 94aaae2c4d..0000000000 --- a/board/cyan/Makefile +++ /dev/null @@ -1 +0,0 @@ -../../Makefile
\ No newline at end of file diff --git a/board/cyan/battery.c b/board/cyan/battery.c deleted file mode 100644 index 5c21d1d29b..0000000000 --- a/board/cyan/battery.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2015 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - * - * Battery pack vendor provided charging profile - */ - -#include "battery.h" -#include "battery_smart.h" - -#define SB_SHIP_MODE_ADDR 0x3a -#define SB_SHIP_MODE_DATA 0xc574 - -static const struct battery_info info = { - .voltage_max = 12600,/* mV */ - .voltage_normal = 10800, - .voltage_min = 8250, - .precharge_current = 340,/* mA */ - .start_charging_min_c = 0, - .start_charging_max_c = 50, - .charging_min_c = 0, - .charging_max_c = 60, - .discharging_min_c = 0, - .discharging_max_c = 60, -}; - -const struct battery_info *battery_get_info(void) -{ - return &info; -} - -int board_cut_off_battery(void) -{ - return sb_write(SB_SHIP_MODE_ADDR, SB_SHIP_MODE_DATA); -} diff --git a/board/cyan/board.c b/board/cyan/board.c deleted file mode 100644 index 316cb3671c..0000000000 --- a/board/cyan/board.c +++ /dev/null @@ -1,224 +0,0 @@ -/* Copyright 2015 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* Cyan board-specific configuration */ - -#include "charger.h" -#include "charge_state.h" -#include "driver/accel_kionix.h" -#include "driver/accel_kxcj9.h" -#include "driver/temp_sensor/tmp432.h" -#include "extpower.h" -#include "gpio.h" -#include "hooks.h" -#include "host_command.h" -#include "i2c.h" -#include "keyboard_scan.h" -#include "lid_switch.h" -#include "math_util.h" -#include "motion_lid.h" -#include "motion_sense.h" -#include "power.h" -#include "power_button.h" -#include "registers.h" -#include "spi.h" -#include "switch.h" -#include "task.h" -#include "temp_sensor.h" -#include "temp_sensor_chip.h" -#include "thermal.h" -#include "uart.h" -#include "util.h" - -#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP) -#define GPIO_KB_OUTPUT (GPIO_ODR_HIGH) -#ifdef CONFIG_KEYBOARD_COL2_INVERTED - #define GPIO_KB_OUTPUT_COL2 (GPIO_OUT_LOW) -#else - #define GPIO_KB_OUTPUT_COL2 (GPIO_OUT_HIGH) -#endif - -#include "gpio_list.h" - -/* power signal list. Must match order of enum power_signal. */ -const struct power_signal_info power_signal_list[] = { - {GPIO_ALL_SYS_PGOOD, 1, "ALL_SYS_PWRGD"}, - {GPIO_RSMRST_L_PGOOD, 1, "RSMRST_N_PWRGD"}, - {GPIO_PCH_SLP_S3_L, 1, "SLP_S3#_DEASSERTED"}, - {GPIO_PCH_SLP_S4_L, 1, "SLP_S4#_DEASSERTED"}, -}; -BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT); - -const struct i2c_port_t i2c_ports[] = { - {"batt_chg", MEC1322_I2C0_0, 100, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA}, - {"sensors", MEC1322_I2C1, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA }, - {"soc", MEC1322_I2C2, 100, GPIO_I2C2_SCL, GPIO_I2C2_SDA }, - {"thermal", MEC1322_I2C3, 100, GPIO_I2C3_SCL, GPIO_I2C3_SDA }, -}; -const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); - -/* SPI devices */ -const struct spi_device_t spi_devices[] = { - { CONFIG_SPI_FLASH_PORT, 0, GPIO_PVT_CS0 }, -}; -const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices); - -const enum gpio_signal hibernate_wake_pins[] = { - GPIO_POWER_BUTTON_L, -}; - -const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); - -/* - * Temperature sensors data; must be in same order as enum temp_sensor_id. - * Sensor index and name must match those present in coreboot: - * src/mainboard/google/${board}/acpi/dptf.asl - */ -const struct temp_sensor_t temp_sensors[] = { - {"TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val, - TMP432_IDX_LOCAL, 4}, - {"TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val, - TMP432_IDX_REMOTE1, 4}, - {"TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val, - TMP432_IDX_REMOTE2, 4}, - {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_temp_sensor_get_val, 0, 4}, -}; -BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); - -/* Thermal limits for each temp sensor. All temps are in degrees K. Must be in - * same order as enum temp_sensor_id. To always ignore any temp, use 0. - */ -struct ec_thermal_config thermal_params[] = { - {{0, 0, 0}, 0, 0}, /* TMP432_Internal */ - {{0, 0, 0}, 0, 0}, /* TMP432_Sensor_1 */ - {{0, 0, 0}, 0, 0}, /* TMP432_Sensor_2 */ - {{0, 0, 0}, 0, 0}, /* Battery Sensor */ -}; -BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); - -/* kxcj9 mutex and local/private data*/ -static struct mutex g_kxcj9_mutex[2]; -struct kionix_accel_data g_kxcj9_data[2] = { - {.variant = KXCJ9}, - {.variant = KXCJ9}, -}; - -/* Four Motion sensors */ -/* Matrix to rotate accelrator into standard reference frame */ -const matrix_3x3_t base_standard_ref = { - { 0, FLOAT_TO_FP(1), 0}, - {FLOAT_TO_FP(-1), 0, 0}, - { 0, 0, FLOAT_TO_FP(1)} -}; - -const matrix_3x3_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[] = { - {.name = "Base", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_KXCJ9, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_BASE, - .drv = &kionix_accel_drv, - .mutex = &g_kxcj9_mutex[0], - .drv_data = &g_kxcj9_data[0], - .addr = KXCJ9_ADDR1, - .rot_standard_ref = &base_standard_ref, - .default_range = 2, /* g, enough for laptop. */ - .config = { - /* AP: by default shutdown all sensors */ - [SENSOR_CONFIG_AP] = { - .odr = 0, - .ec_rate = 0, - }, - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 100000 | ROUND_UP_FLAG, - .ec_rate = 100, - }, - /* Sensor off in S3/S5 */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 0, - .ec_rate = 0 - }, - /* Sensor off in S3/S5 */ - [SENSOR_CONFIG_EC_S5] = { - .odr = 0, - .ec_rate = 0 - }, - }, - }, - {.name = "Lid", - .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_KXCJ9, - .type = MOTIONSENSE_TYPE_ACCEL, - .location = MOTIONSENSE_LOC_LID, - .drv = &kionix_accel_drv, - .mutex = &g_kxcj9_mutex[1], - .drv_data = &g_kxcj9_data[1], - .addr = KXCJ9_ADDR0, - .rot_standard_ref = &lid_standard_ref, - .default_range = 2, /* g, enough for laptop. */ - .config = { - /* AP: by default shutdown all sensors */ - [SENSOR_CONFIG_AP] = { - .odr = 0, - .ec_rate = 0, - }, - /* EC use accel for angle detection */ - [SENSOR_CONFIG_EC_S0] = { - .odr = 100000 | ROUND_UP_FLAG, - .ec_rate = 100, - }, - /* Sensor off in S3/S5 */ - [SENSOR_CONFIG_EC_S3] = { - .odr = 0, - .ec_rate = 0 - }, - /* Sensor off in S3/S5 */ - [SENSOR_CONFIG_EC_S5] = { - .odr = 0, - .ec_rate = 0 - }, - }, - }, -}; -const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); - -#ifdef CONFIG_LID_ANGLE_UPDATE -static void track_pad_enable(int enable) -{ - if (enable) - gpio_set_level(GPIO_TP_INT_DISABLE, 0); - else - gpio_set_level(GPIO_TP_INT_DISABLE, 1); -} - -void lid_angle_peripheral_enable(int enable) -{ - if (enable) { - keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE); - track_pad_enable(1); - } else { - /* - * Ensure chipset is off before disabling keyboard. When chipset - * is on, EC keeps keyboard enabled and the AP decides when to - * ignore keys based on its more accurate lid angle calculation. - * - * TODO(crosbug.com/p/43695): Remove this check once we have a - * host command that can inform EC when we are entering or - * exiting tablet mode in S0. Also, add this check back to the - * function lid_angle_update in lid_angle.c - */ - if (!chipset_in_state(CHIPSET_STATE_ON)) - keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE); - track_pad_enable(0); - } -} -#endif diff --git a/board/cyan/board.h b/board/cyan/board.h deleted file mode 100644 index bac66945cd..0000000000 --- a/board/cyan/board.h +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright 2015 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* Cyan board configuration */ - -#ifndef __CROS_EC_BOARD_H -#define __CROS_EC_BOARD_H - -/* Optional features */ -#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands */ -#define CONFIG_WATCHDOG_HELP -#define CONFIG_BOARD_VERSION -#define CONFIG_CLOCK_CRYSTAL -#define CONFIG_CHIPSET_BRASWELL -#define CONFIG_SCI_GPIO GPIO_PCH_SCI_L -#define CONFIG_KEYBOARD_COL2_INVERTED -#define CONFIG_KEYBOARD_IRQ_GPIO GPIO_KBD_IRQ_L -#undef CONFIG_KEYBOARD_KSO_BASE -#define CONFIG_KEYBOARD_KSO_BASE 4 /* KSO starts from KSO04 */ -#define CONFIG_KEYBOARD_PROTOCOL_8042 -#define CONFIG_POWER_BUTTON -#define CONFIG_POWER_BUTTON_X86 -#define CONFIG_LID_SWITCH -#define CONFIG_LOW_POWER_IDLE -#define CONFIG_LOW_POWER_PSEUDO_G3 -#define CONFIG_LED_COMMON -#define CONFIG_POWER_COMMON -#define CONFIG_POWER_SHUTDOWN_PAUSE_IN_S5 -#define CONFIG_EXTPOWER_GPIO -#define CONFIG_I2C -#define CONFIG_VBOOT_HASH - -#define CONFIG_CHARGER -#define CONFIG_BATTERY_CUT_OFF -#define CONFIG_BATTERY_SMART -#define CONFIG_CHARGER_V2 -#define CONFIG_CHARGER_BQ24770 -#define CONFIG_CHARGER_ILIM_PIN_DISABLED -#define CONFIG_CHARGER_SENSE_RESISTOR 10 -#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 -#define CONFIG_CHARGER_INPUT_CURRENT 2240 -#define CONFIG_CHARGER_DISCHARGE_ON_AC - -#define CONFIG_SPI_FLASH_PORT 1 -#define CONFIG_SPI_FLASH -#define CONFIG_FLASH_SIZE 524288 -/* TODO: Add flash protect support for the SPI part cyan actually has */ -#define CONFIG_SPI_FLASH_W25X40 - -#define CONFIG_USB_PORT_POWER_SMART -#define CONFIG_USB_PORT_POWER_SMART_SIMPLE - -/* Temperature sensor */ -#define CONFIG_TEMP_SENSOR -#define CONFIG_TEMP_SENSOR_TMP432 - -/* Motion */ -#define CONFIG_ACCEL_KXCJ9 -#define CONFIG_CMD_ACCELS -#define CONFIG_CMD_ACCEL_INFO -#define CONFIG_LID_ANGLE_SENSOR_BASE 0 -#define CONFIG_LID_ANGLE_SENSOR_LID 1 -#define CONFIG_LID_ANGLE -#define CONFIG_LID_ANGLE_UPDATE - -/* Modules we want to exclude */ -#undef CONFIG_EEPROM -#undef CONFIG_PSTORE -#undef CONFIG_PECI -#undef CONFIG_PWM -#undef CONFIG_FANS -#undef CONFIG_ADC -#ifndef __ASSEMBLER__ - -#include "gpio_signal.h" -#include "registers.h" - -#define I2C_PORT_BATTERY MEC1322_I2C0_0 -#define I2C_PORT_CHARGER MEC1322_I2C0_0 -#define I2C_PORT_ACCEL MEC1322_I2C1 -#define I2C_PORT_THERMAL MEC1322_I2C3 - -#undef CONFIG_I2C_NACK_RETRY_COUNT -#define CONFIG_I2C_NACK_RETRY_COUNT 2 - -/* power signal definitions */ -enum power_signal { - X86_ALL_SYS_PWRGD = 0, - X86_RSMRST_L_PWRGD, - X86_SLP_S3_DEASSERTED, - X86_SLP_S4_DEASSERTED, - - /* Number of X86 signals */ - POWER_SIGNAL_COUNT -}; - -enum temp_sensor_id { - /* TMP432 local and remote sensors */ - TEMP_SENSOR_I2C_TMP432_LOCAL, - TEMP_SENSOR_I2C_TMP432_REMOTE1, - TEMP_SENSOR_I2C_TMP432_REMOTE2, - - /* Battery temperature sensor */ - TEMP_SENSOR_BATTERY, - - TEMP_SENSOR_COUNT -}; - -#endif /* !__ASSEMBLER__ */ - -#endif /* __CROS_EC_BOARD_H */ diff --git a/board/cyan/build.mk b/board/cyan/build.mk deleted file mode 100644 index 51dfe75e15..0000000000 --- a/board/cyan/build.mk +++ /dev/null @@ -1,14 +0,0 @@ -# -*- makefile -*- -# Copyright 2015 The Chromium OS Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -# -# Board specific files build -# - -# the IC is SMSC MEC1322 / external SPI is 512KB / external clock is crystal -CHIP:=mec1322 -CHIP_SPI_SIZE_KB:=512 - -board-y=board.o led.o -board-$(CONFIG_BATTERY_SMART)+=battery.o diff --git a/board/cyan/ec.tasklist b/board/cyan/ec.tasklist deleted file mode 100644 index 2e7070a299..0000000000 --- a/board/cyan/ec.tasklist +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2015 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* - * List of enabled tasks in the priority order - * - * The first one has the lowest priority. - * - * For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and - * TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries, - * where : - * 'n' in the name of the task - * 'r' in the main routine of the task - * 'd' in an opaque parameter passed to the routine at startup - * 's' is the stack size in bytes; must be a multiple of 8 - */ -#define CONFIG_TASK_LIST \ - TASK_ALWAYS(HOOKS, hook_task, NULL, HOOKS_TASK_STACK_SIZE) \ - TASK_ALWAYS(CHARGER, charger_task, NULL, CHARGER_TASK_STACK_SIZE) \ - TASK_NOTEST(MOTIONSENSE, motion_sense_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(HOSTCMD, host_command_task, NULL, HOST_CMD_TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, CONSOLE_TASK_STACK_SIZE) \ - TASK_ALWAYS(POWERBTN, power_button_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) - diff --git a/board/cyan/gpio.inc b/board/cyan/gpio.inc deleted file mode 100644 index 45c8b9ee00..0000000000 --- a/board/cyan/gpio.inc +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- mode:c -*- - * - * Copyright 2015 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -GPIO_INT(LID_OPEN, PIN(27), GPIO_INT_BOTH_DSLEEP, lid_interrupt) /* Lid switch */ -GPIO_INT(AC_PRESENT, PIN(30), GPIO_INT_BOTH_DSLEEP, extpower_interrupt) /* BC_ACOK / EC_ACIN - to know if battery or AC connected */ -GPIO_INT(WP_L, PIN(33), GPIO_INT_BOTH, switch_interrupt) /* Write protect input */ -GPIO_INT(POWER_BUTTON_L, PIN(35), GPIO_INT_BOTH_DSLEEP, power_button_interrupt) /* Power button */ -GPIO_INT(RSMRST_L_PGOOD, PIN(63), GPIO_INT_BOTH, power_signal_interrupt) /* RSMRST_N_PWRGD from power logic */ -GPIO_INT(ALL_SYS_PGOOD, PIN(130), GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* ALL_SYS_PWRGD from power logic */ -GPIO_INT(PCH_SLP_S4_L, PIN(200), GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S4# signal from PCH */ -GPIO_INT(PCH_SLP_S3_L, PIN(206), GPIO_INT_BOTH_DSLEEP, power_signal_interrupt) /* SLP_S3# signal from PCH */ -#ifdef CONFIG_LOW_POWER_IDLE -GPIO_INT(UART0_RX, PIN(162), GPIO_INT_BOTH_DSLEEP | GPIO_PULL_UP, uart_deepsleep_interrupt) /* UART0 RX input */ -#endif - -GPIO(NC_GPIO0, PIN(0), GPIO_INPUT | GPIO_PULL_UP) /* NC, JTAG_TCK */ -GPIO(NC_012, PIN(12), GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(USB_ILIM_SEL, PIN(13), GPIO_OUT_HIGH) /* USB current control */ -GPIO(LPC_CLK_RUN, PIN(14), GPIO_OUT_HIGH) /* LPC_CLKRUN is not used and set as GPIO HIGH to fix floating */ -GPIO(I2C0_0_SCL, PIN(15), GPIO_ODR_HIGH) -GPIO(I2C0_0_SDA, PIN(16), GPIO_ODR_HIGH) -GPIO(BOARD_VERSION3, PIN(17), GPIO_INPUT) /* Board ID */ - -GPIO(I2C2_SCL, PIN(20), GPIO_ODR_HIGH) -GPIO(I2C2_SDA, PIN(21), GPIO_ODR_HIGH) -GPIO(I2C1_SCL, PIN(22), GPIO_ODR_HIGH) -GPIO(I2C1_SDA, PIN(23), GPIO_ODR_HIGH) -GPIO(I2C3_SCL, PIN(24), GPIO_ODR_HIGH) -GPIO(I2C3_SDA, PIN(25), GPIO_ODR_HIGH) -GPIO(PCH_SCI_L, PIN(26), GPIO_ODR_HIGH) /* SCI output */ - -GPIO(NC_31, PIN(31), GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(NC_34, PIN(34), GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(USB2_ENABLE, PIN(36), GPIO_OUT_LOW) /* Enable power for USB2 Port */ - -GPIO(ENTERING_RW, PIN(41), GPIO_OUT_LOW) /* Indicate when EC is entering RW code */ -GPIO(PCH_SMI_L, PIN(44), GPIO_ODR_HIGH) /* SMI output */ -GPIO(USB_OC1_L, PIN(45), GPIO_INT_FALLING) /* DB2 BC1.2 over current signal to EC */ -GPIO(NC_46, PIN(46), GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(NC_47, PIN(47), GPIO_INPUT | GPIO_PULL_UP) /* NC */ - -GPIO(TOUCHPANEL_PWREN, PIN(50), GPIO_OUT_HIGH) /* Enable power for Touch Panel */ -GPIO(PCH_SUS_STAT_L, PIN(51), GPIO_INT_FALLING) /* Signal to inform EC that SOC is entering low power state */ -GPIO(TP_INT_DISABLE, PIN(52), GPIO_OUT_LOW) /* Disable Track Pad interrupt */ -GPIO(TRACKPAD_PWREN, PIN(53), GPIO_OUT_HIGH) /* Enable power for Track Pad */ -GPIO(USB_OC0_L, PIN(55), GPIO_INT_FALLING) /* Over current signal of the BC1.2 charger to EC */ -GPIO(NC_56, PIN(56), GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(NC_57, PIN(57), GPIO_INPUT | GPIO_PULL_UP) /* NC */ - -GPIO(CHGR_PMON, PIN(60), GPIO_ANALOG) -GPIO(WIFI_PWREN, PIN(61), GPIO_OUT_HIGH) /* Enable power for WiFi */ -GPIO(BATT_EN_L, PIN(62), GPIO_INPUT | GPIO_PULL_UP) /* NC for EVT */ -GPIO(EC_HIB_L, PIN(64), GPIO_OUT_LOW) -GPIO(PCH_SYS_PWROK, PIN(65), GPIO_OUT_LOW) /* EC thinks everything is up and ready (DELAY_ALL_SYS_PWRGD) */ -GPIO(PCH_WAKE_L, PIN(66), GPIO_ODR_HIGH) /* PCH wake pin */ -GPIO(USB1_ENABLE, PIN(67), GPIO_OUT_LOW) /* Enable power for USB3 Port */ - -GPIO(NC_GPIO100, PIN(100), GPIO_INPUT | GPIO_PULL_UP) /* NC, JTAG_TMS */ -GPIO(NC_GPIO101, PIN(101), GPIO_INPUT | GPIO_PULL_UP) /* NC, JTAG_TDI */ -GPIO(NC_GPIO102, PIN(102), GPIO_INPUT | GPIO_PULL_UP) /* NC, JTAG_TDO */ -GPIO(USB_CTL1, PIN(105), GPIO_OUT_HIGH) /* USB charging mode control */ - -GPIO(PCH_RCIN_L, PIN(110), GPIO_ODR_HIGH) /* Reset line to PCH (for 8042 emulation) */ -GPIO(NC_115, PIN(115), GPIO_INPUT | GPIO_PULL_UP) /* NC */ - -GPIO(NC_122, PIN(122), GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(EC_STRAP_GPIO1, PIN(123), GPIO_OUT_LOW) -GPIO(NC_124, PIN(124), GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(GYRO_INT2, PIN(127), GPIO_INPUT | GPIO_PULL_DOWN) /* Gyro sensor interrupt 2 to EC */ - -GPIO(NC_132, PIN(132), GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(BAT_LED0_L, PIN(133), GPIO_OUT_HIGH) /* Battery charging LED - blue */ -GPIO(BOARD_VERSION2, PIN(134), GPIO_INPUT) /* Board ID */ -GPIO(WWAN_PWREN, PIN(135), GPIO_OUT_HIGH) /* Enable power for WWAN - PROBE_DETECT_L */ -GPIO(BAT_LED1_L, PIN(136), GPIO_OUT_HIGH) /* Battery charging LED - orange */ - -GPIO(NC_140, PIN(140), GPIO_INPUT | GPIO_PULL_UP) /* NC */ -GPIO(PWR_LED0_L, PIN(141), GPIO_OUT_HIGH) /* Power LED - blue */ -GPIO(PCH_RSMRST_L, PIN(143), GPIO_OUT_LOW) /* RSMRST_N to PCH */ -GPIO(PWR_LED1_L, PIN(145), GPIO_OUT_HIGH) /* Power LED - orange */ -GPIO(PVT_CS0, PIN(146), GPIO_ODR_HIGH) /* SPI PVT Chip select */ -GPIO(EC_KBD_ALERT, PIN(147), GPIO_OUT_HIGH) - -GPIO(WLAN_OFF_L, PIN(150), GPIO_ODR_HIGH) /* Wireless LAN */ -GPIO(CPU_PROCHOT, PIN(151), GPIO_OUT_LOW) -GPIO(KBD_IRQ_L, PIN(152), GPIO_ODR_HIGH) /* Negative edge triggered irq. */ -GPIO(BOARD_VERSION1, PIN(154), GPIO_INPUT) /* Board ID */ -GPIO(CORE_PWROK, PIN(155), GPIO_INPUT | GPIO_PULL_UP) /* Disconnected. CORE_PWR_OK_R */ -GPIO(LID_OPEN2, PIN(156), GPIO_INT_BOTH_DSLEEP) /* LID_OPEN_OUT2_R */ -GPIO(PCH_SUSPWRDNACK, PIN(157), GPIO_INT_FALLING) /* PMC SUSPWRDNACK signal from SOC to EC */ - -GPIO(PCH_PWRBTN_L, PIN(160), GPIO_OUT_HIGH) /* Power button output to PCH */ -GPIO(GYRO_INT1, PIN(161), GPIO_INPUT | GPIO_PULL_DOWN) /* Gyro sensor interrupt 1 to EC */ -GPIO(NC_163, PIN(163), GPIO_INPUT | GPIO_PULL_UP) /* NC */ - -GPIO(STARTUP_LATCH_SET, PIN(201), GPIO_OUT_HIGH) -GPIO(EC_BL_DISABLE_L, PIN(202), GPIO_OUT_HIGH) /* EDP backligh disable signal from EC */ -GPIO(SMC_SHUTDOWN, PIN(203), GPIO_OUT_LOW) /* Shutdown signal from EC to power sequencing PLD */ -GPIO(NC_204, PIN(204), GPIO_INPUT | GPIO_PULL_UP) /* NC */ - -GPIO(SUSPWRDNACK_SOC_EC,PIN(210), GPIO_OUT_LOW) /* SUSPWRDNACK signal from EC to MOIC device */ -GPIO(PCH_SLP_SX_L, PIN(211), GPIO_INPUT | GPIO_PULL_UP) /* NC for EVT. Sleep SOIX signal from SOC to EC */ - -/* Alternate functions GPIO definition */ -ALTERNATE(PIN_MASK(16, 0x24), 1, MODULE_UART, 0) /* UART0 */ - -ALTERNATE(PIN_MASK(1, 0x60), 2, MODULE_I2C, GPIO_PULL_UP) /* I2C0: Battery Charger */ -ALTERNATE(PIN_MASK(2, 0x3f), 2, MODULE_I2C, GPIO_PULL_UP) /* I2C1: Motion Sensor / I2C2: SOC / I2C3: Temp Sensor */ - -ALTERNATE(PIN_MASK(0, 0xfc), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PIN_MASK(1, 0x03), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -ALTERNATE(PIN_MASK(10, 0xd8), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT) -#ifdef CONFIG_KEYBOARD_COL2_INVERTED - GPIO(KBD_KSO2, PIN(1), GPIO_KB_OUTPUT_COL2) /* Negative edge triggered irq. */ -#else - ALTERNATE(PIN_MASK(0, 0x02), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_OUTPUT_COL2) -#endif - -ALTERNATE(PIN_MASK(3, 0x04), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PIN_MASK(4, 0x0d), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PIN_MASK(12, 0x60), 2, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) -ALTERNATE(PIN_MASK(14, 0x14), 3, MODULE_KEYBOARD_SCAN, GPIO_KB_INPUT) - -ALTERNATE(PIN_MASK(11, 0x9e), 1, MODULE_LPC, 0) /* 111~114: LAD[0:3], 117: PCI_CLK */ -ALTERNATE(PIN_MASK(11, 0x40), 1, MODULE_LPC, GPIO_INT_BOTH) /* 116: LRESET# */ -ALTERNATE(PIN_MASK(12, 0x01), 1, MODULE_LPC, 0) /* 120: LFRAME# */ - -ALTERNATE(PIN_MASK(5, 0x10), 1, MODULE_SPI, 0) /* 54: MOSI */ -ALTERNATE(PIN_MASK(16, 0x10), 1, MODULE_SPI, 0) /* 164: MISO */ -ALTERNATE(PIN_MASK(15, 0x08), 1, MODULE_SPI, 0) /* 153: CLK */ - -/* Re-Config LPC Pins to GPIO Open Drain for SOC G3 (EC - POWER_G3) state */ -ALTERNATE(PIN_MASK(1, 0x10), 0, MODULE_GPIO, GPIO_ODR_HIGH) /* 14: LPC CLKRUN */ -ALTERNATE(PIN_MASK(11, 0x9e), 0, MODULE_GPIO, GPIO_ODR_HIGH) /* 111~114:LAD[0:3], 117:PCI_CLK */ -ALTERNATE(PIN_MASK(11, 0x40), 0, MODULE_GPIO, GPIO_ODR_HIGH) /* 116: LRESET# */ -ALTERNATE(PIN_MASK(12, 0x01), 0, MODULE_GPIO, GPIO_ODR_HIGH) /* 120: LFRAME# */ diff --git a/board/cyan/led.c b/board/cyan/led.c deleted file mode 100644 index d6953b4fab..0000000000 --- a/board/cyan/led.c +++ /dev/null @@ -1,216 +0,0 @@ -/* Copyright 2015 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - * - * Power and battery LED control for Cyan. - */ - -#include "battery.h" -#include "charge_state.h" -#include "chipset.h" -#include "ec_commands.h" -#include "gpio.h" -#include "hooks.h" -#include "host_command.h" -#include "led_common.h" -#include "util.h" - -#define CRITICAL_LOW_BATTERY_PERMILLAGE 71 -#define LOW_BATTERY_PERMILLAGE 137 -#define FULL_BATTERY_PERMILLAGE 937 - -#define LED_TOTAL_4SECS_TICKS 16 -#define LED_TOTAL_2SECS_TICKS 8 -#define LED_ON_1SEC_TICKS 4 -#define LED_ON_2SECS_TICKS 8 - -enum led_color { - LED_OFF = 0, - LED_BLUE, - LED_AMBER, - LED_PINK, - - LED_COLOR_COUNT /* Number of colors, not a color itself */ -}; - -const enum ec_led_id supported_led_ids[] = { - EC_LED_ID_POWER_LED, EC_LED_ID_BATTERY_LED}; - -const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids); - -static int cyan_led_set_gpio(enum led_color color, - enum gpio_signal gpio_led_blue_l, - enum gpio_signal gpio_led_amber_l) -{ - switch (color) { - case LED_OFF: - gpio_set_level(gpio_led_blue_l, 1); - gpio_set_level(gpio_led_amber_l, 1); - break; - case LED_BLUE: - gpio_set_level(gpio_led_blue_l, 0); - gpio_set_level(gpio_led_amber_l, 1); - break; - case LED_AMBER: - gpio_set_level(gpio_led_blue_l, 1); - gpio_set_level(gpio_led_amber_l, 0); - break; - case LED_PINK: - gpio_set_level(gpio_led_blue_l, 0); - gpio_set_level(gpio_led_amber_l, 0); - break; - default: - return EC_ERROR_UNKNOWN; - } - return EC_SUCCESS; -} - -static int cyan_led_set_color_battery(enum led_color color) -{ - return cyan_led_set_gpio(color, GPIO_BAT_LED0_L, GPIO_BAT_LED1_L); -} - -static int cyan_led_set_color_power(enum led_color color) -{ - return cyan_led_set_gpio(color, GPIO_PWR_LED0_L, GPIO_PWR_LED1_L); -} - -static int cyan_led_set_color(enum ec_led_id led_id, enum led_color color) -{ - int rv; - - led_auto_control(led_id, 0); - switch (led_id) { - case EC_LED_ID_BATTERY_LED: - rv = cyan_led_set_color_battery(color); - break; - case EC_LED_ID_POWER_LED: - rv = cyan_led_set_color_power(color); - break; - default: - return EC_ERROR_UNKNOWN; - } - return rv; -} - -int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness) -{ - if (brightness[EC_LED_COLOR_BLUE] != 0 && - brightness[EC_LED_COLOR_YELLOW] != 0) - cyan_led_set_color(led_id, LED_PINK); - else if (brightness[EC_LED_COLOR_BLUE] != 0) - cyan_led_set_color(led_id, LED_BLUE); - else if (brightness[EC_LED_COLOR_YELLOW] != 0) - cyan_led_set_color(led_id, LED_AMBER); - else - cyan_led_set_color(led_id, LED_OFF); - - return EC_SUCCESS; -} - -void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) -{ - /* Ignoring led_id as both leds support the same colors */ - brightness_range[EC_LED_COLOR_BLUE] = 1; - brightness_range[EC_LED_COLOR_YELLOW] = 1; -} - -static void cyan_led_set_power(void) -{ - static int power_ticks; - static int previous_state_suspend; - - power_ticks++; - - if (chipset_in_state(CHIPSET_STATE_SUSPEND)) { - /* Reset ticks if entering suspend so LED turns amber - * as soon as possible. */ - if (!previous_state_suspend) - power_ticks = 0; - - /* Blink once every four seconds. */ - cyan_led_set_color_power( - (power_ticks % LED_TOTAL_4SECS_TICKS < - LED_ON_1SEC_TICKS) ? LED_AMBER : LED_OFF); - - previous_state_suspend = 1; - return; - } - - previous_state_suspend = 0; - - if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) - cyan_led_set_color_power(LED_OFF); - else if (chipset_in_state(CHIPSET_STATE_ON)) - cyan_led_set_color_power(LED_BLUE); -} - -static void cyan_led_set_battery(void) -{ - static int battery_ticks; - uint32_t chflags = charge_get_flags(); - int remaining_capacity; - int full_charge_capacity; - int permillage; - - battery_ticks++; - - remaining_capacity = *(int *)host_get_memmap(EC_MEMMAP_BATT_CAP); - full_charge_capacity = *(int *)host_get_memmap(EC_MEMMAP_BATT_LFCC); - permillage = !full_charge_capacity ? 0 : - (1000 * remaining_capacity) / full_charge_capacity; - - switch (charge_get_state()) { - case PWR_STATE_CHARGE: - /* Make the percentage approximate to UI shown */ - cyan_led_set_color_battery(permillage < - FULL_BATTERY_PERMILLAGE ? LED_AMBER : LED_BLUE); - break; - case PWR_STATE_CHARGE_NEAR_FULL: - cyan_led_set_color_battery(LED_BLUE); - break; - case PWR_STATE_DISCHARGE: - /* Less than 3%, blink one second every two seconds */ - if (!chipset_in_state(CHIPSET_STATE_ANY_OFF) && - permillage <= CRITICAL_LOW_BATTERY_PERMILLAGE) - cyan_led_set_color_battery( - (battery_ticks % LED_TOTAL_2SECS_TICKS < - LED_ON_1SEC_TICKS) ? LED_AMBER : LED_OFF); - /* Less than 10%, blink one second every four seconds */ - else if (!chipset_in_state(CHIPSET_STATE_ANY_OFF) && - permillage <= LOW_BATTERY_PERMILLAGE) - cyan_led_set_color_battery( - (battery_ticks % LED_TOTAL_4SECS_TICKS < - LED_ON_1SEC_TICKS) ? LED_AMBER : LED_OFF); - else - cyan_led_set_color_battery(LED_OFF); - break; - case PWR_STATE_ERROR: - cyan_led_set_color_battery( - (battery_ticks % LED_TOTAL_2SECS_TICKS < - LED_ON_1SEC_TICKS) ? LED_AMBER : LED_OFF); - break; - case PWR_STATE_IDLE: /* External power connected in IDLE. */ - if (chflags & CHARGE_FLAG_FORCE_IDLE) - cyan_led_set_color_battery( - (battery_ticks % LED_TOTAL_4SECS_TICKS < - LED_ON_2SECS_TICKS) ? LED_BLUE : LED_AMBER); - else - cyan_led_set_color_battery(LED_BLUE); - break; - default: - /* Other states don't alter LED behavior */ - break; - } -} - -/* Called by hook task every 250mSec */ -static void led_tick(void) -{ - if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED)) - cyan_led_set_power(); - - if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) - cyan_led_set_battery(); -} -DECLARE_HOOK(HOOK_TICK, led_tick, HOOK_PRIO_DEFAULT); diff --git a/board/cyan/lfw/gpio.inc b/board/cyan/lfw/gpio.inc deleted file mode 100644 index 122aff0cdf..0000000000 --- a/board/cyan/lfw/gpio.inc +++ /dev/null @@ -1,16 +0,0 @@ -/* -*- mode:c -*- - * - * Copyright (c) 2014 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - * - * Minimal set of GPIOs needed for LFW loader - */ - -GPIO(PVT_CS0, PIN(146), GPIO_ODR_HIGH) /* SPI PVT Chip select */ - -/* Alternate functions GPIO definition */ -ALTERNATE(PIN_MASK(16, 0x24), 1, MODULE_UART, 0) /* UART0 */ -ALTERNATE(PIN_MASK(5, 0x10), 1, MODULE_SPI, 0) -ALTERNATE(PIN_MASK(16, 0x10), 1, MODULE_SPI, 0) -ALTERNATE(PIN_MASK(15, 0x08), 1, MODULE_SPI, 0) /* 153: CLK */ |