summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJongpil Jung <jongpil19.jung@samsung.com>2017-11-29 18:46:35 +0900
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2017-12-09 00:06:04 +0000
commitbf293e592adc328e4a169aba3f3f6e985154bc0f (patch)
tree9c1e7bfbd09fd8402d6198e64af5c597835dd718
parent8a436472b78b732c837d878527ce50927b5c5460 (diff)
downloadchrome-ec-bf293e592adc328e4a169aba3f3f6e985154bc0f.tar.gz
caroline: enable/disable als and kblight as boardid.
We want to enable/disable als and keyboard backlight as board id on caroline. BRANCH=firmware-glados-7820.B BUG=b:65567128 TEST=emerge-caroline chromeos-ec flash ec on caroline on rev5 and rev6. Check ALS and Keyboard backlight function. Change-Id: I016fffa30399ebcc3fe8ed92d603fc6abf0092b6 Signed-off-by: Jongpil Jung <jongpil19.jung@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/795617 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/caroline/board.c26
-rw-r--r--board/caroline/board.h1
2 files changed, 27 insertions, 0 deletions
diff --git a/board/caroline/board.c b/board/caroline/board.c
index 5a2496196b..cab2a6aa49 100644
--- a/board/caroline/board.c
+++ b/board/caroline/board.c
@@ -169,6 +169,8 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = {
}
};
+static int cached_board_id;
+
/**
* Reset PD MCU
*/
@@ -275,6 +277,21 @@ static void board_init(void)
/* Provide AC status to the PCH */
gpio_set_level(GPIO_PCH_ACOK, extpower_is_present());
+
+ cached_board_id = system_get_board_version();
+
+ /*
+ * If board id is lower than 6 and we define ALS in build stage
+ * Disable ALS.
+ * LID_ALS : als sensor index is the last of motion_sensors.
+ */
+#ifdef CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
+ if (cached_board_id < 6)
+ motion_sensor_count -= 1;
+#else
+ /* In case of Caroline, we have to enable ALS motion seneor dynamically. */
+#error "Need to define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT on caroline."
+#endif
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -641,7 +658,12 @@ struct motion_sensor_t motion_sensors[] = {
},
},
};
+
+#ifdef CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
+unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+#else
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+#endif
/* ALS instances when LPC mapping is needed. Each entry directs to a sensor. */
const struct motion_sensor_t *motion_als_sensors[] = {
@@ -745,6 +767,8 @@ void chipset_set_pmic_slp_sus_l(int level)
static void kblight_enable(void)
{
+ if(cached_board_id < 6)
+ return;
gpio_set_level(GPIO_KBDBKLIT_RST_L, 1);
msleep(10);
max14521_init();
@@ -753,6 +777,8 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, kblight_enable, HOOK_PRIO_DEFAULT);
static void kblight_disable(void)
{
+ if(cached_board_id < 6)
+ return;
gpio_set_level(GPIO_KBDBKLIT_RST_L, 0);
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, kblight_disable, HOOK_PRIO_DEFAULT);
diff --git a/board/caroline/board.h b/board/caroline/board.h
index 3318e9354b..080cf904c7 100644
--- a/board/caroline/board.h
+++ b/board/caroline/board.h
@@ -56,6 +56,7 @@
#define CONFIG_CLOCK_CRYSTAL
#define CONFIG_DEBUG_ASSERT_BRIEF
#define CONFIG_DPTF_DEVICE_ORIENTATION
+#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
#define CONFIG_EXTPOWER_GPIO
#define CONFIG_HOSTCMD_ALIGNED
#define CONFIG_HOSTCMD_PD