mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
oak: Enable TI OPT3001 ambient light sensor for rev5
Refer to commit 3f2dc44158,
enable light sensor driver for oak rev5
BUG=chrome-os-partner:50312
Change-Id: I896cf99fd781f5d4d8dad206d43f5a3d8faeb9a2
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/319271
Reviewed-by: Rong Chang <rongchang@chromium.org>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "adc.h"
|
||||
#include "adc_chip.h"
|
||||
#include "als.h"
|
||||
#include "atomic.h"
|
||||
#include "battery.h"
|
||||
#include "charge_manager.h"
|
||||
@@ -15,6 +16,7 @@
|
||||
#include "chipset.h"
|
||||
#include "common.h"
|
||||
#include "console.h"
|
||||
#include "driver/als_opt3001.h"
|
||||
#include "driver/temp_sensor/tmp432.h"
|
||||
#include "extpower.h"
|
||||
#include "gpio.h"
|
||||
@@ -134,6 +136,12 @@ const struct temp_sensor_t temp_sensors[] = {
|
||||
};
|
||||
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
|
||||
|
||||
/* ALS instances. Must be in same order as enum als_id. */
|
||||
struct als_t als[] = {
|
||||
{"TI", opt3001_init, opt3001_read_lux, 5},
|
||||
};
|
||||
BUILD_ASSERT(ARRAY_SIZE(als) == ALS_COUNT);
|
||||
|
||||
/* Thermal limits for each temp sensor. All temps are in degrees K. Must be in
|
||||
* same order as enum temp_sensor_id. To always ignore any temp, use 0.
|
||||
*/
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
|
||||
#define CONFIG_ADC
|
||||
#undef CONFIG_ADC_WATCHDOG
|
||||
|
||||
/* Add for Ambient Light Sensor */
|
||||
#define CONFIG_ALS
|
||||
#define CONFIG_ALS_OPT3001
|
||||
#define CONFIG_CMD_ALS
|
||||
|
||||
/* Add for AC adaptor, charger, battery */
|
||||
#define CONFIG_BATTERY_CUT_OFF
|
||||
#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BAT_PRESENT_L
|
||||
@@ -134,6 +140,10 @@
|
||||
#define I2C_PORT_PD_MCU 1
|
||||
#define I2C_PORT_USB_MUX 1
|
||||
#define I2C_PORT_TCPC 1
|
||||
#define I2C_PORT_ALS I2C_PORT_MASTER
|
||||
|
||||
/* Ambient Light Sensor address */
|
||||
#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1
|
||||
|
||||
/* Timer selection */
|
||||
#define TIM_CLOCK32 2
|
||||
@@ -182,6 +192,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
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#define CONFIG_TASK_LIST \
|
||||
TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
|
||||
TASK_VBUS(VBUS, vbus_task, NULL, 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) \
|
||||
|
||||
Reference in New Issue
Block a user