From 247ca1c861392358ae38d4c3f9e31d9016078037 Mon Sep 17 00:00:00 2001 From: Ted Kuo Date: Wed, 24 Jun 2015 10:45:30 +0800 Subject: 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 Change-Id: I02c8d273c60bcb50c76ee9e3d20c8b544638556d Reviewed-on: https://chromium-review.googlesource.com/281490 Reviewed-by: Mohammed Habibulla Commit-Queue: Ted Kuo Tested-by: Ted Kuo --- board/sumo/board.c | 13 +++++++++++++ board/sumo/board.h | 3 +++ common/keyboard_8042.c | 2 ++ include/button.h | 2 ++ 4 files changed, 20 insertions(+) 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 }; -- cgit v1.2.1