summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wang <chriswang@ami.com.tw>2017-02-17 21:50:58 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2017-02-22 01:55:10 +0000
commit5399a6245d2dc21c2234f0d908032ab7fa6ac6e7 (patch)
tree2fa462b83db8e41c1b5695881392f630ef904651
parent37e63bd63ed9156aa2e560f489099bd5e4ed7f4f (diff)
downloadchrome-ec-5399a6245d2dc21c2234f0d908032ab7fa6ac6e7.tar.gz
Wizpig: Disable Touch Screen and motion sensor for clamshell SKU
For support clamsehll sku (board id 101) Disable touch screen and motion sensor by board id detecting. BUG=chrome-os-partner:62214;chrome-os-partner:62907 BRANCH=firmware-strago-7287.B TEST=make buildall -j/Check motion sensor and touch screen function on clamshell SKU and covertiable SKU Signed-off-by: Chris Wang <chriswang@ami.com.tw> Change-Id: I92114558b1dcb0cc09561de78faace502d2e213d Reviewed-on: https://chromium-review.googlesource.com/444587 Tested-by: Chris Wang <chriswang@ami.com.tw> Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Chris Wang <chriswang@ami.com.tw>
-rw-r--r--board/wizpig/board.c50
-rw-r--r--board/wizpig/board.h1
2 files changed, 44 insertions, 7 deletions
diff --git a/board/wizpig/board.c b/board/wizpig/board.c
index 3451fe7dd6..18536ae5e8 100644
--- a/board/wizpig/board.c
+++ b/board/wizpig/board.c
@@ -31,13 +31,21 @@
#include "thermal.h"
#include "uart.h"
#include "util.h"
+#include "system.h"
#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP)
#define GPIO_KB_OUTPUT (GPIO_ODR_HIGH)
#define GPIO_KB_OUTPUT_COL2 (GPIO_OUT_LOW)
+#define BOARD_VERSION_CLAMSHELL 0x5
+
+#define CLAMSHELL_SKU 0
+#define CONVERTIBLE_SKU 1
+
#include "gpio_list.h"
+static uint8_t sku_type;
+
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
{0, PWM_CONFIG_ACTIVE_LOW},
@@ -204,7 +212,7 @@ struct motion_sensor_t motion_sensors[] = {
},
},
};
-const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
#ifdef CONFIG_LID_ANGLE_UPDATE
void lid_angle_peripheral_enable(int enable)
@@ -234,9 +242,11 @@ DECLARE_HOOK(HOOK_INIT, adc_pre_init, HOOK_PRIO_INIT_ADC - 1);
static void touch_screen_power_init(void)
{
/* Enable touch screen. */
- gpio_set_level(GPIO_TS_VDD_EN, 1);
- msleep(1);
- gpio_set_level(GPIO_TS_RST_L, 1);
+ if (sku_type == CONVERTIBLE_SKU) {
+ gpio_set_level(GPIO_TS_VDD_EN, 1);
+ msleep(1);
+ gpio_set_level(GPIO_TS_RST_L, 1);
+ }
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, touch_screen_power_init,
@@ -248,10 +258,36 @@ static void touch_screen_power_disable(void)
* Disable the load switch and hold touch screen in reset
* to reduce the power consumption.
*/
- gpio_set_level(GPIO_TS_VDD_EN, 0);
- usleep(10);
- gpio_set_level(GPIO_TS_RST_L, 0);
+ if (sku_type == CONVERTIBLE_SKU) {
+ gpio_set_level(GPIO_TS_VDD_EN, 0);
+ usleep(10);
+ gpio_set_level(GPIO_TS_RST_L, 0);
+ }
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, touch_screen_power_disable,
HOOK_PRIO_DEFAULT);
+
+static void get_sku_version(void)
+{
+ /*
+ * clamshell sku :0 (board id : 101b)
+ *
+ * convertible sku : 1
+ */
+ if (BOARD_VERSION_CLAMSHELL == system_get_board_version())
+ sku_type = CLAMSHELL_SKU;
+ else
+ sku_type = CONVERTIBLE_SKU;
+
+}
+DECLARE_HOOK(HOOK_INIT, get_sku_version, HOOK_PRIO_FIRST);
+
+static void get_motion_sensors_count(void)
+{
+ if (sku_type == CONVERTIBLE_SKU)
+ motion_sensor_count = ARRAY_SIZE(motion_sensors);
+ else
+ motion_sensor_count = 0;
+}
+DECLARE_HOOK(HOOK_INIT, get_motion_sensors_count, HOOK_PRIO_FIRST + 1);
diff --git a/board/wizpig/board.h b/board/wizpig/board.h
index a366715db3..d9f4f5ec50 100644
--- a/board/wizpig/board.h
+++ b/board/wizpig/board.h
@@ -88,6 +88,7 @@
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
+#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
/* Wireless signals */
#define WIRELESS_GPIO_WLAN GPIO_WLAN_OFF_L