diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2013-01-06 21:34:48 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-01-17 03:28:02 -0500 |
commit | 914e597682375ad732d2fedecd855ac637ed7ef7 (patch) | |
tree | 1296f601743ee425aab4e6eb8922ef060c81c632 /drivers/input/keyboard | |
parent | 88390243a9937f9831aeba5113a8b59bb1d4411a (diff) |
Input: tegra-kbc - remove default keymap
Tegra KBC driver have the default key mapping for 16x8 configuration.
The key mapping can be provided through platform data or through DT
and the mapping varies from platform to platform, hence this default
mapping is not so useful. Remove the default mapping to reduce the code
lines of the driver.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r-- | drivers/input/keyboard/tegra-kbc.c | 176 |
1 files changed, 7 insertions, 169 deletions
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c index 39ef663bb38f..4526bdd36022 100644 --- a/drivers/input/keyboard/tegra-kbc.c +++ b/drivers/input/keyboard/tegra-kbc.c | |||
@@ -87,147 +87,6 @@ struct tegra_kbc { | |||
87 | struct clk *clk; | 87 | struct clk *clk; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | static const u32 tegra_kbc_default_keymap[] = { | ||
91 | KEY(0, 2, KEY_W), | ||
92 | KEY(0, 3, KEY_S), | ||
93 | KEY(0, 4, KEY_A), | ||
94 | KEY(0, 5, KEY_Z), | ||
95 | KEY(0, 7, KEY_FN), | ||
96 | |||
97 | KEY(1, 7, KEY_LEFTMETA), | ||
98 | |||
99 | KEY(2, 6, KEY_RIGHTALT), | ||
100 | KEY(2, 7, KEY_LEFTALT), | ||
101 | |||
102 | KEY(3, 0, KEY_5), | ||
103 | KEY(3, 1, KEY_4), | ||
104 | KEY(3, 2, KEY_R), | ||
105 | KEY(3, 3, KEY_E), | ||
106 | KEY(3, 4, KEY_F), | ||
107 | KEY(3, 5, KEY_D), | ||
108 | KEY(3, 6, KEY_X), | ||
109 | |||
110 | KEY(4, 0, KEY_7), | ||
111 | KEY(4, 1, KEY_6), | ||
112 | KEY(4, 2, KEY_T), | ||
113 | KEY(4, 3, KEY_H), | ||
114 | KEY(4, 4, KEY_G), | ||
115 | KEY(4, 5, KEY_V), | ||
116 | KEY(4, 6, KEY_C), | ||
117 | KEY(4, 7, KEY_SPACE), | ||
118 | |||
119 | KEY(5, 0, KEY_9), | ||
120 | KEY(5, 1, KEY_8), | ||
121 | KEY(5, 2, KEY_U), | ||
122 | KEY(5, 3, KEY_Y), | ||
123 | KEY(5, 4, KEY_J), | ||
124 | KEY(5, 5, KEY_N), | ||
125 | KEY(5, 6, KEY_B), | ||
126 | KEY(5, 7, KEY_BACKSLASH), | ||
127 | |||
128 | KEY(6, 0, KEY_MINUS), | ||
129 | KEY(6, 1, KEY_0), | ||
130 | KEY(6, 2, KEY_O), | ||
131 | KEY(6, 3, KEY_I), | ||
132 | KEY(6, 4, KEY_L), | ||
133 | KEY(6, 5, KEY_K), | ||
134 | KEY(6, 6, KEY_COMMA), | ||
135 | KEY(6, 7, KEY_M), | ||
136 | |||
137 | KEY(7, 1, KEY_EQUAL), | ||
138 | KEY(7, 2, KEY_RIGHTBRACE), | ||
139 | KEY(7, 3, KEY_ENTER), | ||
140 | KEY(7, 7, KEY_MENU), | ||
141 | |||
142 | KEY(8, 4, KEY_RIGHTSHIFT), | ||
143 | KEY(8, 5, KEY_LEFTSHIFT), | ||
144 | |||
145 | KEY(9, 5, KEY_RIGHTCTRL), | ||
146 | KEY(9, 7, KEY_LEFTCTRL), | ||
147 | |||
148 | KEY(11, 0, KEY_LEFTBRACE), | ||
149 | KEY(11, 1, KEY_P), | ||
150 | KEY(11, 2, KEY_APOSTROPHE), | ||
151 | KEY(11, 3, KEY_SEMICOLON), | ||
152 | KEY(11, 4, KEY_SLASH), | ||
153 | KEY(11, 5, KEY_DOT), | ||
154 | |||
155 | KEY(12, 0, KEY_F10), | ||
156 | KEY(12, 1, KEY_F9), | ||
157 | KEY(12, 2, KEY_BACKSPACE), | ||
158 | KEY(12, 3, KEY_3), | ||
159 | KEY(12, 4, KEY_2), | ||
160 | KEY(12, 5, KEY_UP), | ||
161 | KEY(12, 6, KEY_PRINT), | ||
162 | KEY(12, 7, KEY_PAUSE), | ||
163 | |||
164 | KEY(13, 0, KEY_INSERT), | ||
165 | KEY(13, 1, KEY_DELETE), | ||
166 | KEY(13, 3, KEY_PAGEUP), | ||
167 | KEY(13, 4, KEY_PAGEDOWN), | ||
168 | KEY(13, 5, KEY_RIGHT), | ||
169 | KEY(13, 6, KEY_DOWN), | ||
170 | KEY(13, 7, KEY_LEFT), | ||
171 | |||
172 | KEY(14, 0, KEY_F11), | ||
173 | KEY(14, 1, KEY_F12), | ||
174 | KEY(14, 2, KEY_F8), | ||
175 | KEY(14, 3, KEY_Q), | ||
176 | KEY(14, 4, KEY_F4), | ||
177 | KEY(14, 5, KEY_F3), | ||
178 | KEY(14, 6, KEY_1), | ||
179 | KEY(14, 7, KEY_F7), | ||
180 | |||
181 | KEY(15, 0, KEY_ESC), | ||
182 | KEY(15, 1, KEY_GRAVE), | ||
183 | KEY(15, 2, KEY_F5), | ||
184 | KEY(15, 3, KEY_TAB), | ||
185 | KEY(15, 4, KEY_F1), | ||
186 | KEY(15, 5, KEY_F2), | ||
187 | KEY(15, 6, KEY_CAPSLOCK), | ||
188 | KEY(15, 7, KEY_F6), | ||
189 | |||
190 | /* Software Handled Function Keys */ | ||
191 | KEY(20, 0, KEY_KP7), | ||
192 | |||
193 | KEY(21, 0, KEY_KP9), | ||
194 | KEY(21, 1, KEY_KP8), | ||
195 | KEY(21, 2, KEY_KP4), | ||
196 | KEY(21, 4, KEY_KP1), | ||
197 | |||
198 | KEY(22, 1, KEY_KPSLASH), | ||
199 | KEY(22, 2, KEY_KP6), | ||
200 | KEY(22, 3, KEY_KP5), | ||
201 | KEY(22, 4, KEY_KP3), | ||
202 | KEY(22, 5, KEY_KP2), | ||
203 | KEY(22, 7, KEY_KP0), | ||
204 | |||
205 | KEY(27, 1, KEY_KPASTERISK), | ||
206 | KEY(27, 3, KEY_KPMINUS), | ||
207 | KEY(27, 4, KEY_KPPLUS), | ||
208 | KEY(27, 5, KEY_KPDOT), | ||
209 | |||
210 | KEY(28, 5, KEY_VOLUMEUP), | ||
211 | |||
212 | KEY(29, 3, KEY_HOME), | ||
213 | KEY(29, 4, KEY_END), | ||
214 | KEY(29, 5, KEY_BRIGHTNESSDOWN), | ||
215 | KEY(29, 6, KEY_VOLUMEDOWN), | ||
216 | KEY(29, 7, KEY_BRIGHTNESSUP), | ||
217 | |||
218 | KEY(30, 0, KEY_NUMLOCK), | ||
219 | KEY(30, 1, KEY_SCROLLLOCK), | ||
220 | KEY(30, 2, KEY_MUTE), | ||
221 | |||
222 | KEY(31, 4, KEY_HELP), | ||
223 | }; | ||
224 | |||
225 | static const | ||
226 | struct matrix_keymap_data tegra_kbc_default_keymap_data = { | ||
227 | .keymap = tegra_kbc_default_keymap, | ||
228 | .keymap_size = ARRAY_SIZE(tegra_kbc_default_keymap), | ||
229 | }; | ||
230 | |||
231 | static void tegra_kbc_report_released_keys(struct input_dev *input, | 90 | static void tegra_kbc_report_released_keys(struct input_dev *input, |
232 | unsigned short old_keycodes[], | 91 | unsigned short old_keycodes[], |
233 | unsigned int old_num_keys, | 92 | unsigned int old_num_keys, |
@@ -704,33 +563,6 @@ static inline struct tegra_kbc_platform_data *tegra_kbc_dt_parse_pdata( | |||
704 | } | 563 | } |
705 | #endif | 564 | #endif |
706 | 565 | ||
707 | static int tegra_kbd_setup_keymap(struct tegra_kbc *kbc) | ||
708 | { | ||
709 | const struct tegra_kbc_platform_data *pdata = kbc->pdata; | ||
710 | const struct matrix_keymap_data *keymap_data = pdata->keymap_data; | ||
711 | unsigned int keymap_rows = KBC_MAX_KEY; | ||
712 | int retval; | ||
713 | |||
714 | if (keymap_data && pdata->use_fn_map) | ||
715 | keymap_rows *= 2; | ||
716 | |||
717 | retval = matrix_keypad_build_keymap(keymap_data, NULL, | ||
718 | keymap_rows, KBC_MAX_COL, | ||
719 | kbc->keycode, kbc->idev); | ||
720 | if (retval == -ENOSYS || retval == -ENOENT) { | ||
721 | /* | ||
722 | * If there is no OF support in kernel or keymap | ||
723 | * property is missing, use default keymap. | ||
724 | */ | ||
725 | retval = matrix_keypad_build_keymap( | ||
726 | &tegra_kbc_default_keymap_data, NULL, | ||
727 | keymap_rows, KBC_MAX_COL, | ||
728 | kbc->keycode, kbc->idev); | ||
729 | } | ||
730 | |||
731 | return retval; | ||
732 | } | ||
733 | |||
734 | static int tegra_kbc_probe(struct platform_device *pdev) | 566 | static int tegra_kbc_probe(struct platform_device *pdev) |
735 | { | 567 | { |
736 | const struct tegra_kbc_platform_data *pdata = pdev->dev.platform_data; | 568 | const struct tegra_kbc_platform_data *pdata = pdev->dev.platform_data; |
@@ -742,6 +574,7 @@ static int tegra_kbc_probe(struct platform_device *pdev) | |||
742 | int num_rows = 0; | 574 | int num_rows = 0; |
743 | unsigned int debounce_cnt; | 575 | unsigned int debounce_cnt; |
744 | unsigned int scan_time_rows; | 576 | unsigned int scan_time_rows; |
577 | unsigned int keymap_rows = KBC_MAX_KEY; | ||
745 | 578 | ||
746 | if (!pdata) | 579 | if (!pdata) |
747 | pdata = tegra_kbc_dt_parse_pdata(pdev); | 580 | pdata = tegra_kbc_dt_parse_pdata(pdev); |
@@ -815,7 +648,12 @@ static int tegra_kbc_probe(struct platform_device *pdev) | |||
815 | input_dev->open = tegra_kbc_open; | 648 | input_dev->open = tegra_kbc_open; |
816 | input_dev->close = tegra_kbc_close; | 649 | input_dev->close = tegra_kbc_close; |
817 | 650 | ||
818 | err = tegra_kbd_setup_keymap(kbc); | 651 | if (pdata->keymap_data && pdata->use_fn_map) |
652 | keymap_rows *= 2; | ||
653 | |||
654 | err = matrix_keypad_build_keymap(pdata->keymap_data, NULL, | ||
655 | keymap_rows, KBC_MAX_COL, | ||
656 | kbc->keycode, input_dev); | ||
819 | if (err) { | 657 | if (err) { |
820 | dev_err(&pdev->dev, "failed to setup keymap\n"); | 658 | dev_err(&pdev->dev, "failed to setup keymap\n"); |
821 | return err; | 659 | return err; |