als: Define CONFIG_ALS when HAS_TASK_ALS is present.

For oak, set a different list of task (no als, no accel) for compiling
revision 4 or less. Fix GPIO include issue.

BUG=chrome-os-partner:59423,chrome-os-partner:59084
TEST=compile for oak with board 4 and 5, tested on Reef.
BRANCH=kevin,reef

Change-Id: I09051a69cbad6d477a7b3bf9907f4c5c144b5136
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/424220
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Gwendal Grignou
2016-12-28 12:38:02 -08:00
committed by chrome-bot
parent c5358465b8
commit d5bd0bd0f6
15 changed files with 35 additions and 27 deletions

View File

@@ -93,7 +93,6 @@
/* Sensor */
#define CONFIG_ACCEL_KXCJ9
#define CONFIG_ALS
#define CONFIG_ALS_ISL29035
#define CONFIG_TEMP_SENSOR
#define CONFIG_TEMP_SENSOR_BD99992GW

View File

@@ -18,7 +18,6 @@
#define CONFIG_ACCELGYRO_BMI160
#define CONFIG_ACCEL_KX022
#define CONFIG_ADC
#define CONFIG_ALS
#define CONFIG_ALS_OPT3001
#define CONFIG_BATTERY_CUT_OFF
#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BAT_PRESENT_L

View File

@@ -92,7 +92,6 @@
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
#ifdef BOARD_GRU
#define CONFIG_ALS
#define CONFIG_ALS_OPT3001
#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1
#define CONFIG_BARO_BMP280

View File

@@ -152,7 +152,7 @@ const struct temp_sensor_t temp_sensors[] = {
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
#ifdef CONFIG_ALS
#ifdef HAS_TASK_ALS
/* ALS instances. Must be in same order as enum als_id. */
struct als_t als[] = {
{"TI", opt3001_init, opt3001_read_lux, 5},
@@ -550,14 +550,6 @@ void vbus_task(void)
}
#endif /* BOARD_REV < OAK_REV4 */
#ifndef CONFIG_ALS
void als_task(void)
{
while (1)
task_wait_event(-1);
}
#endif
#ifdef CONFIG_TEMP_SENSOR_TMP432
static void tmp432_set_power_deferred(void)
{

View File

@@ -23,7 +23,6 @@
#if BOARD_REV >= OAK_REV5
/* Add for Ambient Light Sensor */
#define CONFIG_ALS
#define CONFIG_ALS_OPT3001
#define CONFIG_CMD_ALS
#endif
@@ -69,6 +68,10 @@
#define CONFIG_HIBERNATE_WAKEUP_PINS (STM32_PWR_CSR_EWUP6)
#else
#define CONFIG_HIBERNATE_WAKEUP_PINS (STM32_PWR_CSR_EWUP1)
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_SENSOR_BASE 0
#define CONFIG_LID_ANGLE_SENSOR_LID 2
#define CONFIG_LID_ANGLE_UPDATE
#endif /* BOARD_REV */
#define CONFIG_HOST_COMMAND_STATUS
#define CONFIG_HOSTCMD_PD
@@ -78,10 +81,6 @@
#define CONFIG_KEYBOARD_COL2_INVERTED
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_LED_COMMON
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_SENSOR_BASE 0
#define CONFIG_LID_ANGLE_SENSOR_LID 2
#define CONFIG_LID_ANGLE_UPDATE
#define CONFIG_LID_SWITCH
#define CONFIG_LOW_POWER_IDLE
#define CONFIG_MKBP_EVENT

View File

@@ -16,6 +16,10 @@
* 'd' in an opaque parameter passed to the routine at startup
* 's' is the stack size in bytes; must be a multiple of 8
*/
#include "board_revs.h"
#if BOARD_REV >= OAK_REV5
#define CONFIG_TASK_LIST \
TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
@@ -32,3 +36,21 @@
TASK_NOTEST(MOTIONSENSE, motion_sense_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(PD_C1, pd_task, NULL, LARGER_TASK_STACK_SIZE)
#else /* BOARD_REV >= OAK_REV5 */
#define CONFIG_TASK_LIST \
TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(VBUS, vbus_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) \
TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_NOTEST(PDCMD, pd_command_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(HOSTCMD, host_command_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(PD_C1, pd_task, NULL, LARGER_TASK_STACK_SIZE)
#endif /* BOARD_REV >= OAK_REV5 */

View File

@@ -174,6 +174,9 @@ GPIO(USB_C0_DEVMODE_L, PIN(E, 4), GPIO_OUT_HIGH) /* set HSD2 (host mode) pat
GPIO(USB_C1_DEVMODE, PIN(E, 2), GPIO_OUT_LOW) /* set HSD1 (host mode) path as default */
#else /* >= OAK_REV5 */
GPIO(LEVEL_SHIFT_EN_L, PIN(F, 10), GPIO_OUT_LOW) /* LID/AC level shift */
/* SPI MASTER. For SPI sensor */
GPIO(SPI2_NSS, PIN(D, 0), GPIO_OUT_LOW)
#endif
GPIO(USB_PD_RST_L, PIN(A, 15), GPIO_OUT_HIGH) /* PD reset */
GPIO(USB_C0_5V_EN, PIN(D, 8), GPIO_OUT_LOW) /* USBC port 0 5V */
@@ -202,9 +205,6 @@ GPIO(I2C0_SDA, PIN(B, 7), GPIO_INPUT)
GPIO(I2C1_SCL, PIN(B, 13), GPIO_INPUT) /* PD I2C */
GPIO(I2C1_SDA, PIN(B, 14), GPIO_INPUT)
/* SPI MASTER. For SPI sensor */
GPIO(SPI2_NSS, PIN(D, 0), GPIO_OUT_LOW)
ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, 0) /* USART1: PA9/PA10 */
ALTERNATE(PIN_MASK(B, 0x00c0), 1, MODULE_I2C, 0) /* I2C MASTER:PB6/7 */
ALTERNATE(PIN_MASK(B, 0x6000), 5, MODULE_I2C, 0) /* I2C MASTER:PB13/14 */

View File

@@ -191,7 +191,6 @@
#define BMM150_I2C_ADDRESS BMM150_ADDR0 /* 8-bit address */
#define CONFIG_MAG_CALIBRATE
#define CONFIG_ACCEL_KX022
#define CONFIG_ALS
#define CONFIG_ALS_OPT3001
#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1
#define CONFIG_BARO_BMP280

View File

@@ -192,7 +192,6 @@
#define BMM150_I2C_ADDRESS BMM150_ADDR0 /* 8-bit address */
#define CONFIG_MAG_CALIBRATE
#define CONFIG_ACCEL_KX022
#define CONFIG_ALS
#define CONFIG_ALS_OPT3001
#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1
#define CONFIG_BARO_BMP280

View File

@@ -18,7 +18,6 @@
#define CONFIG_ACCELGYRO_LSM6DS0
#define CONFIG_ACCEL_KXCJ9
#define CONFIG_ACCEL_STD_REF_FRAME_OLD
#define CONFIG_ALS
#define CONFIG_ALS_ISL29035
#define CONFIG_BOARD_VERSION
#define CONFIG_CMD_ACCELS

View File

@@ -190,7 +190,6 @@
#define BMM150_I2C_ADDRESS BMM150_ADDR0 /* 8-bit address */
#define CONFIG_MAG_CALIBRATE
#define CONFIG_ACCEL_KX022
#define CONFIG_ALS
#define CONFIG_ALS_OPT3001
#define OPT3001_I2C_ADDR OPT3001_I2C_ADDR1
#define CONFIG_BARO_BMP280

View File

@@ -64,7 +64,6 @@
#define CONFIG_PMIC
#define CONFIG_ALS
#define CONFIG_ALS_ISL29035
#define CONFIG_BATTERY_CUT_OFF
#define CONFIG_BATTERY_SMART

View File

@@ -12,7 +12,6 @@
#define CONFIG_ACCELGYRO_BMI160
#define CONFIG_ACCEL_KX022
#define CONFIG_ADC
#define CONFIG_ALS
#define CONFIG_ALS_OPT3001
#define CONFIG_BATTERY_CUT_OFF
#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BAT_PRESENT_L

View File

@@ -16,7 +16,7 @@ common-$(CONFIG_ACCELGYRO_LSM6DSM)+=math_util.o
common-$(CONFIG_ACCEL_KXCJ9)+=math_util.o
common-$(CONFIG_ACCEL_KX022)+=math_util.o
common-$(CONFIG_ADC)+=adc.o
common-$(CONFIG_ALS)+=als.o
common-$(HAS_TASK_ALS)+=als.o
common-$(CONFIG_AP_HANG_DETECT)+=ap_hang_detect.o
common-$(CONFIG_BACKLIGHT_LID)+=backlight_lid.o
# TODO(crosbug.com/p/23821): Why do these include battery_common but

View File

@@ -114,7 +114,11 @@
* Some ALS modules may be connected to the EC. We need the command, and
* specific drivers for each module.
*/
#ifdef HAS_TASK_ALS
#define CONFIG_ALS
#else
#undef CONFIG_ALS
#endif
#undef CONFIG_ALS_AL3010
#undef CONFIG_ALS_ISL29035
#undef CONFIG_ALS_OPT3001