Lines Matching +full:short +full:- +full:press +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0-only
3 * max7359_keypad.c - MAX7359 Key Switch Controller Driver
10 * Datasheet: http://www.maxim-ic.com/quick_view2.cfm/qv_pk/5456
47 * Autosleep register values (ms)
58 unsigned short keycodes[MAX7359_MAX_KEY_NUM];
69 dev_err(&client->dev, "%s: reg 0x%x, val 0x%x, err %d\n", in max7359_write_reg()
79 dev_err(&client->dev, "%s: reg 0x%x, err %d\n", in max7359_read_reg()
84 /* runs in an IRQ thread -- can (and will!) sleep */
88 struct input_dev *input_dev = keypad->input_dev; in max7359_interrupt()
91 val = max7359_read_reg(keypad->client, MAX7359_REG_KEYFIFO); in max7359_interrupt()
98 dev_dbg(&keypad->client->dev, in max7359_interrupt()
99 "key[%d:%d] %s\n", row, col, release ? "release" : "press"); in max7359_interrupt()
102 input_report_key(input_dev, keypad->keycodes[code], !release); in max7359_interrupt()
110 * If no keys are pressed, enter sleep mode for 8192 ms. And if any
120 * Autosleep just for 256 ms.
131 max7359_take_catnap(keypad->client); in max7359_open()
140 max7359_fall_deepsleep(keypad->client); in max7359_close()
147 MAX7359_CFG_WAKEUP); /* Key press wakeup enable */ in max7359_initialize()
149 /* Full key-scan functionality */ in max7359_initialize()
161 dev_get_platdata(&client->dev); in max7359_probe()
167 if (!client->irq) { in max7359_probe()
168 dev_err(&client->dev, "The irq number should not be zero\n"); in max7359_probe()
169 return -EINVAL; in max7359_probe()
175 dev_err(&client->dev, "failed to detect device\n"); in max7359_probe()
176 return -ENODEV; in max7359_probe()
179 dev_dbg(&client->dev, "keys FIFO is 0x%02x\n", ret); in max7359_probe()
181 keypad = devm_kzalloc(&client->dev, sizeof(struct max7359_keypad), in max7359_probe()
184 dev_err(&client->dev, "failed to allocate memory\n"); in max7359_probe()
185 return -ENOMEM; in max7359_probe()
188 input_dev = devm_input_allocate_device(&client->dev); in max7359_probe()
190 dev_err(&client->dev, "failed to allocate input device\n"); in max7359_probe()
191 return -ENOMEM; in max7359_probe()
194 keypad->client = client; in max7359_probe()
195 keypad->input_dev = input_dev; in max7359_probe()
197 input_dev->name = client->name; in max7359_probe()
198 input_dev->id.bustype = BUS_I2C; in max7359_probe()
199 input_dev->open = max7359_open; in max7359_probe()
200 input_dev->close = max7359_close; in max7359_probe()
201 input_dev->dev.parent = &client->dev; in max7359_probe()
203 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); in max7359_probe()
204 input_dev->keycodesize = sizeof(keypad->keycodes[0]); in max7359_probe()
205 input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes); in max7359_probe()
206 input_dev->keycode = keypad->keycodes; in max7359_probe()
214 keypad->keycodes, in max7359_probe()
217 dev_err(&client->dev, "failed to build keymap\n"); in max7359_probe()
221 error = devm_request_threaded_irq(&client->dev, client->irq, NULL, in max7359_probe()
224 client->name, keypad); in max7359_probe()
226 dev_err(&client->dev, "failed to register interrupt\n"); in max7359_probe()
233 dev_err(&client->dev, "failed to register input device\n"); in max7359_probe()
240 device_init_wakeup(&client->dev, 1); in max7359_probe()
251 if (device_may_wakeup(&client->dev)) in max7359_suspend()
252 enable_irq_wake(client->irq); in max7359_suspend()
261 if (device_may_wakeup(&client->dev)) in max7359_resume()
262 disable_irq_wake(client->irq); in max7359_resume()