glados: Enable TI OPT3001 ambient light sensor

Enable the light sensor driver for glados so it can be exported
to the host via ACPI.

BUG=chrome-os-partner:43493
BRANCH=none
TEST=enable ACPI ALS interface on glados in BIOS and kernel and
check that light sensor values can be read by the OS.

Change-Id: I813e8cae830832a1ef582b2821f1338e3c1b289b
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/298158
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Duncan Laurie
2015-09-09 09:53:07 -07:00
committed by chrome-bot
parent 2a16019d54
commit 3f2dc44158
3 changed files with 21 additions and 0 deletions

View File

@@ -6,6 +6,7 @@
/* Glados board-specific configuration */
#include "adc_chip.h"
#include "als.h"
#include "bd99992gw.h"
#include "button.h"
#include "charge_manager.h"
@@ -13,6 +14,7 @@
#include "charger.h"
#include "chipset.h"
#include "console.h"
#include "driver/als_opt3001.h"
#include "extpower.h"
#include "gpio.h"
#include "hooks.h"
@@ -199,6 +201,12 @@ struct ec_thermal_config thermal_params[] = {
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
/* ALS instances. Must be in same order as enum als_id. */
struct als_t als[] = {
{"TI", opt3001_read_lux, 5},
};
BUILD_ASSERT(ARRAY_SIZE(als) == ALS_COUNT);
const struct button_config buttons[CONFIG_BUTTON_COUNT] = {
{ 0 },
{ 0 },

View File

@@ -10,6 +10,8 @@
/* Optional features */
#define CONFIG_ADC
#define CONFIG_ALS
#define CONFIG_ALS_OPT3001
#define CONFIG_BATTERY_CUT_OFF
#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BAT_PRESENT_L
#define CONFIG_BATTERY_SMART
@@ -105,6 +107,9 @@
/* Thermal sensors read through PMIC ADC interface */
#define I2C_PORT_THERMAL I2C_PORT_PMIC
/* Ambient Light Sensor address */
#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1
/* Modules we want to exclude */
#undef CONFIG_CMD_HASH
#undef CONFIG_CMD_I2C_SCAN
@@ -156,6 +161,13 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
/* Light sensors */
enum als_id {
ALS_OPT3001 = 0,
ALS_COUNT
};
/* start as a sink in case we have no other power supply/battery */
#define PD_DEFAULT_STATE PD_STATE_SNK_DISCONNECTED

View File

@@ -18,6 +18,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(USB_CHG_P1, usb_charger_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(CHARGER, charger_task, NULL, LARGER_TASK_STACK_SIZE) \