Commit 0b35b2d11774fadd48b9492bacd89a9757965ecc
Committed by
Stefano Babic
1 parent
5ca614cae9
Exists in
smarc_8mq_lf_v2020.04
and in
11 other branches
board: Add support for KEY1 status detection on K+P's HSC|DDC boards
This code provides information if the K+P's imx53 boards had KEY1 pressed. Signed-off-by: Lukasz Majewski <lukma@denx.de>
Showing 2 changed files with 16 additions and 0 deletions Side-by-side Diff
arch/arm/dts/imx53-kp.dts
board/k+p/kp_imx53/kp_imx53.c
... | ... | @@ -23,6 +23,7 @@ |
23 | 23 | #define PHY_nRST IMX_GPIO_NR(7, 6) |
24 | 24 | #define BOOSTER_OFF IMX_GPIO_NR(2, 23) |
25 | 25 | #define LCD_BACKLIGHT IMX_GPIO_NR(1, 1) |
26 | +#define KEY1 IMX_GPIO_NR(2, 26) | |
26 | 27 | |
27 | 28 | DECLARE_GLOBAL_DATA_PTR; |
28 | 29 | |
... | ... | @@ -196,6 +197,17 @@ |
196 | 197 | gpio_direction_output(LCD_BACKLIGHT, 0); |
197 | 198 | } |
198 | 199 | |
200 | +void board_misc_setup(void) | |
201 | +{ | |
202 | + gpio_request(KEY1, "KEY1_GPIO"); | |
203 | + gpio_direction_input(KEY1); | |
204 | + | |
205 | + if (gpio_get_value(KEY1)) | |
206 | + env_set("key1", "off"); | |
207 | + else | |
208 | + env_set("key1", "on"); | |
209 | +} | |
210 | + | |
199 | 211 | int board_late_init(void) |
200 | 212 | { |
201 | 213 | int ret = 0; |
... | ... | @@ -214,6 +226,8 @@ |
214 | 226 | |
215 | 227 | show_eeprom(); |
216 | 228 | read_board_id(); |
229 | + | |
230 | + board_misc_setup(); | |
217 | 231 | |
218 | 232 | return ret; |
219 | 233 | } |