瀏覽代碼

Input: gpio-keys - allow setting input device name in DT

Allow specifying name if input device via device tree property. This helps
userspace code to get name and perform proper event to key mapping in some
cases (for example, on Android).

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Laxman Dewangan 10 年之前
父節點
當前提交
c4dc5f8c95
共有 2 個文件被更改,包括 3 次插入0 次删除
  1. 1 0
      Documentation/devicetree/bindings/input/gpio-keys.txt
  2. 2 0
      drivers/input/keyboard/gpio_keys.c

+ 1 - 0
Documentation/devicetree/bindings/input/gpio-keys.txt

@@ -6,6 +6,7 @@ Required properties:
 Optional properties:
 Optional properties:
 	- autorepeat: Boolean, Enable auto repeat feature of Linux input
 	- autorepeat: Boolean, Enable auto repeat feature of Linux input
 	  subsystem.
 	  subsystem.
+	- label: String, name of the input device.
 
 
 Each button (key) is represented as a sub-node of "gpio-keys":
 Each button (key) is represented as a sub-node of "gpio-keys":
 Subnode properties:
 Subnode properties:

+ 2 - 0
drivers/input/keyboard/gpio_keys.c

@@ -645,6 +645,8 @@ gpio_keys_get_devtree_pdata(struct device *dev)
 
 
 	pdata->rep = !!of_get_property(node, "autorepeat", NULL);
 	pdata->rep = !!of_get_property(node, "autorepeat", NULL);
 
 
+	of_property_read_string(node, "label", &pdata->name);
+
 	i = 0;
 	i = 0;
 	for_each_child_of_node(node, pp) {
 	for_each_child_of_node(node, pp) {
 		enum of_gpio_flags flags;
 		enum of_gpio_flags flags;