Lines Matching +full:no +full:- +full:autorepeat

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * twl4030_keypad.c - driver for 8x8 keypad controller in twl4030 chips
8 * Code re-written for 2430SDP by:
27 * events, since it uses only the always-on 32KiHz oscillator, and has
29 * multi-key combinations.
50 bool autorepeat; member
59 /*----------------------------------------------------------------------*/
100 #define KEYP_PERIOD_US(t, prescale) ((t) / (31 << ((prescale) + 1)) - 1)
123 /*----------------------------------------------------------------------*/
131 dev_warn(kp->dbg_dev, in twl4030_kpread()
132 "Couldn't read TWL4030: %X - ret %d[%x]\n", in twl4030_kpread()
143 dev_warn(kp->dbg_dev, in twl4030_kpwrite_u8()
144 "Could not write TWL4030: %X - ret %d[%x]\n", in twl4030_kpwrite_u8()
159 return 1 << kp->n_cols; in twl4030_col_xlate()
161 return col & ((1 << kp->n_cols) - 1); in twl4030_col_xlate()
169 KEYP_FULL_CODE_7_0, kp->n_rows); in twl4030_read_kp_matrix_state()
171 for (row = 0; row < kp->n_rows; row++) in twl4030_read_kp_matrix_state()
182 for (i = 0; i < kp->n_rows; i++) { in twl4030_is_in_ghost_state()
196 struct input_dev *input = kp->input; in twl4030_kp_scan()
214 for (row = 0; row < kp->n_rows; row++) { in twl4030_kp_scan()
215 int changed = new_state[row] ^ kp->kp_state[row]; in twl4030_kp_scan()
221 for (col = 0; col < kp->n_cols + 1; col++) { in twl4030_kp_scan()
227 dev_dbg(kp->dbg_dev, "key [%d:%d] %s\n", row, col, in twl4030_kp_scan()
233 input_report_key(input, kp->keymap[code], in twl4030_kp_scan()
236 kp->kp_state[row] = new_state[row]; in twl4030_kp_scan()
270 /* Enable controller, with hardware decoding but not autorepeat */ in twl4030_kp_program()
274 return -EIO; in twl4030_kp_program()
284 return -EIO; in twl4030_kp_program()
289 return -EIO; in twl4030_kp_program()
294 return -EIO; in twl4030_kp_program()
299 return -EIO; in twl4030_kp_program()
302 return -EIO; in twl4030_kp_program()
305 * Enable Clear-on-Read; disable remembering events that fire in twl4030_kp_program()
310 return -EIO; in twl4030_kp_program()
313 if (twl4030_read_kp_matrix_state(kp, kp->kp_state) < 0) in twl4030_kp_program()
314 return -EIO; in twl4030_kp_program()
325 struct twl4030_keypad_data *pdata = dev_get_platdata(&pdev->dev); in twl4030_kp_probe()
332 kp = devm_kzalloc(&pdev->dev, sizeof(*kp), GFP_KERNEL); in twl4030_kp_probe()
334 return -ENOMEM; in twl4030_kp_probe()
336 input = devm_input_allocate_device(&pdev->dev); in twl4030_kp_probe()
338 return -ENOMEM; in twl4030_kp_probe()
341 kp->dbg_dev = &pdev->dev; in twl4030_kp_probe()
342 kp->input = input; in twl4030_kp_probe()
345 input->name = "TWL4030 Keypad"; in twl4030_kp_probe()
346 input->phys = "twl4030_keypad/input0"; in twl4030_kp_probe()
348 input->id.bustype = BUS_HOST; in twl4030_kp_probe()
349 input->id.vendor = 0x0001; in twl4030_kp_probe()
350 input->id.product = 0x0001; in twl4030_kp_probe()
351 input->id.version = 0x0003; in twl4030_kp_probe()
354 if (!pdata->rows || !pdata->cols || !pdata->keymap_data) { in twl4030_kp_probe()
355 dev_err(&pdev->dev, "Missing platform_data\n"); in twl4030_kp_probe()
356 return -EINVAL; in twl4030_kp_probe()
359 kp->n_rows = pdata->rows; in twl4030_kp_probe()
360 kp->n_cols = pdata->cols; in twl4030_kp_probe()
361 kp->autorepeat = pdata->rep; in twl4030_kp_probe()
362 keymap_data = pdata->keymap_data; in twl4030_kp_probe()
364 error = matrix_keypad_parse_properties(&pdev->dev, &kp->n_rows, in twl4030_kp_probe()
365 &kp->n_cols); in twl4030_kp_probe()
369 kp->autorepeat = true; in twl4030_kp_probe()
372 if (kp->n_rows > TWL4030_MAX_ROWS || kp->n_cols > TWL4030_MAX_COLS) { in twl4030_kp_probe()
373 dev_err(&pdev->dev, in twl4030_kp_probe()
375 return -EINVAL; in twl4030_kp_probe()
378 kp->irq = platform_get_irq(pdev, 0); in twl4030_kp_probe()
379 if (kp->irq < 0) in twl4030_kp_probe()
380 return kp->irq; in twl4030_kp_probe()
385 kp->keymap, input); in twl4030_kp_probe()
387 dev_err(kp->dbg_dev, "Failed to build keymap\n"); in twl4030_kp_probe()
393 if (kp->autorepeat) in twl4030_kp_probe()
394 __set_bit(EV_REP, input->evbit); in twl4030_kp_probe()
398 dev_err(kp->dbg_dev, in twl4030_kp_probe()
413 error = devm_request_threaded_irq(&pdev->dev, kp->irq, NULL, do_kp_irq, in twl4030_kp_probe()
414 0, pdev->name, kp); in twl4030_kp_probe()
416 dev_info(kp->dbg_dev, "request_irq failed for irq no=%d: %d\n", in twl4030_kp_probe()
417 kp->irq, error); in twl4030_kp_probe()
424 /* mask all events - we don't care about the result */ in twl4030_kp_probe()
426 return -EIO; in twl4030_kp_probe()
434 { .compatible = "ti,twl4030-keypad" },
441 * NOTE: twl4030 are multi-function devices connected via I2C.