diff options
author | Ryan Zhang <Ryan.Zhang@quantatw.com> | 2015-12-02 21:22:38 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-12-03 02:21:53 -0800 |
commit | 25b573bdae39087b93481b29ca5d8c721f59608b (patch) | |
tree | 7ac9029148fdce2b91214f424fcafe3ee63af6a1 | |
parent | f184c0ba4b6df9df149aeb577f6dd9451ba83b3e (diff) | |
download | chrome-ec-25b573bdae39087b93481b29ca5d8c721f59608b.tar.gz |
Lars: Add ALS support
+ als settings
+ i2c ports for als
BUG=chrome-os-partner:48206
BRANCH=lars
TEST=`make BOARD=lars -j`, OS can boot up normally
Change-Id: I3a0cdf3f07b3b164fae8e393f86c1a2d0b4fc1da
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/315470
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r-- | board/lars/board.c | 11 | ||||
-rw-r--r-- | board/lars/board.h | 9 | ||||
-rw-r--r-- | board/lars/ec.tasklist | 1 | ||||
-rw-r--r-- | board/lars/gpio.inc | 10 |
4 files changed, 24 insertions, 7 deletions
diff --git a/board/lars/board.c b/board/lars/board.c index 4eaeb16e2f..5eaea71f36 100644 --- a/board/lars/board.c +++ b/board/lars/board.c @@ -5,10 +5,12 @@ /* Skylake Chrome Reference Design board-specific configuration */ #include "adc_chip.h" +#include "als.h" #include "charge_manager.h" #include "charge_state.h" #include "charger.h" #include "console.h" +#include "driver/als_isl29035.h" #include "driver/pmic_tps650830.h" #include "driver/temp_sensor/tmp432.h" #include "extpower.h" @@ -70,6 +72,12 @@ void usb0_evt(enum gpio_signal signal) #include "gpio_list.h" +/* ALS instances. Must be in same order as enum als_id. */ +struct als_t als[] = { + {"ISL", isl29035_init, isl29035_read_lux, 5}, +}; +BUILD_ASSERT(ARRAY_SIZE(als) == ALS_COUNT); + /* power signal list. Must match order of enum power_signal. */ const struct power_signal_info power_signal_list[] = { {GPIO_RSMRST_L_PGOOD, 1, "RSMRST_N_PWRGD"}, @@ -99,7 +107,8 @@ const struct i2c_port_t i2c_ports[] = { {"pmic", MEC1322_I2C0_0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA}, {"muxes", MEC1322_I2C0_1, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA}, {"pd_mcu", MEC1322_I2C1, 500, GPIO_I2C1_SCL, GPIO_I2C1_SDA}, - {"batt", MEC1322_I2C3, 100, GPIO_I2C3_SCL, GPIO_I2C3_SDA }, + {"sensor", MEC1322_I2C2, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA }, + {"batt", MEC1322_I2C3, 100, GPIO_I2C3_SCL, GPIO_I2C3_SDA }, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); diff --git a/board/lars/board.h b/board/lars/board.h index d338fe0463..97b981c712 100644 --- a/board/lars/board.h +++ b/board/lars/board.h @@ -10,6 +10,8 @@ /* Optional features */ #define CONFIG_ADC +#define CONFIG_ALS +#define CONFIG_ALS_ISL29035 #define CONFIG_BATTERY_CUT_OFF #define CONFIG_BATTERY_PRESENT_GPIO GPIO_BAT_PRESENT_L #define CONFIG_BATTERY_SMART @@ -107,6 +109,7 @@ #define I2C_PORT_USB_MUX MEC1322_I2C0_1 #define I2C_PORT_PD_MCU MEC1322_I2C1 #define I2C_PORT_TCPC MEC1322_I2C1 +#define I2C_PORT_ALS MEC1322_I2C2 #define I2C_PORT_BATTERY MEC1322_I2C3 #define I2C_PORT_CHARGER MEC1322_I2C3 #define I2C_PORT_THERMAL MEC1322_I2C3 @@ -141,6 +144,12 @@ enum adc_channel { ADC_CH_COUNT }; +/* Light sensors */ +enum als_id { + ALS_ISL29035 = 0, + ALS_COUNT, +}; + /* power signal definitions */ enum power_signal { X86_RSMRST_L_PWRGD = 0, diff --git a/board/lars/ec.tasklist b/board/lars/ec.tasklist index 803c0d4798..304a597f96 100644 --- a/board/lars/ec.tasklist +++ b/board/lars/ec.tasklist @@ -19,6 +19,7 @@ #define CONFIG_TASK_LIST \ TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \ + TASK_ALWAYS(ALS, als_task, NULL, TASK_STACK_SIZE) \ TASK_ALWAYS(USB_CHG_P0, usb_charger_task, NULL, TASK_STACK_SIZE) \ TASK_ALWAYS(CHARGER, charger_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \ diff --git a/board/lars/gpio.inc b/board/lars/gpio.inc index 923b051afa..cc7df2a161 100644 --- a/board/lars/gpio.inc +++ b/board/lars/gpio.inc @@ -76,8 +76,8 @@ GPIO(I2C0_1_SCL, PIN(134), GPIO_INPUT) GPIO(I2C0_1_SDA, PIN(17), GPIO_INPUT) GPIO(I2C1_SCL, PIN(22), GPIO_INPUT) GPIO(I2C1_SDA, PIN(23), GPIO_INPUT) -GPIO(NC_20, PIN(20), GPIO_INPUT | GPIO_PULL_UP) /* I2C2_SCL */ -GPIO(NC_21, PIN(21), GPIO_INPUT | GPIO_PULL_UP) /* I2C2_SDA */ +GPIO(I2C2_SCL, PIN(20), GPIO_INPUT) +GPIO(I2C2_SDA, PIN(21), GPIO_INPUT) GPIO(I2C3_SCL, PIN(24), GPIO_INPUT) GPIO(I2C3_SDA, PIN(25), GPIO_INPUT) @@ -149,10 +149,8 @@ ALTERNATE(PIN_MASK(6, 0x06), 1, MODULE_ADC, GPIO_ANALOG) /* I2C pins */ /* I2C0_0 CLK - GPIO015, I2C0_0 DAT - GPIO016, I2C0_1 DAT - GPIO017 */ ALTERNATE(PIN_MASK(1, 0xe0), 2, MODULE_I2C, GPIO_ODR_HIGH) -/* I2C{1,2,3} CLK / DAT - GPIO022-GPIO025*/ -ALTERNATE(PIN_MASK(2, 0x3c), 2, MODULE_I2C, GPIO_ODR_HIGH) -/* I2C{1,2,3} CLK / DAT - GPIO020, GPIO021*/ -//ALTERNATE(PIN_MASK(2, 0x03), 2, MODULE_I2C, GPIO_ODR_HIGH) /* preserve */ +/* I2C{1,2,3} CLK / DAT - GPIO020-GPIO025*/ +ALTERNATE(PIN_MASK(2, 0x3f), 2, MODULE_I2C, GPIO_ODR_HIGH) /* I2C0_1 CLK - GPIO134 */ ALTERNATE(PIN_MASK(13, 0x10), 2, MODULE_I2C, GPIO_ODR_HIGH) |