Commit 145e9734 authored by Olof Johansson's avatar Olof Johansson Committed by Dmitry Torokhov

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: default avatarOlof Johansson <olof@lixom.net>
Acked-by: default avatarGrant Likely <grant.likely@secretlab.ca>
Acked-by: default avatarStephen Warren <swarren@nvidia.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 2cd36877
...@@ -3,16 +3,21 @@ ...@@ -3,16 +3,21 @@
Required properties: Required properties:
- compatible: "nvidia,tegra20-kbc" - compatible: "nvidia,tegra20-kbc"
Optional properties: Optional properties, in addition to those specified by the shared
- debounce-delay: delay in milliseconds per row scan for debouncing matrix-keyboard bindings:
- repeat-delay: delay in milliseconds before repeat starts
- ghost-filter: enable ghost filtering for this device - linux,fn-keymap: a second keymap, same specification as the
- wakeup-source: configure keyboard as a wakeup source for suspend/resume matrix-keyboard-controller spec but to be used when the KEY_FN modifier
key is pressed.
- nvidia,debounce-delay-ms: delay in milliseconds per row scan for debouncing
- nvidia,repeat-delay-ms: delay in milliseconds before repeat starts
- nvidia,ghost-filter: enable ghost filtering for this device
- nvidia,wakeup-source: configure keyboard as a wakeup source for suspend/resume
Example: Example:
keyboard: keyboard { keyboard: keyboard {
compatible = "nvidia,tegra20-kbc"; compatible = "nvidia,tegra20-kbc";
reg = <0x7000e200 0x100>; reg = <0x7000e200 0x100>;
ghost-filter; nvidia,ghost-filter;
}; };
...@@ -624,6 +624,8 @@ tegra_kbc_dt_parse_pdata(struct platform_device *pdev) ...@@ -624,6 +624,8 @@ tegra_kbc_dt_parse_pdata(struct platform_device *pdev)
{ {
struct tegra_kbc_platform_data *pdata; struct tegra_kbc_platform_data *pdata;
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
u32 prop;
int i;
if (!np) if (!np)
return NULL; return NULL;
...@@ -631,16 +633,16 @@ tegra_kbc_dt_parse_pdata(struct platform_device *pdev) ...@@ -631,16 +633,16 @@ tegra_kbc_dt_parse_pdata(struct platform_device *pdev)
if (!pdata) if (!pdata)
return NULL; return NULL;
if (!of_property_read_u32(np, "debounce-delay", &prop)) if (!of_property_read_u32(np, "nvidia,debounce-delay-ms", &prop))
pdata->debounce_cnt = prop; pdata->debounce_cnt = prop;
if (!of_property_read_u32(np, "repeat-delay", &prop)) if (!of_property_read_u32(np, "nvidia,repeat-delay-ms", &prop))
pdata->repeat_cnt = prop; pdata->repeat_cnt = prop;
if (of_find_property(np, "needs-ghost-filter", NULL)) if (of_find_property(np, "nvidia,needs-ghost-filter", NULL))
pdata->use_ghost_filter = true; pdata->use_ghost_filter = true;
if (of_find_property(np, "wakeup-source", NULL)) if (of_find_property(np, "nvidia,wakeup-source", NULL))
pdata->wakeup = true; pdata->wakeup = true;
/* /*
...@@ -657,6 +659,10 @@ tegra_kbc_dt_parse_pdata(struct platform_device *pdev) ...@@ -657,6 +659,10 @@ tegra_kbc_dt_parse_pdata(struct platform_device *pdev)
pdata->pin_cfg[KBC_MAX_ROW + i].type = PIN_CFG_COL; pdata->pin_cfg[KBC_MAX_ROW + i].type = PIN_CFG_COL;
} }
pdata->keymap_data = matrix_keyboard_of_fill_keymap(np, "linux,keymap");
/* FIXME: Add handling of linux,fn-keymap here */
return pdata; return pdata;
} }
#else #else
...@@ -792,6 +798,9 @@ static int __devinit tegra_kbc_probe(struct platform_device *pdev) ...@@ -792,6 +798,9 @@ static int __devinit tegra_kbc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, kbc); platform_set_drvdata(pdev, kbc);
device_init_wakeup(&pdev->dev, pdata->wakeup); device_init_wakeup(&pdev->dev, pdata->wakeup);
if (!pdev->dev.platform_data)
matrix_keyboard_of_free_keymap(pdata->keymap_data);
return 0; return 0;
err_free_irq: err_free_irq:
...@@ -806,8 +815,10 @@ static int __devinit tegra_kbc_probe(struct platform_device *pdev) ...@@ -806,8 +815,10 @@ static int __devinit tegra_kbc_probe(struct platform_device *pdev)
input_free_device(input_dev); input_free_device(input_dev);
kfree(kbc); kfree(kbc);
err_free_pdata: err_free_pdata:
if (!pdev->dev.platform_data) if (!pdev->dev.platform_data) {
matrix_keyboard_of_free_keymap(pdata->keymap_data);
kfree(pdata); kfree(pdata);
}
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment