Lines Matching refs:keypad_data

88 static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset)
90 return __raw_readl(keypad_data->base +
91 keypad_data->reg_offset + offset);
94 static void kbd_writel(struct omap4_keypad *keypad_data, u32 offset, u32 value)
97 keypad_data->base + keypad_data->reg_offset + offset);
100 static int kbd_read_irqreg(struct omap4_keypad *keypad_data, u32 offset)
102 return __raw_readl(keypad_data->base +
103 keypad_data->irqreg_offset + offset);
106 static void kbd_write_irqreg(struct omap4_keypad *keypad_data,
110 keypad_data->base + keypad_data->irqreg_offset + offset);
117 struct omap4_keypad *keypad_data = dev_id;
119 if (kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)) {
121 kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
131 struct omap4_keypad *keypad_data = dev_id;
132 struct input_dev *input_dev = keypad_data->input;
133 unsigned char key_state[ARRAY_SIZE(keypad_data->key_state)];
137 *new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0);
138 *(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32);
140 for (row = 0; row < keypad_data->rows; row++) {
141 changed = key_state[row] ^ keypad_data->key_state[row];
145 for (col = 0; col < keypad_data->cols; col++) {
148 keypad_data->row_shift);
151 keypad_data->keymap[code],
159 memcpy(keypad_data->key_state, key_state,
160 sizeof(keypad_data->key_state));
163 kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS,
164 kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS));
167 kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
176 struct omap4_keypad *keypad_data = input_get_drvdata(input);
180 disable_irq(keypad_data->irq);
182 kbd_writel(keypad_data, OMAP4_KBD_CTRL,
185 kbd_writel(keypad_data, OMAP4_KBD_DEBOUNCINGTIME,
188 kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS,
189 kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS));
190 kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
193 kbd_writel(keypad_data, OMAP4_KBD_WAKEUPENABLE,
196 enable_irq(keypad_data->irq);
203 struct omap4_keypad *keypad_data = input_get_drvdata(input);
205 disable_irq(keypad_data->irq);
208 kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE,
212 kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS,
213 kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS));
215 enable_irq(keypad_data->irq);
221 struct omap4_keypad *keypad_data)
226 err = matrix_keypad_parse_of_params(dev, &keypad_data->rows,
227 &keypad_data->cols);
232 keypad_data->no_autorepeat = true;
239 struct omap4_keypad *keypad_data;
259 keypad_data = kzalloc(sizeof(struct omap4_keypad), GFP_KERNEL);
260 if (!keypad_data) {
261 dev_err(&pdev->dev, "keypad_data memory allocation failed\n");
265 keypad_data->irq = irq;
267 error = omap4_keypad_parse_dt(&pdev->dev, keypad_data);
278 keypad_data->base = ioremap(res->start, resource_size(res));
279 if (!keypad_data->base) {
296 rev = __raw_readl(keypad_data->base + OMAP4_KBD_REVISION);
301 keypad_data->reg_offset = 0x00;
302 keypad_data->irqreg_offset = 0x00;
305 keypad_data->reg_offset = 0x10;
306 keypad_data->irqreg_offset = 0x0c;
316 keypad_data->input = input_dev = input_allocate_device();
333 if (!keypad_data->no_autorepeat)
336 input_set_drvdata(input_dev, keypad_data);
338 keypad_data->row_shift = get_count_order(keypad_data->cols);
339 max_keys = keypad_data->rows << keypad_data->row_shift;
340 keypad_data->keymap = kzalloc(max_keys * sizeof(keypad_data->keymap[0]),
342 if (!keypad_data->keymap) {
349 keypad_data->rows, keypad_data->cols,
350 keypad_data->keymap, input_dev);
356 error = request_threaded_irq(keypad_data->irq, omap4_keypad_irq_handler,
358 "omap4-keypad", keypad_data);
367 error = input_register_device(keypad_data->input);
373 platform_set_drvdata(pdev, keypad_data);
379 free_irq(keypad_data->irq, keypad_data);
381 kfree(keypad_data->keymap);
387 iounmap(keypad_data->base);
391 kfree(keypad_data);
397 struct omap4_keypad *keypad_data = platform_get_drvdata(pdev);
400 free_irq(keypad_data->irq, keypad_data);
406 input_unregister_device(keypad_data->input);
408 iounmap(keypad_data->base);
413 kfree(keypad_data->keymap);
414 kfree(keypad_data);
429 struct omap4_keypad *keypad_data = platform_get_drvdata(pdev);
433 error = enable_irq_wake(keypad_data->irq);
435 keypad_data->irq_wake_enabled = true;
444 struct omap4_keypad *keypad_data = platform_get_drvdata(pdev);
446 if (device_may_wakeup(&pdev->dev) && keypad_data->irq_wake_enabled) {
447 disable_irq_wake(keypad_data->irq);
448 keypad_data->irq_wake_enabled = false;