Browse Source

spl: input: Allow input in SPL and TPL

In some cases it is necessary to read the keyboard in early phases of
U-Boot. Update the config to allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass 3 years ago
parent
commit
985ca3945f
3 changed files with 59 additions and 5 deletions
  1. 48 0
      drivers/input/Kconfig
  2. 7 4
      drivers/input/Makefile
  3. 4 1
      drivers/input/input.c

+ 48 - 0
drivers/input/Kconfig

@@ -1,3 +1,16 @@
1
+config INPUT
2
+	bool "Enable input subsystem"
3
+	depends on DM
4
+	default y
5
+
6
+config SPL_INPUT
7
+	bool "Enable input subsystem for SPL"
8
+	depends on SPL_DM
9
+
10
+config TPL_INPUT
11
+	bool "Enable input subsystem for TPL"
12
+	depends on TPL_DM
13
+
1 14
 config DM_KEYBOARD
2 15
 	bool "Enable driver model keyboard support"
3 16
 	depends on DM
@@ -7,8 +20,43 @@ config DM_KEYBOARD
7 20
 	  includes methods to start/stop the device, check for available
8 21
 	  input and update LEDs if the keyboard has them.
9 22
 
23
+config SPL_DM_KEYBOARD
24
+	bool "Enable driver model keyboard support"
25
+	depends on SPL_DM
26
+	help
27
+	  This adds a uclass for keyboards and implements keyboard support
28
+	  using driver model. The API is implemented by keyboard.h and
29
+	  includes methods to start/stop the device, check for available
30
+	  input and update LEDs if the keyboard has them.
31
+
32
+config TPL_DM_KEYBOARD
33
+	bool "Enable driver model keyboard support"
34
+	depends on TPL_DM
35
+	help
36
+	  This adds a uclass for keyboards and implements keyboard support
37
+	  using driver model. The API is implemented by keyboard.h and
38
+	  includes methods to start/stop the device, check for available
39
+	  input and update LEDs if the keyboard has them.
40
+
10 41
 config CROS_EC_KEYB
11 42
 	bool "Enable Chrome OS EC keyboard support"
43
+	depends on INPUT
44
+	help
45
+	  Most ARM Chromebooks use an EC to provide access to the keyboard.
46
+	  Messages are used to request key scans from the EC and these are
47
+	  then decoded into keys by this driver.
48
+
49
+config SPL_CROS_EC_KEYB
50
+	bool "Enable Chrome OS EC keyboard support in SPL"
51
+	depends on SPL_INPUT
52
+	help
53
+	  Most ARM Chromebooks use an EC to provide access to the keyboard.
54
+	  Messages are used to request key scans from the EC and these are
55
+	  then decoded into keys by this driver.
56
+
57
+config TPL_CROS_EC_KEYB
58
+	bool "Enable Chrome OS EC keyboard support in TPL"
59
+	depends on TPL_INPUT
12 60
 	help
13 61
 	  Most ARM Chromebooks use an EC to provide access to the keyboard.
14 62
 	  Messages are used to request key scans from the EC and these are

+ 7 - 4
drivers/input/Makefile

@@ -3,12 +3,15 @@
3 3
 # (C) Copyright 2000-2007
4 4
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 5
 
6
-obj-$(CONFIG_DM_KEYBOARD) += keyboard-uclass.o
6
+obj-y += input.o
7
+obj-$(CONFIG_$(SPL_TPL_)CROS_EC_KEYB) += cros_ec_keyb.o
8
+obj-$(CONFIG_$(SPL_TPL_)OF_CONTROL) += key_matrix.o
9
+obj-$(CONFIG_$(SPL_TPL_)DM_KEYBOARD) += keyboard-uclass.o
10
+
11
+ifndef CONFIG_SPL_BUILD
7 12
 
8 13
 obj-$(CONFIG_I8042_KEYB) += i8042.o
9 14
 obj-$(CONFIG_TEGRA_KEYBOARD) += tegra-kbc.o
10 15
 obj-$(CONFIG_TWL4030_INPUT) += twl4030.o
11 16
 obj-$(CONFIG_TWL6030_INPUT) += twl6030.o
12
-obj-$(CONFIG_CROS_EC_KEYB) += cros_ec_keyb.o
13
-obj-y += input.o
14
-obj-$(CONFIG_$(SPL_)OF_CONTROL) += key_matrix.o
17
+endif

+ 4 - 1
drivers/input/input.c

@@ -652,7 +652,7 @@ int input_stdio_register(struct stdio_dev *dev)
652 652
 	int error;
653 653
 
654 654
 	error = stdio_register(dev);
655
-
655
+#if !defined(CONFIG_SPL_BUILD) || CONFIG_IS_ENABLED(ENV_SUPPORT)
656 656
 	/* check if this is the standard input device */
657 657
 	if (!error && strcmp(env_get("stdin"), dev->name) == 0) {
658 658
 		/* reassign the console */
@@ -660,6 +660,9 @@ int input_stdio_register(struct stdio_dev *dev)
660 660
 				console_assign(stdin, dev->name))
661 661
 			return -1;
662 662
 	}
663
+#else
664
+	error = error;
665
+#endif
663 666
 
664 667
 	return 0;
665 668
 }