Re: [PATCH v5 2/2] input: samsung-keypad: Add device tree support
From: Olof Johansson <hidden>
Date: 2011-12-28 07:28:38
Also in:
linux-arm-kernel, linux-devicetree, linux-samsung-soc
Hi, I came across this searching for other proposed device tree bindings based on what I wanted to do for Tegra. Comments below. On Mon, Oct 10, 2011 at 9:29 AM, Thomas Abraham [off-list ref] wrote:
+- Keys represented as child nodes: Each key connected to the keypad + controller is represented as a child node to the keypad controller + device node and should include the following properties. + - keypad,row: the row number to which the key is connected. + - keypad,column: the column number to which the key is connected. + - linux,code: the key-code to be reported when the key is pressed + and released.
[...]
+ key_1 {
+ keypad,row = <0>;
+ keypad,column = <3>;
+ linux,code = <2>;
+ };
+
+ key_2 {
+ keypad,row = <0>;
+ keypad,column = <4>;
+ linux,code = <3>;
+ };
+
+ key_3 {
+ keypad,row = <0>;
+ keypad,column = <5>;
+ linux,code = <4>;
+ };
The above is good if all you want to specify is a few keys. If you
want a full keyboard specification, it gets very verbose.
I would prefer a simpler binding, something along the lines of:
linux,keymap = < row col code ... >;
Where it's just an array of the above, so your example would be:
linux,keymap = < 0 3 2
0 4 3
0 5 4 >;
Same amount of data, it would be more or less as easy to read but a
_much_ more compact representation when you need to provide 100+ keys.
-Olof