Lines Matching full:keypad

116  * struct stmpe_keypad - STMPE keypad state container
141 static int stmpe_keypad_read_data(struct stmpe_keypad *keypad, u8 *data) in stmpe_keypad_read_data() argument
143 const struct stmpe_keypad_variant *variant = keypad->variant; in stmpe_keypad_read_data()
144 struct stmpe *stmpe = keypad->stmpe; in stmpe_keypad_read_data()
165 struct stmpe_keypad *keypad = dev; in stmpe_keypad_irq() local
166 struct input_dev *input = keypad->input; in stmpe_keypad_irq()
167 const struct stmpe_keypad_variant *variant = keypad->variant; in stmpe_keypad_irq()
172 ret = stmpe_keypad_read_data(keypad, fifo); in stmpe_keypad_irq()
188 input_report_key(input, keypad->keymap[code], !up); in stmpe_keypad_irq()
195 static int stmpe_keypad_altfunc_init(struct stmpe_keypad *keypad) in stmpe_keypad_altfunc_init() argument
197 const struct stmpe_keypad_variant *variant = keypad->variant; in stmpe_keypad_altfunc_init()
200 struct stmpe *stmpe = keypad->stmpe; in stmpe_keypad_altfunc_init()
208 * Figure out which pins need to be set to the keypad alternate in stmpe_keypad_altfunc_init()
212 * for the keypad. in stmpe_keypad_altfunc_init()
214 * keypad->{cols,rows} are a bitmask of which pins (of the ones useable in stmpe_keypad_altfunc_init()
215 * for the keypad) are used on the board. in stmpe_keypad_altfunc_init()
221 if (keypad->cols & (1 << i)) { in stmpe_keypad_altfunc_init()
232 if (keypad->rows & (1 << i)) in stmpe_keypad_altfunc_init()
243 * On STMPE24xx, set pin bias to pull-up on all keypad input in stmpe_keypad_altfunc_init()
265 static int stmpe_keypad_chip_init(struct stmpe_keypad *keypad) in stmpe_keypad_chip_init() argument
267 const struct stmpe_keypad_variant *variant = keypad->variant; in stmpe_keypad_chip_init()
268 struct stmpe *stmpe = keypad->stmpe; in stmpe_keypad_chip_init()
271 if (keypad->debounce_ms > STMPE_KEYPAD_MAX_DEBOUNCE) in stmpe_keypad_chip_init()
274 if (keypad->scan_count > STMPE_KEYPAD_MAX_SCAN_COUNT) in stmpe_keypad_chip_init()
281 ret = stmpe_keypad_altfunc_init(keypad); in stmpe_keypad_chip_init()
285 ret = stmpe_reg_write(stmpe, STMPE_KPC_COL, keypad->cols); in stmpe_keypad_chip_init()
289 ret = stmpe_reg_write(stmpe, STMPE_KPC_ROW_LSB, keypad->rows); in stmpe_keypad_chip_init()
296 keypad->rows >> 8); in stmpe_keypad_chip_init()
303 keypad->scan_count << 4); in stmpe_keypad_chip_init()
311 (keypad->debounce_ms << 1)); in stmpe_keypad_chip_init()
314 static void stmpe_keypad_fill_used_pins(struct stmpe_keypad *keypad, in stmpe_keypad_fill_used_pins() argument
323 if (keypad->keymap[code] != KEY_RESERVED) { in stmpe_keypad_fill_used_pins()
324 keypad->rows |= 1 << row; in stmpe_keypad_fill_used_pins()
325 keypad->cols |= 1 << col; in stmpe_keypad_fill_used_pins()
335 struct stmpe_keypad *keypad; in stmpe_keypad_probe() local
346 keypad = devm_kzalloc(&pdev->dev, sizeof(struct stmpe_keypad), in stmpe_keypad_probe()
348 if (!keypad) in stmpe_keypad_probe()
351 keypad->stmpe = stmpe; in stmpe_keypad_probe()
352 keypad->variant = &stmpe_keypad_variants[stmpe->partnum]; in stmpe_keypad_probe()
354 of_property_read_u32(np, "debounce-interval", &keypad->debounce_ms); in stmpe_keypad_probe()
355 of_property_read_u32(np, "st,scan-count", &keypad->scan_count); in stmpe_keypad_probe()
356 keypad->no_autorepeat = of_property_read_bool(np, "st,no-autorepeat"); in stmpe_keypad_probe()
362 input->name = "STMPE keypad"; in stmpe_keypad_probe()
371 keypad->keymap, input); in stmpe_keypad_probe()
376 if (!keypad->no_autorepeat) in stmpe_keypad_probe()
379 stmpe_keypad_fill_used_pins(keypad, rows, cols); in stmpe_keypad_probe()
381 keypad->input = input; in stmpe_keypad_probe()
383 error = stmpe_keypad_chip_init(keypad); in stmpe_keypad_probe()
389 IRQF_ONESHOT, "stmpe-keypad", keypad); in stmpe_keypad_probe()
402 platform_set_drvdata(pdev, keypad); in stmpe_keypad_probe()
409 struct stmpe_keypad *keypad = platform_get_drvdata(pdev); in stmpe_keypad_remove() local
411 stmpe_disable(keypad->stmpe, STMPE_BLOCK_KEYPAD); in stmpe_keypad_remove()
415 .driver.name = "stmpe-keypad",
422 MODULE_DESCRIPTION("STMPExxxx keypad driver");