max7359_keypad: implement DT bindings
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Dmitry Torokhov
Review
Quoted 2 lines · Evgeniy Dushistov
(quoted diff) +2
-0+ maxim,debounce_reg = /bits/ 8 <0x5F>; + maxim,ports_reg = /bits/ 8 <0xFF>;Specifying exact size for properties is quite uncommon; I think the usual recommendation is is to use the "standard" u32 and validate the range in parser function.
Using of u8 has advantages, it is possible on compilation stage (dts->dtb) check that you enter right value, but because of DT validation tools are not part of mainline, I replace u8 with u32 as you suggest, see patch bellow.
Quoted 7 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ MATRIX_KEY(0, 7, KEY_RESERVED) + ...Indent one more level? Also, maybe fill with something other than
KEY_RESERVED?
Fixed, see patch bellow.
Quoted 15 lines
Review
Quoted 9 lines
(quoted diff) +5
-0dev_dbg(&client->dev, "keys FIFO is 0x%02x\n", ret); + if (!keymap_data) { + error = max7359_parse_dt(&client->dev, &init_state); + if (error) { + dev_err(&client->dev, "platform data null, and no DT data\n"); + return error;Both debounce and ports values are optional and we'll fail building keymap if there are no platform data nor device tree data, so I would drop this check and the stub for
max7359_parse_dt()as well - we have stubs for property parsing anyway.
Because of u32/u8 check at now max7359_parse_dt can return not 0.
Quoted 3 lines
Signature · 1 line
Dmitry
Thanks, for review.
Please add me to CC, because of I'm not the part
of any mailing list (too huge traffic for me).
Here patch with fixes mentioned above:
max7359_keypad: implement DT bindings
--- .../devicetree/bindings/input/max7359-keypad.txt | 33 ++++++++++ drivers/input/keyboard/max7359_keypad.c | 70 +++++++++++++++++++++- 2 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/input/max7359-keypad.txt
Documentation/devicetree/bindings/input/max7359-keypad.txt new file +33 -0
@@ -0,0 +1,33 @@ +* MAX7359 keypda device tree bindings + +Required Properties: +- compatible: Should be "maxim,max7359" +- linux,keymap: The definition can be found at + bindings/input/matrix-keymap.txt + +Optional Properties: +- maxim,debounce_reg: u32, in short allow control debounce, +see max7359 datasheet for details +- maxim,ports_reg: u32, in short allow control what pin used, +and what pins should be configured as GPIO + +Example: +max7359_keypad@38 { + compatible = "maxim,max7359"; + reg = <0x38>; + interrupts = <28 IRQ_TYPE_LEVEL_LOW>;/*gpio_156*/ + interrupt-parent = <&gpio5>; + maxim,debounce_reg = <0x5F>; + maxim,ports_reg = <0xFF>; + linux,keymap = < + MATRIX_KEY(0, 0, KEY_F1) + MATRIX_KEY(0, 1, KEY_RESERVED) + MATRIX_KEY(0, 2, KEY_F2) + MATRIX_KEY(0, 3, KEY_RESERVED) + MATRIX_KEY(0, 4, KEY_M) + MATRIX_KEY(0, 5, KEY_L) + MATRIX_KEY(0, 6, KEY_P) + MATRIX_KEY(0, 7, KEY_ESC) + ... + >; +};
drivers/input/keyboard/max7359_keypad.c +67 -3
126 lines not on this page · raw message
Signature · 5 lines
2.3.6 -- /Evgeniy
Dmitry Torokhov
maintainerQuoted 10 lines · Evgeniy Dushistov
Quoted 8 lines · Dmitry Torokhov
Review
Quoted 2 lines · Evgeniy Dushistov
(quoted diff) +2
-0+ maxim,debounce_reg = /bits/ 8 <0x5F>; + maxim,ports_reg = /bits/ 8 <0xFF>;Specifying exact size for properties is quite uncommon; I think the usual recommendation is is to use the "standard" u32 and validate the range in parser function.
Quoted 4 lines
Using of u8 has advantages, it is possible on compilation stage (
dts->dtb) check that you enter right value, but because of DT validation tools are not part of mainline, I replace u8 with u32 as you suggest, see patch bellow.
If you get DT folks OK on using /bits/ I'm fine with keeping it.
Signature · 5 lines
Dmitry -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Dmitry Torokhov
maintainerQuoted 10 lines · Evgeniy Dushistov
Quoted 8 lines · Dmitry Torokhov
Review
Quoted 2 lines · Evgeniy Dushistov
(quoted diff) +2
-0+ maxim,debounce_reg = /bits/ 8 <0x5F>; + maxim,ports_reg = /bits/ 8 <0xFF>;Specifying exact size for properties is quite uncommon; I think the usual recommendation is is to use the "standard" u32 and validate the range in parser function.
Quoted 4 lines
Using of u8 has advantages, it is possible on compilation stage (
dts->dtb) check that you enter right value, but because of DT validation tools are not part of mainline, I replace u8 with u32 as you suggest, see patch bellow.
If you get DT folks to OK using /bits/ - that's fine. Grant, Rob, any guidance here?
Quoted 29 lines
Quoted 8 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+ MATRIX_KEY(0, 7, KEY_RESERVED) + ...Indent one more level? Also, maybe fill with something other than
KEY_RESERVED?Fixed, see patch bellow.
Quoted 15 lines
drivers/input/keyboard/max7359_keypad.c static int max7359_probe(struct i2c_client *client, · line 234
Quoted 9 lines
drivers/input/keyboard/max7359_keypad.c +5
-0dev_dbg (&client->dev,"keys FIFO is 0x%02x\n" , ret); +if (!keymap_data) { + error =max7359_parse_dt (&client->dev, &init_state); +if (error) { +dev_err (&client->dev,"platform data null, and no DT data\n" ); +return error;Both debounce and ports values are optional and we'll fail building keymap if there are no platform data nor device tree data, so I would drop this check and the stub for
max7359_parse_dt()as well - we have stubs for property parsing anyway.Because of u32/u8 check at now
max7359_parse_dtcan return not 0.
Quoted 8 lines
Quoted 3 lines
Signature · 1 line
DmitryThanks, for review.
Please add me to CC, because of I'm not the part
of any mailing list (too huge traffic for me).
Umm, if you want to be replied (or CCed) to, why do you make sure that replies do not go to you by default??? Why do you set "Mail-Followup-To" to exclude yourself?
Quoted 3 lines
Mail-Followup-To: Dmitry Torokhov <[email protected]>,
[email protected], [email protected], [email protected]
Thanks.
Signature · 5 lines
Dmitry -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html