diff options
author | Olof Johansson <olof@lixom.net> | 2012-03-14 00:36:29 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-03-14 00:37:07 -0400 |
commit | 145e97348a3066cf71038d02392aa8063550de6f (patch) | |
tree | 2ef6ed98478e18030b3c266b4951e24075f8510c | |
parent | 2cd36877ad1c61429e00c099b6903ebcd936ca00 (diff) |
Input: tegra-kbc - revise device tree support
This is an incremental patch updating to the revised bindings for
matrix keyboards.
This includes an optional "linux,fn-keymap" binding that is not yet
implemented, that will be used to specify the Fn-key modifier layout
if needed.
Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r-- | Documentation/devicetree/bindings/input/tegra-kbc.txt | 17 | ||||
-rw-r--r-- | drivers/input/keyboard/tegra-kbc.c | 21 |
2 files changed, 27 insertions, 11 deletions
diff --git a/Documentation/devicetree/bindings/input/tegra-kbc.txt b/Documentation/devicetree/bindings/input/tegra-kbc.txt index 5ecfa99089b4..72683be6de35 100644 --- a/Documentation/devicetree/bindings/input/tegra-kbc.txt +++ b/Documentation/devicetree/bindings/input/tegra-kbc.txt | |||
@@ -3,16 +3,21 @@ | |||
3 | Required properties: | 3 | Required properties: |
4 | - compatible: "nvidia,tegra20-kbc" | 4 | - compatible: "nvidia,tegra20-kbc" |
5 | 5 | ||
6 | Optional properties: | 6 | Optional properties, in addition to those specified by the shared |
7 | - debounce-delay: delay in milliseconds per row scan for debouncing | 7 | matrix-keyboard bindings: |
8 | - repeat-delay: delay in milliseconds before repeat starts | 8 | |
9 | - ghost-filter: enable ghost filtering for this device | 9 | - linux,fn-keymap: a second keymap, same specification as the |
10 | - wakeup-source: configure keyboard as a wakeup source for suspend/resume | 10 | matrix-keyboard-controller spec but to be used when the KEY_FN modifier |
11 | key is pressed. | ||
12 | - nvidia,debounce-delay-ms: delay in milliseconds per row scan for debouncing | ||
13 | - nvidia,repeat-delay-ms: delay in milliseconds before repeat starts | ||
14 | - nvidia,ghost-filter: enable ghost filtering for this device | ||
15 | - nvidia,wakeup-source: configure keyboard as a wakeup source for suspend/resume | ||
11 | 16 | ||
12 | Example: | 17 | Example: |
13 | 18 | ||
14 | keyboard: keyboard { | 19 | keyboard: keyboard { |
15 | compatible = "nvidia,tegra20-kbc"; | 20 | compatible = "nvidia,tegra20-kbc"; |
16 | reg = <0x7000e200 0x100>; | 21 | reg = <0x7000e200 0x100>; |
17 | ghost-filter; | 22 | nvidia,ghost-filter; |
18 | }; | 23 | }; |
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c index dc19432c665b..21c42f852343 100644 --- a/drivers/input/keyboard/tegra-kbc.c +++ b/drivers/input/keyboard/tegra-kbc.c | |||
@@ -624,6 +624,8 @@ tegra_kbc_dt_parse_pdata(struct platform_device *pdev) | |||
624 | { | 624 | { |
625 | struct tegra_kbc_platform_data *pdata; | 625 | struct tegra_kbc_platform_data *pdata; |
626 | struct device_node *np = pdev->dev.of_node; | 626 | struct device_node *np = pdev->dev.of_node; |
627 | u32 prop; | ||
628 | int i; | ||
627 | 629 | ||
628 | if (!np) | 630 | if (!np) |
629 | return NULL; | 631 | return NULL; |
@@ -631,16 +633,16 @@ tegra_kbc_dt_parse_pdata(struct platform_device *pdev) | |||
631 | if (!pdata) | 633 | if (!pdata) |
632 | return NULL; | 634 | return NULL; |
633 | 635 | ||
634 | if (!of_property_read_u32(np, "debounce-delay", &prop)) | 636 | if (!of_property_read_u32(np, "nvidia,debounce-delay-ms", &prop)) |
635 | pdata->debounce_cnt = prop; | 637 | pdata->debounce_cnt = prop; |
636 | 638 | ||
637 | if (!of_property_read_u32(np, "repeat-delay", &prop)) | 639 | if (!of_property_read_u32(np, "nvidia,repeat-delay-ms", &prop)) |
638 | pdata->repeat_cnt = prop; | 640 | pdata->repeat_cnt = prop; |
639 | 641 | ||
640 | if (of_find_property(np, "needs-ghost-filter", NULL)) | 642 | if (of_find_property(np, "nvidia,needs-ghost-filter", NULL)) |
641 | pdata->use_ghost_filter = true; | 643 | pdata->use_ghost_filter = true; |
642 | 644 | ||
643 | if (of_find_property(np, "wakeup-source", NULL)) | 645 | if (of_find_property(np, "nvidia,wakeup-source", NULL)) |
644 | pdata->wakeup = true; | 646 | pdata->wakeup = true; |
645 | 647 | ||
646 | /* | 648 | /* |
@@ -657,6 +659,10 @@ tegra_kbc_dt_parse_pdata(struct platform_device *pdev) | |||
657 | pdata->pin_cfg[KBC_MAX_ROW + i].type = PIN_CFG_COL; | 659 | pdata->pin_cfg[KBC_MAX_ROW + i].type = PIN_CFG_COL; |
658 | } | 660 | } |
659 | 661 | ||
662 | pdata->keymap_data = matrix_keyboard_of_fill_keymap(np, "linux,keymap"); | ||
663 | |||
664 | /* FIXME: Add handling of linux,fn-keymap here */ | ||
665 | |||
660 | return pdata; | 666 | return pdata; |
661 | } | 667 | } |
662 | #else | 668 | #else |
@@ -792,6 +798,9 @@ static int __devinit tegra_kbc_probe(struct platform_device *pdev) | |||
792 | platform_set_drvdata(pdev, kbc); | 798 | platform_set_drvdata(pdev, kbc); |
793 | device_init_wakeup(&pdev->dev, pdata->wakeup); | 799 | device_init_wakeup(&pdev->dev, pdata->wakeup); |
794 | 800 | ||
801 | if (!pdev->dev.platform_data) | ||
802 | matrix_keyboard_of_free_keymap(pdata->keymap_data); | ||
803 | |||
795 | return 0; | 804 | return 0; |
796 | 805 | ||
797 | err_free_irq: | 806 | err_free_irq: |
@@ -806,8 +815,10 @@ err_free_mem: | |||
806 | input_free_device(input_dev); | 815 | input_free_device(input_dev); |
807 | kfree(kbc); | 816 | kfree(kbc); |
808 | err_free_pdata: | 817 | err_free_pdata: |
809 | if (!pdev->dev.platform_data) | 818 | if (!pdev->dev.platform_data) { |
819 | matrix_keyboard_of_free_keymap(pdata->keymap_data); | ||
810 | kfree(pdata); | 820 | kfree(pdata); |
821 | } | ||
811 | 822 | ||
812 | return err; | 823 | return err; |
813 | } | 824 | } |