diff options
author | 志偉 黃 <David.Huang@quantatw.com> | 2013-09-12 07:11:52 +0000 |
---|---|---|
committer | Marc Jones <marc.jones@se-eng.com> | 2013-09-12 08:55:15 +0000 |
commit | 8f811c4e51e7862b523e64ede2ea9cd87b343504 (patch) | |
tree | b7bbe3d001febfd3de595db8352a399da29e2445 | |
parent | 2b4856fe23aa172911936a1791f00b41dd41a93a (diff) | |
download | chrome-ec-8f811c4e51e7862b523e64ede2ea9cd87b343504.tar.gz |
Revert "First release leon which based on slippy."
This reverts commit 013c61b60d6011528140ab408a4561e10f141a62.
BUG=none
BRANCH=leon
TEST=none
Signed-off-by: David Huang <David.Huang@quantatw.com>
Conflicts:
common/battery_leon.c
Change-Id: I0a07e938eb700a5bb77c50e464d80bca6e353fb7
Reviewed-on: https://chromium-review.googlesource.com/169092
Reviewed-by: Marc Jones <marc.jones@se-eng.com>
Commit-Queue: 志偉 黃 <David.Huang@quantatw.com>
Tested-by: 志偉 黃 <David.Huang@quantatw.com>
-rw-r--r-- | board/leon/board.c | 244 | ||||
-rw-r--r-- | board/leon/board.h | 208 | ||||
-rw-r--r-- | board/leon/build.mk | 12 | ||||
-rw-r--r-- | board/leon/ec.tasklist | 29 | ||||
-rw-r--r-- | common/battery_leon.c | 70 | ||||
-rw-r--r-- | common/build.mk | 1 | ||||
-rw-r--r-- | common/led_leon.c | 185 |
7 files changed, 0 insertions, 749 deletions
diff --git a/board/leon/board.c b/board/leon/board.c deleted file mode 100644 index faebdd8cdc..0000000000 --- a/board/leon/board.c +++ /dev/null @@ -1,244 +0,0 @@ -/* Copyright (c) 2013 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. - */ -/* EC for Leon board configuration */ - -#include "adc.h" -#include "backlight.h" -#include "chip_temp_sensor.h" -#include "chipset_haswell.h" -#include "chipset_x86_common.h" -#include "common.h" -#include "ec_commands.h" -#include "extpower.h" -#include "gpio.h" -#include "host_command.h" -#include "i2c.h" -#include "keyboard_scan.h" -#include "lid_switch.h" -#include "lm4_adc.h" -#include "peci.h" -#include "power_button.h" -#include "registers.h" -#include "switch.h" -#include "temp_sensor.h" -#include "temp_sensor_g781.h" -#include "timer.h" -#include "util.h" - -/* GPIO signal list. Must match order from enum gpio_signal. */ -const struct gpio_info gpio_list[] = { - /* Inputs with interrupt handlers are first for efficiency */ - {"POWER_BUTTON_L", LM4_GPIO_A, (1<<2), GPIO_INT_BOTH, - power_button_interrupt}, - {"LID_OPEN", LM4_GPIO_A, (1<<3), GPIO_INT_BOTH, - lid_interrupt}, - {"AC_PRESENT", LM4_GPIO_H, (1<<3), GPIO_INT_BOTH, - extpower_interrupt}, - {"PCH_BKLTEN", LM4_GPIO_M, (1<<3), GPIO_INT_BOTH, - backlight_interrupt}, - {"PCH_SLP_S0_L", LM4_GPIO_G, (1<<6), GPIO_INT_BOTH, - x86_interrupt}, - {"PCH_SLP_S3_L", LM4_GPIO_G, (1<<7), GPIO_INT_BOTH, - x86_interrupt}, - {"PCH_SLP_S5_L", LM4_GPIO_H, (1<<1), GPIO_INT_BOTH, - x86_interrupt}, - {"PCH_SLP_SUS_L", LM4_GPIO_G, (1<<3), GPIO_INT_BOTH, - x86_interrupt}, - {"PP1050_PGOOD", LM4_GPIO_H, (1<<4), GPIO_INT_BOTH, - x86_interrupt}, - {"PP1350_PGOOD", LM4_GPIO_H, (1<<6), GPIO_INT_BOTH, - x86_interrupt}, - {"PP5000_PGOOD", LM4_GPIO_N, (1<<0), GPIO_INT_BOTH, - x86_interrupt}, - {"VCORE_PGOOD", LM4_GPIO_C, (1<<6), GPIO_INT_BOTH, - x86_interrupt}, - {"PCH_EDP_VDD_EN", LM4_GPIO_J, (1<<1), GPIO_INT_BOTH, - haswell_interrupt}, - {"RECOVERY_L", LM4_GPIO_A, (1<<5), GPIO_PULL_UP|GPIO_INT_BOTH, - switch_interrupt}, - {"WP_L", LM4_GPIO_A, (1<<4), GPIO_INT_BOTH, - switch_interrupt}, - - /* Other inputs */ - {"FAN_ALERT_L", LM4_GPIO_B, (1<<0), GPIO_INPUT, NULL}, - {"PCH_SUSWARN_L", LM4_GPIO_G, (1<<2), GPIO_INT_BOTH, NULL}, - {"USB1_OC_L", LM4_GPIO_E, (1<<7), GPIO_INPUT, NULL}, - {"USB2_OC_L", LM4_GPIO_E, (1<<0), GPIO_INPUT, NULL}, - {"BOARD_VERSION1", LM4_GPIO_Q, (1<<5), GPIO_INPUT, NULL}, - {"BOARD_VERSION2", LM4_GPIO_Q, (1<<6), GPIO_INPUT, NULL}, - {"BOARD_VERSION3", LM4_GPIO_Q, (1<<7), GPIO_INPUT, NULL}, - {"CPU_PGOOD", LM4_GPIO_C, (1<<4), GPIO_INPUT, NULL}, - {"BAT_DETECT_L", LM4_GPIO_B, (1<<4), GPIO_INPUT, NULL}, - - /* Outputs; all unasserted by default except for reset signals */ - {"CPU_PROCHOT", LM4_GPIO_B, (1<<1), GPIO_OUT_LOW, NULL}, - {"PP1350_EN", LM4_GPIO_H, (1<<5), GPIO_OUT_LOW, NULL}, - {"PP3300_DSW_GATED_EN", LM4_GPIO_J, (1<<3), GPIO_OUT_LOW, NULL}, - {"PP3300_DX_EN", LM4_GPIO_J, (1<<2), GPIO_OUT_LOW, NULL}, - {"PP3300_LTE_EN", LM4_GPIO_D, (1<<2), GPIO_OUT_LOW, NULL}, - {"PP3300_WLAN_EN", LM4_GPIO_J, (1<<0), GPIO_OUT_LOW, NULL}, - {"SUSP_VR_EN", LM4_GPIO_C, (1<<7), GPIO_OUT_LOW, NULL}, - {"VCORE_EN", LM4_GPIO_C, (1<<5), GPIO_OUT_LOW, NULL}, - {"PP5000_EN", LM4_GPIO_H, (1<<7), GPIO_OUT_LOW, NULL}, - {"SYS_PWROK", LM4_GPIO_H, (1<<2), GPIO_OUT_LOW, NULL}, - {"WLAN_OFF_L", LM4_GPIO_J, (1<<4), GPIO_OUT_LOW, NULL}, - {"CHARGE_L", LM4_GPIO_E, (1<<6), GPIO_OUT_LOW, NULL}, - - {"ENABLE_BACKLIGHT", LM4_GPIO_M, (1<<7), GPIO_OUT_LOW, NULL}, - {"ENABLE_TOUCHPAD", LM4_GPIO_N, (1<<1), GPIO_OUT_LOW, NULL}, - {"ENTERING_RW", LM4_GPIO_D, (1<<3), GPIO_OUT_LOW, NULL}, - {"PCH_DPWROK", LM4_GPIO_G, (1<<0), GPIO_OUT_LOW, NULL}, - /* - * HDA_SDO is technically an output, but we need to leave it as an - * input until we drive it high. So can't use open-drain (HI_Z). - */ - {"PCH_HDA_SDO", LM4_GPIO_G, (1<<1), GPIO_INPUT, NULL}, - {"PCH_WAKE_L", LM4_GPIO_F, (1<<0), GPIO_OUT_HIGH, NULL}, - {"PCH_NMI_L", LM4_GPIO_F, (1<<2), GPIO_OUT_HIGH, NULL}, - {"PCH_PWRBTN_L", LM4_GPIO_H, (1<<0), GPIO_OUT_HIGH, NULL}, - {"PCH_PWROK", LM4_GPIO_F, (1<<5), GPIO_OUT_LOW, NULL}, - /* FIXME: Why does PL6 not honor open drain semantics? Setting it to 1 - * drives the pin low while setting it to 0 drives the pin high. To - * work around this PCH_RCIN_L is set to an input. It will only - * be set to an output when it needs to be driven to 0. */ - {"PCH_RCIN_L", LM4_GPIO_L, (1<<6), GPIO_INPUT, NULL}, - {"PCH_RSMRST_L", LM4_GPIO_F, (1<<1), GPIO_OUT_LOW, NULL}, - {"PCH_SMI_L", LM4_GPIO_F, (1<<4), GPIO_ODR_HIGH, NULL}, - {"TOUCHSCREEN_RESET_L", LM4_GPIO_N, (1<<7), GPIO_OUT_LOW, NULL}, - {"EC_EDP_VDD_EN", LM4_GPIO_J, (1<<5), GPIO_OUT_LOW, NULL}, - - {"LPC_CLKRUN_L", LM4_GPIO_M, (1<<2), GPIO_ODR_HIGH, NULL}, - {"USB1_ENABLE", LM4_GPIO_E, (1<<4), GPIO_OUT_LOW, NULL}, - {"USB2_ENABLE", LM4_GPIO_D, (1<<5), GPIO_OUT_LOW, NULL}, - - {"PCH_SUSACK_L", LM4_GPIO_F, (1<<3), GPIO_OUT_HIGH, NULL}, - {"PCH_RTCRST_L", LM4_GPIO_F, (1<<6), GPIO_ODR_HIGH, NULL}, - {"PCH_SRTCRST_L", LM4_GPIO_F, (1<<7), GPIO_ODR_HIGH, NULL}, - - {"BAT_LED0_L", LM4_GPIO_N, (1<<6), GPIO_ODR_HIGH, NULL}, - {"BAT_LED1_L", LM4_GPIO_N, (1<<4), GPIO_ODR_HIGH, NULL}, - {"KB_LED_L", LM4_GPIO_D, (1<<0), GPIO_ODR_HIGH, NULL}, -}; -BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT); - -/* Pins with alternate functions */ -const struct gpio_alt_func gpio_alt_funcs[] = { - {GPIO_A, 0x03, 1, MODULE_UART}, /* UART0 */ - {GPIO_B, 0x04, 3, MODULE_I2C}, /* I2C0 SCL */ - {GPIO_B, 0x08, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C0 SDA */ - {GPIO_B, 0x40, 3, MODULE_I2C}, /* I2C5 SCL */ - {GPIO_B, 0x80, 3, MODULE_I2C, GPIO_OPEN_DRAIN}, /* I2C5 SDA */ - {GPIO_G, 0x30, 1, MODULE_UART}, /* UART2 */ - {GPIO_J, 0x40, 1, MODULE_PECI}, /* PECI Tx */ - {GPIO_J, 0x80, 0, MODULE_PECI, GPIO_ANALOG}, /* PECI Rx */ - {GPIO_L, 0x3f, 15, MODULE_LPC}, /* LPC */ - {GPIO_M, 0x33, 15, MODULE_LPC}, /* LPC */ - {GPIO_N, 0x0c, 1, MODULE_PWM_FAN}, /* Fan0 PWM/tach */ -}; -const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); - -/* x86 signal list. Must match order of enum x86_signal. */ -const struct x86_signal_info x86_signal_list[] = { - {GPIO_PP5000_PGOOD, 1, "PGOOD_PP5000"}, - {GPIO_PP1350_PGOOD, 1, "PGOOD_PP1350"}, - {GPIO_PP1050_PGOOD, 1, "PGOOD_PP1050"}, - {GPIO_VCORE_PGOOD, 1, "PGOOD_VCORE"}, - {GPIO_PCH_SLP_S0_L, 1, "SLP_S0#_DEASSERTED"}, - {GPIO_PCH_SLP_S3_L, 1, "SLP_S3#_DEASSERTED"}, - {GPIO_PCH_SLP_S5_L, 1, "SLP_S5#_DEASSERTED"}, - {GPIO_PCH_SLP_SUS_L, 1, "SLP_SUS#_DEASSERTED"}, -}; -BUILD_ASSERT(ARRAY_SIZE(x86_signal_list) == X86_SIGNAL_COUNT); - -/* ADC channels. Must be in the exactly same order as in enum adc_channel. */ -const struct adc_t adc_channels[] = { - /* EC internal temperature is calculated by - * 273 + (295 - 450 * ADC_VALUE / ADC_READ_MAX) / 2 - * = -225 * ADC_VALUE / ADC_READ_MAX + 420.5 - */ - {"ECTemp", LM4_ADC_SEQ0, -225, ADC_READ_MAX, 420, - LM4_AIN_NONE, 0x0e /* TS0 | IE0 | END0 */, 0, 0}, - - /* IOUT == ICMNT is on PE3/AIN0 */ - /* We have 0.01-ohm resistors, and IOUT is 20X the differential - * voltage, so 1000mA ==> 200mV. - * ADC returns 0x000-0xFFF, which maps to 0.0-3.3V (as configured). - * mA = 1000 * ADC_VALUE / ADC_READ_MAX * 3300 / 200 - */ - {"ChargerCurrent", LM4_ADC_SEQ1, 33000, ADC_READ_MAX * 2, 0, - LM4_AIN(0), 0x06 /* IE0 | END0 */, LM4_GPIO_E, (1<<3)}, -}; -BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); - -/* I2C ports */ -const struct i2c_port_t i2c_ports[] = { - /* Note: battery and charger share a port. Only include it once in - * this list so we don't double-initialize it. */ - {"batt_chg", I2C_PORT_BATTERY, 100}, - {"thermal", I2C_PORT_THERMAL, 100}, -}; -BUILD_ASSERT(ARRAY_SIZE(i2c_ports) == I2C_PORTS_USED); - - -/* Temperature sensors data; must be in same order as enum temp_sensor_id. */ -const struct temp_sensor_t temp_sensors[] = { - {"PECI", TEMP_SENSOR_TYPE_CPU, peci_temp_sensor_get_val, 0, 2}, - {"ECInternal", TEMP_SENSOR_TYPE_BOARD, chip_temp_sensor_get_val, 0, 4}, - {"G781Internal", TEMP_SENSOR_TYPE_BOARD, g781_get_val, - G781_IDX_INTERNAL, 4}, - {"G781External", TEMP_SENSOR_TYPE_BOARD, g781_get_val, - G781_IDX_EXTERNAL, 4}, -}; -BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); - -struct keyboard_scan_config keyscan_config = { - .output_settle_us = 40, - .debounce_down_us = 6 * MSEC, - .debounce_up_us = 30 * MSEC, - .scan_period_us = 1500, - .min_post_scan_delay_us = 1000, - .poll_timeout_us = SECOND, - .actual_key_mask = { - 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, - 0xa4, 0xff, 0xf6, 0x55, 0xfa, 0xca /* full set */ - }, -}; - -/** - * Perform necessary actions on host wake events. - */ -void board_process_wake_events(uint32_t active_wake_events) -{ - uint32_t power_button_mask; - - power_button_mask = EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON); - - /* If there are other events aside from the power button press drive - * the wake pin. Otherwise ensure it is high. */ - if (active_wake_events & ~power_button_mask) - gpio_set_level(GPIO_PCH_WAKE_L, 0); - else - gpio_set_level(GPIO_PCH_WAKE_L, 1); -} - -/** - * Board-specific g781 power state. - */ -int board_g781_has_power(void) -{ - return gpio_get_level(GPIO_PP3300_DX_EN); -} - -/** - * Discharge battery when on AC power for factory test. - */ -int board_discharge_on_ac(int enable) -{ - if (enable) - gpio_set_level(GPIO_CHARGE_L, 1); - else - gpio_set_level(GPIO_CHARGE_L, 0); - return EC_SUCCESS; -} diff --git a/board/leon/board.h b/board/leon/board.h deleted file mode 100644 index 788dbe74df..0000000000 --- a/board/leon/board.h +++ /dev/null @@ -1,208 +0,0 @@ -/* Copyright (c) 2013 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. - */ - -/* Configuration for Leon mainboard */ - -#ifndef __BOARD_H -#define __BOARD_H - -/* Optional features */ -#define CONFIG_BACKLIGHT_X86 -#define CONFIG_BATTERY_CHECK_CONNECTED -#define CONFIG_BATTERY_SMART -#define CONFIG_BOARD_VERSION -#define CONFIG_CHARGER -#define CONFIG_CHARGER_BQ24707A -#define CONFIG_CHARGER_DISCHARGE_ON_AC -#define CONFIG_CHIPSET_HASWELL -#define CONFIG_CHIPSET_X86 -#define CONFIG_EXTPOWER_GPIO -#define CONFIG_KEYBOARD_BOARD_CONFIG -#define CONFIG_KEYBOARD_PROTOCOL_8042 -#define CONFIG_POWER_BUTTON -#define CONFIG_POWER_BUTTON_X86 -#define CONFIG_PWM_FAN -#define CONFIG_TEMP_SENSOR -#define CONFIG_TEMP_SENSOR_G781 -#define CONFIG_UART_HOST 2 -#define CONFIG_USB_PORT_POWER_DUMB -#define CONFIG_WIRELESS - -#ifndef __ASSEMBLER__ - -/* Module IDs */ -/* TODO(rspangler): use this in place of enum console_channel as well */ -enum module_id { - MODULE_I2C, - MODULE_LPC, - MODULE_PECI, - MODULE_PWM_FAN, - MODULE_UART, -}; - -/* PWM channels */ -#define FAN_CH_CPU 2 /* CPU fan */ -#define FAN_CH_BL_DISPLAY 4 /* LVDS backlight (from PCH, cleaned by EC) */ - -/* I2C ports */ -#define I2C_PORT_BATTERY 0 -#define I2C_PORT_CHARGER 0 -#define I2C_PORT_THERMAL 5 -/* There are only two I2C ports used because battery and charger share a port */ -#define I2C_PORTS_USED 2 - -/* 13x8 keyboard scanner uses an entire GPIO bank for row inputs */ -#define KB_SCAN_ROW_IRQ LM4_IRQ_GPIOK -#define KB_SCAN_ROW_GPIO LM4_GPIO_K - -/* Host connects to keyboard controller module via LPC */ -#define HOST_KB_BUS_LPC - -/* USB ports */ -#define USB_PORT_COUNT 2 - -/* GPIO signal definitions. */ -enum gpio_signal { - /* Inputs with interrupt handlers are first for efficiency */ - GPIO_POWER_BUTTON_L = 0, /* Power button */ - GPIO_LID_OPEN, /* Lid switch */ - GPIO_AC_PRESENT, /* AC power present */ - GPIO_PCH_BKLTEN, /* Backlight enable signal from PCH */ - GPIO_PCH_SLP_S0_L, /* SLP_S0# signal from PCH */ - GPIO_PCH_SLP_S3_L, /* SLP_S3# signal from PCH */ - GPIO_PCH_SLP_S5_L, /* SLP_S5# signal from PCH */ - GPIO_PCH_SLP_SUS_L, /* SLP_SUS# signal from PCH */ - GPIO_PP1050_PGOOD, /* Power good on 1.05V */ - GPIO_PP1350_PGOOD, /* Power good on 1.35V (DRAM) */ - GPIO_PP5000_PGOOD, /* Power good on 5V */ - GPIO_VCORE_PGOOD, /* Power good on core VR */ - GPIO_PCH_EDP_VDD_EN, /* PCH wants EDP enabled */ - GPIO_RECOVERY_L, /* Recovery signal from servo */ - GPIO_WP_L, /* Write protect input */ - - /* Other inputs */ - GPIO_FAN_ALERT_L, /* From thermal sensor */ - GPIO_PCH_SUSWARN_L, /* SUSWARN# signal from PCH */ - GPIO_USB1_OC_L, /* USB port overcurrent warning */ - GPIO_USB2_OC_L, /* USB port overcurrent warning */ - GPIO_BOARD_VERSION1, /* Board version stuffing resistor 1 */ - GPIO_BOARD_VERSION2, /* Board version stuffing resistor 2 */ - GPIO_BOARD_VERSION3, /* Board version stuffing resistor 3 */ - GPIO_CPU_PGOOD, /* Power good to the CPU */ - GPIO_BAT_DETECT_L, /* Battery detect. Repurposed BAT_TEMP */ - - /* Outputs */ - GPIO_CPU_PROCHOT, /* Force CPU to think it's overheated */ - GPIO_PP1350_EN, /* Enable 1.35V supply */ - GPIO_PP3300_DSW_GATED_EN, /* Enable DSW rails */ - GPIO_PP3300_DX_EN, /* Enable power to lots of peripherals */ - GPIO_PP3300_LTE_EN, /* Enable LTE radio */ - GPIO_PP3300_WLAN_EN, /* Enable WiFi power */ - GPIO_SUSP_VR_EN, /* Enable 1.05V regulator */ - GPIO_VCORE_EN, /* Stuffing option - not connected */ - GPIO_PP5000_EN, /* Enable 5V supply */ - GPIO_SYS_PWROK, /* EC thinks everything is up and ready */ - GPIO_WLAN_OFF_L, /* Disable WiFi radio */ - GPIO_CHARGE_L, /* Allow battery to charge when on AC */ - - GPIO_ENABLE_BACKLIGHT, /* Enable backlight power */ - GPIO_ENABLE_TOUCHPAD, /* Enable touchpad power */ - GPIO_ENTERING_RW, /* Indicate when EC is entering RW code */ - GPIO_PCH_DPWROK, /* Indicate when VccDSW is good */ - - GPIO_PCH_HDA_SDO, /* HDA_SDO signal to PCH; when high, ME - * ignores security descriptor */ - GPIO_PCH_WAKE_L, /* Wake signal from EC to PCH */ - GPIO_PCH_NMI_L, /* Non-maskable interrupt pin to PCH */ - GPIO_PCH_PWRBTN_L, /* Power button output to PCH */ - GPIO_PCH_PWROK, /* PWROK / APWROK signals to PCH */ - GPIO_PCH_RCIN_L, /* RCIN# line to PCH (for 8042 emulation) */ - GPIO_PCH_RSMRST_L, /* Reset PCH resume power plane logic */ - GPIO_PCH_SMI_L, /* System management interrupt to PCH */ - GPIO_TOUCHSCREEN_RESET_L, /* Reset touch screen */ - GPIO_EC_EDP_VDD_EN, /* Enable EDP (passthru from PCH) */ - GPOI_LPC_CLKRUN_L, /* Dunno. Probably important, though. */ - - GPIO_USB1_ENABLE, /* USB port 1 output power enable */ - GPIO_USB2_ENABLE, /* USB port 2 output power enable */ - - GPIO_PCH_SUSACK_L, /* Acknowledge PCH SUSWARN# signal */ - GPIO_PCH_RTCRST_L, /* Not supposed to be here */ - GPIO_PCH_SRTCRST_L, /* Not supposed to be here */ - - GPIO_BAT_LED0_L, /* Battery charging LED - Blue */ - GPIO_BAT_LED1_L, /* Battery charging LED - Amber */ - GPIO_KB_LED_L, /* Keyboard LED */ - - /* Number of GPIOs; not an actual GPIO */ - GPIO_COUNT -}; - -/* x86 signal definitions */ -enum x86_signal { - X86_PGOOD_PP5000 = 0, - X86_PGOOD_PP1350, - X86_PGOOD_PP1050, - X86_PGOOD_VCORE, - X86_PCH_SLP_S0n_DEASSERTED, - X86_PCH_SLP_S3n_DEASSERTED, - X86_PCH_SLP_S5n_DEASSERTED, - X86_PCH_SLP_SUSn_DEASSERTED, - - /* Number of X86 signals */ - X86_SIGNAL_COUNT -}; - -/* Charger module */ -#define CONFIG_CHARGER_SENSE_RESISTOR 10 /* Charge sense resistor, mOhm */ -#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 /* Input sensor resistor, mOhm */ -#define CONFIG_CHARGER_INPUT_CURRENT 4032 /* mA, about half max */ - - -enum adc_channel { - /* EC internal die temperature in degrees K. */ - ADC_CH_EC_TEMP = 0, - - /* HEY: Be prepared to read this (ICMNT). */ - /* Charger current in mA. */ - ADC_CH_CHARGER_CURRENT, - - ADC_CH_COUNT -}; - -enum temp_sensor_id { - /* CPU die temperature via PECI */ - TEMP_SENSOR_CPU_PECI = 0, - /* EC internal temperature sensor */ - TEMP_SENSOR_EC_INTERNAL, - /* G781 internal and external sensors */ - TEMP_SENSOR_I2C_G781_INTERNAL, - TEMP_SENSOR_I2C_G781_EXTERNAL, - - TEMP_SENSOR_COUNT -}; - -/** - * Board-specific g781 power state. - */ -int board_g781_has_power(void); - -/* HEY: The below stuff is for Link. Pick a different pin for Slippy */ -/* Target value for BOOTCFG. This is set to PE2/USB1_CTL1, which has an external - * pullup. If this signal is pulled to ground when the EC boots, the EC will get - * into the boot loader and we can recover bricked EC. */ -#define BOOTCFG_VALUE 0x7fff88fe - -/* Wireless signals */ -#define WIRELESS_GPIO_WLAN GPIO_WLAN_OFF_L -#define WIRELESS_GPIO_WWAN GPIO_PP3300_LTE_EN -#define WIRELESS_GPIO_WLAN_POWER GPIO_PP3300_WLAN_EN - -/* Discharge battery when on AC power for factory test. */ -int board_discharge_on_ac(int enable); - -#endif /* !__ASSEMBLER__ */ - -#endif /* __BOARD_H */ diff --git a/board/leon/build.mk b/board/leon/build.mk deleted file mode 100644 index 1843369ed4..0000000000 --- a/board/leon/build.mk +++ /dev/null @@ -1,12 +0,0 @@ -# -*- makefile -*- -# Copyright (c) 2013 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 TI Stellaris LM4 -CHIP:=lm4 - -board-y=board.o diff --git a/board/leon/ec.tasklist b/board/leon/ec.tasklist deleted file mode 100644 index 40d5ec4f60..0000000000 --- a/board/leon/ec.tasklist +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (c) 2013 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' is the name of the task - * 'r' is the main routine of the task - * 'd' is 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, TASK_STACK_SIZE) \ - TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, LARGER_TASK_STACK_SIZE) \ - TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(THERMAL, thermal_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_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/common/battery_leon.c b/common/battery_leon.c deleted file mode 100644 index 9b64af2c30..0000000000 --- a/common/battery_leon.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright (c) 2012 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_pack.h" -#include "gpio.h" -#include "host_command.h" -#include "smart_battery.h" -#include "extpower.h" -#include "hooks.h" - -#define SB_SHIP_MODE_ADDR 0x35 -#define SB_SHIP_MODE_DATA 0x0004 -#define SB_SHIP_RESET_DATA 0x0003 - -/* FIXME: We need REAL values for all this stuff */ -const struct battery_temperature_ranges bat_temp_ranges = { - .start_charging_min_c = 0, - .start_charging_max_c = 50, - .charging_min_c = 0, - .charging_max_c = 50, - .discharging_min_c = -20, - .discharging_max_c = 60, -}; - -static const struct battery_info info = { - - .voltage_max = 16800, - .voltage_normal = 14800, - .voltage_min = 10800, - - /* Pre-charge values. */ - .precharge_current = 256, /* mA */ -}; - -const struct battery_info *battery_get_info(void) -{ - return &info; -} - -static void battery_leon_ac_change(void) -{ - if (extpower_is_present()) - sb_write(SB_SHIP_MODE_ADDR, SB_SHIP_RESET_DATA); -} -DECLARE_HOOK(HOOK_AC_CHANGE, battery_leon_ac_change, HOOK_PRIO_DEFAULT); - -int battery_command_cut_off(struct host_cmd_handler_args *args) -{ - return sb_write(SB_SHIP_MODE_ADDR, SB_SHIP_MODE_DATA); -} -DECLARE_HOST_COMMAND(EC_CMD_BATTERY_CUT_OFF, battery_command_cut_off, - EC_VER_MASK(0)); - -/* FIXME: The smart battery should do the right thing - that's why it's - * called "smart". Do we really want to second-guess it? For now, let's not. */ -void battery_vendor_params(struct batt_params *batt) -{ -} - -/** - * Physical detection of battery connection. - */ -int battery_is_connected(void) -{ - return (gpio_get_level(GPIO_BAT_DETECT_L) == 0); -} diff --git a/common/build.mk b/common/build.mk index f0e83c5087..0964540e9c 100644 --- a/common/build.mk +++ b/common/build.mk @@ -18,7 +18,6 @@ common-$(BOARD_peppy)+=battery_peppy.o led_common.o led_peppy.o common-$(BOARD_slippy)+=battery_slippy.o led_slippy.o common-$(BOARD_snow)+=extpower_snow.o common-$(BOARD_spring)+=battery_spring.o -common-$(BOARD_leon)+=battery_leon.o led_common.o led_leon.o common-$(CONFIG_BACKLIGHT_X86)+=backlight_x86.o common-$(CONFIG_BATTERY_BQ20Z453)+=battery_bq20z453.o diff --git a/common/led_leon.c b/common/led_leon.c deleted file mode 100644 index e937b459ed..0000000000 --- a/common/led_leon.c +++ /dev/null @@ -1,185 +0,0 @@ -/* Copyright (c) 2013 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 Leon. - */ - -#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 LED_TOTAL_TICKS 16 -#define LED_ON_TICKS 4 - -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 leon_led_set_bat_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 leon_led_set_kb_gpio(enum led_color color, - enum gpio_signal gpio_led_blue_l) -{ - switch (color) { - case LED_OFF: - gpio_set_level(gpio_led_blue_l, 1); - break; - case LED_BLUE: - gpio_set_level(gpio_led_blue_l, 0); - break; - default: - return EC_ERROR_UNKNOWN; - } - return EC_SUCCESS; -} - -static int leon_led_set_color_battery(enum led_color color) -{ - return leon_led_set_bat_gpio(color, GPIO_BAT_LED0_L, GPIO_BAT_LED1_L); -} - -static int leon_led_set_color_power(enum led_color color) -{ - return leon_led_set_kb_gpio(color, GPIO_KB_LED_L); -} - -static int leon_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 = leon_led_set_color_battery(color); - break; - case EC_LED_ID_POWER_LED: - rv = leon_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) - leon_led_set_color(led_id, LED_PINK); - else if (brightness[EC_LED_COLOR_BLUE] != 0) - leon_led_set_color(led_id, LED_BLUE); - else if (brightness[EC_LED_COLOR_YELLOW] != 0) - leon_led_set_color(led_id, LED_AMBER); - else - leon_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 leon_led_set_power(int ticks) -{ - if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) - leon_led_set_color_power(LED_OFF); - else if (chipset_in_state(CHIPSET_STATE_ON)) - leon_led_set_color_power(LED_BLUE); - else if (chipset_in_state(CHIPSET_STATE_SUSPEND)) - /* Blink once every four seconds. */ - leon_led_set_color_power( - (ticks % LED_TOTAL_TICKS < LED_ON_TICKS) ? - LED_AMBER : LED_OFF); -} - -static void leon_led_set_battery(int ticks) -{ - uint32_t chflags = charge_get_flags(); - - switch (charge_get_state()) { - case PWR_STATE_CHARGE: - leon_led_set_color_battery(LED_AMBER); - break; - case PWR_STATE_CHARGE_NEAR_FULL: - leon_led_set_color_battery(LED_BLUE); - break; - case PWR_STATE_DISCHARGE: - leon_led_set_color_battery(LED_OFF); - break; - case PWR_STATE_ERROR: - leon_led_set_color_battery( - (ticks & 0x2) ? LED_AMBER : LED_OFF); - break; - case PWR_STATE_IDLE: /* External power connected in IDLE. */ - if (chflags & CHARGE_FLAG_FORCE_IDLE) - leon_led_set_color_battery( - (ticks & 0x4) ? LED_BLUE : LED_OFF); - else - leon_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) -{ - static int ticks; - - ticks++; - - if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED)) - leon_led_set_power(ticks); - - if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) - leon_led_set_battery(ticks); -} -DECLARE_HOOK(HOOK_TICK, led_tick, HOOK_PRIO_DEFAULT); |