Lines Matching +full:pull +full:- +full:ups

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) ST-Ericsson SA 2010
5 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
61 * struct stmpe_keypad_variant - model-specific attributes
63 * auto-increments on multiple read
64 * @set_pullup: whether the pins need to have their pull-ups set
90 .col_gpios = 0x000ff, /* GPIO 0 - 7 */
91 .row_gpios = 0x0ff00, /* GPIO 8 - 15 */
100 .col_gpios = 0x0000ff, /* GPIO 0 - 7*/
101 .row_gpios = 0x1f7f00, /* GPIO 8-14, 16-20 */
110 .col_gpios = 0x0000ff, /* GPIO 0 - 7*/
111 .row_gpios = 0x1fef00, /* GPIO 8-14, 16-20 */
116 * struct stmpe_keypad - STMPE keypad state container
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()
148 if (variant->auto_increment) in stmpe_keypad_read_data()
150 variant->num_data, data); in stmpe_keypad_read_data()
152 for (i = 0; i < variant->num_data; i++) { in stmpe_keypad_read_data()
166 struct input_dev *input = keypad->input; in stmpe_keypad_irq()
167 const struct stmpe_keypad_variant *variant = keypad->variant; in stmpe_keypad_irq()
176 for (i = 0; i < variant->num_normal_data; i++) { in stmpe_keypad_irq()
188 input_report_key(input, keypad->keymap[code], !up); in stmpe_keypad_irq()
197 const struct stmpe_keypad_variant *variant = keypad->variant; in stmpe_keypad_altfunc_init()
198 unsigned int col_gpios = variant->col_gpios; in stmpe_keypad_altfunc_init()
199 unsigned int row_gpios = variant->row_gpios; in stmpe_keypad_altfunc_init()
200 struct stmpe *stmpe = keypad->stmpe; in stmpe_keypad_altfunc_init()
201 u8 pureg = stmpe->regs[STMPE_IDX_GPPUR_LSB]; in stmpe_keypad_altfunc_init()
214 * keypad->{cols,rows} are a bitmask of which pins (of the ones useable in stmpe_keypad_altfunc_init()
218 for (i = 0; i < variant->max_cols; i++) { in stmpe_keypad_altfunc_init()
221 if (keypad->cols & (1 << i)) { in stmpe_keypad_altfunc_init()
229 for (i = 0; i < variant->max_rows; 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()
245 * and placed at GPIO0-7 so only the LSB of the pull up register in stmpe_keypad_altfunc_init()
248 if (variant->set_pullup) { in stmpe_keypad_altfunc_init()
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()
272 return -EINVAL; in stmpe_keypad_chip_init()
274 if (keypad->scan_count > STMPE_KEYPAD_MAX_SCAN_COUNT) in stmpe_keypad_chip_init()
275 return -EINVAL; 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()
293 if (variant->max_rows > 8) { 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()
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()
333 struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); in stmpe_keypad_probe()
334 struct device_node *np = pdev->dev.of_node; in stmpe_keypad_probe()
346 keypad = devm_kzalloc(&pdev->dev, sizeof(struct stmpe_keypad), in stmpe_keypad_probe()
349 return -ENOMEM; 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()
358 input = devm_input_allocate_device(&pdev->dev); in stmpe_keypad_probe()
360 return -ENOMEM; in stmpe_keypad_probe()
362 input->name = "STMPE keypad"; in stmpe_keypad_probe()
363 input->id.bustype = BUS_I2C; in stmpe_keypad_probe()
364 input->dev.parent = &pdev->dev; in stmpe_keypad_probe()
366 error = matrix_keypad_parse_properties(&pdev->dev, &rows, &cols); in stmpe_keypad_probe()
371 keypad->keymap, input); in stmpe_keypad_probe()
376 if (!keypad->no_autorepeat) in stmpe_keypad_probe()
377 __set_bit(EV_REP, input->evbit); in stmpe_keypad_probe()
381 keypad->input = input; in stmpe_keypad_probe()
387 error = devm_request_threaded_irq(&pdev->dev, irq, in stmpe_keypad_probe()
389 IRQF_ONESHOT, "stmpe-keypad", keypad); in stmpe_keypad_probe()
391 dev_err(&pdev->dev, "unable to get irq: %d\n", error); in stmpe_keypad_probe()
397 dev_err(&pdev->dev, in stmpe_keypad_probe()
411 stmpe_disable(keypad->stmpe, STMPE_BLOCK_KEYPAD); in stmpe_keypad_remove()
415 .driver.name = "stmpe-keypad",