diff options
author | Hsu Henry <Henry.Hsu@quantatw.com> | 2013-07-31 11:28:56 +0800 |
---|---|---|
committer | Dave Parker <dparker@chromium.org> | 2013-08-09 23:38:30 -0700 |
commit | 3d3607034423fe180e0a7413b8d4183abac7664d (patch) | |
tree | 751c4a379fd119397526522a24dcc0fd47f70b6c | |
parent | 8369aec28c50499afb3b73dc95c14db7985e8931 (diff) | |
download | chrome-ec-3d3607034423fe180e0a7413b8d4183abac7664d.tar.gz |
CHERRY-PICK:Update Wolf from Slippy.
Copy from Slippy and Delete BAT_DETECT_L and related functions.
(create new file battery_wolf.c)
BRANCH=wolf
BUG=none
TEST=manual
Build it with util/make_all.sh, seems fine.
Change-Id: I061a49a3683f9b68f558b7ec4753432a7ffa83ad
Original-Change-Id: I672147c45e14d03c7f4cf8ecc6daa3f889f97c05
Signed-off-by: Hsu Henry <Henry.Hsu@quantatw.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/63872
Reviewed-by: Dave Parker <dparker@chromium.org>
Tested-by: Dave Parker <dparker@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65451
-rw-r--r-- | board/wolf/board.c | 15 | ||||
-rw-r--r-- | board/wolf/board.h | 29 | ||||
-rw-r--r-- | board/wolf/ec.tasklist | 2 | ||||
-rw-r--r-- | common/battery_wolf.c | 42 | ||||
-rw-r--r-- | common/build.mk | 1 |
5 files changed, 78 insertions, 11 deletions
diff --git a/board/wolf/board.c b/board/wolf/board.c index 887ce30cc6..cd6cc1462a 100644 --- a/board/wolf/board.c +++ b/board/wolf/board.c @@ -23,6 +23,7 @@ #include "registers.h" #include "switch.h" #include "temp_sensor.h" +#include "temp_sensor_g781.h" #include "timer.h" #include "util.h" @@ -181,9 +182,10 @@ 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[] = { -/* HEY: Need correct I2C addresses and read function for external sensor */ - {"ECInternal", TEMP_SENSOR_TYPE_BOARD, chip_temp_sensor_get_val, 0, 4}, {"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, 0, 4}, + {"G781External", TEMP_SENSOR_TYPE_BOARD, g781_get_val, 1, 4}, }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); @@ -216,3 +218,12 @@ void board_process_wake_events(uint32_t active_wake_events) 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); +} + diff --git a/board/wolf/board.h b/board/wolf/board.h index ef04274398..5b208bd50c 100644 --- a/board/wolf/board.h +++ b/board/wolf/board.h @@ -10,6 +10,10 @@ /* Optional features */ #define CONFIG_BACKLIGHT_X86 +#define CONFIG_BATTERY_SMART +#define CONFIG_BOARD_VERSION +#define CONFIG_CHARGER +#define CONFIG_CHARGER_BQ24707A #define CONFIG_CHIPSET_HASWELL #define CONFIG_CHIPSET_X86 #define CONFIG_EXTPOWER_GPIO @@ -20,6 +24,7 @@ #define CONFIG_PWM_FAN #define CONFIG_TEMP_SENSOR #define CONFIG_UART_HOST 2 +#define CONFIG_TEMP_SENSOR_G781 #define CONFIG_USB_PORT_POWER_DUMB #define CONFIG_WIRELESS @@ -124,8 +129,8 @@ enum gpio_signal { GPIO_PCH_RTCRST_L, /* Not supposed to be here */ GPIO_PCH_SRTCRST_L, /* Not supposed to be here */ - BAT_LED0_L, /* Battery charging LED - Blue */ - BAT_LED1_L, /* Battery charging LED - Amber */ + GPIO_BAT_LED0_L, /* Battery charging LED - Blue */ + GPIO_BAT_LED1_L, /* Battery charging LED - Amber */ /* Number of GPIOs; not an actual GPIO */ GPIO_COUNT @@ -149,11 +154,13 @@ enum x86_signal { /* 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 3078 /* mA, 90% of a 65W adapter at 19V */ +/*FIXME needed to be checked, use the same as Peppy*/ +#define CONFIG_CHARGER_INPUT_CURRENT 3078 /* mA, need be checked */ 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, @@ -162,17 +169,22 @@ enum adc_channel { }; enum temp_sensor_id { - /* HEY - need two I2C sensor values, and PECI should really be first */ - + /* CPU die temperature via PECI */ + TEMP_SENSOR_CPU_PECI = 0, /* EC internal temperature sensor */ TEMP_SENSOR_EC_INTERNAL, - /* CPU die temperature via PECI */ - TEMP_SENSOR_CPU_PECI, + /* G781 internal and external sensors */ + TEMP_SENSOR_I2C_G781_INTERNAL, + TEMP_SENSOR_I2C_G781_EXTERNAL, TEMP_SENSOR_COUNT }; -/* HEY: The below stuff is for Link. Pick a different pin for Wolf */ +/** + * Board-specific g781 power state. + */ +int board_g781_has_power(void); + /* 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. */ @@ -183,6 +195,7 @@ enum temp_sensor_id { #define WIRELESS_GPIO_WWAN GPIO_PP3300_LTE_EN #define WIRELESS_GPIO_WLAN_POWER GPIO_PP3300_WLAN_EN + #endif /* !__ASSEMBLER__ */ #endif /* __BOARD_H */ diff --git a/board/wolf/ec.tasklist b/board/wolf/ec.tasklist index 848b56830c..40d5ec4f60 100644 --- a/board/wolf/ec.tasklist +++ b/board/wolf/ec.tasklist @@ -19,7 +19,7 @@ #define CONFIG_TASK_LIST \ TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \ TASK_NOTEST(VBOOTHASH, vboot_hash_task, NULL, LARGER_TASK_STACK_SIZE) \ - /* HEY: TASK_ALWAYS(CHARGER, charger_task, NULL, 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) \ diff --git a/common/battery_wolf.c b/common/battery_wolf.c new file mode 100644 index 0000000000..6ae9506aad --- /dev/null +++ b/common/battery_wolf.c @@ -0,0 +1,42 @@ +/* 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" + +/* 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 = { +/* Based on 3S1P, same as peppy */ + + .voltage_max = 12600, + .voltage_normal = 11100, + .voltage_min = 9000, + + /* Pre-charge values. */ + .precharge_current = 256, /* mA */ +}; + +const struct battery_info *battery_get_info(void) +{ + return &info; +} + +/* 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) +{ +} + diff --git a/common/build.mk b/common/build.mk index 547aed605a..86742794f9 100644 --- a/common/build.mk +++ b/common/build.mk @@ -18,6 +18,7 @@ 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_wolf)+=battery_wolf.o led_slippy.o common-$(CONFIG_BACKLIGHT_X86)+=backlight_x86.o common-$(CONFIG_BATTERY_BQ20Z453)+=battery_bq20z453.o |