diff options
author | Bill Richardson <wfrichar@chromium.org> | 2013-10-03 13:10:21 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-10-04 20:04:44 +0000 |
commit | 9af47b787c71e05a0c53e5c2f87b2fb1ce6c7ed2 (patch) | |
tree | 18367ae2dd4d4be15c95ec435ba4278666dcb474 | |
parent | ab55db590cd4692ee4968e2ba446b78b646bd1fe (diff) | |
download | chrome-ec-9af47b787c71e05a0c53e5c2f87b2fb1ce6c7ed2.tar.gz |
samus: alternate functions, charger
Adding some more board-specific configurations for Samus.
BUG=chrome-os-partner:22870
BRANCH=none
TEST=manual
make runtests
Change-Id: I86c909e899fb5bdb6ba75f476ced58bae2c75c29
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/171809
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | board/samus/board.c | 23 | ||||
-rw-r--r-- | board/samus/board.h | 8 | ||||
-rw-r--r-- | common/charger_bq24715.c | 22 |
3 files changed, 38 insertions, 15 deletions
diff --git a/board/samus/board.c b/board/samus/board.c index 2126364367..4871bb0f10 100644 --- a/board/samus/board.c +++ b/board/samus/board.c @@ -108,8 +108,9 @@ const struct gpio_info gpio_list[] = { {"PCH_SYS_RST_L", LM4_GPIO_F, (1<<1), GPIO_ODR_HIGH, 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}, - +#ifndef HEY_USE_BUILTIN_CLKRUN {"LPC_CLKRUN_L", LM4_GPIO_M, (1<<2), GPIO_ODR_HIGH, NULL}, +#endif {"USB1_CTL1", LM4_GPIO_E, (1<<1), GPIO_OUT_LOW, NULL}, {"USB1_CTL2", LM4_GPIO_E, (1<<2), GPIO_OUT_HIGH, NULL}, {"USB1_CTL3", LM4_GPIO_E, (1<<3), GPIO_OUT_LOW, NULL}, @@ -137,8 +138,11 @@ const struct gpio_alt_func gpio_alt_funcs[] = { {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 */ - {GPIO_N, 0x40, 1, MODULE_PWM_KBLIGHT}, /* Fan1 PWM */ +#ifdef HEY_USE_BUILTIN_CLKRUN + {GPIO_M, 0x04, 15, MODULE_LPC, GPIO_OPEN_DRAIN},/* LPC */ +#endif + {GPIO_N, 0x3c, 1, MODULE_PWM_FAN}, /* Fan0PWM/TACH 2&3 */ + {GPIO_N, 0x40, 1, MODULE_PWM_KBLIGHT}, /* Fan1PWM4 */ }; const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs); @@ -165,14 +169,13 @@ const struct adc_t adc_channels[] = { {"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 + /* We're measuring the adapter input current through a 0.01-ohm + * resistor (ACP/ACN). IOUT is 40X the differential voltage, so + * 1000mA => 400mV. ADC returns 0x000-0xFFF over 0.0-3.3V. + * mA = 1000 * ADC_VALUE / ADC_READ_MAX * 3.3(V) * 100(R) / 40(gain) */ - {"ChargerCurrent", LM4_ADC_SEQ1, 33000, ADC_READ_MAX * 2, 0, - LM4_AIN(0), 0x06 /* IE0 | END0 */, LM4_GPIO_E, (1<<3)}, + {"ChargerCurrent", LM4_ADC_SEQ1, 33000, ADC_READ_MAX * 4, 0, + LM4_AIN(11), 0x06 /* IE0 | END0 */, LM4_GPIO_B, (1<<5)}, }; BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); diff --git a/board/samus/board.h b/board/samus/board.h index 936aecd363..f9d6114653 100644 --- a/board/samus/board.h +++ b/board/samus/board.h @@ -12,6 +12,8 @@ #define CONFIG_CONSOLE_CMDHELP #define CONFIG_TASK_PROFILING +#define HEY_USE_BUILTIN_CLKRUN + /* Optional features */ #define CONFIG_BOARD_VERSION #define CONFIG_CHIPSET_X86 @@ -32,7 +34,7 @@ /* 10mOhm sense resitors. */ #define CONFIG_CHARGER_SENSE_RESISTOR 10 #define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 -/* External Charger maximum current. */ +/* HEY: what value for External Charger maximum current? */ #define CONFIG_CHARGER_INPUT_CURRENT 5000 #define CONFIG_FAN #define CONFIG_FAN_CH_CPU 2 @@ -137,8 +139,9 @@ enum gpio_signal { GPIO_PCH_SYS_RST_L, /* Reset PCH resume power plane logic */ GPIO_PCH_SMI_L, /* System management interrupt to PCH */ GPIO_TOUCHSCREEN_RESET_L, /* Reset touch screen */ +#ifndef HEY_USE_BUILTIN_CLKRUN GPIO_LPC_CLKRUN_L, /* Dunno. Probably important, though. */ - +#endif GPIO_USB1_CTL1, /* USB charger port 1 CTL1 output */ GPIO_USB1_CTL2, /* USB charger port 1 CTL2 output */ GPIO_USB1_CTL3, /* USB charger port 1 CTL3 output */ @@ -174,7 +177,6 @@ enum x86_signal { enum adc_channel { /* EC internal die temperature in degrees K. */ ADC_CH_EC_TEMP = 0, - /* Charger current in mA. */ ADC_CH_CHARGER_CURRENT, diff --git a/common/charger_bq24715.c b/common/charger_bq24715.c index 56e8b6ee34..7ee2ebf70e 100644 --- a/common/charger_bq24715.c +++ b/common/charger_bq24715.c @@ -169,6 +169,24 @@ int charger_set_voltage(int voltage) /* Charging power state initialization */ int charger_post_init(void) { - /* Set charger input current limit */ - return charger_set_input_current(CONFIG_CHARGER_INPUT_CURRENT); + int rv; + int option; + + rv = charger_get_option(&option); + if (rv) + return rv; + + /* Don't be noisy */ + option |= OPT_AUDIO_FREQ_40KHZ_LIMIT; + + /* Always monitor adapter current (40X multiplier). */ + option |= OPT_FIX_IOUT_ALWAYS; + option &= ~OPT_IOUT_MASK; + + rv = charger_set_option(option); + if (rv) + return rv; + + rv = charger_set_input_current(CONFIG_CHARGER_INPUT_CURRENT); + return rv; } |