summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kuo <tedkuo@ami.com.tw>2015-06-24 10:45:30 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-25 01:04:37 +0000
commit247ca1c861392358ae38d4c3f9e31d9016078037 (patch)
tree9d5444c56b89df6b7b5026f4084fa7993822bb7a
parent3f84e2fda2cc3922313d0fd653a597ea77c3fa38 (diff)
downloadchrome-ec-247ca1c861392358ae38d4c3f9e31d9016078037.tar.gz
Sumo: Implement brightness buttons
Add brightness up/down button to control display panel backlight. BUG=chrome-os-partner:39182 TEST=make -j buildall, verified BRANCH=None Signed-off-by: Ted Kuo <tedkuo@ami.com.tw> Change-Id: I02c8d273c60bcb50c76ee9e3d20c8b544638556d Reviewed-on: https://chromium-review.googlesource.com/281490 Reviewed-by: Mohammed Habibulla <moch@chromium.org> Commit-Queue: Ted Kuo <tedkuo@ami.com.tw> Tested-by: Ted Kuo <tedkuo@ami.com.tw>
-rw-r--r--board/sumo/board.c13
-rw-r--r--board/sumo/board.h3
-rw-r--r--common/keyboard_8042.c2
-rw-r--r--include/button.h2
4 files changed, 20 insertions, 0 deletions
diff --git a/board/sumo/board.c b/board/sumo/board.c
index 455f5c1fa3..2d8bdc1bcc 100644
--- a/board/sumo/board.c
+++ b/board/sumo/board.c
@@ -7,6 +7,7 @@
#include "adc.h"
#include "adc_chip.h"
#include "backlight.h"
+#include "button.h"
#include "charge_state.h"
#include "charger.h"
#include "common.h"
@@ -66,6 +67,10 @@ const struct gpio_info gpio_list[] = {
{"UART0_RX", LM4_GPIO_A, (1<<0), GPIO_INT_BOTH_DSLEEP |
GPIO_PULL_UP,
uart_deepsleep_interrupt},
+ {"BUTTON_BRIGHTNESS_DOWN_L", LM4_GPIO_M, (1<<6), GPIO_INT_BOTH,
+ button_interrupt},
+ {"BUTTON_BRIGHTNESS_UP_L", LM4_GPIO_J, (1<<5), GPIO_INT_BOTH,
+ button_interrupt},
/* Other inputs */
{"BOARD_VERSION1", LM4_GPIO_Q, (1<<5), GPIO_INPUT, NULL},
@@ -196,3 +201,11 @@ struct ec_thermal_config thermal_params[] = {
{{0, 0, 0}, 0, 0},
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
+
+const struct button_config buttons[] = {
+ {"Brightness Down", KEYBOARD_BUTTON_BRIGHTNESS_DOWN,
+ GPIO_BUTTON_BRIGHTNESS_DOWN_L, 30 * MSEC, 0},
+ {"Brightness Up", KEYBOARD_BUTTON_BRIGHTNESS_UP,
+ GPIO_BUTTON_BRIGHTNESS_UP_L, 30 * MSEC, 0},
+};
+BUILD_ASSERT(ARRAY_SIZE(buttons) == CONFIG_BUTTON_COUNT);
diff --git a/board/sumo/board.h b/board/sumo/board.h
index 9071991087..553bcbdb9c 100644
--- a/board/sumo/board.h
+++ b/board/sumo/board.h
@@ -12,6 +12,7 @@
#define CONFIG_AP_HANG_DETECT
#define CONFIG_BACKLIGHT_LID
#define CONFIG_BOARD_VERSION
+#define CONFIG_BUTTON_COUNT 2
#define CONFIG_CHIPSET_BAYTRAIL
#define CONFIG_CHIPSET_CAN_THROTTLE
#define CONFIG_CHIPSET_X86
@@ -78,6 +79,8 @@ enum gpio_signal {
GPIO_WP_L, /* Write protect input */
GPIO_JTAG_TCK, /* JTAG clock input */
GPIO_UART0_RX, /* UART0 RX input */
+ GPIO_BUTTON_BRIGHTNESS_DOWN_L, /* Brightness down button */
+ GPIO_BUTTON_BRIGHTNESS_UP_L, /* Brightness up button */
/* Other inputs */
GPIO_BOARD_VERSION1, /* Board version stuffing resistor 1 */
diff --git a/common/keyboard_8042.c b/common/keyboard_8042.c
index 0d8192b166..cdcb6d2359 100644
--- a/common/keyboard_8042.c
+++ b/common/keyboard_8042.c
@@ -206,6 +206,8 @@ static const struct button_8042_t buttons_8042[] = {
{0xe05e, 0xe037, 0}, /* Power */
{0xe02e, 0xe021, 1}, /* Volume Down */
{0xe030, 0xe032, 1}, /* Volume Up */
+ {0x40, 0x0b, 1}, /* Brightness Down */
+ {0x41, 0x83, 1}, /* Brightness Up */
};
BUILD_ASSERT(ARRAY_SIZE(buttons_8042) == KEYBOARD_BUTTON_COUNT);
diff --git a/include/button.h b/include/button.h
index eedf7974f8..349ed178be 100644
--- a/include/button.h
+++ b/include/button.h
@@ -17,6 +17,8 @@ enum keyboard_button_type {
KEYBOARD_BUTTON_POWER = 0,
KEYBOARD_BUTTON_VOLUME_DOWN,
KEYBOARD_BUTTON_VOLUME_UP,
+ KEYBOARD_BUTTON_BRIGHTNESS_DOWN,
+ KEYBOARD_BUTTON_BRIGHTNESS_UP,
KEYBOARD_BUTTON_COUNT
};