Lines Matching full:keypad

115  * struct stmpe_keypad - STMPE keypad state container
140 static int stmpe_keypad_read_data(struct stmpe_keypad *keypad, u8 *data) in stmpe_keypad_read_data() argument
142 const struct stmpe_keypad_variant *variant = keypad->variant; in stmpe_keypad_read_data()
143 struct stmpe *stmpe = keypad->stmpe; in stmpe_keypad_read_data()
164 struct stmpe_keypad *keypad = dev; in stmpe_keypad_irq() local
165 struct input_dev *input = keypad->input; in stmpe_keypad_irq()
166 const struct stmpe_keypad_variant *variant = keypad->variant; in stmpe_keypad_irq()
171 ret = stmpe_keypad_read_data(keypad, fifo); in stmpe_keypad_irq()
187 input_report_key(input, keypad->keymap[code], !up); in stmpe_keypad_irq()
194 static int stmpe_keypad_altfunc_init(struct stmpe_keypad *keypad) in stmpe_keypad_altfunc_init() argument
196 const struct stmpe_keypad_variant *variant = keypad->variant; in stmpe_keypad_altfunc_init()
199 struct stmpe *stmpe = keypad->stmpe; in stmpe_keypad_altfunc_init()
207 * Figure out which pins need to be set to the keypad alternate in stmpe_keypad_altfunc_init()
211 * for the keypad. in stmpe_keypad_altfunc_init()
213 * keypad->{cols,rows} are a bitmask of which pins (of the ones useable in stmpe_keypad_altfunc_init()
214 * for the keypad) are used on the board. in stmpe_keypad_altfunc_init()
220 if (keypad->cols & (1 << i)) { in stmpe_keypad_altfunc_init()
231 if (keypad->rows & (1 << i)) in stmpe_keypad_altfunc_init()
242 * On STMPE24xx, set pin bias to pull-up on all keypad input in stmpe_keypad_altfunc_init()
264 static int stmpe_keypad_chip_init(struct stmpe_keypad *keypad) in stmpe_keypad_chip_init() argument
266 const struct stmpe_keypad_variant *variant = keypad->variant; in stmpe_keypad_chip_init()
267 struct stmpe *stmpe = keypad->stmpe; in stmpe_keypad_chip_init()
270 if (keypad->debounce_ms > STMPE_KEYPAD_MAX_DEBOUNCE) in stmpe_keypad_chip_init()
273 if (keypad->scan_count > STMPE_KEYPAD_MAX_SCAN_COUNT) in stmpe_keypad_chip_init()
280 ret = stmpe_keypad_altfunc_init(keypad); in stmpe_keypad_chip_init()
284 ret = stmpe_reg_write(stmpe, STMPE_KPC_COL, keypad->cols); in stmpe_keypad_chip_init()
288 ret = stmpe_reg_write(stmpe, STMPE_KPC_ROW_LSB, keypad->rows); in stmpe_keypad_chip_init()
295 keypad->rows >> 8); in stmpe_keypad_chip_init()
302 keypad->scan_count << 4); in stmpe_keypad_chip_init()
310 (keypad->debounce_ms << 1)); in stmpe_keypad_chip_init()
313 static void stmpe_keypad_fill_used_pins(struct stmpe_keypad *keypad, in stmpe_keypad_fill_used_pins() argument
322 if (keypad->keymap[code] != KEY_RESERVED) { in stmpe_keypad_fill_used_pins()
323 keypad->rows |= 1 << row; in stmpe_keypad_fill_used_pins()
324 keypad->cols |= 1 << col; in stmpe_keypad_fill_used_pins()
334 struct stmpe_keypad *keypad; in stmpe_keypad_probe() local
345 keypad = devm_kzalloc(&pdev->dev, sizeof(struct stmpe_keypad), in stmpe_keypad_probe()
347 if (!keypad) in stmpe_keypad_probe()
350 keypad->stmpe = stmpe; in stmpe_keypad_probe()
351 keypad->variant = &stmpe_keypad_variants[stmpe->partnum]; in stmpe_keypad_probe()
353 of_property_read_u32(np, "debounce-interval", &keypad->debounce_ms); in stmpe_keypad_probe()
354 of_property_read_u32(np, "st,scan-count", &keypad->scan_count); in stmpe_keypad_probe()
355 keypad->no_autorepeat = of_property_read_bool(np, "st,no-autorepeat"); in stmpe_keypad_probe()
361 input->name = "STMPE keypad"; in stmpe_keypad_probe()
370 keypad->keymap, input); in stmpe_keypad_probe()
375 if (!keypad->no_autorepeat) in stmpe_keypad_probe()
378 stmpe_keypad_fill_used_pins(keypad, rows, cols); in stmpe_keypad_probe()
380 keypad->input = input; in stmpe_keypad_probe()
382 error = stmpe_keypad_chip_init(keypad); in stmpe_keypad_probe()
388 IRQF_ONESHOT, "stmpe-keypad", keypad); in stmpe_keypad_probe()
401 platform_set_drvdata(pdev, keypad); in stmpe_keypad_probe()
408 struct stmpe_keypad *keypad = platform_get_drvdata(pdev); in stmpe_keypad_remove() local
410 stmpe_disable(keypad->stmpe, STMPE_BLOCK_KEYPAD); in stmpe_keypad_remove()
416 .driver.name = "stmpe-keypad",
424 MODULE_DESCRIPTION("STMPExxxx keypad driver");